:root {
  color-scheme: dark;
  --black: #020403;
  --graphite: #090d0d;
  --stone: rgba(12, 16, 15, 0.78);
  --stone-strong: rgba(16, 21, 20, 0.94);
  --line: rgba(229, 221, 204, 0.18);
  --line-hot: rgba(214, 184, 121, 0.42);
  --text: #ece7dc;
  --muted: #aaa194;
  --faint: #706b62;
  --amber: #d6a85e;
  --green: #9caf8a;
  --cyan: #8eb7bd;
  --danger: #c98c72;
  --shadow: 0 32px 100px rgba(0, 0, 0, 0.62);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--black);
  color: var(--text);
  font-family: "Inter", system-ui, sans-serif;
  overflow-x: hidden;
}

button,
a,
textarea,
input {
  font: inherit;
}

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

.site-shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at 78% 18%, rgba(142, 183, 189, 0.13), transparent 28rem),
    radial-gradient(circle at 55% 70%, rgba(214, 168, 94, 0.11), transparent 24rem),
    #020403;
}

.hero {
  position: relative;
  min-height: 100svh;
  padding: 24px clamp(18px, 4vw, 76px) 34px;
  isolation: isolate;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -3;
  background:
    linear-gradient(90deg, rgba(2, 4, 3, 0.96) 0%, rgba(2, 4, 3, 0.78) 24%, rgba(2, 4, 3, 0.32) 54%, rgba(2, 4, 3, 0.72) 100%),
    linear-gradient(180deg, rgba(2, 4, 3, 0.38) 0%, rgba(2, 4, 3, 0.1) 48%, rgba(2, 4, 3, 0.94) 100%),
    url("./assets/cemetery-night.png") center / cover no-repeat;
  transform: scale(1.018);
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    radial-gradient(circle at 12% 34%, rgba(0, 0, 0, 0.48), transparent 16rem),
    linear-gradient(180deg, transparent 72%, #020403 98%);
}

.rain {
  position: absolute;
  inset: -30%;
  z-index: -1;
  pointer-events: none;
  opacity: 0.42;
  background-image:
    linear-gradient(110deg, transparent 0 47%, rgba(223, 235, 231, 0.18) 48%, transparent 51%),
    linear-gradient(110deg, transparent 0 44%, rgba(156, 175, 138, 0.11) 45%, transparent 48%);
  background-size: 108px 240px, 156px 320px;
  animation: rainFall 14s linear infinite;
}

.fog {
  position: absolute;
  left: -12%;
  right: -12%;
  height: 22svh;
  z-index: -1;
  pointer-events: none;
  filter: blur(28px);
  opacity: calc((var(--mist, 72) / 100) * 0.34);
  background: linear-gradient(90deg, transparent, rgba(186, 201, 196, 0.26), transparent);
}

.fog-one {
  bottom: 12%;
  animation: fogDrift 28s ease-in-out infinite;
}

.fog-two {
  bottom: 24%;
  opacity: calc((var(--mist, 72) / 100) * 0.2);
  animation: fogDrift 36s ease-in-out infinite reverse;
}

.gate-open .hero::before {
  filter: brightness(1.14) contrast(1.06);
}

.gate-open .stone-panel {
  border-color: rgba(214, 168, 94, 0.48);
  box-shadow:
    var(--shadow),
    inset 0 0 0 1px rgba(214, 168, 94, 0.16),
    0 0 44px rgba(214, 168, 94, 0.14);
}

.topbar {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(236, 231, 220, 0.12);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  width: fit-content;
  color: var(--text);
  text-decoration: none;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(1.35rem, 2vw, 1.9rem);
  font-weight: 700;
  letter-spacing: 0;
}

.brand-mark {
  width: 25px;
  height: 42px;
  display: inline-block;
  background:
    linear-gradient(var(--text), var(--text)) center / 1px 100% no-repeat,
    linear-gradient(135deg, transparent 45%, var(--line-hot) 46% 54%, transparent 55%) center 16px / 22px 22px no-repeat,
    radial-gradient(circle, transparent 43%, var(--line-hot) 44% 49%, transparent 50%) center 4px / 12px 12px no-repeat;
  filter: drop-shadow(0 0 12px rgba(214, 168, 94, 0.28));
}

.nav-links {
  display: flex;
  gap: clamp(24px, 5vw, 74px);
  align-items: center;
}

.nav-links a {
  color: rgba(236, 231, 220, 0.78);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-family: "Cormorant Garamond", serif;
  font-size: 0.86rem;
  transition: color 180ms ease, text-shadow 180ms ease;
}

.nav-links a:hover {
  color: var(--text);
  text-shadow: 0 0 18px rgba(214, 168, 94, 0.26);
}

.icon-button {
  justify-self: end;
  width: 46px;
  height: 46px;
  display: grid;
  place-content: center;
  gap: 6px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.icon-button span {
  width: 24px;
  height: 1px;
  background: currentColor;
  transition: transform 180ms ease, opacity 180ms ease;
}

.icon-button:hover {
  border-color: var(--line);
  background: rgba(236, 231, 220, 0.04);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(310px, 0.92fr) minmax(360px, 560px);
  gap: clamp(30px, 6vw, 90px);
  align-items: center;
  padding: clamp(48px, 8vh, 96px) 0 clamp(26px, 4vh, 44px);
}

.hero-copy {
  max-width: 780px;
}

.ornament-line {
  width: min(240px, 58vw);
  height: 1px;
  margin-bottom: 34px;
  background: linear-gradient(90deg, var(--line-hot), rgba(236, 231, 220, 0.1), transparent);
  position: relative;
}

.ornament-line::after {
  content: "";
  position: absolute;
  left: 44%;
  top: 50%;
  width: 9px;
  height: 9px;
  border: 1px solid var(--line-hot);
  transform: translate(-50%, -50%) rotate(45deg);
  background: rgba(2, 4, 3, 0.86);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(4rem, 8.2vw, 8.7rem);
  line-height: 0.91;
  font-weight: 600;
  max-width: 900px;
  letter-spacing: 0;
  color: #efe9dd;
  text-shadow: 0 16px 58px rgba(0, 0, 0, 0.92);
}

.hero-copy p {
  max-width: 610px;
  margin-top: 30px;
  color: rgba(236, 231, 220, 0.78);
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(1.35rem, 2vw, 1.86rem);
  line-height: 1.35;
  text-shadow: 0 10px 38px rgba(0, 0, 0, 0.86);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 36px;
}

.primary-action,
.secondary-action,
.mini-action {
  border: 1px solid var(--line);
  color: var(--text);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.78rem;
  font-weight: 700;
  transition: transform 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}

.primary-action {
  min-height: 54px;
  padding: 0 24px;
  border-color: rgba(214, 168, 94, 0.5);
  background:
    linear-gradient(90deg, rgba(214, 168, 94, 0.16), rgba(156, 175, 138, 0.08)),
    rgba(4, 7, 6, 0.72);
  box-shadow: inset 0 0 0 1px rgba(236, 231, 220, 0.06), 0 18px 42px rgba(0, 0, 0, 0.35);
}

.secondary-action {
  min-height: 54px;
  padding: 0 22px;
  background: rgba(5, 8, 8, 0.68);
}

.primary-action:hover,
.secondary-action:hover,
.mini-action:hover {
  transform: translateY(-2px);
  border-color: rgba(236, 231, 220, 0.48);
  background-color: rgba(20, 26, 24, 0.9);
}

.stone-panel {
  position: relative;
  padding: clamp(24px, 3vw, 34px);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.035), transparent 28%),
    linear-gradient(180deg, rgba(16, 21, 20, 0.92), rgba(5, 7, 7, 0.94));
  border: 1px solid rgba(236, 231, 220, 0.16);
  border-radius: 8px;
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(14px);
  overflow: hidden;
}

