/* Shared styles for case-study and secondary pages. Same tokens as the homepage. */
:root {
  --paper: #FAF7F2; --surface: #FFFFFF; --ink: #17161A; --ink-2: #545159; --muted: #7C7882;
  --line: #E3DED6; --accent: #8A2DA8; --tint: #F1E7EE; --band: #17161A; --band-ink: #FAF7F2;
  --band-accent: #D9B8E8; --c-gray: #CFC9D3; --c-alt: #C8692A; --todo: #FFF6D6; --todo-ink: #7A5A00;
  --display: "Manrope", "Inter", system-ui, sans-serif;
  --body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #141316; --surface: #1D1C20; --ink: #F3F0EA; --ink-2: #C3BFC8; --muted: #9A96A0;
    --line: #2E2C33; --accent: #CFA2E3; --tint: #241D29; --band: #251E2A; --band-ink: #F3F0EA;
    --band-accent: #CFA2E3; --c-gray: #4A4651; --c-alt: #E39A62; --todo: #3A3220; --todo-ink: #F0D78A;
    --foot-bg: #1A191D; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #141316; --surface: #1D1C20; --ink: #F3F0EA; --ink-2: #C3BFC8; --muted: #9A96A0;
  --line: #2E2C33; --accent: #CFA2E3; --tint: #241D29; --band: #251E2A; --band-ink: #F3F0EA;
  --band-accent: #CFA2E3; --c-gray: #4A4651; --c-alt: #E39A62; --todo: #3A3220; --todo-ink: #F0D78A;
  --foot-bg: #1A191D; color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--body); font-size: 17px; line-height: 1.65;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
img { max-width: 100%; }
.wrap { max-width: 1200px; margin: 0 auto; }
a { color: inherit; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 6px; }
h1, h2, h3 { font-family: var(--display); text-wrap: balance; margin: 0; color: var(--ink); }
p { margin: 0; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent); }

.nav { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-block: 28px; flex-wrap: wrap; }
.brand { font-family: var(--display); font-weight: 800; font-size: 15px; letter-spacing: 0.06em; text-decoration: none; }
.nav ul { display: flex; gap: 28px; list-style: none; margin: 0; padding: 0; }
.nav ul a { font-size: 14px; font-weight: 600; text-decoration: none; color: var(--ink-2); padding-bottom: 3px; border-bottom: 2px solid transparent; }
.nav ul a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--accent); }
.nav ul a:hover { color: var(--ink); }

