/* Prism — end of life. Tokens follow the Prism website's DESIGN.md:
   cream canvas by day, warm ink by night; seafoam marks the path, amber adds warmth. */

:root {
  color-scheme: light dark;

  --bg: hsl(40 30% 97%);
  --card: hsl(40 25% 95%);
  --fg: hsl(220 20% 15%);
  --body: hsl(220 13% 30%);
  --muted: hsl(220 10% 42%);
  --rule: hsl(40 15% 86%);
  --accent: hsl(165 52% 32%);
  --accent-hover: hsl(165 55% 24%);
  --seafoam: hsl(165 42% 50%);
  --wash-seafoam: hsl(165 45% 85%);
  --wash-amber: hsl(35 60% 85%);
  --selection: hsl(165 45% 85%);
  --grain-opacity: 0.05;
  --lights-rest: 0.55;

  --font-display: "Playfair Display", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-body: "DM Sans", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --gutter: clamp(1.25rem, 5vw, 3rem);
  --column: 40rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: hsl(30 8% 6%);
    --card: hsl(30 7% 10%);
    --fg: hsl(36 22% 92%);
    --body: hsl(36 12% 78%);
    --muted: hsl(36 9% 64%);
    --rule: hsl(30 6% 18%);
    --accent: hsl(165 52% 58%);
    --accent-hover: hsl(165 58% 70%);
    --seafoam: hsl(165 45% 52%);
    --wash-seafoam: hsl(165 45% 52%);
    --wash-amber: hsl(35 80% 58%);
    --selection: hsl(168 22% 22%);
    --grain-opacity: 0.05;
    --lights-rest: 0.4;
  }
}

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

html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scrollbar-color: var(--rule) var(--bg);
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--body);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

::selection {
  background: var(--selection);
  color: var(--fg);
}

a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
  transition: color 160ms ease, text-decoration-color 160ms ease;
}

a:hover {
  color: var(--accent-hover);
  text-decoration-color: currentColor;
}

a:focus-visible {
  outline: 2px solid var(--seafoam);
  outline-offset: 3px;
  border-radius: 3px;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  color: var(--fg);
  font-weight: 600;
  text-wrap: balance;
  margin: 0;
}

p {
  margin: 0;
  text-wrap: pretty;
}

.skip {
  position: absolute;
  left: var(--gutter);
  top: -4rem;
  padding: 0.5rem 1rem;
  background: var(--card);
  color: var(--fg);
  border: 1px solid var(--rule);
  border-radius: 999px;
  z-index: 10;
}

.skip:focus-visible {
  top: 1rem;
}

/* Very large displays: scale the whole column up rather than leaving a small island. */
@media (min-width: 1800px) {
  html {
    font-size: 112.5%;
  }
}

@media (min-width: 2400px) {
  html {
    font-size: 125%;
  }
}

/* ---------- Atmosphere: the light over the room, and film grain ---------- */

.lights {
  position: absolute;
  inset: 0 0 auto 0;
  height: min(52rem, 120vh);
  pointer-events: none;
  z-index: 0;
  opacity: var(--lights-rest);
  background:
    radial-gradient(42rem 30rem at calc(50% - 17rem) 6%, color-mix(in srgb, var(--wash-seafoam) 70%, transparent), transparent 70%),
    radial-gradient(34rem 26rem at calc(50% + 24rem) -6%, color-mix(in srgb, var(--wash-amber) 55%, transparent), transparent 72%);
}

@media (prefers-color-scheme: dark) {
  .lights {
    background:
      radial-gradient(40rem 28rem at calc(50% - 17rem) 4%, color-mix(in srgb, var(--wash-seafoam) 16%, transparent), transparent 70%),
      radial-gradient(32rem 24rem at calc(50% + 24rem) -8%, color-mix(in srgb, var(--wash-amber) 10%, transparent), transparent 72%);
  }
}

