/* ==========================================================================
   Z-INDEX LAYERS
   0   - Canvas background
   10  - Center logo (behind overlays)
   100 - Page content / overlays
   200 - Chrome (nav, footer, controls)
   210 - Dropdowns (lang menu)
   ========================================================================== */

* { margin: 0; padding: 0; }

:root {
  --cursor-light: url('/static/cursor-light.svg') 12 12;
  --cursor-dark: url('/static/cursor-dark.svg') 12 12;
  --mono-font: 'Departure Mono', 'SFMono-Regular', ui-monospace, monospace;
  --serif-font: 'PlantinNow', 'Plantin MT Pro', 'Plantin MT Std', 'Plantin', Georgia, serif;
  --viewport-height: 100vh;
  --overlay-top-safe-zone: 30px;
  --overlay-bottom-safe-zone: 170px;
  --overlay-card-chrome: 150px;
  --overlay-close-clearance: 0px;
  --overlay-border-gap: 2px;
}

@supports (height: 100dvh) {
  :root {
    --viewport-height: 100dvh;
  }
}

html, body {
  cursor: var(--cursor-light), auto;
  background: #b8b8b8;
  overflow: hidden;
}

body.has-overlay {
  overflow: hidden;
  height: var(--viewport-height);
}

html:has(body.has-overlay) {
  overflow: hidden;
}

.theme-night, .theme-night body {
  background: #1a1a1a;
}

* { cursor: inherit; }

a {
  cursor: var(--cursor-light), pointer;
}

a:hover {
  cursor: var(--cursor-dark), pointer;
}

.theme-night a {
  cursor: var(--cursor-dark), pointer;
}

.theme-night a:hover {
  cursor: var(--cursor-light), pointer;
}

/* ==========================================================================
   ANNOUNCEMENT BANNER
   ========================================================================== */

:root {
  --banner-height: 34px;
}

.announcement-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 210;
  height: var(--banner-height);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0 20px;
}

.announcement-banner a {
  font: 14px/1 var(--mono-font);
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.95);
  text-decoration: none;
  text-shadow: 0 0 4px rgba(255, 255, 255, 0);
  transition: text-shadow 0.3s ease;
  cursor: var(--cursor-light), pointer;
}

.announcement-banner a:hover {
  color: rgba(255, 255, 255, 0.95);
  text-shadow: 0 0 4px rgba(255, 255, 255, 0.9);
  cursor: var(--cursor-dark), pointer;
}

.theme-night .announcement-banner a {
  cursor: var(--cursor-dark), pointer;
}

.theme-night .announcement-banner a:hover {
  cursor: var(--cursor-light), pointer;
}

.theme-night .announcement-banner {
  border-bottom-color: rgba(255, 255, 255, 0.15);
}

/* ==========================================================================
   LAYER 0: Canvas Background
   ========================================================================== */

canvas {
  display: block;
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 0;
  image-rendering: auto;
  opacity: 0;
  transition: opacity 1000ms ease;
}

@supports (height: 100dvh) {
  canvas {
    height: 100dvh;
  }
}

canvas.shader-ready { 
  opacity: 1; 
}

#overlay-guide-line {
  position: fixed;
  left: 10px;
  width: 1px;
  top: var(--overlay-top-safe-zone);
  bottom: var(--overlay-bottom-safe-zone);
  pointer-events: none;
  opacity: 0;
  z-index: 1;
}

/* ==========================================================================
   LAYER 10: Center Logo
   ========================================================================== */

.center-logo {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 10;
  display: block;
  text-decoration: none;
}

.main-logo {
  width: 300px;
  max-width: 65vw;
  opacity: 0;
  transition: opacity 0.35s ease;
}

.loaded .main-logo,
.skip-intro .main-logo {
  opacity: 0.85;
}

body:has(.page[data-page-type="home"]) .center-logo,
body:has(.page[data-page-type="corner-logo"]) .center-logo {
  left: calc(75px + 10px);
  top: calc(75px + var(--banner-height));
  transform: none;
}

body:has(.page[data-page-type="home"]) .main-logo,
body:has(.page[data-page-type="corner-logo"]) .main-logo {
  width: 122px;
  max-width: calc(65vw * 0.41);
}

/* ==========================================================================
   LAYER 100: Page Content / Overlays
   ========================================================================== */

.page {
  position: relative;
  z-index: 100;
}