/* Case header */
.case-head { padding-block: 40px 32px; display: flex; flex-direction: column; gap: 18px; max-width: 900px; }
.case-head h1 { font-size: clamp(34px, 5vw, 56px); line-height: 1.06; font-weight: 800; letter-spacing: -0.02em; }
.case-head .sum { font-size: 20px; line-height: 1.5; color: var(--ink-2); max-width: 760px; }
.meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; padding-block: 18px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.meta dt { font-size: 11.5px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.meta dd { margin: 0; font-size: 15px; font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 32px; margin-top: 36px; }
.stat { padding: 2px 0 2px 20px; border-left: 1px solid var(--line); }
.stat b { display: block; font-family: var(--display); font-size: 48px; letter-spacing: -0.02em; line-height: 1; font-weight: 800; color: var(--accent); }
.stat span { display: block; margin-top: 10px; font-size: 14.5px; line-height: 1.4; color: var(--ink-2); }

/* Figures */
.fig { margin: 0; display: flex; flex-direction: column; gap: 10px; }
.fig .frame { background: var(--tint); border-radius: 20px; padding: 36px 36px 0; overflow: hidden; display: flex; }
.fig .frame.full { padding: 28px; }
.fig .frame img { display: block; width: 100%; height: auto; align-self: flex-start; flex-shrink: 0; border-radius: 12px; box-shadow: 0 10px 30px rgba(23,22,26,0.12); }
.fig .frame.full img { border-radius: 12px; }
.fig .frame.cap { max-height: 620px; }
.fig figcaption { font-size: 13.5px; color: var(--muted); }
.fig.hero { margin-top: 32px; }
.fig.hero .frame { max-height: 560px; }
.pair-figs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
.chart { background: var(--surface); border-radius: 20px; box-shadow: 0 0 0 1px var(--line); padding: 28px 28px 20px; }
.chart h3 { font-size: 17px; font-weight: 700; }
.chart .sub { font-size: 13.5px; color: var(--ink-2); margin-top: 4px; }
.chart svg { display: block; width: 100%; height: auto; margin-top: 14px; }
.legend { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

/* Story */
.story { display: flex; flex-direction: column; gap: 56px; padding-block: 72px 0; }
.sec { display: grid; grid-template-columns: 280px minmax(0, 680px); gap: 56px; }
.sec h2 { font-size: 26px; line-height: 1.25; font-weight: 700; }
.sec .body { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.sec ul { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 8px; }
.quote { margin: 0 0 0 336px; padding: 4px 0 4px 26px; border-left: 3px solid var(--accent); font-family: var(--display); font-size: 25px; line-height: 1.35; font-weight: 700; max-width: 680px; }
.todo { background: var(--todo); color: var(--todo-ink); border-radius: 8px; padding: 10px 14px; font-size: 15px; }
.todo::before { content: "To add: "; font-weight: 700; }

.next { margin-block: 80px 32px; padding: 36px 44px; border-radius: 20px; background: var(--band); color: var(--band-ink); display: flex; justify-content: space-between; align-items: center; gap: 20px; text-decoration: none; }
.next small { display: block; font-size: 12px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--band-accent); }
.next strong { display: block; font-family: var(--display); font-size: 26px; line-height: 1.2; color: var(--band-ink); }
.next span { font-size: 28px; }
.next:hover strong { text-decoration: underline; text-underline-offset: 5px; }
.foot { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; margin-top: 72px; padding-block: 40px 48px; font-size: 14px; color: var(--muted); background: var(--foot-bg, #F1EDE6); box-shadow: 0 0 0 100vmax var(--foot-bg, #F1EDE6); clip-path: inset(0 -100vmax -100vmax); }
.foot-id { display: flex; flex-direction: column; gap: 2px; }
.foot-id b { font-family: var(--display); font-size: 15px; font-weight: 700; color: var(--ink); }
.foot-links { display: flex; gap: 24px; }
.foot-links a { font-size: 15px; font-weight: 600; color: var(--ink); text-decoration: none; border-bottom: 1px solid color-mix(in srgb, var(--ink) 20%, transparent); padding-bottom: 2px; }
.foot-links a:hover { color: var(--accent); border-bottom-color: var(--accent); }

@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px; }
  .stat b { font-size: 36px; }
  .meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sec { grid-template-columns: 1fr; gap: 12px; }
  .quote { margin-left: 0; font-size: 21px; }
  .pair-figs { grid-template-columns: 1fr; }
  .fig .frame { padding: 20px 20px 0; }
  .fig .frame.full { padding: 20px; }
  .story { padding-block: 48px 0; gap: 44px; }
  .next { padding: 28px; }
  .next strong { font-size: 21px; }
}

.btn { display: inline-flex; align-items: center; gap: 6px; align-self: flex-start; color: var(--accent); font-size: 16px; font-weight: 600; text-decoration: none; }
.btn:hover { text-decoration: underline; text-underline-offset: 4px; }
.subproject { padding-top: 24px; border-top: 1px solid var(--line); }
.fig .frame.phone { justify-content: center; padding: 28px; }
.fig .frame.phone img { width: auto; max-height: 460px; box-shadow: none; border-radius: 0; }
.fig .frame video { display: block; width: 100%; height: auto; align-self: flex-start; border-radius: 12px; box-shadow: 0 10px 30px rgba(23,22,26,0.12); }
.about-head { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 56px; align-items: end; padding-block: 40px 32px; border-bottom: 1px solid var(--line); margin-bottom: 40px; }
.about-head .case-head { padding-block: 0; gap: 12px; }
.portrait { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; object-position: 100% 25%; border-radius: 20px; }
@media (max-width: 900px) { .about-head { grid-template-columns: 1fr; gap: 24px; } .portrait { max-width: 160px; } }

/* Previous / next pager */
.pager { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-block: 72px 32px; }
.pager.single { grid-template-columns: minmax(0, 1fr); max-width: 50%; margin-left: auto; }
.pager a { display: flex; flex-direction: column; gap: 4px; padding: 16px 22px; border-radius: 16px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); text-decoration: none; transition: background 0.15s ease; }
.pager a:hover { background: var(--tint); }
.pager small { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.pager strong { font-family: var(--display); font-size: 15.5px; line-height: 1.35; font-weight: 700; color: var(--ink); }
.pager .nextp { text-align: right; align-items: flex-end; }
@media (max-width: 700px) { .pager, .pager.single { grid-template-columns: 1fr; max-width: none; } }

/* Side-by-side figures: frames stretch to the taller one, images fill the width */
.pair-figs .fig .frame, .pair-figs .fig .frame.full { flex: 1; height: auto; padding: 24px; align-items: center; justify-content: center; }
.pair-figs .fig .frame img { width: 100%; height: auto; max-height: 560px; object-fit: contain; align-self: center; flex-shrink: 1; border-radius: 10px; }

.body p > a[href$=".html"] { color: var(--accent); font-weight: 600; text-decoration: none; white-space: nowrap; }
.body p > a[href$=".html"]:hover { text-decoration: underline; text-underline-offset: 4px; }
@media (max-width: 700px) {
  .chart { padding: 20px 16px 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .chart svg { min-width: 600px; }
}
.chart svg.mob { display: none; }
@media (max-width: 700px) {
  .chart svg.desk { display: none; }
  .chart svg.mob { display: block; min-width: 0; }
}

/* Sticky nav that hides on scroll down, returns on scroll up; hamburger on phones */
.nav { position: sticky; top: 0; z-index: 50; background: var(--paper); box-shadow: 0 0 0 100vmax var(--paper); clip-path: inset(0 -100vmax -1px); transition: transform .35s cubic-bezier(.2,.7,.2,1), border-color .2s; border-bottom: 1px solid transparent; }
.nav.scrolled { border-bottom-color: var(--line); }
.nav.tuck { transform: translateY(-100%); }
.menu-btn { display: none; width: 40px; height: 40px; margin-right: -8px; border: 0; background: none; color: var(--ink); cursor: pointer; border-radius: 10px; align-items: center; justify-content: center; }
.menu-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.menu-btn span { position: relative; display: block; width: 20px; height: 2px; background: currentColor; border-radius: 2px; transition: background .2s; }
.menu-btn span::before, .menu-btn span::after { content: ""; position: absolute; left: 0; width: 20px; height: 2px; background: currentColor; border-radius: 2px; transition: transform .25s ease; }
.menu-btn span::before { transform: translateY(-6px); } .menu-btn span::after { transform: translateY(6px); }
.nav.open .menu-btn span { background: transparent; }
.nav.open .menu-btn span::before { transform: rotate(45deg); } .nav.open .menu-btn span::after { transform: rotate(-45deg); }
@media (max-width: 600px) {
  .js .menu-btn { display: inline-flex; }
  .js .nav { flex-wrap: wrap; padding-block: 14px; }
  .js .nav ul { display: none; flex-basis: 100%; flex-direction: column; gap: 0; padding: 6px 0 8px; }
  .js .nav.open ul { display: flex; }
  .js .nav ul a { display: block; font-size: 17px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .js .nav ul li:last-child a { border-bottom: 0; }
  .js .nav ul a[aria-current="page"] { color: var(--accent); border-bottom-color: var(--line); }
}
@media (prefers-reduced-motion: reduce) { .nav, .menu-btn span::before, .menu-btn span::after { transition: none; } }
