/* bestsis5ever: shared styles */

:root {
  --bg: #f4f2ee;
  --surface: #ffffff;
  --surface-2: #faf8f4;
  --text: #1c1b19;
  --text-muted: #6b675f;
  --border: #e3ded4;
  --accent: #8a5a2b;
  --accent-contrast: #ffffff;
  --ink: #1c1b19;
  --ink-contrast: #ffffff;
  --focus: #2b6cb0;
  --ok-bg: #e8f3ea;
  --ok-text: #1e5b2b;
  --err-bg: #fbeaea;
  --err-text: #8a1f1f;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 4px 16px rgba(0, 0, 0, 0.05);
  --radius: 10px;
  --serif: Georgia, "Iowan Old Style", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141311;
    --surface: #1d1c19;
    --surface-2: #23211e;
    --text: #ece8e1;
    --text-muted: #a29d93;
    --border: #34312c;
    --accent: #d9a46c;
    --accent-contrast: #141311;
    --ink: #ece8e1;
    --ink-contrast: #141311;
    --focus: #7fb3f0;
    --ok-bg: #1d3323;
    --ok-text: #a6dcb1;
    --err-bg: #3a1f1f;
    --err-text: #f2b4b4;
    --shadow: none;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #141311;
  --surface: #1d1c19;
  --surface-2: #23211e;
  --text: #ece8e1;
  --text-muted: #a29d93;
  --border: #34312c;
  --accent: #d9a46c;
  --accent-contrast: #141311;
  --ink: #ece8e1;
  --ink-contrast: #141311;
  --focus: #7fb3f0;
  --ok-bg: #1d3323;
  --ok-text: #a6dcb1;
  --err-bg: #3a1f1f;
  --err-text: #f2b4b4;
  --shadow: none;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
}

a { color: var(--accent); }
a:hover { text-decoration-thickness: 2px; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }

.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 100;
  background: var(--ink); color: var(--ink-contrast);
  padding: 8px 14px; border-radius: 6px;
}
.skip-link:focus { top: 8px; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.wrap-narrow { max-width: 680px; margin: 0 auto; padding: 0 16px; }

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

/* Header ---------------------------------------------------------------- */

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.site-header .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; min-height: 60px;
}
.logo {
  font-family: var(--serif); font-weight: 700; font-size: 1.35rem;
  color: var(--text); text-decoration: none; letter-spacing: -0.01em;
  white-space: nowrap;
}
.logo span { color: var(--accent); }
.nav { display: flex; align-items: center; gap: 4px; }
.nav a {
  color: var(--text); text-decoration: none; font-size: 0.95rem;
  padding: 8px 10px; border-radius: 6px;
}
.nav a:hover, .nav a[aria-current="page"] { background: var(--surface-2); }

.theme-toggle {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  width: 40px; height: 40px; border-radius: 8px; cursor: pointer;
  display: inline-grid; place-items: center; font-size: 1.1rem;
}
.theme-toggle:hover { background: var(--surface-2); }
.theme-toggle svg { width: 20px; height: 20px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

@media (max-width: 520px) {
  .nav a.hide-sm { display: none; }
}

/* Footer ---------------------------------------------------------------- */

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 64px; padding: 28px 0 40px;
  color: var(--text-muted); font-size: 0.9rem;
}
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 8px 20px; justify-content: space-between; }
.site-footer a { color: var(--text-muted); }

/* Buttons and forms ------------------------------------------------------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--ink); color: var(--ink-contrast);
  border: 1px solid var(--ink); border-radius: 8px;
  font: inherit; font-weight: 600; font-size: 1rem;
  padding: 12px 20px; cursor: pointer; text-decoration: none;
  min-height: 46px;
}
.btn:hover { opacity: 0.9; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-2); opacity: 1; }
.btn-danger { background: transparent; color: var(--err-text); border-color: var(--err-text); }
.btn-small { padding: 8px 14px; min-height: 38px; font-size: 0.92rem; }

label { font-weight: 600; }

input[type="email"], input[type="date"] {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 11px 12px; min-height: 46px; width: 100%;
}
input[type="date"] { width: auto; }
input:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }

.field { margin-bottom: 18px; }
.field > label { display: block; margin-bottom: 6px; }

fieldset { border: 0; padding: 0; margin: 0 0 18px; min-width: 0; }
legend { font-weight: 600; margin-bottom: 8px; padding: 0; }

.region-checks {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px;
}
@media (max-width: 420px) { .region-checks { grid-template-columns: 1fr; } }

.check {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; background: var(--surface); cursor: pointer;
  font-weight: 500; min-height: 46px;
}
.check:hover { background: var(--surface-2); }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; flex: none; }
.check:has(input:checked) { border-color: var(--accent); background: var(--surface-2); }

.select-all { font-size: 0.9rem; margin-top: 8px; }
.linklike {
  background: none; border: 0; padding: 0; color: var(--accent);
  font: inherit; text-decoration: underline; cursor: pointer;
}

.notice {
  border-radius: 8px; padding: 12px 14px; margin: 14px 0 0;
  font-size: 0.95rem;
}
.notice:empty { display: none; }
.notice.ok { background: var(--ok-bg); color: var(--ok-text); }
.notice.err { background: var(--err-bg); color: var(--err-text); }

.fine { font-size: 0.85rem; color: var(--text-muted); }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 24px;
}
@media (max-width: 480px) { .card { padding: 18px; } }

/* Landing ---------------------------------------------------------------- */