.home-hero {
  position: relative;
  min-height: var(--viewport-height);
  display: grid;
  place-items: center;
  box-sizing: border-box;
  padding-top: 4vh;
  text-align: center;
  color: rgba(255, 255, 255, 0.95);
}

.home-hero-text {
  margin: 0;
  font-family: var(--serif-font);
  font-size: clamp(20.16px, 2.16vw, 37.44px);
  line-height: 1.12;
  font-style: italic;
  font-weight: 400;
  text-wrap: balance;
}

.home-hero-open-clause {
  white-space: nowrap;
}

.home-hero-tail-clause {
  display: inline-block;
  max-width: 100%;
  vertical-align: baseline;
}

.home-hero-link,
.home-hero-open {
  position: relative;
  display: inline-block;
  --hero-star-size: 15px;
  --hero-star-gap: 3px;
  text-decoration-line: underline;
  text-decoration-style: dotted;
  text-decoration-thickness: 0.03em;
  text-underline-offset: 0.08em;
}

.home-hero-link,
.home-hero-open {
  color: inherit;
  text-shadow: 0 0 4px rgba(255, 255, 255, 0);
  transition: text-shadow 0.3s ease;
  cursor: var(--cursor-light), pointer;
}

.home-hero-link:hover,
.home-hero-open:hover {
  color: inherit;
  text-decoration: none;
  text-shadow: 0 0 4px rgba(255, 255, 255, 0.9);
  cursor: var(--cursor-dark), pointer;
}

.theme-night .home-hero-link,
.theme-night .home-hero-open {
  cursor: var(--cursor-dark), pointer;
}

.theme-night .home-hero-link:hover,
.theme-night .home-hero-open:hover {
  cursor: var(--cursor-light), pointer;
}

.home-hero-link::before,
.home-hero-open::after {
  content: "";
  position: absolute;
  left: 50%;
  width: var(--hero-star-size);
  height: var(--hero-star-size);
  transform: translateX(-50%);
  transform-origin: center;
  background: url('/static/cursor-light.svg') center/contain no-repeat;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.home-hero-link::before {
  top: calc(-1 * (var(--hero-star-size) + var(--hero-star-gap)));
}

.home-hero-open::after {
  bottom: calc(-1 * (var(--hero-star-size) + var(--hero-star-gap)) + 4px);
}

.home-hero-link:hover::before,
.home-hero-open:hover::after {
  opacity: 1;
  animation: heroWordStarSpin 0.85s linear infinite;
}

@keyframes heroWordStarSpin {
  from {
    transform: translateX(-50%) rotate(0deg);
  }
  to {
    transform: translateX(-50%) rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .home-hero-link:hover::before,
  .home-hero-open:hover::after {
    animation: none;
  }
}


.updates-overlay {
  position: relative;
  min-height: var(--viewport-height);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: var(--overlay-top-safe-zone) 30px var(--overlay-bottom-safe-zone);
  background: transparent;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  clip-path: none;
}

.updates-overlay:target,
.updates-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.updates-overlay.is-closing {
  opacity: 0;
  pointer-events: none;
}

.updates-letter {
  --letter-inline-padding: 70px;
  --overlay-scrollbar-inset: 18px;
  position: relative;
  width: min(1000px, 92vw);
  margin: 0;
  max-height: calc(var(--viewport-height) - var(--overlay-top-safe-zone) - var(--overlay-bottom-safe-zone) - var(--overlay-border-gap));
  overflow: hidden;
  padding: 78px var(--letter-inline-padding) 72px;
  box-sizing: border-box;
  pointer-events: auto;
  background: linear-gradient(rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.08)), url('/static/paper.png') center/256px 256px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(25, 20, 12, 0.2);
  font: 15px/1.5 var(--mono-font);
  color: #1c1b1a;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.35s ease, transform 0.35s ease;
  cursor: var(--cursor-dark), auto;
}

.updates-letter::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 0 1px rgba(25, 20, 12, 0.14), inset 0 -2px 4px rgba(25, 20, 12, 0.18);
}

.theme-night .updates-letter {
  background: url('/static/paper-dark.png') center/256px 256px;
  color: rgba(240, 240, 240, 0.8);
  cursor: var(--cursor-light), auto;
}

.theme-night .updates-letter::after {
  box-shadow: inset 0 0 0 1px rgba(240, 240, 240, 0.14), inset 0 -2px 4px rgba(0, 0, 0, 0.28);
}

.updates-overlay:target .updates-letter,
.updates-overlay.is-open .updates-letter {
  opacity: 1;
  transform: translateY(0);
}

