:root {
  --top-bar-height: 5.5rem;
  color-scheme: dark;

  /* Core palette */
  --top-bar-background: #111111;
  --top-bar-outline: #343b49;
  --page-background: #181c24;
  --plain-page-background: #181c24;
  --page-pattern: #1b2029;
  --pattern-gap: 8rem;
  --pattern-band: 3rem;
  --pattern-cycle-y: 15.556349rem;
  --ground-height: clamp(7rem, 18vh, 14rem);
  --title-color: #c8cbd2;
  --text-color: #a7abb3;
  --heading-color: #c2c6ce;
  --eyebrow-color: #7f8998;
  --aside-color: #818894;
  --lead-color: #b0b4bc;
  --accent-color: #66758a;
  --accent-fade: rgba(102, 117, 138, 0.08);
  --divider-color: rgba(127, 137, 152, 0.2);
  --divider-soft-color: rgba(127, 137, 152, 0.1);
  --counter-color: #6f7b8d;
  --quote-background: rgba(12, 16, 22, 0.48);
  --quote-mark-color: rgba(111, 123, 141, 0.16);
  --quote-text-color: #b8bdc6;
  --quote-meta-color: #798493;

  /* Theme control */
  --switch-label-color: #aeb4bf;
  --switch-track-background: #252b35;
  --switch-track-border: #465063;
  --switch-track-active-background: #52677f;
  --switch-track-active-border: #7188a4;
  --switch-thumb-color: #c8d0dd;
  --switch-thumb-shadow: rgba(0, 0, 0, 0.22);
  --focus-ring-color: #8195b3;
  --floating-control-background: rgba(17, 17, 17, 0.9);

  /* Stored procedural scene */
  --cloud-far-color: #171717;
  --cloud-near-color: #191919;
  --lightning-glow-color: rgba(232, 243, 255, 0.98);
  --rain-color: #c1ccdc;
  --mountain-far-color: #202832;
  --mountain-near-color: #171c22;
  --mountain-giant-color: #1d242c;
  --ground-color: #0d131a;

  --pattern-scroll: 0px;
  --cloud-far-scroll: 0px;
  --cloud-near-scroll: 0px;
  --cloud-opacity: 1;
  --lightning-scroll: 0px;
  --rain-scroll: 0px;
  --mountain-near-scroll: 0px;
  --mountain-far-scroll: 0px;
  --mountain-giant-scroll: 0px;
  --rain-angle: 0deg;
  --rain-wind-shift: 0vh;
}

:root[data-theme="light"] {
  color-scheme: light;
  --top-bar-background: #f5f7fa;
  --top-bar-outline: #c6cfdb;
  --page-background: #e8edf2;
  --plain-page-background: #ffffff;
  --page-pattern: #dce3ea;
  --title-color: #252c36;
  --text-color: #4f5966;
  --heading-color: #29323e;
  --eyebrow-color: #687589;
  --aside-color: #747e8c;
  --lead-color: #414c59;
  --accent-color: #71839b;
  --accent-fade: rgba(113, 131, 155, 0.08);
  --divider-color: rgba(76, 91, 111, 0.22);
  --divider-soft-color: rgba(76, 91, 111, 0.12);
  --counter-color: #627187;
  --quote-background: rgba(255, 255, 255, 0.48);
  --quote-mark-color: rgba(79, 95, 116, 0.14);
  --quote-text-color: #3c4755;
  --quote-meta-color: #66758a;
  --switch-label-color: #505c6b;
  --switch-track-background: #d5dde7;
  --switch-track-border: #a9b5c5;
  --switch-track-active-background: #8098b5;
  --switch-track-active-border: #657f9f;
  --switch-thumb-color: #ffffff;
  --switch-thumb-shadow: rgba(49, 62, 78, 0.2);
  --focus-ring-color: #536f96;
  --floating-control-background: rgba(245, 247, 250, 0.92);
  --cloud-far-color: #aeb5bd;
  --cloud-near-color: #bcc3ca;
  --lightning-glow-color: rgba(255, 255, 255, 0.96);
  --rain-color: #8497ae;
  --mountain-far-color: #a7b3bf;
  --mountain-near-color: #929fab;
  --mountain-giant-color: #9ca8b4;
  --ground-color: #7f8c99;
}

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

html {
  min-height: 100%;
  overflow-x: hidden;
  background: var(--page-background);
  -webkit-text-size-adjust: 100%;
}

body {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding-top: calc(var(--top-bar-height) + env(safe-area-inset-top));
}

