:root {
  --ink: #1a1410;
  --sand: #e8d3b0;
  --copper: #c45c26;
  --ember: #ff7a3d;
  --canal-bright: #4ecdc4;
  --night: #0c1218;
  --land: #0c1218;
  --line: rgba(232, 211, 176, 0.22);
  --font-display: "Syne", sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --mode-a: #1b2430;
  --mode-b: #c45c26;
  --mode-c: #e8d3b0;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--sand);
  font-family: var(--font-mono);
  background: var(--night);
  overflow-x: hidden;
}

body::selection {
  background: var(--copper);
  color: var(--night);
}

.sky {
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background: linear-gradient(
    180deg,
    var(--mode-a) 0%,
    color-mix(in srgb, var(--mode-a) 55%, var(--mode-b)) 42%,
    var(--mode-b) 68%,
    var(--mode-c) 100%
  );
  transition: background 1.2s var(--ease);
}

.sky__wash {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 45% at 70% 18%, rgba(255, 122, 61, 0.35), transparent 60%),
    radial-gradient(ellipse 60% 40% at 20% 30%, rgba(78, 205, 196, 0.12), transparent 55%);
  opacity: 0.9;
  transition: opacity 1.2s var(--ease), background 1.2s var(--ease);
}

body[data-phase="day"] .sky__wash {
  background:
    radial-gradient(ellipse 70% 40% at 60% 20%, rgba(255, 220, 140, 0.45), transparent 55%),
    radial-gradient(ellipse 50% 35% at 20% 40%, rgba(120, 180, 220, 0.2), transparent 60%);
}

body[data-phase="night"] .sky__wash {
  background:
    radial-gradient(ellipse 55% 35% at 75% 18%, rgba(120, 160, 255, 0.18), transparent 60%),
    radial-gradient(ellipse 40% 30% at 20% 35%, rgba(40, 70, 120, 0.2), transparent 55%);
}

body[data-phase="day"] .sky__heat {
  opacity: 0.85;
}

body[data-phase="night"] .sky__heat {
  opacity: 0.25;
}

.sky__heat {
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 3px,
    rgba(255, 255, 255, 0.015) 3px,
    rgba(255, 255, 255, 0.015) 4px
  );
  mix-blend-mode: soft-light;
  animation: heat-shimmer 7s linear infinite;
}

.sky__horizon {
  position: absolute;
  left: -5%;
  right: -5%;
  bottom: 0;
  height: 28vh;
  background: var(--land);
  clip-path: polygon(
    0% 55%,
    8% 48%,
    14% 52%,
    22% 40%,
    31% 46%,
    42% 28%,
    53% 38%,
    62% 22%,
    71% 34%,
    80% 30%,
    88% 42%,
    100% 36%,
    100% 100%,
    0% 100%
  );
}

.sky__cacti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.saguaro {
  position: absolute;
  fill: var(--land);
  opacity: 1;
}

.saguaro--1 {
  left: 10%;
  bottom: 10vh;
  width: clamp(36px, 5vw, 72px);
  height: auto;
}

.saguaro--2 {
  left: 25%;
  bottom: 12.5vh;
  width: clamp(48px, 6.5vw, 92px);
  height: auto;
}

.saguaro--3 {
  left: 46%;
  bottom: 16vh;
  width: clamp(28px, 3.8vw, 54px);
  height: auto;
}

.saguaro--4 {
  left: 56%;
  bottom: 17.5vh;
  width: clamp(56px, 7.5vw, 110px);
  height: auto;
}

.saguaro--5 {
  left: 74%;
  bottom: 14.5vh;
  width: clamp(34px, 4.5vw, 64px);
  height: auto;
}

@keyframes heat-shimmer {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-12px);
  }
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem clamp(1rem, 3vw, 2rem);
  backdrop-filter: blur(10px);
  background: color-mix(in srgb, var(--night) 35%, transparent);
  border-bottom: 1px solid var(--line);
}

.topbar__meta {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: inherit;
  font-family: inherit;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.78;
  appearance: none;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0;
  padding: 0.35rem 0.45rem;
  cursor: pointer;
  transition: opacity 0.2s var(--ease), border-color 0.2s var(--ease);
}

.topbar__meta:hover,
.topbar__meta[aria-expanded="true"] {
  opacity: 1;
  border-color: var(--line);
}

.topbar__moon {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.topbar__moon canvas {
  width: 14px;
  height: 14px;
  display: block;
  flex-shrink: 0;
}

.topbar__sep {
  opacity: 0.55;
}

.sky-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: start end;
  padding: 4.5rem clamp(1rem, 3vw, 2rem) 1rem;
}

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

.sky-modal__backdrop {
  position: absolute;
  inset: 0;
  appearance: none;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(8, 12, 18, 0.28);
  cursor: pointer;
}

.sky-modal__panel {
  position: relative;
  z-index: 1;
  width: min(22rem, calc(100vw - 2rem));
  padding: 1rem 1.1rem 1.15rem;
  border: 1px solid rgba(232, 211, 176, 0.22);
  background: rgba(12, 18, 24, 0.45);
  backdrop-filter: blur(14px);
  color: #e8d3b0;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

.sky-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.sky-modal__head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1rem;
  letter-spacing: -0.02em;
  font-weight: 700;
}

.sky-modal__close {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  padding: 0.1rem 0.25rem;
}

.sky-modal__close:hover {
  opacity: 1;
}

.sky-modal__field {
  display: grid;
  gap: 0.45rem;
  margin-bottom: 1rem;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sky-modal__label {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  opacity: 0.85;
}

.sky-modal__field input[type="range"] {
  width: 100%;
  accent-color: var(--ember);
  cursor: pointer;
}

.sky-modal__reset {
  appearance: none;
  width: 100%;
  border: 1px solid var(--line);
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.sky-modal__reset:hover {
  border-color: var(--canal-bright);
  color: var(--canal-bright);
}

.hero {
  position: relative;
  min-height: calc(100vh - 3.5rem);
  min-height: calc(100dvh - 3.5rem);
  display: grid;
  align-items: end;
  padding: clamp(1.5rem, 5vw, 4rem);
  padding-bottom: clamp(3rem, 10vh, 6rem);
  overflow: hidden;
}

.hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: auto;
  cursor: crosshair;
}

.hero__copy {
  position: relative;
  z-index: 1;
  max-width: 38rem;
  animation: rise 1s var(--ease) both;
  pointer-events: none;
}

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

.hero__brand {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(5.5rem, 22vw, 12rem);
  line-height: 0.85;
  letter-spacing: -0.07em;
  color: var(--ember);
  text-shadow: 0 0 60px color-mix(in srgb, var(--ember) 35%, transparent);
  animation: brand-glow 4.5s ease-in-out infinite;
}

@keyframes brand-glow {
  0%,
  100% {
    filter: brightness(1);
  }
  50% {
    filter: brightness(1.12);
  }
}

.hero__title {
  margin: 1.1rem 0 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.05rem, 4.2vw, 2.35rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  max-width: none;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .topbar__meta {
    font-size: 0.65rem;
    gap: 0.3rem;
  }

  .hero__brand {
    font-size: clamp(4.5rem, 28vw, 7rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
