/* ============================================================
   Annchiahui Tai, site styles
   Shared by all case study pages. The home page (index.html)
   keeps its own inline styles for the layout-heavy hero/grid.
   ============================================================ */

:root {
  --base: #F2F3F9;
  --surface: #FFFFFF;
  --surface-2: #E7EAF3;
  --ink: #14182E;
  --ink-soft: #4A5078;
  --ink-faint: #8E94B0;
  --line: #DCDFEC;
  --dot: #C5CADD;
  --peach: #E89A3C;
  --peach-deep: #C77A1F;
  --matcha: #6F88BD;
  --matcha-deep: #2C3E73;
  --taro: #C9D0E5;
  --butter: #F2E5C9;
  --shadow: 0 1px 0 rgba(20,24,46,.04), 0 8px 28px -12px rgba(20,24,46,.18);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --hand: "Caveat", "Bradley Hand", cursive;
}

[data-theme="dark"] {
  --base: #14182E;
  --surface: #1C2140;
  --surface-2: #252A52;
  --ink: #F2E5C9;
  --ink-soft: #C9D0E5;
  --ink-faint: #8E94B0;
  --line: #2D3458;
  --dot: #2A2F4D;
  --peach: #F2B568;
  --peach-deep: #FFC889;
  --matcha: #8FA4D2;
  --matcha-deep: #B5C6EE;
  --taro: #5B6FA3;
  --butter: #F2E5C9;
  --shadow: 0 1px 0 rgba(0,0,0,.4), 0 14px 40px -16px rgba(0,0,0,.6);
}


* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
/* clip beats hidden on iOS: it stops horizontal overflow without creating
   a scrolling container, which would otherwise break position:sticky on .nav. */
html, body { overflow-x: clip; }
body {
  margin: 0;
  background: var(--base);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  background-image: radial-gradient(var(--dot) 1px, transparent 1.4px);
  background-size: 22px 22px;
  transition: background-color .3s ease, color .3s ease;
  /* Boba cursor as the page default; standard pointer on clickable things. */
  cursor: url('images/boba-cursor.png') 8 4, default;
}
a, button, [role="button"], summary, label, .theme-toggle, .brand {
  cursor: pointer;
}
input, textarea, select { cursor: text; }
::selection { background: var(--peach); color: var(--ink); }
a { color: inherit; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }
a:hover { text-decoration-color: var(--peach-deep); }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 clamp(28px, 6.5vw, 80px); }
.prose { max-width: 680px; }

/* ----- Nav (shared across all pages) ----- */
.nav {
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  background: color-mix(in oklab, var(--base) 78%, transparent);
  border-bottom: 1px solid color-mix(in oklab, var(--line) 60%, transparent);
}
/* IMPORTANT: padding longhand only — .nav-row shares .wrap class, so
   `padding: 24px 0` shorthand would zero out the horizontal padding
   from .wrap and slam the avatar against the page edge.
   8-grid padding: tighter on desktop (16), generous on mobile (24). */
.nav-row {
  display: flex; align-items: center; justify-content: space-between;
  padding-top: 16px;
  padding-bottom: 16px;
}
@media (max-width: 760px) {
  .nav-row { padding-top: 24px; padding-bottom: 24px; }
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--serif); font-weight: 600; font-size: 19px;
  letter-spacing: -0.01em; text-decoration: none; color: var(--ink);
  white-space: nowrap;
}
.brand-text { white-space: nowrap; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface-2); overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px color-mix(in oklab, var(--ink) 8%, transparent);
  transition: transform .3s cubic-bezier(.2,.8,.2,1);
}
.brand:hover .brand-mark { transform: rotate(-6deg) scale(1.05); }
.brand-mark img {
  width: 100%; height: 100%;
  object-fit: cover; object-position: center 14%;
  transform: scale(1.5); transform-origin: center 30%;
}
.nav-links { display: flex; align-items: center; gap: 22px; }
.nav-links a {
  font-size: 14.5px; color: var(--ink-soft);
  text-decoration: none; font-weight: 500;
  transition: color .15s ease;
}
.nav-links a:hover { color: var(--ink); }
.back-link::before { content: "← "; }
.theme-toggle {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform .2s ease, background .2s ease;
}
.theme-toggle:hover { transform: rotate(-12deg); background: var(--surface-2); }

/* ----- Case study layout -----
   NOTE: padding-top/padding-bottom only — article.cs shares .wrap, so the
   `padding` shorthand would zero out the horizontal padding from .wrap. */
