/* Between Games — stylesheet
   Fonts: Fraunces + Inter (both SIL Open Font License) */

:root {
  --bg: #14120f;
  --bg-raised: #1c1915;
  --line: #2e2a24;
  --text: #ece6da;
  --text-dim: #a39b8c;
  --accent: #e3a83b;          /* warm gold */
  --accent-soft: rgba(227, 168, 59, 0.12);
  --jade: #6fb39a;
  --radius: 14px;
  --max: 1080px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f7f3ec;
    --bg-raised: #ffffff;
    --line: #e2dbcf;
    --text: #1d1a16;
    --text-dim: #6b6358;
    --accent: #b87708;
    --accent-soft: rgba(184, 119, 8, 0.10);
    --jade: #2f7d63;
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f7f3ec;
  --bg-raised: #ffffff;
  --line: #e2dbcf;
  --text: #1d1a16;
  --text-dim: #6b6358;
  --accent: #b87708;
  --accent-soft: rgba(184, 119, 8, 0.10);
  --jade: #2f7d63;
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent); }
img { max-width: 100%; display: block; }

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

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav .wrap { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.logo { font-family: var(--serif); font-size: 20px; font-weight: 600; text-decoration: none; letter-spacing: -0.01em; }
.logo span { color: var(--accent); }
.logo .dice { color: inherit; display: inline-block; margin-right: 2px; transition: transform .4s; }
.logo:hover .dice { transform: rotate(180deg); }
.nav ul { display: flex; gap: 28px; list-style: none; align-items: center; }
.nav ul a { text-decoration: none; color: var(--text-dim); font-size: 15px; }
.nav ul a:hover { color: var(--text); }
.theme-btn {
  background: none; border: 1px solid var(--line); color: var(--text-dim);
  border-radius: 999px; width: 34px; height: 34px; cursor: pointer; font-size: 15px;
}
.theme-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ---------- Hero ---------- */
.hero { padding: 120px 0 100px; }
.eyebrow {
  font-family: var(--mono); font-size: 13px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--jade); margin-bottom: 20px;
}
.hero h1 {
  font-family: var(--serif); font-weight: 500;
  font-size: clamp(44px, 7.5vw, 84px); line-height: 1.04; letter-spacing: -0.025em;
}
.reel-line { display: flex; align-items: baseline; gap: 0.3em; flex-wrap: wrap; }

/* the signature: a slot reel that spins through roles */
.reel {
  display: inline-block; height: 1.1em; overflow: hidden; vertical-align: bottom;
  color: var(--accent); font-style: italic;
  border-bottom: 2px solid var(--accent-soft);
}
.reel-strip { display: flex; flex-direction: column; transition: transform 0.9s cubic-bezier(.2,.9,.25,1.15); }
.reel-strip span { height: 1.1em; line-height: 1.1em; white-space: nowrap; }