.grain {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: var(--grain-opacity);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.5 0 0 0 0 0.45 0 0 0 0 0.4 0 0 0 1.1 -0.1'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.page,
.site-footer,
.doc-header {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: calc(var(--column) + 2 * var(--gutter));
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.page {
  flex: 1;
}

/* ---------- The slate (Prism's clapperboard, split at the hinge) ---------- */

.slate {
  position: relative;
  display: block;
  --slate-size: clamp(7rem, 22vw, 10rem);
  width: var(--slate-size);
  aspect-ratio: 1;
  /* The artwork's board starts 145px into its 1024px canvas; pull it onto the text edge. */
  margin-left: calc(var(--slate-size) * -0.1416);
}

.slate img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

/* Pivot measured on the 1024px artwork: (279, 354). Closing angle 16.5deg lays the
   top stick flat on the lower one. The resting state is closed, so the page reads
   correctly with no motion at all. */
.slate-arm {
  transform-origin: 27.25% 34.57%;
  transform: rotate(16.5deg);
}

.slate-shadow {
  position: absolute;
  left: 14%;
  right: 12%;
  bottom: 1%;
  height: 10%;
  border-radius: 50%;
  background: radial-gradient(closest-side, hsl(165 40% 20% / 0.16), transparent);
  filter: blur(6px);
}

@media (prefers-color-scheme: dark) {
  .slate-shadow {
    background: radial-gradient(closest-side, hsl(165 50% 45% / 0.16), transparent);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .slate-arm {
    animation: slate-close 1650ms both;
  }

  .lights {
    animation: lights-down 5200ms both;
  }
}

/* Hold open, then a short accelerating strike that stops dead: a real clap, no bounce. */
@keyframes slate-close {
  0%,
  58% {
    transform: rotate(0deg);
    animation-timing-function: cubic-bezier(0.5, 0, 0.92, 0.42);
  }
  100% {
    transform: rotate(16.5deg);
  }
}

/* House lights: up while the slate is open, then a slow fade to rest after the clap. */
@keyframes lights-down {
  0%,
  30% {
    opacity: 1;
    animation-timing-function: cubic-bezier(0.33, 0, 0.2, 1);
  }
  100% {
    opacity: var(--lights-rest);
  }
}

/* ---------- Home: one reading column, one left edge ---------- */

.hero {
  padding-top: clamp(3.5rem, 12vh, 8.5rem);
}

.hero h1 {
  margin-top: clamp(1.25rem, 3vw, 2rem);
  font-size: clamp(3.1rem, 11vw, 5.5rem);
  line-height: 1;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.lede {
  margin-top: clamp(1.25rem, 2.5vw, 1.5rem);
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.3rem, 2.4vw, 1.6rem);
  line-height: 1.4;
  color: var(--fg);
}

.route-note {
  margin-top: 1.5rem;
  padding: 0.85rem 1.1rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 0.75rem;
  font-size: 0.9375rem;
  line-height: 1.55;
}

.route-note[hidden] {
  display: none;
}

.letter {
  margin-top: clamp(3rem, 8vw, 5rem);
}

.letter-intro {
  font-size: clamp(1.0625rem, 1.5vw, 1.1875rem);
  line-height: 1.7;
}

.notes {
  margin: clamp(2.5rem, 5vw, 3.25rem) 0 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--rule);
}

.note {
  padding: clamp(1.5rem, 3vw, 1.85rem) 0;
  border-bottom: 1px solid var(--rule);
}

.note h2 {
  font-size: clamp(1.25rem, 2vw, 1.4rem);
  line-height: 1.25;
  margin-bottom: 0.5rem;
}

.thanks {
  margin-top: clamp(3.5rem, 9vw, 6rem);
  padding-bottom: clamp(3rem, 8vw, 5rem);
}

.thanks p {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: clamp(2.4rem, 7.5vw, 4rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
  color: var(--fg);
  text-wrap: balance;
}

/* ---------- Sign-in hand-off pages ---------- */

.handoff {
  padding-top: clamp(3rem, 10vh, 7rem);
  padding-bottom: clamp(3rem, 8vw, 5rem);
}

.handoff h1 {
  font-size: clamp(2.2rem, 7vw, 3.25rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
  font-weight: 700;
}

.handoff p {
  margin-top: 1rem;
}

.handoff .farewell-note {
  margin-top: clamp(2.5rem, 6vw, 3.5rem);
  padding: 0.85rem 1.1rem;
  border: 1px solid var(--rule);
  border-radius: 0.75rem;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--muted);
}

.farewell-note a {
  color: var(--fg);
}

/* ---------- Footer ---------- */

.site-footer {
  padding-top: 1.75rem;
  padding-bottom: max(2rem, env(safe-area-inset-bottom));
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 2rem;
  justify-content: space-between;
  align-items: baseline;
  font-size: 0.875rem;
  color: var(--muted);
}

.site-footer::before {
  content: "";
  position: absolute;
  top: 0;
  left: var(--gutter);
  right: var(--gutter);
  border-top: 1px solid var(--rule);
}

.site-footer nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-footer a {
  color: var(--muted);
  text-decoration-color: transparent;
  display: inline-block;
  padding: 0.35rem 0;
}

.site-footer a:hover {
  color: var(--fg);
  text-decoration-color: currentColor;
}

.site-footer a[aria-current="page"] {
  color: var(--fg);
}

/* ---------- Archived legal pages ---------- */

.doc-header {
  padding-top: 1.25rem;
}

.home-link {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--fg);
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.2rem;
  padding: 0.25rem 0.5rem 0.25rem 0;
}

.home-link:hover {
  color: var(--fg);
}

.home-link img {
  width: 2.5rem;
  height: 2.5rem;
  margin-left: -0.35rem;
}

.doc {
  padding-top: clamp(2.5rem, 7vw, 4.5rem);
  padding-bottom: clamp(3rem, 8vw, 5rem);
}

.doc h1 {
  font-size: clamp(2.4rem, 7vw, 3.5rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
  font-weight: 700;
}

.doc .updated {
  margin-top: 0.75rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.archived {
  margin-top: 1.75rem;
  padding: 1rem 1.25rem;
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: 0.75rem;
  font-size: 0.9375rem;
  line-height: 1.6;
  color: var(--body);
}

.archived strong {
  color: var(--fg);
  font-weight: 600;
}

.doc-body {
  margin-top: clamp(2.5rem, 6vw, 3.5rem);
  font-size: 0.9875rem;
  line-height: 1.7;
}

.doc-body section + section {
  margin-top: 2.25rem;
}

.doc-body h2 {
  font-size: 1.3rem;
  line-height: 1.3;
  margin-bottom: 0.75rem;
}

.doc-body p + p,
.doc-body p + ul,
.doc-body ul + p {
  margin-top: 0.75rem;
}

.doc-body ul {
  margin: 0;
  padding-left: 1.25rem;
}

.doc-body li + li {
  margin-top: 0.4rem;
}

.doc-body li::marker {
  color: var(--muted);
}

.doc-body strong {
  color: var(--fg);
  font-weight: 600;
}

.doc-body a {
  overflow-wrap: anywhere;
}

@media print {
  .lights,
  .grain {
    display: none;
  }
}
