/* ==========================================================================
   Dragoneers · FTC Team 607 — site styles
   Change colors and fonts here, at the top. Everything else uses these names.
   ========================================================================== */
:root {
  --paper: #f3eee4;        /* page background */
  --paper-2: #e9e2d3;      /* slightly darker panels on the paper background */
  --ink: #17140f;          /* main text */
  --ink-2: #5b544a;        /* secondary text */
  --gold: #e8940f;         /* team gold */
  --gold-deep: #b86e06;    /* darker gold for text on light backgrounds */
  --coal: #1a1714;         /* dark page background (Robot page, footer) */
  --coal-2: #26221e;       /* panels on the dark background */
  --rule: rgba(23, 20, 15, 0.16);
  --rule-dark: rgba(243, 238, 228, 0.16);

  --display: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;

  --max: 1280px;
  --gutter: clamp(18px, 4vw, 44px);
}

/* Fonts are in /fonts (Open Font License) */
@font-face { font-family: "Barlow Condensed"; font-weight: 500; font-display: swap; src: url("/fonts/barlow-condensed-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 700; font-display: swap; src: url("/fonts/barlow-condensed-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 800; font-display: swap; src: url("/fonts/barlow-condensed-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 200 900; font-display: swap; src: url("/fonts/source-serif-4-latin-wght-normal.woff2") format("woff2"); }
@font-face { font-family: "Source Serif 4"; font-weight: 200 900; font-style: italic; font-display: swap; src: url("/fonts/source-serif-4-latin-wght-italic.woff2") format("woff2"); }

/* --- Base ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.55;
  font-feature-settings: "kern", "liga", "onum";
}
body.dark { background: var(--coal); color: var(--paper); }

img, video { max-width: 100%; height: auto; display: block; }
img { background: var(--paper-2); }
.dark img { background: var(--coal-2); }

a { color: inherit; text-decoration-color: var(--gold); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--gold-deep); }
.dark a:hover { color: var(--gold); }

h1, h2, h3, h4 { font-family: var(--display); font-weight: 800; line-height: 0.95; letter-spacing: -0.01em; text-transform: uppercase; margin: 0 0 0.4em; }
h1 { font-size: clamp(3rem, 9vw, 7.5rem); }
h2 { font-size: clamp(2.2rem, 5vw, 4rem); }
h3 { font-size: clamp(1.5rem, 2.6vw, 2.1rem); letter-spacing: 0; }
h4 { font-size: 1.25rem; letter-spacing: 0.02em; }
p { margin: 0 0 1em; max-width: 68ch; }
.lede { font-size: clamp(1.25rem, 2vw, 1.5rem); line-height: 1.4; font-weight: 350; }
.muted { color: var(--ink-2); }
.dark .muted { color: rgba(243, 238, 228, 0.7); }
small { font-size: 0.875rem; }

/* Small uppercase labels with a gold dot ("eyebrows") */
.eyebrow {
  font-family: var(--display); font-weight: 700; font-size: 0.95rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-2); display: flex; align-items: center; gap: 0.6em; margin: 0 0 1rem;
}
.eyebrow::before { content: ""; width: 0.55em; height: 0.55em; border-radius: 50%; background: var(--gold); flex: none; }
.dark .eyebrow { color: rgba(243, 238, 228, 0.7); }

/* Big condensed numbers (team number, dates, stats) */
.num { font-family: var(--display); font-weight: 800; letter-spacing: -0.02em; line-height: 1; }

/* Layout helpers */
.wrap { width: min(var(--max), 100% - 2 * var(--gutter)); margin-inline: auto; }
.section { padding-block: clamp(3rem, 7vw, 6rem); }
.section + .section { border-top: 1px solid var(--rule); }
.dark .section + .section { border-top-color: var(--rule-dark); }
.rule { border: 0; border-top: 1px solid var(--rule); margin: 0; }
.dark .rule { border-top-color: var(--rule-dark); }

.grid { display: grid; gap: clamp(1rem, 2.5vw, 2rem); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.split { display: grid; grid-template-columns: 5fr 7fr; gap: clamp(1.5rem, 4vw, 4rem); align-items: start; }
.split.reverse { grid-template-columns: 7fr 5fr; }
.sticky { position: sticky; top: 5rem; }
@media (max-width: 900px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .split, .split.reverse { grid-template-columns: 1fr; }
  .sticky { position: static; }
}
@media (max-width: 560px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }

.skip { position: absolute; left: -999px; top: 0; background: var(--gold); color: var(--ink); padding: 0.5rem 1rem; font-family: var(--display); }
.skip:focus { left: 1rem; z-index: 100; }

/* --- Header / nav ------------------------------------------------------- */
.nav {
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap;
  padding-block: 1rem; border-bottom: 1px solid var(--rule);
}
.dark .nav { border-bottom-color: var(--rule-dark); }
.brand { display: flex; align-items: center; gap: 0.8rem; text-decoration: none; }
.brand img { width: 40px; height: auto; background: none; }
.brand-name { font-family: var(--display); font-weight: 800; font-size: 1.6rem; letter-spacing: 0.02em; text-transform: uppercase; line-height: 1; }
.brand-sub { display: block; font-weight: 500; font-size: 0.8rem; letter-spacing: 0.16em; color: var(--ink-2); margin-top: 2px; }
.dark .brand-sub { color: rgba(243, 238, 228, 0.7); }
.nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.25rem 1.4rem; }
.nav li a {
  font-family: var(--display); font-weight: 700; font-size: 1.05rem; letter-spacing: 0.1em; text-transform: uppercase;
  text-decoration: none; padding: 0.4rem 0; border-bottom: 2px solid transparent;
}
.nav li a:hover, .nav li a[aria-current="page"] { border-bottom-color: var(--gold); color: inherit; }
@media (max-width: 700px) { .nav ul { gap: 0.1rem 1rem; } .nav li a { font-size: 0.95rem; } }

/* --- Hero (home) -------------------------------------------------------- */
.hero { position: relative; color: var(--paper); background: var(--coal); overflow: hidden; }
.hero img { width: 100%; height: min(88vh, 900px); object-fit: cover; object-position: center 40%; }
.hero-text { position: absolute; inset: auto 0 0 0; padding: clamp(2rem, 6vw, 5rem) 0 clamp(1.5rem, 4vw, 3rem); background: linear-gradient(to top, rgba(26, 23, 20, 0.92) 0%, rgba(26, 23, 20, 0.55) 55%, rgba(26, 23, 20, 0) 100%); }
.hero h1 { color: var(--paper); margin: 0; }
.hero h1 .gold { color: var(--gold); }
.hero .eyebrow { color: rgba(243, 238, 228, 0.85); }
.hero p { color: rgba(243, 238, 228, 0.85); max-width: 46ch; margin-top: 1rem; }
.hero-caption { position: absolute; top: 1rem; right: var(--gutter); font-family: var(--display); font-size: 0.85rem; letter-spacing: 0.12em; text-transform: uppercase; color: rgba(243, 238, 228, 0.7); }

/* --- Photos -------------------------------------------------------------- */
figure { margin: 0; }
figure.photo img { width: 100%; height: auto; }
figure.photo.cover img { aspect-ratio: 4 / 3; object-fit: cover; }
figure.photo.tall img { aspect-ratio: 3 / 4; object-fit: cover; }
figure.photo.wide img { aspect-ratio: 16 / 9; object-fit: cover; }
figcaption {
  font-family: var(--display); font-weight: 500; font-size: 0.9rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-2); margin-top: 0.6rem; display: flex; gap: 0.6em; align-items: baseline;
}
figcaption::before { content: ""; width: 0.45em; height: 0.45em; border-radius: 50%; background: var(--gold); flex: none; transform: translateY(-0.1em); }
.dark figcaption { color: rgba(243, 238, 228, 0.7); }

/* Photo strip filled by js/strip.js */
.strip { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: 0.75rem; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 0.5rem; scrollbar-width: thin; }
.strip a { scroll-snap-align: start; display: block; }
.strip img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }

/* Video */
.clip video { width: 100%; aspect-ratio: 16 / 9; background: #000; object-fit: cover; }
.clip.portrait video { aspect-ratio: 9 / 16; max-height: 70vh; margin-inline: auto; width: auto; }

/* --- Buttons -------------------------------------------------------------- */
.btn {
  display: inline-block; font-family: var(--display); font-weight: 700; font-size: 1.05rem; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 0.7rem 1.3rem; border: 2px solid currentColor; text-decoration: none; transition: background 0.15s, color 0.15s;
}
.btn:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.dark .btn:hover { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.btn.gold { background: var(--gold); border-color: var(--gold); color: var(--ink); }
.btn.gold:hover { background: var(--gold-deep); border-color: var(--gold-deep); color: var(--paper); }

/* --- Stats row ------------------------------------------------------------ */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1.5rem; }
.stats .num { font-size: clamp(3rem, 6vw, 5rem); color: var(--gold-deep); }
.dark .stats .num { color: var(--gold); }
.stats .label { font-family: var(--display); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; font-size: 0.95rem; color: var(--ink-2); }

/* --- Timeline (journal) ---------------------------------------------------- */
h2.season { margin-top: 3.5rem; padding-top: 2rem; border-top: 1px solid var(--rule); color: var(--gold-deep); }
h2.season:first-of-type { margin-top: 1.5rem; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { display: grid; grid-template-columns: 10rem 1fr; gap: clamp(1rem, 3vw, 3rem); padding-block: clamp(2.5rem, 5vw, 4rem); border-top: 1px solid var(--rule); position: relative; }
.timeline > li:first-child { border-top: 0; }
.tl-date { position: sticky; top: 5rem; align-self: start; }
.tl-date .num { font-size: clamp(2.6rem, 5vw, 4rem); color: var(--gold-deep); display: block; }
.tl-date .month { font-family: var(--display); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; font-size: 1rem; color: var(--ink-2); }
.tl-body h3 { margin-bottom: 0.5rem; }
.tl-body .grid { margin-top: 1.5rem; }
@media (max-width: 700px) {
  .timeline > li { grid-template-columns: 1fr; gap: 0.75rem; }
  .tl-date { position: static; display: flex; align-items: baseline; gap: 0.6rem; }
  .tl-date .num { font-size: 2.4rem; }
}

/* --- Robot page (dark) subsystem blocks ---------------------------------- */
.subsystem { padding-block: clamp(3rem, 6vw, 5rem); border-top: 1px solid var(--rule-dark); }
.subsystem:first-of-type { border-top: 0; }
.subsystem .index { font-family: var(--display); font-weight: 800; font-size: clamp(4rem, 10vw, 9rem); line-height: 0.8; color: var(--gold); opacity: 0.9; }
.spec { list-style: none; margin: 1.5rem 0 0; padding: 0; border-top: 1px solid var(--rule-dark); }
.spec li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.6rem 0; border-bottom: 1px solid var(--rule-dark); font-size: 1rem; }
.spec li span:first-child { font-family: var(--display); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; font-size: 0.9rem; color: rgba(243, 238, 228, 0.7); }
.spec li span:last-child { text-align: right; }

/* --- Gallery ----------------------------------------------------------------- */
.search { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 1rem; margin-block: 1.5rem 2rem; border-bottom: 2px solid var(--ink); padding-bottom: 0.6rem; max-width: 42rem; }
.search .eyebrow { margin: 0; }
.search input { font: 400 1.25rem/1.3 var(--serif); color: var(--ink); background: none; border: 0; outline: none; width: 100%; min-width: 0; }
.search input::placeholder { color: var(--ink-2); opacity: 0.7; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.search .count { font-family: var(--display); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; font-size: 0.9rem; color: var(--ink-2); white-space: nowrap; }
.search:focus-within { border-bottom-color: var(--gold); }

/* Justified rows: each tile's flex-grow is its aspect ratio, so rows fill the width */
.gallery { display: flex; flex-wrap: wrap; gap: 6px; }
.gallery::after { content: ""; flex-grow: 1000; }
.gallery a { flex-grow: calc(var(--ar) * 100); flex-basis: calc(var(--ar) * 240px); aspect-ratio: var(--ar); display: block; position: relative; overflow: hidden; background: var(--paper-2); }
.gallery a[hidden] { display: none; }
.gallery img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.4s ease; }
.gallery a:hover img { transform: scale(1.03); }
.gallery a:focus-visible { outline: 3px solid var(--gold); outline-offset: -3px; }
.gallery-empty { padding: 3rem 0; color: var(--ink-2); }
@media (max-width: 560px) { .gallery a { flex-basis: calc(var(--ar) * 150px); } }

/* Lightbox */
.lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; }
.lightbox::backdrop { background: rgba(23, 20, 15, 0.94); }
.lightbox .frame { position: fixed; inset: 0; display: grid; grid-template-rows: 1fr auto; color: var(--paper); background: rgba(23, 20, 15, 0.94); }
.lightbox img { max-width: 100vw; max-height: calc(100vh - 6.5rem); width: auto; height: auto; margin: auto; background: none; object-fit: contain; }
.lightbox .bar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem var(--gutter) 1.25rem; font-family: var(--display); letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.95rem; }
.lightbox .bar .cap { display: flex; gap: 0.6em; align-items: baseline; }
.lightbox .bar .cap::before { content: ""; width: 0.45em; height: 0.45em; border-radius: 50%; background: var(--gold); flex: none; }
.lightbox .bar .cap .event { color: rgba(243, 238, 228, 0.6); margin-left: 0.5em; }
.lightbox .bar .counter { color: rgba(243, 238, 228, 0.6); white-space: nowrap; }
.lightbox button { position: fixed; top: 50%; transform: translateY(-50%); background: rgba(26, 23, 20, 0.6); color: var(--paper); border: 0; width: 3rem; height: 4rem; font-size: 1.8rem; cursor: pointer; }
.lightbox button:hover { background: var(--gold); color: var(--ink); }
.lightbox .prev { left: 0; } .lightbox .next { right: 0; }
.lightbox .close { top: 0; transform: none; right: 0; height: 3rem; font-size: 1.5rem; }
@media (max-width: 700px) { .lightbox button.prev, .lightbox button.next { display: none; } }

