/* Palette (dark only): near-black fading to dark Toyota Army Green (paint 6V7; Toyota
   publishes no hex, #4f5843 is matched by eye to the non-metallic olive), bronze accent.
   Every text pairing is WCAG AA against the darkest and lightest background. */
:root {
  color-scheme: dark;
  --army: #4f5843; --army-ink: #f3f1e8;
  --bg: #0a0b08; --fg: #ece9de; --muted: #a7aa98; --line: #2a3023; --card: rgba(236, 233, 222, 0.035);
  --link: #d1a95e; --accent: #d1a95e; --accent-ink: #0a0b08;
  --page-bg: linear-gradient(to bottom right, #0a0b08 0%, #0a0b08 35%, #131710 65%, #1f2819 100%);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --measure: 68ch; --gutter: 16px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 17px/1.55 var(--font); }
/* Page background: black fading to dark army green in the bottom-right corner. "to bottom
   right" adapts to the window shape, so on wide screens the fade stays mostly vertical. A fixed layer, so it stays put while content scrolls (and
   avoids background-attachment: fixed, which iOS ignores). */
body::before { content: ""; position: fixed; inset: 0; z-index: -1; background: var(--page-bg); pointer-events: none; }
a { color: var(--link); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent); }
a:focus-visible, .card:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-ink); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -0.01em; margin: 0 0 0.4em; }
h1 { font-size: clamp(1.8rem, 4.5vw, 2.8rem); }
h2 { font-size: 1.35rem; margin-top: 2.2rem; padding-top: 0.6rem; border-top: 1px solid var(--line); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; }
main, .top, .bottom { max-width: 1040px; margin: 0 auto; padding: 0 var(--gutter); }
/* Army Green band; bronze only as a rule under it (bronze text on green fails contrast). */
/* Header: frosted glass, sticky, matching the translucent cards. */
.band {
  position: sticky; top: 0; z-index: 20;
  background: rgba(10, 11, 8, 0.6);
  -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid rgba(236, 233, 222, 0.08);
}
html { scroll-padding-top: 84px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 16px; padding-bottom: 16px; }
.brand { font-weight: 700; color: var(--fg); text-decoration: none; letter-spacing: 0.01em; }
.top nav { display: flex; gap: 22px; flex-wrap: wrap; }
.top nav a { color: var(--muted); text-decoration: none; border-bottom: 1px solid transparent; padding-bottom: 2px; transition: color .15s ease, border-color .15s ease; }
.top nav a:hover, .top a:focus-visible { color: var(--fg); border-bottom-color: var(--accent); }
.top a:focus-visible { outline-color: var(--accent); }
.hero { padding: 4vw 0 2vw; max-width: var(--measure); }
.kicker { font-family: var(--mono); font-size: 0.85rem; color: var(--accent); text-transform: uppercase; letter-spacing: 0.06em; }
.lede { font-size: 1.12rem; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.card { display: block; background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 0 0 16px; color: var(--fg); text-decoration: none; overflow: hidden; transition: transform .15s ease, border-color .15s ease; }
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card-art span { font: 700 2.4rem/1 var(--mono); opacity: .9; }
.card-org { display: block; margin: 12px 16px 4px; font-family: var(--mono); font-size: 0.75rem; color: var(--muted); }
.card h3 { margin: 0 16px 6px; }
.card p { margin: 0 16px; color: var(--muted); font-size: 0.95rem; }
.role { padding: 14px 0; border-bottom: 1px solid var(--line); }
.role-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.dates { font-family: var(--mono); font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.role-context { color: var(--muted); }
.role ul { padding-left: 1.2em; margin: 0.4em 0; }
.role li { margin-bottom: 0.35em; }
.role-links { font-size: 0.95rem; color: var(--muted); }
.chips { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.chips li { border: 1px solid color-mix(in srgb, var(--army) 35%, var(--line)); border-radius: 999px; padding: 4px 12px; font-size: 0.9rem; background: color-mix(in srgb, var(--army) 10%, var(--card)); }
.awards { padding-left: 1.2em; }
.project { max-width: var(--measure); padding-top: 2vw; }
.role-line { color: var(--muted); }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin: 1rem 0; }
.gallery figure { margin: 0; }
.gallery figure:first-child { grid-column: 1 / -1; }
.gallery a { display: block; }
figcaption { font-size: 0.9rem; color: var(--muted); margin-top: 6px; }
.spec { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; }
.spec dt { font-family: var(--mono); font-size: 0.85rem; color: var(--muted); }
.spec dd { margin: 0; }
.results { border-collapse: collapse; width: 100%; }
.results th, .results td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.results th { font-weight: 500; }
.note { font-size: 0.85rem; color: var(--muted); }
.bottom { padding: 32px var(--gutter) 40px; color: var(--muted); font-size: 0.9rem; border-top: 3px solid var(--army); margin-top: 3rem; }
/* Home: journey */
.hero h1 { max-width: 22ch; }
.stat-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 1.6rem 0 0; }
.stat { display: flex; flex-direction: column-reverse; justify-content: flex-end; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-top: 3px solid var(--army); border-radius: 8px; }
.stat dd { margin: 0; font: 700 1.9rem/1.1 var(--font); color: var(--fg); letter-spacing: -0.02em; }
.stat dt { font-size: 0.85rem; color: var(--muted); margin-top: 4px; }
.timeline { list-style: none; margin: 1.4rem 0 0; padding: 0 0 0 28px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: linear-gradient(var(--army), var(--accent)); opacity: .55; }
.timeline > li { position: relative; margin-bottom: 28px; }
.timeline > li::before { content: ""; position: absolute; left: -27px; top: 6px; width: 14px; height: 14px; border-radius: 50%; background: var(--bg); border: 3px solid var(--army); }
.chapter-years { display: block; font: 600 0.85rem/1 var(--mono); color: var(--accent); letter-spacing: .04em; margin: 4px 0 10px; }
.chapter-card { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 0; background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.chapter-body { padding: 18px 22px 20px; }
.chapter-body h3 { font-size: 1.5rem; margin-bottom: 6px; }
.chapter-body .kicker { margin-bottom: 4px; }
.chapter-context { color: var(--muted); }
.chapter-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px 18px; margin: 14px 0 16px; }
.chapter-stats div { display: flex; flex-direction: column; }
.chapter-stats dd { margin: 0; font: 700 1.35rem/1.1 var(--font); color: var(--link); }
.chapter-stats dt { font-size: 0.82rem; color: var(--muted); }
.cta { display: inline-block; font-weight: 600; color: var(--link); padding: 6px 0; }
.built { grid-column: 1 / -1; border-top: 1px solid var(--line); padding: 14px 22px 18px; }
.built-label { font: 600 0.8rem/1 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 10px; }
.built-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.built-grid a { display: block; color: var(--fg); text-decoration: none; font-size: 0.85rem; line-height: 1.3; }
.built-grid a:hover span { color: var(--accent); }
.thread { padding: 4px 0 4px 2px; max-width: var(--measure); }
.thread::before { background: var(--accent) !important; border-color: var(--accent) !important; width: 10px !important; height: 10px !important; left: -25px !important; top: 9px !important; }
.thread-tag { font: 600 0.8rem/1 var(--mono); color: var(--accent); text-transform: uppercase; letter-spacing: .05em; }
.thread p { margin: 6px 0 0; font-size: 1.05rem; font-style: italic; color: var(--fg); }
.background h2:first-child { margin-top: 3rem; }
/* Placeholders (draft only; the Vercel build refuses to run while any remain). */
.draft-banner { margin: 16px 0 0; padding: 8px 12px; border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--card)); font-size: 0.9rem; color: var(--muted); }
/* Placeholder text: muted italic with a small bronze tag. */
span.ph, .thread.ph p, .cta.ph { color: var(--muted); font-style: italic; }
span.ph::after, .thread.ph .thread-tag::after, .stat.ph dt::after, .cta.ph::after { content: "draft"; display: inline-block; margin-left: 6px; padding: 2px 6px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font: 600 0.62rem/1.2 var(--mono); font-style: normal; text-transform: uppercase; letter-spacing: .05em; vertical-align: middle; }
.cta.ph::after { content: "page coming"; }
.stat.ph dd { color: var(--muted); }
/* Missing photo: flat tinted panel. */
.ph-img { display: grid; place-content: center; gap: 6px; padding: 16px; text-align: center; font-size: 0.85rem; color: var(--muted); background: color-mix(in srgb, var(--army) 9%, var(--card)); }
.ph-img span { font: 600 0.68rem/1 var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.ph-img.small { padding: 8px; }
@media (max-width: 720px) {
  .chapter-card { grid-template-columns: 1fr; }
  .timeline { padding-left: 22px; }
  .timeline > li::before { left: -22px; }
  .timeline::before { left: 4px; }
}
@media (max-width: 600px) { .spec { grid-template-columns: 1fr; gap: 2px 0; } .spec dd { margin-bottom: 8px; } .top { flex-direction: column; align-items: flex-start; gap: 8px; } html { scroll-padding-top: 110px; } }
@media (prefers-reduced-motion: reduce) { .card { transition: none; } .card:hover { transform: none; } }
.ph-img em { display: block; font-style: normal; max-width: 28ch; }
.background .role:last-of-type { border-bottom: none; }
.group-roles { list-style: none; margin: 10px 0 14px; padding: 0; }
.group-roles li { padding: 10px 0; border-top: 1px solid var(--line); }
.group-roles li:first-child { border-top: none; padding-top: 0; }
.group-role-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: baseline; }
.group-roles .chapter-context { margin: 4px 0 6px; font-size: 0.95rem; }
.group-stat { margin: 0; font-size: 0.85rem; color: var(--muted); }
.group-stat b { font-size: 1.1rem; color: var(--link); margin-right: 4px; }
.headline.ph { color: inherit; font-style: normal; }
/* Company pages */
.company { padding-top: 2vw; }
.company-head, .company .prose { max-width: var(--measure); }
.company-hero { margin: 1.4rem 0 0; }
.company .stat-strip { max-width: 760px; }
.company-built .grid { margin-top: 0.6rem; }
.company-nav { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 3rem; padding-top: 1rem; border-top: 1px solid var(--line); font-weight: 600; }
.cta-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 20px; margin: 0; }
.site-link { font-size: 0.92rem; }
.site-link a, a.site-link { color: var(--muted); }
.site-link a:hover, a.site-link:hover { color: var(--accent); }
.company-gallery { max-width: var(--measure); }
.company-gallery figure:first-child { grid-column: auto; }
.card-art.small span { font-size: 1.4rem; }

