@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,400;0,9..144,500;0,9..144,600;0,9..144,700;1,9..144,400;1,9..144,500&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ---------- Tokens ---------- */
:root {
  --bg: #FBF7F1;
  --bg-raised: #FFFFFF;
  --ink: #221A2B;
  --ink-soft: #5B5063;
  --ink-faint: #8A8092;
  --accent: #5B3A91;
  --accent-ink: #FFFFFF;
  --accent-soft: #EFE6FA;
  --accent-soft-ink: #4A2F78;
  --border: #E7DFD3;
  --border-soft: #EFE9DD;
  --ring: #5B3A91;

  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', Consolas, monospace;

  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2.5rem;
  --space-5: 4rem;
  --space-6: 6rem;

  --radius-s: 8px;
  --radius-m: 14px;
  --radius-l: 24px;

  --shadow-card: 0 1px 2px rgba(34,26,43,0.04), 0 10px 30px -12px rgba(34,26,43,0.12);
  --max-width: 1120px;
}

:root[data-theme="dark"] {
  --bg: #18141F;
  --bg-raised: #221C2B;
  --ink: #F3EEF8;
  --ink-soft: #BDB2CC;
  --ink-faint: #8B7FA0;
  --accent: #B692F0;
  --accent-ink: #1B1326;
  --accent-soft: #2E2440;
  --accent-soft-ink: #D9C8F5;
  --border: #35293F;
  --border-soft: #2A2233;
  --ring: #B692F0;
  --shadow-card: 0 1px 2px rgba(0,0,0,0.3), 0 20px 40px -20px rgba(0,0,0,0.55);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #18141F;
    --bg-raised: #221C2B;
    --ink: #F3EEF8;
    --ink-soft: #BDB2CC;
    --ink-faint: #8B7FA0;
    --accent: #B692F0;
    --accent-ink: #1B1326;
    --accent-soft: #2E2440;
    --accent-soft-ink: #D9C8F5;
    --border: #35293F;
    --border-soft: #2A2233;
    --ring: #B692F0;
    --shadow-card: 0 1px 2px rgba(0,0,0,0.3), 0 20px 40px -20px rgba(0,0,0,0.55);
  }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; }
h1, h2, h3, h4, h5 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0; color: var(--ink); }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
button { font: inherit; cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

:focus-visible {
  outline: 2.5px solid var(--ring);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: var(--accent-ink);
  padding: 0.6em 1em; border-radius: var(--radius-s); z-index: 200;
}
.skip-link:focus { left: var(--space-2); top: var(--space-2); }

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

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-soft);
}
.header-inner {
  max-width: var(--max-width); margin: 0 auto; padding: var(--space-2) var(--space-3);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-2);
}
.brand {
  font-family: var(--font-display); font-weight: 600; font-size: 1.15rem;
  text-decoration: none; letter-spacing: -0.01em;
}
.brand:hover { color: var(--accent); }
.main-nav { display: flex; gap: var(--space-4); }
.main-nav a {
  text-decoration: none; font-size: 0.95rem; color: var(--ink-soft);
  transition: color 0.2s ease;
}
.main-nav a:hover { color: var(--accent); }
.header-actions { display: flex; align-items: center; gap: var(--space-2); }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; min-width: 44px; min-height: 44px;
  border-radius: 50%; border: 1px solid var(--border); background: var(--bg-raised);
  color: var(--ink); transition: border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.icon-btn svg { width: 19px; height: 19px; }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-moon { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }

.btn {
  display: inline-flex; align-items: center; gap: 0.5em;
  padding: 0.85em 1.5em; border-radius: 100px;
  font-size: 0.95rem; font-weight: 600; text-decoration: none;
  min-height: 44px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color .2s ease;
  border: 1.5px solid transparent;
  white-space: nowrap;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px -8px color-mix(in srgb, var(--accent) 55%, transparent); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-small { padding: 0.6em 1.2em; font-size: 0.88rem; }

/* ---------- Hero ---------- */
.hero {
  position: relative; padding: var(--space-6) 0 var(--space-5);
  overflow: hidden;
}
.hero-glow {
  position: absolute; top: -220px; right: -160px; width: 560px; height: 560px;
  background: radial-gradient(circle at 50% 50%, var(--accent-soft), transparent 70%);
  opacity: 0.8; pointer-events: none; z-index: 0; border-radius: 50%;
}
.hero-inner { position: relative; z-index: 1; }
.hero-inner > * { max-width: 780px; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 0.6em;
  font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); margin-bottom: var(--space-3);
}
.eyebrow::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); display: inline-block; }
.hero h1 {
  font-size: clamp(2.2rem, 5vw, 3.4rem);
  font-weight: 600; letter-spacing: -0.015em;
  max-width: 19ch;
}
.hero h1 em { font-style: italic; color: var(--accent); font-weight: 500; }
.hero-lede {
  margin-top: var(--space-3); font-size: 1.1rem; color: var(--ink-soft); max-width: 62ch;
}
.hero-ctas { display: flex; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-4); }

.hero-signoff {
  margin-top: var(--space-5); display: flex; align-items: center; gap: var(--space-2);
  color: var(--ink-faint); font-size: 0.9rem;
}
.hero-signoff .line { width: 46px; height: 1px; background: var(--border); }

/* ---------- Section scaffolding ---------- */
section { padding: var(--space-6) 0; }
.case-hero + section { padding-top: var(--space-4); }
.section-head { max-width: 640px; margin-bottom: var(--space-5); }
.section-head .eyebrow { margin-bottom: var(--space-2); }
.section-head h2 { font-size: clamp(1.7rem, 3.2vw, 2.3rem); }
.section-head p { margin-top: var(--space-2); color: var(--ink-soft); font-size: 1.05rem; }

/* ---------- About ---------- */
.about { border-top: 1px solid var(--border-soft); }
.about-grid {
  display: grid; grid-template-columns: 1.3fr 1fr; gap: var(--space-5);
  align-items: start;
}
.about-copy p { color: var(--ink-soft); margin-bottom: var(--space-3); font-size: 1.05rem; text-align: justify; text-align-last: left; hyphens: auto; }
.about-copy p:last-child { margin-bottom: 0; }
.about-copy strong { color: var(--ink); font-weight: 600; }

.about-side {
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius-l);
  padding: var(--space-4); box-shadow: var(--shadow-card);
}
.about-side h3 {
  font-size: 0.78rem; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-faint); margin-bottom: var(--space-3); font-weight: 500;
}
.tag-cloud { display: flex; flex-wrap: wrap; gap: 0.5em; margin-bottom: var(--space-4); }
.tag {
  font-family: var(--font-mono); font-size: 0.78rem; padding: 0.4em 0.85em; border-radius: 100px;
  background: var(--accent-soft); color: var(--accent-soft-ink); white-space: nowrap;
}
.tag.outline { background: transparent; border: 1px solid var(--border); color: var(--ink-soft); }
.about-side .divider { height: 1px; background: var(--border-soft); margin: var(--space-3) 0; }
.fact-row { display: flex; justify-content: space-between; gap: var(--space-2); padding: 0.55em 0; font-size: 0.92rem; }
.fact-row dt { color: var(--ink-faint); }
.fact-row dd { margin: 0; font-weight: 600; text-align: right; }

/* ---------- Work grid (index) ---------- */
.work { border-top: 1px solid var(--border-soft); }