/* --- Cards / info -------------------------------------------------------------- */
.card { border: 1px solid var(--rule); padding: 1.5rem; background: var(--paper); }
.dark .card { border-color: var(--rule-dark); background: var(--coal-2); }
.card h3 { margin-bottom: 0.5rem; }
.card .num { font-size: 2.6rem; color: var(--gold-deep); }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 0.4rem 1.5rem; margin: 0; }
.dl dt { font-family: var(--display); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; font-size: 0.9rem; color: var(--ink-2); padding-top: 0.25rem; }
.dl dd { margin: 0; }

/* --- Footer --------------------------------------------------------------------- */
.footer { background: var(--coal); color: var(--paper); padding-block: clamp(2.5rem, 5vw, 4rem) 2rem; margin-top: clamp(3rem, 7vw, 6rem); }
.dark .footer { border-top: 1px solid var(--rule-dark); margin-top: 0; }
.footer .cols { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 2rem; }
.footer .big { font-family: var(--display); font-weight: 800; font-size: clamp(2.5rem, 6vw, 4.5rem); line-height: 0.9; text-transform: uppercase; }
.footer .big span { color: var(--gold); }
.footer .big + p { margin-top: 1rem; }
.footer ul { list-style: none; margin: 0; padding: 0; }
.footer li { padding: 0.2rem 0; }
.footer a { text-decoration: none; }
.footer a:hover { color: var(--gold); }
.footer .fine { margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid var(--rule-dark); font-size: 0.9rem; color: rgba(243, 238, 228, 0.6); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem 2rem; }
@media (max-width: 700px) { .footer .cols { grid-template-columns: 1fr; } }

/* --- Dark band inside a light page (home page robot teaser) ------------------- */
.band-dark { background: var(--coal); color: var(--paper); }
.band-dark .eyebrow, .band-dark figcaption, .band-dark .muted { color: rgba(243, 238, 228, 0.7); }
.band-dark img { background: var(--coal-2); }
.band-dark a:hover { color: var(--gold); }
.band-dark .btn:hover { background: var(--gold); color: var(--ink); border-color: var(--gold); }
.band-dark .spec, .band-dark .spec li { border-color: var(--rule-dark); }
.band-dark .spec li span:first-child { color: rgba(243, 238, 228, 0.7); }

/* Journal teasers on the home page */
.teaser { text-decoration: none; display: block; }
.teaser img { aspect-ratio: 4 / 3; object-fit: cover; width: 100%; }
.teaser .date { font-family: var(--display); font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; font-size: 0.9rem; color: var(--gold-deep); margin-top: 0.9rem; display: block; }
.teaser h3 { margin: 0.2rem 0 0.3rem; }
.teaser p { color: var(--ink-2); font-size: 1rem; margin: 0; }
.teaser:hover h3 { color: var(--gold-deep); }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.section-head h2, .section-head .eyebrow { margin-bottom: 0; }