.updates-overlay.is-closing .updates-letter {
  opacity: 0;
  transform: translateY(12px);
}

.updates-dismiss {
  position: absolute;
  top: 18px;
  inset-inline-end: 18px;
  z-index: 5;
  text-decoration: none;
  text-transform: uppercase;
  color: rgba(25, 24, 22, 0.7);
  font-size: 1.5em;
  line-height: 1;
  cursor: var(--cursor-dark), pointer;
}

.theme-night .updates-dismiss {
  color: rgba(240, 240, 240, 0.8);
  cursor: var(--cursor-light), pointer;
}

.updates-dismiss:hover,
.theme-night .updates-dismiss:hover {
  color: #fff;
}

.updates-letter :is(.letter-body, .updates-scroll-content) {
  --overlay-scrollbar-shift: max(0px, calc(var(--letter-inline-padding) - var(--overlay-scrollbar-inset)));
  margin-inline-end: calc(-1 * var(--overlay-scrollbar-shift));
  padding-inline-end: var(--overlay-scrollbar-shift);
  max-height: calc(var(--viewport-height) - var(--overlay-top-safe-zone) - var(--overlay-bottom-safe-zone) - var(--overlay-card-chrome) - var(--overlay-close-clearance) - var(--overlay-border-gap));
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.95) transparent;
}

/* Individual post pages: keep [back] fixed, scroll meta+body+footer together */
.updates-overlay.overlay--post-detail .updates-dismiss {
  position: absolute;
  top: 18px;
  inset-inline-end: 18px;
  z-index: 6;
}

.updates-overlay.overlay--post-detail .updates-scroll-content {
  margin-top: var(--overlay-close-clearance);
}

.updates-letter :is(.letter-body, .updates-scroll-content)::-webkit-scrollbar {
  width: 8px;
  background: transparent;
  -webkit-appearance: none;
}

.updates-letter :is(.letter-body, .updates-scroll-content)::-webkit-scrollbar-track,
.updates-letter :is(.letter-body, .updates-scroll-content)::-webkit-scrollbar-track-piece,
.updates-letter :is(.letter-body, .updates-scroll-content)::-webkit-scrollbar-corner {
  background: transparent;
  box-shadow: none;
}

.updates-letter :is(.letter-body, .updates-scroll-content)::-webkit-scrollbar-button {
  width: 0;
  height: 0;
  display: none;
}

.updates-letter :is(.letter-body, .updates-scroll-content)::-webkit-scrollbar-thumb {
  background-color: rgba(255, 255, 255, 0.95);
  background-image: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.98) 0 2px, rgba(255, 255, 255, 0.72) 2px 4px);
  border-radius: 0;
  border: 0;
}

.overlay-scrollbar-mode-custom .updates-letter.has-custom-scrollbar :is(.letter-body, .updates-scroll-content) {
  scrollbar-width: none;
}

.overlay-scrollbar-mode-custom .updates-letter.has-custom-scrollbar :is(.letter-body, .updates-scroll-content)::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.updates-scrollbar-indicator {
  position: absolute;
  inset-inline-end: var(--overlay-scrollbar-inset);
  width: 6px;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
}

.updates-scrollbar-indicator-thumb {
  width: 100%;
  min-height: 24px;
  background-color: rgba(255, 255, 255, 0.95);
  border-radius: 999px;
}

.updates-overlay.overlay--post-detail .updates-letter .letter-body {
  max-height: none;
  overflow: visible;
}

/* ==========================================================================
   LAYER 200: Chrome (Nav, Footer, Controls)
   ========================================================================== */

#fps { 
  position: fixed; 
  top: 10px; 
  left: 10px; 
  color: white; 
  font: 16px var(--mono-font); 
  background: rgba(0,0,0,0.5); 
  padding: 5px 10px; 
  z-index: 200; 
  display: none; 
}

#fps.visible { 
  display: block; 
}

/* Top Navigation */
.top-nav {
  position: fixed;
  top: calc(75px + var(--banner-height));
  right: 75px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  opacity: 1;
}

.top-nav.has-overlap-backdrop {
  z-index: 260;
}

.top-nav.has-overlap-backdrop::before {
  content: "";
  position: absolute;
  inset: -10px -20px -12px;
  border: 1px solid rgba(95, 95, 95, 0.75);
  border-radius: 4px;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(circle at 14% 18%, rgba(175, 175, 175, 0.2) 0 1px, transparent 1.8px),
    radial-gradient(circle at 72% 24%, rgba(165, 165, 165, 0.18) 0 1px, transparent 1.8px),
    radial-gradient(circle at 40% 66%, rgba(185, 185, 185, 0.16) 0 1px, transparent 1.8px),
    radial-gradient(circle at 86% 78%, rgba(170, 170, 170, 0.2) 0 1px, transparent 1.8px),
    linear-gradient(rgba(58, 58, 58, 0.98), rgba(58, 58, 58, 0.98)),
    url('/static/paper-dark.png') center/220px 220px;
  background-size: 220px 220px, 220px 220px, 220px 220px, 220px 220px, auto, 220px 220px;
  background-repeat: repeat;
}

.menu-trigger {
  display: inline-flex;
  align-items: center;
}

.menu-trigger-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  padding: 0;
  margin: 0;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  cursor: var(--cursor-light), pointer;
}

.menu-about {
  display: inline-block;
  font: 14px/1 var(--mono-font);
  letter-spacing: 0;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.95);
  transition: opacity 0.2s ease, color 0.2s ease;
}

.top-nav.is-open .menu-about {
  opacity: 0;
  visibility: hidden;
}

.menu-chevron {
  display: inline-block;
  position: relative;
  top: 1px;
  font: 20px/1 var(--mono-font);
  letter-spacing: 0;
  color: rgba(255, 255, 255, 0.45);
  transform-origin: center;
  transition: transform 0.25s ease, color 0.25s ease;
  animation: chevronPulse 1.1s ease-in-out infinite alternate;
}

.menu-trigger-toggle:hover .menu-about,
.menu-trigger-toggle:hover .menu-chevron {
  color: #fff;
  animation: none;
}

.top-nav.is-open .menu-chevron {
  animation: none;
  transform: rotate(90deg);
  color: rgba(255, 255, 255, 0.95);
}

.menu-links {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.menu-links[hidden] {
  display: none;
}

@keyframes chevronPulse {
  from {
    color: rgba(160, 160, 160, 0.6);
  }
  to {
    color: rgba(255, 255, 255, 0.95);
  }
}

.nav-link {
  font: 14px/1 var(--mono-font);
  text-transform: uppercase;
  letter-spacing: 0;
  color: rgba(255, 255, 255, 0.95);
  text-decoration: none;
  text-shadow: 0 0 4px rgba(255, 255, 255, 0);
  transition: color 0.2s ease, text-shadow 0.3s ease;
  cursor: var(--cursor-light), pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.nav-link::after {
  content: "";
  width: 15px;
  height: 15px;
  background: url('/static/cursor-light.svg') center/contain no-repeat;
  transform-origin: center;
  flex: 0 0 auto;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.nav-link:hover {
  color: #fff;
  text-decoration: none;
  text-shadow: 0 0 4px rgba(255, 255, 255, 0.9);
  cursor: var(--cursor-dark), pointer;
}

.nav-link:hover::after {
  opacity: 1;
  animation: navLinkStarSpin 0.85s linear infinite;
}

@keyframes navLinkStarSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-link:hover::after {
    animation: none;
  }
}

.theme-night .nav-link,
.theme-night .menu-trigger-toggle {
  cursor: var(--cursor-dark), pointer;
}

.theme-night .nav-link:hover,
.theme-night .menu-trigger-toggle:hover {
  cursor: var(--cursor-light), pointer;
}

/* Footer */
#site-footer {
  position: fixed;
  bottom: 75px;
  left: 75px;
  z-index: 200;
  color: rgba(255, 255, 255, 0.95);
  font: 14px/1 var(--mono-font);
  padding: 6px 10px;
}

/* Bottom Controls */
.bottom-controls {
  position: fixed;
  bottom: 75px;
  right: 75px;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 16px;
}

#theme-toggle {
  border: 0;
  background: none;
  color: rgba(255, 255, 255, 0.95);
  font: 14px/1 var(--mono-font);
  padding: 6px 10px;
  cursor: var(--cursor-light), pointer;
  transition: color 0.2s ease;
}

#theme-toggle:hover {
  color: #fff;
  cursor: var(--cursor-dark), pointer;
}

.theme-night #theme-toggle {
  cursor: var(--cursor-dark), pointer;
}

.theme-night #theme-toggle:hover {
  cursor: var(--cursor-light), pointer;
}

#theme-toggle .value {
  margin-inline-start: 0.15em;
}

/* Language Picker */
.lang-picker {
  position: relative;
  z-index: 220;
  pointer-events: auto;
}

