*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

#ambientCanvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: none;
  z-index: 9999;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: #f3f2ed;
  color: #111;
  font-family: 'Inter', -apple-system, sans-serif;
  font-weight: 300;
  line-height: 1.6;
}

/* ─── Layout ─── */

main {
  max-width: 560px;
  margin: 0 auto;
  padding: 96px 32px 100px;
  display: flex;
  flex-direction: column;
  gap: 68px;
}

/* ─── Header ─── */

header {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.85rem;
  font-weight: 400;
  letter-spacing: -0.04em;
  color: #111;
  line-height: 1;
}

.role {
  font-size: 0.76rem;
  font-weight: 300;
  color: #bbb;
  letter-spacing: 0.01em;
}


/* ─── About ─── */

.about p {
  font-size: 0.9rem;
  font-weight: 300;
  color: #555;
  line-height: 1.85;
}

/* ─── Section label ─── */

h2 {
  font-size: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #ccc;
  margin-bottom: 20px;
}

/* ─── Skills ─── */

/* ─── Skills ticker ─── */

.skill-ticker {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  /* fade edges */
  -webkit-mask-image: linear-gradient(to right, transparent 0%, #000 12%, #000 88%, transparent 100%);
  mask-image:         linear-gradient(to right, transparent 0%, #000 12%, #000 88%, transparent 100%);
}

.skill-track {
  display: flex;
  gap: 10px;
  width: max-content;
  animation: ticker-left 22s linear infinite;
}

.skill-track.reverse {
  animation: ticker-right 22s linear infinite;
}

.skill-ticker:hover .skill-track {
  animation-play-state: paused;
}

@keyframes ticker-left {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

@keyframes ticker-right {
  from { transform: translateX(-50%); }
  to   { transform: translateX(0); }
}

.skill {
  font-size: 0.8rem;
  font-weight: 300;
  color: #555;
  cursor: pointer;
  padding: 6px 14px;
  border: 1px solid #dddbd4;
  border-radius: 2px;
  user-select: none;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
  outline: none;
  flex-shrink: 0;
}

.skill:hover {
  color: #111;
  border-color: #111;
}

.skill:focus-visible {
  outline: 1px solid #111;
  outline-offset: 3px;
}

/* ─── Skill active state ─── */

.skill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.skill.is-active {
  background: #111;
  color: #fff;
  border-color: #111;
}

.skill-icon {
  width: 11px;
  height: 11px;
  flex-shrink: 0;
  display: block;
  opacity: 0;
  transform: scale(0.4) rotate(-15deg);
  transition:
    opacity 0.25s ease 0.07s,
    transform 0.35s cubic-bezier(0.16, 1, 0.3, 1) 0.07s;
}

.skill.is-active .skill-icon {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}


/* ─── Experience Timeline ─── */

.experience { display: flex; flex-direction: column; }

.timeline {
  display: flex;
  flex-direction: column;
  position: relative;
  margin-top: 6px;
}

.timeline::before {
  content: '';
  position: absolute;
  top: 6px;
  bottom: 0;
  left: 3px;
  width: 1px;
  background: #e5e3db;
}

.timeline-item {
  position: relative;
  padding-left: 20px;
  padding-bottom: 24px;
}
.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
  position: absolute;
  left: 0;
  top: 6px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  border: 1px solid #111;
  box-shadow: 0 0 0 2px #f3f2ed;
}

.timeline-content {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.timeline-role {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 0.95rem;
  font-weight: 500;
  color: #111;
  letter-spacing: -0.01em;
}

.timeline-date {
  font-size: 0.72rem;
  color: #888;
  white-space: nowrap;
}

.timeline-company {
  font-size: 0.76rem;
  font-weight: 500;
  color: #555;
}

.timeline-desc {
  margin-top: 6px;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #444;
}

/* ─── Certifications & Awards ─── */

.honours {
  display: flex;
  flex-direction: column;
}

.honour-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 0;
  border-top: 1px solid #e5e3db;
}

.honour-item:last-child {
  border-bottom: 1px solid #e5e3db;
}

.honour-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.honour-title {
  font-size: 0.88rem;
  font-weight: 400;
  color: #111;
  letter-spacing: -0.01em;
}

.honour-sub {
  font-size: 0.74rem;
  font-weight: 300;
  color: #aaa;
}

.honour-meta {
  font-size: 0.7rem;
  font-weight: 300;
  color: #bbb;
  white-space: nowrap;
  padding-top: 2px;
}

.honour-link {
  font-size: 0.72rem;
  font-weight: 300;
  color: #bbb;
  text-decoration: none;
  white-space: nowrap;
  padding-top: 2px;
  transition: color 0.15s;
  flex-shrink: 0;
  /* reset for when used as <button> */
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  padding: 0;
}

.honour-link:hover {
  color: #111;
}

/* ─── Projects ─── */


.projects {
  display: flex;
  flex-direction: column;
}

.project-card {
  display: block;
  text-decoration: none;
  color: inherit;
  padding: 22px 0;
  border-top: 1px solid #e5e3db;
  transition: padding-left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.project-card:last-child {
  border-bottom: 1px solid #e5e3db;
}

.project-card:hover {
  padding-left: 10px;
}

.project-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 9px;
}

.project-title {
  font-size: 0.92rem;
  font-weight: 400;
  letter-spacing: -0.01em;
  color: #111;
}

.project-badge {
  font-size: 0.55rem;
  font-weight: 500;
  padding: 2px 6px;
  background: #edecea;
  color: #888;
  border: 1px solid #e5e3db;
  border-radius: 4px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-left: 8px;
}

.is-placeholder .project-title {
  color: #ccc;
  font-style: italic;
  font-weight: 300;
}

.project-arrow {
  font-size: 0.85rem;
  color: #ddd;
  transition: color 0.2s, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.project-card:hover .project-arrow {
  color: #111;
  transform: translate(3px, -3px);
}

.project-desc {
  font-size: 0.8rem;
  font-weight: 300;
  color: #888;
  line-height: 1.75;
  margin-bottom: 11px;
}

.is-placeholder .project-desc {
  color: #d0d0ce;
}

.project-stack {
  font-size: 0.68rem;
  font-weight: 300;
  color: #bbb;
  letter-spacing: 0.04em;
}

/* ─── Writing / Blog ─── */

.writing {
  display: flex;
  flex-direction: column;
}

.writing-list {
  display: flex;
  flex-direction: column;
  margin-top: 4px;
}

.writing-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid #e5e3db;
  text-decoration: none;
  color: inherit;
  transition: padding-left 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.writing-row:last-child {
  border-bottom: 1px solid #e5e3db;
}

.writing-row:hover {
  padding-left: 8px;
}

.writing-row:hover .writing-arrow {
  color: #111;
  transform: translate(3px, -3px);
}

.writing-title {
  font-size: 0.88rem;
  font-weight: 300;
  color: #111;
  letter-spacing: -0.01em;
  flex: 1;
}

.writing-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.writing-date {
  font-size: 0.72rem;
  color: #bbb;
  font-weight: 300;
  white-space: nowrap;
}

.writing-arrow {
  font-size: 0.8rem;
  color: #ddd;
  transition: color 0.2s, transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Loading dot for writing list */
.writing-loading {
  display: flex;
  justify-content: flex-start;
  padding: 20px 0;
}

.writing-loading-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #ddd;
  animation: pulse 1.2s ease-in-out infinite;
}

.blog-see-all {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-top: 1px solid #e5e3db;
  padding: 14px 0;
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 300;
  color: #bbb;
  cursor: pointer;
  letter-spacing: 0.01em;
  transition: color 0.15s;
}

.blog-see-all:hover { color: #111; }

/* ─── Footer ─── */

footer {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  padding-top: 28px;
}

footer a {
  font-size: 0.75rem;
  font-weight: 300;
  color: #aaa;
  text-decoration: none;
  transition: color 0.15s;
}

footer a:hover {
  color: #111;
}

/* ─── Certificate modal ─── */

.cert-modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(17, 17, 17, 0);
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  pointer-events: none;
  transition:
    background 0.35s ease,
    backdrop-filter 0.35s ease;
}

.cert-modal.is-open {
  background: rgba(17, 17, 17, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  pointer-events: all;
}

.cert-modal-card {
  background: #f3f2ed;
  border-radius: 4px;
  width: 100%;
  max-width: 820px;
  height: min(85vh, 640px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(0.98);
  transition:
    opacity 0.35s cubic-bezier(0.16, 1, 0.3, 1) 0.05s,
    transform 0.4s cubic-bezier(0.16, 1, 0.3, 1) 0.05s;
}

.cert-modal.is-open .cert-modal-card {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.cert-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid #e9e7e0;
  flex-shrink: 0;
}

.cert-modal-title {
  font-size: 0.78rem;
  font-weight: 400;
  color: #111;
  letter-spacing: -0.01em;
}

.cert-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.8rem;
  color: #bbb;
  padding: 4px 6px;
  line-height: 1;
  font-family: inherit;
  transition: color 0.15s;
  border-radius: 2px;
}

.cert-modal-close:hover {
  color: #111;
}

.cert-modal-body {
  flex: 1;
  overflow: hidden;
}

.cert-modal-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

.cert-modal-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background-color: transparent;
}


/* ─── Post Reader Modal ─── */

.post-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: #f3f2ed;
  overflow-y: auto;
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px);
  transition: opacity 0.3s ease, transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.post-modal.is-open {
  opacity: 1;
  pointer-events: all;
  transform: translateY(0);
}

.post-modal-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 24px 96px;
}

.post-modal-header {
  margin-bottom: 48px;
}

.post-modal-back {
  font-size: 0.78rem;
  font-weight: 300;
  color: #aaa;
  text-decoration: none;
  letter-spacing: 0.01em;
  transition: color 0.15s;
}

.post-modal-back:hover { color: #111; }

/* post body typography */
.post-modal-body h1 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1.7rem;
  font-weight: 400;
  letter-spacing: -0.03em;
  color: #111;
  line-height: 1.2;
  margin: 0 0 20px;
}

.post-modal-body h2 {
  font-family: 'Space Grotesk', sans-serif;
  font-size: 1rem;
  font-weight: 500;
  color: #111;
  margin: 36px 0 12px;
  letter-spacing: -0.01em;
}

.post-modal-body h3 {
  font-size: 0.9rem;
  font-weight: 500;
  color: #333;
  margin: 24px 0 8px;
}

.post-modal-body p {
  font-size: 0.92rem;
  font-weight: 300;
  line-height: 1.85;
  color: #444;
  margin: 0 0 18px;
}

.post-modal-body em { color: #888; font-style: italic; }

.post-modal-body strong { font-weight: 500; color: #111; }

.post-modal-body a { color: #111; text-underline-offset: 3px; }

.post-modal-body hr {
  border: none;
  border-top: 1px solid #e5e3db;
  margin: 36px 0;
}

.post-modal-body blockquote {
  margin: 0 0 18px;
  padding: 0 0 0 16px;
  border-left: 2px solid #e5e3db;
  color: #888;
  font-style: italic;
}

.post-modal-body blockquote p { color: #888; }

.post-modal-body pre {
  background: #edecea;
  border-radius: 4px;
  padding: 16px;
  overflow-x: auto;
  margin: 0 0 18px;
}

.post-modal-body code {
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  font-size: 0.78rem;
  background: #e9e8e2;
  padding: 2px 5px;
  border-radius: 3px;
  color: #333;
}

.post-modal-body pre code {
  background: none;
  padding: 0;
  font-size: 0.8rem;
  color: #444;
}

.post-modal-body ul,
.post-modal-body ol {
  font-size: 0.9rem;
  font-weight: 300;
  color: #444;
  line-height: 1.8;
  padding-left: 20px;
  margin: 0 0 18px;
}

.post-modal-body img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  margin: 8px 0 24px;
  display: block;
}

.post-modal-body table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  font-weight: 300;
  margin: 0 0 24px;
}

.post-modal-body th {
  text-align: left;
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #888;
  border-bottom: 1.5px solid #e5e3db;
  padding: 8px 12px 8px 0;
}

.post-modal-body td {
  padding: 10px 12px 10px 0;
  border-bottom: 1px solid #eeede8;
  color: #333;
  line-height: 1.6;
  vertical-align: top;
}

.post-modal-body tr:last-child td {
  border-bottom: none;
}


/* Loading dot */
.post-modal-loading {
  display: flex;
  justify-content: center;
  padding: 60px 0;
}

.post-modal-loading-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #ddd;
  animation: pulse 1.2s ease-in-out infinite;
}

/* ─── Mobile ─── */

@media (max-width: 480px) {
  main {
    padding: 60px 24px 72px;
    gap: 52px;
  }
  h1 {
    font-size: 1.55rem;
  }
}

/* ─── SSG Fallback Pages ─── */

.ssg-page {
  max-width: 680px;
  margin: 0 auto;
  padding: 64px 32px 100px;
}

.ssg-nav {
  margin-bottom: 48px;
}

.ssg-back {
  font-size: 0.85rem;
  font-weight: 400;
  color: #888;
  text-decoration: none;
  transition: color 0.15s;
}

.ssg-back:hover {
  color: #111;
}

.ssg-content {
  /* Inherits from .post-modal-body but we reset padding */
  padding: 0;
}

/* ─── Search / Archive Modal ─── */

.search-modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  background: rgba(20, 18, 14, 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 10vh 24px 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.search-modal.is-open {
  opacity: 1;
  pointer-events: all;
}

.search-modal-inner {
  background: #f3f2ed;
  border-radius: 10px;
  width: 100%;
  max-width: 620px;
  max-height: 75vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(-12px);
  transition: transform 0.2s ease;
  box-shadow: 0 24px 80px rgba(0,0,0,0.14);
}

.search-modal.is-open .search-modal-inner {
  transform: translateY(0);
}

.search-modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid #e5e3db;
  flex-shrink: 0;
}

.search-input-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-icon {
  color: #aaa;
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: 'Inter', sans-serif;
  font-size: 0.9rem;
  font-weight: 300;
  color: #111;
  outline: none;
  caret-color: #111;
}

.search-input::placeholder {
  color: #bbb;
}

.search-modal-close {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.8rem;
  color: #aaa;
  padding: 4px 6px;
  line-height: 1;
  transition: color 0.15s;
  flex-shrink: 0;
}

.search-modal-close:hover {
  color: #111;
}

.search-meta {
  font-size: 0.72rem;
  font-weight: 400;
  color: #aaa;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 10px 20px 8px;
  flex-shrink: 0;
}

.search-results {
  overflow-y: auto;
  padding: 0 8px 12px;
  flex: 1;
}

.search-results .writing-row {
  border-radius: 6px;
  padding: 12px;
  border-bottom: none;
}

.search-results .writing-row:hover {
  background: #edecea;
}

.search-results mark {
  background: transparent;
  color: #111;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2px;
}

.search-empty {
  font-size: 0.85rem;
  font-weight: 300;
  color: #aaa;
  padding: 24px 12px;
  text-align: center;
}

.search-empty strong {
  color: #777;
  font-weight: 400;
}