.stone-panel::before,
.stone-panel::after {
  content: "";
  position: absolute;
  inset: 12px;
  pointer-events: none;
  border: 1px solid rgba(236, 231, 220, 0.08);
}

.stone-panel::after {
  inset: 22px;
  border-color: rgba(214, 168, 94, 0.08);
}

.panel-crown {
  width: 98px;
  height: 30px;
  margin: 0 auto 14px;
  opacity: 0.55;
  background:
    linear-gradient(90deg, transparent, var(--line-hot), transparent) center / 100% 1px no-repeat,
    radial-gradient(circle, transparent 41%, var(--line-hot) 43% 48%, transparent 50%) center / 28px 28px no-repeat;
}

.panel-header,
.support-row,
.journal-strip,
.range-row {
  position: relative;
  z-index: 1;
}

.panel-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(236, 231, 220, 0.13);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: rgba(236, 231, 220, 0.74);
  font-size: 0.76rem;
}

.panel-header strong {
  color: var(--amber);
  font-size: 0.86rem;
}

.gauge-wrap {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 22px;
  align-items: center;
  padding: 28px 0 24px;
}

.gauge {
  --value: 72;
  width: 126px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, rgba(4, 6, 6, 0.96) 0 56%, transparent 57%),
    conic-gradient(var(--green) calc(var(--value) * 1%), rgba(236, 231, 220, 0.12) 0);
  box-shadow:
    inset 0 0 0 1px rgba(236, 231, 220, 0.12),
    0 0 34px rgba(156, 175, 138, 0.13);
}

