/* Layout: one night rail from 18:00 to 05:00. Every page hangs off its hour in the left column.
   Look: a dark bar. Black ground, ivory type, one red light under the door. Single theme by choice. */
:root {
  color-scheme: dark;
  --night: #0b0b0c;
  --night-2: #131214;
  --line: #3a3632;
  --paper: #ece7dc;
  --muted: #a8a297;
  --accent: #e0444d;
  --hot: #fff8ea;
  --receipt: #f2efe6;
  --receipt-ink: #1b1c2b;
  --receipt-rule: #b9b4a4;

  --font-display: "Bodoni Moda", Didot, "Bodoni 72", "Times New Roman", serif;
  --font-kanji: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --font-body: "Hanken Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --font-mono: "DM Mono", ui-monospace, Menlo, Consolas, monospace;
  --font-ja: "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;

  --gutter: clamp(1rem, 4vw, 2.5rem);
  --hour-col: 5.5rem;
  --measure: 65ch;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--night);
  color: var(--paper);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
}
img { max-width: 100%; }
a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { color: var(--hot); }
:focus-visible { outline: 2px solid var(--hot); outline-offset: 3px; }
h1, h2, h3 { text-wrap: balance; margin: 0; }
p { margin: 0; }
[lang="ja"] { font-family: var(--font-ja); }

.wrap {
  max-width: 72rem;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* Header and footer */
.site-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding-block: 1.25rem;
  border-bottom: 1px solid var(--line);
}
.wordmark {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.22em;
  color: var(--paper);
  text-decoration: none;
}
.wordmark span { color: var(--accent); }
.site-nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; }
.site-nav a {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
}
.site-nav a:hover { color: var(--accent); }
.site-foot {
  margin-top: 4rem;
  padding-block: 1.5rem 2.5rem;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  justify-content: space-between;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

/* Hero */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 19rem);
  gap: clamp(2rem, 6vw, 4.5rem);
  align-items: center;
  padding-block: clamp(2.5rem, 7vw, 5rem) clamp(2rem, 5vw, 3.5rem);
}
.hero-copy { display: grid; gap: 1.25rem; min-width: 0; }
.hero h1 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(2.6rem, 7.2vw, 5.5rem);
  line-height: 1;
  letter-spacing: -0.01em;
}
.hero h1 em { font-style: inherit; color: var(--accent); }
.lede { max-width: 34em; font-size: 1.25rem; line-height: 1.5; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; }
.btn {
  display: inline-block;
  padding: 0.85rem 1.4rem;
  background: var(--paper);
  color: var(--night);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-decoration: none;
  border: 0;
  border-radius: 2px;
  cursor: pointer;
}
.btn:hover { background: var(--accent); color: var(--night); }
.link-quiet { font-family: var(--font-mono); font-size: 0.9rem; }

.door-col { display: grid; gap: 0.9rem; min-width: 0; justify-items: start; }
.door {
  width: min(100%, 19rem);
  aspect-ratio: 3 / 4;
  box-sizing: border-box;
  border: 1px solid var(--line);
  background: var(--night-2);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  padding-top: 1.5rem;
}
.door-label {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted);
}
.clock-time { font-size: 1.05rem; letter-spacing: 0.08em; color: var(--paper); font-variant-numeric: tabular-nums; }
.door-kanji {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.06em;
  font-family: var(--font-kanji);
  font-weight: 800;
  font-size: clamp(4rem, 9vw, 6.5rem);
  line-height: 1;
}
.door-kanji span { display: block; }
.door-light { align-self: stretch; height: 3px; background: var(--accent); box-shadow: 0 0 42px 8px var(--accent); }
.door-gloss { font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.08em; color: var(--muted); }
.clock-note { font-size: 0.98rem; line-height: 1.45; max-width: 19rem; }

/* Night rail */
.section { padding-block: clamp(2rem, 5vw, 3.5rem); }
.section-head { display: grid; gap: 0.5rem; margin-bottom: 1.5rem; }
.section-head h2, .book h2 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(1.5rem, 3.6vw, 2.2rem);
  line-height: 1.15;
}
.section-head p { color: var(--muted); max-width: 40em; }

