/* Shared MarkLaporte.com chrome + Games library styles
   Matches homepage tokens (Syne, dark bg, red accent). */
:root {
  --bg: #0f0f0f;
  --bg-elevated: #161616;
  --bg-card: #141414;
  --text: #f5f5f5;
  --text-muted: #a3a3a3;
  --accent: #c0392b;
  --accent-hover: #e74c3c;
  --border: #2a2a2a;
  --border-accent: rgba(192, 57, 43, 0.45);
  --radius: 2px;
  --font: "Syne", system-ui, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Code", "SF Mono", Consolas, "Courier New", monospace;
  --max: 1120px;
  --nav-h: 64px;
  --term-green: #7cfc7c;
  --term-green-dim: #3f8f4f;
  --term-amber: #ffd27a;
  --term-amber-dim: #a67c2d;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 20%, transparent 70%);
  pointer-events: none;
}

a { color: inherit; text-decoration: none; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: #fff;
  z-index: 100;
}
.skip-link:focus { left: 1rem; top: 1rem; }

.wrap {
  width: min(100% - 2.5rem, var(--max));
  margin-inline: auto;
}

/* Navigation */
.site-nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--border);
  background: rgba(15, 15, 15, 0.92);
  backdrop-filter: blur(10px);
}

.site-nav .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.nav-brand {
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  position: relative;
  z-index: 60;
}

.nav-brand span { color: var(--accent); }

.nav-toggle {
  display: none;
  position: relative;
  z-index: 60;
  width: 44px;
  height: 44px;
  margin-right: -8px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 5px;
}

.nav-toggle:focus-visible {
  outline: none;
  border-color: var(--border-accent);
}

.nav-toggle-bar {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--text);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.site-nav.is-open .nav-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.site-nav.is-open .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.site-nav.is-open .nav-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 1.25rem;
  list-style: none;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.nav-links a {
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a:focus-visible,
.nav-links a[aria-current="page"] {
  color: var(--text);
}

/* Page hero */
.page-hero {
  padding: 4rem 0 3rem;
  border-bottom: 1px solid var(--border);
}

.page-hero .hero-eyebrow {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}

.page-hero h1 {
  font-size: clamp(2.25rem, 6vw, 3.75rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  margin-bottom: 1rem;
}

.page-hero .hero-desc {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 54ch;
  font-weight: 400;
}

.hero-accent-line {
  width: 64px;
  height: 3px;
  background: var(--accent);
  margin-top: 1.75rem;
}

.section-label {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

/* Games grid */
.games-section {
  padding: 3.5rem 0 4.5rem;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.25rem;
}

.game-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.35rem 1.5rem;
  transition: border-color 0.25s ease, transform 0.25s ease, box-shadow 0.25s ease;
  position: relative;
  overflow: hidden;
  min-width: 0;
}

.game-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: transparent;
  transition: background 0.25s ease;
}

.game-card:hover,
.game-card:focus-within {
  border-color: var(--border-accent);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.game-card:hover::before,
.game-card:focus-within::before {
  background: var(--accent);
}

.game-card h2 {
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin-bottom: 0.25rem;
}

.game-subtitle {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.85rem;
  line-height: 1.4;
}

.game-desc {
  color: var(--text-muted);
  font-size: 0.92rem;
  flex: 1;
  margin-bottom: 1.1rem;
  line-height: 1.55;
}

.game-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 1rem;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.28rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  background: var(--bg);
}

.meta-chip.is-category {
  color: var(--term-green);
  border-color: rgba(124, 252, 124, 0.28);
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.04em;
}

.meta-chip.is-status {
  color: var(--accent);
  border-color: var(--border-accent);
}

.meta-chip.is-version {
  font-family: var(--mono);
  font-size: 0.65rem;
}

/* Terminal preview */
.term-preview {
  margin: 0 0 1.15rem;
  padding: 0.85rem 0.95rem;
  background: #0a120e;
  border: 1px solid #1f3a28;
  border-radius: var(--radius);
  overflow: hidden;
  min-width: 0;
}

.term-preview.is-amber {
  background: #12100a;
  border-color: #3a3220;
}

.term-preview-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.65rem;
  font-family: var(--mono);
  font-size: 0.65rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--term-green-dim);
}

.term-preview.is-amber .term-preview-bar {
  color: var(--term-amber-dim);
}