.hero p.lead {
  margin-top: 32px; max-width: 620px; font-size: 20px; color: var(--text-dim);
}
.hero-cta { margin-top: 40px; display: flex; gap: 14px; flex-wrap: wrap; }
.btn {
  display: inline-block; padding: 12px 22px; border-radius: 999px;
  font-size: 15px; font-weight: 500; text-decoration: none; transition: all .2s;
}
.btn-primary { background: var(--accent); color: #1a1408; }
.btn-primary:hover { color: #1a1408; filter: brightness(1.08); }
.btn-ghost { border: 1px solid var(--line); color: var(--text); }
.btn-ghost:hover { border-color: var(--accent); }

/* ---------- Sections ---------- */
section { padding: 90px 0; border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 44px; gap: 16px; flex-wrap: wrap; }
.section-head h2 { font-family: var(--serif); font-weight: 500; font-size: clamp(30px, 4vw, 40px); letter-spacing: -0.015em; }
.section-num { font-family: var(--mono); font-size: 13px; color: var(--text-dim); }

section.first { border-top: 0; padding-top: 72px; }

/* About */
.about-text { max-width: 760px; }
.about-text p { color: var(--text-dim); font-size: 19px; }
.about-text p + p { margin-top: 20px; }
.about-text p strong { color: var(--text); font-weight: 500; }
.about-grid { display: grid; grid-template-columns: 1.5fr 1fr; gap: 64px; }
.about-grid p + p { margin-top: 18px; }
.about-grid p { color: var(--text-dim); }
.about-grid p strong { color: var(--text); font-weight: 500; }
.facts { list-style: none; border-top: 1px solid var(--line); }
.facts li { display: flex; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); font-size: 15px; }
.facts li span:first-child { color: var(--text-dim); }
.facts li span:last-child { text-align: right; }

/* Skills */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.card {
  background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px 24px; transition: border-color .2s, transform .2s;
}
.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.card .icon { font-family: var(--mono); color: var(--accent); font-size: 13px; margin-bottom: 18px; }
.card h3 { font-family: var(--serif); font-weight: 500; font-size: 21px; margin-bottom: 10px; }
.card p { font-size: 15px; color: var(--text-dim); line-height: 1.6; }

/* Work */
.work-list { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.work {
  border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden;
  background: var(--bg-raised); text-decoration: none; display: flex; flex-direction: column;
}
.work:hover { border-color: var(--accent); color: inherit; }
.work-thumb {
  aspect-ratio: 16 / 9; display: grid; place-items: center;
  background:
    radial-gradient(circle at 30% 20%, var(--accent-soft), transparent 60%),
    repeating-linear-gradient(90deg, transparent 0 19.6%, var(--line) 19.6% 20%),
    var(--bg);
  font-family: var(--mono); font-size: 13px; color: var(--text-dim);
}
.work-body { padding: 22px 24px 26px; }
.tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.tag {
  font-family: var(--mono); font-size: 11.5px; letter-spacing: 0.04em; text-transform: uppercase;
  padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--text-dim);
}
.tag.live { color: var(--jade); border-color: var(--jade); }
.work h3 { font-family: var(--serif); font-weight: 500; font-size: 23px; margin-bottom: 8px; }
.work p { font-size: 15px; color: var(--text-dim); }

/* Writing */
.posts { list-style: none; border-top: 1px solid var(--line); }
.posts a {
  display: grid; grid-template-columns: 1fr auto; gap: 24px; align-items: baseline;
  padding: 24px 0; border-bottom: 1px solid var(--line); text-decoration: none;
}
.posts a:hover h3 { color: var(--accent); }
.posts time { font-family: var(--mono); font-size: 13px; color: var(--text-dim); }
.posts h3 { font-family: var(--serif); font-weight: 500; font-size: 21px; transition: color .2s; }
.posts p { font-size: 15px; color: var(--text-dim); margin-top: 4px; }
.posts .arrow { color: var(--text-dim); }

/* Contact */
.contact { text-align: center; padding: 120px 0; }
.contact h2 { font-family: var(--serif); font-weight: 500; font-size: clamp(34px, 5vw, 56px); letter-spacing: -0.02em; }
.contact p { color: var(--text-dim); margin: 18px auto 36px; max-width: 520px; }
.contact-actions { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }
a.card { display: block; text-decoration: none; color: inherit; }
.socials { margin-top: 28px; display: flex; gap: 24px; justify-content: center; font-size: 15px; }
.socials a { color: var(--text-dim); }

footer { border-top: 1px solid var(--line); padding: 28px 0; font-size: 13px; color: var(--text-dim); }
footer .wrap { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------- Article page ---------- */
.article { max-width: 700px; margin: 0 auto; padding: 80px 24px 100px; }
.article .back { font-size: 14px; color: var(--text-dim); text-decoration: none; }
.article header { margin: 28px 0 48px; }
.article h1 { font-family: var(--serif); font-weight: 500; font-size: clamp(34px, 5vw, 50px); line-height: 1.12; letter-spacing: -0.02em; margin: 14px 0 18px; }
.article .meta { font-family: var(--mono); font-size: 13px; color: var(--text-dim); }
.article h2 { font-family: var(--serif); font-weight: 500; font-size: 28px; margin: 52px 0 16px; }
.article p { margin-bottom: 20px; }
.article ul { margin: 0 0 20px 22px; }
.article li { margin-bottom: 8px; }
.article code { font-family: var(--mono); font-size: 0.88em; background: var(--bg-raised); border: 1px solid var(--line); padding: 1px 6px; border-radius: 5px; }
.article blockquote { border-left: 3px solid var(--accent); padding: 4px 0 4px 20px; color: var(--text-dim); font-style: italic; margin: 28px 0; }
.formula {
  font-family: var(--serif); font-style: italic; font-size: 20px; text-align: center;
  padding: 22px; margin: 28px 0; background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius);
}
.formula sub { font-size: 0.65em; }

/* demo embed: a click-to-load facade, so the page stays fast */
.demo {
  margin: 40px -40px; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg-raised);
}
.demo-stage {
  aspect-ratio: 16 / 9; display: grid; place-items: center; text-align: center; position: relative;
  background:
    radial-gradient(circle at 50% 40%, var(--accent-soft), transparent 65%),
    repeating-linear-gradient(90deg, transparent 0 19.6%, var(--line) 19.6% 20%),
    var(--bg);
}
.demo-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.demo-play {
  background: var(--accent); color: #1a1408; border: 0; border-radius: 999px;
  padding: 14px 26px; font-size: 16px; font-weight: 600; cursor: pointer; font-family: var(--sans);
}
.demo-play:hover { filter: brightness(1.08); }
.demo-stage small { display: block; margin-top: 12px; color: var(--text-dim); font-size: 13px; }
.demo-caption { display: flex; justify-content: space-between; gap: 16px; padding: 14px 20px; font-size: 13px; color: var(--text-dim); border-top: 1px solid var(--line); flex-wrap: wrap; }

