/* ============================================================
   Cargu.tv — design tokens + components
   Brand: lime green (#3DE32D) on near-black. Friendly, clean, fast.
   ============================================================ */

:root {
  /* Surfaces (dark — canonical) */
  --bg: #0A0B0A;
  --surface: #111311;
  --surface-2: #171A17;
  --surface-3: #1F231F;
  --border: #262B26;
  --border-strong: #353B35;

  /* Text */
  --text: #E9EFE8;
  --text-2: #A7B0A5;
  --text-3: #828B80;  /* >=4.5:1 on dark surfaces for small spec/footer labels */

  /* Brand */
  --brand: #3DE32D;          /* fills, glow, flow field */
  --brand-2: #2DBF20;        /* hover / pressed */
  --brand-text: #6CEA5E;     /* green text/links readable on dark */
  --brand-ink: #06210A;      /* text on green fills */
  --brand-soft: rgba(61, 227, 45, 0.14);
  --brand-glow: rgba(61, 227, 45, 0.45);

  /* Secondary + status */
  --purple: #9146FF;
  --purple-soft: rgba(145, 70, 255, 0.16);
  --amber: #FFB020;
  --offline: #7A847C;

  /* Geometry */
  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --maxw: 1120px;
  --header-h: 64px;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;

  color-scheme: dark;
}

html.light {
  --bg: #F6F8F5;
  --surface: #FFFFFF;
  --surface-2: #F1F4F0;
  --surface-3: #E8ECE6;
  --border: #DFE5DD;
  --border-strong: #C8D0C6;

  --text: #16201A;
  --text-2: #4D584F;
  --text-3: #626B61;  /* >=4.5:1 on light surfaces for small spec/footer labels */

  --brand-text: #157A1E;     /* AA-compliant green text on light (>=4.9:1 on all light surfaces) */
  --brand-soft: rgba(61, 227, 45, 0.16);
  --brand-glow: rgba(61, 227, 45, 0.30);
  --offline: #6B746A;

  color-scheme: light;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  transition: background-color .3s ease, color .3s ease;
}

img, svg, canvas { display: block; max-width: 100%; }
a { color: var(--brand-text); text-decoration: none; transition: color .15s ease; }
a:hover { color: var(--brand); }
html.light a:hover { color: #0F6E18; }  /* darken on hover (raw lime fails contrast on light) */
ul { list-style: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 1.5rem; }

/* ---------- Accessibility helpers ---------- */
.skip-link {
  position: absolute; left: 50%; top: 0;
  transform: translateX(-50%) translateY(-130%);
  background: var(--brand); color: var(--brand-ink); font-weight: 500;
  padding: 10px 18px; border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  z-index: 200; transition: transform .2s ease;
}
.skip-link:focus { transform: translateX(-50%) translateY(0); color: var(--brand-ink); }

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.nav {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--header-h);
}
.brand-lockup { display: inline-flex; align-items: center; gap: 10px; }
.brand-lockup .mark { width: 30px; height: 30px; }
.brand-lockup .wordmark {
  font-size: 1.3rem; font-weight: 500; letter-spacing: .01em; color: var(--text);
}
.brand-lockup:hover .wordmark { color: var(--text); }

.nav-links { display: none; align-items: center; gap: 1.6rem; }
.nav-links a { color: var(--text-2); font-size: .95rem; }
.nav-links a:hover, .nav-links a[aria-current="true"] { color: var(--text); }
.nav-links a[aria-current="true"] { position: relative; }
.nav-links a[aria-current="true"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 2px;
  background: var(--brand); border-radius: 2px;
}

.nav-right { display: flex; align-items: center; gap: 12px; }

