/* ==========================================================================
   NextDraw Labs — styles
   ========================================================================== */

:root {
  --bg: #0b0d12;
  --bg-alt: #0f1219;
  --surface: #141823;
  --surface-2: #1a1f2c;
  --border: #252b3a;
  --text: #e8eaf0;
  --muted: #9aa3b5;
  --accent: #8b6cff;
  --accent-ink: #ffffff;
  --grid: rgba(255, 255, 255, 0.035);

  --games: #ff5c8a;
  --analytics: #2fd4c0;
  --live: #ffa043;
  --leads: #6f9bff;

  --font-display: "Space Grotesk", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  --radius: 16px;
  --container: 1120px;
  --header-h: 68px;

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #f7f7fb;
  --bg-alt: #eef0f6;
  --surface: #ffffff;
  --surface-2: #f2f3f8;
  --border: #dfe2ec;
  --text: #121521;
  --muted: #586074;
  --accent: #6a47f5;
  --grid: rgba(18, 21, 33, 0.05);

  --games: #e03468;
  --analytics: #0f9e8e;
  --live: #d9761a;
  --leads: #3b6ef0;

  color-scheme: light;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f7f7fb;
    --bg-alt: #eef0f6;
    --surface: #ffffff;
    --surface-2: #f2f3f8;
    --border: #dfe2ec;
    --text: #121521;
    --muted: #586074;
    --accent: #6a47f5;
    --grid: rgba(18, 21, 33, 0.05);

    --games: #e03468;
    --analytics: #0f9e8e;
    --live: #d9761a;
    --leads: #3b6ef0;

    color-scheme: light;
  }
}

/* Base ------------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 {
  font-family: var(--font-display);
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin: 0 0 0.6em;
}

h2 { font-size: clamp(1.9rem, 4vw, 2.75rem); }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1em; }

a { color: inherit; }
img, svg { display: block; max-width: 100%; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

@media (max-width: 600px) {
  .container { padding: 0 16px; }
}

.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;
}

.skip-link {
  position: absolute; left: 16px; top: -48px; z-index: 100;
  background: var(--accent); color: var(--accent-ink);
  padding: 8px 14px; border-radius: 8px; text-decoration: none;
}
.skip-link:focus { top: 12px; }

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}

.accent-text {
  background: linear-gradient(90deg, var(--accent), var(--games) 55%, var(--live));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* Buttons ---------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0.8em 1.4em;
  border-radius: 999px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  font-size: 0.975rem;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background 0.2s ease;
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px -8px var(--accent);
}
.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover { border-color: var(--accent); box-shadow: none; }
.btn-small { padding: 0.5em 1.1em; font-size: 0.9rem; }
.btn-large { padding: 1em 1.8em; font-size: 1.05rem; }

/* Header ----------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}
.site-header.is-scrolled { border-bottom-color: var(--border); }

.header-inner {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  letter-spacing: -0.01em;
}
.brand-mark { width: 30px; height: 30px; }
.brand-dim { color: var(--muted); font-weight: 500; margin-left: 0.25em; }

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

.nav-menu {
  display: flex;
  align-items: center;
  gap: 28px;
  list-style: none;
  margin: 0 12px 0 0;
  padding: 0;
}
.nav-menu a:not(.btn) {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.15s ease;
}
.nav-menu a:not(.btn):hover,
.nav-menu a[aria-current="page"] { color: var(--text); }

.theme-toggle, .nav-toggle {
  width: 40px; height: 40px;
  display: inline-grid; place-items: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
}
.theme-toggle svg {
  width: 18px; height: 18px;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round;
}
.icon-sun { display: none; }
:root[data-theme="light"] .icon-sun { display: block; }
:root[data-theme="light"] .icon-moon { display: none; }
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) .icon-sun { display: block; }
  :root:not([data-theme="dark"]) .icon-moon { display: none; }
}

.nav-toggle { display: none; gap: 5px; align-content: center; }
.nav-toggle-bar {
  display: block; width: 18px; height: 2px; border-radius: 2px;
  background: currentColor; transition: transform 0.2s ease;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:first-of-type { transform: translateY(3.5px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:last-of-type { transform: translateY(-3.5px) rotate(-45deg); }

@media (max-width: 760px) {
  .nav-toggle { display: inline-grid; order: 2; }
  .theme-toggle { order: 1; }
  .nav-menu {
    position: absolute;
    top: var(--header-h);
    left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    padding: 8px 16px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    display: none;
  }
  .nav-menu.is-open { display: flex; }
  .nav-menu li a:not(.btn) { display: block; padding: 14px 4px; font-size: 1.05rem; }
  .nav-menu .btn { margin-top: 10px; width: 100%; }
}

/* Hero ------------------------------------------------------------------- */