#lang-toggle {
  border: 0;
  background: none;
  color: rgba(255, 255, 255, 0.95);
  font: 14px/1 var(--mono-font);
  padding: 6px 10px;
  cursor: var(--cursor-light), pointer;
  transition: color 0.2s ease;
  position: relative;
  z-index: 221;
  pointer-events: auto;
}

#lang-toggle:hover {
  color: #fff;
  cursor: var(--cursor-dark), pointer;
}

.theme-night #lang-toggle {
  cursor: var(--cursor-dark), pointer;
}

.theme-night #lang-toggle:hover {
  cursor: var(--cursor-light), pointer;
}

/* ==========================================================================
   LAYER 210: Dropdowns
   ========================================================================== */

.lang-menu {
  position: absolute;
  bottom: 100%;
  right: 0;
  margin-bottom: 8px;
  z-index: 230;
  background: rgba(30, 30, 30, 0.95);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  list-style: none;
  padding: 6px 0;
  min-width: 160px;
  max-height: 320px;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}

.lang-menu:not([hidden]) {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.lang-menu::-webkit-scrollbar {
  width: 6px;
}

.lang-menu::-webkit-scrollbar-track {
  background: transparent;
}

.lang-menu::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
}

.lang-menu li {
  padding: 0;
  margin: 0;
}

.lang-menu button {
  width: 100%;
  border: 0;
  background: none;
  color: rgba(255, 255, 255, 0.8);
  font: 13px/1.4 var(--mono-font);
  padding: 8px 16px;
  text-align: start;
  cursor: var(--cursor-dark), pointer;
  transition: background 0.15s ease, color 0.15s ease;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 1.2em auto;
  align-items: center;
  column-gap: 12px;
}

.lang-menu button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 1);
}

.lang-menu button[aria-selected="true"] {
  color: rgba(255, 255, 255, 1);
}

.lang-menu .lang-check {
  width: 1.2em;
  text-align: center;
  font-size: 11px;
  opacity: 0;
}

.lang-menu button[aria-selected="true"] .lang-check {
  opacity: 0.7;
}

.lang-menu .lang-code {
  opacity: 0.5;
  font-size: 11px;
  text-transform: uppercase;
}

/* ==========================================================================
   Letter Content Styles
   ========================================================================== */

.email-meta {
  margin-bottom: 24px;
  opacity: 0.85;
}

.email-meta p {
  margin-bottom: 0;
  line-height: 1.5;
}

.email-meta a {
  color: inherit;
  text-decoration: none;
  cursor: var(--cursor-dark), pointer;
}

.theme-night .email-meta a {
  cursor: var(--cursor-light), pointer;
}

.email-meta a:hover,
.theme-night .email-meta a:hover {
  color: #fff;
}

.email-meta + .letter-body {
  font-family: var(--serif-font);
  font-size: 18px;
  font-weight: 400;
}

.email-meta + .letter-body em,
.email-meta + .letter-body i {
  font-style: italic;
  font-weight: 400;
}

.email-meta + .letter-body strong,
.email-meta + .letter-body b,
.email-meta + .letter-body a {
  font-weight: 700;
}

.letter-body p {
  margin-bottom: 20px;
}

.letter-body ul,
.letter-body ol {
  list-style: none;
  padding-inline-start: 0;
  margin: 20px 0;
}

.letter-body li {
  position: relative;
  padding-inline-start: 1.4em;
  margin: 6px 0;
}

.letter-body li::before {
  content: "•";
  position: absolute;
  inset-inline-start: 0;
}

.posts-list li {
  padding-inline-start: 0;
}

.posts-list li::before {
  content: none;
}

.posts-title {
  font-weight: 700;
  margin-bottom: 18px;
}

.post-date {
  font-weight: 400;
}

.posts-list .post-name {
  margin-inline-start: 0.6em;
  font-family: var(--serif-font);
  font-size: 18px;
  line-height: 1.1;
  font-style: italic;
  font-weight: 400;
}

.letter-body a {
  color: inherit;
  text-decoration: none;
  font-weight: 700;
  cursor: var(--cursor-dark), pointer;
}

.theme-night .letter-body a {
  cursor: var(--cursor-light), pointer;
}

.letter-body a:hover,
.theme-night .letter-body a:hover {
  color: #fff;
}

.letter-footer {
  margin-top: 28px;
  font-weight: 400;
  line-height: 1.5;
  color: rgba(25, 24, 22, 0.6);
}

