/*
 * Themes: "Origin" (light) and "Deep Space" (dark).
 * - No data-theme attribute  = follow the system via prefers-color-scheme (pure CSS).
 * - data-theme="light|dark"  = explicit visitor choice (set by js/theme-init.js).
 */
:root {
  color-scheme: light dark;

  /* Origin (light) */
  --bg: #ebebeb;
  --text: #111f29;
  --muted: #465563;
  --surface: #f7f8f9;
  --border: #cbd2d8;
  --link: #0b5c8a;
  --focus: #0b5c8a;
  --ok: #1b6b3a;
  --warn: #8a5a00;
  --accent: #35b6ec;
  --accent-hover: #5cc6f1;
  --on-accent: #111f29;

  /* Signup area: dark navy surface in both themes */
  --signup-bg: #111f29;
  --signup-text: #ebebeb;
  --signup-muted: #a8b8c7;
  --signup-border: #2a3d4f;
  --signup-link: #7fd0f5;

  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* Deep Space (dark), applied automatically when the system is dark... */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #09121b;
    --text: #ebebeb;
    --muted: #a8b8c7;
    --surface: #0e1b27;
    --border: #2a3d4f;
    --link: #7fd0f5;
    --focus: #7fd0f5;
    --ok: #86efac;
    --warn: #fbbf24;
    --signup-bg: #122333;
  }
}

/* ...or when explicitly chosen. */
:root[data-theme="dark"] {
  --bg: #09121b;
  --text: #ebebeb;
  --muted: #a8b8c7;
  --surface: #0e1b27;
  --border: #2a3d4f;
  --link: #7fd0f5;
  --focus: #7fd0f5;
  --ok: #86efac;
  --warn: #fbbf24;
  --signup-bg: #122333;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
}

.container { width: min(100% - 2rem, 62rem); margin-inline: auto; }

a { color: var(--link); overflow-wrap: anywhere; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.skip-link {
  position: absolute; left: 0.5rem; top: -4rem;
  background: var(--accent); color: var(--on-accent); padding: 0.5rem 1rem; z-index: 10;
}
.skip-link:focus { top: 0.5rem; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.site-header {
  display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem;
  align-items: center; justify-content: space-between; padding-block: 1.25rem 0;
}
.site-name { margin: 0; font-family: var(--serif); font-size: 1.15rem; font-weight: 700; }
.header-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.25rem; }
.badge { margin: 0; font-size: 0.85rem; color: var(--muted); }
.badge::before { content: "● "; color: var(--accent); font-size: 0.7em; vertical-align: 0.1em; }

/* Theme selector: compact segmented control (shown only when JS is available) */
.theme-picker { border: 0; margin: 0; padding: 0; min-width: 0; }
.theme-options {
  display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden;
  background: var(--surface);
}
.theme-options label {
  position: relative; padding: 0.3rem 0.75rem; font-size: 0.85rem; cursor: pointer;
  color: var(--muted); min-height: 32px; display: inline-flex; align-items: center;
}
.theme-options label + label { border-left: 1px solid var(--border); }
.theme-options input {
  position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer;
}
.theme-options label:has(input:checked) { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.theme-options label:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: -3px; }

main { padding-block: 2rem 3rem; }

h1, h2 { font-family: var(--serif); font-weight: 700; color: inherit; }
h1 { font-size: clamp(2rem, 7vw, 3rem); line-height: 1.1; margin: 0 0 1rem; }
h2 { font-size: 1.35rem; margin: 0 0 0.75rem; }
p { margin: 0 0 0.9rem; }

.hero { display: grid; gap: 1.5rem; margin-bottom: 2rem; }
@media (min-width: 52rem) {
  .hero { grid-template-columns: 1.6fr 1fr; align-items: start; gap: 2rem; }
}

/* Signup area keeps its own dark palette in both themes */
.signup {
  --text: var(--signup-text);
  --muted: var(--signup-muted);
  --border: var(--signup-border);
  --link: var(--signup-link);
  --focus: var(--signup-link);
  --ok: #86efac;
  --warn: #fbbf24;
  background: var(--signup-bg); color: var(--signup-text);
  border: 1px solid var(--signup-border); border-radius: 8px; padding: clamp(1.25rem, 4vw, 2rem);
}

.lead { font-size: 1.15rem; }

.ticket {
  margin: 1.5rem 0 1.25rem; padding: 0.9rem 1.1rem;
  border: 2px dashed var(--border); border-left: 4px solid var(--accent); border-radius: 4px;
}
.label { color: var(--muted); font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; margin: 0 0 0.2rem; }
.code {
  margin: 0; font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: clamp(1.3rem, 6vw, 2rem); letter-spacing: 0.05em;
  overflow-wrap: anywhere; user-select: all;
}

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1.25rem; }
.btn {
  display: inline-block; font: inherit; font-weight: 600; text-align: center;
  padding: 0.75rem 1.25rem; border-radius: 6px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none; min-height: 44px;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-quiet { background: none; color: var(--link); text-decoration: underline; text-underline-offset: 3px; padding-inline: 0.25rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; pointer-events: none; }

.status { min-height: 1.5em; margin: 0.5rem 0; color: var(--ok); }
.status.error { color: var(--warn); }
.notice { color: var(--warn); }
.disclosure { margin-top: 1rem; font-style: italic; font-family: var(--serif); }
.small { color: var(--muted); font-size: 0.9rem; }

/* Promotion and lower sections share the section surface */
.promo, .row {
  background: var(--surface); border: 1px solid var(--border); border-radius: 8px;
  padding: clamp(1.1rem, 3vw, 1.5rem);
}
.promo-label { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--link); margin-bottom: 0.25rem; }
.promo img { max-width: 100%; height: auto; border: 1px solid var(--border); border-radius: 4px; margin-bottom: 0.75rem; }
.promo dl { margin: 0 0 0.9rem; }
.promo dt { font-weight: 600; margin-top: 0.75rem; }
.promo dd { margin: 0.1rem 0 0; }

.row { display: grid; gap: 0.5rem 3rem; margin-bottom: 1.5rem; }
@media (min-width: 52rem) {
  .row { grid-template-columns: 1fr 2.2fr; }
}

.steps { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding-left: 2.5rem; margin-bottom: 1rem; }
.steps li::before {
  content: counter(step); position: absolute; left: 0; top: -0.15rem;
  font-family: var(--serif); font-size: 1.6rem; color: var(--link); line-height: 1.2;
}

details { padding: 0.4rem 0; border-top: 1px solid var(--border); }
details:first-child { border-top: 0; }
summary { cursor: pointer; font-weight: 600; }
details p { margin: 0.4rem 0; }

.site-footer {
  border-top: 1px solid var(--border); padding-block: 1.5rem 2.5rem; color: var(--muted); font-size: 0.9rem;
  display: grid; grid-template-columns: auto 1fr auto; gap: 1rem 1.5rem; align-items: center;
}
.footer-text { text-align: center; }
.site-footer p { margin: 0 0 0.4rem; }
.footer-logo img { display: block; height: 56px; width: auto; }
.footer-logo-right { justify-self: end; }
.logo-on-dark { display: none !important; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-on-light { display: none !important; }
  :root:not([data-theme="light"]) .logo-on-dark { display: block !important; }
}
:root[data-theme="dark"] .logo-on-light { display: none !important; }
:root[data-theme="dark"] .logo-on-dark { display: block !important; }
@media (max-width: 40rem) {
  .site-footer { grid-template-columns: 1fr 1fr; }
  .footer-text { grid-column: 1 / -1; grid-row: 1; }
}

[hidden] { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
