/* ==========================================================================
   nitya-venkat.com
   Single stylesheet. Design tokens at :root, fluid layout throughout.
   No fixed-width containers anywhere — the 980px trap is what broke tablet.
   ========================================================================== */

/* ---------- tokens ---------- */
:root{
  color-scheme: light;

  --paper:      #FBFAF8;
  --surface:    #FFFFFF;
  --sunk:       #F1EFEA;
  --ink:        #16181C;
  --muted:      #5A6069;
  --faint:      #8A9099;
  --rule:       #E2DFD8;
  --rule-strong:#C9C5BC;

  --accent:     #1F5F52;
  --accent-ink: #16463C;
  --accent-soft:#E4EFEB;

  --f-display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --f-body:    "Source Serif 4", Georgia, "Times New Roman", serif;
  --f-mono:    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --measure: 68ch;
  --gutter: clamp(18px, 4vw, 32px);
  --page: 1140px;

  --step: clamp(56px, 9vw, 104px);   /* vertical rhythm between sections */
}

@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    color-scheme: dark;
    --paper:      #0E1114;
    --surface:    #161A1F;
    --sunk:       #1B2026;
    --ink:        #E8EBEE;
    --muted:      #9AA2AC;
    --faint:      #6C747E;
    --rule:       #262C33;
    --rule-strong:#39414A;
    --accent:     #64C2AC;
    --accent-ink: #8FD6C5;
    --accent-soft:#12262180;
  }
}
:root[data-theme="dark"]{
  color-scheme: dark;
  --paper:#0E1114; --surface:#161A1F; --sunk:#1B2026;
  --ink:#E8EBEE; --muted:#9AA2AC; --faint:#6C747E;
  --rule:#262C33; --rule-strong:#39414A;
  --accent:#64C2AC; --accent-ink:#8FD6C5; --accent-soft:#12262180;
}

/* ---------- reset ---------- */
*,*::before,*::after{ box-sizing:border-box }
html{ -webkit-text-size-adjust:100% }
body{
  margin:0;
  background:var(--paper);
  color:var(--ink);
  font-family:var(--f-body);
  font-size:clamp(16.5px, 0.4vw + 15.8px, 18px);
  line-height:1.62;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
  overflow-x:hidden;            /* belt and braces: never scroll sideways */
}
img,svg,video{ max-width:100%; height:auto; display:block }
h1,h2,h3,h4{ font-family:var(--f-display); font-weight:700; letter-spacing:-.018em; line-height:1.14; margin:0; text-wrap:balance }
p{ margin:0 0 1.05em }
a{ color:var(--accent); text-decoration-thickness:1px; text-underline-offset:3px }
a:hover{ color:var(--accent-ink) }
strong{ font-weight:600 }
ul,ol{ margin:0 0 1.05em; padding-left:1.2em }
li{ margin:.3em 0 }
:focus-visible{ outline:2px solid var(--accent); outline-offset:3px; border-radius:2px }

.skip{
  position:absolute; left:-9999px; top:0; z-index:100;
  background:var(--accent); color:#fff; padding:10px 16px; border-radius:0 0 4px 0;
  font-family:var(--f-display); font-size:14px; font-weight:600;
}
.skip:focus{ left:0 }

/* ---------- layout primitives ---------- */
.wrap{
  width:100%;
  max-width:var(--page);
  margin-inline:auto;
  padding-inline:var(--gutter);
}
.prose{ max-width:var(--measure) }
.prose > * + h2,
.prose > * + h3{ margin-top:1.8em }

section{ margin-top:var(--step) }

.lede{
  font-size:clamp(1.08rem, 1.1vw + .85rem, 1.32rem);
  line-height:1.5; color:var(--muted); max-width:60ch;
}

/* ---------- masthead / nav ---------- */
.site-head{
  border-bottom:1px solid var(--rule);
  background:color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter:saturate(180%) blur(8px);
  position:sticky; top:0; z-index:50;
}
.site-head .wrap{
  display:flex; align-items:center; gap:20px 28px;
  min-height:64px; flex-wrap:wrap; padding-block:12px;
}
.brand{
  font-family:var(--f-display); font-weight:700; font-size:1rem;
  letter-spacing:-.01em; color:var(--ink); text-decoration:none; margin-right:auto;
}
.brand span{ color:var(--faint); font-weight:500 }
.nav{ display:flex; gap:6px 22px; flex-wrap:wrap; align-items:center }
.nav a{
  font-family:var(--f-display); font-size:14.5px; font-weight:500;
  color:var(--muted); text-decoration:none; padding:4px 0;
  border-bottom:2px solid transparent;
}
.nav a:hover{ color:var(--ink) }
.nav a[aria-current="page"]{ color:var(--ink); border-bottom-color:var(--accent) }