.theme-night .letter-footer {
  color: rgba(240, 240, 240, 0.6);
}

.letter-footer a {
  color: inherit;
  text-decoration: none;
  cursor: var(--cursor-dark), pointer;
}

.theme-night .letter-footer a {
  cursor: var(--cursor-light), pointer;
}

.letter-footer a:hover,
.theme-night .letter-footer a:hover {
  color: #fff;
}

/* ==========================================================================
   Subscribe Form
   ========================================================================== */

.updates-form-area {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  min-height: 4em;
  margin: 24px 0;
}

[dir="rtl"] .updates-form-area {
  align-items: flex-end;
}

.updates-input-wrapper {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  cursor: text;
}

[dir="rtl"] .updates-input-wrapper {
  justify-content: flex-end;
}

.updates-input {
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: inherit;
  line-height: 1.6;
  color: inherit;
  caret-color: rgba(25, 24, 22, 0.8);
  cursor: inherit;
  -webkit-user-select: text;
  user-select: text;
  text-align: start;
}

.updates-input.placeholder-text {
  color: rgba(25, 24, 22, 0.5);
}

.updates-input.valid-glow {
  background: linear-gradient(90deg, #fff 0%, #fff 40%, currentColor 60%, currentColor 100%);
  background-size: 300% 100%;
  background-position: 100% 0;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: text-sweep 0.72s ease forwards;
}

[dir="rtl"] .updates-input.valid-glow {
  background: linear-gradient(-90deg, #fff 0%, #fff 40%, currentColor 60%, currentColor 100%);
  background-size: 300% 100%;
  background-position: 0% 0;
  animation: text-sweep-rtl 0.72s ease forwards;
}

@keyframes text-sweep {
  from { background-position: 100% 0; }
  to { background-position: 0% 0; }
}

@keyframes text-sweep-rtl {
  from { background-position: 0% 0; }
  to { background-position: 100% 0; }
}

.updates-message.valid {
  background: linear-gradient(90deg, #fff 0%, #fff 40%, currentColor 60%, currentColor 100%);
  background-size: 300% 100%;
  background-position: 100% 0;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: text-sweep 0.72s ease forwards;
}

[dir="rtl"] .updates-message.valid {
  background: linear-gradient(-90deg, #fff 0%, #fff 40%, currentColor 60%, currentColor 100%);
  background-size: 300% 100%;
  background-position: 0% 0;
  animation: text-sweep-rtl 0.72s ease forwards;
}

.updates-measure {
  position: absolute;
  visibility: hidden;
  white-space: pre;
  font-family: inherit;
  font-size: inherit;
  line-height: 1.6;
  pointer-events: none;
}

.updates-input::selection,
.updates-input:focus::selection {
  background: rgba(25, 24, 22, 0.2);
  color: inherit;
}

.updates-enter {
  margin-inline-start: 0;
  position: relative;
  top: 2px;
  color: rgba(25, 24, 22, 0.6);
  cursor: var(--cursor-dark), pointer;
  transition: color 0.2s ease;
}

.updates-enter:hover {
  color: rgba(25, 24, 22, 1);
}

.updates-message {
  display: none;
  font-size: inherit;
  font-family: inherit;
  line-height: 1.6;
  color: inherit;
  margin: 0;
  white-space: nowrap;
}

.updates-message:not([hidden]) {
  display: block;
}

.theme-night .updates-input {
  caret-color: rgba(240, 240, 240, 0.8);
}

.theme-night .updates-input.placeholder-text {
  color: rgba(240, 240, 240, 0.45);
}

.theme-night .updates-enter {
  color: rgba(240, 240, 240, 0.6);
  cursor: var(--cursor-light), pointer;
}

.theme-night .updates-enter:hover {
  color: rgba(240, 240, 240, 1);
}

.theme-night .updates-input.valid-glow {
  background: linear-gradient(90deg, #fff 0%, #fff 40%, currentColor 60%, currentColor 100%);
  background-size: 300% 100%;
  background-position: 100% 0;
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: text-sweep 0.72s ease forwards;
}

[dir="rtl"] .theme-night .updates-input.valid-glow {
  background: linear-gradient(-90deg, #fff 0%, #fff 40%, currentColor 60%, currentColor 100%);
  background-size: 300% 100%;
  background-position: 0% 0;
  animation: text-sweep-rtl 0.72s ease forwards;
}

/* ==========================================================================
   404 Error Page
   ========================================================================== */

.error-text {
  position: fixed;
  top: 70%;
  left: 50%;
  transform: translate(-50%, -50%) translateY(20px);
  text-align: center;
  font: 15px/1.5 var(--mono-font);
  color: rgba(255, 255, 255, 0.9);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  letter-spacing: 0.02em;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s ease 2s, transform 1s ease 2s;
}

.page[data-page-type="404"] .error-text {
  opacity: 1;
  transform: translate(-50%, -50%);
}

/* ==========================================================================
   Page + Content Variants
   ========================================================================== */

.updates-overlay.overlay--prose .letter-body {
  font-family: var(--serif-font);
  font-weight: 400;
  font-size: 18px;
  line-height: 1.5;
}

.updates-overlay.overlay--prose .letter-body strong,
.updates-overlay.overlay--prose .letter-body b,
.updates-overlay.overlay--prose .letter-body a {
  font-weight: 700;
}

.updates-overlay.overlay--purpose .prose-subheading {
  font-weight: 500;
}

.updates-overlay.overlay--values .letter-body {
  font-size: 16px;
}

.section-heading {
  margin: 0 0 10px;
}

.updates-overlay.overlay--values .letter-body .section-heading {
  margin-bottom: 10px;
}

.section-heading em strong {
  font-size: 18px;
}

.section-heading--spaced {
  margin-top: 20px;
}

.disclosure {
  margin: 0 0 6px;
}

.disclosure-summary {
  list-style: none;
  display: flex;
  align-items: baseline;
  gap: 8px;
  --values-chevron-index: 0;
  --values-chevron-glow: 0;
  color: rgba(28, 27, 26, 0.9);
  cursor: var(--cursor-light), pointer;
  transition: color 0.2s ease;
}

.disclosure-summary::-webkit-details-marker {
  display: none;
}

.disclosure-summary::before {
  content: ">";
  font: 11px/1 var(--mono-font);
  color: rgba(
    calc(28 + (255 - 28) * var(--values-chevron-glow)),
    calc(27 + (255 - 27) * var(--values-chevron-glow)),
    calc(26 + (255 - 26) * var(--values-chevron-glow)),
    calc(0.9 + 0.05 * var(--values-chevron-glow))
  );
  text-shadow: 0 0 4px rgba(255, 255, 255, 0.9);
  transform-origin: center;
  transition: transform 0.2s ease, color 0.2s ease;
  margin-top: 3px;
}

.disclosure[open] .disclosure-summary::before {
  transform: rotate(90deg);
  color: currentColor;
}

.disclosure-summary:hover,
.disclosure[open] .disclosure-summary:hover {
  color: rgba(255, 255, 255, 0.95);
}

.disclosure-summary:hover::before,
.disclosure[open] .disclosure-summary:hover::before {
  color: rgba(255, 255, 255, 0.95);
}

.disclosure-title {
  font-size: 16px;
  font-weight: 400;
  color: inherit;
  transition: color 0.2s ease;
}

.updates-overlay.overlay--values .letter-body .icon-list {
  margin: 6px 0 14px 20px;
  padding: 0;
  list-style: none;
}

.icon-list > li {
  margin: 0 0 3px;
  position: relative;
  padding-inline-start: 16px;
}

.icon-list--star > li::before {
  content: "✶";
  position: absolute;
  inset-inline-start: 0;
  top: 0;
  color: rgba(0, 0, 0, 0.95);
}

.theme-night .disclosure-summary {
  color: rgba(240, 240, 240, 0.8);
}

.theme-night .disclosure-summary::before {
  color: rgba(
    calc(200 + (255 - 200) * var(--values-chevron-glow)),
    calc(200 + (255 - 200) * var(--values-chevron-glow)),
    calc(200 + (255 - 200) * var(--values-chevron-glow)),
    calc(0.65 + 0.3 * var(--values-chevron-glow))
  );
}

.theme-night .disclosure[open] .disclosure-summary::before {
  color: rgba(240, 240, 240, 0.8);
}

.theme-night .disclosure-summary:hover,
.theme-night .disclosure[open] .disclosure-summary:hover {
  color: rgba(255, 255, 255, 0.95);
}

.theme-night .disclosure-summary:hover::before,
.theme-night .disclosure[open] .disclosure-summary:hover::before {
  color: rgba(255, 255, 255, 0.95);
}

.theme-night .icon-list--star > li::before {
  color: rgba(240, 240, 240, 0.8);
}

/* ==========================================================================
   Utility Classes
   ========================================================================== */

.mono-bold {
  font-weight: 700;
}

.mono-light {
  font-weight: 300;
}

.mono-caps {
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.mono-spaced {
  letter-spacing: 0.3em;
}

/* ==========================================================================
   Responsive: Medium (< 800px)
   ========================================================================== */

@media (max-width: 800px) {
  :root {
    --overlay-top-safe-zone: 58px;
    --overlay-bottom-safe-zone: 140px;
    --overlay-card-chrome: 56px;
    --overlay-close-clearance: 26px;
    --overlay-mobile-top-gap: 58px;
  }

  .top-nav {
    top: calc(40px + var(--banner-height));
    right: 40px;
  }

  .updates-overlay {
    align-items: flex-start;
    padding-inline: 8px;
  }

  .updates-overlay .updates-letter {
    width: 98vw;
    max-width: 98vw;
    margin-top: 0;
    max-height: calc(var(--viewport-height) - var(--overlay-top-safe-zone) - var(--overlay-bottom-safe-zone) - var(--overlay-border-gap));
    transition: opacity 0.35s ease, transform 0.35s ease, max-height 0.22s ease;
  }

  .updates-overlay .updates-letter {
    --letter-inline-padding: 12px;
    --overlay-scrollbar-inset: 12px;
    padding: 16px var(--letter-inline-padding) 12px;
  }

  .updates-overlay .updates-dismiss {
    font-size: 21px;
    line-height: 1;
  }

  .updates-overlay .updates-letter .letter-body {
    margin-top: var(--overlay-close-clearance);
  }

  .updates-overlay .updates-letter :is(.letter-body, .updates-scroll-content) {
    max-height: calc(var(--viewport-height) - var(--overlay-top-safe-zone) - var(--overlay-bottom-safe-zone) - var(--overlay-card-chrome) - var(--overlay-close-clearance) - var(--overlay-border-gap));
    transition: max-height 0.22s ease;
  }

  .updates-overlay.overlay--prose .letter-body,
  .updates-overlay.overlay--posts .letter-body {
    font-size: 16px;
  }

  .updates-overlay.overlay--post-detail .email-meta {
    font-size: 14px;
    line-height: 1.5;
  }

  .updates-overlay.overlay--values .section-heading em strong {
    font-size: 17px;
  }

  .updates-overlay.overlay--posts .posts-list .post-name,
  .updates-overlay.overlay--posts .post-date {
    font-size: 16px;
  }

  #site-footer {
    bottom: 40px;
    left: 40px;
  }

  .bottom-controls {
    bottom: 40px;
    right: 40px;
  }

  .main-logo {
    width: 210px;
    max-width: calc(65vw * 0.7);
  }

  body:has(.page[data-page-type="home"]) .center-logo,
  body:has(.page[data-page-type="corner-logo"]) .center-logo {
    left: calc(40px + 10px);
    top: calc(40px + var(--banner-height));
  }

  body:has(.page[data-page-type="home"]) .main-logo,
  body:has(.page[data-page-type="corner-logo"]) .main-logo {
    width: 85px;
    max-width: calc(65vw * 0.29);
  }

  .home-hero-text {
    font-size: clamp(15.84px, 3.456vw, 25.2px);
  }

}

/* ==========================================================================
   Responsive: Small (< 520px)
   ========================================================================== */

@media (max-width: 520px) {
  :root {
    --overlay-top-safe-zone: 46px;
    --overlay-bottom-safe-zone: 120px;
    --overlay-card-chrome: 44px;
    --overlay-close-clearance: 22px;
    --overlay-mobile-top-gap: 46px;
  }

  .top-nav {
    top: calc(28px + var(--banner-height));
    right: 28px;
  }

  #site-footer {
    bottom: 28px;
    left: 28px;
  }

  .bottom-controls {
    bottom: 28px;
    right: 28px;
    gap: 8px;
  }

  #lang-toggle,
  #theme-toggle {
    padding: 6px 6px;
  }

  .lang-menu {
    min-width: 140px;
  }

  .posts-list .post-name {
    display: block;
    margin-inline-start: 0;
  }

  body:has(.page[data-page-type="home"]) .center-logo,
  body:has(.page[data-page-type="corner-logo"]) .center-logo {
    left: calc(28px + 10px);
    top: calc(28px + var(--banner-height));
  }

  .home-hero-text {
    font-size: clamp(12.96px, 4.896vw, 20.16px);
    line-height: 1.18;
    width: min(92vw, 680px);
  }

}