.gauge span {
  font-family: "Cormorant Garamond", serif;
  font-size: 3.35rem;
  color: var(--text);
}

.gauge-wrap h2 {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(1.7rem, 3vw, 2.65rem);
  font-weight: 600;
  color: var(--text);
}

.gauge-wrap p {
  margin-top: 8px;
  color: rgba(236, 231, 220, 0.62);
  line-height: 1.55;
  font-size: 0.95rem;
}

.range-row {
  display: grid;
  gap: 12px;
  color: rgba(236, 231, 220, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.75rem;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--green);
}

.signal-line {
  position: relative;
  z-index: 1;
  height: 54px;
  margin: 20px 0 4px;
  border-top: 1px solid rgba(236, 231, 220, 0.1);
  border-bottom: 1px solid rgba(236, 231, 220, 0.1);
  overflow: hidden;
}

.signal-line span {
  position: absolute;
  inset: 13px 0;
  background:
    linear-gradient(90deg, transparent, rgba(156, 175, 138, 0.85), transparent) 0 50% / 160px 1px repeat-x,
    radial-gradient(circle, rgba(156, 175, 138, 0.95) 0 2px, transparent 3px) 32px 50% / 190px 12px repeat-x;
  filter: drop-shadow(0 0 10px rgba(156, 175, 138, 0.52));
  animation: signalMove 5.6s linear infinite;
}

.journal-strip {
  margin-top: 20px;
  padding: 18px 18px 16px;
  border: 1px solid rgba(236, 231, 220, 0.1);
  background: rgba(1, 2, 2, 0.33);
}

.journal-strip span,
.support-row span {
  display: block;
  color: rgba(236, 231, 220, 0.52);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.68rem;
  margin-bottom: 8px;
}

.journal-strip p {
  font-family: "Cormorant Garamond", serif;
  color: rgba(236, 231, 220, 0.83);
  font-size: 1.2rem;
  line-height: 1.36;
}

.journal-strip small {
  display: block;
  margin-top: 12px;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.68rem;
}

.support-row {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-top: 18px;
  padding: 16px 0 0;
  border-top: 1px solid rgba(236, 231, 220, 0.12);
}

.support-row strong {
  display: block;
  color: rgba(236, 231, 220, 0.88);
  font-size: 0.9rem;
  line-height: 1.35;
}

.mini-action {
  min-width: 132px;
  height: 42px;
  padding: 0 14px;
  background: rgba(11, 15, 14, 0.82);
  color: rgba(236, 231, 220, 0.84);
}

.lower-rail {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border: 1px solid rgba(236, 231, 220, 0.12);
  background: linear-gradient(180deg, rgba(17, 22, 21, 0.82), rgba(4, 6, 6, 0.84));
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.46);
}

.rail-item {
  display: grid;
  grid-template-columns: 58px 1fr;
  grid-template-areas:
    "icon title"
    "icon text";
  gap: 5px 18px;
  min-height: 128px;
  padding: 24px clamp(16px, 2.5vw, 34px);
  border: 0;
  border-right: 1px solid rgba(236, 231, 220, 0.1);
  background: transparent;
  color: rgba(236, 231, 220, 0.76);
  text-align: left;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease;
}

.rail-item:last-child {
  border-right: 0;
}

.rail-item:hover,
.rail-item.active {
  color: var(--text);
  background: linear-gradient(90deg, rgba(214, 168, 94, 0.1), rgba(156, 175, 138, 0.04));
}

.rail-icon {
  grid-area: icon;
  align-self: center;
  justify-self: center;
  color: var(--green);
  font-size: 2.1rem;
  text-shadow: 0 0 20px rgba(156, 175, 138, 0.3);
}