.rail { list-style: none; margin: 0; padding: 0; }
.slot {
  display: grid;
  grid-template-columns: var(--hour-col) minmax(0, 1fr);
  gap: 0 1.5rem;
  padding-block: 1.4rem;
  border-top: 1px solid var(--line);
}
.slot:last-child { border-bottom: 1px solid var(--line); }
.slot-hour {
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1.2;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.slot.has-guide .slot-hour { color: var(--accent); }
.slot-body { display: grid; gap: 0.3rem; min-width: 0; }
.slot-kind {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  align-items: baseline;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.slot h3 { font-family: var(--font-display); font-weight: 500; font-size: 1.7rem; line-height: 1.2; }
.slot h3 a { color: var(--paper); text-decoration-color: var(--accent); text-decoration-thickness: 2px; }
.slot h3 a:hover { color: var(--accent); }
.slot.is-planned h3 { color: var(--muted); font-size: 1.3rem; }
.slot-dek { max-width: 38em; color: var(--muted); }
.slot.has-guide .slot-dek { color: var(--paper); }
.tag { color: var(--muted); border: 1px solid var(--line); padding: 0 0.4rem; letter-spacing: 0.06em; }
.now-badge { color: var(--night); background: var(--hot); padding: 0 0.4rem; letter-spacing: 0.06em; }

/* Book and about */
.book {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr);
  gap: 2rem 3rem;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  background: var(--night-2);
  border: 1px solid var(--line);
}
.book-title { display: grid; gap: 0.5rem; align-content: start; min-width: 0; }
.book-sub { font-family: var(--font-display); font-style: italic; font-size: 1.35rem; color: var(--accent); }
.book-by { font-family: var(--font-mono); font-size: 0.9rem; color: var(--muted); }
.book-copy { display: grid; gap: 1rem; align-content: start; min-width: 0; }
.cta-pending {
  justify-self: start;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  padding: 0.6rem 1rem;
  border: 1px dashed var(--accent);
  color: var(--accent);
}
.about { display: grid; grid-template-columns: var(--hour-col) minmax(0, 1fr); gap: 0 1.5rem; }
.about-body { display: grid; gap: 1rem; max-width: var(--measure); grid-column: 2; }
.about h2 { grid-column: 2; font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 1.7rem; margin-bottom: 1rem; }

/* Article */
.article {
  display: grid;
  grid-template-columns: var(--hour-col) minmax(0, var(--measure));
  gap: 0 1.5rem;
  padding-block: clamp(2rem, 6vw, 4rem) 0;
}
.article > * { grid-column: 2; min-width: 0; }
.article > .stamp { grid-column: 1; }
.stamp { display: grid; gap: 0.25rem; align-content: start; }
.stamp-hour {
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1.2;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.stamp-kind {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.article-head { display: grid; gap: 1rem; margin-bottom: 2rem; }
.article-head h1 {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(2.2rem, 5.6vw, 3.6rem);
  line-height: 1.05;
}
.dek { font-size: 1.3rem; line-height: 1.45; color: var(--muted); }

.prose { display: grid; gap: 1.15rem; }
.prose > * { min-width: 0; }
.prose h2 { font-family: var(--font-display); font-weight: 500; font-size: 1.75rem; line-height: 1.2; margin-top: 1.6rem; }
.prose ul, .prose ol { margin: 0; padding-left: 1.3rem; display: grid; gap: 0.6rem; }
.prose li::marker { color: var(--accent); font-family: var(--font-mono); font-size: 0.9em; }
.prose dl { margin: 0; display: grid; gap: 1rem; }
.prose dt { font-weight: 600; }
.prose dt span { font-weight: 400; color: var(--muted); font-size: 0.95rem; }
.prose dd { margin: 0.15rem 0 0; }
.say { font-style: italic; }

.ask {
  display: grid;
  gap: 0.35rem;
  margin: 0.5rem 0;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--accent);
}
.ask-ja { font-family: var(--font-ja); font-size: clamp(1.5rem, 4.5vw, 2.1rem); font-weight: 700; line-height: 1.25; color: var(--accent); }
.ask-romaji { font-style: italic; }
.ask-en { font-family: var(--font-mono); font-size: 0.9rem; color: var(--muted); }

.table-scroll { overflow-x: auto; border: 1px solid var(--line); }
table { border-collapse: collapse; width: 100%; min-width: 34rem; font-size: 1rem; line-height: 1.45; }
th, td { text-align: left; vertical-align: top; padding: 0.65rem 0.85rem; border-bottom: 1px solid var(--line); }
tr:last-child td { border-bottom: 0; }
th {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--night-2);
  white-space: nowrap;
}
td.ja { font-family: var(--font-ja); font-weight: 700; white-space: nowrap; }
td.romaji { font-style: italic; min-width: 9rem; }
td.cost { font-family: var(--font-mono); color: var(--accent); white-space: nowrap; }
.table-note { font-size: 0.9rem; color: var(--muted); }

.phrase-tools { display: flex; flex-wrap: wrap; gap: 0.5rem 1rem; align-items: center; }
.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  padding: 0.4rem 0.75rem;
  border-radius: 2px;
  cursor: pointer;
}
.btn-ghost:hover { color: var(--hot); border-color: var(--hot); }
.phrases.is-drill td.en { cursor: pointer; }
.phrases.is-drill td.en > span { visibility: hidden; }
.phrases.is-drill tr.is-shown td.en > span { visibility: visible; }
.phrases.is-drill td.en::before { content: "Tap to check"; font-family: var(--font-mono); font-size: 0.75rem; color: var(--muted); display: block; }
.phrases.is-drill tr.is-shown td.en::before { content: none; }

