/* =========================================================================
   bentabb.com — 2026 rebuild
   Hand-built, token-driven. No framework, no build step.
   Design tokens live here as CSS custom properties with semantic names —
   the same practice the work describes, made legible in the site itself.
   ========================================================================= */

:root {
  /* --- Color ------------------------------------------------------------ */
  --color-bg:            #fcfcfc;   /* warm near-white, carried from prior site */
  --color-ink:          #1a1a1a;   /* primary text */
  --color-ink-soft:     #555;      /* secondary text */
  --color-ink-faint:    #6a6a6a;   /* meta / eyebrow — WCAG AA (4.5:1+) on page and tile bg */
  --color-rule:         #e6e6e6;   /* hairlines */
  --color-tile:         #f2f2f0;   /* tile field */
  --color-tile-hover:   #ebebe8;
  --color-accent:       #1f4e5f;   /* teal, carried from résumé */

  /* --- Type ------------------------------------------------------------- */
  --font-display: "Jost", "Futura", system-ui, sans-serif;      /* ≈ futura-pt */
  --font-body:    "Mulish", system-ui, -apple-system, sans-serif; /* ≈ proxima-nova */

  --step--1: clamp(0.8rem, 0.77rem + 0.15vw, 0.9rem);
  --step-0:  clamp(1rem, 0.95rem + 0.25vw, 1.15rem);
  --step-1:  clamp(1.3rem, 1.15rem + 0.7vw, 1.7rem);
  --step-2:  clamp(1.7rem, 1.4rem + 1.4vw, 2.6rem);
  --step-3:  clamp(2.1rem, 1.6rem + 2.4vw, 3.6rem);

  /* --- Space / measure -------------------------------------------------- */
  --space-xs: 0.5rem;
  --space-s:  1rem;
  --space-m:  1.75rem;
  --space-l:  3rem;
  --space-xl: clamp(3rem, 2rem + 3vw, 5rem);
  --page-max: 1200px;
  --page-pad: clamp(1.25rem, 0.5rem + 4vw, 4.5rem);

  /* --- Grid --------------------------------------------------------------
     A real 12-column grid, the single source of truth for width. Every
     block on a case page sits in a .row and claims a .col-N span; nothing
     gets its own one-off max-width, so nothing can drift out of alignment.
     ------------------------------------------------------------------- */
  --grid-gap: clamp(1rem, 0.6rem + 1.5vw, 1.75rem);
}

/* --- Reset-ish ---------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-ink);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
ul { margin: 0; padding: 0; }

/* Widow control: no single-word last lines in text blocks; balanced
   multi-line headings. Progressive enhancement — unsupporting browsers
   keep default wrapping. */
p, li, dd, figcaption, blockquote { text-wrap: pretty; }
h1, h2, h3, .case-next__title { text-wrap: balance; }

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--color-ink); color: #fff;
  padding: 0.6rem 1rem; z-index: 100; border-radius: 0 0 6px 0;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 3px; }

/* --- Header ------------------------------------------------------------- */
.site-header {
  display: flex; flex-wrap: wrap; gap: var(--space-s) var(--space-m);
  align-items: baseline; justify-content: space-between;
  max-width: var(--page-max); margin: 0 auto;
  padding: clamp(1.5rem, 1rem + 2vw, 2.75rem) var(--page-pad) 0;
}
.wordmark { display: inline-flex; text-decoration: none; }
.wordmark img {
  height: clamp(46px, 36px + 3vw, 72px); width: auto;
}
.site-nav { display: flex; flex-wrap: wrap; gap: clamp(1rem, 0.5rem + 2vw, 2.25rem); }
.site-nav a {
  font-weight: 300; font-size: var(--step--1);
  letter-spacing: 0.14em; text-transform: uppercase; text-decoration: none;
  color: var(--color-ink-soft); padding-bottom: 2px;
  border-bottom: 1px solid transparent; transition: color .15s, border-color .15s;
}
.site-nav a:hover { color: var(--color-ink); border-color: var(--color-ink); }