.hero {
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 40px; align-items: start; padding: 56px 0 24px;
}
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; gap: 28px; padding-top: 36px; } }

.eyebrow {
  font-size: 0.8rem; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); font-weight: 700; margin: 0 0 10px;
}
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; letter-spacing: -0.01em; }
.hero h1 { font-size: clamp(2.1rem, 5vw, 3.2rem); margin: 0 0 18px; }
.lede { font-size: 1.15rem; color: var(--text-muted); margin: 0 0 22px; max-width: 34em; }

.points { list-style: none; padding: 0; margin: 0 0 8px; }
.points li { padding-left: 28px; position: relative; margin-bottom: 8px; }
.points li::before {
  content: ""; position: absolute; left: 4px; top: 0.55em;
  width: 10px; height: 10px; border-radius: 50%; background: var(--accent);
}

.signup-card h2 { margin: 0 0 6px; font-size: 1.5rem; }
.signup-card > p { margin: 0 0 18px; color: var(--text-muted); }
.turnstile-slot { min-height: 70px; margin-bottom: 14px; }

.section { padding: 40px 0 8px; }
.section h2 { font-size: 1.7rem; margin: 0 0 18px; }

.steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; padding: 0; margin: 0; list-style: none; counter-reset: step; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; } }
.steps li { counter-increment: step; }
.steps li::before {
  content: counter(step);
  display: inline-grid; place-items: center; width: 32px; height: 32px;
  border-radius: 50%; background: var(--ink); color: var(--ink-contrast);
  font-weight: 700; margin-bottom: 10px;
}
.steps h3 { margin: 0 0 6px; font-size: 1.15rem; }
.steps p { margin: 0; color: var(--text-muted); }

.region-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px; padding: 0; margin: 0; list-style: none;
}
.region-grid a {
  display: block; padding: 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); text-decoration: none; font-weight: 600;
}
.region-grid a:hover { border-color: var(--accent); }
.region-grid a span { display: block; font-weight: 400; font-size: 0.85rem; color: var(--text-muted); }

/* News page -------------------------------------------------------------- */

.news-head { padding: 28px 0 0; }
.news-head h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); margin: 0 0 4px; }
.news-head p { margin: 0; color: var(--text-muted); }

.tabs-bar {
  position: sticky; top: 60px; z-index: 10;
  background: var(--bg); padding: 14px 0 10px; margin-top: 16px;
  border-bottom: 1px solid var(--border);
}
.tabs {
  display: flex; gap: 6px; overflow-x: auto; scrollbar-width: thin;
  padding-bottom: 4px; -webkit-overflow-scrolling: touch;
}
.tab {
  flex: none; font: inherit; font-size: 0.95rem; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 999px; padding: 8px 16px; cursor: pointer; min-height: 40px;
}
.tab:hover { border-color: var(--accent); }
.tab[aria-selected="true"] { background: var(--ink); color: var(--ink-contrast); border-color: var(--ink); }

.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px;
}
.toolbar label { font-weight: 600; font-size: 0.92rem; }
.toolbar input[type="date"] { min-height: 38px; padding: 6px 10px; }

.day { padding-top: 28px; scroll-margin-top: 190px; }
.day-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  border-bottom: 2px solid var(--ink); padding-bottom: 6px; margin-bottom: 4px;
}
.day-head h2 { margin: 0; font-size: 1.35rem; }
.day-head .badge {
  font-size: 0.75rem; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--accent); font-weight: 700;
}

.stories { list-style: none; padding: 0; margin: 0; }
.story {
  display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px;
  padding: 18px 0; border-bottom: 1px solid var(--border);
}
.story .num {
  font-family: var(--serif); font-size: 1.5rem; font-weight: 700;
  color: var(--accent); line-height: 1.2;
}
.story h3 { margin: 0 0 4px; font-size: 1.2rem; }
.story h3 a { color: var(--text); text-decoration: none; }
.story h3 a:hover { text-decoration: underline; }
.story .meta { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 6px; }
.story .meta strong { color: var(--accent); font-weight: 600; }
.story p { margin: 0 0 6px; font-family: var(--serif); font-size: 1.02rem; color: var(--text); }
.story .read { font-size: 0.9rem; }

.feed-status { text-align: center; color: var(--text-muted); padding: 28px 0; }
.spinner {
  display: inline-block; width: 18px; height: 18px; vertical-align: -3px; margin-right: 8px;
  border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

.empty {
  text-align: center; padding: 40px 16px; color: var(--text-muted);
  border: 1px dashed var(--border); border-radius: var(--radius); margin-top: 24px;
}

.cta-strip {
  margin-top: 36px; padding: 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
}
.cta-strip p { margin: 0; }

/* Simple pages ----------------------------------------------------------- */

.page { padding: 40px 0 0; }
.page h1 { font-size: clamp(1.8rem, 4vw, 2.4rem); margin: 0 0 12px; }
.page h2 { font-size: 1.3rem; margin: 28px 0 8px; }
.page p, .page li { color: var(--text); }
.page .actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.page hr { border: 0; border-top: 1px solid var(--border); margin: 32px 0; }
.btn-block { width: 100%; }

/* Local preview server only (npm run preview) */
.test-banner {
  background: #fff3c4; color: #5c4400; text-align: center;
  font-size: 0.9rem; padding: 8px 16px; border-bottom: 1px solid #e8d48a;
}
.test-banner a { color: #5c4400; font-weight: 600; }
