/* Houston N'Crowd — site redesign.
 * Design system carried over from the Runner Schedule prototype:
 * navy + gold + ballast grey, light/dark, mobile-first. One shared shell
 * across every page so the navigation is identical and correct everywhere. */

:root {
  --navy: #000099;
  --navy-deep: #050a4a;
  --navy-2: #101a70;
  --gold: #ffcc00;
  --gold-deep: #e0a800;

  --bg: #eceef3;          /* ballast grey */
  --surface: #ffffff;
  --surface-2: #f5f6fa;
  --ink: #1a1f2e;
  --ink-soft: #5a6172;
  --line: #dce0ea;

  --red: #c0392b;   --red-bg: #fbeae7;
  --amber: #b07400; --amber-bg: #fbf1dc;
  --green: #2e7d47; --green-bg: #e7f4ec;

  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 8px 24px rgba(10,16,54,.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --navy: #2a3ad6;
    --navy-deep: #0a1140;
    --navy-2: #16205e;
    --bg: #12141b;
    --surface: #1c1f29;
    --surface-2: #232733;
    --ink: #eceef3;
    --ink-soft: #a6acbb;
    --line: #2f3542;
    --red: #ef6a5b;   --red-bg: #3a201d;
    --amber: #e0a54a; --amber-bg: #362a15;
    --green: #63c281; --green-bg: #17301f;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Helvetica, Arial, sans-serif;
  line-height: 1.5;
}

.wrap { max-width: 1000px; margin: 0 auto; padding: 0 20px; }
img { max-width: 100%; height: auto; }
a { color: var(--navy); }
@media (prefers-color-scheme: dark) { a { color: #8ea0ff; } }

/* ===== Top bar ===== */
.topbar { background: var(--surface); border-bottom: 3px solid var(--gold); }
.topbar-inner { display: flex; align-items: center; gap: 14px; padding: 12px 20px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: inherit; min-width: 0; }
.logo-img { height: 60px; width: auto; display: block; border-radius: 6px; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-name { font-weight: 800; font-size: 1.35rem; color: var(--navy); letter-spacing: .2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (prefers-color-scheme: dark) { .brand-name { color: var(--ink); } }
.brand-sub { font-size: .78rem; color: var(--ink-soft); }
.demo-badge {
  margin-left: auto; flex-shrink: 0;
  font-size: .68rem; font-weight: 800; letter-spacing: .14em; color: var(--navy);
  background: var(--gold); padding: 5px 10px; border-radius: 999px; white-space: nowrap;
}
.badge-short { display: none; }
.nav-toggle {
  display: none; margin-left: auto; font-size: 1.5rem; line-height: 1;
  background: none; border: none; color: var(--navy); cursor: pointer; padding: 4px 8px;
}
@media (prefers-color-scheme: dark) { .nav-toggle { color: var(--ink); } }

/* ===== Main nav ===== */
.mainnav { background: var(--navy-deep); }
.mainnav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
.mainnav a {
  display: block; padding: 13px 15px; color: #dfe3ff; text-decoration: none;
  font-size: .9rem; font-weight: 600; border-bottom: 3px solid transparent;
  transition: background .12s, color .12s, border-color .12s;
}
.mainnav a:hover { background: rgba(255,255,255,.08); color: #fff; }
.mainnav a.active {
  color: var(--gold); border-bottom-color: var(--gold); background: rgba(0,0,0,.2);
}

/* ===== Hero ===== */
.hero {
  color: #fff;
  background-color: var(--navy-2);
  background-image:
    linear-gradient(90deg, rgba(5,10,74,.92), rgba(5,10,74,.55)),
    url("assets/Index_IMG_3526.jpg");
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
}
.hero-overlay { padding: 42px 0; }
.hero h1 { margin: 0 0 8px; font-size: 2rem; color: var(--gold); text-shadow: 0 2px 8px rgba(0,0,0,.4); }
.hero p { margin: 0; max-width: 680px; font-size: 1.02rem; color: #eef0ff; }
.hero strong { color: #fff; }
.hero a { color: #fff; }

.page { padding-top: 26px; padding-bottom: 12px; }

/* ===== Panels ===== */
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; margin-bottom: 26px; box-shadow: var(--shadow);
}
.panel-head { margin-bottom: 16px; }
.panel-head h2 { margin: 0 0 4px; font-size: 1.15rem; color: var(--navy); }
@media (prefers-color-scheme: dark) { .panel-head h2 { color: var(--ink); } }
.panel-sub { margin: 0; color: var(--ink-soft); font-size: .9rem; }

/* ===== Prose ===== */
.prose { color: var(--ink); }
.prose h2 { color: var(--navy); font-size: 1.3rem; margin: 0 0 12px; }
.prose h3 { color: var(--navy); font-size: 1.05rem; margin: 20px 0 6px; }
@media (prefers-color-scheme: dark) { .prose h2, .prose h3 { color: var(--ink); } }
.prose p { margin: 0 0 14px; }
.prose ul { margin: 0 0 14px; padding-left: 22px; }
.prose li { margin: 4px 0; }
.mapslink { white-space: nowrap; }
.address {
  background: var(--surface-2); border: 1px solid var(--line); border-left: 4px solid var(--gold);
  border-radius: 8px; padding: 12px 16px; margin: 14px 0; font-style: normal;
}

/* ===== Split (text + media) ===== */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; align-items: start; }
.split.narrow-media { grid-template-columns: 1.2fr .8fr; }
.split .media img { border-radius: 10px; border: 1px solid var(--line); display: block; width: 100%; }
.figure { text-align: center; }
.figure figcaption { font-size: .82rem; color: var(--ink-soft); margin-top: 6px; }
@media (max-width: 760px) { .split, .split.narrow-media { grid-template-columns: 1fr; } }

/* ===== Gallery ===== */
.gallery { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.gallery a { display: block; cursor: zoom-in; }
.gallery img {
  width: 100%; border-radius: 10px; border: 1px solid var(--line);
  box-shadow: var(--shadow); display: block;
}

/* ===== Photo essay (quarterly reports) ===== */
.essay { max-width: 820px; margin: 0 auto; }
.essay figure { margin: 0 0 22px; }
.essay figure img {
  width: 100%; border-radius: 10px; border: 1px solid var(--line); box-shadow: var(--shadow); display: block;
}
.essay figcaption { margin-top: 10px; color: var(--ink-soft); font-size: .95rem; text-align: center; }
.essay .lead { text-align: center; color: var(--ink-soft); margin: 0 0 24px; }

/* ===== Card grid (photos hub) ===== */
.card-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.card {
  background: var(--surface-2); border: 1px solid var(--line); border-top: 4px solid var(--navy);
  border-radius: 10px; overflow: hidden; display: flex; flex-direction: column;
  text-decoration: none; color: inherit; transition: transform .08s ease, box-shadow .12s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.card .thumb { aspect-ratio: 1 / 1; overflow: hidden; background: var(--line); }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card .card-body { padding: 12px 14px; font-size: .9rem; font-weight: 600; }
.card.wide { grid-column: 1 / -1; }
.card.wide .thumb { aspect-ratio: auto; max-height: 360px; }
.card.wide .thumb img { object-fit: cover; }
.card-tag { display: inline-block; font-size: .7rem; font-weight: 800; letter-spacing: .06em;
  color: var(--navy); background: var(--gold); padding: 2px 7px; border-radius: 999px; margin-left: 6px; }
@media (prefers-color-scheme: dark) { .card-tag { color: #0a1140; } }

/* ===== Special run cars ===== */
.car-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fill, minmax(300px, 460px)); justify-content: center; }
.car-card {
  background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--navy);
  border-radius: 10px; overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column;
}
.car-card .car-photos { background: var(--surface-2); display: grid; gap: 1px; }
.car-card .car-photos a { display: block; cursor: zoom-in; }
.car-card .car-photos img { width: 100%; height: auto; display: block; }
.car-info { padding: 12px 14px; display: flex; flex-direction: column; gap: 5px; }
.car-year {
  align-self: flex-start; font-size: .7rem; font-weight: 800; letter-spacing: .05em;
  color: var(--navy-deep); background: var(--gold); padding: 2px 9px; border-radius: 999px;
}
@media (prefers-color-scheme: dark) { .car-year { color: #0a1140; } }
.car-name { font-weight: 700; font-size: .96rem; line-height: 1.3; }
.car-maker { font-size: .82rem; color: var(--ink-soft); }
.car-card.wide { grid-column: 1 / -1; }
.car-card.wide .car-info { align-items: center; text-align: center; }

/* ===== Archive (year lists) ===== */
.archive { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.archive .year { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.archive .year h3 { margin: 0 0 8px; color: var(--navy); font-size: 1rem; }
@media (prefers-color-scheme: dark) { .archive .year h3 { color: var(--gold); } }
.archive ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.archive a { text-decoration: none; font-size: .88rem; }
.archive a:hover { text-decoration: underline; }

/* ===== Members sign-in ===== */
.signin-panel { max-width: 440px; margin: 0 auto; }
.signin-form { display: grid; gap: 14px; }
.signin-form label { display: grid; gap: 5px; font-size: .88rem; font-weight: 600; }
.signin-form input {
  font: inherit; padding: 10px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--ink);
}
.signin-form input:focus-visible { outline: 2px solid var(--navy); outline-offset: 1px; }
.signin-form .btn { justify-self: start; }
.signin-hint { font-size: .8rem; margin: 14px 0 0; }
.signed-in-bar {
  display: flex; align-items: center; gap: 8px; justify-content: flex-end;
  font-size: .88rem; color: var(--ink-soft); margin-bottom: 18px;
}
.linkbtn { background: none; border: none; color: var(--navy); font: inherit; font-weight: 700; cursor: pointer; padding: 0; text-decoration: underline; }
@media (prefers-color-scheme: dark) { .linkbtn { color: #8ea0ff; } }

/* ===== Members-only tiles ===== */
.member-tiles { display: grid; gap: 20px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.member-tile {
  background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--navy);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 30px 24px;
  text-align: center; text-decoration: none; color: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  transition: transform .08s ease, box-shadow .12s ease;
}
a.member-tile:hover { transform: translateY(-3px); box-shadow: 0 4px 8px rgba(0,0,0,.08), 0 14px 32px rgba(10,16,54,.12); }
.member-tile .tile-icon { font-size: 2.6rem; line-height: 1; }
.member-tile h2 { margin: 0; font-size: 1.25rem; color: var(--navy); }
@media (prefers-color-scheme: dark) { .member-tile h2 { color: var(--ink); } }
.member-tile p { margin: 0; color: var(--ink-soft); font-size: .92rem; flex: 1; }
.member-tile .btn { margin-top: 6px; }

/* False / decorative links (content not part of this preview) */
.false-link { color: var(--ink-soft); cursor: not-allowed; text-decoration: none; border-bottom: 1px dotted var(--ink-soft); }
.false-link:hover { color: var(--ink); }

/* ===== Prev / next ===== */
.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin: 10px 0 4px; font-weight: 700; }
.pager .btn-ghost { padding: 7px 14px; }
.pager .disabled { color: var(--ink-soft); opacity: .5; }

/* ===== Buttons ===== */
.btn { font: inherit; font-weight: 700; border-radius: 8px; padding: 9px 18px; cursor: pointer; border: 1px solid transparent; text-decoration: none; display: inline-block; }
.btn-primary { background: var(--navy); color: #fff; }
.btn-primary:hover { background: var(--navy-2); }
.btn-ghost { background: transparent; color: var(--ink-soft); border-color: var(--line); }
.btn-ghost:hover { color: var(--ink); border-color: var(--ink-soft); }
.btn-gold { background: var(--gold); color: var(--navy-deep); }
.btn-gold:hover { background: var(--gold-deep); }

/* ===== Note callout ===== */
.note {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 10px;
  font-size: .92rem; background: var(--amber-bg); border: 1px solid color-mix(in srgb, var(--amber) 30%, transparent);
  margin-bottom: 22px;
}
.note .i { font-size: 1.1rem; line-height: 1.2; }

/* ===== Footer ===== */
.site-footer { border-top: 3px solid var(--gold); background: var(--navy-deep); color: #dfe3ff; padding: 24px 0 40px; }
.site-footer p { margin: 4px 0; font-size: .88rem; }
.site-footer a { color: #fff; }
.site-footer strong { color: #fff; }
.site-footer .muted { color: #aeb4e0; }
.site-footer .copyright { margin-top: 12px; font-size: .8rem; color: #8b92c8; }
.muted { color: var(--ink-soft); }

/* ===================================================================
   Runner Schedule page — carried over from the prototype
   =================================================================== */
.summary { margin: 0 0 26px; }
.summary-card {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-left: 6px solid var(--line);
  border-radius: var(--radius); padding: 20px 22px; box-shadow: var(--shadow);
}
.summary-card.state-red { border-left-color: var(--red); }
.summary-card.state-amber { border-left-color: var(--amber); }
.summary-card.state-green { border-left-color: var(--green); }
.summary-count { font-size: 2.4rem; font-weight: 800; line-height: 1; color: var(--navy); }
@media (prefers-color-scheme: dark) { .summary-count { color: var(--ink); } }
.summary-text h2 { margin: 0 0 2px; font-size: 1.1rem; }
.summary-text p { margin: 0; color: var(--ink-soft); font-size: .92rem; }
.summary-spacer { flex: 1; }

.alerts-list { display: grid; gap: 10px; }
.alert {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; font-size: .92rem;
  background: var(--red-bg); border: 1px solid color-mix(in srgb, var(--red) 30%, transparent);
}
.alert.ok { background: var(--green-bg); border-color: color-mix(in srgb, var(--green) 30%, transparent); }
.alert-icon { font-size: 1.15rem; line-height: 1.3; }
.alert strong { color: var(--ink); }
.alert .alert-channels { color: var(--ink-soft); font-size: .82rem; display: block; margin-top: 2px; }

.calendar { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
.day-card {
  text-align: left; cursor: pointer; font: inherit; color: inherit;
  background: var(--surface-2); border: 1px solid var(--line); border-top: 4px solid var(--line);
  border-radius: 10px; padding: 14px; transition: transform .08s ease, box-shadow .12s ease;
}
.day-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.day-card:focus-visible { outline: 3px solid var(--navy); outline-offset: 2px; }
.day-card.state-red { border-top-color: var(--red); }
.day-card.state-amber { border-top-color: var(--amber); }
.day-card.state-green { border-top-color: var(--green); }
.day-top { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; gap: 8px; }
.day-date { font-weight: 700; font-size: 1rem; }
.day-when { font-size: .74rem; color: var(--ink-soft); }
.pill { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.pill.state-red { background: var(--red-bg); color: var(--red); }
.pill.state-amber { background: var(--amber-bg); color: var(--amber); }
.pill.state-green { background: var(--green-bg); color: var(--green); }
.meter { display: flex; gap: 4px; margin: 10px 0 8px; }
.meter span { height: 8px; flex: 1; border-radius: 3px; background: var(--line); }
.meter span.filled { background: var(--navy); }
.meter span.over { background: var(--gold-deep); }
.roster { list-style: none; margin: 6px 0 0; padding: 0; display: grid; gap: 3px; }
.roster li { font-size: .84rem; color: var(--ink-soft); display: flex; justify-content: space-between; gap: 8px; }
.roster .cancel-x { background: none; border: none; color: var(--red); cursor: pointer; font-size: .78rem; padding: 0 2px; opacity: .7; }
.roster .cancel-x:hover { opacity: 1; text-decoration: underline; }
.roster .empty { font-style: italic; }
.day-cta { margin-top: 10px; font-size: .82rem; font-weight: 700; color: var(--navy); }
@media (prefers-color-scheme: dark) { .day-cta { color: var(--gold); } }

.legend { display: flex; flex-wrap: wrap; gap: 18px; margin-top: 18px; font-size: .82rem; color: var(--ink-soft); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.dot-red { background: var(--red); } .dot-amber { background: var(--amber); } .dot-green { background: var(--green); }
.footer-actions { text-align: center; margin: 8px 0 32px; }

.dialog { border: none; border-radius: var(--radius); padding: 0; max-width: 420px; width: 92%; background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(5,10,74,.55); }
.dialog form { padding: 24px; display: grid; gap: 14px; }
.dialog h3 { margin: 0; font-size: 1.2rem; color: var(--navy); }
@media (prefers-color-scheme: dark) { .dialog h3 { color: var(--ink); } }
.dialog-date { margin: 0; color: var(--ink-soft); font-weight: 600; }
.dialog label { display: grid; gap: 5px; font-size: .88rem; font-weight: 600; }
.dialog input { font: inherit; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); }
.dialog input:focus-visible { outline: 2px solid var(--navy); outline-offset: 1px; }
.dialog .muted { font-weight: 400; }
.dialog-warning { margin: 0; font-size: .84rem; padding: 9px 11px; border-radius: 8px; background: var(--amber-bg); color: var(--amber); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; }

/* ===== Mobile ===== */
@media (max-width: 760px) {
  .nav-toggle { display: block; }
  .topbar-inner { gap: 10px; }
  .demo-badge { font-size: .58rem; letter-spacing: .1em; padding: 4px 8px; }
  .badge-full { display: none; }
  .badge-short { display: inline; }
  .mainnav ul { flex-direction: column; max-height: 0; overflow: hidden; transition: max-height .25s ease; }
  .mainnav.open ul { max-height: 720px; }
  .mainnav a { padding: 13px 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
  .mainnav a.active { border-bottom-color: rgba(255,255,255,.08); }
  .logo-img { height: 48px; }
  .brand-name { font-size: 1.05rem; }
  .brand-sub { display: none; }
  .hero h1 { font-size: 1.6rem; }
  .hero-overlay { padding: 32px 0; }
  .summary-count { font-size: 2rem; }
}
@media (max-width: 420px) {
  .summary-card { flex-direction: column; align-items: flex-start; }
  .summary-card .btn-primary { width: 100%; }
}

/* ===== Lightbox =====
   Always a dark overlay regardless of light/dark theme — intentional, so no
   prefers-color-scheme override. */
body.lb-open { overflow: hidden; }
.lightbox {
  position: fixed; inset: 0; z-index: 9999;
  display: none; align-items: center; justify-content: center;
  padding: 24px;
  background: rgba(3, 6, 32, .9);
}
.lightbox.open { display: flex; }
.lightbox figure {
  margin: 0; max-width: 100%; max-height: 100%;
  display: flex; flex-direction: column; align-items: center;
}
.lightbox img {
  max-width: 92vw; max-height: 84vh; width: auto; height: auto;
  border-radius: 6px; box-shadow: 0 10px 40px rgba(0, 0, 0, .6);
}
.lightbox figcaption {
  margin-top: 12px; max-width: 680px; text-align: center;
  color: #eef0ff; font-size: .95rem;
}
.lb-close {
  position: absolute; top: 14px; right: 18px; z-index: 2;
  width: 44px; height: 44px; padding: 0;
  border: 0; border-radius: 50%; cursor: pointer;
  background: rgba(255, 255, 255, .14); color: #fff;
  font-size: 1.7rem; line-height: 1;
}
.lb-close:hover { background: rgba(255, 255, 255, .28); }
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 2;
  width: 48px; height: 48px; padding: 0;
  border: 0; border-radius: 50%; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255, 255, 255, .14); color: #fff;
  font-size: 2rem; line-height: 1;
}
.lb-nav:hover { background: rgba(255, 255, 255, .28); }
.lb-prev { left: 16px; }
.lb-next { right: 16px; }
@media (max-width: 420px) {
  .lb-close { top: 8px; right: 10px; }
  .lb-nav { width: 40px; height: 40px; font-size: 1.6rem; }
  .lb-prev { left: 6px; }
  .lb-next { right: 6px; }
}
