/* -------------------------------------------------------------------------
   When the lights came back on…
   Palette is a sodium street lamp seen at night: cold blue-black surrounds,
   one warm amber light, and paper-white text only where reading happens.
   ------------------------------------------------------------------------- */

:root {
  --night:    #0F1219;
  --dusk:     #161A24;
  --edge:     #262C3B;
  --sodium:   #F5B23D;
  --filament: #FFEDCB;
  --cold:     #8290A8;
  --cold-dim: #5C687E;
  --warn:     #E8836A;

  --serif: "Country Flags", "Literata", Georgia, "Times New Roman", serif;
  --sans:  "Country Flags", "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono:  "Country Flags", ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --measure: 33rem;
  --dock: 0px;
}

/*
 * Flags on Windows.
 *
 * Chrome and Edge on Windows ship no flag glyphs at all, so 🇳🇿 renders as the
 * letters NZ while every phone in the world shows a flag. This is Twemoji's
 * country flags, subsetted to just those glyphs and served from here — no third
 * party, one 78kb file, cached after the first visit. Listed ahead of the body
 * fonts so it only ever supplies flags and nothing else.
 */
@font-face {
  font-family: 'Country Flags';
  src: url('/TwemojiCountryFlags.woff2') format('woff2');
  font-display: swap;
  unicode-range: U+1F1E6-1F1FF;          /* regional indicator letters only */
}

* { box-sizing: border-box; }

/*
 * The browser's own [hidden] rule is display:none, but any author rule setting
 * a display beats it — so .field { display: flex } quietly kept hidden things
 * on screen. This puts the attribute back in charge everywhere.
 */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  min-height: 100dvh;
  background: var(--night);
  /* the lamp: a single warm source above the reading column */
  background-image: radial-gradient(120% 55% at 50% -12%, rgba(245,178,61,.16), transparent 62%);
  background-attachment: fixed;
  color: var(--filament);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  padding-bottom: calc(var(--dock) + 2rem);
}

a { color: inherit; }

.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;
}

.skip {
  position: absolute; left: -999px; top: 0; z-index: 20;
  background: var(--sodium); color: #14171F; padding: .6rem 1rem;
  font-weight: 600; text-decoration: none;
}
.skip:focus { left: 0; }

:where(a, button, select, input):focus-visible {
  outline: 2px solid var(--sodium);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------------------------------------------------------------- masthead */

.masthead {
  border-bottom: 1px solid var(--edge);
  background: rgba(15,18,25,.72);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 10;
}

.masthead-inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: .75rem 1.25rem;
  display: flex;
  flex-wrap: wrap;
  gap: .5rem 1rem;
  align-items: baseline;
  justify-content: space-between;
}

.eyebrow {
  margin: 0;
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .04em;
  color: var(--cold);
  text-transform: uppercase;
}

.masthead-tools {
  display: flex;
  align-items: baseline;
  gap: 1rem;
}

.link {
  font-size: .82rem;
  color: var(--cold);
  text-decoration: none;
  border-bottom: 1px solid var(--edge);
  padding-bottom: 1px;
  white-space: nowrap;
}
.link:hover { color: var(--filament); border-bottom-color: var(--sodium); }

/* ------------------------------------------------------------------- story */

main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 3.5rem 1.25rem 2rem;
}

.story {
  font-family: var(--serif);
  font-size: clamp(1.125rem, 1rem + .6vw, 1.3rem);
  line-height: 1.72;
}

.story-opening {
  margin: 0 0 .35em;
  font-size: 1.32em;
  font-weight: 600;
  letter-spacing: -.012em;
  text-wrap: balance;
  color: #FFF7E8;
}

.story-body {
  margin: 0;
  color: var(--filament);
  hanging-punctuation: first;
}

.loading { color: var(--cold-dim); font-style: italic; }

.turn {
  border-radius: 2px;
  transition: background-color .18s ease;
}
.turn:hover { background: rgba(245,178,61,.11); }

/* your own turns keep a faint lamp under them, so you can find your line */
.turn.mine {
  box-shadow: inset 0 -.35em 0 rgba(245,178,61,.2);
}

.turn.fresh {
  animation: warm-up 2.2s ease-out;
}

@keyframes warm-up {
  0%   { background: rgba(245,178,61,.55); }
  100% { background: rgba(245,178,61,0); }
}

.flag {
  font-family: 'Country Flags', var(--sans);
  font-size: .62em;
  vertical-align: .55em;
  margin: 0 .1em 0 .12em;
  opacity: .75;
  letter-spacing: .02em;
}
.flag.code {
  font-family: var(--mono);
  font-size: .5em;
  color: var(--cold);
  vertical-align: .7em;
}