.hero {
  position: relative;
  padding: clamp(72px, 12vw, 140px) 0 clamp(64px, 10vw, 120px);
  overflow: hidden;
}
.hero::before {
  /* Drafting grid */
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 30%, #000 30%, transparent 75%);
  pointer-events: none;
}
.hero::after {
  content: "";
  position: absolute;
  width: 640px; height: 640px;
  top: -260px; right: -160px;
  background: radial-gradient(circle, color-mix(in srgb, var(--accent) 28%, transparent), transparent 65%);
  filter: blur(20px);
  pointer-events: none;
}

.hero-inner { position: relative; z-index: 1; }

.hero-title {
  font-size: clamp(2.6rem, 7.5vw, 5.25rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  max-width: 14ch;
  margin-bottom: 0.4em;
}

.hero-lede {
  max-width: 560px;
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  color: var(--muted);
  margin-bottom: 2rem;
}

.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; }

/* Sections --------------------------------------------------------------- */

.section { padding: clamp(72px, 10vw, 120px) 0; }
.section-alt {
  background: var(--bg-alt);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.section-head { max-width: 640px; margin-bottom: 3rem; }
.section-lede { color: var(--muted); font-size: 1.1rem; }

/* Ventures --------------------------------------------------------------- */

.venture-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
@media (max-width: 760px) {
  .venture-grid { grid-template-columns: 1fr; }
}

.venture {
  position: relative;
  padding: 28px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.venture::before {
  content: "";
  position: absolute;
  left: 0; top: 0; right: 0;
  height: 3px;
  background: var(--c);
  opacity: 0.85;
}
.venture::after {
  content: "";
  position: absolute;
  width: 260px; height: 260px;
  right: -120px; top: -120px;
  background: radial-gradient(circle, color-mix(in srgb, var(--c) 18%, transparent), transparent 70%);
  pointer-events: none;
}
.venture:hover {
  border-color: color-mix(in srgb, var(--c) 55%, var(--border));
  transform: translateY(-2px);
}

.venture-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}

.venture-icon {
  width: 48px; height: 48px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: color-mix(in srgb, var(--c) 14%, transparent);
  color: var(--c);
}
.venture-icon svg {
  width: 24px; height: 24px;
  fill: none; stroke: currentColor; stroke-width: 1.8;
  stroke-linecap: round; stroke-linejoin: round;
}
.venture-icon .fill { fill: currentColor; stroke: none; }

.venture p { color: var(--muted); margin: 0; }

.venture-link {
  display: inline-block;
  margin-top: 1rem;
  color: var(--c);
  font-weight: 600;
  text-decoration: none;
}
.venture-link:hover { text-decoration: underline; }

.status {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  white-space: nowrap;
}
.status::before {
  content: "";
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-right: 7px;
  vertical-align: 1px;
  background: currentColor;
}
.status-live { color: #2fcf7a; border-color: color-mix(in srgb, #2fcf7a 40%, transparent); }
.status-beta { color: var(--leads); border-color: color-mix(in srgb, var(--leads) 40%, transparent); }
.status-dev  { color: var(--live); border-color: color-mix(in srgb, var(--live) 40%, transparent); }

.section-head-row {
  max-width: none;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.section-head-row h2 { margin-bottom: 0; }

.text-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.text-link:hover { text-decoration: underline; }

/* Blog: post list -------------------------------------------------------- */

.post-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--border);
}
.post-list > li { border-bottom: 1px solid var(--border); }

.post-item {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 8px 32px;
  padding: 26px 4px;
  text-decoration: none;
  transition: background 0.15s ease;
}
.post-item:hover h3 { color: var(--accent); }
.post-item time {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted);
  padding-top: 0.3em;
}
.post-item h3 { margin: 0 0 0.35em; transition: color 0.15s ease; }
.post-item p { margin: 0; color: var(--muted); }
@media (max-width: 600px) {
  .post-item { grid-template-columns: 1fr; padding: 22px 0; }
}

