/* =========================================================================
   MaineRacing.com — concept · dark motorsport theme
   ========================================================================= */
@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@600;700;800;900&family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg:        #0b0d10;
  --bg-2:      #11151a;
  --surface:   #161b22;
  --surface-2: #1d242d;
  --line:      #28313c;
  --line-2:    #364150;
  --text:      #eef2f6;
  --text-dim:  #9fb0c0;
  --text-mute: #6b7c8d;
  --accent:    #e63329;   /* racing red */
  --accent-2:  #ff5a3c;
  --gold:      #f2b300;    /* checkered/winner cue */
  --green:     #25c26e;
  --radius:    14px;
  --radius-sm: 9px;
  --maxw:      1240px;
  --shadow:    0 10px 30px rgba(0,0,0,.45);
  --font-disp: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --font:      "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
::selection { background: var(--accent); color: #fff; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 22px; }
.muted { color: var(--text-mute); }
.dim { color: var(--text-dim); }

/* ---- checkered hairline accent ---------------------------------------- */
.checker {
  height: 6px;
  background-image:
    linear-gradient(45deg, var(--text) 25%, transparent 25%),
    linear-gradient(-45deg, var(--text) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--text) 75%),
    linear-gradient(-45deg, transparent 75%, var(--text) 75%);
  background-size: 12px 12px;
  background-position: 0 0, 0 6px, 6px -6px, -6px 0;
  opacity: .9;
}

/* ===== Header ============================================================ */
.site-head {
  position: sticky; top: 0; z-index: 100;
  background: rgba(11,13,16,.86);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.head-row {
  display: flex; align-items: center; gap: 22px;
  height: 64px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--font-disp); font-weight: 900; font-size: 22px;
  letter-spacing: -.02em; text-transform: uppercase;
}
.brand .mark {
  width: 30px; height: 30px; border-radius: 7px;
  background: var(--accent);
  display: grid; place-items: center; color: #fff; font-size: 16px;
  box-shadow: 0 0 0 3px rgba(230,51,41,.2);
}
.brand .me { color: var(--accent); }
.nav { display: flex; gap: 4px; align-items: center; margin-left: 6px; }
.nav a {
  padding: 8px 12px; border-radius: 8px; font-weight: 600; font-size: 14px;
  color: var(--text-dim);
}
.nav a:hover, .nav a.active { color: var(--text); background: var(--surface); }
.head-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.searchbox {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; padding: 7px 14px; min-width: 230px;
  transition: border-color .15s, box-shadow .15s;
}
.searchbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(230,51,41,.15); }
.searchbox input {
  background: none; border: 0; outline: 0; color: var(--text);
  font-size: 14px; width: 100%;
}
/* Hamburger — hidden on desktop, shown on mobile via the media query below. */
.nav-toggle {
  display: none;
  flex-direction: column; justify-content: center; gap: 5px;
  width: 42px; height: 42px; padding: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 9px;
  cursor: pointer;
}
.nav-toggle span {
  display: block; height: 2px; width: 20px; margin: 0 auto;
  background: var(--text); border-radius: 2px;
  transition: transform .2s, opacity .2s;
}
.site-head.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.site-head.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
.site-head.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
/* ===== Buttons / chips =================================================== */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 10px; font-weight: 700; font-size: 14px;
  border: 1px solid var(--line-2); background: var(--surface); color: var(--text);
  cursor: pointer; transition: transform .1s, background .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-ghost { background: transparent; }
.btn.disabled, .btn[aria-disabled="true"] { opacity: .55; pointer-events: none; cursor: not-allowed; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--line); color: var(--text-dim);
}
.chip:hover { color: var(--text); border-color: var(--line-2); }
.chip.cat { color: var(--gold); border-color: rgba(242,179,0,.3); }

.kicker {
  font-family: var(--font-disp); font-weight: 800; font-size: 12px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--accent);
}
.score {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 800; letter-spacing: .03em;
  color: var(--gold); text-transform: uppercase;
}

/* ===== Hero ============================================================== */
.hero { padding: 30px 0 8px; }
.hero-grid {
  display: grid; grid-template-columns: 1.55fr 1fr; gap: 22px;
}
.feature {
  position: relative; border-radius: var(--radius); overflow: hidden;
  min-height: 440px; display: flex; align-items: flex-end;
  background: var(--surface); border: 1px solid var(--line);
}
.feature .bg {
  position: absolute; inset: 0; object-fit: cover; width: 100%; height: 100%;
  opacity: .55;
}
.feature .bg.image-logo {
  object-fit: contain; padding: 80px 18%; background: #eef1f4; opacity: .58;
}
.feature .scrim {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(11,13,16,.1) 0%, rgba(11,13,16,.55) 55%, rgba(11,13,16,.96) 100%);
}
.feature .inner { position: relative; padding: 30px; }
.feature h1 {
  font-family: var(--font-disp); font-weight: 900; letter-spacing: -.02em;
  font-size: clamp(26px, 3.4vw, 44px); line-height: 1.04; margin: 12px 0 10px;
}
.feature p { color: var(--text-dim); font-size: 16px; max-width: 60ch; margin: 0 0 14px; }
.feature .meta { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--text-mute); }

