/* The Game of Tomorrow — modern theme with light/dark, grids, and hero */
:root {
  --accent: #0ea5e9;
  --maxw: 74rem;

  /* Dark theme (default) */
  --bg: #0b0f14;
  --surface: #0f172a;
  --text: #e5e7eb;
  --muted: #94a3b8;
  --card: #0c1220;
  --border: #1f2937;
  --code: #0b1220;
}

[data-theme="light"] {
  --bg: #f8fafc;
  --surface: #ffffff;
  --text: #0b1220;
  --muted: #475569;
  --card: #ffffff;
  --border: #e5e7eb;
  --code: #f1f5f9;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto,
    Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: linear-gradient(180deg, var(--bg), var(--surface) 100%);
  color: var(--text);
  line-height: 1.7;
}

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

.site-header {
  position: sticky; top: 0; z-index: 40;
  backdrop-filter: saturate(140%) blur(10px);
  background: color-mix(in oklab, var(--bg) 70%, transparent);
  border-bottom: 1px solid var(--border);
}
.hero-banner-wrap { position: relative; width: 100vw; margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); }
.overlay-menu { position: absolute; top: 10px; right: 10px; z-index: 10; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { color: var(--text); text-decoration: none; font-weight: 800; letter-spacing: 0.2px; }
.brand:hover { color: var(--accent); }
.nav { display: flex; align-items: center; gap: 0.75rem; }
.nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; }
.nav a:hover { color: var(--accent); background: color-mix(in oklab, var(--accent) 10%, transparent); }

