/* Lights. One page, one toy in the corner.

   Type: Gloock for the display line and headings, a heavy sharp serif that reads like a
   painted sign. Sono for text, using its MONO axis: proportional for reading, monospaced
   for lists, labels and the switch.
   Palette from the B10 notes: paper #f6efe0, ink #2b2622, lamp orange #ff9a1f.
   Cream plus a serif sits near the second-wave look (anti-ai-ui tell 13). It stays because
   the page is a lit room: the orange is the lamp and the locator light, never body text,
   and the dark theme is tuned by hand, not inverted.
   Radius policy: 4px on the switch plate, 2px on the slot and lever, 50% on screws and pins.
   Shadows: none. Motion: the lever snaps in 90ms. Nothing else animates. */

:root {
  --gut-l: 1rem;
  --gut-r: 1rem;
  --gap: clamp(1rem, 2.5vw, 2.25rem);
}

body {
  --paper: #f6efe0;
  --ink: #2b2622;
  --muted: #6b5f53;
  --rule: #d6c9b2;
  --slip: #fbf7ee;
  --accent: #ff9a1f;
  --on-accent: #2b2622;
  --focus: var(--ink);
  --img: none;

  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Sono", ui-sans-serif, sans-serif;
  font-variation-settings: "MONO" 0;
  font-size: 1.125rem;
  line-height: 1.6;
  color-scheme: light;
  overflow-wrap: break-word;
}

/* Lights off, no flashlight: the plain dark theme. Warm, not black. */
html:not(.torch) body:has(#lights:not(:checked)) {
  --paper: #1f1a16;
  --ink: #ece2cf;
  --muted: #b3a48f;
  --rule: #4a4038;
  --slip: #29231e;
  --img: brightness(0.78);
  color-scheme: dark;
}