/* Bill builder */
.builder {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.5rem;
  padding: 1.25rem;
  background: var(--night-2);
  border: 1px solid var(--line);
}
.builder-form { display: grid; gap: 0.9rem; align-content: start; min-width: 0; }
.field { display: grid; gap: 0.25rem; }
.field label, .field-check label { font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.04em; color: var(--muted); }
.field input, .field select {
  width: 100%;
  font: inherit;
  font-family: var(--font-mono);
  font-size: 1rem;
  padding: 0.45rem 0.6rem;
  color: var(--paper);
  background: var(--night);
  border: 1px solid var(--line);
  border-radius: 2px;
}
.field-check { display: flex; gap: 0.5rem; align-items: center; }
.field-check input { width: 1.1rem; height: 1.1rem; accent-color: var(--accent); }
.receipt {
  background: var(--receipt);
  color: var(--receipt-ink);
  font-family: var(--font-mono);
  font-size: 0.9rem;
  line-height: 1.5;
  padding: 1.1rem 1.1rem 1.25rem;
  align-self: start;
  min-width: 0;
  font-variant-numeric: tabular-nums;
}
.receipt-head { text-align: center; padding-bottom: 0.6rem; border-bottom: 1px dashed var(--receipt-rule); margin-bottom: 0.6rem; }
.receipt-head b { font-family: var(--font-ja); font-size: 1.1rem; letter-spacing: 0.3em; }
.receipt-row { display: flex; justify-content: space-between; gap: 1rem; }
.receipt-row span:first-child { min-width: 0; }
.receipt-row.is-total { border-top: 1px dashed var(--receipt-rule); margin-top: 0.6rem; padding-top: 0.6rem; font-weight: 500; font-size: 1.05rem; }
.receipt-foot { margin-top: 0.6rem; font-size: 0.8rem; }