/* Status pill */
.status-pill {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--mono); font-size: .72rem; letter-spacing: .02em;
  padding: 5px 11px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2); white-space: nowrap;
}
.status-pill .dot {
  width: 8px; height: 8px; border-radius: 50%; background: var(--offline);
  flex: none;
}
html[data-live="live"] .status-pill {
  color: var(--brand-text); border-color: var(--brand-soft); background: var(--brand-soft);
}
html[data-live="live"] .status-pill .dot {
  background: var(--brand); box-shadow: 0 0 0 0 var(--brand-glow);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 var(--brand-glow); }
  70% { box-shadow: 0 0 0 7px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

/* Icon buttons */
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; border-radius: var(--radius-sm);
  color: var(--text-2); border: 1px solid transparent;
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn svg { width: 20px; height: 20px; }
.theme-icon-light, .theme-icon-dark { display: none; }
html.light .theme-icon-dark { display: block; }
html:not(.light) .theme-icon-light { display: block; }

#menu-btn { display: inline-flex; }
@media (min-width: 860px) {
  .nav-links { display: flex; }
  #menu-btn { display: none; }
}

/* Mobile menu */
.mobile-menu {
  display: none; flex-direction: column; gap: 2px;
  padding: 12px 1.5rem 20px;
  border-bottom: 1px solid var(--border); background: var(--surface);
}
.mobile-menu.open { display: flex; }
.mobile-menu a {
  color: var(--text-2); padding: 11px 12px; border-radius: var(--radius-sm); font-size: 1rem;
}
.mobile-menu a:hover { color: var(--text); background: var(--surface-2); }
.mobile-menu .menu-watch { color: var(--brand-text); font-weight: 500; }
.mobile-menu hr { border: 0; border-top: 1px solid var(--border); margin: 8px 0; }
@media (min-width: 860px) { .mobile-menu { display: none !important; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-weight: 500; font-size: .98rem; padding: 11px 22px;
  border-radius: var(--radius-sm); transition: transform .15s ease, background-color .15s ease, border-color .15s ease;
  border: 1px solid transparent; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 19px; height: 19px; }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-2); color: var(--brand-ink); }
.btn-outline { background: var(--surface-2); color: var(--text); border-color: var(--border-strong); }
.btn-outline:hover { background: var(--surface-3); color: var(--text); }
.btn-purple { background: var(--purple); color: #fff; }
.btn-purple:hover { background: #7c34e6; color: #fff; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  border-bottom: 1px solid var(--border);
}
#flowfield {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
}
.hero-inner {
  position: relative; z-index: 1;
  padding: clamp(3.5rem, 9vw, 6.5rem) 0 clamp(3rem, 7vw, 5rem);
  text-align: center;
}
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: .8rem; letter-spacing: .06em;
  color: var(--text-2); background: var(--surface);
  border: 1px solid var(--border); padding: 6px 14px; border-radius: 999px;
  margin-bottom: 1.4rem;
}
.eyebrow .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--offline); }
html[data-live="live"] .eyebrow { color: var(--brand-text); border-color: var(--brand-soft); }
html[data-live="live"] .eyebrow .dot { background: var(--brand); animation: pulse 2s infinite; }

.hero h1 {
  font-size: clamp(2rem, 6.5vw, 4.2rem); font-weight: 500; line-height: 1.05;
  letter-spacing: -0.02em; margin-bottom: 1rem; overflow-wrap: break-word;
}
.hero h1 .accent { color: var(--brand-text); }
.hero-tagline {
  font-size: clamp(1.05rem, 2.4vw, 1.3rem); color: var(--text-2);
  max-width: 40rem; margin: 0 auto 2rem;
}
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* Twitch facade (click-to-load) */
.player-wrap { margin: clamp(2.2rem, 5vw, 3.4rem) auto 0; max-width: 980px; }
.facade {
  position: relative; aspect-ratio: 16 / 9; width: 100%;
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border);
  display: grid; place-items: center;
}
.facade::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 45%, transparent 55%, rgba(0,0,0,.45) 100%);
}
.facade .play {
  position: relative; z-index: 1;
  width: 76px; height: 76px; border-radius: 50%;
  background: var(--brand); color: var(--brand-ink);
  display: grid; place-items: center;
  box-shadow: 0 0 0 0 var(--brand-glow); transition: transform .2s ease;
}
.facade:hover .play { transform: scale(1.07); }
.facade .play svg { width: 30px; height: 30px; margin-left: 4px; }
.facade .facade-label {
  position: absolute; z-index: 1; bottom: 14px; left: 14px;
  font-family: var(--mono); font-size: .8rem; color: var(--text);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border);
}
.facade .live-badge { display: none; }
html[data-live="live"] .facade .live-badge {
  display: inline-flex; align-items: center; gap: 6px;
  position: absolute; z-index: 1; top: 14px; left: 14px;
  font-family: var(--mono); font-size: .74rem; font-weight: 500;
  color: var(--brand-ink); background: var(--brand);
  padding: 5px 11px; border-radius: 999px;
}
.facade .live-badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand-ink); animation: pulse-ink 2s infinite; }
@keyframes pulse-ink { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.player-wrap iframe { width: 100%; aspect-ratio: 16/9; border: 0; border-radius: var(--radius); display: block; }

/* ---------- Sections ---------- */
.section { padding: clamp(3.5rem, 8vw, 5.5rem) 0; }
.section + .section { border-top: 1px solid var(--border); }
.section-head { text-align: center; max-width: 42rem; margin: 0 auto 2.6rem; }
.section-eyebrow {
  font-family: var(--mono); font-size: .78rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--brand-text); display: block; margin-bottom: .6rem;
}
.section h2 { font-size: clamp(1.7rem, 4vw, 2.3rem); font-weight: 500; letter-spacing: -0.01em; }
.section-head p { color: var(--text-2); margin-top: .7rem; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: clamp(1.5rem, 3vw, 2.2rem);
}

