@font-face {
  font-family: "Fraunces";
  src: url("fonts/Fraunces9pt-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Fraunces";
  src: url("fonts/Fraunces9pt-Italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Plex Sans";
  src: url("fonts/IBMPlexSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Plex Sans";
  src: url("fonts/IBMPlexSans-SemiBold.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("fonts/IBMPlexMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --sky: #10141c;
  --topsoil: #3b2a1e;
  --clay: #6b4a2f;
  --slate: #4a5260;
  --bedrock: #2a2d33;
  --lava: #ff5a1f;
  --lava-ink: #ff8a5c;
  --moss: #7fd38a;
  --cream: #f3ead9;
  --dim: #d9cdb8;
  --sand: #e6c79a;
  --paper: #eadfc8;
  --ink: #231a12;
  --ink-soft: #4d3d2c;
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --sans: "Plex Sans", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --mono: "Plex Mono", ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace;
  --loop: 26s;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  background: var(--sky);
  color: var(--cream);
  font-family: var(--sans);
  overflow: hidden;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

.expo {
  --u: min(1vw, 1.78vh);
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 54fr) minmax(0, 46fr);
  grid-template-rows: minmax(0, 1fr) auto;
}

.ground {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  min-height: 0;
}
.ground svg {
  position: absolute;
  left: calc(2.4 * var(--u));
  top: calc(1.4 * var(--u));
  width: calc(100% - 2.4 * var(--u));
  height: calc(100% - 6 * var(--u));
}

.words {
  grid-column: 2;
  grid-row: 1;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  padding: calc(3.2 * var(--u)) calc(4.4 * var(--u)) calc(1.5 * var(--u)) calc(2.6 * var(--u));
}

.tag {
  justify-self: start;
  margin: 0;
  font-family: var(--mono);
  font-size: calc(1.12 * var(--u));
  line-height: 1.35;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink);
  padding: 0.5em 0.9em 0.5em 2.1em;
  transform: rotate(-0.8deg);
  box-shadow: 2px 3px 0 rgba(0, 0, 0, 0.35);
  background: var(--paper) radial-gradient(circle at 1em 50%, var(--ink) 0 0.24em, transparent 0.28em);
  clip-path: polygon(0.65em 0, 100% 0, 100% 100%, 0.65em 100%, 0 72%, 0 28%);
}

.says, .live { align-self: center; }
.says { display: grid; }
.say { grid-area: 1 / 1; opacity: 0; animation: var(--loop) linear infinite; }
.say-1 { animation-name: say-1; }
.say-2 { animation-name: say-2; }
.say-3 { animation-name: say-3; }
.say-4 { animation-name: say-4; }

.step {
  margin: 0 0 1.1em;
  font-family: var(--mono);
  font-size: calc(1.3 * var(--u));
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sand);
}
h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 600;
  font-size: calc(4.7 * var(--u));
  line-height: 1.07;
  letter-spacing: -0.01em;
  text-wrap: balance;
}
.sub {
  margin: 0.85em 0 0;
  font-size: calc(2.3 * var(--u));
  line-height: 1.34;
  color: var(--dim);
  max-width: 24em;
  text-wrap: pretty;
}
.mark {
  margin: 0 0 0.08em -0.04em;
  font-family: var(--serif);
  font-weight: 600;
  font-size: calc(11.5 * var(--u));
  line-height: 0.92;
  letter-spacing: -0.02em;
}
.say-4 h1 { font-size: calc(3.7 * var(--u)); line-height: 1.12; }

.then {
  margin: 1.1em 0 0;
  padding-left: 1.6em;
  position: relative;
  font-family: var(--serif);
  font-style: italic;
  font-size: calc(2.1 * var(--u));
  line-height: 1.3;
  color: var(--sand);
}
.then::before {
  content: "";
  position: absolute;
  left: 0.15em;
  top: 0;
  width: 1em;
  height: 0.75em;
  border-left: 1px solid var(--sand);
  border-bottom: 1px solid var(--sand);
}
.live .step { color: var(--cream); }
.expo[data-scene="lie"] .live .step { color: var(--lava-ink); }
.expo[data-scene="cooled"] .live .step { color: var(--moss); }
.mono { font-family: var(--mono); }

.strip {
  grid-column: 1 / -1;
  grid-row: 2;
  position: relative;
  display: flex;
  align-items: center;
  gap: calc(2.4 * var(--u));
  min-height: calc(4.6 * var(--u));
  padding: calc(1.1 * var(--u)) calc(2.6 * var(--u)) calc(0.8 * var(--u));
  background: var(--topsoil);
  font-size: calc(1.3 * var(--u));
}
.strip-edge {
  position: absolute;
  left: 0;
  bottom: calc(100% - 1px);
  width: 100%;
  height: calc(1.3 * var(--u));
  fill: var(--topsoil);
  pointer-events: none;
}
.strip p { margin: 0; }
.status {
  display: flex;
  align-items: center;
  gap: 0.6em;
  font-weight: 600;
  font-size: calc(1.55 * var(--u));
  white-space: nowrap;
}
.lamp {
  width: 0.8em;
  height: 0.8em;
  border-radius: 50%;
  border: 0.14em solid var(--sand);
  transition: background-color 0.8s, border-color 0.8s;
}
.status[data-liar="lying"] .lamp { background: var(--sand); }
.status[data-liar="honest"] .lamp { background: var(--moss); border-color: var(--moss); }
.keys { display: flex; gap: calc(0.9 * var(--u)); }
.keys button {
  display: flex;
  align-items: center;
  gap: 0.6em;
  min-height: 44px;
  padding: 0.3em 0.9em 0.3em 0.4em;
  border: 1px solid rgba(243, 234, 217, 0.45);
  border-radius: 3px;
  background: none;
  color: var(--cream);
  font: inherit;
  cursor: pointer;
}
.keys button:hover { border-color: var(--cream); }
.keys button:focus-visible { outline: 3px solid var(--sand); outline-offset: 2px; }
kbd {
  font-family: var(--mono);
  font-size: 0.92em;
  color: var(--ink);
  background: var(--paper);
  padding: 0.2em 0.55em;
  border-radius: 2px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4);
}
.count { font-family: var(--mono); color: var(--dim); white-space: nowrap; }
.said { color: var(--sand); }
.where {
  margin-left: auto !important;
  font-family: var(--mono);
  font-size: calc(1.5 * var(--u));
  white-space: nowrap;
}

