/* =========================================================
   Ryan Uchi O'Neill — Portfolio
   Homepage styles

   Breakpoints
     mobile   : < 768px   → 1 column
     tablet   : 768–1199  → 2 columns
     desktop  : ≥ 1200px  → 4 columns  (matches Figma 1920 frame)
   ========================================================= */

/* ---------- Tokens ---------- */
:root {
  --ink:            #000000;
  --ink-inverse:    #ffffff;
  --accent:         #006de1;
  --surface:        #ffffff;
  --surface-muted:  #f4f4f4;
  --band:           #67b6ce;
  --band-dark:      #04232d;
  --hairline:       rgba(0, 0, 0, 0.5);
  --hairline-soft:  #dcdcdc;

  --font-display: "Google Sans Code", ui-monospace, SFMono-Regular, Menlo, monospace;
  --font-ui:      "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Grid: 4 × 432px cards + 3 × 24px gutters = 1800px at the 1920 frame */
  --content-max: 1800px;
  --gutter:      24px;
  --row-gap:     48px;
  --page-pad:    clamp(20px, 3.125vw, 60px);

  /* Vertical rhythm — scales down on small screens */
  --space-section: clamp(72px, 9vw, 149px);

  /* Section label rule — mobile values; overridden per breakpoint below */
  --label-pad: 16px;   /* gap between label text and its underline */
  --label-gap: 32px;   /* gap between the underline and the grid  */
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--surface);
  background-image: url("images/texture.png");
  background-size: 120px 120px;
  background-position: top left;
  font-family: var(--font-display);
  font-weight: 300;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
img { max-width: 100%; }
a { color: inherit; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 12px 16px;
  background: var(--ink);
  color: var(--ink-inverse);
  font-family: var(--font-ui);
  font-size: 14px;
  text-decoration: none;
}
.skip-link:focus { left: 0; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

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

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: calc(var(--content-max) + var(--page-pad) * 2);
  margin-inline: auto;
  padding-inline: var(--page-pad);
}

/* ---------- Hairline rule (dots + line, from the Figma divider) ---------- */
.rule {
  display: flex;
  align-items: center;
  height: 4px;
  margin-top: 16px;
}
.rule__dots {
  flex: 0 0 auto;
  width: 138px;
  height: 2px;
  background-image: radial-gradient(circle at 1px 50%, var(--ink) 1px, transparent 1.4px);
  background-size: 20px 2px;
  background-repeat: repeat-x;
}
.rule__line {
  flex: 1 1 auto;
  height: 2px;
  background: var(--ink);
}

/* ---------- Header ---------- */
.site-header { padding-top: 48px; }

.site-header__bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px 40px;
  flex-wrap: wrap;
}

.site-header__brand,
.site-footer__brand,
.site-footer__copy,
.site-nav a,
.section__label,
.aside {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 16px;
  line-height: 24px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}

.site-header__brand a { text-decoration: none; }
.site-header__brand a:hover { text-decoration: underline; }

.site-nav {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
}
.site-nav a { text-decoration: none; }
.site-nav a:hover,
.site-nav a:focus-visible { text-decoration: underline; }

/* ---------- Hero ---------- */
.hero { padding-top: clamp(48px, 7vw, 88px); }

.hero__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.17;
  max-width: 24ch;
  margin-bottom: clamp(28px, 3.5vw, 44px);
}

.hero__lede {
  font-weight: 300;
  font-size: clamp(17px, 1.7vw, 24px);
  line-height: 1.67;
  max-width: 1193px;
}
.hero__lede + .hero__lede { margin-top: clamp(20px, 2.2vw, 32px); }

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: clamp(32px, 4vw, 56px);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  border: 1px solid transparent;
  border-radius: 0;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 16px;
  line-height: 24px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  text-decoration: none;
  text-align: center;
  cursor: pointer;
  transition: background-color .15s ease, color .15s ease;
}