/* --- Sticky header (CSS-only, desktop) -----------------------------------
   The masthead pins and condenses over the first 140px of scroll, driven
   entirely by scroll-timeline — no JS. Gated behind @supports so browsers
   without scroll-driven animations keep the static header as-is. Mobile
   (≤640px) stays static: the stacked header would eat too much viewport. */
@supports (animation-timeline: scroll()) {
  @media (min-width: 641px) {
    .site-header {
      position: sticky; top: 0; z-index: 50;
      animation: header-condense linear both;
      animation-timeline: scroll(root);
      animation-range: 0 140px;
    }
    /* Full-bleed veil: background + hairline that fade in once scrolled,
       so the top-of-page masthead looks exactly as before. */
    .site-header::before {
      content: ""; position: absolute; z-index: -1;
      top: 0; bottom: 0; left: 50%; width: 100vw;
      transform: translateX(-50%);
      background: var(--color-bg);
      border-bottom: 1px solid var(--color-rule);
      opacity: 0;
      animation: header-veil linear both;
      animation-timeline: scroll(root);
      animation-range: 0 140px;
    }
    .wordmark img {
      animation: logo-condense linear both;
      animation-timeline: scroll(root);
      animation-range: 0 140px;
    }
    /* Keep in-page anchor jumps (#work, #about) clear of the pinned bar. */
    [id] { scroll-margin-top: 5rem; }
  }
}
@keyframes header-condense { to { padding-top: 0.7rem; padding-bottom: 0.7rem; } }
@keyframes logo-condense   { to { height: 38px; } }
@keyframes header-veil     { to { opacity: 1; } }

/* --- Layout shell ------------------------------------------------------- */
main { max-width: var(--page-max); margin: 0 auto; padding: 0 var(--page-pad); }
section:not(.case-section) { padding-block: var(--space-xl); }
section:not(.case-section) + section:not(.case-section) { border-top: 1px solid var(--color-rule); }

/* --- 12-column grid ------------------------------------------------------
   The one layout primitive for page content. .row is a 12-track grid;
   children claim a .col-N span. Widths come from this math everywhere —
   no element gets its own one-off max-width, so nothing can drift out of
   alignment with anything else on the page.

   Three breakpoints, one set of tracks:
     desktop  >1024px   spans as authored (reading column = 8/12)
     tablet   641–1024  quarter-width items (.col-3/.col-4) fold to half;
                        the reading column widens to 10/12 to keep a
                        45–75ch measure as the container narrows
     mobile   ≤640px    everything stacks full width (stats stay 2-up —
                        see .case-stats override below)
   ------------------------------------------------------------------- */
.row {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--grid-gap);
  align-items: start;
}
.row + .row { margin-top: var(--space-m); }

.col-1  { grid-column: span 1; }
.col-2  { grid-column: span 2; }
.col-3  { grid-column: span 3; }
.col-4  { grid-column: span 4; }
.col-5  { grid-column: span 5; }
.col-6  { grid-column: span 6; }
.col-7  { grid-column: span 7; }
.col-8  { grid-column: span 8; }
.col-9  { grid-column: span 9; }
.col-10 { grid-column: span 10; }
.col-11 { grid-column: span 11; }
.col-12 { grid-column: span 12; }

@media (min-width: 641px) and (max-width: 1024px) {
  .row > .col-3,
  .row > .col-4 { grid-column: span 6; }
  .row > .col-8,
  .row > .col-9,
  .row > .col-10 { grid-column: span 10; }
}

@media (max-width: 640px) {
  .row > [class*="col-"] { grid-column: 1 / -1; }
  /* Stats are short enough to keep a 2-up rhythm on phones */
  .case-stats > [class*="col-"] { grid-column: span 6; }
}

.section-heading {
  font-family: var(--font-display);
  font-weight: 300; font-size: var(--step-1);
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--color-ink); margin: 0 0 var(--space-l);
}

/* --- Intro -------------------------------------------------------------- */
.intro { padding-top: var(--space-l); }
.eyebrow {
  font-family: var(--font-display); font-weight: 400;
  font-size: var(--step--1); letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--color-ink-faint); margin: 0 0 var(--space-m);
}
.intro h1 {
  font-family: var(--font-display); font-weight: 300;
  font-size: clamp(1.7rem, 1.4rem + 1.7vw, 2.75rem); line-height: 1.2; letter-spacing: 0.005em;
  max-width: 34ch; margin: 0 0 var(--space-l);
}
.intro h1 em { font-style: italic; }
.lede { max-width: 42rem; color: var(--color-ink-soft); margin: 0; }