.project-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: var(--space-3);
}
.project-card {
  background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius-l);
  overflow: hidden; display: flex; flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  text-decoration: none; color: inherit;
}
.project-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-card); }
.project-card.featured { grid-column: 1 / -1; display: grid; grid-template-columns: 1.1fr 1fr; min-height: 300px; }
.project-card .thumb { aspect-ratio: 16/10; max-height: 260px; overflow: hidden; background: var(--accent-soft); }
.project-card.featured .thumb { position: relative; aspect-ratio: auto; max-height: none; }
.project-card .thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; display: block; }
.project-card.featured .thumb img { position: absolute; inset: 0; }
.project-card .card-body { padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); flex: 1; }
.project-card.featured .card-body { padding: var(--space-4); justify-content: center; }
.project-card h3 { font-size: 1.2rem; }
.project-card.featured h3 { font-size: clamp(1.4rem, 2.2vw, 1.8rem); }
.project-card.featured p.overview { font-size: 1.02rem; }
.meta-row { display: flex; flex-wrap: wrap; gap: 0.5em; }
.meta-chip {
  font-family: var(--font-mono); font-size: 0.73rem; padding: 0.35em 0.75em; border-radius: 100px;
  border: 1px solid var(--border); color: var(--ink-soft);
}
.project-card p.overview { color: var(--ink-soft); font-size: 0.96rem; }
.project-card .role-tags { display: flex; flex-wrap: wrap; gap: 0.4em; }
.project-card .role-tags .tag { background: transparent; border: 1px solid var(--border); color: var(--ink-soft); font-size: 0.72rem; }
.project-card .read-more { margin-top: auto; font-weight: 600; color: var(--accent); font-size: 0.92rem; display: inline-flex; align-items: center; gap: 0.4em; }
.featured-kicker { font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent); }

/* ---------- Contact ---------- */
.contact { border-top: 1px solid var(--border-soft); text-align: center; }
.contact-inner { max-width: 620px; margin: 0 auto; }
.contact h2 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
.contact p.lede { margin-top: var(--space-3); color: var(--ink-soft); font-size: 1.08rem; }
.contact-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: var(--space-2); margin-top: var(--space-4); }

/* ---------- Footer ---------- */
footer { padding: var(--space-4) 0; border-top: 1px solid var(--border-soft); }
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: var(--space-2); font-size: 0.85rem; color: var(--ink-faint); }
.footer-inner a { text-decoration: none; }
.footer-inner a:hover { color: var(--accent); }
.back-to-top { display: inline-flex; align-items: center; gap: 0.4em; }

/* ---------- Case study page ---------- */
.case-hero { border-top: 1px solid var(--border-soft); padding-bottom: var(--space-4); }
.breadcrumb { font-family: var(--font-mono); font-size: 0.78rem; color: var(--ink-faint); margin-bottom: var(--space-3); display: flex; gap: 0.5em; align-items: center; }
.breadcrumb a { text-decoration: none; color: var(--ink-faint); }
.breadcrumb a:hover { color: var(--accent); }
.case-hero h1 { font-size: clamp(2rem, 4.4vw, 2.9rem); max-width: 22ch; }
.case-hero .lede-line { font-family: var(--font-display); font-size: 1.25rem; font-weight: 500; color: var(--ink-soft); margin-top: var(--space-2); max-width: 60ch; }
.quickfacts { display: grid; grid-template-columns: repeat(4,1fr); gap: 0.8em 1.5em; margin: var(--space-4) 0 0; padding: var(--space-3); background: var(--accent-soft); border-radius: var(--radius-m); }
.quickfacts div span.lbl { display: block; font-family: var(--font-mono); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent-soft-ink); opacity: 0.75; margin-bottom: 0.2em; }
.quickfacts div span.val { font-weight: 600; color: var(--accent-soft-ink); font-size: 0.88rem; }

.hero-shot {
  margin: var(--space-4) auto 0; width: fit-content; max-width: 100%; background: var(--bg);
  border-radius: var(--radius-m); overflow: hidden;
  border: 1px solid var(--border-soft); box-shadow: var(--shadow-card);
}
/* Images keep their intrinsic aspect ratio: never stretched, cropped or letterboxed */
.hero-shot img, .shot img, .shot video {
  display: block; width: auto; max-width: 100%; height: auto; max-height: 85vh;
}
.hero-shot img { cursor: zoom-in; }
.case-body.after-shot > h2:first-child { margin-top: var(--space-5); padding-top: var(--space-4); border-top: 1px solid var(--border-soft); }

