:root {
  --paper: #eee3ce;
  --paper-light: #f8f0df;
  --paper-deep: #d7c6a8;
  --ink: #1d1a16;
  --muted-ink: #5d5448;
  --thistle: #62405f;
  --moss: #526248;
  --ochre: #ad7a2d;
  --rain: #728a96;
  --line: 3px solid var(--ink);
  --soft-shadow: 0 16px 40px rgb(42 34 25 / 18%);
  --control-font: Arial, Helvetica, sans-serif;
  --display-font: Georgia, "Times New Roman", serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  scroll-behavior: smooth;
  background: var(--paper);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 14% 12%, rgb(255 255 255 / 32%) 0 1px, transparent 2px),
    radial-gradient(circle at 84% 76%, rgb(72 54 34 / 8%) 0 1px, transparent 2px),
    linear-gradient(112deg, var(--paper-light), var(--paper) 46%, #e4d6bd);
  background-size: 19px 17px, 23px 21px, auto;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.55;
}

body.is-dialog-open {
  overflow: hidden;
}

a {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  font: inherit;
}

img {
  display: block;
  max-width: 100%;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.6rem;
  left: 0.6rem;
  padding: 0.65rem 0.9rem;
  border: 2px solid var(--ink);
  background: var(--paper-light);
  font: 700 0.88rem/1 var(--control-font);
  transform: translateY(-150%);
}

.skip-link:focus {
  transform: translateY(0);
}

.site-header {
  position: relative;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100% - 2rem, 1380px);
  min-height: 76px;
  margin: 0 auto;
  border-bottom: 2px solid rgb(29 26 22 / 35%);
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  text-decoration: none;
  font: 900 clamp(1.65rem, 3vw, 2.45rem)/1 var(--display-font);
  letter-spacing: -0.07em;
}

.wordmark span:last-child {
  display: inline-block;
  color: var(--thistle);
  font-style: italic;
  transform: rotate(-2deg);
}

.site-header nav {
  display: flex;
  gap: clamp(0.8rem, 2vw, 1.8rem);
  font: 700 0.78rem/1.2 var(--control-font);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.site-header nav a,
.site-footer a,
.text-link {
  text-decoration-thickness: 2px;
  text-underline-offset: 0.24em;
}

.opening {
  display: grid;
  grid-template-columns: minmax(0, 0.78fr) minmax(0, 1.22fr);
  gap: clamp(2.5rem, 6vw, 7rem);
  align-items: center;
  width: min(100% - 3rem, 1380px);
  min-height: calc(100svh - 76px);
  margin: 0 auto;
  padding: clamp(3rem, 7vw, 7rem) 0;
}

.opening__copy {
  position: relative;
  z-index: 2;
}

.opening__copy::before {
  position: absolute;
  z-index: -1;
  top: -2.5rem;
  left: -2rem;
  width: 6.5rem;
  height: 6.5rem;
  border: 2px solid rgb(98 64 95 / 34%);
  border-radius: 50%;
  content: "";
}

.opening h1 {
  max-width: 9.5ch;
  margin: 0;
  font: 900 clamp(3.5rem, 6.7vw, 7.5rem)/0.88 var(--display-font);
  letter-spacing: -0.075em;
}

.opening h1 em {
  color: var(--thistle);
  font-weight: 400;
}

.opening__announcement {
  max-width: 38rem;
  margin: clamp(1.6rem, 3vw, 2.6rem) 0 0;
  color: var(--muted-ink);
  font-size: clamp(1.05rem, 1.5vw, 1.28rem);
  line-height: 1.6;
}

.opening__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.3rem;
  align-items: center;
  margin-top: 2.2rem;
}