/* ---------- hero ---------- */
.hero{ padding:clamp(48px,8vw,92px) 0 clamp(36px,5vw,56px) }
.hero h1{
  font-size:clamp(2.2rem, 6vw, 4rem);
  line-height:1.02; letter-spacing:-.028em; max-width:19ch; margin-bottom:.34em;
}
.hero .lede{ max-width:58ch }

.eyebrow{
  font-family:var(--f-mono); font-size:11px; font-weight:700;
  letter-spacing:.18em; text-transform:uppercase; color:var(--accent);
  margin:0 0 1.1em;
}

/* ---------- work cards (homepage) ---------- */
.work-grid{
  display:grid; gap:clamp(20px,2.6vw,30px);
  grid-template-columns:repeat(auto-fit, minmax(min(100%, 330px), 1fr));
  margin:0; padding:0; list-style:none;
}
.work-card{
  display:flex; flex-direction:column;
  background:var(--surface); border:1px solid var(--rule);
  border-radius:6px; overflow:hidden;
  text-decoration:none; color:inherit;
  transition:border-color .16s ease, transform .16s ease, box-shadow .16s ease;
}
.work-card:hover{
  border-color:var(--rule-strong);
  transform:translateY(-3px);
  box-shadow:0 10px 28px -18px rgba(0,0,0,.42);
}
.work-card__shot{
  aspect-ratio:16/10; width:100%; object-fit:cover;
  background:var(--sunk); border-bottom:1px solid var(--rule);
}
.work-card__body{ padding:20px 22px 22px; display:flex; flex-direction:column; flex:1 }
.work-card__slug{
  font-family:var(--f-mono); font-size:10.5px; font-weight:700;
  letter-spacing:.14em; text-transform:uppercase; color:var(--faint);
  margin:0 0 8px;
}
.work-card h3{
  font-size:1.24rem; margin:0 0 .42em; letter-spacing:-.014em; color:var(--ink);
}
.work-card__hook{
  font-size:.98rem; line-height:1.5; color:var(--muted); margin:0 0 16px; flex:1;
}
.work-card__hook b{ color:var(--ink); font-weight:600 }
.work-card__foot{
  display:flex; align-items:baseline; justify-content:space-between;
  gap:12px; flex-wrap:wrap; border-top:1px solid var(--rule); padding-top:13px;
}
.work-card__role{
  font-family:var(--f-mono); font-size:10.5px; color:var(--faint);
  letter-spacing:.06em; text-transform:uppercase;
}
.work-card__cta{
  font-family:var(--f-display); font-size:13.5px; font-weight:600; color:var(--accent);
}
.work-card:hover .work-card__cta{ color:var(--accent-ink) }

/* ---------- results strip ---------- */
.results{
  display:grid; gap:1px;
  grid-template-columns:repeat(auto-fit, minmax(min(100%, 170px), 1fr));
  background:var(--rule);
  border:1px solid var(--rule);
  border-radius:5px; overflow:hidden;
  margin:0 0 var(--step);
}
.results div{ background:var(--surface); padding:18px 20px }
.results dt{
  font-family:var(--f-display); font-size:11.5px; font-weight:600;
  letter-spacing:.04em; color:var(--muted); line-height:1.35; margin:7px 0 0; order:2;
}
.results dd{
  font-family:var(--f-mono); font-weight:700;
  font-size:clamp(1.3rem, 2.2vw, 1.72rem);
  letter-spacing:-.022em; font-variant-numeric:tabular-nums;
  color:var(--accent); margin:0; line-height:1.1; order:1;
}
.results div{ display:flex; flex-direction:column }
.results small{ font-size:.62em; font-weight:700 }

/* ---------- meta block (role / duration / team) ---------- */
.meta-block{
  display:grid; gap:14px 34px;
  grid-template-columns:repeat(auto-fit, minmax(min(100%,148px), auto));
  justify-content:start;
  border-top:1px solid var(--rule); border-bottom:1px solid var(--rule);
  padding:18px 0; margin:0 0 var(--step);
}
.meta-block dt{
  font-family:var(--f-mono); font-size:10px; font-weight:700;
  letter-spacing:.15em; text-transform:uppercase; color:var(--faint); margin:0 0 4px;
}
.meta-block dd{
  font-family:var(--f-display); font-size:15px; font-weight:500;
  color:var(--ink); margin:0; line-height:1.4;
}

