/* ==========================================================================
   HIBBING SPEEDWAY — CORE
   One brand, three surfaces. Everything shared lives here: tokens, faces,
   materials (steel, program stock, grain), and the parts every surface is
   built from (plates, truss rules, car-number plates, class chips, buttons,
   program tables).
   ========================================================================== */

/* ---------- Faces ---------- */
@font-face { font-family: "Ironware"; src: url("../fonts/VLNLIronware.woff2") format("woff2"), url("../fonts/VLNLIronware.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Stone Iron"; src: url("../fonts/StoneIronVF-Variable.woff2") format("woff2"), url("../fonts/StoneIronVF-Variable.ttf") format("truetype"); font-weight: 300 800; font-display: swap; }
@font-face { font-family: "Archivo"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/archivo-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Archivo"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/archivo-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Archivo"; font-style: italic; font-weight: 100 900; font-display: swap;
  src: url("../fonts/archivo-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

/* ---------- Tokens ---------- */
:root {
  /* Official */
  --red: #A61E2F;            /* Iron Range Red — heat and action */
  --ore: #464645;            /* Iron Ore Gray — steel plate */
  --black: #131413;          /* Mine Shaft Black */
  --mineral: #DCE5D9;        /* Mineral White — program stock */

  /* Steel ramp (tinted from Mine Shaft Black, never neutral grey) */
  --steel-0: #0C0D0C;
  --steel-1: #131413;
  --steel-2: #1A1C1A;
  --steel-3: #222523;
  --steel-4: #2D302D;
  --steel-5: #3A3D3A;
  --seam: #333733;           /* weld seam / hairline on dark */

  /* Program stock ramp (from Mineral White) */
  --stock-0: #EEF2EC;
  --stock-1: #DCE5D9;
  --stock-2: #CBD5C7;
  --stock-3: #B5C0B1;
  --rule: #131413;

  /* Supporting world colours */
  --red-deep: #7E1422;       /* red in shadow */
  --red-hot: #E5505F;        /* red as text on steel (AA) */
  --taconite: #7A3B26;       /* iron ore pellet rust */
  --clay: #A27C5D;           /* the racing surface */
  --sodium: #E8A33D;         /* track lights; focus on steel */

  /* State (flag semantics, only where they mean something) */
  --flag-green: #2FA35F;
  --flag-yellow: #F2C230;
  --flag-red: #D8283C;
  --flag-white: #F4F7F2;

  /* Text on steel */
  --ink-hi: #DCE5D9;
  --ink-mid: #A6AEA3;
  --ink-lo: #7D847B;
  /* Text on stock */
  --ink-dark: #131413;
  --ink-dark-mid: #464645;
  --ink-dark-lo: #5E625C;

  /* Faces */
  --f-iron: "Ironware", "Stone Iron", "Archivo", sans-serif;
  --f-steel: "Stone Iron", "Archivo", sans-serif;
  --f-body: "Archivo", system-ui, sans-serif;

  /* Rhythm */
  --u: 8px;
  --cut: 10px;               /* chamfer on cut-plate corners */
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);

  /* Materials */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --brushed: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='600' height='300'%3E%3Cfilter id='b'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='2' seed='4' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23b)'/%3E%3C/svg%3E");  /* mill-scale speck: flat steel with a little dirt, no faux brushing */
  --mottle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1600' height='1000' preserveAspectRatio='none'%3E%3Cfilter id='m' x='0' y='0' width='100%25' height='100%25'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.006 .009' numOctaves='4' seed='9'/%3E%3CfeColorMatrix values='0 0 0 0 .48 0 0 0 0 .23 0 0 0 0 .15 0 0 0 .5 -.12'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3C/svg%3E");
  --truss: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='16'%3E%3Cpath d='M0 1H32M0 15H32M1 0V16M1 1L31 15M1 15L31 1' stroke='%23000' stroke-width='2' fill='none'/%3E%3C/svg%3E");
  --truss-fine: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='10'%3E%3Cpath d='M0 .75H20M0 9.25H20M.75 0V10M.75 .75L19.25 9.25M.75 9.25L19.25 .75' stroke='%23000' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
}

/* ---------- Browser surfaces ---------- */
::selection { background: var(--red); color: var(--mineral); }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scrollbar-color: var(--steel-5) var(--steel-1); }
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--steel-1); }
::-webkit-scrollbar-thumb { background: var(--steel-5); border: 3px solid var(--steel-1); }
::-webkit-scrollbar-thumb:hover { background: var(--ore); }
* { box-sizing: border-box; }
body { margin: 0; caret-color: var(--red); font-family: var(--f-body); font-variant-numeric: lining-nums; -webkit-font-smoothing: antialiased; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-underline-offset: .22em; text-decoration-thickness: 1px; }
:focus-visible { outline: 3px solid var(--focus, var(--sodium)); outline-offset: 3px; }
.stock :focus-visible, .on-stock:focus-visible { --focus: var(--black); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tnum { font-variant-numeric: tabular-nums lining-nums; }

/* ---------- Grounds ---------- */
.steel { background-color: var(--steel-1); color: var(--ink-hi); }
.stock { background-color: var(--stock-1); color: var(--ink-dark); --focus: var(--black); }
.grain { position: relative; isolation: isolate; }
.grain::after { content: ""; position: absolute; inset: 0; background-image: var(--grain); opacity: .1; mix-blend-mode: multiply; pointer-events: none; z-index: 1; }
.steel.grain::after { opacity: .1; mix-blend-mode: normal; }
.brushed { background-image: var(--brushed); background-size: 600px 300px; }

/* ---------- Type ---------- */
.t-iron { font-family: var(--f-iron); font-weight: 400; letter-spacing: .005em; line-height: .9; text-transform: uppercase; }
.t-steel { font-family: var(--f-steel); line-height: 1; letter-spacing: .01em; }
.t-label { font-family: var(--f-body); font-weight: 700; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; line-height: 1.2; }
.t-meta { font-family: var(--f-body); font-weight: 500; font-size: 14px; line-height: 1.35; }

/* ---------- Truss rule: the cross-brace from the H mark, as a headframe ---------- */
.truss { display: block; height: 16px; background: currentColor; -webkit-mask: var(--truss) repeat-x left center / 32px 16px; mask: var(--truss) repeat-x left center / 32px 16px; }
.truss--fine { height: 10px; -webkit-mask-image: var(--truss-fine); mask-image: var(--truss-fine); -webkit-mask-size: 20px 10px; mask-size: 20px 10px; }
.truss--red { color: var(--red); }
.truss--ore { color: var(--ore); }

/* ---------- Plate: riveted steel data plate (no offset shadows — bevel + cast shadow) ---------- */
.plate {
  position: relative;
  background-color: var(--steel-2);
  background-image: var(--brushed);
  background-size: 600px 300px;
  border: 1px solid var(--seam);
  box-shadow: inset 0 1px 0 rgba(220, 229, 217, .07), inset 0 -1px 0 rgba(0, 0, 0, .55), 0 18px 32px -18px rgba(0, 0, 0, .7);
  color: var(--ink-hi);
}
.rivets::before {
  content: ""; position: absolute; inset: 7px; pointer-events: none;
  background:
    radial-gradient(circle at 40% 35%, #8a908a 0 .8px, #4a4e4a 1.6px, #101110 2.6px, transparent 3.1px) 0 0 / 7px 7px no-repeat,
    radial-gradient(circle at 40% 35%, #8a908a 0 .8px, #4a4e4a 1.6px, #101110 2.6px, transparent 3.1px) 100% 0 / 7px 7px no-repeat,
    radial-gradient(circle at 40% 35%, #8a908a 0 .8px, #4a4e4a 1.6px, #101110 2.6px, transparent 3.1px) 0 100% / 7px 7px no-repeat,
    radial-gradient(circle at 40% 35%, #8a908a 0 .8px, #4a4e4a 1.6px, #101110 2.6px, transparent 3.1px) 100% 100% / 7px 7px no-repeat;
}
.stock .plate--stock, .plate--stock {
  background-color: var(--stock-0); background-image: none; color: var(--ink-dark);
  border: 1.5px solid var(--black);
  box-shadow: 0 14px 28px -20px rgba(19, 20, 19, .45);
}
/* Cut corner: plate sheared on the bottom-right, like flame-cut steel */
.cut { clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%); }
.cut-tl { clip-path: polygon(var(--cut) 0, 100% 0, 100% 100%, 0 100%, 0 var(--cut)); }

/* ---------- Buttons ---------- */
.btn {
  --bg: var(--red); --fg: var(--mineral); --edge: rgba(0,0,0,.35);
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 0 22px 0 22px;
  font-family: var(--f-body); font-weight: 800; font-size: 14px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--fg); background: var(--bg); border: 0; text-decoration: none; white-space: nowrap;
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.14), inset 0 -2px 0 var(--edge);
  transition: background-color .2s var(--ease-out), transform .2s var(--ease-out), color .2s;
}
.btn .ico { width: 18px; height: 18px; }
.btn:hover { --bg: #BC2537; }
.btn:active { transform: translateY(1px); }
.btn--steel { --bg: var(--steel-4); --fg: var(--mineral); --edge: rgba(0,0,0,.5); }
.btn--steel:hover { --bg: var(--steel-5); }
.btn--mineral { --bg: var(--mineral); --fg: var(--black); --edge: rgba(0,0,0,.18); }
.btn--mineral:hover { --bg: #fff; }
.btn--black { --bg: var(--black); --fg: var(--mineral); }
.btn--black:hover { --bg: var(--steel-3); }
.btn--line { --bg: transparent; --fg: currentColor; box-shadow: inset 0 0 0 1.5px currentColor; clip-path: none; }
.btn--line:hover { --bg: rgba(220,229,217,.08); }
.stock .btn--line:hover { --bg: rgba(19,20,19,.06); }
.btn--lg { min-height: 58px; padding: 0 30px; font-size: 15px; }
.btn--sm { min-height: 38px; padding: 0 14px; font-size: 12px; --cut: 7px; }
.btn[disabled], .btn.is-disabled { --bg: var(--steel-3); --fg: var(--ink-lo); cursor: not-allowed; }

/* ---------- Class chip: stamped tag ---------- */
.cls {
  display: inline-flex; align-items: center; justify-content: center; min-width: 34px; height: 24px; padding: 0 7px;
  font-family: var(--f-steel); font-weight: 700; font-size: 15px; letter-spacing: .04em; line-height: 1;
  color: var(--ink-hi); background: var(--steel-3); border: 1px solid var(--steel-5);
}
.stock .cls { color: var(--ink-dark); background: transparent; border-color: var(--ink-dark); }
.cls--red { background: var(--red); border-color: var(--red); color: var(--mineral) !important; }

/* ---------- Car-number plate: door number ---------- */
.carno {
  display: inline-grid; place-items: center; min-width: 52px; height: 40px; padding: 0 8px;
  font-family: var(--f-iron); font-size: 24px; line-height: 1; letter-spacing: .01em;
  color: var(--black); background: var(--mineral);
  box-shadow: inset 0 0 0 2px var(--black), inset 0 0 0 4px var(--mineral), inset 0 0 0 5px rgba(19,20,19,.35);
}
.carno--red { color: var(--mineral); background: var(--red); box-shadow: inset 0 0 0 2px var(--red), inset 0 0 0 3.5px rgba(220,229,217,.5); }
.carno--steel { color: var(--mineral); background: var(--steel-4); box-shadow: inset 0 0 0 1px var(--steel-5); }

/* ---------- Flag state ---------- */
.flagdot { display: inline-block; width: 10px; height: 10px; background: var(--flag-green); flex: none; }
.flagdot--live { animation: flagpulse 1.6s var(--ease-io) infinite; }
.flagdot--yellow { background: var(--flag-yellow); }
.flagdot--red { background: var(--flag-red); }
@keyframes flagpulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------- Program table: printed results sheet ---------- */
.ptable { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums lining-nums; }
.ptable th { font-family: var(--f-body); font-weight: 700; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; text-align: left; padding: 0 12px 10px; border-bottom: 4px double currentColor; }
.ptable td { padding: 12px; border-bottom: 1px solid color-mix(in srgb, currentColor 22%, transparent); vertical-align: middle; }
.ptable tr:last-child td { border-bottom: 2px solid currentColor; }
.ptable .num { text-align: right; }

/* ---------- Photography ---------- */
.photo { position: relative; overflow: hidden; background: var(--steel-3); }
.photo > img { width: 100%; height: 100%; object-fit: cover; }
/* One grade for the BBQ crops: tame the saturation, unify warmth */
img[src*="/bbq/"] { filter: saturate(.78) contrast(1.05) brightness(.97) sepia(.06); }
/* Duotone: archive print — Mine Shaft Black into Mineral White */
.duo { position: relative; overflow: hidden; background: var(--black); }
.duo > img { width: 100%; height: 100%; object-fit: cover; filter: grayscale(1) contrast(1.18) brightness(.92); mix-blend-mode: luminosity; }
.duo::after { content: ""; position: absolute; inset: 0; background: var(--mineral); mix-blend-mode: multiply; pointer-events: none; }

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