/* About */
.about-grid { display: grid; gap: 2rem; align-items: center; }
@media (min-width: 760px) { .about-grid { grid-template-columns: 200px 1fr; } }
.about-avatar {
  width: 160px; height: 160px; border-radius: var(--radius-lg); margin: 0 auto;
  background: var(--surface-2); border: 1px solid var(--border);
  display: grid; place-items: center; overflow: hidden;
}
.about-avatar .mark { width: 84px; height: 84px; opacity: .9; }
.about-grid p { color: var(--text-2); margin-bottom: 1rem; }
.about-grid p:last-child { margin-bottom: 0; }
.about-grid strong { color: var(--text); font-weight: 500; }

/* Gear */
.gear-grid { display: grid; gap: 1.4rem; }
@media (min-width: 720px) { .gear-grid { grid-template-columns: 1fr 1fr; } }
.gear-card h3 {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.15rem; font-weight: 500; margin-bottom: 1.1rem;
}
.gear-card h3 .chip {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: var(--brand-soft); color: var(--brand-text);
}
.gear-card h3 .chip svg { width: 17px; height: 17px; }
.spec { display: flex; justify-content: space-between; gap: 1rem; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: .95rem; }
.spec:last-child { border-bottom: 0; }
.spec .k { color: var(--text-3); font-family: var(--mono); font-size: .82rem; letter-spacing: .02em; padding-top: 2px; }
.spec .v { color: var(--text); text-align: right; }
.homelab { margin-top: 1.4rem; }
.homelab p { color: var(--text-2); }
.homelab p + p { margin-top: .9rem; }

/* Community */
.community { text-align: center; }
.community .card { max-width: 40rem; margin: 0 auto; }
.community p { color: var(--text-2); margin-bottom: 1.6rem; font-size: 1.05rem; }
.social-row { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; margin-top: 1.6rem; }
.social-row a {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: var(--radius-sm);
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2);
  transition: transform .15s ease, color .15s ease, border-color .15s ease;
}
.social-row a:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-2px); }
.social-row a svg { width: 20px; height: 20px; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border); background: var(--surface);
  padding: 2.5rem 0; text-align: center; color: var(--text-3);
}
.site-footer .footer-socials { display: flex; gap: 18px; justify-content: center; margin-bottom: 1.2rem; }
.site-footer .footer-socials a { color: var(--text-3); }
.site-footer .footer-socials a:hover { color: var(--brand-text); }
.site-footer .footer-socials svg { width: 20px; height: 20px; }
.site-footer p { font-size: .88rem; margin-bottom: .4rem; }
.site-footer .konami-hint { font-family: var(--mono); font-size: .76rem; color: var(--text-3); opacity: .8; }
.site-footer .konami-hint kbd {
  font-family: var(--mono); background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 5px; padding: 1px 5px; font-size: .72rem; color: var(--text-2);
}

/* ---------- Konami toast ---------- */
.konami-toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  z-index: 300; opacity: 0; pointer-events: none;
  background: var(--brand); color: var(--brand-ink); font-weight: 500;
  font-family: var(--mono); font-size: .9rem; letter-spacing: .04em;
  padding: 12px 22px; border-radius: 999px;
  box-shadow: 0 8px 30px var(--brand-glow);
  transition: opacity .35s ease, transform .35s ease;
}
.konami-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Scroll reveal ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .reveal { opacity: 1; transform: none; }
  .btn:hover, .social-row a:hover, .facade:hover .play { transform: none; }
}

/* ---------- Custom scrollbar ---------- */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }
