/* Stream World: one stylesheet for the server-rendered pages. It styles plain semantic HTML
   (nav, forms, tables, dl, details, role="alert") so templates stay simple. System fonts only:
   nothing is loaded from other domains. */

:root {
  color-scheme: light dark;
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #eef1f7;
  --text: #141a2a;
  --muted: #5b6478;
  --border: #dde2ec;
  --accent: #5b3cf5;
  --accent-strong: #4628d6;
  --accent-soft: #ece8ff;
  --ok: #0f7a55;
  --ok-soft: #e3f6ee;
  --warn: #9a5b00;
  --warn-soft: #fff3dc;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(20 26 42 / 6%), 0 4px 16px rgb(20 26 42 / 6%);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1020;
    --surface: #151a2e;
    --surface-2: #1c2240;
    --text: #e8ebf5;
    --muted: #9aa3bb;
    --border: #2a3152;
    --accent: #8f7bff;
    --accent-strong: #a998ff;
    --accent-soft: #241d52;
    --ok: #4cd29a;
    --ok-soft: #10382a;
    --warn: #f1b75b;
    --warn-soft: #3a2a0c;
    --danger: #ff8a7f;
    --danger-soft: #3d1714;
    --shadow: 0 1px 2px rgb(0 0 0 / 30%), 0 4px 16px rgb(0 0 0 / 25%);
  }
}

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

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--font);
}

/* --- header and navigation ------------------------------------------------------------- */

header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}

header nav {
  max-width: 1080px;
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
}

header nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 15px;
}

header nav a:hover { color: var(--text); background: var(--surface-2); }

header nav a.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
  padding-left: 0;
  color: var(--text);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.01em;
}

header nav a.brand:hover { background: none; }
header nav a.brand img { width: 28px; height: 28px; }

header nav form { display: inline; margin: 0; }

/* --- layout ------------------------------------------------------------------------------ */

main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

main > section, main > form, main > table, main > dl, main > details {
  margin-bottom: 24px;
}

main > section, .grid > section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 24px;
}

main > section > :first-child, .grid > section > :first-child { margin-top: 0; }
main > section > :last-child, .grid > section > :last-child { margin-bottom: 0; }

h1, h2, h3 { line-height: 1.25; letter-spacing: -0.015em; }
h1 { font-size: clamp(28px, 4vw, 40px); margin: 0 0 16px; }
h2 { font-size: 22px; margin: 28px 0 12px; }
h3 { font-size: 18px; margin: 20px 0 8px; }

a { color: var(--accent); text-underline-offset: 2px; }
a:hover { color: var(--accent-strong); }

small, .muted { color: var(--muted); }

code {
  font-family: var(--mono);
  font-size: 0.92em;
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 6px;
}

blockquote {
  margin: 12px 0;
  padding: 10px 16px;
  border-left: 4px solid var(--accent);
  background: var(--accent-soft);
  border-radius: 0 8px 8px 0;
}

blockquote p { margin: 4px 0; }

/* Open points in draft texts (privacy policy). */
mark { background: var(--warn-soft); color: var(--warn); padding: 0 4px; border-radius: 4px; }

ul, ol { padding-left: 1.3em; }
li + li { margin-top: 4px; }

/* --- landing ------------------------------------------------------------------------------- */

main > section.hero {
  background:
    radial-gradient(1200px 400px at 100% 0%, color-mix(in srgb, var(--accent) 22%, transparent), transparent 60%),
    var(--surface);
  padding: 48px 32px;
}

.hero h1 { max-width: 760px; }
.hero p { max-width: 680px; font-size: 18px; color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 24px;
  margin-bottom: 24px;
}

.grid > section { margin: 0; }

/* --- buttons and forms --------------------------------------------------------------------- */

button, .button, input[type="submit"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  line-height: 1;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}

button:hover, .button:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: #fff; }

header nav button {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
  padding: 6px 10px;
  font-weight: 500;
}

header nav button:hover { color: var(--text); background: var(--surface-2); border-color: var(--border); }

label { font-weight: 500; }

input:not([type="checkbox"], [type="radio"], [type="hidden"]), select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  max-width: 100%;
}

input:not([type="checkbox"], [type="radio"]):focus, select:focus, textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent) 45%, transparent);
  outline-offset: 1px;
  border-color: var(--accent);
}

textarea { width: min(100%, 640px); min-height: 90px; }

/* Full-width fields in ordinary forms; fields with a size (search filters) keep it. */
input:not([type="checkbox"], [type="radio"], [type="hidden"], [size]) { width: min(100%, 420px); }

input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); }

fieldset {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin: 0 0 16px;
}

legend { font-weight: 600; padding: 0 6px; }

form p { margin: 10px 0; }

/* --- notices --------------------------------------------------------------------------------- */

[role="alert"], [role="status"] {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid;
}

[role="alert"] { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); color: var(--danger); }
[role="status"] { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 35%, transparent); color: var(--warn); }

/* --- tables, lists of facts, details ---------------------------------------------------------- */

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  font-size: 15px;
}

th, td { padding: 10px 12px; text-align: left; vertical-align: top; }
th { background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: 0.03em; }
tbody tr + tr td { border-top: 1px solid var(--border); }
tbody tr:hover td { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }

section[aria-live] { overflow-x: auto; }

dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 12px 0; }
dt { color: var(--muted); }
dd { margin: 0; }

@media (max-width: 640px) {
  dl { grid-template-columns: 1fr; }
  dd { margin-bottom: 8px; }
  main > section { padding: 16px; }
  main > section.hero { padding: 32px 20px; }
}

details {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 8px 14px;
  margin: 10px 0;
}

summary { cursor: pointer; font-weight: 600; }

/* --- community board ----------------------------------------------------------------------- */

.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--ok-soft);
  color: var(--ok);
  vertical-align: 1px;
}

section.board-card h2 { margin-top: 0; font-size: 20px; }
section.board-card h2 a { color: var(--text); text-decoration: none; }

/* --- audience risk ------------------------------------------------------------------------- */

section[aria-label="Audience risk"] {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 16px 12px;
  margin: 16px 0;
}

/* --- footer -------------------------------------------------------------------------------- */

footer {
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 14px;
}

footer div {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  justify-content: space-between;
}

footer a { color: var(--muted); }
