/* down here */

@font-face {
  font-family: "Fraunces";
  font-style: normal;
  font-weight: 300 600;
  font-display: swap;
  src: url("/assets/fonts/fraunces-latin.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 500;
  font-display: swap;
  src: url("/assets/fonts/jbmono-latin.woff2") format("woff2");
}

:root {
  color-scheme: dark;
  --bg: #0d0c0f;
  --bg-soft: #141318;
  --text: #e7e3da;
  --text-dim: #b4ad9f;
  --muted: #8a8478;
  --faint: #4c483f;
  --accent: #c8a45a;
  --border: #232128;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --measure: 38rem;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--serif);
  font-weight: 350;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 1.0625rem;
  line-height: 1.7;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

::selection { background: rgba(200, 164, 90, 0.22); }

/* ---- header / nav ---- */
.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem clamp(1rem, 4vw, 2.4rem);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 3;
}
.brand {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
  color: var(--text);
  cursor: pointer;
  background: none; border: none; padding: 0;
}
.nav {
  display: flex;
  gap: 1.25rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: lowercase;
}
.nav button {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--muted);
  font: inherit; letter-spacing: inherit;
}
.nav button:hover, .nav button.active { color: var(--text); }

/* ---- view scaffolding ---- */
main { flex: 1 0 auto; position: relative; }
.view { display: none; }
.view.active { display: block; }
@media (prefers-reduced-motion: no-preference) {
  .view.active { animation: fade 0.6s ease both; }
  @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
}

.wrap {
  width: 100%;
  max-width: 64rem;
  margin: 0 auto;
  padding: clamp(2rem, 6vh, 4rem) clamp(1rem, 4vw, 2.4rem) 4rem;
}
.measure { max-width: var(--measure); margin-left: auto; margin-right: auto; }

.kicker {
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: lowercase;
  color: var(--muted);
}

/* ---- home / set it down ---- */
#view-home { position: relative; overflow: clip; }

/* ambient field of other voices fills the viewport behind the form */
.ambient {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  columns: 16rem;
  column-gap: 2.2rem;
  padding: 2.5rem clamp(1rem, 4vw, 2.4rem);
  overflow: hidden;
  -webkit-mask-image: radial-gradient(ellipse 60% 70% at 50% 42%, transparent 0%, transparent 38%, #000 78%);
  mask-image: radial-gradient(ellipse 60% 70% at 50% 42%, transparent 0%, transparent 38%, #000 78%);
}
.ambient .frag {
  break-inside: avoid;
  margin: 0 0 1.6rem;
  color: var(--faint);
  font-size: 0.92rem;
  line-height: 1.6;
  opacity: 0.5;
}
.home-inner { position: relative; z-index: 1; }

.home-title {
  font-weight: 380;
  font-size: clamp(2.1rem, 6vw, 3rem);
  letter-spacing: 0.005em;
  margin: 0 0 0.4rem;
}
.home-invite {
  font-size: 1.2rem;
  color: var(--text-dim);
  margin: 0 0 2rem;
}

.compose { display: flex; flex-direction: column; gap: 1rem; }
textarea#body {
  width: 100%;
  min-height: 34vh;
  resize: vertical;
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.1rem 1.2rem;
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.7;
}
textarea#body::placeholder { color: var(--muted); opacity: 0.8; }
textarea#body:focus { outline: none; border-color: var(--faint); background: #16151b; }

.optional-row { display: flex; gap: 1rem; flex-wrap: wrap; }
.field { flex: 1 1 14rem; display: flex; flex-direction: column; gap: 0.35rem; }
.field label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: lowercase;
}
.field input {
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  font-family: var(--mono);
  font-size: 0.92rem;
}
.field input:focus { outline: none; border-color: var(--faint); }

.consent {
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.7;
  color: var(--muted);
  margin: 0.4rem 0 0;
}

.btn {
  align-self: flex-start;
  font-family: var(--mono);
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: lowercase;
  color: var(--text);
  background: #1b1a20;
  border: 1px solid #34323c;
  border-radius: 8px;
  padding: 0.7rem 1.4rem;
  cursor: pointer;
}
.btn:hover { background: #232128; border-color: var(--faint); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-quiet {
  background: none; border: none; color: var(--muted);
  letter-spacing: 0.1em; padding: 0.4rem 0;
}
.btn-quiet:hover { color: var(--text); }

#turnstile-holder { min-height: 0; }

