/* Rolleze public page: brown ink on old paper, like the app's hand-drawn maps.
   The colours are the app's pen-and-parchment set (shared/glyphs.ts); dark mode
   is the same sheet by lamplight. */
:root {
  --desk: #cbb68b;
  --paper: #efe2c2;
  --paper-edge: #c9b083;
  --ink: #3b2a1a;
  --ink-soft: #6b5235;
  --wash: #8aa3a0;
  --accent: #8c2b1c;
  --shadow: rgba(40, 25, 10, 0.35);
  --serif: "Palatino Linotype", "Book Antiqua", Palatino, "Iowan Old Style", Georgia, serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --desk: #14100b;
    --paper: #2a2117;
    --paper-edge: #120d08;
    --ink: #eadcb8;
    --ink-soft: #bba67e;
    --wash: #6f8f8a;
    --accent: #e0805f;
    --shadow: rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --desk: #14100b;
  --paper: #2a2117;
  --paper-edge: #120d08;
  --ink: #eadcb8;
  --ink-soft: #bba67e;
  --wash: #6f8f8a;
  --accent: #e0805f;
  --shadow: rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.6;
  padding: 2.5rem 16px 3rem;
}
.defs { position: absolute; }

/* ---------- the sheet ---------- */
.sheet {
  position: relative;
  max-width: 46rem;
  margin: 0 auto;
  padding: 2rem clamp(1.25rem, 6vw, 4rem) 2.5rem;
  isolation: isolate;
}
/* paper with a torn edge, an aged rim and a little grain */
.paper {
  position: absolute; inset: 0; width: 100%; height: 100%;
  z-index: -2; overflow: visible;
  filter: drop-shadow(0 10px 18px var(--shadow));
}
.paper rect { fill: var(--paper); }
.sheet::before {
  content: ""; position: absolute; inset: 6px; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 45%, transparent 55%, color-mix(in srgb, var(--paper-edge) 70%, transparent) 100%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 0.35 0 0 0 0 0.25 0 0 0 0 0.12 0 0 0 0.2 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23g)'/%3E%3C/svg%3E");
  border-radius: 4px;
}

/* ---------- drawings ---------- */
.ln { fill: none; stroke: var(--ink); stroke-linecap: round; stroke-linejoin: round; }
.so { fill: var(--paper); stroke: var(--ink); stroke-linecap: round; stroke-linejoin: round; }
.inked { fill: var(--ink); stroke: var(--ink); }
.acc { fill: var(--accent); stroke: var(--ink); }
.wash { fill: color-mix(in srgb, var(--wash) 35%, var(--paper)); stroke: var(--ink); }
.letter { fill: var(--ink); font-family: var(--serif); }
.road { stroke-dasharray: 3 3.5; opacity: 0.8; }
.map { display: block; width: 100%; height: auto; }
.glyph { display: block; width: 5.5rem; height: auto; margin: 0 auto 0.5rem; }
/* prep is drawn in pencil: lighter, with a dashed edge */
.glyph.pencil .ln, .glyph.pencil .so, .glyph.pencil .acc { stroke-opacity: 0.45; stroke-dasharray: 2.5 2; fill-opacity: 0.4; }
.rule { margin: 2rem auto; max-width: 70%; color: var(--ink); }
.rule-svg { display: block; width: 100%; height: 12px; opacity: 0.7; }

/* ---------- type ---------- */
header { text-align: center; }
h1 {
  margin: 0.25rem 0 0.5rem;
  font-size: clamp(2.6rem, 9vw, 4rem);
  font-weight: normal;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding-left: 0.22em; /* balance the trailing letter space */
  line-height: 1.1;
}
.lede { font-size: 1.25rem; font-style: italic; max-width: 32rem; margin: 0 auto 1rem; }
.alpha { margin: 0; }
h2 {
  font-size: 1.45rem; font-weight: normal; font-style: italic;
  margin: 2.25rem 0 0.5rem;
}
h3 { font-size: 1.1rem; margin: 0 0 0.25rem; }
p { margin: 0 0 0.85rem; }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px dashed var(--accent); outline-offset: 3px; }
strong { font-weight: bold; }

/* the same tower pencilled, inked, then on a card */
.stages {
  display: flex; justify-content: center; align-items: flex-end; gap: clamp(1.5rem, 8vw, 4rem);
  margin: 0.75rem 0 1rem;
}
.stages .glyph { margin: 0; }
@media (max-width: 30rem) {
  .glyph { width: 4rem; }
}

/* ---------- the form ---------- */
.join h2 { text-align: center; }
form { max-width: 30rem; margin: 0 auto; }
.field { margin: 0 0 1.1rem; padding: 0; border: 0; min-width: 0; }
label, legend { display: block; font-style: italic; color: var(--ink-soft); padding: 0; }
.opt { font-size: 0.9em; }
input[type="text"], input[type="email"], textarea {
  width: 100%;
  font: inherit; color: var(--ink);
  background: transparent;
  border: 0; border-bottom: 1.5px solid var(--ink);
  border-radius: 0;
  padding: 0.3rem 0.1rem;
}
textarea {
  border: 1.5px solid var(--ink); border-radius: 3px;
  padding: 0.4rem 0.5rem; resize: vertical; min-height: 5.5rem;
  background: color-mix(in srgb, var(--paper) 70%, transparent);
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 1.5px 0 var(--accent); }
textarea:focus { box-shadow: 0 0 0 1px var(--accent); }
[aria-invalid="true"] { border-color: var(--accent); }
.choices { display: flex; flex-wrap: wrap; gap: 0.25rem 1.75rem; margin-top: 0.25rem; }
.choices label { font-style: normal; color: var(--ink); display: inline-flex; align-items: center; gap: 0.5rem; cursor: pointer; padding: 0.2rem 0; }
input[type="radio"] {
  appearance: none; margin: 0;
  width: 1.05rem; height: 1.05rem; border-radius: 50%;
  border: 1.5px solid var(--ink); background: transparent;
  display: inline-grid; place-content: center; cursor: pointer;
}
input[type="radio"]::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: var(--ink); transform: scale(0); transition: transform 0.1s; }
input[type="radio"]:checked::before { transform: scale(1); }
input[type="radio"]:focus-visible { outline: 2px dashed var(--accent); outline-offset: 2px; }
.err { color: var(--accent); font-size: 0.95rem; margin: 0.25rem 0 0; min-height: 0; }
.err:empty, .count:empty, .status:empty { display: none; }
.count { font-size: 0.9rem; color: var(--ink-soft); margin: 0.25rem 0 0; text-align: right; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

button {
  font: inherit; font-size: 1.1rem; letter-spacing: 0.04em;
  color: var(--paper); background: var(--ink);
  border: 1.5px solid var(--ink); border-radius: 3px;
  padding: 0.55rem 1.6rem; margin: 0.25rem 0 0.9rem;
  cursor: pointer;
  box-shadow: 2px 2px 0 color-mix(in srgb, var(--ink) 35%, transparent);
}
button:hover { background: var(--accent); border-color: var(--accent); }
button:disabled { opacity: 0.6; cursor: wait; }
.small { font-size: 0.95rem; color: var(--ink-soft); }
.status { font-size: 1rem; }
.thanks { text-align: center; font-size: 1.3rem; font-style: italic; padding: 1rem 0; outline: none; }

footer { margin-top: 2.5rem; text-align: center; font-size: 0.85rem; color: var(--ink-soft); font-style: italic; }
footer p { margin: 0; }

@media (max-width: 30rem) {
  body { padding: 1rem 16px 2rem; font-size: 1.0625rem; }
  .sheet { padding: 1.25rem 1.1rem 2rem; }
  h2 { margin-top: 1.75rem; }
  .rule { margin: 1.5rem auto; }
  /* on a phone, show the middle of the country larger rather than all of it tiny */
  header .drawing { overflow: hidden; }
  .map { width: 150%; margin-left: -25%; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