.side-list { display: flex; flex-direction: column; gap: 14px; }
.side-item {
  display: grid; grid-template-columns: 92px 1fr; gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px; transition: border-color .15s, transform .1s;
}
.side-item:hover { border-color: var(--line-2); transform: translateY(-1px); }
.side-item .thumb { width: 92px; height: 70px; border-radius: 7px; object-fit: cover; background: var(--surface-2); }
.side-item .thumb.image-logo,
.result .thumb.image-logo {
  object-fit: contain; padding: 10px; background: #eef1f4;
}
.side-item h3 { font-size: 15px; line-height: 1.25; margin: 4px 0 6px; font-weight: 700; }
.side-item .meta { font-size: 11.5px; color: var(--text-mute); display: flex; gap: 8px; align-items: center; }

/* ===== Section headers =================================================== */
.section { padding: 34px 0; }
.section-head {
  display: flex; align-items: center; gap: 14px; margin-bottom: 18px;
}
.section-head h2 {
  font-family: var(--font-disp); font-weight: 900; text-transform: uppercase;
  letter-spacing: -.01em; font-size: 24px; margin: 0;
}
.section-head .bar { width: 30px; height: 4px; background: var(--accent); border-radius: 3px; }
.section-head .more { margin-left: auto; font-size: 13px; font-weight: 700; color: var(--text-dim); }
.section-head .more:hover { color: var(--accent); }

/* ===== Card grid ========================================================= */
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 20px;
}
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
  transition: border-color .15s, transform .12s, box-shadow .12s;
}
.card:hover { border-color: var(--line-2); transform: translateY(-3px); box-shadow: var(--shadow); }
.card .media { position: relative; aspect-ratio: 16/10; background: var(--surface-2); overflow: hidden; }
.card .media img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s; }
.card .media img.image-logo {
  object-fit: contain; padding: 42px; background: #eef1f4;
}
.card:hover .media img { transform: scale(1.05); }
.card .media .tag-type {
  position: absolute; top: 10px; left: 10px;
  font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  background: rgba(11,13,16,.78); border: 1px solid var(--line-2); color: var(--text);
  padding: 4px 9px; border-radius: 6px; backdrop-filter: blur(4px);
}
.card .media .tag-type.video { background: var(--accent); border-color: var(--accent); }
.card .media .play {
  position: absolute; inset: 0; display: grid; place-items: center; color: #fff;
}
.card .media .play svg { width: 52px; height: 52px; filter: drop-shadow(0 2px 8px rgba(0,0,0,.6)); opacity: .92; }
.card .body { padding: 15px 16px 16px; display: flex; flex-direction: column; gap: 9px; flex: 1; }
.card .body .cats { display: flex; gap: 7px; flex-wrap: wrap; }
.card .body h3 { font-size: 17px; line-height: 1.25; margin: 0; font-weight: 700; }
.card .body .ex { color: var(--text-dim); font-size: 13.5px; margin: 0; flex: 1; }
.card .body .foot { display: flex; align-items: center; gap: 10px; font-size: 11.5px; color: var(--text-mute); margin-top: 2px; }
.card .body .foot .logo { height: 18px; width: auto; border-radius: 3px; background: #fff; padding: 1px; }

/* ===== Video rail ======================================================== */
.rail { display: flex; gap: 18px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; }
.rail::-webkit-scrollbar { height: 8px; }
.rail::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 8px; }
.rail .card { min-width: 300px; max-width: 300px; scroll-snap-align: start; }

/* ===== Topic chips strip ================================================= */
.topic-strip { display: flex; gap: 9px; flex-wrap: wrap; }

/* ===== Newsletter teaser ================================================= */
.nl-teaser {
  background: linear-gradient(135deg, var(--surface-2), var(--surface));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px 30px; display: flex; align-items: center; gap: 26px; flex-wrap: wrap;
}
.nl-teaser h2 { font-family: var(--font-disp); font-weight: 900; text-transform: uppercase; margin: 0 0 6px; font-size: 26px; }
.nl-teaser p { color: var(--text-dim); margin: 0; max-width: 52ch; }
.nl-teaser form { display: flex; gap: 10px; margin-left: auto; flex-wrap: wrap; }
.nl-teaser input {
  background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px;
  padding: 11px 14px; color: var(--text); min-width: 240px; font-size: 14px;
}
.nl-status { flex-basis: 100%; text-align: right; margin: 4px 0 0; font-size: 13px; min-height: 1em; }
.nl-status:empty { margin: 0; }