.button {
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.2rem;
  border: 2px solid var(--ink);
  text-decoration: none;
  font: 800 0.84rem/1.1 var(--control-font);
  letter-spacing: 0.065em;
  text-transform: uppercase;
  box-shadow: 4px 4px 0 var(--ochre);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.button--primary {
  color: var(--paper-light);
  background: var(--ink);
}

.button:hover {
  box-shadow: 2px 2px 0 var(--ochre);
  transform: translate(2px, 2px);
}

.text-link {
  font: 700 0.9rem/1.3 var(--control-font);
}

.opening__picture {
  position: relative;
  margin: 0;
  border: 4px solid var(--ink);
  background: var(--paper-light);
  box-shadow: var(--soft-shadow), 7px 7px 0 var(--rain);
  transform: rotate(0.45deg);
}

.opening__picture::after {
  position: absolute;
  inset: 8px;
  border: 1px solid rgb(29 26 22 / 55%);
  content: "";
  pointer-events: none;
}

.opening__picture img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.opening__picture figcaption {
  position: absolute;
  right: 1.25rem;
  bottom: -1rem;
  padding: 0.4rem 0.7rem;
  border: 2px solid var(--ink);
  background: var(--paper-light);
  font-size: 0.86rem;
  font-style: italic;
  transform: rotate(-1.5deg);
}

.scene-page {
  width: min(100% - 2rem, 1480px);
  min-height: calc(100svh - 76px);
  margin: 0 auto;
  padding: clamp(2rem, 4vw, 4rem) 0 4rem;
}

.scene-heading {
  display: grid;
  grid-template-columns: 1fr minmax(18rem, 0.6fr);
  gap: 3rem;
  align-items: end;
  max-width: 1280px;
  margin: 0 auto 1.4rem;
}

.scene-heading p {
  margin: 0;
  color: var(--muted-ink);
}

.scene-heading > div > p {
  font: 800 0.75rem/1.2 var(--control-font);
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.scene-heading h1,
.story-route h1 {
  margin: 0.15rem 0 0;
  font: 900 clamp(2.5rem, 5vw, 5.4rem)/0.95 var(--display-font);
  letter-spacing: -0.055em;
}

.street-frame {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 5px solid var(--ink);
  background: var(--rain);
  box-shadow: 0 22px 60px rgb(42 34 25 / 22%), 8px 8px 0 var(--ochre);
}

.street-frame::after {
  position: absolute;
  z-index: 25;
  inset: 9px;
  border: 1px solid rgb(248 240 223 / 75%);
  content: "";
  pointer-events: none;
}

.street-frame__backdrop {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.scene-subject,
.scene-landmark,
.wind-control {
  position: absolute;
  z-index: 8;
  margin: 0;
}

.scene-subject {
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  transition: transform 180ms ease;
}

.scene-subject img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  pointer-events: none;
}

.scene-subject > span,
.scene-landmark > span {
  position: absolute;
  left: 50%;
  bottom: 4%;
  padding: 0.25rem 0.52rem;
  border: 2px solid var(--ink);
  background: var(--paper-light);
  font: 800 clamp(0.62rem, 0.85vw, 0.82rem)/1 var(--control-font);
  letter-spacing: 0.04em;
  transform: translateX(-50%) rotate(-1.5deg);
  white-space: nowrap;
}

.scene-subject:hover,
.scene-subject[aria-expanded="true"] {
  transform: translateY(-6px) rotate(-1deg);
}

.scene-subject--gyp {
  bottom: 0;
  left: 1%;
  width: 22%;
  height: 48%;
}

.scene-subject--muir {
  bottom: 22%;
  left: 61%;
  width: 12%;
  height: 37%;
}

.scene-subject--kirk {
  top: 11%;
  right: 8%;
  width: 10%;
  height: 25%;
}

.scene-subject--ginge {
  right: 17%;
  bottom: 0;
  width: 15%;
  height: 39%;
}

.scene-subject--elfie {
  right: auto;
  bottom: 0;
  left: 26%;
  width: 15%;
  height: 39%;
}

.scene-subject--ginge img,
.scene-subject--elfie img {
  transform: scaleX(-1);
}

.scene-landmark {
  top: 71%;
  left: 54.5%;
  width: auto;
  height: auto;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  transform: translateX(-50%);
  transition: transform 180ms ease;
}

.scene-landmark:hover,
.scene-landmark[aria-expanded="true"] {
  transform: translate(-50%, -6px) rotate(-1deg);
}

.scene-landmark > span {
  position: static;
  display: block;
  transform: rotate(-1.5deg);
}

.wind-control {
  top: 1rem;
  left: 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 42px;
  padding: 0.5rem 0.7rem;
  border: 2px solid var(--ink);
  color: var(--ink);
  background: var(--paper-light);
  font: 800 0.72rem/1 var(--control-font);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: 3px 3px 0 var(--thistle);
  cursor: pointer;
}

.wind-control span {
  font-size: 1.25rem;
  transition: transform 200ms ease;
}

.street-frame.is-gusting .wind-control span {
  transform: rotate(100deg);
}

.turbine {
  position: absolute;
  z-index: 3;
  width: 6.2%;
  height: 27%;
  color: #363936;
  opacity: 0.72;
  pointer-events: none;
}

.turbine--two {
  top: 31%;
  left: 26%;
  transform: scale(0.72);
  transform-origin: bottom center;
}

.turbine__mast {
  position: absolute;
  bottom: 0;
  left: calc(50% - 2px);
  width: 4px;
  height: 76%;
  border: 1px solid rgb(248 240 223 / 42%);
  border-radius: 60% 60% 0 0;
  background: currentColor;
}

.turbine__rotor {
  position: absolute;
  top: 19%;
  left: 50%;
  width: 76%;
  aspect-ratio: 1;
  animation: turbine-turn 8s linear infinite;
  transform: translate(-50%, -50%);
  transform-origin: center;
}

.turbine__rotor::after {
  position: absolute;
  top: calc(50% - 4px);
  left: calc(50% - 4px);
  width: 8px;
  height: 8px;
  border: 1px solid var(--paper-light);
  border-radius: 50%;
  background: currentColor;
  content: "";
}

.turbine__rotor i {
  position: absolute;
  top: calc(50% - 2px);
  left: 50%;
  width: 51%;
  height: 5px;
  border-radius: 100% 20% 20% 100%;
  background: currentColor;
  transform-origin: left center;
}

.turbine__rotor i:nth-child(1) {
  transform: rotate(0deg);
}

.turbine__rotor i:nth-child(2) {
  transform: rotate(120deg);
}

.turbine__rotor i:nth-child(3) {
  transform: rotate(240deg);
}

.street-frame.is-gusting .turbine__rotor {
  animation-duration: 1.1s;
}

@keyframes turbine-turn {
  to {
    transform: translate(-50%, -50%) rotate(1turn);
  }
}

.action-menu {
  position: absolute;
  z-index: 40;
  min-width: min(17rem, calc(100% - 24px));
  padding: 0.45rem;
  border: var(--line);
  color: var(--ink);
  background: var(--paper-light);
  box-shadow: 6px 6px 0 rgb(29 26 22 / 40%);
}

.action-menu__title {
  margin: 0;
  padding: 0.35rem 0.5rem 0.45rem;
  color: var(--muted-ink);
  font: 800 0.68rem/1 var(--control-font);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.action-menu [role="menuitem"] {
  display: block;
  width: 100%;
  padding: 0.75rem 0.8rem;
  border: 0;
  color: var(--paper-light);
  background: var(--ink);
  text-align: left;
  font: 800 0.86rem/1.25 var(--control-font);
  cursor: pointer;
}

.scene-status {
  max-width: 60rem;
  min-height: 2rem;
  margin: 1.3rem auto 0;
  padding-left: 1rem;
  border-left: 5px solid var(--thistle);
  color: var(--muted-ink);
  font-size: clamp(0.95rem, 1.5vw, 1.1rem);
  font-style: italic;
}

.scene-page__story-link {
  display: table;
  margin: 0.8rem auto 0;
}

.story-route {
  width: min(100% - 2rem, 960px);
  min-height: calc(100svh - 76px);
  margin: 0 auto;
  padding: clamp(3rem, 7vw, 6rem) clamp(1rem, 5vw, 4.5rem);
  border-right: 2px solid rgb(29 26 22 / 18%);
  border-left: 2px solid rgb(29 26 22 / 18%);
  background: rgb(248 240 223 / 52%);
}

.story-route > header > p:first-child,
.story-entry__name {
  margin: 0;
  color: var(--thistle);
  font: 800 0.72rem/1.2 var(--control-font);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.story-route > header > p:last-child {
  color: var(--muted-ink);
  font-size: 1.1rem;
}

.story-list {
  margin: 3rem 0;
  counter-reset: stories;
}

.story-entry {
  position: relative;
  padding: 2.1rem 0 2.2rem clamp(3.4rem, 8vw, 6rem);
  border-top: 2px solid rgb(29 26 22 / 28%);
  counter-increment: stories;
}

.story-entry::before {
  position: absolute;
  top: 1.85rem;
  left: 0;
  color: var(--paper-deep);
  content: counter(stories, decimal-leading-zero);
  font: 900 clamp(2.2rem, 5vw, 4rem)/1 var(--display-font);
}

.story-entry h2 {
  margin: 0.2rem 0 0.75rem;
  font: 800 clamp(1.6rem, 3.2vw, 2.45rem)/1.05 var(--display-font);
  letter-spacing: -0.025em;
}

.story-entry p:not(.story-entry__name) {
  max-width: 42rem;
  margin: 0.55rem 0;
  color: var(--muted-ink);
}

.story-dialog {
  position: fixed;
  z-index: 80;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgb(20 18 15 / 72%);
}

.story-dialog__panel {
  position: relative;
  width: min(100%, 640px);
  max-height: min(86vh, 720px);
  overflow: auto;
  padding: clamp(2rem, 6vw, 4.2rem);
  border: 4px solid var(--ink);
  background:
    radial-gradient(circle at 85% 10%, rgb(173 122 45 / 14%) 0 1px, transparent 2px),
    var(--paper-light);
  background-size: 17px 15px, auto;
  box-shadow: 10px 10px 0 var(--thistle), var(--soft-shadow);
  transform: rotate(-0.25deg);
}

.story-dialog__close {
  position: absolute;
  top: 0.7rem;
  right: 0.7rem;
  width: 44px;
  height: 44px;
  border: 2px solid var(--ink);
  background: transparent;
  font: 700 1.8rem/1 var(--control-font);
  cursor: pointer;
}

.story-dialog__kicker {
  margin: 0 0 0.35rem;
  color: var(--thistle);
  font: 800 0.72rem/1.2 var(--control-font);
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.story-dialog h2 {
  max-width: 13ch;
  margin: 0;
  font: 900 clamp(2.2rem, 6vw, 4.5rem)/0.95 var(--display-font);
  letter-spacing: -0.055em;
}

.story-dialog [data-dialog-copy] {
  margin-top: 1.5rem;
  color: var(--muted-ink);
  font-size: 1.05rem;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  width: min(100% - 2rem, 1380px);
  margin: 0 auto;
  padding: 1.4rem 0 2rem;
  border-top: 2px solid rgb(29 26 22 / 35%);
  color: var(--muted-ink);
  font: 0.8rem/1.4 var(--control-font);
}

.site-footer p {
  margin: 0;
}

.no-script {
  width: min(100% - 2rem, 760px);
  margin: 2rem auto;
  padding: 2rem;
  border: var(--line);
  background: var(--paper-light);
}

:focus-visible {
  outline: 4px solid #fff;
  outline-offset: 4px;
  box-shadow: 0 0 0 7px var(--thistle);
}

[hidden] {
  display: none !important;
}

@media (max-width: 980px) {
  .opening {
    grid-template-columns: 1fr;
    gap: 3.5rem;
    padding-top: 4rem;
  }

  .opening h1 {
    max-width: 11ch;
    font-size: clamp(3.8rem, 12vw, 7rem);
  }

  .scene-heading {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }
}

@media (max-width: 720px) {
  .site-header {
    width: min(100% - 1.2rem, 1380px);
    min-height: 66px;
  }

  .wordmark {
    font-size: 1.75rem;
  }

  .site-header nav {
    gap: 0.75rem;
    font-size: 0.66rem;
    letter-spacing: 0.04em;
  }

  .site-header nav a:first-child {
    display: none;
  }

  .opening {
    width: min(100% - 1.4rem, 1380px);
    min-height: auto;
    padding: 3.5rem 0 5rem;
  }

  .opening h1 {
    font-size: clamp(3.4rem, 17vw, 5.25rem);
  }

  .opening__copy::before {
    top: -1.7rem;
    left: -0.4rem;
    width: 4.5rem;
    height: 4.5rem;
  }

  .opening__announcement {
    font-size: 1.02rem;
  }

  .opening__actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .opening__picture {
    box-shadow: 5px 5px 0 var(--rain);
  }

  .opening__picture figcaption {
    right: 0.5rem;
    max-width: calc(100% - 1rem);
  }

  .scene-page {
    width: min(100% - 1rem, 1480px);
    padding-top: 1.8rem;
  }

  .scene-heading {
    margin-bottom: 1rem;
  }

  .scene-heading h1 {
    font-size: clamp(2.8rem, 13vw, 4rem);
  }

  .street-frame {
    aspect-ratio: 4 / 5;
    border-width: 4px;
    box-shadow: 5px 5px 0 var(--ochre);
  }

  .street-frame__backdrop {
    left: 50%;
    width: 178%;
    max-width: none;
    transform: translateX(-50%);
  }

  .scene-subject--gyp {
    bottom: -2%;
    left: -4%;
    width: 36%;
    height: 39%;
  }

  .scene-subject--muir {
    bottom: 27%;
    left: 54%;
    width: 21%;
    height: 31%;
  }

  .scene-subject--kirk {
    top: 15%;
    right: 3%;
    width: 16%;
    height: 20%;
  }

  .scene-subject--ginge {
    right: 1%;
    bottom: -1%;
    width: 25%;
    height: 29%;
  }

  .scene-subject--elfie {
    right: auto;
    bottom: -2%;
    left: 28%;
    width: 28%;
    height: 32%;
  }

  .scene-subject > span,
  .scene-landmark > span {
    font-size: 0.62rem;
  }

  .scene-landmark {
    top: 65%;
    left: 36%;
    width: auto;
    height: auto;
  }

  .wind-control {
    top: 0.65rem;
    left: 0.65rem;
    min-height: 38px;
    padding: 0.4rem 0.5rem;
    font-size: 0.64rem;
  }

  .turbine {
    width: 12%;
    height: 21%;
  }

  .turbine--two {
    top: 31%;
    left: 17%;
  }

  .action-menu {
    min-width: 14rem;
  }

  .story-route {
    width: min(100% - 1rem, 960px);
    padding-right: 1rem;
    padding-left: 1rem;
  }

  .story-entry {
    padding-left: 3.6rem;
  }

  .story-dialog__panel {
    padding: 3.6rem 1.3rem 2rem;
    box-shadow: 5px 5px 0 var(--thistle);
  }

  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