.rail-item strong {
  grid-area: title;
  align-self: end;
  font-family: "Cormorant Garamond", serif;
  font-size: 1.65rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.rail-item small {
  grid-area: text;
  color: rgba(236, 231, 220, 0.56);
  line-height: 1.45;
  font-size: 0.88rem;
}

.story-section {
  padding: clamp(74px, 10vw, 128px) clamp(18px, 4vw, 76px);
  background:
    linear-gradient(180deg, #020403, #070a09 44%, #020403),
    radial-gradient(circle at 30% 0%, rgba(214, 168, 94, 0.1), transparent 22rem);
}

.section-inner {
  max-width: 1240px;
  margin: 0 auto;
}

.section-kicker {
  color: var(--amber);
  text-transform: uppercase;
  letter-spacing: 0.22em;
  font-size: 0.76rem;
  margin-bottom: 18px;
}

.story-section h2 {
  max-width: 940px;
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(2.7rem, 5vw, 5.8rem);
  line-height: 0.96;
  font-weight: 600;
}

.story-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  margin-top: 48px;
  border: 1px solid rgba(236, 231, 220, 0.1);
  background: rgba(236, 231, 220, 0.1);
}

.story-grid article {
  min-height: 250px;
  padding: 28px;
  background: rgba(5, 8, 8, 0.92);
}

.story-grid span {
  color: var(--green);
  font-family: "Cormorant Garamond", serif;
  font-size: 1.5rem;
}

.story-grid h3 {
  margin-top: 42px;
  font-family: "Cormorant Garamond", serif;
  font-size: 2.2rem;
  font-weight: 600;
}

.story-grid p {
  margin-top: 12px;
  color: rgba(236, 231, 220, 0.62);
  line-height: 1.7;
}

.journal-modal[hidden] {
  display: none;
}

.journal-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal-scrim {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.74);
  backdrop-filter: blur(8px);
}

.modal-card {
  position: relative;
  z-index: 1;
  width: min(720px, 100%);
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid rgba(236, 231, 220, 0.18);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(16, 21, 20, 0.98), rgba(4, 6, 6, 0.98));
  box-shadow: var(--shadow);
}

.modal-card h2 {
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  font-weight: 600;
}

.modal-card textarea {
  width: 100%;
  min-height: 210px;
  margin: 24px 0 18px;
  padding: 18px;
  resize: vertical;
  border: 1px solid rgba(236, 231, 220, 0.14);
  background: rgba(0, 0, 0, 0.32);
  color: var(--text);
  line-height: 1.7;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: 1px solid rgba(236, 231, 220, 0.14);
  background: transparent;
  color: var(--text);
  font-size: 1.6rem;
  cursor: pointer;
}

@keyframes rainFall {
  from {
    transform: translate3d(0, -8%, 0);
  }
  to {
    transform: translate3d(-4%, 8%, 0);
  }
}

@keyframes fogDrift {
  0%,
  100% {
    transform: translateX(-8%);
  }
  50% {
    transform: translateX(8%);
  }
}

@keyframes signalMove {
  from {
    transform: translateX(-80px);
  }
  to {
    transform: translateX(80px);
  }
}

@media (max-width: 1080px) {
  .hero {
    min-height: auto;
  }

  .topbar {
    grid-template-columns: 1fr auto;
  }

  .nav-links {
    display: none;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    padding-top: 54px;
  }

  .stone-panel {
    max-width: 680px;
  }
}

@media (max-width: 760px) {
  .hero {
    padding: 18px 16px 24px;
  }

  .hero::before {
    background:
      linear-gradient(180deg, rgba(2, 4, 3, 0.88) 0%, rgba(2, 4, 3, 0.48) 42%, rgba(2, 4, 3, 0.96) 100%),
      url("./assets/cemetery-night.png") 58% center / cover no-repeat;
  }

  h1 {
    font-size: clamp(3.35rem, 17vw, 5.6rem);
  }

  .hero-copy p {
    font-size: 1.24rem;
  }

  .hero-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .primary-action,
  .secondary-action {
    width: 100%;
  }

  .stone-panel {
    padding: 22px;
  }

  .gauge-wrap {
    grid-template-columns: 1fr;
  }

  .gauge {
    width: 116px;
  }

  .support-row {
    align-items: stretch;
    flex-direction: column;
  }

  .mini-action {
    width: 100%;
  }

  .lower-rail,
  .story-grid {
    grid-template-columns: 1fr;
  }

  .rail-item {
    border-right: 0;
    border-bottom: 1px solid rgba(236, 231, 220, 0.1);
  }

  .rail-item:last-child {
    border-bottom: 0;
  }
}

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