.post-empty { padding: 26px 4px; color: var(--muted); }
.post-empty a { color: var(--accent); }

/* Page header (blog index) ------------------------------------------------ */

.page-head { padding: clamp(56px, 9vw, 104px) 0 clamp(32px, 5vw, 56px); }
.page-head h1 { font-size: clamp(2.4rem, 6vw, 3.75rem); margin-bottom: 0.3em; }
.page-head p:not(.eyebrow) { color: var(--muted); font-size: 1.15rem; max-width: 560px; margin: 0; }

/* Blog: article ------------------------------------------------------------ */

.post { padding: clamp(48px, 8vw, 96px) 0; }
.post-container { max-width: 720px; }

.post-back {
  display: inline-block;
  margin-bottom: 2rem;
  color: var(--muted);
  font-size: 0.95rem;
  text-decoration: none;
}
.post-back:hover { color: var(--text); }

.post-header { margin-bottom: 2.5rem; }
.post-header h1 { font-size: clamp(2.1rem, 5.5vw, 3.25rem); margin-bottom: 0.4em; }
.post-meta {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--muted);
}

.prose { font-size: 1.1rem; line-height: 1.75; }
.prose > * { margin-top: 0; margin-bottom: 0; }
.prose > * + * { margin-top: 1.25em; }
.prose > h2 { font-size: 1.6rem; margin-top: 2.2em; }
.prose > h3 { font-size: 1.25rem; margin-top: 1.8em; }
.prose a { color: var(--accent); }
.prose ul, .prose ol { padding-left: 1.4em; margin-bottom: 0; }
.prose li + li { margin-top: 0.4em; }
.prose blockquote {
  margin-left: 0;
  margin-right: 0;
  padding-left: 1.2em;
  border-left: 3px solid var(--accent);
  color: var(--muted);
}
.prose code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  padding: 0.15em 0.4em;
  border-radius: 6px;
  background: var(--surface-2);
}
.prose pre {
  overflow-x: auto;
  padding: 18px 20px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.prose pre code { padding: 0; background: none; }
.prose img { border-radius: 12px; height: auto; }

.post-footer {
  margin-top: 3.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
}
.post-footer a { color: var(--accent); }

/* About ------------------------------------------------------------------ */

.about-text p:not(.eyebrow) { color: var(--muted); max-width: 60ch; }
.about-text a { color: var(--accent); }

/* CTA -------------------------------------------------------------------- */

#contact { padding-top: 0; }

.cta {
  position: relative;
  text-align: center;
  padding: clamp(48px, 8vw, 80px) 24px;
  border-radius: calc(var(--radius) + 8px);
  border: 1px solid var(--border);
  background:
    radial-gradient(ellipse 60% 80% at 50% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 70%),
    var(--surface);
  overflow: hidden;
}
.cta h2 { max-width: 20ch; margin-left: auto; margin-right: auto; }
.cta p { color: var(--muted); margin-bottom: 2rem; }
.cta .btn { max-width: 100%; overflow-wrap: anywhere; }

/* Footer ----------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 28px 0;
  color: var(--muted);
  font-size: 0.9rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}
.footer-inner p { margin: 0; }
.footer-links { display: flex; gap: 22px; list-style: none; margin: 0; padding: 0; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { color: var(--text); }

/* 404 -------------------------------------------------------------------- */

.notfound {
  min-height: calc(100vh - var(--header-h) - 90px);
  display: grid;
  place-items: center;
  text-align: center;
  padding: 64px 0;
}
.notfound-code {
  font-family: var(--font-display);
  font-size: clamp(5rem, 18vw, 9rem);
  font-weight: 700;
  line-height: 1;
  margin: 0 0 0.2em;
}
.notfound p { color: var(--muted); }

/* Reveal on scroll ------------------------------------------------------- */

.js .reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.js .reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .reveal { opacity: 1; transform: none; transition: none; }
  .btn, .venture { transition: none; }
}
