/* Case-study pages: the visual first (the hook), then a short read. One vertical rhythm: --sec between sections. */
main { --sec: clamp(88px, 12vh, 144px); }

/* One band: the title on the left, the claim and facts on the right, so the work starts on the first screen. */
.case-head {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  column-gap: clamp(32px, 5vw, 80px);
  align-items: end;
  padding-top: clamp(24px, 4vh, 48px);
  padding-bottom: clamp(36px, 6vh, 64px);
}
.case-head > .case-back { grid-column: 1 / -1; }
.case-head > .case-title { grid-column: 1; grid-row: 2 / span 2; align-self: end; }
.case-head > .case-line { grid-column: 2; grid-row: 2; margin: 0; }
.case-head > .case-meta { grid-column: 2; grid-row: 3; }
@media (max-width: 760px) {
  .case-head { grid-template-columns: minmax(0, 1fr); }
  .case-head > .case-title, .case-head > .case-line, .case-head > .case-meta { grid-column: 1; grid-row: auto; }
  .case-head > .case-line { margin-top: 12px; }
}

.case-back {
  display: inline-block;
  justify-self: start;
  margin-bottom: 12px;
  font-size: 0.875rem;
  color: var(--slate);
  text-decoration: none;
  transition: color 140ms var(--ease-out);
}

.case-back:hover { color: var(--ink); }

.case-title {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(2.5rem, 1.6rem + 3vw, 4rem);
  line-height: 1.02;
  letter-spacing: -0.024em;
}

.case-line {
  margin: 14px 0 0;
  max-width: 30em;
  font-size: clamp(1.0625rem, 0.98rem + 0.32vw, 1.25rem);
  line-height: 1.5;
  color: var(--ink-2);
  text-wrap: pretty;
}

/* The name's pronunciation, beside it: the names are Persian. */
.case-title .say { margin-left: 14px; font-family: var(--font-mono); font-size: 0.8125rem; font-weight: 400; letter-spacing: 0.06em; color: var(--slate); vertical-align: 0.9em; }

.case-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  margin: 18px 0 0;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  color: var(--slate);
}

.case-meta a { color: var(--ink); }

.case-body {
  display: grid;
  gap: 32px;
  max-width: 40rem;
  margin-top: clamp(56px, 8vh, 96px);
  padding-top: 32px;
  border-top: 1px solid var(--rule);
}

.case-body h2 {
  margin: 0 0 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.005em;
}

.case-body p,
.case-body li {
  margin: 0;
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--ink-2);
  text-wrap: pretty;
}

.case-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 1.1em;
}

.case-list li::marker { color: var(--rule-3); }

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  letter-spacing: -0.01em;
  color: var(--ink);
}

/* Where Erfan's own words are needed. Visible, but never mistaken for the accent. */
.placeholder {
  font-style: italic;
  color: var(--slate);
  text-decoration: underline dotted var(--rule-3);
  text-underline-offset: 0.2em;
}

/* ---------- The four parts: what it is (header), why I built it, what it does, the rule it follows ---------- */

.name-note {
  grid-column: 2;
  margin: 10px 0 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 0.9375rem;
  color: var(--slate);
}
@media (max-width: 760px) { .name-note { grid-column: 1; } }

.sec-title { margin: 0 0 10px; font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.005em; }

/* ---------- Why I built it: the claim on the left, its evidence on the right ----------
   The evidence is one thing: a number with its source, a quote with its source, or a quote with a portrait.
   Markup: section.why > h2.sec-title + div.why-say (p…, optional .why-note, .sources) + aside.why-proof */
.why {
  display: grid;
  grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  column-gap: clamp(40px, 7vw, 128px);
  row-gap: 28px;
  align-items: start;
  margin: var(--sec) 0 0;
  padding-top: 32px;
  border-top: 1px solid var(--ink);
}
.why > .sec-title { grid-column: 1 / -1; margin: 0; }
.why-say p {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.375rem, 1.08rem + 1.05vw, 1.9375rem);
  line-height: 1.3;
  letter-spacing: -0.014em;
  color: var(--ink);
  text-wrap: pretty;
}
.why-say p + p { margin-top: 0.6em; }
.why-say .why-note { margin-top: 18px; font-family: var(--font-serif); font-size: 0.9375rem; line-height: 1.55; letter-spacing: 0; color: var(--slate); }
.sources { margin: 18px 0 0; font-family: var(--font-mono); font-size: 0.75rem; line-height: 1.7; letter-spacing: 0.02em; color: var(--slate); }
.sources a { display: inline-block; margin-right: 18px; color: var(--slate); text-decoration-color: var(--rule-3); }
.sources a:hover { color: var(--ink); }
/* Source links inside the claim stay small and mono, not the claim's large serif. */
.why-say p.sources { font-family: var(--font-mono); font-size: 0.75rem; line-height: 1.7; letter-spacing: 0.02em; color: var(--slate); }

/* The evidence column: a hairline down its left edge, so claim and proof read as a pair. */
.why-proof { position: relative; margin: 0; padding-left: clamp(20px, 2.5vw, 36px); }
.why-proof::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 1px; background: var(--rule-2); }
.proof-label { display: block; margin-bottom: 14px; font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.01em; color: var(--slate); }
.proof-num { display: block; font-family: var(--font-serif); font-weight: 400; font-size: clamp(3.25rem, 2.3rem + 3.2vw, 5.5rem); line-height: 0.92; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; color: var(--ink); }
.proof-num small { font-size: 0.42em; letter-spacing: -0.01em; color: var(--slate); }
.proof-text { margin: 14px 0 0; max-width: 24em; font-size: 1rem; line-height: 1.55; color: var(--ink-2); text-wrap: pretty; }
.why-proof blockquote { margin: 0; }
.why-proof blockquote p { margin: 0; font-family: var(--font-serif); font-size: clamp(1.125rem, 1rem + 0.45vw, 1.375rem); line-height: 1.4; color: var(--ink); text-wrap: pretty; }
.why-proof blockquote p::before { content: "\201C"; }
.why-proof blockquote p::after { content: "\201D"; }
.proof-by { display: block; margin-top: 12px; font-size: 0.9375rem; color: var(--slate); }
.proof-by b { font-weight: 500; color: var(--ink); }
.proof-by a { color: var(--slate); text-decoration-color: var(--rule-3); }
.proof-by a:hover { color: var(--ink); }
/* A portrait above the quote, in the same faded grayscale as the heroes. */
.proof-portrait { display: block; width: min(100%, 320px); aspect-ratio: 4 / 3.4; margin: 0 0 18px; overflow: hidden; }
.proof-portrait img { width: 100%; height: 100%; object-fit: cover; object-position: center top; filter: grayscale(1) contrast(1.02) brightness(1.06); opacity: 0.82; -webkit-mask-image: linear-gradient(to bottom, #000 62%, transparent 100%); mask-image: linear-gradient(to bottom, #000 62%, transparent 100%); }
@media (max-width: 760px) {
  .why { grid-template-columns: minmax(0, 1fr); row-gap: 22px; }
  .why-proof { padding-left: 0; padding-top: 22px; }
  .why-proof::before { left: 0; right: 0; top: 0; bottom: auto; width: auto; height: 1px; }
}

.does {
  display: grid;
  gap: 28px;
  max-width: 40rem;
  margin-top: clamp(48px, 7vh, 80px);
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}
.does p { margin: 0; font-size: 1.0625rem; line-height: 1.6; color: var(--ink-2); text-wrap: pretty; }

.rule {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  column-gap: clamp(32px, 6vw, 112px);
  align-items: center;
  margin-top: var(--sec);
  padding-top: 36px;
  border-top: 1px solid var(--ink);
}
.rule-line {
  margin: 0;
  max-width: 18ch;
  font-family: var(--font-serif);
  font-size: clamp(2rem, 1.3rem + 2.6vw, 3.5rem);
  line-height: 1.08;
  letter-spacing: -0.022em;
  text-wrap: balance;
}
.rule .hero { --hero-h: 540px; }
@media (max-width: 760px) {
  .rule { grid-template-columns: minmax(0, 1fr); row-gap: 28px; }
  .rule .hero { --hero-h-sm: 400px; }
}

/* ---------- Field: what it's about, for someone seeing it for the first time ---------- */

.case-tags { grid-column: 2; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 18px; align-items: baseline; margin: 12px 0 0; }
@media (max-width: 760px) { .case-tags { grid-column: 1; } }
.facts dt { font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.01em; color: var(--slate); }
.facts dd { margin: 0; font-size: 0.9375rem; line-height: 1.45; color: var(--ink-2); }

/* ---------- In plain words: under every visual, for someone seeing it for the first time ---------- */

.plainly {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 9fr);
  gap: 8px clamp(24px, 4vw, 56px);
  margin-top: clamp(32px, 5vh, 48px);
  padding: 24px 28px;
  background: var(--surface);
}
.plainly h2 { margin: 4px 0 0; font-size: 0.9375rem; font-weight: 600; }
.plainly p {
  margin: 0;
  max-width: 44rem;
  font-family: var(--font-serif);
  font-size: clamp(1.1875rem, 1.05rem + 0.45vw, 1.4375rem);
  line-height: 1.45;
  letter-spacing: -0.008em;
  color: var(--ink);
  text-wrap: pretty;
}
@media (max-width: 760px) { .plainly { grid-template-columns: minmax(0, 1fr); } }


/* ---------- Built with: a few plain facts, side by side across the page ---------- */

.stack {
  margin-top: var(--sec);
  padding-top: 32px;
  border-top: 1px solid var(--rule);
}
.stack > h2 { margin: 0 0 18px; font-size: 0.9375rem; font-weight: 600; letter-spacing: -0.005em; }
/* Each label sits above its fact; the pairs run as columns. */
.stack dl { display: grid; grid-template-rows: auto auto; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); column-gap: clamp(24px, 4vw, 64px); margin: 0; padding-top: 16px; border-top: 1px solid var(--ink); }
.stack dt { font-family: var(--font-mono); font-size: 0.6875rem; letter-spacing: 0.01em; color: var(--slate); }
.stack dd { margin: 8px 0 0; max-width: 30em; font-size: 1rem; line-height: 1.55; color: var(--ink-2); text-wrap: pretty; }
.stack dd b { font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
@media (max-width: 760px) {
  .stack dl { grid-template-rows: none; grid-auto-flow: row; grid-auto-columns: auto; grid-template-columns: minmax(0, 1fr); }
  .stack dd { margin-bottom: 18px; }
}

/* ---------- Who does the work: code, a model, or a person. The glyph is the same on every page. ---------- */

.who {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.01em;
  color: var(--ink-2);
  white-space: nowrap;
}
.who::before { content: ""; flex: none; width: 9px; height: 9px; border: 1px solid var(--ink); background: var(--ink); }
.who--model::before { background: linear-gradient(135deg, var(--ink) 0 50%, transparent 50% 100%); }
.who--person::before { background: var(--accent); border-color: var(--accent); }
.who--none { color: var(--slate); }
.who--none::before { background: transparent; border-color: var(--rule-3); }
.who + .who { margin-left: 14px; }
.st-side .who + .who { margin-left: 0; }

.who-key { display: flex; flex-wrap: wrap; gap: 8px 18px; margin: 0; }
.who-key .who + .who { margin-left: 0; }

/* ---------- How it works: stations in order, each saying what goes in, who does it, and what comes out ---------- */

.works { margin-top: var(--sec); }
.works-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px 32px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--ink);
}
.works-head .sec-title { margin: 0; }
.stations { list-style: none; margin: 8px 0 0; padding: 0; counter-reset: st; }
.station {
  counter-increment: st;
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 3fr) minmax(0, 6fr) minmax(0, 2.4fr);
  column-gap: clamp(20px, 3vw, 48px);
  align-items: baseline;
  padding: 32px 0 36px;
  border-bottom: 1px solid var(--rule);
}
.station::before {
  content: counter(st, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--slate);
  font-variant-numeric: tabular-nums;
}
.st-name {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(1.5rem, 1.2rem + 1vw, 2rem);
  line-height: 1.1;
  letter-spacing: -0.015em;
}
.st-what { margin: 0; font-size: 1rem; line-height: 1.55; color: var(--ink-2); text-wrap: pretty; }
.st-what + .st-what { margin-top: 0.5em; }
.st-side { display: grid; gap: 10px; justify-items: start; }
.st-num { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.02em; color: var(--slate); font-variant-numeric: tabular-nums; }
.st-num b { font-family: var(--font-serif); font-weight: 400; font-size: 1.375rem; letter-spacing: -0.01em; color: var(--ink); margin-right: 4px; }
/* The last station is the one that hands off: drawn with a stop line rather than a rule. */
.station--stop { border-bottom: 1.5px solid var(--ink); }
@media (max-width: 760px) {
  .station { grid-template-columns: 2rem minmax(0, 1fr); row-gap: 8px; }
  .st-name { grid-column: 2; }
  .st-what, .station > .st-body { grid-column: 2; }
  .st-side { grid-column: 2; display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 16px; margin-top: 4px; }
}

