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

@font-face {
  font-family: N27;
  src: url("/fonts/n27-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: N27;
  src: url("/fonts/n27-medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "JetBrains Mono";
  src: url("/fonts/jetbrains-mono-regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  font-family: N27, sans-serif;
  font-synthesis: none;
  font-weight: 400;
  color: #e9e8e2;
  background: #090909;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 280px;
  min-height: 100vh;
  min-height: 100svh;
}

main {
  width: min(100%, 1440px);
  min-height: 100vh;
  min-height: 100svh;
  margin-inline: auto;
  padding: clamp(96px, 22svh, 240px) clamp(24px, 8vw, 120px) 80px;
}

/* The fossil keeps its original size, position and colour. */
.cursor {
  width: clamp(64px, 7.8vw, 112px);
  height: clamp(112px, 13vw, 188px);
  margin-bottom: clamp(48px, 7svh, 80px);
  background: currentColor;
  animation: blink 1.15s step-end infinite;
}

.prompt {
  display: block;
  position: relative;
  width: fit-content;
  max-width: 100%;
  font-size: clamp(30px, 4.1vw, 60px);
  line-height: 1.16;
  letter-spacing: -0.045em;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button.prompt {
  appearance: none;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  font-family: inherit;
  font-weight: inherit;
  text-align: left;
}

.prompt:has(:focus-visible),
.prompt:focus-visible,
.example:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: 8px;
}

.example {
  display: inline-block;
  min-height: 44px;
  margin-top: 20px;
  padding-block: 8px;
  color: #92918c;
  font-size: clamp(17px, 1.45vw, 20px);
  line-height: 1.5;
  text-decoration: none;
  text-underline-offset: 0.25em;
}

.example:hover {
  color: #e9e8e2;
  text-decoration: underline;
}

body[data-dragging="true"] .cursor {
  animation: none;
}

body[data-dragging="true"] .prompt {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

/* A phase change is one frame. Only new text develops. */
body[data-phase="field"] {
  --paper: #f3f1ea;
  --ink: #171713;
  --muted: #57564f;
  --source-light: #d4dbc3;
  color-scheme: light;
  color: var(--ink);
  background-color: var(--paper);
  background-image: url("/paper.svg");
  font-size: clamp(18px, 1.5vw, 21px);
  line-height: 1.65;
}

body[data-phase="field"][data-theme="dark"] {
  --paper: #141412;
  --ink: #efeee7;
  --muted: #aaa99f;
  --source-light: #3d4432;
  color-scheme: dark;
}

body[data-phase="field"] main {
  width: min(100%, 960px);
  padding: clamp(100px, 12svh, 144px) clamp(24px, 5vw, 64px) 64px;
}

body[data-phase="field"] .fossil,
body:not([data-phase="field"]) #room-footer,
body[data-reading="working"] #room-footer {
  display: none;
}

.theme-toggle {
  position: absolute;
  inset: 24px 24px auto auto;
  min-width: 72px;
  min-height: 44px;
  border: 0;
  border-radius: 0;
  padding: 8px;
  color: var(--muted);
  background: transparent;
  font: 12px/1.5 "JetBrains Mono", monospace;
  cursor: pointer;
  touch-action: manipulation;
}

.theme-toggle:hover,
.reveal-line:hover,
.path-summary:hover {
  color: var(--ink);
}

.reading {
  max-width: 72ch;
}

.filenames {
  display: grid;
  gap: 4px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.filenames,
.file-readings dt {
  color: var(--muted);
  font: 400 12px/1.8 "JetBrains Mono", monospace;
  overflow-wrap: anywhere;
}

.number,
.decision-value {
  font-family: "JetBrains Mono", monospace;
  font-variant-numeric: tabular-nums;
  font-weight: 400;
  font-size: 0.88em;
}

.skipped {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.about {
  margin: clamp(40px, 5vw, 64px) 0 36px;
  font-size: 1.13em;
  line-height: 1.5;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}

.file-readings {
  margin: 0;
}

.file-reading {
  margin-top: 26px;
}

.file-readings dt {
  margin: 0 0 4px;
}

.file-readings dd {
  margin: 0;
  font-size: 0.95em;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.error {
  max-width: 72ch;
  margin: 36px 0 0;
  font-size: 18px;
  line-height: 1.5;
}

body[data-phase="field"] .example {
  color: var(--muted);
}

body[data-phase="field"] .example:hover {
  color: var(--ink);
}

.calculation-status {
  min-height: 44px;
  margin: 36px 0 0;
  color: var(--muted);
  font: 12px/1.8 "JetBrains Mono", monospace;
}

.waiting-cursor {
  display: inline-block;
  width: 9px;
  height: 15px;
  margin-right: 12px;
  background: currentColor;
  vertical-align: -2px;
  animation: blink 1.15s step-end infinite;
}

.elapsed {
  font-variant-numeric: tabular-nums;
}

.analysis {
  margin-top: clamp(72px, 9vw, 112px);
  overflow-wrap: anywhere;
}

.analysis h2 {
  margin: 0 0 20px;
  font: 400 14px/1.5 "JetBrains Mono", monospace;
  color: var(--muted);
}

.question {
  margin: 0 0 clamp(48px, 6vw, 80px);
  font-size: clamp(36px, 4vw, 56px);
  font-weight: 300;
  line-height: 1.14;
  letter-spacing: -0.035em;
  text-wrap: pretty;
}

.decision-line {
  margin: 0;
  font-size: clamp(27px, 2.75vw, 38px);
  font-weight: 300;
  line-height: 1.5;
  letter-spacing: -0.025em;
}

.decision-line .figure-value,
.decision-line .figure-input,
.decision-value {
  font-size: 1.2em;
  font-weight: 400;
  letter-spacing: -0.05em;
}

.boundary-context {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.77em;
  line-height: 1.65;
}

.paths {
  margin-top: 52px;
}

.path {
  margin-block: 24px;
}

.path-summary,
.reveal-line {
  display: block;
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 0;
  padding: 8px 0;
  color: inherit;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  text-wrap: pretty;
}

.path-summary[aria-expanded="false"],
.reveal-line[aria-expanded="false"] {
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

.path-summary[aria-expanded="true"],
.reveal-line[aria-expanded="true"] {
  cursor: default;
}

.path-details,
.reveal-content {
  margin: 16px 0 40px;
}

.reveal-line {
  margin-top: 22px;
  color: var(--muted);
  font-size: 0.87em;
}

.figure {
  margin-block: 32px;
}

.figure p,
.path p,
.breakpoint p {
  margin: 8px 0;
}

.source,
.figure-note,
.figure-alternative,
.path-assumption,
.feasibility,
.calculator-message,
.unknowns,
.limitations {
  font-size: 0.8em;
  line-height: 1.65;
}

.source,
.figure-note,
.path-assumption {
  color: var(--muted);
}

.source,
.source-name,
.period-values {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72em;
  font-variant-numeric: tabular-nums;
}

.source-name {
  font-size: 1em;
}

.source {
  font-size: max(12px, 0.72em);
  width: fit-content;
  max-width: 100%;
}

.source[data-changed="true"] {
  color: var(--ink);
  background-color: var(--source-light);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 0.25em;
}

.figure-value,
.figure-reset {
  display: inline-block;
  min-height: 44px;
  min-width: 44px;
  border: 0;
  border-radius: 0;
  padding: 5px 2px;
  font: inherit;
  color: inherit;
  background: transparent;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  touch-action: manipulation;
}

.figure-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.88em;
  font-variant-numeric: tabular-nums;
}

.figure-input {
  appearance: textfield;
  width: 9ch;
  max-width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 0;
  padding: 5px 2px;
  font: 0.88em/1.5 "JetBrains Mono", monospace;
  font-variant-numeric: tabular-nums;
  color: inherit;
  background: transparent;
}

.figure-input::-webkit-inner-spin-button,
.figure-input::-webkit-outer-spin-button {
  appearance: none;
  margin: 0;
}

.figure-was,
.figure-reset,
.figure-invalid {
  margin-left: 0.5em;
  color: var(--muted);
  font: 400 12px/1.6 "JetBrains Mono", monospace;
  letter-spacing: normal;
}

.figure-invalid {
  display: block;
  margin: 6px 0 0;
}

.theme-toggle:focus-visible,
.reveal-line:focus-visible,
.path-summary:focus-visible,
.figure-value:focus-visible,
.figure-input:focus-visible,
.figure-reset:focus-visible,
.own-files:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: 4px;
}

.figure-input[aria-invalid="true"] {
  text-decoration: underline;
  text-decoration-style: wavy;
  text-underline-offset: 0.2em;
}

.path-title {
  margin: 0 0 10px;
  font: 500 1em/1.5 N27, sans-serif;
}

.path-output {
  overflow-wrap: anywhere;
}

.breakpoint {
  margin-block: 26px;
}

.crossing {
  font-size: 0.8em;
}

.crossing[data-crossed="true"] {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.next-test {
  margin-block: 52px;
}

.next-test p {
  margin: 10px 0;
  font-size: 0.95em;
  line-height: 1.6;
}

.next-test strong {
  font-weight: 500;
}

.room-footer {
  max-width: 72ch;
  margin-top: clamp(100px, 14vw, 180px);
  color: var(--muted);
  font: 11px/1.8 "JetBrains Mono", monospace;
}

.room-footer p {
  margin: 8px 0;
}

.own-files {
  display: inline-block;
  min-height: 44px;
  padding-block: 12px;
  color: inherit;
  text-decoration: none;
  text-underline-offset: 0.25em;
}

.own-files:hover {
  color: var(--ink);
  text-decoration: underline;
}

.room-mark {
  display: block;
  width: 148px;
  height: auto;
  margin: 32px 0 20px;
  fill: currentColor;
}

.room-mark text {
  font: 400 48px N27, sans-serif;
  letter-spacing: 0.5em;
}

.developed {
  animation: develop 420ms ease-out both;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

::selection {
  color: #090909;
  background: #e9e8e2;
}

body[data-phase="field"] ::selection {
  color: var(--paper);
  background: var(--ink);
}

@keyframes blink {
  0%, 54% { opacity: 1; }
  55%, 100% { opacity: 0; }
}

@keyframes develop {
  from { opacity: 0; filter: blur(2px); }
  to { opacity: 1; filter: blur(0); }
}

@media (max-width: 600px) {
  main {
    padding-top: 19svh;
    padding-bottom: 56px;
  }

  .prompt {
    max-width: 340px;
    font-size: clamp(30px, 8.8vw, 44px);
  }

  body[data-phase="field"] main {
    padding-top: 96px;
    padding-bottom: 40px;
  }

  .theme-toggle {
    top: 16px;
    right: 16px;
  }

  .question {
    font-size: clamp(34px, 8.8vw, 44px);
  }

  .decision-line {
    font-size: clamp(26px, 6.8vw, 34px);
  }

  .figure-input {
    width: 7ch;
  }

  .path-summary {
    line-height: 1.7;
  }
}

@media (prefers-reduced-motion: reduce) {
  .cursor,
  .waiting-cursor,
  .developed {
    animation: none;
  }
}