body::before {
  position: fixed;
  z-index: -5;
  inset: -50vmax;
  content: "";
  background-color: var(--page-background);
  background-image: repeating-linear-gradient(
    45deg,
    transparent 0,
    transparent var(--pattern-gap),
    var(--page-pattern) var(--pattern-gap),
    var(--page-pattern) calc(var(--pattern-gap) + var(--pattern-band))
  );
  background-position: 0 var(--pattern-scroll);
  filter: blur(14px);
  pointer-events: none;
  will-change: background-position;
  animation: pattern-drift 11.25s linear infinite;
}

/* Remove this class from <html> to restore the stored striped background. */
html.background-pattern-disabled {
  background: var(--plain-page-background);
}

.background-pattern-disabled body::before {
  background-color: var(--plain-page-background);
  background-image: none;
  filter: none;
  animation: none;
}

/* The procedural scene is retained below for later use, but is currently paused. */
.scene-effects-disabled .filter-definitions,
.scene-effects-disabled .cloud-layer,
.scene-effects-disabled .background-lightning,
.scene-effects-disabled .background-rain,
.scene-effects-disabled .terrain-scene {
  display: none;
}

/* The quote feature and its content remain stored for later use. */
.quotes-disabled .quote-section {
  display: none;
}

.filter-definitions {
  /* Retained in the markup, but the former noise filters are no longer rendered. */
  display: none;
}

.cloud-layer {
  --cloud-base-opacity: 0.8;
  position: fixed;
  left: -15vw;
  display: block;
  width: 130vw;
  pointer-events: none;
  opacity: calc(var(--cloud-opacity) * var(--cloud-base-opacity));
  will-change: transform, opacity;
}

.cloud-layer--far {
  --cloud-base-opacity: 0.78;
  --cloud-design-height: clamp(12rem, 24vw, 18rem);
  z-index: -4;
  top: calc(var(--top-bar-height) + env(safe-area-inset-top) - 5.75rem);
  height: calc(var(--cloud-design-height) + 10rem);
  animation: cloud-drift-far 260s ease-in-out infinite alternate;
}

.cloud-layer--near {
  --cloud-base-opacity: 0.86;
  --cloud-design-height: clamp(10rem, 21vw, 15rem);
  z-index: -3;
  top: calc(var(--top-bar-height) + env(safe-area-inset-top) - 5.5rem);
  height: calc(var(--cloud-design-height) + 9rem);
  animation: cloud-drift-near 170s ease-in-out infinite alternate;
}

@keyframes cloud-drift-far {
  from {
    transform: translate3d(-2vw, var(--cloud-far-scroll), 0);
  }

  to {
    transform: translate3d(3vw, var(--cloud-far-scroll), 0);
  }
}

@keyframes cloud-drift-near {
  from {
    transform: translate3d(3vw, var(--cloud-near-scroll), 0);
  }

  to {
    transform: translate3d(-5vw, var(--cloud-near-scroll), 0);
  }
}

.background-lightning {
  position: fixed;
  z-index: -1;
  inset: 0;
  width: 100%;
  height: 160vh;
  height: 160dvh;
  opacity: 0;
  transform: translate3d(0, var(--lightning-scroll), 0);
  filter: blur(1.5px) drop-shadow(0 0 14px var(--lightning-glow-color));
  pointer-events: none;
  will-change: transform, opacity;
}

.background-lightning.is-flashing {
  animation: lightning-flash 700ms ease-out;
}

@keyframes lightning-flash {
  0%,
  100% {
    opacity: 0;
  }

  8% {
    opacity: 1;
  }

  18% {
    opacity: 0.35;
  }

  30% {
    opacity: 1;
  }

  55% {
    opacity: 0;
  }
}

.background-rain {
  position: fixed;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  filter: blur(1px);
  pointer-events: none;
}

.terrain-scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  overflow: clip;
  pointer-events: none;
}

.mountain-range {
  position: absolute;
  right: 0;
  left: 0;
  overflow: visible;
  pointer-events: none;
  will-change: transform;
}

.mountain-range__canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.mountain-range__extension {
  position: absolute;
  top: calc(100% - 0.75rem);
  left: 0;
  display: block;
  width: 100%;
  height: calc(150vh + 0.75rem);
  height: calc(150dvh + 0.75rem);
}

.mountain-range--far {
  z-index: -1;
  bottom: 14vh;
  bottom: 14dvh;
  height: clamp(36rem, 68vh, 48rem);
  height: clamp(36rem, 68dvh, 48rem);
  transform: translate3d(0, var(--mountain-far-scroll), 0);
}

