/* ==========================================================================
   Portfolio site — shared styles
   Clean & minimal, content-forward. Edit the tokens in :root to reskin.
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Source+Serif+4:opsz,wght@8..60,400;8..60,600&display=swap');

:root {
  /* Color tokens — light theme */
  --color-bg: #fdfcfa;
  --color-bg-alt: #f4f2ee;
  --color-ink: #1c1b19;
  --color-ink-soft: #55524c;
  --color-ink-faint: #8a867d;
  --color-border: #e4e0d8;
  --color-accent: #6b46c1;
  --color-accent-soft: #f0eafb;
  --color-accent-contrast: #fdfcfa;

  /* Type */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-display: 'Source Serif 4', Georgia, 'Times New Roman', serif;

  /* Layout */
  --max-width: 960px;
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: 6rem;
  --radius: 6px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #16171a;
    --color-bg-alt: #1e2023;
    --color-ink: #f2f0ea;
    --color-ink-soft: #b8b5ad;
    --color-ink-faint: #7d7a72;
    --color-border: #33352f9c;
    --color-border: #34362f;
    --color-accent: #b298e8;
    --color-accent-soft: #2b2438;
    --color-accent-contrast: #16171a;
  }
}

:root[data-theme="dark"] {
  --color-bg: #16171a;
  --color-bg-alt: #1e2023;
  --color-ink: #f2f0ea;
  --color-ink-soft: #b8b5ad;
  --color-ink-faint: #7d7a72;
  --color-border: #34362f;
  --color-accent: #b298e8;
  --color-accent-soft: #2b2438;
  --color-accent-contrast: #16171a;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }

a { color: inherit; }

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-3);
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 var(--space-2);
}

h1 { font-size: clamp(2.2rem, 4vw, 3.2rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); }
h3 { font-size: 1.3rem; }

p { margin: 0 0 var(--space-2); color: var(--color-ink-soft); }

.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-accent);
  font-weight: 600;
  margin-bottom: var(--space-1);
}

/* ---- Header / nav ---- */
.site-header {
  border-bottom: 1px solid var(--color-border);
  position: sticky;
  top: 0;
  background: var(--color-bg);
  z-index: 50;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-2);
  padding-bottom: var(--space-2);
}

.logo {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  text-decoration: none;
  color: var(--color-ink);
}

.logo span { color: var(--color-accent); }

nav.main-nav {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.nav-links {
  display: flex;
  gap: var(--space-3);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--color-ink-soft);
  padding: 0.3rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--color-ink);
  border-bottom-color: var(--color-accent);
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.nav-toggle svg { width: 18px; height: 18px; stroke: var(--color-ink); }

@media (max-width: 640px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    flex-direction: column;
    gap: 0;
    padding: var(--space-2) var(--space-3);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { display: block; padding: var(--space-2) 0; border-bottom: 1px solid var(--color-border); }
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem 1.3rem;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.12s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:hover { transform: translateY(-1px); }

.btn-primary { background: var(--color-accent); color: var(--color-accent-contrast); }
.btn-primary:hover { background: var(--color-ink); }

.btn-outline { border-color: var(--color-border); color: var(--color-ink); }
.btn-outline:hover { border-color: var(--color-accent); color: var(--color-accent); }

.btn-row { display: flex; gap: var(--space-2); flex-wrap: wrap; }

/* ---- Sections ---- */
section { padding: var(--space-6) 0; }
section.tight { padding: var(--space-5) 0; }
.alt-bg { background: var(--color-bg-alt); }

.section-head { max-width: 640px; margin-bottom: var(--space-4); }

/* ---- Hero ---- */
.hero { padding: var(--space-6) 0 var(--space-5); }
.hero-tag { color: var(--color-ink-soft); font-size: 1.1rem; max-width: 560px; }
.hero-photo {
  width: 96px; height: 96px; border-radius: 50%;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  margin-bottom: var(--space-3);
  display: flex; align-items: center; justify-content: center;
  color: var(--color-ink-faint); font-size: 0.7rem; text-align: center;
}

/* ---- Word-cycle graphic ---- */
.word-cycle {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.7rem, 3.6vw, 2.3rem);
  color: var(--color-ink);
  margin: var(--space-2) 0 var(--space-3);
  white-space: nowrap;
}
.cycle-word {
  display: inline-block;
  color: var(--color-accent);
}
.cycle-word.is-final {
  animation: cycle-land 0.45s cubic-bezier(0.2, 0.8, 0.3, 1.4);
}
@keyframes cycle-land {
  0% { transform: scale(1.25); opacity: 0.4; }
  100% { transform: scale(1); opacity: 1; }
}