/* Images. Rule: never crop or letterbox a picture. Free-standing images (heroes, card
   media, galleries) keep their own aspect ratio, capped in height and centred. Uniform
   tiles use a 4:3 frame; the template adds .fit-cover only when an image is within 3%
   of 4:3 (negligible crop), otherwise .fit-contain shows it whole. */
.company-hero img, .chapter-media img, .gallery img, .gallery video {
  display: block; width: auto; max-width: 100%; height: auto; margin: 0 auto;
  border-radius: 8px; border: 1px solid var(--line);
}
.company-hero img { max-height: 75vh; border-radius: 12px; }
.chapter-media { display: flex; align-items: center; justify-content: center; padding: 18px 0 18px 18px; }
.chapter-media img { max-height: 420px; }
.chapter-media .ph-img { width: 100%; aspect-ratio: 4 / 3; border-radius: 8px; }
.gallery figure:first-child img, .gallery figure:first-child video { max-height: 80vh; }
.gallery figure:not(:first-child) img, .gallery figure:not(:first-child) video { max-height: 460px; }
.gallery video { background: #000; }
.company-gallery figure:first-child img { max-height: 460px; }
.tile-frame { display: flex; align-items: center; justify-content: center; aspect-ratio: 4 / 3; overflow: hidden; }
.tile-frame img { display: block; max-width: 100%; max-height: 100%; }
.tile-frame img.fit-cover { width: 100%; height: 100%; object-fit: cover; }
.tile-frame img.fit-contain { width: auto; height: auto; border-radius: 6px; }
.card .tile-frame { background: var(--bg); }
.built-grid .tile-frame { border-radius: 6px; margin-bottom: 6px; }
.built-grid .tile-frame img.fit-cover { border-radius: 6px; border: 1px solid var(--line); }
.card-art { display: grid; place-items: center; width: 100%; aspect-ratio: 4 / 3; height: auto; background: linear-gradient(135deg, var(--army) 40%, #8a6224 160%); color: var(--army-ink); }
.built-grid .card-art { border-radius: 6px; margin-bottom: 6px; }
@media (max-width: 720px) {
  .chapter-media { padding: 16px 16px 0; }
  .chapter-media img { max-height: 360px; }
}

/* Round 1 design fixes */
.built-grid .tile-frame, .card .tile-frame { background: var(--bg); }
.built-grid .tile-frame img.fit-contain { border-radius: 0; }
.awards { columns: 2 340px; column-gap: 40px; }
.awards li { break-inside: avoid; margin-bottom: 0.3em; }

/* Round 2 design fixes */
/* Galleries: masonry columns so mixed portrait/landscape images pack without gaps. */
.gallery { display: block; columns: 2 280px; column-gap: 16px; }
.gallery figure { break-inside: avoid; margin: 0 0 18px; }
.gallery figure:first-child { column-span: all; }
.company-gallery figure:first-child { column-span: none; }
/* Images align with the text column instead of floating centred. */
.company-hero img, .gallery img, .gallery video { margin: 0; }
/* Projects without a photo: text-only card. */
.card.no-media { padding-top: 6px; }
/* Number values never wrap. */
.results td { text-align: right; min-width: 9ch; }
@media (max-width: 600px) {
  .results tr { display: block; padding: 6px 0; border-bottom: 1px solid var(--line); }
  .results th, .results td { display: block; border: 0; padding: 0 8px; text-align: left; }
  .results td { font-weight: 600; }
}

/* Chapter cards without a photo: single column. */
.chapter-card.no-media { grid-template-columns: 1fr; }
.group-roles .chapter-context p { margin: 4px 0 6px; }
/* Section spacing: headings breathe above their tables and lists. */
h2 { margin-top: 3rem; padding-top: 1.1rem; margin-bottom: 0.9rem; }
.results { margin-top: 0.4rem; }
.results th, .results td { padding: 10px 10px; }
/* Tools and processes: label and value share a baseline. */
.spec { align-items: baseline; gap: 12px 24px; margin-top: 0.4rem; }
.spec dt { line-height: 1.55; }