::selection { background: var(--accent); color: var(--on-accent); }

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.2em;
}
a:hover { background: var(--accent); color: var(--on-accent); text-decoration-color: var(--on-accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

h1, h2, h3, .write, blockquote {
  font-family: "Gloock", Georgia, serif;
  font-weight: 400;
}

.top, main, .foot { padding-inline: var(--gut-l) var(--gut-r); }

/* Top bar */
.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 1.5rem;
  padding: 1.1rem 4.5rem 1rem 0;
  border-bottom: 1px solid var(--rule);
  font-size: 0.9375rem;
  font-variation-settings: "MONO" 1;
}
@media (max-width: 63.99rem) {
  .bar { min-height: 5.5rem; align-content: flex-start; }
}
.bar ul { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; margin: 0; padding: 0; list-style: none; }

h1 {
  max-width: 13ch;
  margin: clamp(2.75rem, 7vw, 5.5rem) 0 clamp(1.75rem, 3.5vw, 3rem);
  font-size: clamp(2.875rem, 1.1rem + 7vw, 7.5rem);
  line-height: 0.96;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
.when-off { display: none; }
body:has(#lights:not(:checked)) .when-on { display: none; }
body:has(#lights:not(:checked)) .when-off { display: inline; }

/* The switch */
.switch {
  --plate: #fbf7ee;
  --plate-edge: #c9baa0;
  --slot: #3a322b;
  --lever: #fffdf8;
  --lever-edge: #d6c9b2;
  --lamp: #d6c9b2;
  --sw-text: var(--ink);
  --sw-bg: transparent;
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 20;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.5rem;
  padding: 0.5rem;
  background: var(--sw-bg);
  color: var(--sw-text);
}
body:has(#lights:not(:checked)) .switch {
  --plate: #3a322b;
  --plate-edge: #5a4d42;
  --slot: #15110e;
  --lever: #6b5f53;
  --lever-edge: #4a4038;
  --lamp: var(--accent);
  --sw-text: #ece2cf;
  --sw-bg: #1f1a16;
  --focus: var(--accent);
}
html.torch body:has(#lights:not(:checked)) .switch { --sw-bg: #201c17; }
.switch input {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 1px;
  height: 1px;
  margin: 0;
  opacity: 0;
}
.switch label {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}
.plate {
  position: relative;
  display: block;
  width: 2.75em;
  height: 4.75em;
  font-size: 1rem;
  background: var(--plate);
  border: 1px solid var(--plate-edge);
  border-bottom-width: 3px;
  border-radius: 4px;
}
#lights:focus-visible + label .plate { outline: 3px solid var(--focus); outline-offset: 3px; }
.screw {
  position: absolute;
  left: 50%;
  width: 0.4375em;
  height: 0.4375em;
  margin-left: -0.21875em;
  border-radius: 50%;
  background: var(--plate-edge);
}
.screw::after {
  content: "";
  position: absolute;
  top: 0.0625em;
  left: 0.1875em;
  width: 0.0625em;
  height: 0.3125em;
  background: var(--plate);
}
.screw-top { top: 0.375em; }
.screw-bottom { bottom: 0.3125em; }
.slot {
  position: absolute;
  top: 1.1875em;
  left: 50%;
  width: 0.875em;
  height: 1.75em;
  margin-left: -0.4375em;
  background: var(--slot);
  border-radius: 2px;
}
.lever {
  position: absolute;
  top: 0.125em;
  left: 0.125em;
  right: 0.125em;
  height: 0.6875em;
  background: var(--lever);
  border-bottom: 0.25em solid var(--lever-edge);
  border-radius: 2px;
  transition: transform 90ms ease-out;
}
body:has(#lights:not(:checked)) .lever {
  transform: translateY(0.5625em);
  border-bottom: 0;
  border-top: 0.25em solid var(--lever-edge);
}
.locator {
  position: absolute;
  bottom: 1.0625em;
  left: 50%;
  width: 0.375em;
  height: 0.375em;
  margin-left: -0.1875em;
  border-radius: 50%;
  background: var(--lamp);
}
.switch-word { font-size: 0.8125rem; line-height: 1; font-variation-settings: "MONO" 1; }
.torch-hint {
  display: none;
  max-width: 10.5rem;
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.4;
  text-align: right;
}

/* The flashlight overlay, shown only when the script has set html.torch */
.beam {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  background: radial-gradient(circle at var(--x, 85%) var(--y, 8%), rgb(23 19 15 / 0) 0 7rem, rgb(23 19 15 / 0.96) 11rem);
}
html.torch body:has(#lights:not(:checked)) .beam,
html.torch body:has(#lights:not(:checked)) .torch-hint { display: block; }

/* Main grid */
main {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gap);
}
main > * { grid-column: 1 / -1; min-width: 0; }

.greeting {
  margin: 0;
  max-width: 40rem;
  font-size: clamp(1.125rem, 1rem + 0.6vw, 1.25rem);
  line-height: 1.55;
}

h2 {
  margin: 0;
  font-size: clamp(2.25rem, 1.4rem + 2.6vw, 3.75rem);
  line-height: 1;
}
.aside { margin: 0.6rem 0 0; max-width: 36rem; color: var(--muted); font-size: 1rem; }

.now { margin-top: 3rem; padding-top: 1rem; border-top: 2px solid var(--ink); }
.now h2 { font-size: 2rem; }
.now ul {
  margin: 1.1rem 0 0;
  padding-left: 1.1rem;
  list-style: square;
  font-size: 0.9375rem;
  line-height: 1.55;
  font-variation-settings: "MONO" 1;
}
.now li + li { margin-top: 0.55rem; }
.now li::marker { color: var(--accent); }

/* Things made */
.made, .notes {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gap);
  align-items: start;
  margin-top: clamp(4.5rem, 10vw, 8.5rem);
}
.made > *, .notes > * { grid-column: 1 / -1; min-width: 0; }
.made > .aside, .notes > .aside { margin-bottom: 2.25rem; }

.thing img, .wall img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--rule);
  filter: var(--img);
}
.thing h3 { margin: 1rem 0 0; font-size: 1.75rem; line-height: 1.1; }
.thing p { margin: 0.5rem 0 0; max-width: 34rem; }
.thing-clock { margin-top: 3rem; max-width: 24rem; }

.kind {
  color: var(--muted);
  font-size: 0.875rem;
  font-variation-settings: "MONO" 1;
}
.thing .kind { margin-top: 0.3rem; }

.more { margin-top: 4rem; border-bottom: 1px solid var(--rule); }
.row { padding: 1.1rem 0 1.25rem; border-top: 1px solid var(--rule); }
.row h3 { margin: 0; font-size: 1.375rem; line-height: 1.2; }
.row p { margin: 0.3rem 0 0; max-width: 36rem; }

/* Notes wall */
.wall {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gap);
  row-gap: 2.25rem;
  align-items: start;
}
.slip {
  position: relative;
  grid-column: 1 / -1;
  margin: 0;
  padding: 1.4rem 1.25rem 1.1rem;
  background: var(--slip);
  border: 1px solid var(--rule);
}
.slip::before {
  content: "";
  position: absolute;
  top: -6px;
  left: 50%;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: var(--accent);
}
.slip:nth-child(even) { margin-left: 1.5rem; }
.stamp {
  display: inline-block;
  margin: 0 0 0.8rem;
  padding: 0.3rem 0.45rem 0.25rem;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1;
  font-variation-settings: "MONO" 1;
}
.slip blockquote { margin: 0; font-size: 1.375rem; line-height: 1.3; }
.slip blockquote p { margin: 0; }
.slip figcaption {
  margin-top: 0.75rem;
  color: var(--muted);
  font-size: 0.875rem;
  font-variation-settings: "MONO" 1;
}

/* Footer */
.foot {
  margin-top: clamp(5rem, 10vw, 8rem);
  padding-top: 2.5rem;
  padding-bottom: 3rem;
  border-top: 2px solid var(--ink);
}
.write { margin: 0 0 1.5rem; font-size: clamp(1.75rem, 1rem + 3vw, 3.25rem); line-height: 1.1; }
.small { margin: 0.4rem 0 0; color: var(--muted); font-size: 0.875rem; }

@media (min-width: 40rem) {
  :root { --gut-l: 2rem; --gut-r: 2rem; }
  .switch { top: 0.75rem; right: 1.25rem; }
}

@media (min-width: 56rem) {
  .greeting { grid-column: 1 / span 7; align-self: start; }
  .now { grid-column: 9 / -1; margin-top: 0.4rem; }

  .thing-map { grid-column: 1 / span 7; }
  .thing-clock { grid-column: 9 / -1; max-width: none; margin-top: 7rem; }

  .row {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 2fr) minmax(0, 6fr);
    column-gap: var(--gap);
    align-items: baseline;
  }
  .row .kind { margin: 0; }
  .row p { margin: 0; }

  .slip:nth-child(even) { margin-left: 0; }
  .slip:nth-child(1) { grid-column: 1 / span 4; }
  .slip:nth-child(2) { grid-column: 6 / span 3; margin-top: 3.5rem; }
  .slip:nth-child(3) { grid-column: 10 / span 3; margin-top: 1rem; }
  .slip:nth-child(4) { grid-column: 3 / span 5; }
}

/* Wide screens: the switch moves to the wall and stays there while you scroll.
   The right gutter is wider than the left so the plate never covers text. */
@media (min-width: 64rem) {
  :root { --gut-l: clamp(2.5rem, 6vw, 7rem); --gut-r: 7.5rem; }
  .switch { position: fixed; top: 1rem; right: 1.25rem; }
  .plate { font-size: 1.25rem; }
  .bar { padding-right: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .lever { transition: none; }
  .beam { display: none !important; }
}