/* ---- entries ---- */
.entry {
  break-inside: avoid;
  padding: 1.4rem 0;
  border-top: 1px solid var(--border);
}
.entry:first-child { border-top: none; }
.entry-body {
  font-family: var(--serif);
  font-size: 1.08rem;
  line-height: 1.72;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.entry-meta {
  margin-top: 0.7rem;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}
.entry-meta .report {
  margin-left: auto;
  background: none; border: none; cursor: pointer;
  color: var(--faint); font: inherit; letter-spacing: inherit;
}
.entry-meta .report:hover { color: var(--muted); }

/* a column flow that fills the width with voices, not whitespace */
.voices { columns: 22rem; column-gap: 2.6rem; }
.voices .entry { margin-bottom: 0; }

/* the after-submit thread: a single readable column with the song pinned on top */
.thread { max-width: 38rem; margin: 0 auto; }

.song {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--bg);
  padding: 0.7rem 0 0.9rem;
  border-bottom: 1px solid var(--border);
}
.song-invite {
  text-align: center;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.55rem;
}
.song-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.7rem 0.9rem;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.song-info { display: flex; flex-direction: column; gap: 0.15rem; flex: 1; min-width: 0; }
.song-title { font-family: var(--serif); font-size: 1.05rem; color: var(--text); }
.song-meta {
  font-family: var(--mono);
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  color: var(--muted);
}
.song-play {
  flex: 0 0 auto;
  width: 2.5rem; height: 2.5rem;
  border-radius: 50%;
  background: #1b1a20;
  border: 1px solid #34323c;
  color: var(--accent);
  font-size: 0.85rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  padding-left: 2px;
}
.song-play:hover { background: #232128; border-color: var(--faint); }
.song-frame-video {
  position: relative;
  width: 100%;
  padding-top: 56.25%;
  border-radius: 10px;
  overflow: hidden;
}
.song-frame-video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.song-frame-audio iframe { width: 100%; height: 152px; border: 0; border-radius: 12px; display: block; }

/* ---- witness ---- */
.witness { text-align: center; padding: clamp(1rem, 5vh, 3rem) 0 2rem; }
.witness-quote { margin: 0 auto 2.6rem; max-width: 34rem; }
.witness-quote p {
  font-family: var(--serif);
  font-weight: 350;
  font-size: clamp(1.4rem, 4vw, 1.9rem);
  line-height: 1.45;
  margin: 0;
  color: var(--text);
}
.witness-quote .attr {
  display: block;
  margin-top: 0.9rem;
  font-family: var(--mono);
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.witness-quote .attr::before { content: "- "; }

.section-heading {
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: lowercase;
  color: var(--muted);
  margin: 2.5rem 0 1.4rem;
  text-align: center;
}
.closing {
  max-width: 34rem; margin: 3rem auto 0; text-align: center;
  color: var(--text-dim); font-size: 1.05rem;
}

/* ---- blocked / held message ---- */
.message { max-width: 36rem; margin: 0 auto; }
.message p { margin: 0 0 1.25rem; color: var(--text-dim); }
.message p.lead { color: var(--text); font-size: 1.15rem; }

/* ---- crisis ---- */
.crisis {
  border-top: 1px solid var(--border);
  margin-top: 2.5rem;
  padding-top: 2rem;
  max-width: 36rem;
  margin-left: auto; margin-right: auto;
}
.crisis h3 {
  font-family: var(--mono); font-weight: 500;
  font-size: 0.8rem; letter-spacing: 0.16em; text-transform: lowercase;
  color: var(--accent); margin: 0 0 0.8rem;
}
.crisis .intro { color: var(--text-dim); margin: 0 0 1.1rem; }
.crisis-chooser { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.crisis-chooser label { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.08em; color: var(--muted); }
.crisis-chooser select {
  background: var(--bg-soft); color: var(--text);
  border: 1px solid var(--border); border-radius: 7px;
  padding: 0.45rem 0.7rem; font-family: var(--mono); font-size: 0.85rem;
}
.crisis-line { margin: 0.4rem 0; }
.crisis-line .label { color: var(--text); }
.crisis-line .contact { font-family: var(--mono); font-size: 0.92rem; color: var(--accent); margin-left: 0.5rem; }
.crisis-global { margin-top: 1rem; font-size: 0.95rem; color: var(--text-dim); }

/* ---- world map ---- */
.map-block { margin: 2.5rem auto 0; max-width: 52rem; }
.map-intro { text-align: center; color: var(--text-dim); max-width: 34rem; margin: 0 auto 1.4rem; }
.worldmap { width: 100%; height: auto; display: block; }
.worldmap-land { fill: #1a1922; stroke: #26242e; stroke-width: 0.2; }
.worldmap-flag { fill: var(--accent); opacity: 0.55; }
.worldmap-flag-mine { fill: #f3e4be; opacity: 1; }
@media (prefers-reduced-motion: no-preference) {
  .worldmap-flag-mine { animation: pulse 2.4s ease-in-out infinite; }
  @keyframes pulse { 0%,100% { opacity: 0.6; } 50% { opacity: 1; } }
}
.map-actions { text-align: center; margin-top: 1.2rem; }
.map-note { text-align: center; color: var(--muted); font-family: var(--mono); font-size: 0.78rem; margin-top: 0.8rem; }

/* ---- modal ---- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(5, 5, 7, 0.78);
  display: none; align-items: center; justify-content: center;
  padding: 1.2rem;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-width: 34rem; padding: 1.8rem;
}
.modal h3 { margin: 0 0 1rem; font-weight: 400; font-size: 1.25rem; }
.modal p { color: var(--text-dim); margin: 0 0 1.5rem; }
.modal-actions { display: flex; gap: 0.8rem; justify-content: flex-end; }

/* ---- random ---- */
#view-random .wrap {
  min-height: calc(100vh - 9rem);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.one-voice { max-width: 40rem; margin: 0 auto; text-align: center; }
.one-voice .entry { border: none; }
.one-voice .entry-body { font-size: 1.35rem; line-height: 1.6; }
.one-voice .entry-meta { justify-content: center; }

/* ---- footer ---- */
.site-footer {
  flex-shrink: 0;
  border-top: 1px solid var(--border);
  padding: 1.6rem clamp(1rem, 4vw, 2.4rem);
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--muted);
  display: flex; gap: 1.2rem; flex-wrap: wrap; align-items: center;
}
.site-footer button {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font: inherit; letter-spacing: inherit; padding: 0;
}
.site-footer button:hover { color: var(--text); }
.site-footer .door { color: var(--accent); }

.notice {
  font-family: var(--mono); font-size: 0.8rem; color: var(--text-dim);
  background: var(--bg-soft); border: 1px solid var(--border);
  border-radius: 8px; padding: 0.8rem 1rem; margin-top: 1rem;
}

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

@media (max-width: 640px) {
  .ambient { display: none; }
  body { font-size: 1rem; }
}