.rt, .rt-glow, .crack, .ph-crack, .seal-x, .seal-disc, .seal-check, .pg-fake, .ro-led, .ph-dns, .stamp, .g-served {
  transition: stroke 1.2s ease, fill 1.2s ease, opacity 0.9s ease, stroke-dashoffset 1.5s ease;
}
.show-cooled .rt-b { stroke: var(--moss); stroke-dashoffset: 0; opacity: 0; transition-delay: 0s, 0s, 1.8s, 0s; }
.show-cooled .rt-a { stroke-dashoffset: 0; transition-delay: 1.4s; }
.show-cooled .seal-disc { fill: var(--moss); transition-delay: 2.6s; }
.show-cooled .seal-check { stroke: #0b0d12; transition-delay: 2.6s; }

.show-lie.pulse .dot-b { animation: dot-once 1.8s ease-in-out 1; }
@keyframes dot-once {
  0% { stroke-dashoffset: 0; opacity: 0; }
  12% { stroke-dashoffset: -8; opacity: 1; }
  88% { stroke-dashoffset: -94; opacity: 1; }
  100% { stroke-dashoffset: -100; opacity: 0; }
}

.loop .rt-a { animation: draw-a var(--loop) linear infinite; }
.loop .dot-a { animation: dot-a var(--loop) linear infinite; }
.loop .rt-b { animation: draw-b var(--loop) linear infinite; }
.loop .dot-b { animation: dot-b var(--loop) linear infinite; }
.loop .rt-glow { animation: glow var(--loop) linear infinite; }
.loop .crack, .loop .ph-crack { animation: hot var(--loop) linear infinite; }
.loop .pg-fake { animation: fake-hot var(--loop) linear infinite; }
.loop .ro-led, .loop .ph-dns { animation: led-hot var(--loop) linear infinite; }
.loop .seal-disc { animation: seal-disc var(--loop) linear infinite; }
.loop .seal-check { animation: seal-check var(--loop) linear infinite; }
.loop .seal-x { animation: proof-late var(--loop) linear infinite; }
.loop .stamp-ok { animation: proof var(--loop) linear infinite; }
.loop .stamp-bad { animation: proof-late var(--loop) linear infinite; }

@keyframes say-1 { 0% { opacity: 0; } 2%, 23% { opacity: 1; } 25.5%, 100% { opacity: 0; } }
@keyframes say-2 { 0%, 26% { opacity: 0; } 28%, 49% { opacity: 1; } 51.5%, 100% { opacity: 0; } }
@keyframes say-3 { 0%, 52% { opacity: 0; } 54%, 75% { opacity: 1; } 77.5%, 100% { opacity: 0; } }
@keyframes say-4 { 0%, 78% { opacity: 0; } 80%, 97% { opacity: 1; } 99.5%, 100% { opacity: 0; } }

@keyframes draw-a {
  0%, 3% { stroke-dashoffset: 100; opacity: 1; }
  15%, 23% { stroke-dashoffset: 0; opacity: 1; }
  25.5% { stroke-dashoffset: 0; opacity: 0; }
  25.6%, 55% { stroke-dashoffset: 100; opacity: 0; }
  55.1% { stroke-dashoffset: 0; opacity: 0; }
  58%, 97% { stroke-dashoffset: 0; opacity: 1; }
  99.5%, 100% { stroke-dashoffset: 0; opacity: 0; }
}
@keyframes dot-a {
  0%, 3% { stroke-dashoffset: 0; opacity: 0; }
  3.6% { stroke-dashoffset: -5; opacity: 1; }
  14.4% { stroke-dashoffset: -95; opacity: 1; }
  15%, 100% { stroke-dashoffset: -100; opacity: 0; }
}
@keyframes draw-b {
  0%, 29% { stroke-dashoffset: 100; opacity: 1; }
  41%, 75% { stroke-dashoffset: 0; opacity: 1; }
  77.5%, 100% { stroke-dashoffset: 0; opacity: 0; }
}
@keyframes dot-b {
  0%, 29% { stroke-dashoffset: 0; opacity: 0; }
  29.6% { stroke-dashoffset: -5; opacity: 1; }
  40.4% { stroke-dashoffset: -95; opacity: 1; }
  41%, 100% { stroke-dashoffset: -100; opacity: 0; }
}
@keyframes glow { 0%, 40% { opacity: 0; } 44%, 75% { opacity: 0.28; } 77.5%, 100% { opacity: 0; } }
@keyframes hot { 0%, 40% { opacity: 0; } 44%, 75% { opacity: 1; } 77.5%, 100% { opacity: 0; } }
@keyframes fake-hot { 0%, 40% { stroke: var(--cream); } 44%, 75% { stroke: var(--lava); } 77.5%, 100% { stroke: var(--cream); } }
@keyframes led-hot { 0%, 40% { fill: var(--moss); } 44%, 75% { fill: var(--lava); } 77.5%, 100% { fill: var(--moss); } }
@keyframes seal-disc {
  0%, 14% { fill: #0b0d12; }
  17%, 23% { fill: var(--moss); }
  25.5%, 57% { fill: #0b0d12; }
  60%, 97% { fill: var(--moss); }
  99.5%, 100% { fill: #0b0d12; }
}
@keyframes seal-check {
  0%, 14% { stroke: var(--moss); }
  17%, 23% { stroke: #0b0d12; }
  25.5%, 57% { stroke: var(--moss); }
  60%, 97% { stroke: #0b0d12; }
  99.5%, 100% { stroke: var(--moss); }
}
@keyframes proof { 0%, 59% { opacity: 0; } 62%, 75% { opacity: 1; } 77.5%, 100% { opacity: 0; } }
@keyframes proof-late { 0%, 63% { opacity: 0; } 66%, 75% { opacity: 1; } 77.5%, 100% { opacity: 0; } }

@media (orientation: portrait) {
  .expo {
    --u: min(1.7vw, 1.12vh);
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(30vh, auto) minmax(0, 1fr) auto;
  }
  .words { grid-column: 1; grid-row: 1; padding: calc(3.2 * var(--u)) calc(4 * var(--u)) calc(1 * var(--u)); }
  .says, .live { align-self: start; margin-top: calc(2.6 * var(--u)); }
  .ground { grid-column: 1; grid-row: 2; }
  .ground svg { left: calc(2 * var(--u)); top: 0; width: calc(100% - 4 * var(--u)); height: calc(100% - 2.4 * var(--u)); }
  .strip { grid-row: 3; flex-wrap: wrap; row-gap: calc(1 * var(--u)); }
  .say-4 { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: calc(3 * var(--u)); align-items: center; }
  .say-4 .step { grid-column: 1 / -1; }
  .mark { font-size: calc(9 * var(--u)); }
}

@media (prefers-reduced-motion: reduce) {
  .say, .loop * { animation-timing-function: step-end !important; }
  .loop .dot, .show-lie.pulse .dot-b { animation: none; }
  .rt, .rt-glow, .crack, .ph-crack, .seal-x, .seal-disc, .seal-check, .pg-fake, .ro-led, .ph-dns, .stamp, .g-served {
    transition: stroke 0.6s linear, fill 0.6s linear, opacity 0.6s linear;
  }
}