.mountain-range--giant {
  z-index: -2;
  bottom: 15vh;
  bottom: 15dvh;
  height: max(clamp(36rem, 105vh, 64rem), calc(56vh + 23rem));
  height: max(clamp(36rem, 105dvh, 64rem), calc(56dvh + 23rem));
  transform: translate3d(0, var(--mountain-giant-scroll), 0);
}

.mountain-range--near {
  z-index: 0;
  bottom: 11vh;
  bottom: 11dvh;
  height: clamp(25rem, 48vh, 36rem);
  height: clamp(25rem, 48dvh, 36rem);
  transform: translate3d(0, var(--mountain-near-scroll), 0);
}

.ground {
  position: absolute;
  z-index: 1;
  bottom: 0;
  left: 0;
  width: 100%;
  height: var(--ground-height);
  background: var(--ground-color);
  border-radius: 50% 50% 0 0 / 14% 14% 0 0;
  filter: blur(0.5px);
  pointer-events: none;
}

@supports (height: 1dvh) {
  :root {
    --ground-height: clamp(7rem, 18dvh, 14rem);
  }
}

@keyframes pattern-drift {
  from {
    background-position: 0 var(--pattern-scroll);
  }

  to {
    background-position: 0 calc(var(--pattern-scroll) + var(--pattern-cycle-y));
  }
}

.top-bar {
  position: fixed;
  z-index: 1000;
  inset: 0 0 auto;
  height: calc(var(--top-bar-height) + env(safe-area-inset-top));
  background: var(--top-bar-background);
  border-bottom: 2px solid var(--top-bar-outline);
}

.top-bar__inner {
  display: flex;
  align-items: center;
  width: 100%;
  height: 100%;
  margin-inline: auto;
  padding-top: env(safe-area-inset-top);
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
}

.site-title {
  flex: 0 0 auto;
  margin: 0;
  color: var(--title-color);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: clamp(1.4rem, 1.1rem + 1vw, 2rem);
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.top-bar__actions {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: flex-end;
  min-width: 2rem;
  height: 100%;
  margin-left: 2rem;
}

.theme-toggle {
  display: inline-flex;
  gap: 0.7rem;
  align-items: center;
  padding: 0.4rem 0;
  color: var(--switch-label-color);
  font: 600 0.88rem/1 "Trebuchet MS", "Segoe UI", sans-serif;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.theme-toggle__track {
  position: relative;
  flex: 0 0 auto;
  width: 2.8rem;
  height: 1.55rem;
  background: var(--switch-track-background);
  border: 1px solid var(--switch-track-border);
  border-radius: 999px;
  transition: background-color 180ms ease, border-color 180ms ease;
}

.theme-toggle__thumb {
  position: absolute;
  top: 0.2rem;
  left: 0.2rem;
  width: 1.05rem;
  height: 1.05rem;
  background: var(--switch-thumb-color);
  border-radius: 50%;
  box-shadow: 0 1px 3px var(--switch-thumb-shadow);
  transition: transform 180ms ease, background-color 180ms ease;
}

:root[data-theme="light"] .theme-toggle__thumb {
  transform: translateX(1.25rem);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--focus-ring-color);
  outline-offset: 0.35rem;
  border-radius: 0.25rem;
}

.feature-toggle {
  position: fixed;
  z-index: 1100;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  display: inline-flex;
  gap: 0.7rem;
  align-items: center;
  padding: 0.65rem 0.75rem;
  color: var(--switch-label-color);
  font: 600 0.85rem/1 "Trebuchet MS", "Segoe UI", sans-serif;
  background: var(--floating-control-background);
  border: 1px solid var(--switch-track-border);
  border-radius: 0.65rem;
  box-shadow: 0 0.35rem 1.2rem var(--switch-thumb-shadow);
  backdrop-filter: blur(8px);
  cursor: pointer;
}

.feature-toggle__track {
  position: relative;
  flex: 0 0 auto;
  width: 2.8rem;
  height: 1.55rem;
  background: var(--switch-track-background);
  border: 1px solid var(--switch-track-border);
  border-radius: 999px;
  transition: background-color 180ms ease, border-color 180ms ease;
}

.feature-toggle__thumb {
  position: absolute;
  top: 0.2rem;
  left: 0.2rem;
  width: 1.05rem;
  height: 1.05rem;
  background: var(--switch-thumb-color);
  border-radius: 50%;
  box-shadow: 0 1px 3px var(--switch-thumb-shadow);
  transition: transform 180ms ease;
}

.feature-toggle[aria-checked="true"] .feature-toggle__track {
  background: var(--switch-track-active-background);
  border-color: var(--switch-track-active-border);
}

.feature-toggle[aria-checked="true"] .feature-toggle__thumb {
  transform: translateX(1.25rem);
}

.feature-toggle:focus-visible {
  outline: 2px solid var(--focus-ring-color);
  outline-offset: 0.25rem;
}

@media (max-width: 32rem) {
  .top-bar__actions {
    margin-left: 1rem;
  }

  .theme-toggle__label {
    display: none;
  }

  .feature-toggle__label {
    display: none;
  }
}

main {
  width: 100%;
  min-height: 180vh;
  min-height: 180dvh;
  margin-inline: auto;
  padding-left: max(1rem, env(safe-area-inset-left));
  padding-right: max(1rem, env(safe-area-inset-right));
}

.essay {
  position: relative;
  z-index: 3;
  width: min(100%, 52rem);
  margin-inline: auto;
  padding-block: clamp(3.5rem, 9vw, 7rem) clamp(28rem, 65vh, 44rem);
  color: var(--text-color);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-size: clamp(1.05rem, 0.98rem + 0.3vw, 1.2rem);
  line-height: 1.8;
}

.essay__header {
  position: relative;
  margin-bottom: clamp(2rem, 5vw, 3rem);
  padding-left: clamp(1rem, 3vw, 1.5rem);
}

.essay__header::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 2px;
  content: "";
  background: linear-gradient(to bottom, var(--accent-color), var(--accent-fade));
  border-radius: 999px;
}