.tally {
  margin: 2.5rem 0 0;
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--cold-dim);
}

/* ----------------------------------------------------------------- compose */

.compose {
  position: sticky;
  bottom: 0;
  z-index: 12;
  border-top: 1px solid var(--edge);
  background: rgba(22,26,36,.92);
  backdrop-filter: blur(14px);
  padding-bottom: env(safe-area-inset-bottom);
}

.compose-inner {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1rem 1.25rem 1.1rem;
}

/* the signature: thirty filaments, one per character, lighting left to right */
.filament {
  display: grid;
  grid-template-columns: repeat(30, 1fr);
  gap: 2px;
  height: 3px;
  margin-bottom: .85rem;
}

.filament i {
  background: var(--edge);
  border-radius: 1px;
  transition: background-color .12s ease, box-shadow .12s ease;
}

.filament i.lit {
  background: var(--sodium);
  box-shadow: 0 0 6px rgba(245,178,61,.6);
}

.filament i.last {
  background: #FFF2D8;
  box-shadow: 0 0 9px rgba(255,242,216,.8);
}

.entry-row {
  display: flex;
  align-items: center;
  gap: .75rem;
}

#entry {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--edge);
  color: var(--filament);
  font-family: var(--serif);
  font-size: 1.15rem;
  line-height: 1.6;
  padding: .35rem 0 .45rem;
}
#entry::placeholder { color: var(--cold-dim); font-style: italic; }
#entry:focus { border-bottom-color: var(--sodium); outline: none; }

.count {
  font-family: var(--mono);
  font-size: .95rem;
  color: var(--cold);
  min-width: 2.2ch;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.count.full { color: var(--sodium); }

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  align-items: flex-end;
  margin-top: .9rem;
}

.field { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.field-inline { flex-direction: row; align-items: baseline; gap: .45rem; }

.field-label {
  font-family: var(--mono);
  font-size: .62rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--cold-dim);
}

