@font-face {
  font-family: "Rubik";
  src: url("/fonts/rubik.woff2") format("woff2");
  font-weight: 300 900;
  font-style: normal;
  font-display: swap;
}

/* Palettes. Light unless the system asks for dark; the toggle (theme.js) can
   override either with data-theme on the root element. Keep the backgrounds
   in sync with scripts/build.mjs and 404.html. */
:root {
  --bg: #f5efe6;
  --fg: #3b2e2f;
  --accent: #a20315;
  --border: #40d2c1;
  /* Pact states: a green tick for a rule kept today, a quiet grey cross for
     one broken. The green is an emerald, saturated so it reads as green
     against the dark text (about 3.8:1 on the background). --warn is the red cross a hover shows before a rule is
     marked broken: the accent in light mode, a red in dark mode (whose
     accent is cyan). */
  --good: #078a5b;
  --warn: #a20315;
  --pending: color-mix(in srgb, var(--fg) 45%, transparent);
  --rule: color-mix(in srgb, var(--fg) 14%, transparent);
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

  /* Where the logo ends up: distance of its centre from the top, and its
     size. The intro fills 100vmin, so the settled logo would shrink and grow
     with the window. --head-box fixes it instead: the 1000-unit viewBox ends
     up this many pixels wide, whatever the window (the logo is about 86% of
     that). --head-scale is --head-box / 100vmin; tan(atan2()) is how CSS
     divides one length by another. Browsers without it keep 0.36. */
  --head-y: 64px;

  /* One vertical axis: the rules' names, the section titles, the log text
     and the logo's left edge all start on it. Left of it, a
     gutter holds the past days and today's switch (and the log's dates).
     --col is the lists' width, --gutter the width left of the axis (the
     dots, the 6px gaps and the switch's 28px; see .tm). */
  --col: 24rem;
  --gutter: calc(var(--dots) * var(--dot-step) + 40px);
  --head-box: 280px;
  --head-scale: 0.36;

  color-scheme: light;
}

@supports (scale: tan(atan2(1px, 1px))) {
  :root {
    --head-scale: tan(atan2(var(--head-box), 100vmin));
  }
}

@media (orientation: portrait) {
  :root {
    --head-y: 56px;
  }
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #120024;
    --fg: #e1b0ff;
    --accent: #03ffd1;
    --border: #5a1fb0;
    --good: #03ffd1;
    --warn: #ff5c7a;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #120024;
  --fg: #e1b0ff;
  --accent: #03ffd1;
  --border: #5a1fb0;
  --good: #03ffd1;
  --warn: #ff5c7a;
  color-scheme: dark;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--fg);
}

body {
  overflow: hidden;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Every element's resting style is its final state; the animations below
   only describe how it gets there. With reduced motion, only the logo is
   shown, already in place at the top. Timeline, in seconds:
   0     the badge, in the centre; seven wireframes fade in
         around and on top of it, clockwise, one every 0.42s
   0.45  first line of copy, for 3.75s
   3.54  after a short wait, the cluster flies off to all sides
   3.69  calm: waterline
   4.22  the badge swells for a moment
   4.35  second line of copy, for 3.75s
   4.89  the badge shrinks and moves into the full stop
   5.64  the logo rises out of the water
   7.14  the waterline narrows to the logo's width and stays under it
   7.74  the logo slides up to the top, the copy with it
   8.94  colour-scheme toggle
   9.1   the visitor's don'ts and do's
   The intro plays once (public/intro.js); after that the root element has
   the no-intro class and the page opens on this end state. */

.stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  transform-origin: 50% 50%;
  /* Sideways onto the axis: the axis sits --gutter right of the lists' left
     edge, and the logo's left edge is --logo-left (layout.css) of the
     settled viewBox from its centre. On very narrow screens it stops where
     the logo's right edge would leave the 16px margin. */
  --axis: calc(var(--gutter) - min(100vw - 32px, var(--col)) / 2);
  --logo-dx: min(calc(var(--axis) - var(--head-box) * var(--logo-left)), calc(50vw - 16px - var(--head-box) * var(--logo-right)));
  transform: translate(var(--logo-dx), calc(var(--head-y) - 50vh)) scale(var(--head-scale));
  transform: translate(var(--logo-dx), calc(var(--head-y) - 50svh)) scale(var(--head-scale));
  animation: settle 1.2s cubic-bezier(0.65, 0, 0.35, 1) 7.74s both;
}

