/* Shared styles for the dark chapter pages: about / who / story / rules */
@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=EB+Garamond:ital,wght@0,400;0,500;1,400&display=swap');

:root {
  color-scheme: dark;
  /* inverted (dark) palette — semantic tokens mirrored from the light site */
  --background: #000;
  --foreground: #f2f2f2;
  --muted-foreground: #999999;
  --border: rgba(255, 255, 255, 0.12);
  --brand-accent: #C4521A;

  --identity: 'DM Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --body: 'EB Garamond', Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--background);
  color: var(--foreground);
}
body {
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body.menu-open { overflow: hidden; }
a { color: inherit; }

/* ---- nav ---- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 60;
  height: 3.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  background: color-mix(in srgb, var(--background) 70%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
@media (min-width: 640px) { .nav { padding: 0 2rem; } }

.wordmark {
  font-family: var(--identity);
  font-size: 0.875rem;
  letter-spacing: 0.3em;
  text-decoration: none;
  color: var(--foreground);
  transition: color 0.3s ease;
}
.wordmark:hover { color: var(--brand-accent); }

.menu {
  position: relative;
  width: 2.75rem; height: 2.75rem;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 0; cursor: pointer;
  z-index: 61;
}
.menu span {
  position: absolute;
  width: 1.25rem; height: 1.5px;
  background: var(--foreground);
  transition: transform 0.3s ease, background 0.3s ease;
}
.menu span:first-child { transform: translateY(-3px); }
.menu span:last-child  { transform: translateY(3px); }
body.menu-open .menu span:first-child { transform: rotate(45deg); }
body.menu-open .menu span:last-child  { transform: rotate(-45deg); }

/* ---- full-screen menu overlay ---- */
.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 55;
  background: var(--background);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1.5rem;
  padding: 0 clamp(1.5rem, 6vw, 5rem);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0.4s ease;
}
body.menu-open .menu-overlay { opacity: 1; visibility: visible; }

.menu-overlay a {
  font-family: var(--identity);
  font-weight: 400;
  font-size: clamp(1.5rem, 5vw, 2.5rem);
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--foreground);
  opacity: 0;
  transform: translateY(10px);
  transition: color 0.2s ease, transform 0.5s ease, opacity 0.5s ease;
}
.menu-overlay a:hover { color: var(--brand-accent); }
body.menu-open .menu-overlay a { opacity: 1; transform: none; }
body.menu-open .menu-overlay a:nth-child(1) { transition-delay: 0.10s; }
body.menu-open .menu-overlay a:nth-child(2) { transition-delay: 0.16s; }
body.menu-open .menu-overlay a:nth-child(3) { transition-delay: 0.22s; }
body.menu-open .menu-overlay a:nth-child(4) { transition-delay: 0.28s; }
body.menu-open .menu-overlay a:nth-child(5) { transition-delay: 0.36s; }

/* ---- body ---- */
main { padding-top: 3.5rem; }

.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  max-width: 1200px;
  margin: 0 auto;
  padding: 4rem 1.25rem;
}
@media (min-width: 768px) {
  .about-grid {
    grid-template-columns: 1fr 2fr;
    gap: 4rem;
    padding: 6rem 2.5rem;
  }
}

.section-label {
  margin: 0;
  font-family: var(--identity);
  font-weight: 400;
  font-size: 0.875rem;
  letter-spacing: 0.08em;
  line-height: 1.3;
  text-transform: uppercase;
  color: var(--brand-accent);
}
@media (min-width: 768px) {
  .section-label { position: sticky; top: 6rem; }
}

.prose { max-width: 560px; }
.prose p {
  font-family: var(--body);
  font-weight: 400;
  font-size: 1.0625rem;
  line-height: 1.75;
  margin: 0 0 1.5rem;
  max-width: 60ch;
}
.prose p.lead  { color: var(--foreground); }
.prose p.muted { color: var(--muted-foreground); }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  border-radius: 9999px;
  padding: 0.75rem 1rem;
  margin-top: 2.5rem;
  font-family: var(--identity);
  font-weight: 500;
  font-size: 0.875rem;
  text-decoration: none;
  color: var(--foreground);
  background: transparent;
  border: 1px solid color-mix(in srgb, var(--foreground) 60%, transparent);
  transition: all 0.15s ease;
}
.btn:hover, .btn:active {
  background: var(--brand-accent);
  border-color: var(--brand-accent);
  color: #fff;
}