.field select {
  appearance: none;
  background: transparent;
  border: 1px solid var(--edge);
  border-radius: 3px;
  color: var(--filament);
  font-family: var(--sans);
  font-size: .84rem;
  padding: .38rem 1.6rem .38rem .55rem;
  max-width: 11rem;
  text-overflow: ellipsis;
  background-image: linear-gradient(45deg, transparent 50%, var(--cold) 50%),
                    linear-gradient(135deg, var(--cold) 50%, transparent 50%);
  background-position: right .75rem center, right .5rem center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.field select:hover { border-color: var(--cold-dim); }
.field select option { background: var(--dusk); color: var(--filament); }

.send {
  margin-left: auto;
  background: var(--sodium);
  color: #15181F;
  border: 0;
  border-radius: 3px;
  font-family: var(--sans);
  font-size: .88rem;
  font-weight: 600;
  padding: .55rem 1.05rem;
  cursor: pointer;
  transition: background-color .15s ease, opacity .15s ease;
}
.send:hover:not(:disabled) { background: #FFC55C; }
.send:disabled { opacity: .3; cursor: not-allowed; }

.note {
  margin: .7rem 0 0;
  min-height: 1.2em;
  font-size: .82rem;
  color: var(--cold);
}
.note.bad { color: var(--warn); }
.note.good { color: var(--sodium); }


/* the way back into the story, sitting above the visible tail */
.earlier { margin: 0 0 1.4rem; }

.ghost {
  background: transparent;
  border: 1px solid var(--edge);
  border-radius: 3px;
  color: var(--cold);
  font-family: var(--mono);
  font-size: .66rem;
  letter-spacing: .11em;
  text-transform: uppercase;
  padding: .5rem .85rem;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.ghost:hover:not(:disabled) { color: var(--filament); border-color: var(--sodium); }
.ghost:disabled { opacity: .45; cursor: wait; }

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

.footer {
  max-width: var(--measure);
  margin: 3rem auto 0;
  padding: 0 1.25rem 3rem;
  font-size: .8rem;
  line-height: 1.65;
  color: var(--cold-dim);
}
.footer p { margin: 0 0 .5rem; }

/* -------------------------------------------------------------- prose page */

.page {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 3rem 1.25rem 5rem;
}
.page h1 {
  font-family: var(--serif);
  font-size: clamp(1.6rem, 1.3rem + 1.4vw, 2.1rem);
  font-weight: 600;
  letter-spacing: -.02em;
  margin: 0 0 1.75rem;
}
.page h2 {
  font-family: var(--mono);
  font-size: .68rem;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--sodium);
  margin: 2.5rem 0 .6rem;
}
.page p, .page li {
  font-family: var(--serif);
  font-size: 1.03rem;
  line-height: 1.7;
  color: #EFE4D0;
}
.page p { margin: 0 0 1rem; }
.page ul { margin: 0 0 1rem; padding-left: 1.1rem; }
.page li { margin-bottom: .4rem; }

@media (max-width: 30rem) {
  main { padding-top: 2.25rem; }
  .controls { gap: .5rem; }
  .field select { max-width: 8.5rem; font-size: .8rem; }
  .send { width: 100%; margin-left: 0; margin-top: .3rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

/* ------------------------------------------------------------------- clock */
/* the six-month countdown, sitting under the masthead like a station clock */

.clock {
  border-bottom: 1px solid var(--edge);
  text-align: center;
  padding: .7rem 1.25rem;
}

.clock-label {
  font-family: var(--mono);
  font-size: .6rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--cold-dim);
  display: block;
  margin-bottom: .22rem;
}

.clock-time {
  font-family: var(--mono);
  font-size: .95rem;
  letter-spacing: .05em;
  color: var(--sodium);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------- long line */

.turn.long {
  box-shadow: inset 0 -.32em 0 rgba(124, 138, 168, .22);
}

.offer {
  margin: .9rem 0 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem .75rem;
}

.ghost-quiet { border-color: transparent; padding-left: 0; padding-right: .5rem; }
.ghost-quiet:hover:not(:disabled) { border-color: var(--edge); padding-left: .85rem; }

.offer-terms {
  font-size: .74rem;
  color: var(--cold-dim);
  line-height: 1.45;
}

.compose.is-long #entry { font-size: 1.02rem; }
.compose.is-long .count { color: var(--sodium); }

/* -------------------------------------------------------------- prose lede */

.page-lede {
  font-family: var(--sans) !important;
  font-size: .88rem !important;
  line-height: 1.65 !important;
  color: var(--cold) !important;
  max-width: 30rem;
  margin-bottom: 2.25rem !important;
}

/* ---------------------------------------------------------------- calendar */

.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
}

.cal-month {
  font-family: var(--serif) !important;
  font-size: 1.05rem !important;
  font-weight: 600;
  letter-spacing: 0 !important;
  text-transform: none !important;
  color: var(--filament) !important;
  margin: 0 !important;
}

.cal {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-dow {
  font-family: var(--mono);
  font-size: .58rem;
  letter-spacing: .1em;
  color: var(--cold-dim);
  text-align: center;
  padding-bottom: .35rem;
}

.cal-day {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 1px solid var(--edge);
  border-radius: 3px;
  background: transparent;
  color: var(--cold-dim);
  font-family: var(--mono);
  font-size: .74rem;
  padding: 0;
}

/* a day the world wrote on carries light, brighter the busier it was */
.cal-day.has-story {
  --heat: 0;
  cursor: pointer;
  color: #17181D;
  border-color: transparent;
  background: rgba(245, 178, 61, calc(.28 + var(--heat) * .72));
  transition: transform .12s ease;
}
.cal-day.has-story:hover { transform: scale(1.08); }

.day-panel {
  margin-top: 2rem;
  border-top: 1px solid var(--edge);
  padding-top: 1.35rem;
}

.day-meta {
  font-family: var(--mono) !important;
  font-size: .64rem !important;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--cold-dim) !important;
  margin-bottom: .7rem !important;
}

.day-summary {
  font-family: var(--serif) !important;
  font-size: 1.06rem !important;
  line-height: 1.68 !important;
  color: var(--filament) !important;
}

/* ------------------------------------------------------------------- shelf */

.shelf { list-style: none; padding: 0; margin: 0; }

.shelf-item {
  display: grid;
  grid-template-columns: 3.5rem 1fr;
  gap: 1.1rem;
  align-items: start;
  border-bottom: 1px solid var(--edge);
  padding: 1.35rem 0;
  margin: 0;
}

.shelf-num {
  font-family: var(--serif);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--cold-dim);
  line-height: 1.15;
}
.shelf-item.is-open .shelf-num { color: var(--sodium); }

.shelf-opening {
  font-family: var(--serif) !important;
  font-size: 1.05rem !important;
  margin-bottom: .3rem !important;
  color: var(--filament) !important;
}

.shelf-meta {
  font-family: var(--mono) !important;
  font-size: .64rem !important;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--cold-dim) !important;
  margin-bottom: .55rem !important;
}

@media (max-width: 30rem) {
  .cal-day { font-size: .68rem; }
  .shelf-item { grid-template-columns: 2.5rem 1fr; gap: .8rem; }
  .clock-time { font-size: .85rem; }
}

/* --------------------------------------------------------- had your go */

.done { padding: .35rem 0 .1rem; }

.done-line {
  font-family: var(--serif);
  font-size: 1.1rem;
  color: var(--filament);
  margin: 0 0 .4rem;
}

.done-meta {
  font-size: .82rem;
  line-height: 1.55;
  color: var(--cold);
  margin: 0 0 .9rem;
  max-width: 30rem;
}

.done-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin: 0; }