/* ---------- case study page furniture ---------- */
.study-head{ padding:clamp(38px,6vw,64px) 0 0 }
.study-head h1{
  font-size:clamp(2rem, 5.2vw, 3.3rem); letter-spacing:-.026em;
  max-width:17ch; margin-bottom:.32em;
}
.study-head .lede{ margin-bottom:1.6em }

h2{ font-size:clamp(1.42rem, 2.2vw, 1.86rem); margin:0 0 .7em }
h3{ font-size:clamp(1.1rem, 1.4vw, 1.28rem); margin:0 0 .55em; font-weight:600 }

.rule-head{
  border-bottom:1px solid var(--rule-strong);
  padding-bottom:10px; margin-bottom:30px;
  display:flex; align-items:baseline; gap:16px; flex-wrap:wrap;
}
.rule-head h2{ margin:0 }
.rule-head .tag{
  font-family:var(--f-mono); font-size:10.5px; letter-spacing:.14em;
  text-transform:uppercase; color:var(--faint); margin-left:auto; white-space:nowrap;
}

/* ---------- figures ---------- */
/* Default: a figure lives in the text column, not across the whole page.
   Opt into .figure-wide only when the artwork genuinely needs the width. */
figure{ margin:2.2em 0; max-width:var(--measure) }
figure img{
  width:100%;
  border-radius:8px;
  background:var(--surface);
  /* A tonal edge that lifts the image off the paper, rather than a drawn box. */
  box-shadow: 0 0 0 1px var(--rule);                       /* fallback */
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--rule) 72%, transparent),
    0 8px 20px -14px rgba(22,24,28,.34);
}
/* Mockups and artwork that carry their own background need no frame at all. */
.figure-bare img{ box-shadow:none; background:none; border-radius:0 }

figcaption{
  font-size:.9rem; color:var(--muted); line-height:1.5;
  margin-top:10px; max-width:62ch;
}
figcaption b{ color:var(--ink); font-weight:600 }
.figure-wide{ max-width:none; margin-inline:calc(var(--gutter) * -1) }
@media (min-width:900px){ .figure-wide{ margin-inline:0 } }

/* ---------- text with a figure alongside ----------
   The prose keeps its measure; the figure sits in the margin beside it. */
.with-figure{
  --aside: 300px;
  --aside-gap: clamp(24px, 3vw, 44px);
  display:grid;
  gap:var(--aside-gap);
  align-items:start;
  max-width:calc(var(--measure) + var(--aside) + var(--aside-gap));
}
.with-figure > figure{ margin:0; max-width:min(100%, 440px) }
.with-figure > .prose{ max-width:var(--measure) }
.with-figure figcaption{ font-size:.85rem; margin-top:9px }

@media (min-width:900px){
  .with-figure{ grid-template-columns:minmax(0,1fr) var(--aside) }
  .with-figure > figure{ max-width:none }
}