.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; padding: 0; border-radius: 8px; }
.theme-toggle { appearance: none; border: 1px solid var(--border); background: var(--card); color: var(--text); cursor: pointer; font: inherit; }
.theme-toggle:hover { border-color: var(--accent); color: var(--accent); }
.theme-toggle .icon-sun, .theme-toggle .icon-moon { width: 18px; height: 18px; display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: block; }
[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* Overflow menu */
.menu { position: relative; }
.menu-btn { border: 1px solid var(--border); background: var(--card); color: var(--text); }
.menu-btn:hover { border-color: var(--accent); color: var(--accent); }
.overlay-menu .menu-btn { background: transparent; border-color: transparent; color: #ffffff; }
.overlay-menu .menu-btn:hover { background: rgba(255,255,255,0.12); border-color: transparent; color: #ffffff; }
.menu-panel { position: absolute; right: 0; top: calc(100% + 8px); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 6px; min-width: 140px; box-shadow: 0 10px 30px rgba(0,0,0,0.15); }
.menu-item { display: flex; align-items: center; gap: 8px; width: 100%; background: transparent; color: var(--text); border: 0; padding: 8px 10px; border-radius: 8px; cursor: pointer; text-align: left; }
.menu-item:hover { background: color-mix(in oklab, var(--accent) 10%, transparent); color: var(--accent); }
.menu-item .icon-wrap { display: inline-flex; width: 18px; height: 18px; align-items: center; justify-content: center; }

.site-content { padding: 2rem 0 3rem; }
h1, h2, h3 { line-height: 1.25; font-family: "Newsreader", ui-serif, Georgia, serif; }
h1 { font-size: clamp(2rem, 2.6vw + 1rem, 3rem); margin: 0 0 1rem; }
h2 { font-size: clamp(1.5rem, 1.4vw + 1rem, 2rem); margin-top: 2rem; }
h3 { font-size: 1.25rem; margin-top: 1.5rem; }
p { margin: 0 0 1rem; }
em, i { color: color-mix(in oklab, var(--text) 90%, #fff 10%); }

code, pre {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}
code { background: var(--code); padding: 0.15rem 0.35rem; border: 1px solid var(--border); border-radius: 6px; }
pre { background: var(--code); border: 1px solid var(--border); border-radius: 12px; padding: 1rem; overflow: auto; }
pre code { background: transparent; border: 0; padding: 0; }

a { color: var(--accent); }
a:hover { text-decoration: underline; }

img, video { max-width: 100%; height: auto; border-radius: 14px; display: block; margin: 1rem 0; }

.card {
  background: linear-gradient(180deg, var(--card), color-mix(in oklab, var(--card) 80%, transparent));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
  margin: 1rem 0;
  box-shadow: 0 10px 30px rgba(0,0,0,0.15), inset 0 1px 0 rgba(255,255,255,0.03);
}
.card h2 { margin: 0 0 0.5rem; }
.post-meta { color: var(--muted); font-size: 0.95rem; margin-bottom: 0.5rem; }

.site-footer { border-top: 1px solid var(--border); padding: 2rem 0; color: var(--muted); }

/* Post hero header */
.post-hero {
  position: relative;
  background-size: cover;
  background-position: center;
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
  margin: 0 0 1.25rem;
}
.post-hero::before {
  content: "";
  position: absolute; inset: 0;
  --overlay: 0.45;
  background: linear-gradient(180deg, rgba(0,0,0,var(--overlay)), rgba(0,0,0,calc(var(--overlay) - 0.1)));
}
[data-theme="light"] .post-hero::before {
  --overlay: 0.55;
  background: linear-gradient(180deg, rgba(255,255,255,var(--overlay)), rgba(255,255,255,calc(var(--overlay) - 0.1)));
}
.post-hero .inner {
  position: relative;
  padding: 3.2rem 1.25rem;
}
.post-hero h1 { margin: 0 0 0.5rem; color: #fff; text-shadow: 0 2px 16px rgba(0,0,0,0.25); }
.post-hero h1 {
  display: inline-block;
  background: rgba(0,0,0,0.45);
  padding: 0.35rem 0.6rem;
  border-radius: 10px;
  backdrop-filter: saturate(120%) blur(2px);
}
[data-theme="light"] .post-hero h1 {
  background: rgba(255,255,255,0.8);
  color: #0b1220;
  text-shadow: none;
}
.post-hero .post-meta { color: #f5f7fb; text-shadow: 0 2px 12px rgba(0,0,0,0.25); }

/* Post content image float on desktop */
.post-content img:not(.no-float) {
  border-radius: 12px;
}
@media (min-width: 900px) {
  .post-content img:not(.no-float) {
    float: right;
    margin: 0.25rem 0 1rem 1.25rem;
    max-width: min(44%, 520px);
  }
}

/* Figure rendering */
.post-figure { margin: 1rem 0; }
.post-figure img { max-width: 100%; height: auto; border-radius: 12px; display: block; }
.post-figure.no-float img { float: none !important; }
.post-figure figcaption { font-size: 0.9rem; color: var(--muted); margin-top: 0.35rem; }
.post-figure figcaption .caption { font-weight: 500; }
.post-figure figcaption .credit { font-style: italic; }
@media (min-width: 900px) {
  .post-content .post-figure:not(.no-float) img { float: right; margin: 0.25rem 0 1rem 1.25rem; max-width: min(44%, 520px); }
}

/* Hero */
.hero { padding: 3.5rem 0 2rem; }
.hero.banner-only { padding: 0; }
.hero .wrap { max-width: 100%; }
.hero.banner-only .wrap { padding: 0; }
.hero .inner { display: grid; gap: 1.25rem; text-align: center; justify-items: center; }
.hero .inner h1, .hero .inner p { grid-column: 1 / -1; width: 100%; justify-self: center; }
.hero.with-media .inner { align-items: center; }
.hero.with-media .inner { grid-template-columns: 1fr; }
@media (min-width: 900px) {
  .hero.with-media .inner { grid-template-columns: 1.1fr 0.9fr; }
}
.hero-banner { width: 100%; height: auto; display: block; border-radius: 0; border: 0; box-shadow: none; }
.hero.banner-only .inner { gap: 0.75rem; }
.hero h1 { margin: 0; font-size: clamp(2.4rem, 3.2vw + 1rem, 3.6rem); letter-spacing: -0.02em; }
.hero p { color: var(--muted); font-size: clamp(1rem, 0.4vw + 1rem, 1.15rem); }
.hero-cta { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 999px; text-decoration: none; color: #00131d; background: var(--accent); border: 1px solid color-mix(in oklab, var(--accent) 80%, #000 20%); box-shadow: 0 8px 20px rgba(14,165,233,0.25); font-weight: 600; }
.hero-cta:hover { filter: brightness(1.05); }
.hero .media { order: -1; }
@media (min-width: 900px) { .hero .media { order: unset; } }

/* Filters & search */
/* Search bar */
.searchbar { display: flex; justify-content: center; margin: 1rem 0 1.25rem; }
.searchbar-inner { width: min(720px, 92%); display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 10px 14px; box-shadow: 0 2px 16px rgba(0,0,0,0.06); }
.searchbar-inner:hover { border-color: color-mix(in oklab, var(--accent) 40%, var(--border)); }
.search-icon { color: var(--muted); }
.search-input { flex: 1; border: 0; outline: none; background: transparent; color: var(--text); font-size: 1rem; }

/* Post grid */
.post-grid { display: grid; gap: 1rem; grid-template-columns: repeat(1, minmax(0, 1fr)); }
@media (min-width: 700px) { .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .post-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Featured banner */
.featured { margin: 0 0 1.5rem; width: 100vw; margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); }
.featured-card {
  position: relative; display: block; border-radius: 16px; overflow: hidden; min-height: 320px;
  background-size: cover; background-position: center; border: 1px solid var(--border);
}
.featured-overlay { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(0,0,0,0.2), rgba(0,0,0,0.55)); }
[data-theme="light"] .featured-overlay { background: linear-gradient(180deg, rgba(255,255,255,0.3), rgba(255,255,255,0.7)); }
.featured-content { position: absolute; left: 1.25rem; right: 1.25rem; bottom: 1.25rem; padding: 0; display: grid; gap: 0.5rem; max-width: 64rem; }
.featured h2 { margin: 0; font-size: clamp(1.8rem, 1.6vw + 1rem, 2.6rem); color: #fff; text-shadow: 0 2px 16px rgba(0,0,0,0.25); }
.featured .meta { color: #f2f5fb; font-weight: 500; }
@media (min-width: 900px) {
  .featured-card { min-height: 460px; }
}

/* Card redesign */
.post-card { display: grid; grid-template-rows: auto 1fr; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.thumb-link { display: block; }
.thumb { position: relative; width: 100%; aspect-ratio: 1 / 1; background: var(--surface); overflow: hidden; }
.post-thumb { display: block; width: 100%; height: 100%; object-fit: contain; background: var(--surface); }
.card-banner { position: relative; display: block; width: 100%; aspect-ratio: 1 / 1; background-size: contain; background-position: center; background-repeat: no-repeat; background-color: var(--surface); text-decoration: none; border: 1px solid var(--border); border-radius: 12px; margin: 0.9rem 0.9rem 0 0.9rem; }
.card-banner-overlay { display: none; }
.card-banner-content { display: none; }
.post-body { padding: 0.9rem; display: grid; gap: 0.35rem; }
.pill { display: inline-block; font-size: 0.78rem; font-weight: 600; border: 1px solid transparent; border-radius: 999px; padding: 4px 10px; line-height: 1; }
.chip-row .pill:nth-child(6n+1) { background: rgba(14,165,233,0.18); color: color-mix(in oklab, var(--text) 85%, #0ea5e9 15%); border-color: rgba(14,165,233,0.35); }
.chip-row .pill:nth-child(6n+2) { background: rgba(99,102,241,0.18); color: color-mix(in oklab, var(--text) 85%, #6366f1 15%); border-color: rgba(99,102,241,0.35); }
.chip-row .pill:nth-child(6n+3) { background: rgba(236,72,153,0.18); color: color-mix(in oklab, var(--text) 85%, #ec4899 15%); border-color: rgba(236,72,153,0.35); }
.chip-row .pill:nth-child(6n+4) { background: rgba(234,179,8,0.20); color: color-mix(in oklab, var(--text) 85%, #eab308 15%); border-color: rgba(234,179,8,0.35); }
.chip-row .pill:nth-child(6n+5) { background: rgba(34,197,94,0.18); color: color-mix(in oklab, var(--text) 85%, #22c55e 15%); border-color: rgba(34,197,94,0.35); }
.chip-row .pill:nth-child(6n+6) { background: rgba(59,130,246,0.18); color: color-mix(in oklab, var(--text) 85%, #3b82f6 15%); border-color: rgba(59,130,246,0.35); }
.chip-row { display: flex; flex-wrap: wrap; gap: 0.4rem; padding: 0.6rem 0.9rem 0 0.9rem; }
.post-card h3 { margin: 0; font-size: 1.2rem; }
.post-card h3 a { color: inherit; text-decoration: none; }
.post-card h3, .post-card h3 a {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card .card-title a { color: #0b1220; }
[data-theme="dark"] .post-card .card-title a { color: #ffffff; }
.post-card .post-body p {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 0.15rem;
}
.post-card .excerpt p {
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.more-link { display: inline-block; margin-top: 0.4rem; text-decoration: none; color: var(--accent); font-weight: 600; }
.more-link:hover { text-decoration: underline; }

/* Tables */
table { width: 100%; border-collapse: collapse; margin: 1rem 0; }
th, td { border: 1px solid var(--border); padding: 0.6rem 0.8rem; }
th { background: color-mix(in oklab, var(--accent) 10%, var(--surface)); text-align: left; }

/* Blockquotes */
blockquote { border-left: 3px solid var(--accent); margin: 1rem 0; padding: 0.5rem 1rem; color: color-mix(in oklab, var(--text) 80%, var(--accent) 20%); background: color-mix(in oklab, var(--accent) 10%, var(--surface)); border-radius: 10px; }

/* Pagination */
.pagination { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 1.5rem; }
.page-item { border: 1px solid var(--border); background: var(--card); color: var(--text); padding: 0.45rem 0.8rem; border-radius: 10px; text-decoration: none; }
.page-item:hover { border-color: var(--accent); color: var(--accent); }
.page-item.active { background: var(--accent); border-color: var(--accent); color: #00131d; }

/* Utility */
.muted { color: var(--muted); }
.center { text-align: center; }

@media (min-width: 900px) {
  .site-content { padding: 3rem 0 4rem; }
  .card { padding: 1.5rem; }
  .hero { padding: 4.5rem 0 2.5rem; }
}


