:root {
  --bg: #08090c;
  --ink: #f3efe7;
  --dim: #b7b1a6;
  --quiet: #8d877d;
  --rose: #e4c2b4;
  --line: rgba(243, 239, 231, 0.14);
  --serif: "Fraunces", "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, serif;
  --sans: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  overflow-anchor: none;
}

body {
  margin: 0;
  background:
    radial-gradient(1.2px 1.2px at 14% 8%, rgba(243, 239, 231, 0.7), transparent),
    radial-gradient(1px 1px at 72% 4%, rgba(228, 194, 180, 0.8), transparent),
    radial-gradient(1.4px 1.4px at 90% 22%, rgba(243, 239, 231, 0.45), transparent),
    radial-gradient(1px 1px at 8% 46%, rgba(176, 198, 220, 0.45), transparent),
    radial-gradient(1px 1px at 84% 58%, rgba(243, 239, 231, 0.35), transparent),
    radial-gradient(1.2px 1.2px at 28% 72%, rgba(228, 194, 180, 0.4), transparent),
    radial-gradient(1px 1px at 62% 88%, rgba(243, 239, 231, 0.3), transparent),
    radial-gradient(900px 420px at 80% -8%, rgba(120, 78, 64, 0.22), transparent 58%),
    radial-gradient(700px 380px at -10% 30%, rgba(64, 86, 130, 0.12), transparent 55%),
    var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 300;
  line-height: 1.5;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

img,
video {
  max-width: 100%;
  height: auto;
  dynamic-range-limit: no-limit;
}

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

:focus-visible {
  outline: 1px solid var(--rose);
  outline-offset: 4px;
}

.skip {
  position: absolute;
  left: 1rem;
  top: -4rem;
  background: var(--ink);
  color: var(--bg);
  padding: 0.5rem 0.8rem;
  z-index: 20;
}

.skip:focus { top: 1rem; }

.wrap {
  width: min(1120px, calc(100% - 2rem));
  margin-inline: auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 6;
}

.nav {
  background: #08090c;
  border-bottom: 1px solid rgba(228, 194, 180, 0.16);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 3.6rem;
  padding-top: env(safe-area-inset-top);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.2rem;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-decoration: none;
}

.mark {
  width: 0.72rem;
  height: 0.72rem;
  border: 1px solid var(--rose);
  border-radius: 50%;
  box-shadow: inset 0 0 0 2px rgba(8, 9, 12, 0.95), inset 0 0 0 3px var(--rose);
}

.nav nav {
  display: flex;
  gap: 1.25rem;
}

.nav nav a {
  color: var(--dim);
  text-decoration: none;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.nav nav a:hover { color: var(--ink); }

.intro {
  padding: 1.15rem 0 0;
  scroll-margin-top: calc(var(--pin, 8rem) + 0.4rem);
}

.kicker {
  margin: 0;
  color: var(--rose);
  font-size: 0.74rem;
  font-weight: 400;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

h1 {
  margin: 0.15rem 0 0;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(2.35rem, 6vw, 3.8rem);
  line-height: 0.92;
  letter-spacing: -0.04em;
  font-variation-settings: "opsz" 144, "SOFT" 40, "WONK" 0;
}

.ornament {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 0.55rem 0 0;
}

.ornament::before,
.ornament::after {
  content: "";
  height: 1px;
  width: 7.5rem;
  background: linear-gradient(90deg, transparent, var(--rose));
}

.ornament::after {
  background: linear-gradient(90deg, var(--rose), transparent);
}

.ornament span {
  width: 7px;
  height: 7px;
  border: 1px solid var(--rose);
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(228, 194, 180, 0.16);
}

.hdr-note {
  background: linear-gradient(90deg, #3a221c, #121216 42%, #161e2e);
  border-bottom: 1px solid rgba(228, 194, 180, 0.45);
}

.hdr-note-inner {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.7rem 1.25rem;
  align-items: center;
  padding: 0.7rem 0;
}

.hdr-note p {
  margin: 0;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.45;
}

.dismiss {
  justify-self: start;
  background: transparent;
  border: 1px solid rgba(228, 194, 180, 0.55);
  color: var(--ink);
  font: inherit;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  text-align: left;
  cursor: pointer;
  padding: 0.45rem 0.7rem;
  min-height: 44px;
}

.dismiss:hover { border-color: var(--rose); }

.story {
  padding: 1.35rem 0 0.25rem;
  scroll-margin-top: calc(var(--pin, 8rem) + 0.4rem);
}

.story-body p {
  margin: 0.7rem 0 0;
  max-width: none;
  font-family: var(--serif);
  font-weight: 300;
  font-size: 0.98rem;
  line-height: 1.55;
}

.story-body p:last-child {
  margin-top: 1rem;
  font-style: italic;
}

.contents {
  padding: 1.5rem 0 0.25rem;
  scroll-margin-top: calc(var(--pin, 8rem) + 0.4rem);
}

.index {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 1.15rem;
  margin-top: 0.9rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--line);
}

.index a {
  color: var(--quiet);
  text-decoration: none;
  font-size: 0.92rem;
}

.index a:hover,
.index a[aria-current="true"] { color: var(--ink); }

.plates { padding-bottom: 2rem; }

.plate {
  margin-top: clamp(2.6rem, 6vh, 4.5rem);
  scroll-margin-top: calc(var(--pin, 8rem) + 0.6rem);
}

.plate-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem 2rem;
  margin-bottom: 0.75rem;
}

.cat {
  margin: 0;
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(1.45rem, 2.4vw, 1.85rem);
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.cat span {
  font-style: italic;
  font-weight: 300;
  margin-right: 0.4rem;
}

.where {
  margin: 0;
  color: var(--quiet);
  font-size: 0.82rem;
  letter-spacing: 0.03em;
  text-align: right;
}

.frame {
  display: block;
  padding: 8px;
  border: 1px solid rgba(228, 194, 180, 0.28);
  cursor: zoom-in;
  color: inherit;
  text-decoration: none;
  background:
    linear-gradient(var(--rose), var(--rose)) left 6px top 6px / 16px 1px no-repeat,
    linear-gradient(var(--rose), var(--rose)) left 6px top 6px / 1px 16px no-repeat,
    linear-gradient(var(--rose), var(--rose)) right 6px top 6px / 16px 1px no-repeat,
    linear-gradient(var(--rose), var(--rose)) right 6px top 6px / 1px 16px no-repeat,
    linear-gradient(var(--rose), var(--rose)) left 6px bottom 6px / 16px 1px no-repeat,
    linear-gradient(var(--rose), var(--rose)) left 6px bottom 6px / 1px 16px no-repeat,
    linear-gradient(var(--rose), var(--rose)) right 6px bottom 6px / 16px 1px no-repeat,
    linear-gradient(var(--rose), var(--rose)) right 6px bottom 6px / 1px 16px no-repeat,
    #05060a;
}

.frame img,
.frame video {
  display: block;
  width: 100%;
  height: auto;
  background: #05060a;
  pointer-events: none;
}

.plate.is-portrait .frame {
  max-width: 680px;
  margin-inline: auto;
}

.aside {
  margin: 0.75rem 0 0;
  max-width: 38rem;
  color: var(--dim);
  font-size: 0.95rem;
  line-height: 1.5;
}

@supports (animation-timeline: view()) {
  .plate {
    animation: rise linear both;
    animation-timeline: view();
    animation-range: entry 0% cover 22%;
  }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

.footer {
  padding: 4.5rem 0 3rem;
  color: var(--quiet);
  font-size: 0.88rem;
}

.footer p { margin: 0.25rem 0; }

.footer .warn { color: var(--dim); max-width: 36rem; }

dialog {
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  background: #05060a;
  color: var(--ink);
}

dialog::backdrop { background: #05060a; }

.viewer-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  min-height: 4.25rem;
  padding: max(0.75rem, env(safe-area-inset-top)) max(1rem, env(safe-area-inset-right)) 0.4rem max(1rem, env(safe-area-inset-left));
}

.viewer-title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 300;
  font-size: 1.15rem;
}

.viewer-place,
.viewer-mode {
  margin: 0.1rem 0 0;
  color: var(--quiet);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
}

.viewer-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.viewer-actions button {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  font: inherit;
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  min-height: 44px;
}

.viewer-actions button:hover { border-color: var(--rose); }

.viewer-stage {
  height: calc(100dvh - 4.5rem - env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  padding: 0.25rem 1rem max(1rem, env(safe-area-inset-bottom));
  position: relative;
}

.viewer-stage img,
.viewer-stage video {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  pointer-events: none;
}

.viewer-status {
  position: absolute;
  margin: 0;
  color: var(--dim);
  font-size: 0.9rem;
}

.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;
}

@media (max-width: 700px) {
  .plate-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
  }

  .where { text-align: left; }

  .hdr-note-inner { grid-template-columns: 1fr; }

  .ornament::before,
  .ornament::after { width: 3.5rem; }

  .viewer-bar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .viewer-actions { width: 100%; }

  .viewer-actions button { flex: 1; }

  .plate.is-portrait .frame { max-width: none; }
}

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

  .plate {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
  }
}