/* ---- Cards / grid ---- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: var(--space-3);
}

.card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-3);
  background: var(--color-bg);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.card:hover { border-color: var(--color-accent); transform: translateY(-2px); }

.card-thumb {
  aspect-ratio: 16 / 10;
  border-radius: calc(var(--radius) - 2px);
  background: var(--color-bg-alt);
  border: 1px dashed var(--color-border);
  display: flex; align-items: center; justify-content: center;
  color: var(--color-ink-faint);
  font-size: 0.8rem;
  margin-bottom: var(--space-1);
  text-align: center;
  padding: var(--space-2);
}

/* Photo/screenshot thumbnail — absolute positioning guarantees the image
   fills and crops to the 16:10 box regardless of its natural aspect ratio
   (percentage-height on a flex child doesn't reliably resolve against an
   aspect-ratio-derived height, which let tall portrait images render at
   their full natural height instead of being cropped). */
.card-thumb.has-image {
  position: relative;
  overflow: hidden;
  padding: 0;
  border-style: solid;
}
.card-thumb.has-image img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.demo-thumb { position: relative; padding: 0; overflow: hidden; }
.demo-thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.demo-thumb-cover { opacity: 1; transition: opacity 0.2s ease; }
.demo-thumb-gif { opacity: 0; transition: opacity 0.2s ease; }
.card:hover .demo-thumb-cover { opacity: 0; }
.card:hover .demo-thumb-gif { opacity: 1; }

.tag-row { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: var(--space-1); }
.tag {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-accent);
  background: var(--color-accent-soft);
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
}

/* ---- Work category menu ---- */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-3);
}

.category-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: var(--space-4);
  background: var(--color-bg);
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.category-card:hover { border-color: var(--color-accent); transform: translateY(-2px); }

.category-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--color-accent-soft);
  color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-1);
}
.category-icon svg { width: 20px; height: 20px; stroke: currentColor; }

.category-count {
  font-size: 0.78rem;
  color: var(--color-ink-faint);
}

.category-link {
  margin-top: var(--space-1);
  font-weight: 600;
  color: var(--color-accent);
  font-size: 0.9rem;
}

/* ---- Video player ---- */
.video-frame {
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: var(--space-3) 0;
}
.video-frame video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}

.demo-body {
  margin-top: var(--space-4);
}
.demo-body h1 { margin-bottom: var(--space-1); }

/* ---- Slideshow ---- */
.slideshow {
  margin: var(--space-3) 0;
}

.slideshow-stage {
  position: relative;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 16 / 9;
}

.slideshow-stage img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.slideshow-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.9;
  transition: border-color 0.15s ease, opacity 0.15s ease;
}
.slideshow-nav:hover { border-color: var(--color-accent); opacity: 1; }
.slideshow-nav svg { width: 18px; height: 18px; stroke: currentColor; }
.slideshow-prev { left: var(--space-2); }
.slideshow-next { right: var(--space-2); }

.slideshow-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-2);
  font-size: 0.85rem;
  color: var(--color-ink-faint);
}

.slideshow-thumbs {
  display: flex;
  gap: 0.5rem;
  margin-top: var(--space-2);
  overflow-x: auto;
  padding-bottom: 0.3rem;
}

.slideshow-thumbs img {
  width: 84px;
  height: 52px;
  object-fit: cover;
  border-radius: calc(var(--radius) - 2px);
  border: 2px solid transparent;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
}
.slideshow-thumbs img:hover { opacity: 0.9; }
.slideshow-thumbs img.active { opacity: 1; border-color: var(--color-accent); }