/* ---------------------------------------------------------------- the ad */
/*
   Corner of the screen on desktop, out of the reading column and clear of the
   compose dock. On narrow screens there is no corner to spare — the compose box
   owns the bottom — so it drops below the footer instead of covering anything.
*/

.ad {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 5;                 /* under the compose dock, never over it */
  padding: .5rem;
  border: 1px solid var(--edge);
  border-radius: 4px;
  background: rgba(22, 26, 36, .8);
  backdrop-filter: blur(6px);
  opacity: .55;
  transition: opacity .25s ease;
}
.ad:hover { opacity: 1; }

.ad-slot { display: block; line-height: 0; }

.ad-close {
  position: absolute;
  top: -9px;
  right: -9px;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border: 1px solid var(--edge);
  border-radius: 50%;
  background: var(--dusk);
  color: var(--cold);
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.ad-close:hover { color: var(--filament); border-color: var(--sodium); }

/* Below the compose dock's reach, and above 62rem there is room beside the
   reading column without crowding it. */
@media (max-width: 62rem) {
  .ad {
    position: static;
    display: block;
    margin: 0 auto 3rem;
    width: max-content;
    max-width: 100%;
    opacity: 1;
  }
  .ad-close { top: -7px; right: -7px; }
}

/* ------------------------------------------------- making the box obvious */

.compose-title {
  margin: 0 0 .7rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .55rem;
}

.compose-step {
  font-family: var(--sans);
  font-size: .92rem;
  font-weight: 600;
  color: var(--filament);
}

.compose-hint {
  font-family: var(--mono);
  font-size: .62rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--cold-dim);
}

/* a real field rather than a hairline, so it reads as somewhere to type */
.entry-row {
  border: 1px solid var(--edge);
  border-radius: 4px;
  background: rgba(15, 18, 25, .55);
  padding: .15rem .75rem;
  transition: border-color .15s ease, background-color .15s ease;
}
.entry-row:focus-within {
  border-color: var(--sodium);
  background: rgba(15, 18, 25, .85);
}

#entry { border-bottom: 0; }
#entry:focus { border-bottom: 0; }

/* the country field carries a mark, because the flag is permanent */
.field-required select { border-color: var(--cold-dim); }
.field-required select:invalid,
.field-required select[data-empty="true"] {
  border-color: var(--warn);
  color: var(--warn);
}

.req {
  font-size: .9em;
  color: var(--warn);
  letter-spacing: .08em;
}

.country-why {
  margin: .65rem 0 0;
  font-size: .74rem;
  line-height: 1.5;
  color: var(--cold-dim);
  max-width: 26rem;
}

.translating {
  font-family: var(--mono);
  font-size: .62rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--sodium);
}

/* ---------------------------------------------------------------- feedback */

.feedback {
  border: 1px solid var(--edge);
  border-radius: 4px;
  padding: 1.1rem;
  margin: 1.25rem 0 2rem;
  background: rgba(22, 26, 36, .5);
}

.fb-row { display: flex; flex-wrap: wrap; gap: .85rem; margin-bottom: .85rem; }
.fb-field { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.fb-grow { flex: 1; min-width: 12rem; }

.fb-label {
  font-family: var(--mono);
  font-size: .6rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--cold-dim);
}

.fb-optional { color: var(--cold-dim); opacity: .7; }

.feedback select,
.feedback input,
.feedback textarea {
  background: rgba(15, 18, 25, .6);
  border: 1px solid var(--edge);
  border-radius: 3px;
  color: var(--filament);
  font-family: var(--sans);
  font-size: .88rem;
  padding: .45rem .6rem;
  width: 100%;
}
.feedback textarea {
  resize: vertical;
  line-height: 1.55;
  font-family: var(--serif);
  font-size: .95rem;
}
.feedback select:focus,
.feedback input:focus,
.feedback textarea:focus {
  border-color: var(--sodium);
  outline: none;
}
.feedback ::placeholder { color: var(--cold-dim); font-style: italic; }

