:root {
  color-scheme: dark;
  --ink: #1b120b;
  --paper: #eadcaf;
  --focus: #fff36d;
}

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

html {
  min-width: 320px;
  background: #120a04;
}

body {
  min-width: 320px;
  margin: 0;
  overflow-x: clip;
  background: #120a04;
  color: var(--ink);
  font-family: "Arial Narrow", "Franklin Gothic Medium", Arial, system-ui, sans-serif;
  line-height: 1.28;
}

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

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 0.75rem;
  left: 0.75rem;
  min-height: 2.75rem;
  padding: 0.75rem 1rem;
  border: 0.2rem solid #000;
  background: var(--focus);
  color: #000;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transform: translateY(-180%);
}

.skip-link:focus-visible {
  outline: 0.22rem solid #fff;
  outline-offset: 0.2rem;
  transform: translateY(0);
}

.site-header {
  position: fixed;
  z-index: 100;
  inset: 0 0 auto;
  min-height: 0.65rem;
  pointer-events: none;
}

.site-nav-trigger,
.site-back-link {
  position: absolute;
  z-index: 3;
  top: env(safe-area-inset-top, 0px);
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  padding: 0.3rem;
  border: 0;
  color: rgba(255, 243, 207, 0.78);
  background: transparent;
  font: 900 0.58rem/1 "Arial Narrow", "Franklin Gothic Medium", Arial, sans-serif;
  letter-spacing: 0.12em;
  text-decoration: none;
  text-shadow: 0 0.1rem 0.45rem #000;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: auto;
  cursor: pointer;
}

.site-nav-trigger {
  right: calc(0.55rem + env(safe-area-inset-right, 0px));
  min-width: 2.75rem;
  justify-content: center;
}

.site-back-link {
  left: calc(0.55rem + env(safe-area-inset-left, 0px));
  z-index: 4;
  min-width: 5.25rem;
  min-height: 3rem;
  touch-action: manipulation;
}

.site-nav-trigger:is(:hover, :focus-visible),
.site-back-link:is(:hover, :focus-visible),
.site-header[data-open="true"] .site-nav-trigger {
  color: var(--focus);
  outline-color: var(--focus);
}

.fallback-nav {
  position: absolute;
  z-index: 2;
  inset: 0 0 auto;
  width: 100%;
  padding: 0 4.8rem;
  background: linear-gradient(180deg, rgba(18, 10, 4, 0.98), rgba(18, 10, 4, 0.82));
  opacity: 0;
  pointer-events: none;
  transform: translateY(calc(-100% - 0.2rem));
  transition: opacity 160ms ease, transform 180ms ease;
}