.btn--solid {
  background: var(--ink);
  color: var(--ink-inverse);
}
.btn--solid:hover { background: #262626; }

.btn--outline {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--ink);
}
.btn--outline:hover {
  background: var(--ink);
  color: var(--ink-inverse);
}

/* ---------- Sections ---------- */
.section { padding-top: var(--space-section); }

.section__label {
  padding-bottom: var(--label-pad);
  border-bottom: 1px solid var(--hairline-soft);
  margin-bottom: var(--label-gap);
}

.section--band {
  margin-top: var(--space-section);
  padding-top: clamp(64px, 6.7vw, 128px);
  padding-bottom: clamp(80px, 8.5vw, 164px);
  background-color: var(--band);
  background-image: url("images/texture-band.png");
  background-size: 120px 120px;
  background-position: top left;
}

/* ---------- Work grid ---------- */
/* `stretch` makes every card match the tallest card in its row.
   The aside lines opt out below via `align-self: center`. */
.work-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--row-gap) var(--gutter);
  align-items: stretch;
}

/* ---------- Card ---------- */
.card {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 8px 8px 25px;
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: 4px;
}
.card--muted { background: var(--surface-muted); }

.card__media {
  flex: 0 0 230px;   /* never squashed by a stretched card */
  height: 230px;
  width: 100%;
  overflow: hidden;
  background: var(--surface-muted);
}
.card__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Grows to fill whatever height the row hands the card ... */
.card__body {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 24px;
  padding-inline: 16px;
  flex: 1 1 auto;
}

/* ... and the CTA rides the bottom edge, so buttons line up across a row
   instead of leaving ragged whitespace under the shorter cards. */
.card__body > .btn { margin-top: auto; }

.card__text {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 24px;
  line-height: 32px;
}

.card__desc {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 16px;
  line-height: 24px;
}

/* ---------- Aside "life" lines that sit in empty grid cells ---------- */
.aside {
  align-self: center;
  justify-self: center;
  max-width: 26ch;
  text-align: center;
  padding-block: 8px;
}
.aside__hl {
  color: var(--accent);
  font-style: italic;
  text-decoration: underline;
  text-underline-position: from-font;
}

/* Some asides are links, one opens a lightbox, the rest are plain text —
   they all have to look identical, so the button gets stripped back. */
button.aside__hl {
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  font-style: italic;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

a.aside__hl:hover,
a.aside__hl:focus-visible,
button.aside__hl:hover,
button.aside__hl:focus-visible { color: var(--ink); }

/* =========================================================
   CASE STUDY
   ========================================================= */

/* The 12-column geometry from the Figma frame: prose and media both sit in
   columns 3–10 (x 364 → 1556 at the 1920 frame = 1192px). A `.case-wide`
   child breaks out to the full 1800. Below 1200px everything is full width. */
.case {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--gutter);
}
.case > * { grid-column: 1 / -1; }

/* ---------- Case study type ---------- */
.eyebrow {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 16px;
  line-height: 24px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}

.case-h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(26px, 3.3vw, 40px);
  line-height: 1.2;
}

.case-p,
.case-list {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(17px, 1.7vw, 24px);
  line-height: 1.67;
}

.case-list {
  padding-left: 36px;
  margin: 0;
}
.case-list li + li { margin-top: 8px; }

/* Numbered variants keep the same measure and rhythm as the bulleted ones. */
ol.case-list { list-style: decimal; }
.case-list--ordered li + li { margin-top: 16px; }

.case-caption {
  font-family: var(--font-display);
  font-weight: 300;
  font-size: 16px;
  line-height: 24px;
}

/* ---------- Case study vertical rhythm ---------- */
.case > * { margin-top: 32px; }
.case > *:first-child { margin-top: 0; }

.case > .eyebrow { margin-top: 88px; }
.case > .eyebrow:first-child { margin-top: 0; }
.case > .eyebrow + * { margin-top: 24px; }
.case > .case-h2 + * { margin-top: 24px; }