/* visible to a bot reading the markup, invisible to a person */
.fb-trap { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.fb-actions {
  display: flex;
  align-items: center;
  gap: .85rem;
  margin-top: .9rem;
  flex-wrap: wrap;
}

.fb-note { font-size: .8rem; color: var(--cold); }
.fb-note.bad { color: var(--warn); }

.fb-done {
  font-family: var(--serif) !important;
  color: var(--sodium) !important;
  margin: 0 !important;
}

/* ------------------------------------------------------- joining and stops */

.joiner {
  appearance: none;
  flex: 0 0 auto;
  max-width: 7.5rem;
  background: transparent;
  border: 0;
  border-right: 1px solid var(--edge);
  color: var(--sodium);
  font-family: var(--serif);
  font-size: .95rem;
  padding: .3rem 1.2rem .3rem .1rem;
  cursor: pointer;
  text-overflow: ellipsis;
  background-image: linear-gradient(45deg, transparent 50%, var(--cold-dim) 50%),
                    linear-gradient(135deg, var(--cold-dim) 50%, transparent 50%);
  background-position: right .5rem center, right .28rem center;
  background-size: 4px 4px, 4px 4px;
  background-repeat: no-repeat;
}
#suffix {
  border-right: 0;
  border-left: 1px solid var(--edge);
  padding-left: .5rem;
  max-width: 4.5rem;
}
.joiner option { background: var(--dusk); color: var(--filament); }
.joiner:hover { color: #FFC55C; }

.joiner-note {
  margin: .55rem 0 0;
  font-family: var(--mono);
  font-size: .6rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--cold-dim);
}

/* how the turn will actually read once it's in the story */
.preview {
  margin: .7rem 0 0;
  font-family: var(--serif);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--filament);
  border-left: 2px solid var(--sodium);
  padding: .15rem 0 .15rem .7rem;
}
.preview .preview-free { color: var(--sodium); }

@media (max-width: 30rem) {
  .joiner { max-width: 5.5rem; font-size: .88rem; }
  #suffix { max-width: 3.6rem; }
}

/* --------------------------------------------------------- humans only */