/* ---- next chapter ---- */
.next {
  max-width: 1200px;
  margin: 0 auto;
  padding: 4rem 1.25rem;
  border-top: 1px solid var(--border);
  text-align: right;
}
@media (min-width: 768px) { .next { padding: 6rem 2.5rem; } }
.next a {
  display: inline-flex;
  align-items: baseline;
  gap: 1rem;
  font-family: var(--identity);
  font-weight: 400;
  font-size: clamp(1.25rem, 2.5vw, 1.75rem);
  text-decoration: none;
  color: var(--foreground);
}
.next .arrow { font-size: 0.75em; transition: transform 0.3s ease; }
.next a:hover .arrow { transform: translateX(4px); }

/* ---- pagination dots ---- */
.dots {
  display: flex;
  justify-content: center;
  gap: 0.625rem;
  padding: 2rem 0;
}
.dots a {
  width: 0.625rem; height: 0.625rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.15);
  transition: background 0.3s ease;
}
.dots a:hover { background: rgba(255, 255, 255, 0.4); }
.dots a.active { background: var(--brand-accent); }

/* ---- footer ---- */
footer {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}
@media (min-width: 768px) { footer { padding: 4rem 2.5rem; } }
footer .grp {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2rem;
}
footer .grp a {
  font-family: var(--identity);
  font-weight: 400;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-decoration: none;
  color: var(--muted-foreground);
  transition: color 0.2s ease;
}
footer .grp a:hover { color: var(--foreground); }

footer a.powered {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.14);
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease;
}
footer a.powered:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.22);
}
footer .powered .pb-label {
  font-family: var(--identity);
  font-size: 0.625rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}
footer .powered .pb-name {
  font-family: var(--identity);
  font-weight: 500;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--foreground);
}

/* ---- legal / long-form pages (privacy, terms) ---- */
.legal {
  max-width: 48rem;
  margin: 0 auto;
  padding: 3rem 1.25rem 5rem;
}
@media (min-width: 640px) { .legal { padding: 4rem 1.5rem 6rem; } }

.legal h1 {
  font-family: var(--identity);
  font-weight: 500;
  font-size: clamp(1.5rem, 3vw, 2rem);
  letter-spacing: 0.02em;
  margin: 0 0 0.5rem;
}
.legal .effective {
  font-family: var(--identity);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
  margin: 0 0 2.5rem;
}
.legal h2 {
  font-family: var(--identity);
  font-weight: 400;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--brand-accent);
  margin: 2.75rem 0 1rem;
}
.legal h3 {
  font-family: var(--identity);
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--foreground);
  margin: 1.75rem 0 0.75rem;
}
.legal p, .legal li {
  font-family: var(--body);
  font-weight: 400;
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--muted-foreground);
}
.legal p { margin: 0 0 1rem; }
.legal ul { margin: 0 0 1.25rem; padding-left: 1.25rem; }
.legal li { margin: 0 0 0.5rem; }
.legal strong { color: var(--foreground); font-weight: 500; }
.legal a {
  color: var(--foreground);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: color 0.2s ease;
}
.legal a:hover { color: var(--brand-accent); }

.legal .table-wrap { overflow-x: auto; margin: 0 0 1.5rem; }
.legal table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--identity);
  font-size: 0.8rem;
  min-width: 480px;
}
.legal th {
  text-align: left;
  font-weight: 500;
  color: var(--foreground);
  border-bottom: 1px solid var(--border);
  padding: 0.65rem 0.75rem;
  white-space: nowrap;
}
.legal td {
  color: var(--muted-foreground);
  border-bottom: 1px solid var(--border);
  padding: 0.65rem 0.75rem;
  vertical-align: top;
  line-height: 1.55;
}
.legal td:first-child { color: var(--foreground); white-space: nowrap; }

/* ---- contact (uses the .legal container, left-aligned) ---- */
.contact-title {
  font-family: var(--identity);
  font-weight: 400;
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--foreground);
  margin: 0 0 0.5rem;
}
.contact-sub {
  font-family: var(--identity);
  font-size: 0.8rem;
  letter-spacing: 0.02em;
  color: var(--muted-foreground);
  margin: 0 0 2.5rem;
}
.legal .contact-section { margin: 0 0 2rem; }
.legal .contact-section h2 { margin-top: 0; }