.case > .case-figure,
.case > .media-grid,
.case > .results-grid,
.case > .step-flow { margin-top: 64px; }
.case > .case-figure + .case-figure { margin-top: 24px; }

/* An eyebrow directly under a heading is a sub-label (PHASE 1), not a new
   section, so it sits closer than the usual 88px section break. */
.case > .case-h2 + .eyebrow { margin-top: 40px; }
.case > .case-caption + .eyebrow { margin-top: 88px; }

.case > .case-caption { margin-top: 24px; }
.case > .case-caption + * { margin-top: 64px; }

/* ---------- Figures ---------- */
.case-figure { margin: 0; }
.case-figure > img {
  display: block;
  width: 100%;
  height: auto;
}
.case-figure > figcaption { margin-top: 24px; }

/* Some sources are smaller than the column they sit in — cap them at their
   own natural width rather than upscaling into softness. */
.case-figure--cap > img {
  max-width: var(--fig-max, 100%);
  margin-inline: auto;
}

/* ---------- Image crop primitive ----------
   Figma frames don't show these source images whole — each image fill carries
   a scale/offset transform, so the frame shows a window onto a much larger
   picture. `.crop` reproduces that window: the box is locked to the frame's
   aspect ratio and the source is absolutely positioned inside it using the
   exact percentages from the design. Values are passed per instance:

     --crop-ar  frame aspect ratio       (e.g. 584/924)
     --crop-w   source width  as % of frame   (default 100%)
     --crop-h   source height as % of frame   (default 100%)
     --crop-x   source left offset            (default 0%)
     --crop-y   source top offset             (default 0%)

   `.crop--cover` is the simpler case: the frame centre-crops the source, so
   object-fit does the work and only --crop-ar is needed. */
.crop {
  position: relative;
  overflow: hidden;
  aspect-ratio: var(--crop-ar, auto);
}
.crop > img {
  position: absolute;
  left: var(--crop-x, 0%);
  top: var(--crop-y, 0%);
  width: var(--crop-w, 100%);
  height: var(--crop-h, 100%);
  max-width: none;
  display: block;
  /* The percentages already encode the source's own aspect ratio, so the
     image must fill the rect they describe — not be re-cropped inside it. */
  object-fit: fill;
}
.crop--cover > img { object-fit: cover; }

/* ---------- Numbered process steps ----------
   The step titles use the eyebrow treatment, not a display heading, and the
   body is the same 24px measure as the surrounding prose. */
.step-flow {
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
.step-flow > li { counter-increment: step; }
.step-flow > li + li { margin-top: 40px; }

.step-flow__title {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 16px;
  line-height: 24px;
  letter-spacing: 1.6px;
  text-transform: uppercase;
  margin-bottom: 24px;
}
.step-flow__title::before { content: counter(step) ". "; }

/* ---------- Media groups ---------- */
.media-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
}

.media-stack {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Business-unit palette bars stack tight, then one shared caption.
   Each bar is a 280x30 window onto a much taller source image. */
.swatch-set { display: flex; flex-direction: column; gap: 8px; }
.swatch-set > .crop { width: 100%; }
.swatch-set > figcaption { margin-top: 16px; }

/* ---------- Hero ---------- */
.case-hero { padding-top: clamp(40px, 5vw, 92px); }

.case-hero__title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.17;
  max-width: 1193px;
  margin-top: 24px;
}

.case-hero__band {
  margin-top: clamp(48px, 6.25vw, 120px);
  padding-block: clamp(32px, 5vw, 96px) clamp(32px, 3.75vw, 72px);
  background-image: url("images/sequoia/hero-band.png");
  background-size: cover;
  background-position: center;
}

/* The four legacy case studies lead with a photograph rather than a device
   mockup, so the band carries the image itself. Each page passes its own
   via --hero-photo. */