.human {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  margin: .9rem 0 0;
  padding: .6rem .7rem;
  border: 1px solid var(--edge);
  border-radius: 4px;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.human:hover { border-color: var(--cold-dim); }
.human.is-human {
  border-color: rgba(245, 178, 61, .45);
  background: rgba(245, 178, 61, .06);
}

.human input {
  appearance: none;
  flex: 0 0 auto;
  width: 1.05rem;
  height: 1.05rem;
  margin-top: .1rem;
  border: 1px solid var(--cold-dim);
  border-radius: 3px;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.human input:checked {
  border-color: var(--sodium);
  background: var(--sodium);
}
.human input:checked::after {
  content: '';
  width: .3rem;
  height: .58rem;
  border: solid #15181F;
  border-width: 0 2px 2px 0;
  transform: translateY(-1px) rotate(45deg);
}

.human-text { display: flex; flex-direction: column; gap: .18rem; }

.human-line {
  font-family: var(--sans);
  font-size: .86rem;
  font-weight: 500;
  color: var(--filament);
}

.human-why {
  font-size: .74rem;
  line-height: 1.45;
  color: var(--cold-dim);
  max-width: 27rem;
}
.human-why.working { color: var(--sodium); }

/* ===========================================================================
   Lights on — the light theme.
   Night is the default because the story starts in the dark. This is the
   morning after: warm paper, printer's ink, and the sodium lamp turned down to
   a colour that still reads against it.
   =========================================================================== */

[data-theme="light"] {
  --night:    #F2EFE7;   /* warm paper, a touch green so it isn't cream */
  --dusk:     #E9E5DA;   /* raised surfaces */
  --edge:     #D5CFC1;
  --sodium:   #A2650A;   /* the lamp at noon — dark enough to read as text */
  --filament: #22242C;   /* printer's ink */
  --cold:     #5F6675;
  --cold-dim: #85899A;
  --warn:     #B03A1C;
}

[data-theme="light"] body {
  background-image: radial-gradient(120% 55% at 50% -12%, rgba(245, 178, 61, .22), transparent 62%);
}

[data-theme="light"] .masthead { background: rgba(242, 239, 231, .82); }
[data-theme="light"] .compose  { background: rgba(233, 229, 218, .94); }
[data-theme="light"] .entry-row { background: rgba(255, 255, 255, .6); }
[data-theme="light"] .entry-row:focus-within { background: #fff; }

[data-theme="light"] .story-opening { color: #14161C; }
[data-theme="light"] .page p,
[data-theme="light"] .page li { color: #2A2C34; }

[data-theme="light"] .turn:hover { background: rgba(245, 178, 61, .22); }
[data-theme="light"] .turn.mine  { box-shadow: inset 0 -.35em 0 rgba(245, 178, 61, .38); }
[data-theme="light"] .turn.long  { box-shadow: inset 0 -.32em 0 rgba(95, 102, 117, .18); }

[data-theme="light"] .filament i { background: #D5CFC1; }
[data-theme="light"] .filament i.lit  { background: #D9922A; box-shadow: none; }
[data-theme="light"] .filament i.last { background: #A2650A; box-shadow: none; }

[data-theme="light"] .send { background: #D9922A; color: #1A1206; }
[data-theme="light"] .send:hover:not(:disabled) { background: #C88420; }

[data-theme="light"] .joiner option,
[data-theme="light"] .field select option { background: #F2EFE7; color: #22242C; }

[data-theme="light"] .cal-day.has-story { color: #241A08; }
[data-theme="light"] .human.is-human { background: rgba(245, 178, 61, .16); }
[data-theme="light"] .human input:checked { background: #D9922A; border-color: #A2650A; }
[data-theme="light"] .human input:checked::after { border-color: #1A1206; }

[data-theme="light"] .ad { background: rgba(233, 229, 218, .9); }
[data-theme="light"] .feedback { background: rgba(255, 255, 255, .45); }
[data-theme="light"] .feedback select,
[data-theme="light"] .feedback input,
[data-theme="light"] .feedback textarea { background: rgba(255, 255, 255, .75); }

@keyframes warm-up-light {
  0%   { background: rgba(245, 178, 61, .75); }
  100% { background: rgba(245, 178, 61, 0); }
}
[data-theme="light"] .turn.fresh { animation-name: warm-up-light; }

/* the switch itself, named for what the site is about */

.lights {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: transparent;
  border: 1px solid var(--edge);
  border-radius: 999px;
  color: var(--cold);
  font-family: var(--mono);
  font-size: .6rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: .32rem .6rem .32rem .45rem;
  cursor: pointer;
  white-space: nowrap;
  transition: color .15s ease, border-color .15s ease;
}
.lights:hover { color: var(--filament); border-color: var(--sodium); }

.lights-bulb {
  width: .62rem;
  height: .62rem;
  border-radius: 50%;
  background: var(--cold-dim);
  transition: background-color .2s ease, box-shadow .2s ease;
}
[data-theme="light"] .lights-bulb {
  background: var(--sodium);
  box-shadow: 0 0 7px rgba(217, 146, 42, .8);
}

/* copy buttons */

.copy-row { display: flex; flex-wrap: wrap; gap: .5rem; margin: 1rem 0 0; }

.copied { color: var(--sodium) !important; border-color: var(--sodium) !important; }

/* ------------------------------------------------------ chapters on a shelf */

.chapters { list-style: none; margin: 1.1rem 0 0; padding: 0; }

.chapter {
  border-left: 1px solid var(--edge);
  padding: 0 0 .9rem 1rem;
  margin: 0 0 .9rem;
}
.chapter:last-child { margin-bottom: 0; padding-bottom: 0; }

.chapter-head {
  font-family: var(--mono) !important;
  font-size: .63rem !important;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--cold) !important;
  margin: 0 0 .4rem !important;
}

.chapter-summary {
  font-family: var(--serif) !important;
  font-size: .95rem !important;
  line-height: 1.6 !important;
  color: var(--filament) !important;
  margin: 0 0 .5rem !important;
  max-width: 34rem;
}

a.ghost { text-decoration: none; display: inline-block; }

.day-story {
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.72;
  color: var(--filament);
  margin-top: 1.1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--edge);
}

/* --------------------------------------------------------- read it in… */

.translate-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .55rem;
  margin: 0 0 2rem;
  padding: .6rem .8rem;
  border: 1px solid var(--edge);
  border-radius: 4px;
  background: rgba(245, 178, 61, .05);
}

.translate-bar label {
  font-family: var(--mono);
  font-size: .62rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--cold);
}

.translate-bar select {
  appearance: none;
  flex: 1;
  min-width: 11rem;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--edge);
  color: var(--sodium);
  font-family: var(--serif);
  font-size: 1rem;
  padding: .18rem 1.4rem .18rem .1rem;
  cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--cold) 50%),
                    linear-gradient(135deg, var(--cold) 50%, transparent 50%);
  background-position: right .6rem center, right .35rem center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.translate-bar select:hover { border-bottom-color: var(--sodium); }
.translate-bar select option { background: var(--dusk); color: var(--filament); }

[data-theme="light"] .translate-bar { background: rgba(245, 178, 61, .14); }
[data-theme="light"] .translate-bar select option { background: #F2EFE7; color: #22242C; }

/* a page mid-translation shouldn't flicker or look broken */
body.translating-page main,
body.translating-page .compose { opacity: .55; transition: opacity .15s ease; }

/* right-to-left languages, once the page is in one */
[dir="rtl"] .story,
[dir="rtl"] .page { text-align: right; }
[dir="rtl"] .masthead-inner,
[dir="rtl"] .controls { flex-direction: row-reverse; }
[dir="rtl"] .chapter { border-left: 0; border-right: 1px solid var(--edge); padding: 0 1rem .9rem 0; }
[dir="rtl"] .preview { border-left: 0; border-right: 2px solid var(--sodium); padding: .15rem .7rem .15rem 0; }

/* -------------------------------------------------- the box, out of the way */
/*
   Most visits are reading visits — there are two days between anybody's turns —
   so the box sits shut until it's wanted, and the story gets the screen.
*/

.compose-tab {
  display: none;
  width: 100%;
  align-items: baseline;
  gap: .6rem;
  background: transparent;
  border: 0;
  border-top: 1px solid var(--edge);
  color: var(--filament);
  font-family: var(--sans);
  font-size: .9rem;
  font-weight: 600;
  text-align: left;
  padding: .85rem 1.25rem;
  cursor: pointer;
}

.compose.is-shut .compose-tab { display: flex; }
.compose.is-shut .compose-inner { display: none; }
.compose.is-shut { border-top: 0; }

.compose-tab:hover { color: var(--sodium); }

.compose-tab-hint {
  font-family: var(--mono);
  font-size: .6rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--cold-dim);
  font-weight: 400;
}

.compose-tab-mark {
  margin-left: auto;
  width: .5rem;
  height: .5rem;
  border-right: 1.5px solid var(--sodium);
  border-top: 1.5px solid var(--sodium);
  transform: rotate(-45deg);
  transition: transform .18s ease;
}

/* the way back out, once it's open */
.compose-shut {
  position: absolute;
  top: .5rem;
  right: .9rem;
  width: 1.6rem;
  height: 1.6rem;
  display: grid;
  place-items: center;
  background: transparent;
  border: 1px solid var(--edge);
  border-radius: 50%;
  color: var(--cold);
  font-size: .95rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.compose-shut:hover { color: var(--filament); border-color: var(--sodium); }

/* nothing to put away when you're only being told when to come back */
.compose:has(#done:not([hidden])) .compose-shut { display: none; }

.compose { position: sticky; }
.compose-inner { position: relative; }

/* On a short screen the box scrolls inside itself rather than eating the page. */
.compose-inner {
  max-height: 72vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Room to read: the story is no longer hidden behind a tall dock. */
main { padding-bottom: 1rem; }

.translate-note {
  flex-basis: 100%;
  font-size: .72rem;
  line-height: 1.45;
  color: var(--cold-dim);
}

.translate-note-live { color: var(--sodium); }

/* ---------------------------------------------------------------- the tabs */
/*
   The help page had grown to eighteen sections, which is a wall rather than an
   explanation. Four tabs, first one open, and the rest a click away.
*/

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin: 0 0 2rem;
  border-bottom: 1px solid var(--edge);
}

.tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  color: var(--cold);
  font-family: var(--mono);
  font-size: .66rem;
  letter-spacing: .11em;
  text-transform: uppercase;
  padding: .6rem .8rem;
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease;
}
.tab:hover { color: var(--filament); }

.tab[aria-selected="true"] {
  color: var(--sodium);
  border-bottom-color: var(--sodium);
}

.panel > h2:first-child { margin-top: 0; }

@media (max-width: 30rem) {
  .tab { font-size: .6rem; padding: .55rem .55rem; letter-spacing: .08em; }
}

/* ------------------------------------------------------------------ the map */
/*
   Everywhere the story has been written from. Each country that has joined in
   carries a light; a line arriving makes its country flare. The whole idea of
   the site in one picture — lights coming back on, one place at a time.
*/

.map {
  margin: 0 0 2.5rem;
  padding: 0;
}

.map-frame {
  position: relative;
  width: 100%;
  border: 1px solid var(--edge);
  border-radius: 4px;
  background: rgba(15, 18, 25, .45);
  overflow: hidden;
}

.map-svg { display: block; width: 100%; height: auto; }

/* the continents, only just there — the lights are the subject */
.map-land {
  fill: none;
  stroke: var(--edge);
  stroke-width: .8;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.map-light {
  fill: var(--sodium);
  fill-opacity: .85;
  stroke: none;
  filter: drop-shadow(0 0 5px rgba(245, 178, 61, .6));
  cursor: default;
}

/* a light appearing for the first time swells into place */
@keyframes map-lit {
  0%   { r: 0; fill-opacity: 0; }
  55%  { r: 9; fill-opacity: 1; }
  100% { r: 4; fill-opacity: .85; }
}
.map-light.is-new { animation: map-lit 1.6s cubic-bezier(.2, .8, .3, 1); }

@keyframes map-flare {
  0%   { r: 4;  opacity: .9; stroke-width: 2.5; }
  100% { r: 48; opacity: 0;  stroke-width: .3; }
}
.map-flare {
  fill: none;
  stroke: #FFF2D8;
  animation: map-flare 3s cubic-bezier(.15, .7, .3, 1) forwards;
  pointer-events: none;
}
[data-theme="light"] .map-flare { stroke: #A2650A; }

.map-caption {
  margin: .6rem .1rem 0;
  font-family: var(--mono);
  font-size: .62rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--cold-dim);
  line-height: 1.6;
}
.map-caption #map-count { color: var(--sodium); }
.map-hint { display: block; opacity: .75; }

[data-theme="light"] .map-frame { background: rgba(255, 255, 255, .5); }
[data-theme="light"] .map-land { stroke: #C6BFAE; }
[data-theme="light"] .map-light {
  fill: #C07C10;
  filter: drop-shadow(0 0 3px rgba(192, 124, 16, .5));
}
[data-theme="light"] .map-flare { stroke: #C07C10; }

@media (prefers-reduced-motion: reduce) {
  .map-flare { display: none; }
}

/* ------------------------------------------------------- sending it onward */

.translate-out {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .6rem;
  margin: 2rem 0 0;
}

.translate-out-note {
  font-family: var(--mono);
  font-size: .6rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--cold-dim);
}

.colophon {
  margin-top: 1.5rem;
  font-family: var(--mono);
  font-size: .6rem;
  letter-spacing: .09em;
  color: var(--cold-dim);
}

/* ------------------------------------------------------------- a single day */

.day-title {
  font-family: var(--serif) !important;
  font-size: 1.15rem !important;
  font-weight: 600;
  color: var(--filament) !important;
  margin: 0 0 .25rem !important;
}

.day-map {
  margin: 1.2rem 0 .7rem;
  border: 1px solid var(--edge);
  border-radius: 4px;
  background: rgba(15, 18, 25, .35);
  overflow: hidden;
}
[data-theme="light"] .day-map { background: rgba(255, 255, 255, .45); }

.day-flags {
  margin: 0 0 1.2rem !important;
  font-size: 1rem;
  line-height: 1.9;
  letter-spacing: .1em;
  word-break: break-word;
}

.day-story {
  font-family: var(--serif);
  font-size: 1.05rem;
  line-height: 1.72;
  color: var(--filament);
  margin-top: 0;
  padding-top: 1rem;
  border-top: 1px solid var(--edge);
}

a.ghost#day-share { text-decoration: none; }

/* the busiest day, and the one you're reading */

.cal-day.is-busiest {
  box-shadow: 0 0 0 2px var(--night), 0 0 0 3.5px var(--sodium);
}
.cal-day.is-open {
  outline: 2px solid var(--filament);
  outline-offset: 1px;
}
[data-theme="light"] .cal-day.is-busiest {
  box-shadow: 0 0 0 2px var(--night), 0 0 0 3.5px #A2650A;
}

.day-nav {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: 1.2rem;
}
.day-nav .ghost:disabled { opacity: .3; cursor: default; }

/* what this is, for somebody who has just arrived */

.synopsis {
  font-family: var(--sans);
  font-size: .92rem;
  line-height: 1.65;
  color: var(--cold);
  margin: 0 0 2rem;
  max-width: 30rem;
}
.synopsis .link { white-space: nowrap; }