/* ---------- Where AI sits: three plain answers ---------- */

.ai-sits { margin-top: clamp(64px, 10vh, 112px); }
.ai-sits > .sec-title { padding-bottom: 12px; margin: 0; border-bottom: 1px solid var(--ink); }
.ai-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0; }
.ai-grid > div { padding: 18px clamp(16px, 2.5vw, 32px) 22px 0; }
.ai-grid > div { position: relative; }
.ai-grid > div + div { padding-left: clamp(16px, 2.5vw, 32px); }
.ai-grid > div + div::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 1px; background: var(--rule); }
.ai-grid dt { margin-bottom: 10px; }
.ai-grid dd { margin: 0; font-family: var(--font-serif); font-size: clamp(1.375rem, 1.15rem + 0.8vw, 1.75rem); line-height: 1.2; letter-spacing: -0.012em; color: var(--ink); text-wrap: balance; }
.ai-grid dd + dd { margin-top: 12px; max-width: 30em; font-family: var(--font-serif); font-size: 0.9375rem; line-height: 1.55; letter-spacing: 0; color: var(--ink-2); text-wrap: pretty; }
@media (max-width: 760px) {
  .ai-grid { grid-template-columns: minmax(0, 1fr); }
  .ai-grid > div, .ai-grid > div + div { padding: 16px 0 18px; }
  .ai-grid > div + div::before { right: 0; bottom: auto; width: auto; height: 1px; }
}

/* ---------- A standard or a vendor's own words, quoted with its source ---------- */

.cite { margin: 0; padding: 18px 22px; border-left: 2px solid var(--ink); background: var(--surface); }
.cite blockquote { margin: 0; font-family: var(--font-serif); font-size: 1.125rem; line-height: 1.45; color: var(--ink); text-wrap: pretty; }
.cite figcaption { margin-top: 10px; font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.02em; color: var(--slate); }
.cite figcaption a { color: var(--slate); text-decoration-color: var(--rule-3); }
.cite figcaption a:hover { color: var(--ink); }
.ai-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 56rem; }
@media (max-width: 760px) { .ai-grid--2 { grid-template-columns: minmax(0, 1fr); } }

/* The one sentence under "How it works": who does the work, and whether a model is in it. */
.works-key { margin: 22px 0 0; max-width: 40rem; font-family: var(--font-serif); font-size: clamp(1.0625rem, 0.98rem + 0.3vw, 1.1875rem); line-height: 1.45; color: var(--ink-2); text-wrap: pretty; }

/* Instructions name the gesture the reader actually has: hover with a mouse, tap on a touch screen. */
.v-tap { display: none; }
@media (hover: none) { .v-hover { display: none; } .v-tap { display: inline; } }