.case-hero__band--photo {
  background-color: var(--band-dark);
  background-image: var(--hero-photo);
  background-size: cover;
  background-position: center;
  /* Defaults to the Figma band proportion; pages whose art has a different
     shape pass --hero-ratio so the image is never cropped. */
  aspect-ratio: var(--hero-ratio, 1920 / 905);
}

/* AI World uses a flat dark band; the laptop sits flush with its top edge. */
.case-hero__band--dark {
  background: var(--band-dark);
  padding-block: 0 clamp(32px, 3.75vw, 72px);
}

.case-hero__band + .case { margin-top: clamp(40px, 3.3vw, 64px); }

/* Laptop mockup: chassis PNG with the page screenshot layered into its
   screen aperture (x 12.97%, y 11.18%, 73.99% x 77.65% of the chassis).
   The source screenshot is a full-length page render at 630.86% height. */
.hero-laptop {
  position: relative;
  width: 78.39%;
  margin-left: 10.78%;
}
.hero-laptop__chassis {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1411 / 841;
  object-fit: cover;
}
.hero-laptop__screen {
  position: absolute;
  left: 12.97%;
  top: 11.18%;
  width: 73.99%;
  height: 77.65%;
  overflow: hidden;
  border-radius: 8px;
  box-shadow: 0 0 4px 4px rgba(12, 12, 13, 0.03);
}
.hero-laptop__screen > img {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 630.86%;
  max-width: none;
  display: block;
}

/* Laptop mockup: chassis PNG sits above the screenshot, which is clipped to
   the screen aperture (x 12.85%, y 12.35%, 74.3% × 75.3% of the chassis). */
.case-device {
  position: relative;
  filter: drop-shadow(0 8px 6px rgba(0, 0, 0, 0.15))
          drop-shadow(0 4px 2px rgba(0, 0, 0, 0.3));
}
.case-device__chassis {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1191 / 737;
  object-fit: cover;
}

/* The screen aperture, and the window it takes onto the page screenshot —
   the source is a full-length page render, of which only the top 1/7.86
   is visible behind the chassis. */
.case-device__screen {
  position: absolute;
  left: 12.85%;
  top: 12.35%;
  width: 74.3%;
  height: 75.3%;
  overflow: hidden;
}
.case-device__screen > img {
  position: absolute;
  left: 0;
  top: -0.11%;
  width: 100%;
  height: 785.98%;
  max-width: none;
  display: block;
}

/* ---------- Results gallery ---------- */
.results-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
  align-items: start;
}

.results-col {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* Tinted panel with a screenshot inset by 16px, matching the Figma boxes. */
.panel {
  margin: 0;
  padding: 16px;
  background: #f5f5f5;
}
.panel--dark { background: #464f4f; }
.panel--teal { background: #c2d4d4; }

/* Two panels let their screenshot run off the right edge. */
.panel--bleed { padding-right: 0; }

/* The isometric spread carries its own background, so it fills the panel. */
.panel--flush { padding: 0; }

/* Several panels hold a stack of screenshots inset by the same 16px. */
.panel--stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel > img,
.panel > .crop {
  display: block;
  width: 100%;
  height: auto;
}
.panel__shot {
  border-radius: 8px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.06);
}
.panel--bleed > .crop,
.panel--bleed > img {
  border-radius: 8px 0 0 8px;
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.06);
}

/* ---------- Footer ---------- */
.site-footer {
  padding-top: clamp(48px, 6vw, 88px);
  padding-bottom: 40px;
}

.site-footer__bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px 40px;
  flex-wrap: wrap;
}

/* ---------- Lightbox ----------
   The <dialog> shrinks to its image. The image is capped at its own natural
   size (972px) so a wide browser never upscales it, and at the viewport
   minus a 48px gutter so a small one never crops it. `width/height: auto`
   plus both maxima keeps the aspect ratio without any calculation. */