/* --- Work grid ---------------------------------------------------------- */
.tile-grid {
  list-style: none;
  display: grid; gap: var(--grid-gap);
  grid-template-columns: repeat(2, 1fr);
}
.tile { display: flex; }
.tile--feature { grid-column: 1 / -1; }
.tile a {
  display: flex; flex-direction: column; gap: var(--space-xs);
  width: 100%; text-decoration: none;
  background: var(--color-tile);
  padding: clamp(1.5rem, 1rem + 2vw, 2.75rem);
  min-height: 15rem; justify-content: flex-end;
  transition: background .18s, transform .18s;
}
.tile--feature a { min-height: 20rem; }
.tile a:hover { background: var(--color-tile-hover); transform: translateY(-2px); }
.tile__meta {
  font-family: var(--font-display); font-weight: 400;
  font-size: var(--step--1); letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--color-ink-faint);
}
.tile__title {
  font-family: var(--font-display); font-weight: 400;
  font-size: var(--step-2); line-height: 1.05; letter-spacing: 0.01em;
}
.tile--feature .tile__title { font-size: var(--step-3); }
.tile__desc { color: var(--color-ink-soft); max-width: 52ch; }
.tile__cue {
  font-size: var(--step--1); letter-spacing: 0.04em; color: var(--color-accent);
  margin-top: var(--space-xs); font-weight: 600;
}

.earlier {
  margin: var(--space-l) 0 0; color: var(--color-ink-soft); font-size: var(--step--1);
  display: flex; flex-wrap: wrap; gap: var(--space-m); align-items: flex-start;
}
.earlier p { margin: 0; flex: 1 1 24rem; align-self: center; }
.earlier span {
  display: block;
  font-family: var(--font-display); font-weight: 400;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--color-ink-faint); margin-bottom: 0.35rem;
}
.earlier__panel { margin: 0; flex: 0 1 200px; }
.earlier__panel--wide { flex: 0 1 260px; }
.earlier__panel img { width: 100%; border: 1px solid var(--color-rule); }
.earlier__panel figcaption {
  margin-top: 0.4rem; color: var(--color-ink-faint);
  font-size: 0.72rem; line-height: 1.45;
}

/* --- About -------------------------------------------------------------- */
.about__body { display: grid; gap: var(--space-m); max-width: 42rem; }
.about__body p { margin: 0; }

/* --- Footer ------------------------------------------------------------- */
.site-footer {
  max-width: var(--page-max); margin: 0 auto;
  padding: var(--space-l) var(--page-pad) var(--space-xl);
  border-top: 1px solid var(--color-rule);
  display: flex; flex-wrap: wrap; gap: var(--space-s) var(--space-m);
  align-items: center; justify-content: space-between;
  color: var(--color-ink-faint); font-size: var(--step--1);
}
.site-footer p { margin: 0; }
.site-footer nav { display: flex; gap: var(--space-m); }
.site-footer a {
  letter-spacing: 0.1em; text-transform: uppercase; text-decoration: none;
  color: var(--color-ink-soft);
}
.site-footer a:hover { color: var(--color-ink); }

/* --- Responsive --------------------------------------------------------- */
@media (max-width: 640px) {
  .tile-grid { grid-template-columns: 1fr; }
  .site-header { padding-top: 1.5rem; }
}

/* =========================================================================
   Case-study pages
   ========================================================================= */
.case { max-width: var(--page-max); margin: 0 auto; padding: 0 var(--page-pad); }

.case-back {
  display: inline-block; margin-top: var(--space-l);
  font-family: var(--font-display); font-size: var(--step--1);
  letter-spacing: 0.1em; text-transform: uppercase; text-decoration: none;
  color: var(--color-ink-soft);
}
.case-back:hover { color: var(--color-ink); }