.shots{
  display:grid; gap:16px;
  grid-template-columns:repeat(auto-fit, minmax(min(100%,150px), 1fr));
  margin:0; padding:0; list-style:none;
}
.shots img{ width:100%; border:1px solid var(--rule); border-radius:5px; background:#fff }

/* ---------- quotes ---------- */
blockquote{
  margin:1.4em 0; padding:0 0 0 18px;
  border-left:3px solid var(--accent);
  font-style:italic; color:var(--ink); max-width:58ch;
}
blockquote p{ margin:0 0 .5em }
blockquote cite{
  display:block; font-style:normal; font-family:var(--f-mono);
  font-size:11px; letter-spacing:.1em; text-transform:uppercase; color:var(--faint);
}

/* ---------- bottleneck / problem grid ---------- */
.cards{
  display:grid; gap:clamp(14px,1.8vw,20px);
  grid-template-columns:repeat(auto-fit, minmax(min(100%,240px), 1fr));
  margin:0 0 1.4em; padding:0; list-style:none;
}
.cards li{
  background:var(--surface); border:1px solid var(--rule);
  border-radius:5px; padding:18px 20px; margin:0;
}
.cards h3{
  font-size:1rem; margin:0 0 .4em; letter-spacing:-.008em;
}
.cards p{ font-size:.95rem; line-height:1.52; color:var(--muted); margin:0 }
.cards li img{
  width:100%; border:1px solid var(--rule); border-radius:4px;
  background:#fff; margin:0 0 14px;
}
.cards .cost{
  display:block; margin-top:10px; padding-top:10px;
  border-top:1px dashed var(--rule);
  font-family:var(--f-mono); font-size:11.5px; color:var(--accent);
  letter-spacing:.02em;
}

/* ---------- callout ---------- */
.callout{
  background:var(--accent-soft); border-left:3px solid var(--accent);
  padding:18px 22px; border-radius:0 5px 5px 0; margin:1.6em 0;
  max-width:var(--measure);
}
.callout p:last-child{ margin-bottom:0 }
.callout .ev-l{
  font-family:var(--f-mono); font-size:10px; font-weight:700; letter-spacing:.15em;
  text-transform:uppercase; color:var(--accent); display:block; margin-bottom:8px;
}

/* ---------- experience list ---------- */
.roles{ list-style:none; margin:0; padding:0 }
.roles li{
  display:grid; gap:4px 32px;
  grid-template-columns:minmax(150px, 200px) minmax(0,1fr);
  padding:22px 0; border-top:1px solid var(--rule); margin:0;
}
.roles li:first-child{ border-top:0 }
.roles .when{
  font-family:var(--f-mono); font-size:11.5px; letter-spacing:.05em;
  color:var(--faint); text-transform:uppercase; padding-top:4px;
}
.roles h3{ margin:0 0 .18em; font-size:1.08rem }
.roles .where{
  font-family:var(--f-display); font-size:13.5px; color:var(--accent);
  font-weight:500; margin:0 0 .5em;
}
.roles p{ margin:0; color:var(--muted); font-size:.97rem; max-width:64ch }
@media (max-width:640px){
  .roles li{ grid-template-columns:1fr }
  .roles .when{ padding-top:0 }
}

/* ---------- next / prev ---------- */
.next-study{
  margin-top:var(--step); border-top:2px solid var(--ink); padding-top:26px;
  display:flex; justify-content:space-between; gap:18px; flex-wrap:wrap; align-items:baseline;
}
.next-study a{
  font-family:var(--f-display); font-weight:700;
  font-size:clamp(1.1rem,2vw,1.4rem); text-decoration:none;
}
.next-study .lbl{
  font-family:var(--f-mono); font-size:10.5px; letter-spacing:.15em;
  text-transform:uppercase; color:var(--faint); display:block; margin-bottom:6px;
}

/* ---------- buttons ---------- */
.btn{
  display:inline-flex; align-items:center; gap:8px;
  font-family:var(--f-display); font-size:14.5px; font-weight:600;
  padding:11px 20px; border-radius:4px; text-decoration:none;
  background:var(--accent); color:#fff; border:1px solid var(--accent);
  transition:background .15s ease;
}
.btn:hover{ background:var(--accent-ink); color:#fff }
.btn--ghost{ background:transparent; color:var(--accent) }
.btn--ghost:hover{ background:var(--accent-soft); color:var(--accent-ink) }
.btn-row{ display:flex; gap:12px; flex-wrap:wrap; margin:1.6em 0 }

/* ---------- footer ---------- */
.site-foot{
  margin-top:var(--step); border-top:2px solid var(--ink);
  padding:30px 0 56px;
}
.site-foot .wrap{
  display:flex; justify-content:space-between; gap:20px 40px; flex-wrap:wrap;
}
.site-foot a{ color:var(--ink) }
.site-foot .col{ min-width:180px }
.site-foot h2{
  font-family:var(--f-mono); font-size:10.5px; font-weight:700; letter-spacing:.15em;
  text-transform:uppercase; color:var(--faint); margin:0 0 10px;
}
.site-foot ul{ list-style:none; margin:0; padding:0; font-size:.95rem }
.site-foot li{ margin:0 0 6px }
.site-foot .fine{
  font-family:var(--f-mono); font-size:11px; color:var(--faint);
  width:100%; border-top:1px solid var(--rule); padding-top:18px; margin-top:8px;
}

/* ---------- motion ---------- */
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{
    animation-duration:.01ms!important; animation-iteration-count:1!important;
    transition-duration:.01ms!important; scroll-behavior:auto!important;
  }
  .work-card:hover{ transform:none }
}