/* ---- Breadcrumb ---- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--color-ink-faint);
  margin-bottom: var(--space-2);
}
.breadcrumb a { color: var(--color-ink-faint); text-decoration: none; }
.breadcrumb a:hover { color: var(--color-accent); }

/* ---- Long-form writing list ---- */
.writing-list { display: flex; flex-direction: column; }
.writing-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--color-border);
  text-decoration: none;
  color: inherit;
}
.writing-item:first-child { border-top: 1px solid var(--color-border); }
.writing-item:hover h3 { color: var(--color-accent); }
.writing-item-main { flex: 1; }
.writing-item h3 { margin: 0 0 0.3rem; transition: color 0.15s ease; }
.writing-item p { margin: 0; }
.writing-item-meta {
  white-space: nowrap;
  font-size: 0.8rem;
  color: var(--color-ink-faint);
  text-align: right;
}

/* ---- Skills list ---- */
.pill-list { display: flex; flex-wrap: wrap; gap: 0.5rem; list-style: none; padding: 0; margin: 0; }
.pill-list li {
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  font-size: 0.85rem;
  color: var(--color-ink-soft);
}

/* ---- Timeline (resume) ---- */
.timeline-item {
  border-left: 2px solid var(--color-border);
  padding-left: var(--space-3);
  margin-bottom: var(--space-4);
  position: relative;
}
.timeline-item::before {
  content: '';
  position: absolute;
  left: -7px; top: 4px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 2px solid var(--color-bg);
}
.timeline-meta {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: baseline;
}
.timeline-dates { font-size: 0.85rem; color: var(--color-ink-faint); white-space: nowrap; }
.timeline-item ul { margin: var(--space-1) 0 0; padding-left: 1.1rem; color: var(--color-ink-soft); }
.timeline-item li { margin-bottom: 0.3rem; }

/* ---- Case study detail ---- */
.cs-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: var(--space-2);
  border-top: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  padding: var(--space-3) 0;
  margin: var(--space-3) 0 var(--space-4);
}
.cs-meta-grid dt {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-ink-faint);
  margin-bottom: 0.2rem;
}
.cs-meta-grid dd { margin: 0; font-weight: 600; }

.image-placeholder {
  background: var(--color-bg-alt);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius);
  aspect-ratio: 16/9;
  display: flex; align-items: center; justify-content: center;
  color: var(--color-ink-faint);
  font-size: 0.85rem;
  margin: var(--space-3) 0;
  text-align: center;
  padding: var(--space-2);
}

.cs-body h3 { margin-top: var(--space-4); }

/* ---- Contact ---- */
.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}
@media (max-width: 640px) { .contact-grid { grid-template-columns: 1fr; } }

.contact-list { list-style: none; padding: 0; margin: 0; }
.contact-list li { margin-bottom: var(--space-2); }
.contact-list a { text-decoration: none; font-weight: 600; color: var(--color-ink); }
.contact-list a:hover { color: var(--color-accent); }
.contact-list .label { display: block; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--color-ink-faint); margin-bottom: 0.2rem; font-weight: 500; }

/* ---- Contact form ---- */
.contact-form { display: flex; flex-direction: column; gap: var(--space-2); }
.form-field { display: flex; flex-direction: column; gap: 0.35rem; }
.form-field label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 500;
  color: var(--color-ink-faint);
}
.form-field input,
.form-field textarea {
  font-family: var(--font-body);
  font-size: 0.95rem;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  color: var(--color-ink);
}
.form-field input:focus,
.form-field textarea:focus {
  outline: none;
  border-color: var(--color-accent);
}
.form-field textarea { resize: vertical; min-height: 130px; }
.form-honeypot { display: none; }
.form-status {
  font-size: 0.88rem;
  margin: 0;
  min-height: 1.3em;
}
.form-status.is-success { color: var(--color-accent); }
.form-status.is-error { color: #e0665c; }

/* ---- Footer ---- */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: var(--space-4) 0;
  color: var(--color-ink-faint);
  font-size: 0.85rem;
}
.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.footer-links { display: flex; gap: var(--space-3); list-style: none; padding: 0; margin: 0; }
.footer-links a { text-decoration: none; color: var(--color-ink-faint); }
.footer-links a:hover { color: var(--color-accent); }

/* ---- Misc helpers ---- */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.placeholder-note {
  font-size: 0.78rem;
  color: var(--color-accent);
  background: var(--color-accent-soft);
  border-radius: var(--radius);
  padding: 0.5rem 0.8rem;
  display: inline-block;
  margin-bottom: var(--space-2);
}