.case-hero { padding: var(--space-l) 0 0; }
.case-hero h1 {
  font-family: var(--font-display); font-weight: 300;
  font-size: var(--step-3); line-height: 1.05; letter-spacing: 0.01em;
  margin: var(--space-xs) 0 var(--space-m);
}
.case-summary { font-size: var(--step-1); font-weight: 300; color: var(--color-ink); margin: 0; line-height: 1.4; }

/* case-meta is a .row in the markup; these just style the four items */
.case-meta div { display: flex; flex-direction: column; gap: 0.25rem; margin: 0; }
.case-meta dt {
  font-family: var(--font-display); font-size: var(--step--1);
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--color-ink-faint);
}
.case-meta dd { margin: 0; color: var(--color-ink); font-size: var(--step--1); }

.case-body { padding: var(--space-l) 0; }
.case-section { margin-bottom: var(--space-xl); }
.case-section:last-child { margin-bottom: 0; }
.case-h {
  font-family: var(--font-display); font-weight: 300;
  font-size: var(--step-1); letter-spacing: 0.12em; text-transform: uppercase;
  margin: 0 0 var(--space-l); padding-bottom: var(--space-s);
  border-bottom: 1px solid var(--color-rule);
}
.case-section p { margin: 0; }
.case-note {
  padding: var(--space-m); background: var(--color-tile); margin: 0;
  border-left: 3px solid var(--color-accent); color: var(--color-ink-soft);
  font-size: var(--step--1);
}

/* A standalone screenshot, sized purely by its .col-N span in the markup */
.case-figure-solo { margin: 0; }
.case-figure-solo img { width: 100%; display: block; border: 1px solid var(--color-rule); background: #fff; }
.case-figure-solo figcaption { margin-top: 0.5rem; font-size: var(--step--1); color: var(--color-ink-faint); }

.case-block { margin-bottom: var(--space-l); }
.case-block h3 {
  font-family: var(--font-display); font-weight: 500; font-size: var(--step-1);
  letter-spacing: 0.01em; margin: 0 0 var(--space-xs); color: var(--color-ink);
}

/* Stats row — a .row in the markup, .col-3 per item (4 stats = 12 cols) */
.case-stats { list-style: none; align-items: stretch; }
.case-stats li {
  display: flex; flex-direction: column; gap: 0.4rem;
  padding: var(--space-m); background: var(--color-tile);
}
.stat-num {
  font-family: var(--font-display); font-weight: 400; font-size: var(--step-2);
  line-height: 1.15; color: var(--color-accent); letter-spacing: 0.01em;
}
.stat-num--seq { font-size: var(--step-1); white-space: normal; }
.stat-label { font-size: var(--step--1); color: var(--color-ink-soft); line-height: 1.4; }

/* Figures */
.case-figure { margin: 0; }
.case-figure figcaption {
  margin-top: var(--space-s); font-size: var(--step--1);
  color: var(--color-ink-faint);
}
.case-figure--placeholder .figure-ph {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.5rem; min-height: 16rem; text-align: center;
  border: 1px dashed var(--color-ink-faint); background: var(--color-tile);
  padding: var(--space-l);
}
.figure-ph p { margin: 0; font-family: var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-ink-soft); }
.figure-ph-note { font-size: var(--step--1); color: var(--color-ink-faint) !important; text-transform: none !important; letter-spacing: normal !important; }

/* Screenshot galleries within a case-block.
   Two columns of the same 12-track grid (each image = 6 tracks, shared
   gutter), so gallery edges land on the same lines as everything else.
   A fixed 8:5 frame with object-fit: contain equalizes card heights
   across mixed screenshot ratios without cropping any UI — narrower
   shots sit matted on the card's white field. */
.case-gallery {
  list-style: none; display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--grid-gap); margin: 0;
}
.case-gallery figure { margin: 0; }
.case-gallery img {
  width: 100%; display: block; border: 1px solid var(--color-rule);
  background: #fff;
  aspect-ratio: 8 / 5; object-fit: contain;
}
@media (max-width: 640px) {
  .case-gallery { grid-template-columns: 1fr; }
}
.case-gallery figcaption {
  margin-top: 0.5rem; font-size: var(--step--1); color: var(--color-ink-faint);
}
/* Variant for tall/print artifacts: keep the 2-up grid but let each image
   run at its natural aspect instead of the 8/5 frame. */