.term-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--term-green-dim);
  flex-shrink: 0;
}

.term-preview.is-amber .term-dot {
  background: var(--term-amber-dim);
}

.term-preview pre {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--term-green);
  white-space: pre;
  overflow-x: auto;
  max-width: 100%;
}

.term-preview.is-amber pre {
  color: var(--term-amber);
}

.btn-play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  align-self: flex-start;
  padding: 0.7rem 1.2rem;
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
  min-height: 44px;
}

.btn-play:hover,
.btn-play:focus-visible {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
  outline: none;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.1rem;
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: color 0.2s ease, border-color 0.2s ease;
  min-height: 44px;
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
  color: var(--text);
  border-color: var(--border-accent);
  outline: none;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: auto;
}

/* Detail page */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  transition: color 0.2s ease;
}

.back-link:hover,
.back-link:focus-visible {
  color: var(--text);
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: start;
  padding: 2.5rem 0 4rem;
}

.detail-main h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin-bottom: 0.5rem;
}

.detail-subtitle {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.detail-desc {
  color: var(--text-muted);
  font-size: 1.02rem;
  max-width: 58ch;
  margin-bottom: 1.35rem;
}

.detail-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.4rem;
}

.detail-panel h2 {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.85rem;
}

.detail-panel ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.detail-panel li {
  font-size: 0.92rem;
  color: var(--text-muted);
  padding-left: 0.9rem;
  position: relative;
  line-height: 1.5;
}

.detail-panel li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55rem;
  width: 5px;
  height: 5px;
  background: var(--accent);
  border-radius: 1px;
}

.play-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  position: sticky;
  top: calc(var(--nav-h) + 1rem);
}

.play-panel .term-preview {
  margin-bottom: 1.25rem;
}

.play-panel .btn-play {
  width: 100%;
  margin-bottom: 0.75rem;
}

.play-meta-line {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  text-align: center;
}

/* Future filter hook (hidden until enabled) */
.games-filters {
  display: none;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
}

.games-filters.is-ready {
  display: flex;
}

.filter-chip {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  background: var(--bg-card);
  cursor: pointer;
  font-family: var(--font);
  min-height: 40px;
}

.filter-chip.is-active,
.filter-chip:hover {
  color: var(--text);
  border-color: var(--border-accent);
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 0;
  margin-top: auto;
}

.site-footer p {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}

/* Personal chaosnode shortcut — intentionally tiny */
.chaos-pi {
  position: fixed;
  right: 6px;
  bottom: 4px;
  z-index: 40;
  font-size: 8px;
  line-height: 1;
  color: rgba(163, 163, 163, 0.35);
  text-decoration: none;
  font-family: Georgia, "Times New Roman", serif;
  padding: 4px;
  transition: color 0.2s ease;
}

.chaos-pi:hover,
.chaos-pi:focus-visible {
  color: rgba(245, 245, 245, 0.7);
  outline: none;
}

.site-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

@media (max-width: 860px) {
  .nav-toggle {
    display: inline-flex;
  }

  .site-nav {
    height: auto;
    min-height: var(--nav-h);
  }

  .site-nav .wrap {
    position: relative;
    flex-wrap: wrap;
    min-height: var(--nav-h);
  }

  .nav-links {
    display: none;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: stretch;
    gap: 0;
    width: 100%;
    order: 3;
    padding: 0.5rem 0 1rem;
    border-top: 1px solid var(--border);
    background: rgba(15, 15, 15, 0.98);
  }

  .site-nav.is-open .nav-links {
    display: flex;
  }

  .nav-links li {
    border-bottom: 1px solid var(--border);
  }

  .nav-links li:last-child {
    border-bottom: none;
  }

  .nav-links a {
    display: block;
    padding: 0.95rem 0.15rem;
    font-size: 0.85rem;
    min-height: 44px;
  }

  body.nav-open {
    overflow: hidden;
  }
}

@media (max-width: 800px) {
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .play-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  .page-hero { padding: 3rem 0 2.25rem; }
  .games-section { padding: 2.5rem 0 3.5rem; }
  .games-grid { grid-template-columns: 1fr; }

  .wrap {
    width: min(100% - 1.5rem, var(--max));
  }

  .term-preview pre {
    font-size: 0.65rem;
  }
}