.site-header:is(:hover, :focus-within) .fallback-nav,
.site-header[data-open="true"] .fallback-nav {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.fallback-nav ul {
  display: flex;
  min-height: 2.75rem;
  align-items: center;
  justify-content: center;
  gap: clamp(0.5rem, 2.2vw, 1.65rem);
  margin: 0;
  padding: 0;
  list-style: none;
}

.fallback-nav a {
  display: inline-flex;
  min-height: 2.75rem;
  align-items: center;
  color: rgba(255, 243, 207, 0.78);
  font-size: clamp(0.59rem, 1vw, 0.72rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
  white-space: nowrap;
}

.fallback-nav a:is(:hover, :focus-visible),
.fallback-nav a[aria-current="page"] {
  color: var(--focus);
}

@media (max-width: 767px), (max-width: 1100px) and (orientation: portrait) {
  .fallback-nav {
    padding: 0.35rem 5rem;
  }

  .fallback-nav ul {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0;
  }

  .fallback-nav a {
    justify-content: center;
    font-size: 0.59rem;
    text-align: center;
    white-space: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  .fallback-nav { transition: none; }
}

.infinite-board {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-height: 100vh;
  height: var(--board-height, 100vh);
  overflow: hidden;
  background:
    radial-gradient(circle at 19% 11%, rgba(218, 142, 61, 0.17) 0 0.07rem, transparent 0.11rem),
    radial-gradient(circle at 73% 61%, rgba(29, 13, 4, 0.22) 0 0.08rem, transparent 0.13rem),
    repeating-linear-gradient(104deg, transparent 0 3.8rem, rgba(43, 20, 6, 0.045) 3.84rem 3.91rem),
    #6f3e18;
  background-size: 4.9rem 4.4rem, 6.1rem 5.7rem, auto, auto;
}

.infinite-board::after {
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.36), transparent 7%, transparent 93%, rgba(0, 0, 0, 0.36)),
    repeating-linear-gradient(173deg, transparent 0 8.7rem, rgba(33, 15, 4, 0.035) 8.74rem 8.82rem);
  content: "";
  mix-blend-mode: multiply;
}

.board-world {
  position: absolute;
  z-index: -2;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
}

.board-world-segment {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  object-fit: contain;
}

.board-notes {
  position: absolute;
  z-index: 2;
  inset: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.board-page-sentinel {
  position: absolute;
  z-index: -1;
  left: 50%;
  top: max(40vh, calc(var(--board-height) - 150vh));
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.board-note {
  container-type: inline-size;
  position: absolute;
  z-index: var(--note-layer);
  left: var(--note-x);
  top: var(--note-y);
  width: var(--note-width);
  height: var(--note-height);
  transform: translate(var(--note-offset-x, 0), var(--note-offset-y, 0)) rotate(var(--note-rotation)) scale(var(--note-scale, 1));
  transform-origin: 50% 11%;
}

.note-article,
.note-paper {
  width: 100%;
  height: 100%;
}

.note-article {
  position: relative;
  filter: drop-shadow(0.35rem 0.48rem 0.28rem rgba(17, 7, 2, 0.57));
}

.note-paper,
.photo-mount,
.note-copy {
  position: absolute;
}

.note-paper {
  z-index: 2;
  inset: 0;
  display: block;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.photo-mount {
  z-index: 2;
  inset: 0;
}

.photo-media,
.photo-overlay {
  position: absolute;
  display: block;
}

.photo-media {
  object-fit: cover;
  filter: sepia(0.28) contrast(1.08) saturate(0.78);
}

.photo-overlay {
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.photo-mount--frame .photo-media {
  z-index: 1;
  left: var(--aperture-left);
  top: var(--aperture-top);
  width: var(--aperture-width);
  height: var(--aperture-height);
}

.photo-mount--accessory {
  inset: 7% 8% 18%;
  background: #e5d7b7;
  box-shadow: 0.28rem 0.4rem 0.34rem rgba(16, 7, 2, 0.52);
}

.photo-mount--accessory .photo-media {
  z-index: 1;
  inset: 7% 7% 16%;
  width: 86%;
  height: 77%;
}

.photo-mount--accessory .photo-overlay {
  inset: -18% -14% auto;
  width: 128%;
  height: 44%;
  object-fit: contain;
}

.photo-mount--black-corner .photo-overlay {
  inset: auto -7% -5% auto;
  width: 38%;
  height: 38%;
}

.note-copy {
  z-index: 3;
  top: var(--safe-top);
  right: var(--safe-right);
  bottom: var(--safe-bottom);
  left: var(--safe-left);
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: flex-start;
  overflow: visible;
  color: #21150d;
  font-family: "Courier New", Courier, monospace;
  font-size: clamp(0.82rem, 3.5cqw, 1.04rem);
  font-variant-ligatures: none;
  overflow-wrap: anywhere;
  text-shadow: 0.025em 0.025em rgba(54, 29, 14, 0.25);
}

.note-copy h2,
.note-copy p,
.note-copy time {
  margin: 0;
}

.note-copy h2 {
  font-size: clamp(0.94rem, 5.1cqw, 1.56rem);
  font-weight: 700;
  letter-spacing: -0.045em;
  line-height: 0.96;
}

.note-copy time {
  order: -1;
  margin-bottom: 0.5em;
  margin-left: -0.16em;
  color: #61463c;
  font-size: clamp(0.62rem, 0.64em, 0.72rem);
  font-weight: 600;
  letter-spacing: 0.055em;
  line-height: 1;
  text-transform: uppercase;
  opacity: 0.66;
  transform: rotate(-0.8deg);
  transform-origin: left center;
  mix-blend-mode: multiply;
}

.note-copy p {
  margin-top: 0.52em;
  font-weight: 600;
  white-space: pre-line;
}

.board-note--long .note-copy {
  font-size: clamp(0.82rem, 2.95cqw, 0.96rem);
  line-height: 1.2;
}

.board-note--long .note-copy h2 {
  font-size: clamp(0.92rem, 4.05cqw, 1.32rem);
  line-height: 0.96;
}

.board-note--tiny .note-copy,
.board-note--family-receipt .note-copy {
  font-size: clamp(0.75rem, 5.15cqw, 0.88rem);
  line-height: 1.12;
  text-align: center;
}

.board-note--tiny .note-copy h2,
.board-note--family-receipt .note-copy h2 {
  font-size: clamp(0.78rem, 6.4cqw, 0.98rem);
  line-height: 0.96;
}

.board-note--wide .note-copy {
  justify-content: center;
  text-align: center;
}

.board-note--photo .note-copy {
  top: auto;
  right: 14%;
  bottom: 5%;
  left: 14%;
  height: 12%;
  justify-content: flex-end;
  text-align: center;
}

.board-note--photo .note-copy h2 {
  font-size: clamp(0.78rem, 4.7cqw, 1.1rem);
}

.board-note--photo .note-copy p {
  font-size: 0.86em;
}

.note-type--condensed .note-copy {
  font-family: "Arial Narrow", "Franklin Gothic Medium", Arial, system-ui, sans-serif;
  letter-spacing: 0.012em;
}

.note-type--condensed .note-copy h2 {
  font-weight: 700;
  letter-spacing: -0.012em;
}

.note-type--notice .note-copy h2 {
  font-family: Impact, "Arial Black", "Franklin Gothic Heavy", system-ui, sans-serif;
  font-weight: 400;
  letter-spacing: 0.012em;
  line-height: 0.92;
}

.note-type--notice .note-copy p {
  letter-spacing: -0.025em;
}

.board-failure {
  position: relative;
  z-index: 100;
  width: min(90%, 36rem);
  margin: 8rem auto;
  padding: 1rem;
  border: 0.18rem solid #1d0e07;
  background: var(--paper);
  color: var(--ink);
  font-weight: 900;
}

@media (max-width: 767px) {
  .infinite-board::after {
    background:
      linear-gradient(90deg, rgba(0, 0, 0, 0.4), transparent 10%, transparent 90%, rgba(0, 0, 0, 0.4)),
      repeating-linear-gradient(173deg, transparent 0 7rem, rgba(33, 15, 4, 0.03) 7.04rem 7.12rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media (forced-colors: active) {
  .board-world,
  .note-paper,
  .photo-overlay,
  .infinite-board::after {
    opacity: 0.18;
  }

  .note-copy {
    padding: 0.35rem;
    background: Canvas;
    color: CanvasText;
    text-shadow: none;
  }
}