/* ---------- Motion & responsive ---------- */
.reveal { opacity: 0; transform: translateY(16px); transition: opacity .7s ease, transform .7s ease; }
.reveal.in { opacity: 1; transform: none; }

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

@media (max-width: 900px) {
  .cards { grid-template-columns: repeat(2, 1fr); }
  .about-grid { grid-template-columns: 1fr; gap: 40px; }
  .demo { margin: 40px 0; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .wrap { padding: 0 16px; }
  .nav ul { gap: 16px; }
  .nav ul li.hide-sm { display: none; }
  .hero { padding: 72px 0 64px; }
  .hero p.lead { font-size: 18px; }
  section { padding: 64px 0; }
  .cards, .work-list { grid-template-columns: 1fr; }
  .posts a { grid-template-columns: 1fr; gap: 4px; }
  .posts .arrow { display: none; }
  .article { padding: 48px 16px 72px; }
}

/* article images */
.article figure { margin: 32px 0; }
.article figure img { border-radius: var(--radius); border: 1px solid var(--line); }
.article figcaption { font-size: 14px; color: var(--text-dim); margin-top: 10px; text-align: center; }

/* nav: keep logo on one line on small screens */
.logo { white-space: nowrap; }
@media (max-width: 640px) {
  .nav .wrap { gap: 12px; }
  .logo { font-size: 17px; }
  .nav ul { gap: 12px; }
  .nav ul a { font-size: 13.5px; }
  .theme-btn { width: 30px; height: 30px; font-size: 13px; }
}
@media (max-width: 360px) {
  .logo .dice { display: none; }
}

/* brand logo: Between Games */
.logo { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; }
.logo .logo-text { display: flex; flex-direction: column; line-height: 1.05; color: var(--text); }
.logo .logo-name { color: var(--text); }
.logo .logo-dot { color: var(--accent); }
.logo .logo-by { font-family: var(--sans); font-size: 11px; font-weight: 400; letter-spacing: 0.04em; color: var(--text-dim); margin-top: 3px; }
@media (max-width: 640px) {
  .logo { gap: 7px; }
  .logo .logo-by { font-size: 10px; }
}
@media (max-width: 480px) {
  /* phones follow the system light/dark setting; hide the toggle to make room */
  .nav ul li:has(.theme-btn) { display: none; }
}

/* ===================== community: nav auth ===================== */
.nav-auth { position: relative; display: flex; align-items: center; }
.nav-signin { color: var(--text) !important; border: 1px solid var(--line); border-radius: 999px; padding: 5px 12px; white-space: nowrap; }
.nav-signin:hover { border-color: var(--accent); }
.nav-user { background: none; border: 0; padding: 0; cursor: pointer; display: flex; border-radius: 50%; }
.nav-user:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.nav-menu { position: absolute; right: 0; top: 40px; min-width: 180px; background: var(--bg-raised); border: 1px solid var(--line);
  border-radius: 12px; padding: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.25); z-index: 20; display: flex; flex-direction: column; }