.essay__eyebrow {
  margin: 0 0 0.5rem;
  color: var(--eyebrow-color);
  font-size: 0.78em;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.essay h2,
.essay h3 {
  color: var(--heading-color);
  line-height: 1.2;
}

.essay h2 {
  margin: 0;
  font-size: clamp(2rem, 1.5rem + 2vw, 3.25rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  text-transform: uppercase;
}

.essay__aside {
  margin-top: 0.65rem !important;
  color: var(--aside-color);
  font-size: 0.88em;
  font-style: italic;
  line-height: 1.4;
}

.essay__lead {
  color: var(--lead-color);
  font-size: 1.06em;
}

.essay h3 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.25rem, 1.1rem + 0.5vw, 1.55rem);
  font-weight: 600;
}

.essay p {
  margin: 0;
}

.essay__section {
  margin-top: clamp(2.5rem, 6vw, 4rem);
  padding-top: clamp(1.5rem, 4vw, 2.25rem);
  border-top: 1px solid var(--divider-color);
}

.activity-list {
  counter-reset: activity;
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.activity-list li {
  counter-increment: activity;
  display: grid;
  grid-template-columns: 2.2rem 1fr;
  gap: 0.75rem;
  align-items: baseline;
  padding-block: 0.75rem;
  border-bottom: 1px solid var(--divider-soft-color);
}

.activity-list li::before {
  content: counter(activity, decimal-leading-zero);
  color: var(--counter-color);
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.spaced-text {
  font-weight: 700;
  letter-spacing: 0.16em;
}

.quote-section {
  position: relative;
  margin-top: clamp(4rem, 10vw, 7rem);
  padding: clamp(1.5rem, 5vw, 2.5rem);
  overflow: hidden;
  background: var(--quote-background);
  border: 1px solid var(--divider-color);
  border-radius: 0.75rem;
  backdrop-filter: blur(8px);
}

.quote-section::after {
  position: absolute;
  top: -1.75rem;
  right: 1rem;
  content: "“";
  color: var(--quote-mark-color);
  font-family: Georgia, serif;
  font-size: clamp(7rem, 20vw, 11rem);
  line-height: 1;
  pointer-events: none;
}

.quote {
  position: relative;
  z-index: 1;
  margin: 0;
}

.quote__text {
  max-width: 38rem;
  color: var(--quote-text-color);
  font-size: clamp(1.2rem, 1rem + 0.8vw, 1.65rem);
  font-style: italic;
  line-height: 1.55;
}

.quote__footer {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  margin-top: 1.25rem;
  color: var(--quote-meta-color);
  font-size: 0.82em;
}

.quote__author {
  font-style: normal;
}

/* Tablets */
@media (min-width: 48rem) {
  :root {
    --top-bar-height: 6.5rem;
  }

  main {
    padding-inline: 2rem;
  }

  .top-bar__inner {
    padding-inline: 2rem;
  }
}

/* Desktops */
@media (min-width: 64rem) {
  main {
    padding-inline: 3rem;
  }

  .top-bar__inner {
    padding-inline: 3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  body::before {
    background-position: 0 0;
    animation: none;
  }

  .background-lightning {
    display: none;
    transform: none;
  }

  .cloud-layer {
    position: absolute;
    transform: none;
    animation: none;
  }

  .mountain-range,
  .ground {
    transform: none;
  }
}