@keyframes settle {
  from { transform: none; }
}

.logo {
  font-family: "Rubik", system-ui, sans-serif;
  font-weight: 500;
  fill: var(--fg);
}

/* Wireframe cluster around the badge */

.layer {
  visibility: hidden;
  animation: on-stage 4.365s linear;
}

@keyframes on-stage {
  from, to { visibility: visible; }
}

/* Each card's direction (--dx, --dy) is in layout.css. */
.out { animation: out 0.825s cubic-bezier(0.5, 0, 0.75, 0) 3.54s both; }

@keyframes out {
  to { transform: translate(var(--dx), var(--dy)); opacity: 0; }
}

/* Each card's delay is in layout.css. */
.pop { animation: pop 0.27s ease-out both; }

@keyframes pop {
  from { opacity: 0; }
}

/* Wireframes: outlines in the foreground colour, filled with the background
   so later cards cover earlier ones. */
.wf {
  fill: var(--bg);
  stroke: var(--fg);
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.wf * { vector-effect: non-scaling-stroke; }
.wf .t { fill: var(--fg); stroke: none; }
.wf .x { fill: none; }
.wf .hot { fill: var(--accent); stroke: none; }
.wf .hot-line { stroke: var(--accent); fill: none; }

/* Calm water */

.horizon {
  stroke: var(--border);
  stroke-width: 2;
  transform-box: view-box;
  transform: scaleX(0.14);
  animation: horizon 8.04s linear both;
}

@keyframes horizon {
  0%, 45.9% { opacity: 0; transform: scaleX(1); }
  57.1% { opacity: 1; transform: scaleX(1); }
  88.8% { opacity: 1; transform: scaleX(1); animation-timing-function: cubic-bezier(0.2, 0.7, 0.3, 1); }
  /* About the logo's width, so it visibly settles under the logo. */
  100% { opacity: 1; transform: scaleX(0.14); }
}

/* The badge swells, then shrinks into the full stop. The keyframes and their
   easing are in layout.css. */

.badge {
  fill: var(--accent);
  transform-box: view-box;
  animation: badge-land 1.875s linear 4.215s both;
}

/* Logo */

.logo-siren { animation: rise 1.35s cubic-bezier(0.2, 0.7, 0.2, 1) 5.64s both; }
.logo-com { animation: rise 1.35s cubic-bezier(0.2, 0.7, 0.2, 1) 5.82s both; }

@keyframes rise {
  from { transform: translateY(160px); }
  to { transform: none; }
}

/* Copy: two lines, shown one at a time in the same spot, 14px under the
   waterline from the start. They move up with the logo (same timing and
   easing as the stage, so the gap stays 14px). The stage maps 1000 viewBox
   units to 100vmin around the centre: the waterline is 57.8 units below it.
   Once they are gone, Pact and Log take their place and scroll within the
   rest of the window. */

.copy {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 16px;
  top: calc(var(--head-y) + 5.78vmin * var(--head-scale) + 14px);
  max-width: 34rem;
  margin: 0 auto;
  padding: 0 16px;
  font-family: "Rubik", system-ui, sans-serif;
  text-align: center;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  animation: copy-settle 1.2s cubic-bezier(0.65, 0, 0.35, 1) 7.74s both;
}

@keyframes copy-settle {
  from { top: calc(50% + 5.78vmin + 14px); }
}

.line {
  grid-area: 1 / 1;
  align-self: start;
  margin: 0;
  font-size: 20px;
  line-height: 1.5;
  color: var(--fg);
  text-wrap: balance;
}

/* A line in two parts wraps between them, not inside one. */
.line span {
  display: inline-block;
}

/* Each line shows for 3.75s, then makes way. */
.line-1,
.line-2 {
  opacity: 0;
  animation: say 3.75s linear 0.45s both;
}

.line-2 {
  animation-delay: 4.35s;
}

@keyframes say {
  0% { opacity: 0; transform: translateY(8px); animation-timing-function: cubic-bezier(0.2, 0.7, 0.3, 1); }
  10%, 90% { opacity: 1; transform: none; }
  100% { opacity: 0; }
}

/* Pact and Log: two collapsible sections under the third line. Pact has one
   row per rule, each with a switch on the left: a green tick while kept
   today, a quiet grey cross once broken, final outside edit mode. Log is a
   daily note (styled further down).
   Hovering shows the state a click switches to, but not again until the
   pointer has left after a click. Each section's Edit button puts it in
   edit mode: names become text fields, each row gets a drag grip and
   delete at its end, and the switch works both ways. */

/* 8px wider than the column on each side, with that much padding, so the
   rows' outdented icons (negative margins below) stay inside the scroll area
   instead of making it scroll sideways. */
.lists {
  grid-row: 1 / 3;
  grid-column: 1;
  justify-self: center;
  box-sizing: border-box;
  width: calc(100% + 16px);
  max-width: calc(var(--col) + 16px);
  min-height: 0;
  margin: 0;
  padding: 40px 8px 0;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: thin;
  text-align: left;
  animation: fade-in 0.9s ease-out 9.1s both;
}

/* Big screens: a wider column with larger rows and note. */
@media (min-width: 720px) {
  :root {
    --col: 28rem;
  }

  .lists {
    max-width: calc(var(--col) + 16px);
  }

  .lists .tm,
  .lists .tm-add {
    font-size: 19px;
  }

  .lists .tm-today {
    --note-size: 19px;
  }

  .lists .tm,
  .lists .tm-add {
    min-height: 54px;
  }
}

.lists[hidden] {
  display: none;
}

.tm-section + .tm-section {
  margin-top: 64px;
}

/* Section headings: Rubik like the logo. The whole row toggles the section; the chevron sits on the right,
   in line with the delete icons, pointing up while open and down once
   collapsed. */
/* Three columns: title, then the tools (Add, Edit) and the chevron on the
   right. (The tools used to be centred, with "1fr auto 1fr".) */
.tm-section summary {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 4px 0 12px;
  list-style: none;
  cursor: pointer;
  color: var(--fg);
  /* Headings are also drag handles (temptations.js): no text selection, and
     on touch screens a drag moves the section instead of scrolling. */
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

/* The section being dragged: drawn above the other, on the page colour so
   it covers what it passes over. */
.tm-section.dragging {
  position: relative;
  z-index: 1;
  background: var(--bg);
}

.tm-section.dragging summary {
  cursor: grabbing;
}

.tm-section summary::-webkit-details-marker {
  display: none;
}

.tm-section h2 {
  justify-self: start;
  margin: 0;
}

.tm-section:not(.collapsed) h2 {
  margin-left: var(--gutter);
}

.tm-section h2 {
  transition: color 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: "Rubik", system-ui, sans-serif;
  font-weight: 500;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.tm-chevron {
  justify-self: end;
  width: 22px;
  height: 22px;
  margin-right: -1px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.5;
  /* Same length and easing as the slide in temptations.js. */
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.15s ease-out;
}

.tm-section.collapsed .tm-chevron {
  transform: rotate(180deg);
}

/* While a section slides (temptations.js animates its body's height and
   moves the content inside it right and up), the content rises through the
   heading bar, behind the title, button and chevron, and is clipped at the
   top of the section; sideways, the list container clips it. */
.tm-section.sliding {
  overflow-x: visible;
  overflow-y: clip;
}

.tm-section summary {
  position: relative;
  z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
  .tm-chevron,
  .tm-section h2 {
    transition: none;
  }

  .tm-tools button,
  .tm-section.editing .tm-grip,
  .tm-section.editing .tm-delete {
    animation: none;
  }
}

.tm-section summary:hover:not(:has(.tm-tools:hover)) .tm-chevron {
  opacity: 1;
}

/* What goes in an empty list, with an example. */
.tm-empty {
  margin: 0;
  padding: 10px 0 12px var(--gutter);
  font-size: 15px;
  line-height: 1.5;
  color: color-mix(in srgb, var(--fg) 55%, transparent);
}

.tm-empty[hidden] {
  display: none;
}

/* Collapsed: no tools, and the title moves next to the chevron
   (temptations.js slides it there) in a quieter colour. */
.tm-section.collapsed summary {
  grid-template-columns: 1fr auto;
}

.tm-section.collapsed .tm-tools {
  display: none;
}

.tm-section.collapsed h2 {
  justify-self: end;
  color: color-mix(in srgb, var(--fg) 50%, transparent);
}

.tm-section.collapsed summary:hover h2 {
  color: var(--fg);
}

/* The tools (Add, Edit) show only while the section is in use: under the
   pointer, after a tap in it on touch screens (.revealed, temptations.js),
   with focus inside it, or in edit mode. The weekday letters show while the
   pointer is over the past days (or the letters), a past day has keyboard
   focus, in edit mode, or after a tap on touch screens. Both keep their
   space, so nothing moves when they appear. */
.tm-tools,
.tm-week {
  transition: opacity 0.2s ease-out;
}

@media (hover: hover) {
  .tm-section:not(:hover):not(.editing):not(:focus-within) .tm-tools,
  .tm-section:not(.editing):not(:has(.tm-days:hover, .tm-week:hover, .tm-day:focus-visible)) .tm-week {
    opacity: 0;
  }
}

@media (hover: none) {
  .tm-section:not(.revealed):not(.editing):not(:focus-within) .tm-tools,
  .tm-section:not(.revealed):not(.editing):not(:focus-within) .tm-week {
    opacity: 0;
  }
}

/* Add and Edit: quiet outlined pills in the foreground colour, clearer on
   hover. Edit reads "Done" while the section is in edit mode, and is filled
   then. */
.tm-tools {
  display: flex;
  gap: 6px;
}

.tm-tools button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0;
  padding: 5px 10px 5px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: none;
  color: color-mix(in srgb, var(--fg) 70%, transparent);
  font: 500 14px/1 "Rubik", system-ui, sans-serif;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.15s ease-out, border-color 0.15s ease-out, background-color 0.15s ease-out;
  /* Fades in when it reappears as the section expands. */
  animation: fade-in 0.3s ease-out 0.1s both;
}

.tm-tools svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

.tm-mode {
  padding-inline: 10px;
}

.tm-tools button:hover,
.tm-mode[aria-pressed="true"] {
  color: var(--fg);
  border-color: color-mix(in srgb, var(--fg) 45%, transparent);
  background: color-mix(in srgb, var(--fg) 5%, transparent);
}

.tm-mode[aria-pressed="true"] {
  background: color-mix(in srgb, var(--fg) 9%, transparent);
}

.tm-tools button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.tm-section summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

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

.tm,
.tm-add {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  min-height: 50px;
  border-bottom: 1px solid transparent;
  font-size: 17px;
  line-height: 1.4;
}

/* The new line, at the top of the list while the add button has it open. */
.tm-add[hidden] {
  display: none;
}

/* The line being typed in: its rule turns solid. */
.tm-add:focus-within,
.tm-section.editing .tm:has(.tm-input:focus) {
  border-bottom-color: var(--fg);
}

.tm button {
  flex: none;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--fg);
  cursor: pointer;
}

.tm button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.tm svg,
.tm-plus svg {
  grid-area: 1 / 1;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* The switch: a green tick or a grey cross (data-show, temptations.js). */
.tm .tm-state,
.tm-plus {
  width: 36px;
  height: 36px;
  margin-left: -8px;
}

.tm .tm-state {
  transition: color 0.2s ease-out;
}

.tm-state svg {
  stroke-width: 2.75;
}

.tm .tm-state[aria-disabled="true"] {
  cursor: default;
}

.tm-state[data-show="good"] {
  color: var(--good);
}

.tm-state[data-show="grey"] {
  color: var(--pending);
}

.tm-state[data-show="good"] .icon-cross,
.tm-state:not([data-show="good"]) .icon-check {
  display: none;
}

/* The name: plain text, with the plain arrow over it and no text selection
   (outside edit mode); only the switch marks a rule. */
.tm-section:not(.editing) .tm-name {
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
}

.tm-name {
  flex: 0 1 auto;
  min-width: 0;
  padding: 10px 0;
  overflow-wrap: anywhere;
}

/* A row just added: an empty switch, with no hover preview, for its first
   1.2s (temptations.js); then its green tick fades in. */
.tm.fresh .tm-state {
  cursor: default;
}

.tm.fresh .tm-state svg {
  visibility: hidden;
}

.tm.arrived .tm-state svg {
  animation: fade-in 0.6s ease-out both;
}

/* Text fields: the new line, and the names in edit mode (which replace the
   plain names there, in the same spot and type). */
.tm-input,
.tm-add input {
  flex: 1;
  min-width: 0;
  margin: 0;
  padding: 10px 0;
  border: 0;
  border-radius: 0;
  outline: none;
  background: none;
  color: var(--fg);
  font: inherit;
}

.tm-input,
.tm-section.editing .tm-name {
  display: none;
}

.tm-section.editing .tm-input {
  display: block;
}

.tm-add input::placeholder {
  color: var(--fg);
  opacity: 0.45;
}

.tm-plus {
  display: grid;
  place-items: center;
  color: var(--fg);
  opacity: 0.45;
}

/* The past days, left of the switch: one faint mark per day, oldest first
   (a small tick: kept, a small cross: broken, a speck: no entry). Six on
   wider screens, the last four on narrow ones. In edit mode they are
   clearer and each can be clicked to change that day. */
:root {
  --dots: 6;
  --dot-step: 15px;
}

@media (max-width: 479px) {
  :root {
    --dots: 4;
  }

  .tm-day:nth-child(-n + 2),
  .tm-wd:nth-child(-n + 2) {
    display: none;
  }
}

/* Weekday letters over the dots, and today's over the switches: small and
   quiet, today's clearer. */
.tm-week {
  display: flex;
  margin-bottom: 2px;
  font-size: 11px;
  line-height: 16px;
  color: color-mix(in srgb, var(--fg) 55%, transparent);
  user-select: none;
  -webkit-user-select: none;
}

.tm-week[hidden] {
  display: none;
}

.tm-wd {
  flex: none;
  width: var(--dot-step);
  text-align: center;
}

/* Over the switch: past the rows' 6px gap, less the switch's -8px margin. */
.tm-wd-today {
  width: 36px;
  margin-left: -2px;
  color: color-mix(in srgb, var(--fg) 80%, transparent);
  font-weight: 500;
}

.tm-days {
  flex: none;
  display: flex;
  width: calc(var(--dots) * var(--dot-step));
}

.tm .tm-day {
  width: var(--dot-step);
  height: 28px;
  border-radius: 0;
  cursor: default;
}

/* Each past day: a small tick (kept) or cross (broken), faint; a speck
   for no entry. Clearer in edit mode, clearest under the pointer there. */
.tm-day svg {
  width: 12px;
  height: 12px;
  stroke-width: 2.5;
  transition: opacity 0.2s ease-out;
}

.tm-day[data-state="kept"] {
  color: var(--good);
}

.tm-day[data-state="broken"] {
  color: var(--fg);
}

.tm-day[data-state="kept"] .icon-cross,
.tm-day[data-state="broken"] .icon-check,
.tm-day[data-state="none"] svg {
  display: none;
}

.tm-day[data-state="kept"] svg {
  opacity: 0.8;
}

.tm-day[data-state="broken"] svg {
  opacity: 0.6;
}

.tm-day[data-state="none"]::before {
  content: "";
  width: 2px;
  height: 2px;
  border-radius: 50%;
  background: var(--fg);
  opacity: 0.35;
  transition: opacity 0.2s ease-out;
}

.tm-section.editing .tm-day[data-state="kept"] svg {
  opacity: 0.9;
}

.tm-section.editing .tm-day[data-state="broken"] svg {
  opacity: 0.75;
}

.tm-section.editing .tm-day[data-state="none"]::before {
  opacity: 0.5;
}

.tm-section.editing .tm-day {
  cursor: pointer;
}

.tm-section.editing .tm-day:hover svg,
.tm-section.editing .tm-day:hover::before {
  opacity: 1;
}

/* Edit mode only: a drag grip and delete at the end of the row, in the same
   size and quiet colour, fading in as the mode starts. */
.tm-grip,
.tm .tm-delete {
  display: none;
  width: 32px;
  height: 32px;
  color: color-mix(in srgb, var(--fg) 55%, transparent);
}

.tm-section.editing .tm-grip,
.tm-section.editing .tm-delete {
  display: grid;
  place-items: center;
  animation: fade-in 0.2s ease-out both;
}

.tm-grip {
  flex: none;
  margin-left: auto;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.tm-grip svg {
  width: 18px;
  height: 18px;
  stroke-width: 3.4;
}

.tm .tm-delete {
  margin-left: -4px;
  margin-right: -6px;
}

.tm-delete svg {
  width: 17px;
  height: 17px;
}

.tm-grip:hover,
.tm .tm-delete:hover {
  color: var(--accent);
}

.tm .tm-delete:focus-visible {
  color: var(--fg);
}

.tm.dragging {
  z-index: 2;
  background: var(--bg);
}

.tm.dragging .tm-grip {
  cursor: grabbing;
}

/* The new line's plus lines up with the switches, past the dots. */
.tm-add {
  padding-left: calc(var(--dots) * var(--dot-step) + 6px);
}

/* Hovering previews what a click does (data-next): a green tick to undo, or
   a red cross before a rule is marked broken (it then settles to grey).
   Only over the switch itself. */
@media (hover: hover) {
  .tm:not(.fresh) .tm-state[data-next="good"]:not(.settled):not([aria-disabled="true"]):hover {
    color: var(--good);
  }

  .tm:not(.fresh) .tm-state[data-next="grey"]:not(.settled):not([aria-disabled="true"]):hover {
    color: var(--warn);
  }

  .tm:not(.fresh) .tm-state[data-next="good"]:not(.settled):not([aria-disabled="true"]):hover .icon-cross,
  .tm:not(.fresh) .tm-state:not([data-next="good"]):not(.settled):not([aria-disabled="true"]):hover .icon-check {
    display: none;
  }

  .tm:not(.fresh) .tm-state[data-next="good"]:not(.settled):not([aria-disabled="true"]):hover .icon-check,
  .tm:not(.fresh) .tm-state:not([data-next="good"]):not(.settled):not([aria-disabled="true"]):hover .icon-cross {
    display: block;
  }
}

/* Log: a note for today, then the last few days' notes, quiet, each with
   its date on the left in a faint column ("Today", "Nov 30th"). The heading
   has no tools, so it has only the title and the chevron. */
.tm-notes summary {
  grid-template-columns: 1fr auto;
}

.tm-today {
  --note-size: 17px;
}

.tm-today,
.tm-past li {
  display: grid;
  /* Dates in the gutter, text on the axis. */
  grid-template-columns: calc(var(--gutter) - 12px) minmax(0, 1fr);
  gap: 12px;
}

/* The date column; on the note's line it matches the note's first line. */
.tm-when,
.tm-past time {
  font-size: 14px;
  color: color-mix(in srgb, var(--fg) 45%, transparent);
  white-space: nowrap;
}

.tm-when {
  padding-top: 10px;
  line-height: calc(var(--note-size) * 1.4);
}

.tm-note {
  display: block;
  box-sizing: border-box;
  width: 100%;
  min-height: 44px;
  margin: 0;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid transparent;
  border-radius: 0;
  outline: none;
  background: none;
  color: var(--fg);
  font: var(--note-size)/1.4 "Rubik", system-ui, sans-serif;
  resize: none;
  overflow: hidden;
}

.tm-note:focus {
  border-bottom-color: var(--fg);
}

.tm-note::placeholder {
  color: var(--fg);
  opacity: 0.45;
}

.tm-past {
  margin: 0;
  padding: 6px 0 0;
  list-style: none;
}

.tm-past[hidden] {
  display: none;
}

.tm-past li {
  padding: 8px 0;
  font-size: 15px;
  line-height: 1.45;
  color: color-mix(in srgb, var(--fg) 70%, transparent);
}

.tm-past time {
  line-height: 1.55;
}

.tm-past p {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-line;
}

/* Colour-scheme toggle */

.theme-toggle {
  position: fixed;
  color: var(--fg);
  animation: fade-in 0.9s ease-out 8.94s both;
}

/* Light/dark toggle: a monochrome icon top right, showing the mode it
   switches to. 40px hit area; the icon stays clear of the logo even on a
   320px-wide screen. */
.theme-toggle {
  top: 8px;
  right: 8px;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}

.theme-toggle[hidden] {
  display: none;
}

.theme-toggle svg {
  grid-area: 1 / 1;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.theme-toggle[data-to="light"] .icon-moon,
.theme-toggle:not([data-to="light"]) .icon-sun {
  display: none;
}

.theme-toggle:hover {
  opacity: 0.65;
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@keyframes fade-in {
  from { opacity: 0; }
}

/* Not-found page */

.notfound {
  min-height: 100%;
  display: grid;
  place-content: center;
  gap: 24px;
  padding: 16px;
  text-align: center;
}

.notfound h1 {
  margin: 0;
  font-family: "Rubik", system-ui, sans-serif;
  font-weight: 500;
  font-size: clamp(3rem, 12vw, 8rem);
  line-height: 1;
}

.notfound a {
  font: 500 15px/1 var(--mono);
  color: var(--fg);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.notfound a:hover {
  color: var(--accent);
}

.notfound a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* Intro already seen: open on the end state. */
.no-intro .stage,
.no-intro .stage *,
.no-intro .copy,
.no-intro .line,
.no-intro .lists,
.no-intro .theme-toggle {
  animation: none !important;
}

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

  .stage,
  .stage *,
  .copy,
  .line,
  .lists,
  .theme-toggle {
    animation: none !important;
  }
}