.nav-menu[hidden] { display: none; }
.nav-menu-name { font-size: 13px; color: var(--text-dim); padding: 6px 10px 8px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.nav-menu a, .nav-menu button { text-align: left; background: none; border: 0; color: var(--text); font: inherit; font-size: 14px; padding: 8px 10px; border-radius: 8px; cursor: pointer; text-decoration: none; }
.nav-menu a:hover, .nav-menu button:hover { background: var(--accent-soft); color: var(--text); }

/* ===================== community: shared ===================== */
.btn-sm { padding: 8px 16px; font-size: 14px; border: 0; cursor: pointer; font-family: var(--sans); }
.btn-ghost.btn-sm { background: none; color: var(--text); border: 1px solid var(--line); }
.btn[disabled] { opacity: .6; cursor: default; }
.cm-avatar { border-radius: 50%; object-fit: cover; flex: none; background: var(--line); }
.cm-avatar-letter { display: inline-grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--text); background: var(--accent-soft); border: 1px solid var(--line); }
.cm-badge { font-family: var(--mono); font-size: 11px; letter-spacing: .04em; text-transform: uppercase; border: 1px solid var(--accent); color: var(--accent); border-radius: 999px; padding: 1px 8px; }
.cm-badge.cm-pending { border-color: var(--line); color: var(--text-dim); }
.cm-note, .cm-empty { color: var(--text-dim); font-size: 15px; }
.cm-msg { color: var(--accent); font-size: 14px; min-height: 1em; }
.cm-toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--bg-raised); border: 1px solid var(--line); padding: 12px 18px; border-radius: 12px; z-index: 50; }