article.cs {
  padding-top: 56px;
  padding-bottom: 80px;
}
.cs-eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  text-transform: uppercase; letter-spacing: 0.14em;
  font-size: 12px; color: var(--ink-faint);
  margin: 0 0 14px;
}
.cs-eyebrow::before {
  content: ""; width: 18px; height: 1.5px; background: var(--peach-deep);
  display: inline-block;
}
.cs-title {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(38px, 5.4vw, 60px);
  line-height: 1.05; letter-spacing: -0.02em;
  margin: 0 0 22px; max-width: 18ch;
  font-variation-settings: "SOFT" 60;
}
.cs-title em {
  font-style: italic; color: var(--peach-deep);
  font-variation-settings: "SOFT" 100;
}
.cs-lede {
  font-family: var(--serif); font-style: italic;
  font-size: clamp(20px, 2.4vw, 24px);
  line-height: 1.45; color: var(--ink-soft);
  max-width: 36ch;
  margin: 0 0 40px;
}

.cs-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 24px 32px;
  margin: 0 0 56px;
  padding: 24px 0 0;
  border-top: 1px solid var(--line);
}
.cs-meta div { margin: 0; }
.cs-meta dt {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--ink-faint); margin-bottom: 6px; font-weight: 500;
}
.cs-meta dd {
  margin: 0; font-size: 14.5px; color: var(--ink); line-height: 1.5;
}

/* ----- Section headings inside the case study ----- */
.cs h2 {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(26px, 3vw, 34px);
  line-height: 1.2; letter-spacing: -0.015em;
  margin: 64px 0 18px;
}
.cs h2 em {
  font-style: italic; color: var(--peach-deep);
  font-variation-settings: "SOFT" 100;
}
.cs h3 {
  font-family: var(--serif); font-weight: 500;
  font-size: 20px; letter-spacing: -0.01em;
  margin: 32px 0 8px; color: var(--ink);
}
.cs h4 {
  font-family: var(--sans); font-weight: 600;
  font-size: 14.5px; letter-spacing: 0.02em;
  text-transform: uppercase; color: var(--peach-deep);
  margin: 28px 0 8px;
}

.cs p {
  margin: 0 0 16px;
  color: var(--ink); font-size: 17px; line-height: 1.65;
}
.cs p.muted { color: var(--ink-soft); }
.cs strong { font-weight: 600; color: var(--ink); }
.cs em { font-style: italic; }

.cs ul, .cs ol {
  max-width: 680px;
  padding-left: 24px;
  margin: 0 0 16px;
  color: var(--ink);
}
.cs li { margin-bottom: 8px; line-height: 1.6; }

/* ----- Figures and images ----- */
.cs-figure {
  /* White card behind the screenshot. No dashed border, no padding chrome,
     but the surface fills any transparent margins inside the PNG so the
     body's dot pattern doesn't bleed through. */
  margin: 36px 0 12px;
  background: var(--surface);
  border-radius: 12px;
  padding: 0;
  border: none;
  box-shadow: 0 10px 28px -14px rgba(20,24,46,.22);
  overflow: hidden;
}
.cs-figure img {
  display: block; width: 100%; height: auto;
  border-radius: 12px;
  box-shadow: none;
  cursor: zoom-in;
}

/* Lightbox: tap any case study figure image to open it full-screen.
   Closed by clicking the backdrop, the X button, or pressing Escape. */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(10, 12, 28, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: zoom-out;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
}
.lightbox.is-open {
  opacity: 1;
  pointer-events: auto;
}
.lightbox img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
  border-radius: 8px;
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .15);
  border: 1px solid rgba(255, 255, 255, .3);
  color: white;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sans);
}
.lightbox-close:hover {
  background: rgba(255, 255, 255, .25);
}
@media (max-width: 480px) {
  .lightbox { padding: 16px; }
  .lightbox-close { top: 12px; right: 12px; width: 36px; height: 36px; }
}
.cs-figure figcaption {
  font-family: var(--sans); font-size: 13.5px;
  color: var(--ink-soft); margin-top: 14px; text-align: center;
  font-style: italic;
}
.cs-figure-hero {
  margin-top: 0; margin-bottom: 56px;
  padding: 0;
}
.cs-figure-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.cs-figure-pair > .cs-figure { margin: 0; padding: 0; }
@media (max-width: 720px) {
  .cs-figure-pair { grid-template-columns: 1fr; }
}

/* ----- Pull quote ----- */
.cs-quote {
  border-left: 3px solid var(--peach);
  padding: 8px 0 8px 24px;
  margin: 32px 0;
  max-width: 640px;
}
.cs-quote p {
  font-family: var(--serif); font-style: italic;
  font-size: 19px; line-height: 1.5; color: var(--ink);
  margin: 0 0 6px;
}
.cs-quote cite {
  font-family: var(--sans); font-size: 13.5px; color: var(--ink-faint);
  font-style: normal;
}