/* Chooser */
.chooser { display: grid; gap: 1rem; padding: 1.25rem; background: var(--night-2); border: 1px solid var(--line); }
.chooser-options { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chooser-options button {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  padding: 0.5rem 0.8rem;
  color: var(--paper);
  background: var(--night);
  border: 1px solid var(--line);
  border-radius: 2px;
  cursor: pointer;
}
.chooser-options button:hover { border-color: var(--accent); }
.chooser-options button[aria-pressed="true"] { background: var(--accent); color: var(--night); border-color: var(--accent); }
.chooser-answer { display: grid; gap: 0.5rem; }
.chooser-answer h3 { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 1.6rem; color: var(--accent); }

/* Article endings */
.next-hour {
  margin-top: 3rem;
  padding-block: 1.25rem;
  border-block: 1px solid var(--line);
  display: grid;
  gap: 0.25rem;
}
.next-hour a { font-family: var(--font-display); font-weight: 500; font-size: 1.6rem; line-height: 1.25; color: var(--paper); text-decoration-color: var(--accent); text-decoration-thickness: 2px; }
.next-hour a:hover { color: var(--accent); }
.book-strip { margin-top: 2rem; display: grid; gap: 0.75rem; padding: 1.25rem; background: var(--night-2); border: 1px solid var(--line); }
.book-strip b { font-family: var(--font-mono); font-weight: 500; font-size: 0.9em; letter-spacing: 0.12em; }

@media (max-width: 46rem) {
  :root { --hour-col: 4.25rem; }
  body { font-size: 1rem; }
  .door { width: min(100%, 13rem); }
  .hero, .book, .builder { grid-template-columns: minmax(0, 1fr); }
  .hero { align-items: start; gap: 1.75rem; }
  .lede { font-size: 1.15rem; }
  .slot { gap: 0 1rem; }
  .slot-hour, .stamp-hour { font-size: 1.15rem; }
  .slot h3 { font-size: 1.35rem; }
  .article, .about { grid-template-columns: minmax(0, 1fr); }
  .article > *, .article > .stamp, .about h2, .about-body { grid-column: 1; }
  .stamp { grid-auto-flow: column; justify-content: start; align-items: baseline; gap: 0.75rem; margin-bottom: 0.75rem; }
  .dek { font-size: 1.15rem; }
}
@media (prefers-reduced-motion: no-preference) {
  .btn, .btn-ghost, .chooser-options button { transition: background-color 0.15s, color 0.15s, border-color 0.15s; }
}

/* Field map teaser and sign-up */
.maptease {
  display: grid;
  grid-template-columns: var(--hour-col) minmax(0, 1fr);
  gap: 1rem 1.5rem;
  padding-block: 1.75rem;
  border-block: 1px solid var(--accent);
}
.maptease-title { grid-column: 1 / -1; display: grid; gap: 0.4rem; }
.maptease h2 { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: clamp(1.5rem, 3.6vw, 2.2rem); line-height: 1.15; }
.maptease-copy { grid-column: 2; display: grid; gap: 1rem; max-width: var(--measure); min-width: 0; }
.notify { display: grid; gap: 0.75rem; padding: 1.25rem; background: var(--night-2); border: 1px solid var(--line); }
.notify-row { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.notify-row input {
  flex: 1 1 14rem;
  min-width: 0;
  font: inherit;
  font-family: var(--font-mono);
  font-size: 1rem;
  padding: 0.6rem 0.75rem;
  color: var(--paper);
  background: var(--night);
  border: 1px solid var(--line);
  border-radius: 2px;
}
.notify label { font-family: var(--font-mono); font-size: 0.8rem; letter-spacing: 0.04em; color: var(--muted); }
.notify-note { font-size: 0.95rem; color: var(--muted); }
.notify .btn[disabled], .notify input[disabled] { opacity: 0.55; cursor: not-allowed; }
@media (max-width: 46rem) {
  .maptease { grid-template-columns: minmax(0, 1fr); }
  .maptease-copy { grid-column: 1; }
}

/* Kit sign-up embed: the form brings its own box, so the wrapper stays plain. */
.notify-kit { padding: 0; background: transparent; border: 0; }
.notify-kit:has(.formkit-form) .notify-fallback { display: none; }

.site-foot a { color: var(--muted); }
.site-foot a:hover { color: var(--paper); }
.contact { font-family: var(--font-mono); font-size: 0.95em; }

/* Kit form colors: the embed ships its own light theme, so the site restyles it to match. */
.notify-kit .formkit-form { background-color: #131214 !important; border: 1px solid #3a3632 !important; border-radius: 0 !important; }
.notify-kit .formkit-form .formkit-background { opacity: 0 !important; }
.notify-kit .formkit-form .formkit-header { color: #ece7dc !important; font-family: "Bodoni Moda", Didot, "Times New Roman", serif !important; font-weight: 500 !important; }
.notify-kit .formkit-form .formkit-header h2 { font-style: italic; font-weight: 500; }
.notify-kit .formkit-form .formkit-subheader { color: #cfc9bd !important; }
.notify-kit .formkit-form .formkit-input { background: #0b0b0c !important; color: #ece7dc !important; border: 1px solid #3a3632 !important; border-radius: 2px !important; }
.notify-kit .formkit-form .formkit-input::placeholder { color: #a8a297 !important; opacity: 1; }
.notify-kit .formkit-form .formkit-input:focus { border-color: #ece7dc !important; outline: none; }
.notify-kit .formkit-form .formkit-submit { background-color: #ece7dc !important; color: #0b0b0c !important; border-radius: 2px !important; font-weight: 500 !important; }
.notify-kit .formkit-form .formkit-submit:hover > span { background-color: #e0444d !important; }
.notify-kit .formkit-form .formkit-guarantee { color: #a8a297 !important; }
.notify-kit .formkit-form .formkit-alert-success { background: #131214 !important; border-color: #e0444d !important; color: #ece7dc !important; }
.notify-kit .formkit-form .formkit-powered-by-convertkit { filter: invert(1) !important; opacity: 0.6; }