.intro-split { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); align-items: start; margin: var(--space-3) 0 var(--space-5); }
.intro-text h3 { margin-top: 0; }
.intro-shot {
  border-radius: var(--radius-m); overflow: hidden; border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-card); background: var(--bg);
}
.intro-shot img { display: block; width: auto; max-width: 100%; height: auto; max-height: 85vh; }
@media (max-width: 640px) {
  .intro-split { grid-template-columns: 1fr; }
  .intro-shot { order: -1; }
}

.case-hero .wrap, .case-body { max-width: 760px; }
.case-body > .shot { max-width: min(100%, 760px); }
.case-body h2 {
  font-size: 1.5rem; margin-top: var(--space-6); margin-bottom: var(--space-2);
  padding-top: var(--space-4); border-top: 1px solid var(--border-soft);
}
.case-body h2:first-child { margin-top: 0; border-top: none; padding-top: 0; }
.case-body h3 { font-size: 1.15rem; margin-top: var(--space-3); margin-bottom: 0.6em; color: var(--accent); }
.case-body p { color: var(--ink-soft); margin-bottom: var(--space-2); font-size: 1rem; text-align: justify; text-align-last: left; hyphens: auto; }
.case-body p strong, .case-body li strong { color: var(--ink); font-weight: 600; }
.case-body p em, .case-body li em { font-style: italic; color: var(--ink); }
.case-body ul, .case-body ol { margin: 0.6em 0 var(--space-2); padding-left: 1.3em; color: var(--ink-soft); }
.case-body li { margin-bottom: 0.5em; }
.pull-callout {
  border-left: 3px solid var(--accent); padding: 0.3em 0 0.3em 1.1em; margin: var(--space-3) 0;
  font-size: 1.08rem; color: var(--ink); font-family: var(--font-display); font-weight: 500;
}
.table-scroll { overflow-x: auto; margin: var(--space-2) 0 var(--space-3); border: 1px solid var(--border-soft); border-radius: var(--radius-s); }
table.ds { width: 100%; border-collapse: collapse; font-size: 0.88rem; min-width: 480px; }
table.ds th, table.ds td { text-align: left; padding: 0.7em 1em; border-bottom: 1px solid var(--border-soft); vertical-align: top; }
table.ds th { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-faint); background: var(--bg); }
table.ds tr:last-child td { border-bottom: none; }
table.ds td { color: var(--ink-soft); }
.sev { font-family: var(--font-mono); font-size: 0.72rem; text-transform: uppercase; padding: 0.2em 0.6em; border-radius: 100px; }
.sev-serious { background: #F8DADA; color: #8A2626; }
.sev-minor { background: #EDE6D8; color: #7A6A3E; }
:root[data-theme="dark"] .sev-serious { background: #3A2127; color: #F2A9A9; }
:root[data-theme="dark"] .sev-minor { background: #332C1F; color: #E2CE98; }
.signature-line { margin-top: var(--space-4); font-style: italic; color: var(--ink-faint); font-size: 0.92rem; }

.shot {
  margin: var(--space-3) auto; width: fit-content; max-width: 100%; background: var(--bg);
  border-radius: var(--radius-m); overflow: hidden;
  border: 1px solid var(--border-soft); box-shadow: var(--shadow-card);
}
.shot img { cursor: zoom-in; }
/* width:0 + min-width:100% keeps a long caption from widening the frame past the image */
.shot figcaption {
  width: 0; min-width: 100%; box-sizing: border-box;
  padding: 0.7em 1em; font-size: 0.85rem; color: var(--ink-faint);
  background: var(--bg-raised); border-top: 1px solid var(--border-soft);
}

.slideshow {
  position: relative; margin: var(--space-3) auto; max-width: 760px;
  border-radius: var(--radius-m); overflow: hidden; border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-card); background: var(--bg);
}
.slideshow .slide {
  display: none; margin: 0; padding: var(--space-2) 3.5rem;
  flex-direction: column; align-items: center; justify-content: center; gap: 0.6em;
  box-sizing: border-box;
}
.slideshow .slide.is-active { display: flex; }
.slideshow .slide img, .slideshow .slide video {
  display: block; max-width: 100%; max-height: 85vh; width: auto; height: auto;
  border-radius: var(--radius-s); flex: 0 1 auto; min-height: 0;
}
.slideshow .slide-label { font-size: 0.82rem; color: var(--ink-faint); text-align: center; flex: none; }
.slideshow-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; min-width: 40px; min-height: 40px; border-radius: 50%; border: none;
  background: rgba(20,14,26,0.55); color: #fff; display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background 0.2s ease;
}
.slideshow-nav:hover { background: rgba(20,14,26,0.8); }
.slideshow-nav.prev { left: 10px; }
.slideshow-nav.next { right: 10px; }
.slideshow-footer {
  display: flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: 0.7em 1em; background: var(--bg-raised); border-top: 1px solid var(--border-soft);
}
.slideshow-dots { display: flex; align-items: center; gap: 0.4em; }
.slideshow-dots button { width: 7px; height: 7px; padding: 0; border-radius: 50%; border: none; background: var(--border); cursor: pointer; }
.slideshow-dots button.is-active { background: var(--accent); width: 18px; border-radius: 4px; transition: width 0.2s ease; }
.slideshow-counter { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-faint); min-width: 3.5em; text-align: center; }
@media (max-width: 640px) {
  .slideshow .slide { padding: var(--space-1) 2.75rem; }
}

.shot img.zoomable, .slide img.zoomable { cursor: zoom-in; }

.lightbox-overlay {
  position: fixed; inset: 0; background: rgba(10,8,14,0.9); z-index: 1000;
  display: flex; align-items: flex-start; justify-content: center;
  padding: var(--space-5) var(--space-4); overflow-y: auto;
  opacity: 0; visibility: hidden; transition: opacity 0.2s ease;
}
.lightbox-overlay.is-open { opacity: 1; visibility: visible; }
.lightbox-overlay img { max-width: min(1200px, 100%); width: auto; height: auto; border-radius: var(--radius-s); box-shadow: 0 30px 80px rgba(0,0,0,0.5); margin: auto; }
.lightbox-close {
  position: fixed; top: var(--space-3); right: var(--space-3); z-index: 1001;
  width: 44px; height: 44px; min-width: 44px; min-height: 44px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.12); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.lightbox-close:hover { background: rgba(255,255,255,0.22); }
.metric-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: var(--space-2); margin: var(--space-3) 0; max-width: 760px; }
.metric-tile { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius-m); padding: var(--space-3); text-align: center; }
.metric-tile .num { font-family: var(--font-display); font-size: 1.7rem; font-weight: 600; color: var(--accent); display: block; }
.metric-tile .lbl { font-size: 0.78rem; color: var(--ink-faint); margin-top: 0.3em; display: block; }

.case-nav-footer { display: flex; flex-wrap: wrap; gap: var(--space-2); justify-content: space-between; align-items: center; margin-top: var(--space-6); padding-top: var(--space-4); border-top: 1px solid var(--border-soft); max-width: 760px; }

@media (max-width: 860px) {
  .about-grid { grid-template-columns: 1fr; }
  .quickfacts { grid-template-columns: repeat(2,1fr); }
  .project-card.featured { grid-template-columns: 1fr; min-height: 0; }
  .project-card.featured .thumb { position: static; aspect-ratio: 16/10; max-height: 220px; }
  .project-card.featured .thumb img { position: static; }
  .project-card.featured .card-body { padding: var(--space-3); justify-content: flex-start; }
  .shot-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .main-nav { display: none; }
  section { padding: var(--space-5) 0; }
  .hero { padding: var(--space-5) 0 var(--space-4); }
  .quickfacts { grid-template-columns: 1fr 1fr; }
}