/* ---- apply / early access ---- */
.apply-wrap {
  min-height: calc(100dvh - 3.5rem);
  display: grid;
  place-items: center;
  padding: 4rem 1.25rem 5rem;
}
.apply-card { width: min(440px, 100%); }
.apply-intro { text-align: center; }
.apply-card .eyebrow {
  font-family: var(--identity);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  color: var(--brand-accent);
  margin: 0 0 1rem;
}
.apply-card h1 {
  font-family: var(--identity);
  font-weight: 500;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  letter-spacing: 0.01em;
  margin: 0 0 1rem;
}
.apply-lead {
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.7;
  color: var(--muted-foreground);
  margin: 0 0 1.5rem;
}
.apply-meta {
  font-family: var(--identity);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
  margin: 0 0 2rem;
}

/* auth screen (Google + email apply/sign-in) */
.auth-head { text-align: center; margin-bottom: 1.75rem; }
.auth-brand {
  font-family: var(--identity);
  font-weight: 500;
  font-size: 1.5rem;
  letter-spacing: 0.18em;
  color: var(--foreground);
  margin: 0;
}
.auth-sub {
  font-family: var(--body);
  font-size: 1.0625rem;
  color: var(--muted-foreground);
  margin: 0.5rem 0 0;
}
.btn-google {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.8rem;
  border-radius: 9999px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: var(--foreground);
  font-family: var(--identity);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-google:hover { background: rgba(255, 255, 255, 0.09); border-color: rgba(255, 255, 255, 0.28); }
.btn-google svg { width: 1.05rem; height: 1.05rem; }
.divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.25rem 0;
  color: var(--muted-foreground);
  font-family: var(--identity);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.auth-actions { display: flex; gap: 0.75rem; margin-top: 1.25rem; }
.auth-actions button {
  flex: 1;
  padding: 0.8rem;
  border-radius: 9999px;
  font-family: var(--identity);
  font-weight: 500;
  font-size: 0.85rem;
  cursor: pointer;
  transition: filter 0.15s ease, background 0.15s ease;
}
.auth-actions button:disabled { opacity: 0.5; cursor: default; }
.btn-apply { background: var(--brand-accent); color: #fff; border: none; }
.btn-apply:hover:not(:disabled) { filter: brightness(1.08); }
.btn-signin { background: transparent; color: var(--foreground); border: 1px solid rgba(255, 255, 255, 0.6); }
.btn-signin:hover:not(:disabled) { background: rgba(255, 255, 255, 0.06); }
.auth-msg { font-family: var(--body); font-size: 0.9rem; margin-top: 0.9rem; text-align: center; min-height: 1.2em; }
.auth-msg.error { color: #ff6b57; }
.auth-msg.ok { color: var(--foreground); }

.apply-form { text-align: left; margin-top: 0.5rem; }
.field { margin: 0 0 1.1rem; }
.field label {
  display: block;
  font-family: var(--identity);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
  margin: 0 0 0.5rem;
}
.field input,
.field select {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
  color: var(--foreground);
  font-family: var(--body);
  font-size: 1rem;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s ease;
}
.field select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23999' stroke-width='1.5' d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  padding-right: 2.25rem;
  cursor: pointer;
}
.field select option { background: #111; color: var(--foreground); }
.field input::placeholder { color: rgba(255, 255, 255, 0.35); }
.field input:focus,
.field select:focus { outline: none; border-color: var(--brand-accent); }

.btn-submit {
  width: 100%;
  margin-top: 0.75rem;
  padding: 0.85rem;
  border: none;
  border-radius: 9999px;
  background: var(--brand-accent);
  color: #fff;
  font-family: var(--identity);
  font-weight: 500;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: filter 0.15s ease;
}
.btn-submit:hover { filter: brightness(1.08); }

.apply-success {
  text-align: center;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.25rem 1.5rem;
}
.apply-success .check { font-size: 1.5rem; color: var(--brand-accent); }
.apply-success h2 {
  font-family: var(--identity);
  font-weight: 500;
  font-size: 1.1rem;
  margin: 0.75rem 0 0.35rem;
}
.apply-success p {
  font-family: var(--body);
  font-size: 1rem;
  color: var(--muted-foreground);
  margin: 0;
}
.is-hidden { display: none !important; }

/* ---- gentle load fade ---- */
.fade { opacity: 0; animation: fadeUp 0.8s ease forwards; }
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .fade { animation: none; opacity: 1; transform: none; }
  .menu-overlay a { transition: color 0.2s ease; transform: none; }
}