.case-gallery--natural { margin-top: var(--grid-gap); }
.case-gallery--natural img { aspect-ratio: auto; }

.case-next {
  display: flex; flex-wrap: wrap; gap: var(--space-m);
  justify-content: space-between; align-items: flex-end;
  max-width: var(--page-max); margin: 0 auto;
  padding: var(--space-xl) var(--page-pad);
  border-top: 1px solid var(--color-rule);
}
.case-next a {
  font-family: var(--font-display); font-size: var(--step--1);
  letter-spacing: 0.08em; text-transform: uppercase; text-decoration: none;
  color: var(--color-ink-soft);
}
.case-next a:hover { color: var(--color-ink); }

/* The forward link is the page's real exit — give it destination weight. */
.case-next__next { display: flex; flex-direction: column; gap: 0.35rem; text-align: right; }
.case-next__eyebrow {
  font-weight: 400; letter-spacing: 0.16em;
  color: var(--color-ink-faint);
}
.case-next__title {
  display: block; font-weight: 300; font-size: var(--step-2);
  line-height: 1.05; letter-spacing: 0.01em; text-transform: none;
  color: var(--color-ink);
}
.case-next__title .arrow { display: inline-block; transition: transform .18s; }
a.case-next__next:hover .case-next__title { color: var(--color-accent); }
a.case-next__next:hover .arrow { transform: translateX(0.35em); }

@media (max-width: 640px) {
  .case-next { flex-direction: column-reverse; align-items: flex-start; }
  .case-next__next { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

/* --- Résumé download link ------------------------------------------------ */
.resume-link { display: inline-flex; align-items: center; gap: 0.4em; }
.resume-link .dl-icon {
  width: 0.85em; height: 0.85em; flex: none;
  position: relative; top: 0.03em;
  opacity: 0.85; transition: opacity .15s, transform .15s;
}
.resume-link:hover .dl-icon { opacity: 1; transform: translateY(1px); }

/* --- External link (LinkedIn) -------------------------------------------- */
.ext-link { display: inline-flex; align-items: center; gap: 0.4em; }
.ext-link .ext-icon {
  width: 0.8em; height: 0.8em; flex: none;
  position: relative; top: 0.02em;
  opacity: 0.85; transition: opacity .15s, transform .15s;
}
.ext-link:hover .ext-icon { opacity: 1; transform: translate(1px, -1px); }

/* --- Testing pull quote -------------------------------------------------- */
.case-quote {
  margin: var(--space-m) 0 0; padding: var(--space-m);
  background: var(--color-tile); border-left: 3px solid var(--color-accent);
}
.case-quote p {
  font-family: var(--font-display); font-style: italic;
  font-size: var(--step-1); line-height: 1.4; margin: 0 0 var(--space-xs);
  color: var(--color-ink);
}
.case-quote cite {
  font-style: normal; font-size: var(--step--1); color: var(--color-ink-faint);
}

/* --- Identity / logo strip ----------------------------------------------- */
.logo-strip {
  list-style: none; display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--grid-gap); margin: 0;
}
.logo-strip li {
  display: flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--color-rule);
  padding: clamp(1.25rem, 1rem + 1.5vw, 2.5rem);
  aspect-ratio: 8 / 5;
}
.logo-strip img { max-width: 78%; max-height: 70%; }
@media (max-width: 640px) {
  .logo-strip { grid-template-columns: 1fr; }
}

/* Single featured logo: a white tile matching the logo-strip treatment. */
.logo-tile { margin: 0; }
.logo-tile__frame {
  display: flex; align-items: center; justify-content: center;
  background: #fff; border: 1px solid var(--color-rule);
  aspect-ratio: 1 / 1; padding: clamp(1.25rem, 1rem + 1.5vw, 2.5rem);
}
.logo-tile__frame img { max-width: 62%; max-height: 62%; }
.logo-tile figcaption {
  margin-top: 0.5rem; font-size: var(--step--1); color: var(--color-ink-faint);
}
