/* Portfolio home.
   Hero and statement borrow from ivo.design (full-screen hero with a two-tone headline at the bottom,
   words that rise in, a statement that lights up on scroll).
   Everything else is the same system as the case studies (studies/qata/styles.css): a narrow label column and a wide content column,
   Geist on warm greys, mono for metadata, product mockups on quiet grey stages.
   The featured cover is the case study's own hero demo, in an iframe (studies/qata/cover.html). */

:root {
  --bg: #f7f7f6;
  --fg: #151515;
  --muted: #6c6c6a;
  --faint: #8c8c88;   /* second half of the headline: still 3:1 on --bg for large text */
  --faint-2: #d2d2ce; /* statement words before they light up */
  --line: #e3e3e0;
  --stage: #f0f0ee;
  --stage-2: #e7e7e4;
  --raised: #ffffff;
  --font: 'Geist', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --r: 16px;
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { background: var(--bg); color: var(--fg); font-family: var(--font); font-size: 18px; line-height: 1.55; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
a { color: inherit; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
[id] { scroll-margin-top: 72px; }

.wrap { max-width: 1320px; margin: 0 auto; padding-left: max(24px, env(safe-area-inset-left, 0px)); padding-right: max(24px, env(safe-area-inset-right, 0px)); }

/* ---------- top bar ---------- */
.top { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 40; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.top-in { display: flex; justify-content: space-between; align-items: center; height: 56px; }
.top-link { text-decoration: none; font-size: 14px; }
.top-nav { display: flex; gap: 24px; }
.top-nav a { color: var(--muted); text-decoration: none; }
.top-link:hover, .top-nav a:hover { color: var(--fg); }

/* ---------- hero: fills the first screen, headline sits at the bottom ---------- */
.hero { min-height: calc(100svh - 56px); display: flex; flex-direction: column; justify-content: space-between; padding-top: 28px; padding-bottom: 40px; }
.status { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.status::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #22c55e; margin-right: 9px; vertical-align: 1px; }
.hero-b { padding-top: 96px; }
.who { display: flex; align-items: center; gap: 12px; font-family: var(--mono); font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.who img { width: 32px; height: 32px; border-radius: 50%; background: var(--stage); }
.hero-h { font-size: clamp(44px, 8.2vw, 124px); line-height: 1; font-weight: 500; letter-spacing: -.045em; max-width: 15ch; text-wrap: balance; }
.faint { color: var(--faint); }
.lede { margin-top: 32px; font-size: clamp(18px, 1.9vw, 21px); line-height: 1.45; color: var(--muted); max-width: 50ch; }

/* word-by-word rise on load (words wrapped by home.js) */
.reveal .w { display: inline-block; opacity: 0; transform: translateY(.3em); filter: blur(6px); animation: rise 1.2s cubic-bezier(.22, 1, .36, 1) both; animation-delay: calc(.1s + var(--i) * 55ms); }
@keyframes rise { to { opacity: 1; transform: none; filter: none; } }

/* ---------- statement: words light up as it scrolls past ---------- */
.say { padding-top: 160px; padding-bottom: 40px; text-align: center; }
.say-t { font-size: clamp(30px, 4.6vw, 60px); line-height: 1.12; font-weight: 500; letter-spacing: -.035em; max-width: 21ch; margin: 0 auto; text-wrap: balance; }
.say-t + .say-t { margin-top: .6em; }
.lit-on .say-t .w { color: var(--faint-2); transition: color .35s; }
.lit-on .say-t .w.on { color: var(--fg); }

/* ---------- sections ---------- */
.sec { padding-top: 104px; }
.sec + .sec { padding-top: 88px; }
.row { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 48px; }
.lab { font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--muted); padding-top: 8px; }
.body { min-width: 0; }
.title { font-size: clamp(28px, 3.4vw, 40px); line-height: 1.1; font-weight: 500; letter-spacing: -.03em; max-width: 20ch; text-wrap: balance; }
.lead p { font-size: clamp(20px, 2.1vw, 25px); line-height: 1.42; letter-spacing: -.01em; max-width: 720px; }
.lead p + p { margin-top: 20px; }
.muted { color: var(--muted); }
.intro-p { margin-top: 16px; font-size: 18px; color: var(--muted); max-width: 56ch; }

/* ---------- featured case study ---------- */
.stage { background: var(--stage); border-radius: var(--r); position: relative; overflow: hidden; overflow: clip; }
.featured { position: relative; margin-top: 8px; }
.stage-feat { padding: 48px 24px 44px; transition: background .3s; }
.cover { display: block; width: 100%; height: 720px; border: 0; pointer-events: none; } /* home.js sets the exact height */
.featured:hover .stage-feat { background: var(--stage-2); }
.feat-cap { margin-top: 28px; }
.feat-cap .row { align-items: start; }
.feat-cap .lab { line-height: 1.7; }
.client { display: flex; align-items: center; gap: 10px; color: var(--fg); margin-bottom: 6px; }
.client img { width: 20px; height: 20px; border-radius: 5px; display: block; }
.feat-cap h3 { font-size: clamp(28px, 3.4vw, 40px); line-height: 1.1; font-weight: 500; letter-spacing: -.03em; max-width: 22ch; text-wrap: balance; }
.feat-cap p { margin-top: 12px; font-size: 18px; color: var(--muted); max-width: 56ch; }
.more { display: inline-block; margin-top: 18px; font-size: 15px; text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 2px; transition: border-color .2s; }
.more::after { content: ''; position: absolute; inset: 0; } /* the whole card is the link */
.featured:hover .more { border-color: var(--fg); }

/* ---------- numbers ---------- */
.numbers { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; padding-top: 88px; }
.num b { display: block; font-size: clamp(40px, 5vw, 64px); font-weight: 500; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.num span { display: block; margin-top: 12px; font-family: var(--mono); font-size: 12px; color: var(--muted); max-width: 26ch; line-height: 1.5; }

/* ---------- work index ---------- */
.index { list-style: none; margin-top: 36px; border-bottom: 1px solid var(--line); }
.index li { border-top: 1px solid var(--line); }
.ix { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 24px; align-items: baseline; padding: 22px 0 24px; text-decoration: none; }
.ix-n, .ix-s { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.ix h4 { font-size: clamp(20px, 2vw, 24px); font-weight: 500; letter-spacing: -.02em; line-height: 1.25; }
.ix p { margin-top: 4px; font-size: 15px; color: var(--muted); max-width: 60ch; }
a.ix h4 { transition: color .2s; }
a.ix:hover h4 { color: var(--muted); }
a.ix .ix-s { color: var(--fg); }

/* ---------- 3D & retouching teaser ---------- */
.vis { position: relative; display: block; text-decoration: none; }
.vis-g { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 32px; }
.vis-g img { display: block; width: 100%; aspect-ratio: 1; border-radius: var(--r); object-fit: cover; background: var(--stage); transition: opacity .2s; }
.vis:hover .vis-g img { opacity: .88; }
.vis-t { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; margin-top: 16px; font-size: 18px; color: var(--muted); }
.vis .more { margin-top: 0; color: var(--fg); }
.vis .more::after { content: none; }
.vis:hover .more { border-color: var(--fg); }
.ns { display: none; }

/* ---------- approach ---------- */
.principles { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 24px; margin-top: 44px; }
.principles li { padding-top: 18px; border-top: 1px solid var(--line); }
.principles h4, .learn h4 { font-size: 17px; font-weight: 500; letter-spacing: -.01em; }
.principles p, .learn p { margin-top: 6px; font-size: 15px; color: var(--muted); line-height: 1.55; max-width: 46ch; }

/* ---------- about ---------- */
.avatar { width: 64px; height: 64px; border-radius: 50%; display: block; margin-bottom: 28px; background: var(--stage); }
.learn { margin-top: 56px; }
.learn article { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 32px; padding: 22px 0 24px; border-top: 1px solid var(--line); }
.learn article p { margin-top: 0; font-size: 16px; }
.learn time { display: block; margin-top: 4px; font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* ---------- footer ---------- */
.foot { padding-top: 56px; padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
.foot-links { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; }
.foot-links a { text-decoration: none; font-size: clamp(22px, 3vw, 32px); letter-spacing: -.02em; }
.foot-links a:hover { color: var(--muted); }
.copy { margin-top: 56px; font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .row { grid-template-columns: 1fr; gap: 14px; }
  .lab { padding-top: 0; }
  .principles { grid-template-columns: 1fr; gap: 0; }
  .principles li { padding: 18px 0 20px; }
  .learn article { grid-template-columns: 1fr; gap: 6px; }
}
@media (max-width: 640px) {
  .wrap { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
  body { font-size: 16px; }
  .top-nav { gap: 12px; }
  .top-nav .opt { display: none; } /* no room next to the name: About is one scroll away */
  .top-in > .top-link, .top-nav a { white-space: nowrap; }
  .nl { display: none; }
  .ns { display: inline; }
  .vis-g { gap: 8px; margin-top: 24px; }
  .vis-g img { border-radius: 10px; }
  .hero { padding-top: 20px; padding-bottom: 32px; }
  .status { font-size: 12px; }
  .hero-b { padding-top: 64px; }
  .lede { margin-top: 24px; }
  .say { padding-top: 112px; }
  .stage-feat { padding: 20px 8px 24px; }
  .cover { height: 700px; }
  .numbers { grid-template-columns: 1fr; gap: 32px; padding-top: 64px; }
  .sec { padding-top: 80px; }
  .sec + .sec { padding-top: 64px; }
  .ix { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .ix-n { display: none; }
  .ix-s { margin-top: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; }
  html { scroll-behavior: auto; }
}