/* ===================== comments ===================== */
.cm { margin-top: 64px; padding-top: 36px; border-top: 1px solid var(--line); }
.cm-title { font-family: var(--serif); font-weight: 500; font-size: 26px; display: flex; align-items: center; gap: 10px; margin: 0 0 6px !important; }
.cm-count { font-family: var(--mono); font-size: 13px; color: var(--text-dim); border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; }
.cm-title-note { color: var(--jade); font-size: 14px; margin: 0 0 10px !important; min-height: 0; }
.cm-signin { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; color: var(--text-dim); font-size: 15px; }
.cm-form { display: flex; flex-direction: column; gap: 10px; margin: 8px 0 24px; }
.cm-input { width: 100%; font: inherit; font-size: 16px; color: var(--text); background: var(--bg-raised); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; resize: vertical; }
.cm-input:focus { outline: none; border-color: var(--accent); }
.cm-form-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.cm-form-btns { display: flex; gap: 8px; margin-left: auto; }
.cm-list { list-style: none; margin: 0 !important; padding: 0; }
.cm-item { padding: 16px 0 6px; border-top: 1px solid var(--line); margin: 0 !important; }
.cm-list .cm-list .cm-item { border-top: 0; padding-top: 12px; }
.cm-nested { margin-left: 18px !important; padding-left: 16px; border-left: 2px solid var(--line); }
.cm-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.cm-name { font-weight: 600; font-size: 15px; }
.cm-meta { font-family: var(--mono); font-size: 12px; color: var(--text-dim); }
.cm-body { white-space: pre-wrap; overflow-wrap: anywhere; margin: 8px 0 4px 38px; font-size: 16px; line-height: 1.6; }
.cm-actions { display: flex; gap: 14px; margin-left: 38px; }
.cm-reply-slot { margin-left: 38px; }
.cm-link { background: none; border: 0; padding: 4px 0; font: inherit; font-size: 13px; color: var(--text-dim); cursor: pointer; }
.cm-link:hover { color: var(--accent); }
.cm-danger:hover { color: #d8352a; }
.cm-deleted .cm-head { opacity: .7; }

/* ===================== Q&A ===================== */
.qa-toolbar { display: flex; justify-content: flex-end; margin-bottom: 20px; }
.qa-new { margin-bottom: 20px; }
.qa-list p { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.qa-body { margin-left: 0 !important; font-size: 17px; }
.article .cm-head + .cm-body { margin-top: 18px; }

/* ===================== admin ===================== */
.admin-page { max-width: var(--max); margin: 0 auto; padding: 56px 24px 100px; }
.admin-page h1 { font-family: var(--serif); font-weight: 500; font-size: 40px; margin-bottom: 24px; }
.ad-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 28px; overflow-x: auto; }
.ad-tabs button { background: none; border: 0; border-bottom: 2px solid transparent; color: var(--text-dim); font: inherit; font-size: 15px; padding: 10px 14px; cursor: pointer; white-space: nowrap; }
.ad-tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.ad-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 28px; }
.ad-tile { background: var(--bg-raised); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.ad-tile-v { font-family: var(--serif); font-size: 34px; line-height: 1.1; }
.ad-tile-k { color: var(--text-dim); font-size: 13px; margin-top: 6px; }
.ad-figure { margin: 0 0 32px; }
.ad-figure figcaption { color: var(--text-dim); font-size: 13px; margin-bottom: 8px; }
.ad-chart-wrap { position: relative; }
.ad-chart { width: 100%; height: 160px; display: block; border-bottom: 1px solid var(--line); }
.ad-tip[hidden] { display: none; }
.ad-xlabels { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; color: var(--text-dim); margin-top: 6px; }
.ad-max { float: right; font-family: var(--mono); font-size: 11px; }
.ad-details { margin-top: 12px; font-size: 14px; color: var(--text-dim); }
.ad-details summary { cursor: pointer; }
.ad-bar { fill: #b87708; }
.ad-axis { stroke: var(--line); stroke-width: 1; }
.ad-axis-label { fill: var(--text-dim); font-size: 11px; font-family: var(--mono); }
.ad-tip { position: absolute; top: 0; transform: translateX(-50%); background: var(--bg-raised); border: 1px solid var(--line); border-radius: 8px; padding: 4px 10px; font-size: 13px; white-space: nowrap; pointer-events: none; }
.ad-two { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.ad-two h3 { font-family: var(--serif); font-weight: 500; font-size: 20px; margin-bottom: 10px; }
.ad-table-wrap { overflow-x: auto; }
.ad-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.ad-table th { text-align: left; font-weight: 500; color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.ad-table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ad-table td .cm-link + .cm-link { margin-left: 12px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ad-bar { fill: #b8821f; } }
:root[data-theme="dark"] .ad-bar { fill: #b8821f; }
@media (max-width: 900px) { .ad-tiles { grid-template-columns: repeat(2, 1fr); } .ad-two { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .cm-body, .cm-actions, .cm-reply-slot { margin-left: 0; }
  .cm-nested { margin-left: 4px !important; padding-left: 12px; }
  .nav-signin { padding: 4px 10px; font-size: 13px !important; }
}

@media (max-width: 520px) {
  /* phones: Playground is still on the home page, so drop it from the nav to make room */
  .nav ul li:has(a[href$="#playground"]) { display: none; }
  .nav ul { gap: 10px; }
}
@media (max-width: 420px) {
  /* small phones: the logo already links to the Thoughts list, so drop that link to fit Sign in */
  .nav ul li:has(a[href$="#thoughts"]) { display: none; }
}

/* About: channel-style round avatar next to the heading */
.about-title { display: flex; align-items: center; gap: 24px; flex: 1; min-width: 0; }
.avatar { width: 128px; height: 128px; border-radius: 50%; object-fit: cover; flex: none;
  border: 1px solid var(--line); background: var(--bg-raised); }
@media (max-width: 640px) {
  .about-title { gap: 16px; }
  .avatar { width: 72px; height: 72px; }
}
.section-head:has(.about-title) { align-items: center; flex-wrap: nowrap; }