.lightbox {
  padding: 0;
  border: 0;
  margin: auto;                 /* centres in the modal viewport */
  background: transparent;
  max-width: none;              /* override the UA's own caps */
  max-height: none;
  overflow: visible;
}
.lightbox::backdrop { background: rgba(0, 0, 0, 0.75); }

.lightbox__img {
  display: block;
  width: auto;
  height: auto;
  max-width: min(972px, calc(100vw - 48px));
  max-height: calc(100dvh - 48px);
  background: var(--surface);
}

.lightbox__close {
  position: absolute;
  top: 12px;
  right: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  cursor: pointer;
  transition: background-color .15s ease;
}
.lightbox__close:hover,
.lightbox__close:focus-visible { background: var(--ink); }

/* Stop the page scrolling behind an open lightbox */
html:has(dialog[open]) { overflow: hidden; }

@media (max-width: 600px) {
  .lightbox__img {
    max-width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
  }
}

/* ---------- Copy-to-clipboard toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 32px;
  transform: translateX(-50%);
  padding: 12px 20px;
  background: var(--ink);
  color: var(--ink-inverse);
  font-family: var(--font-ui);
  font-size: 14px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  z-index: 50;
}
.toast[hidden] { display: none; }

/* =========================================================
   TABLET — 768px and up: two columns
   ========================================================= */
@media (min-width: 768px) {
  :root {
    --label-pad: 20px;
    --label-gap: 40px;
  }

  .work-grid { grid-template-columns: repeat(2, 1fr); }
  .rule__dots { width: 138px; }

  /* Media groups take up their Figma column ratios */
  .media-grid--2       { grid-template-columns: 1fr 1fr; }
  .media-grid--3       { grid-template-columns: repeat(3, 1fr); }
  .media-grid--4       { grid-template-columns: repeat(2, 1fr); }
  .media-grid--736-432 { grid-template-columns: 736fr 432fr; }
  .media-grid--888-280 { grid-template-columns: 888fr 280fr; }
  .results-grid        { grid-template-columns: 736fr 432fr; }
}

/* =========================================================
   DESKTOP — 1200px and up: four columns (the Figma layout)
   ========================================================= */
@media (min-width: 1200px) {
  :root {
    --label-pad: 24px;
    --label-gap: 56px;
  }

  .work-grid { grid-template-columns: repeat(4, 1fr); }

  .site-header__bar { flex-wrap: nowrap; }
  .site-nav { gap: 32px; flex-shrink: 0; }

  /* Case study prose and media indent to columns 3–10; only the audit
     collage breaks out to the full content width. */
  .case > *          { grid-column: 3 / span 8; }
  .case > .case-wide { grid-column: 1 / -1; }

  .media-grid--4 { grid-template-columns: repeat(4, 1fr); }
}

/* =========================================================
   SMALL MOBILE — tighten type that would otherwise wrap badly
   ========================================================= */
@media (max-width: 600px) {
  .site-header__brand,
  .site-footer__brand,
  .site-footer__copy,
  .site-nav a {
    font-size: 12px;
    line-height: 20px;
    letter-spacing: 1.2px;
  }

  .rule__dots { width: 92px; }

  .site-header__bar { gap: 12px; }
  .site-nav { gap: 16px; }

  .hero__actions .btn { flex: 1 1 100%; }

  .aside {
    max-width: none;
    padding-block: 16px;
    font-size: 14px;
    letter-spacing: 1.4px;
  }

  .card__title { font-size: 20px; line-height: 28px; }

  /* Case study: tighter labels and rhythm */
  .eyebrow { font-size: 14px; letter-spacing: 1.4px; }
  .case-list { padding-left: 24px; }

  .case > .eyebrow { margin-top: 56px; }
  .case > .case-figure,
  .case > .media-grid,
  .case > .results-grid { margin-top: 40px; }
  .case > .case-caption + * { margin-top: 40px; }
}