/* ===== Article / reader page ============================================= */
.reader-hero {
  position: relative; min-height: 360px; display: flex; align-items: flex-end;
  border-bottom: 1px solid var(--line);
}
.reader-hero .bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .42; }
.reader-hero .bg.image-logo {
  object-fit: contain; padding: 55px 12%; background: #f5f6f4; opacity: .34;
}
.reader-hero .scrim { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(11,13,16,.3), rgba(11,13,16,.97)); }
.reader-hero .inner { position: relative; padding: 36px 0; }
.reader-hero h1 {
  font-family: var(--font-disp); font-weight: 900; letter-spacing: -.02em;
  font-size: clamp(28px, 4vw, 48px); line-height: 1.05; margin: 12px 0 14px; max-width: 22ch;
}
.reader-hero .meta { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; color: var(--text-dim); font-size: 14px; }

/* light reading pane */
.reader {
  background: #f5f6f4; color: #16191d;
}
.reader .wrap { max-width: 760px; padding-top: 40px; padding-bottom: 56px; }
.reader .toolbar {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  margin-bottom: 26px; padding-bottom: 20px; border-bottom: 1px solid #e1e3df;
}
.reader .btn { background: #fff; color: #16191d; border-color: #d8dad6; }
.reader .btn:hover { background: #ececea; }
.reader .btn-accent { background: var(--accent); color: #fff; border-color: var(--accent); }
.reader article { font-size: 18.5px; line-height: 1.72; }
.reader article p { margin: 0 0 1.15em; }
.reader article h2, .reader article h3 { font-family: var(--font-disp); letter-spacing: -.01em; margin: 1.6em 0 .5em; }
.reader article img { border-radius: 10px; margin: 1.4em 0; }
.reader article a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.reader .ai-summary {
  background: #fff; border: 1px solid #e1e3df; border-left: 4px solid var(--accent);
  border-radius: 10px; padding: 16px 18px; margin: 0 0 26px;
}
.reader .ai-summary .lbl { font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }
.reader .source-note { margin-top: 30px; padding-top: 18px; border-top: 1px solid #e1e3df; font-size: 14px; color: #5b6168; }
.reader .logos { display: flex; gap: 12px; align-items: center; margin: 18px 0; flex-wrap: wrap; }
.reader .logos img { height: 42px; width: auto; background: #fff; border: 1px solid #e1e3df; border-radius: 8px; padding: 4px; display: block; }
.reader .logos a { display: inline-flex; transition: transform .12s ease, box-shadow .12s ease; }
.reader .logos a:hover { transform: translateY(-1px); box-shadow: 0 3px 10px rgba(0,0,0,.12); }
.reader .logos a:hover img { border-color: #cfd2cc; }

/* related */
.related { background: var(--bg); padding: 40px 0; }

/* ===== Search page ======================================================= */
.search-head { padding: 40px 0 10px; }
.search-head h1 { font-family: var(--font-disp); font-weight: 900; text-transform: uppercase; font-size: 34px; margin: 0 0 16px; }
.big-search {
  display: flex; gap: 10px; align-items: center;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px;
  padding: 10px 16px;
}
.big-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(230,51,41,.14); }
.big-search input { flex: 1; background: none; border: 0; outline: 0; color: var(--text); font-size: 18px; }
.result {
  display: grid; grid-template-columns: 130px 1fr auto; gap: 18px; align-items: center;
  padding: 18px 0; border-bottom: 1px solid var(--line);
}
.result .thumb { width: 130px; height: 84px; border-radius: 9px; object-fit: cover; background: var(--surface-2); }
.result h3 { margin: 4px 0 6px; font-size: 19px; }
.result .ex { color: var(--text-dim); font-size: 14px; margin: 0; }
.result .match {
  text-align: center; font-family: var(--font-disp); font-weight: 900;
  color: var(--gold); font-size: 22px; min-width: 64px;
}
.result .match small { display: block; font-size: 10px; color: var(--text-mute); font-weight: 700; letter-spacing: .06em; }

/* ===== Assistant widget ================================================== */
.pitbox-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 200;
  display: flex; align-items: center; gap: 10px;
  background: var(--accent); color: #fff; border: 0; cursor: pointer;
  padding: 13px 18px; border-radius: 999px; font-weight: 800; font-size: 14px;
  box-shadow: 0 8px 26px rgba(230,51,41,.45);
  font-family: var(--font-disp); letter-spacing: .01em;
}
.pitbox-fab:hover { background: var(--accent-2); }
.pitbox-panel {
  position: fixed; right: 22px; bottom: 22px; z-index: 201;
  width: min(420px, calc(100vw - 32px)); height: min(620px, calc(100vh - 40px));
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 16px;
  box-shadow: var(--shadow); display: none; flex-direction: column; overflow: hidden;
}
.pitbox-panel.open { display: flex; }
.pitbox-head {
  display: flex; align-items: center; gap: 10px; padding: 14px 16px;
  border-bottom: 1px solid var(--line); background: var(--surface);
}
.pitbox-head .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); }
.pitbox-head .dot.off { background: var(--text-mute); box-shadow: none; }
.pitbox-head b { font-family: var(--font-disp); text-transform: uppercase; letter-spacing: .02em; }
.pitbox-head select { margin-left: auto; background: var(--bg); color: var(--text-dim); border: 1px solid var(--line); border-radius: 7px; font-size: 12px; padding: 4px 6px; }
.pitbox-head .x { background: none; border: 0; color: var(--text-dim); cursor: pointer; font-size: 20px; line-height: 1; }
.pitbox-msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.msg { max-width: 88%; font-size: 14.5px; line-height: 1.55; }
.msg.user { align-self: flex-end; background: var(--accent); color: #fff; padding: 10px 14px; border-radius: 14px 14px 4px 14px; }
.msg.bot { align-self: flex-start; color: var(--text); }
.msg.bot .bubble { background: var(--surface); border: 1px solid var(--line); padding: 12px 14px; border-radius: 14px 14px 14px 4px; }
.msg.bot .cites { margin-top: 9px; display: flex; flex-direction: column; gap: 5px; }
.msg.bot .cites a { font-size: 12.5px; color: var(--text-dim); border-left: 2px solid var(--accent); padding-left: 9px; }
.msg.bot .cites a:hover { color: var(--text); }
.pitbox-intro { color: var(--text-dim); font-size: 14px; }
.pitbox-intro .ex { display: block; margin-top: 4px; color: var(--accent-2); cursor: pointer; font-weight: 600; }
.pitbox-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); background: var(--surface); }
.pitbox-form input { flex: 1; background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; color: var(--text); padding: 11px 13px; outline: 0; font-size: 14px; }
.pitbox-form input:focus { border-color: var(--accent); }
.pitbox-form button { background: var(--accent); border: 0; color: #fff; border-radius: 10px; padding: 0 16px; cursor: pointer; font-weight: 800; }
.typing span { display: inline-block; width: 6px; height: 6px; margin: 0 1px; background: var(--text-mute); border-radius: 50%; animation: blink 1.2s infinite both; }
.typing span:nth-child(2){ animation-delay:.2s } .typing span:nth-child(3){ animation-delay:.4s }
@keyframes blink { 0%,80%,100%{opacity:.2} 40%{opacity:1} }

/* ===== Footer ============================================================ */
.site-foot { border-top: 1px solid var(--line); margin-top: 50px; padding: 34px 0 50px; color: var(--text-mute); font-size: 13px; }
.site-foot .cols { display: flex; gap: 40px; flex-wrap: wrap; align-items: flex-start; }
.site-foot a { color: var(--text-dim); }
.site-foot a:hover { color: var(--text); }
.badge-ai { display: inline-flex; gap: 7px; align-items: center; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; color: var(--text-dim); }

/* ===== Loading / empty =================================================== */
.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.3s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.loading { text-align: center; color: var(--text-mute); padding: 50px; }
.notice { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--gold); border-radius: 9px; padding: 12px 16px; color: var(--text-dim); font-size: 14px; margin: 14px 0; }

/* ===== Responsive ======================================================== */
@media (max-width: 880px) {
  .hero-grid { grid-template-columns: 1fr; }
  /* Search collapses into the hamburger menu (Search is a nav link too). */
  .head-right .searchbox { display: none; }
  .nav-toggle { display: flex; }
  /* Nav becomes a full-width drop-down panel below the sticky header. */
  .nav {
    display: none;
    position: absolute; top: 64px; left: 0; right: 0;
    flex-direction: column; gap: 2px; margin: 0;
    padding: 10px 16px 16px;
    background: rgba(11,13,16,.98);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 12px 24px rgba(0,0,0,.4);
  }
  .site-head.nav-open .nav { display: flex; }
  .nav a { padding: 12px 12px; font-size: 16px; border-radius: 8px; }
  .result { grid-template-columns: 1fr; }
  .result .thumb { width: 100%; height: 180px; }
  .result .match { text-align: left; }
}