/* ----- Approach blocks (TreeSelect-style) ----- */
.approaches {
  display: grid; gap: 16px;
  margin: 24px 0 0;
}
.approach {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 24px;
  background: var(--surface);
}
.approach.is-winner {
  border: 2px solid var(--peach);
  background: color-mix(in oklab, var(--butter) 30%, var(--surface));
}
.approach h3 {
  margin: 0 0 4px; font-size: 18px;
  display: flex; align-items: center; gap: 10px;
}
.winner-tag {
  font-family: var(--sans); text-transform: uppercase;
  letter-spacing: 0.12em; font-size: 10.5px;
  background: var(--peach); color: var(--ink);
  padding: 3px 8px; border-radius: 999px;
  font-weight: 600;
}
.approach p { margin: 0; font-size: 14.5px; color: var(--ink-soft); line-height: 1.55; }

/* ----- Stat callouts (for results sections) ----- */
.cs-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin: 24px 0 16px;
}
.cs-stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 24px;
}
.cs-stat .num {
  font-family: var(--serif); font-weight: 500;
  font-size: 32px; letter-spacing: -0.02em;
  color: var(--peach-deep);
  line-height: 1;
  margin: 0 0 4px;
}
.cs-stat .label {
  font-size: 13.5px; color: var(--ink-soft); line-height: 1.4;
  margin: 0;
}

/* ----- Footer of case study (back link + tail) ----- */
.cs-tail {
  margin-top: 80px;
  padding-top: 40px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 16px;
}
.cs-tail-back {
  font-family: var(--serif); font-size: 18px; font-weight: 500;
  text-decoration: none; color: var(--ink);
  border-bottom: 1.5px dashed var(--peach-deep); padding-bottom: 2px;
}
.cs-tail-back:hover { color: var(--peach-deep); }
.cs-tail-meta {
  font-family: var(--hand); font-size: 22px;
  color: var(--ink-soft); transform: rotate(-1.5deg);
}
.cs-tail-cat {
  display: inline-block;
  width: 24px; height: 20px;
  vertical-align: -3px;
  margin-left: 4px;
  transform: rotate(8deg);
  transition: transform .3s cubic-bezier(.2,.8,.2,1);
}
.cs-tail-meta:hover .cs-tail-cat {
  transform: rotate(-10deg) translateY(-2px);
}


footer.site-foot {
  border-top: 1px solid var(--line);
  padding: 32px 0 56px;
  color: var(--ink-soft); font-size: 13.5px;
}
footer.site-foot .foot-row {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 16px;
}
footer.site-foot a {
  color: var(--ink-soft); text-decoration: none;
  border-bottom: 1px dashed var(--ink-faint);
}
footer.site-foot a:hover { color: var(--peach-deep); border-bottom-color: var(--peach-deep); }

/* ============================================================
   Mobile padding & sizing pass for case study pages.
   ============================================================ */
@media (max-width: 720px) {
  article.cs { padding-top: 48px; padding-bottom: 64px; }
  .cs-lede { margin-bottom: 32px; }
  .cs-meta { gap: 16px 24px; padding-top: 24px; margin-bottom: 40px; }
  .cs h2 { margin: 48px 0 16px; }
  .cs-figure { padding: 0; margin: 24px 0 8px; }
  .cs-figure-hero { padding: 0; margin-bottom: 40px; }
  .cs-stats { gap: 8px; }
}
@media (max-width: 480px) {
  .wrap { padding: 0 24px; }
  .brand-text { display: none; }
  .nav-links { gap: 16px; }
  .nav-links a { font-size: 13.5px; }
  .back-link::before { content: "← "; }
  article.cs { padding-top: 32px; padding-bottom: 56px; }
  .cs-eyebrow { font-size: 11.5px; margin-bottom: 16px; }
  .cs-title { font-size: clamp(28px, 8vw, 36px); max-width: none; }
  .cs-lede { font-size: 18px; margin-bottom: 24px; }
  .cs-meta {
    grid-template-columns: 1fr;
    gap: 16px;
    padding-top: 16px;
    margin-bottom: 32px;
  }
  .cs h2 { font-size: clamp(22px, 6.5vw, 28px); margin: 40px 0 16px; }
  .cs h3 { font-size: 18px; margin-top: 24px; }
  .cs p, .cs li { font-size: 16px; }
  .cs-figure { padding: 0; margin: 24px 0 8px; }
  .cs-figure-hero { padding: 0; margin-bottom: 32px; }
  .cs-quote { padding-left: 16px; margin: 24px 0; }
  .cs-quote p { font-size: 17px; }
  .approach { padding: 16px; }
  .approach h3 { font-size: 17px; }
  .cs-stats { grid-template-columns: 1fr; }
  .cs-stat { padding: 16px; }
  .cs-stat .num { font-size: 32px; }
  .cs-tail { margin-top: 56px; padding-top: 24px; }
  .cs-tail-back { font-size: 17px; }
  footer.site-foot { padding: 24px 0 40px; }
  footer.site-foot .foot-row { font-size: 12.5px; }
}
