:root {
  --sky-top: #0b1220;
  --ink: #e8eef6;
  --ink-muted: rgba(214, 224, 236, 0.78);
  --cloud: 230, 228, 236;
  --cloud-alpha: 0.12;
  --fog-alpha: 0;
  --stars-alpha: 0;
  --grain-alpha: 0.05;
  --scene-brightness: 1;
  --scene-saturate: 1.05;
  --light-wash: rgba(12, 22, 44, 0.2);
  --vignette: 0.35;
  --brand-blue: #3b5b8c;
  color-scheme: dark;
}

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

html,
body {
  min-height: 100%;
}

html {
  background: #05070c;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Exo 2", "IBM Plex Sans", system-ui, sans-serif;
  background: #05070c;
  overflow: hidden;
}

::selection {
  background: rgba(59, 91, 140, 0.55);
  color: #f4f7fb;
}

:focus-visible {
  outline: 2px solid #c5d0e0;
  outline-offset: 3px;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.landscapes {
  position: absolute;
  inset: 0;
}

.landscape {
  position: absolute;
  inset: 0;
  background-color: #05070c;
  background-position: center;
  background-size: cover;
  background-repeat: no-repeat;
  opacity: 0;
  transform: scale(1.04);
  filter: brightness(var(--scene-brightness)) saturate(var(--scene-saturate));
  transition: opacity 1.8s ease;
}

.landscape--spring {
  background-image: url("assets/season-spring.jpg");
}

.landscape--summer {
  background-image: url("assets/season-summer.jpg");
}

.landscape--autumn {
  background-image: url("assets/season-autumn.jpg");
}

.landscape--winter {
  background-image: url("assets/season-winter.jpg");
}

body[data-season="spring"] .landscape--spring,
body[data-season="summer"] .landscape--summer,
body[data-season="autumn"] .landscape--autumn,
body[data-season="winter"] .landscape--winter {
  opacity: 1;
}

.light {
  position: absolute;
  inset: 0;
  background: var(--light-wash);
  transition: background 1.8s ease;
}

.vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    ellipse at center,
    transparent 42%,
    rgba(0, 0, 0, var(--vignette)) 100%
  );
  transition: background 1.8s ease;
}

.damask {
  position: absolute;
  inset: 0;
  opacity: 0.11;
  mix-blend-mode: overlay;
  background-color: var(--brand-blue);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cpath fill='none' stroke='%239bb4d4' stroke-width='1.2' d='M90 12c18 22 28 38 28 58s-10 36-28 58c-18-22-28-38-28-58s10-36 28-58zm0 0c-18 22-28 38-28 58m56 0c0-20-10-36-28-58M42 90c22 18 38 28 58 28s36-10 58-28c-22-18-38-28-58-28s-36 10-58 28z'/%3E%3Ccircle cx='90' cy='90' r='10' fill='none' stroke='%239bb4d4' stroke-width='1'/%3E%3C/svg%3E");
  background-size: 180px 180px;
}

.stars {
  position: absolute;
  inset: 0;
  opacity: var(--stars-alpha);
  background-image:
    radial-gradient(1.2px 1.2px at 8% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 22% 42%, #fff 50%, transparent 51%),
    radial-gradient(1.4px 1.4px at 36% 12%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 48% 28%, #fff 50%, transparent 51%),
    radial-gradient(1.1px 1.1px at 61% 8%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 74% 22%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 88% 14%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 12% 68%, #fff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 29% 81%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 55% 62%, #fff 50%, transparent 51%),
    radial-gradient(1.3px 1.3px at 71% 74%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 93% 58%, #fff 50%, transparent 51%);
  transition: opacity 2s ease;
}

.clouds {
  position: absolute;
  inset: -20% 0 0;
  opacity: var(--cloud-alpha);
  background:
    radial-gradient(42% 28% at 18% 22%, rgba(var(--cloud), 0.85) 0%, transparent 70%),
    radial-gradient(36% 24% at 42% 16%, rgba(var(--cloud), 0.7) 0%, transparent 68%),
    radial-gradient(48% 30% at 68% 20%, rgba(var(--cloud), 0.8) 0%, transparent 72%),
    radial-gradient(40% 26% at 88% 28%, rgba(var(--cloud), 0.65) 0%, transparent 70%);
  filter: blur(18px);
  animation: drift 80s linear infinite;
  transition: opacity 2s ease;
}

.fog {
  position: absolute;
  inset: 35% 0 0;
  background: linear-gradient(
    180deg,
    transparent 0%,
    rgba(var(--cloud), var(--fog-alpha)) 55%,
    rgba(var(--cloud), calc(var(--fog-alpha) * 1.15)) 100%
  );
  filter: blur(12px);
  transition: background 2s ease;
}

.precip {
  position: absolute;
  inset: -60px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.2s ease;
}

body[data-weather="rain"] .precip,
body[data-weather="storm"] .precip {
  opacity: 0.85;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='420' viewBox='0 0 220 420'%3E%3Cline x1='24' y1='20' x2='24' y2='54' stroke='rgba(215,230,250,0.65)' stroke-width='1.4' stroke-linecap='round'/%3E%3Cline x1='78' y1='140' x2='78' y2='178' stroke='rgba(215,230,250,0.5)' stroke-width='1.2' stroke-linecap='round'/%3E%3Cline x1='132' y1='65' x2='132' y2='104' stroke='rgba(215,230,250,0.6)' stroke-width='1.3' stroke-linecap='round'/%3E%3Cline x1='188' y1='220' x2='188' y2='262' stroke='rgba(215,230,250,0.7)' stroke-width='1.5' stroke-linecap='round'/%3E%3Cline x1='45' y1='280' x2='45' y2='314' stroke='rgba(215,230,250,0.45)' stroke-width='1.1' stroke-linecap='round'/%3E%3Cline x1='102' y1='340' x2='102' y2='378' stroke='rgba(215,230,250,0.55)' stroke-width='1.3' stroke-linecap='round'/%3E%3Cline x1='160' y1='15' x2='160' y2='50' stroke='rgba(215,230,250,0.5)' stroke-width='1.2' stroke-linecap='round'/%3E%3Cline x1='210' y1='320' x2='210' y2='352' stroke='rgba(215,230,250,0.4)' stroke-width='1' stroke-linecap='round'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='300' viewBox='0 0 160 300'%3E%3Cline x1='18' y1='40' x2='18' y2='64' stroke='rgba(200,220,245,0.4)' stroke-width='1' stroke-linecap='round'/%3E%3Cline x1='64' y1='120' x2='64' y2='146' stroke='rgba(200,220,245,0.35)' stroke-width='0.9' stroke-linecap='round'/%3E%3Cline x1='112' y1='20' x2='112' y2='48' stroke='rgba(200,220,245,0.4)' stroke-width='1' stroke-linecap='round'/%3E%3Cline x1='145' y1='200' x2='145' y2='228' stroke='rgba(200,220,245,0.35)' stroke-width='0.9' stroke-linecap='round'/%3E%3Cline x1='38' y1='230' x2='38' y2='254' stroke='rgba(200,220,245,0.3)' stroke-width='0.8' stroke-linecap='round'/%3E%3Cline x1='90' y1='170' x2='90' y2='198' stroke='rgba(200,220,245,0.38)' stroke-width='1' stroke-linecap='round'/%3E%3C/svg%3E");
  background-size: 220px 420px, 160px 300px;
  animation: rain-fall 0.44s linear infinite;
  transform: skewX(-7deg);
}

body[data-weather="storm"] .precip {
  opacity: 1;
  animation: rain-fall 0.28s linear infinite;
  transform: skewX(-12deg);
}

body[data-weather="snow"] .precip {
  opacity: 0.85;
  background-image:
    radial-gradient(2px 2px at 10% 20%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 30% 40%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 55% 15%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 75% 35%, #fff 50%, transparent 51%),
    radial-gradient(2.2px 2.2px at 90% 10%, #fff 50%, transparent 51%),
    radial-gradient(1.6px 1.6px at 20% 70%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 48% 80%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 68% 62%, #fff 50%, transparent 51%),
    radial-gradient(2px 2px at 85% 88%, #fff 50%, transparent 51%);
  background-size: 220px 220px;
  animation: snow 12s linear infinite;
}

.lightning {
  position: absolute;
  inset: 0;
  opacity: 0;
  background: rgba(230, 236, 255, 0.45);
  mix-blend-mode: screen;
  pointer-events: none;
}

body[data-weather="storm"] .lightning {
  animation: lightning 7s ease-in-out infinite;
}

.grain {
  position: absolute;
  inset: 0;
  opacity: var(--grain-alpha);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
  background-size: 160px 160px;
  mix-blend-mode: overlay;
}

.site {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  color: var(--ink);
}

.logo {
  width: min(88vw, 560px);
  height: auto;
  display: block;
  user-select: none;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.logo:hover {
  transform: scale(1.015);
}

.logo:active {
  transform: scale(0.98);
}

.status,
.footer {
  color: var(--ink-muted);
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.7);
  transition: color 1.4s ease;
}

/* Floating Atmosphere Studio Window */
.preview-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
}

.preview-modal.is-open {
  opacity: 1;
  visibility: visible;
}

.preview-dialog {
  position: fixed;
  z-index: 101;
  pointer-events: auto;
  width: min(92vw, 440px);
  max-height: calc(100dvh - 2.5rem);
  background: rgba(9, 15, 26, 0.88);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(130, 180, 240, 0.25);
  border-radius: 20px;
  box-shadow: 0 24px 65px rgba(0, 0, 0, 0.8),
    0 0 45px rgba(59, 91, 140, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.15);
  display: flex;
  flex-direction: column;
  color: var(--ink);
  overflow: hidden;
  touch-action: none;
}

.preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  background: rgba(255, 255, 255, 0.02);
}

.preview-header:active,
.preview-header.is-dragging {
  cursor: grabbing;
}

.preview-title-group {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.preview-drag-handle {
  font-size: 1.1rem;
  line-height: 1;
  color: rgba(200, 220, 245, 0.4);
  cursor: grab;
  letter-spacing: -2px;
  margin-right: 0.15rem;
  user-select: none;
}

.preview-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 10px #34d399;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.preview-indicator.indicator-override {
  background: #60a5fa;
  box-shadow: 0 0 12px #60a5fa;
}

.preview-title {
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  margin: 0;
  color: #fff;
}

.preview-badge {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  padding: 2px 8px;
  border-radius: 9999px;
  background: rgba(52, 211, 153, 0.16);
  color: #6ee7b7;
  border: 1px solid rgba(52, 211, 153, 0.3);
  transition: all 0.3s ease;
}

.preview-badge.preview-badge-override {
  background: rgba(96, 165, 250, 0.18);
  color: #93c5fd;
  border-color: rgba(96, 165, 250, 0.35);
}

.preview-close-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--ink-muted);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preview-close-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
}

.preview-body {
  padding: 1rem 1.15rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.preview-body::-webkit-scrollbar {
  width: 6px;
}
.preview-body::-webkit-scrollbar-track {
  background: transparent;
}
.preview-body::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

.preview-group {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.preview-group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.preview-label {
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: rgba(200, 218, 240, 0.7);
}

.preview-value {
  font-size: 0.82rem;
  font-weight: 500;
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
  padding: 2px 8px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.preview-chips {
  display: grid;
  gap: 0.45rem;
}

.grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

.grid-6 {
  grid-template-columns: repeat(3, 1fr);
}

@media (min-width: 480px) {
  .grid-6 {
    grid-template-columns: repeat(6, 1fr);
  }
}

.preview-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--ink-muted);
  border-radius: 10px;
  padding: 0.5rem 0.4rem;
  font-size: 0.78rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.preview-chip:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  border-color: rgba(150, 190, 240, 0.3);
  transform: translateY(-1px);
}

.preview-chip.is-active {
  background: rgba(59, 91, 140, 0.75);
  border-color: #8bb3e8;
  color: #ffffff;
  box-shadow: 0 0 16px rgba(90, 145, 230, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.preview-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.12);
  outline: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.preview-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #a9c6eb;
  border: 2px solid #ffffff;
  box-shadow: 0 0 12px rgba(135, 185, 250, 0.8);
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.preview-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  background: #ffffff;
}

.preview-range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #a9c6eb;
  border: 2px solid #ffffff;
  box-shadow: 0 0 12px rgba(135, 185, 250, 0.8);
  cursor: pointer;
}

.preview-sliders {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.slider-row {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--ink-muted);
}

.preview-action-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 0.55rem 0.85rem;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preview-action-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.preview-action-btn:active {
  transform: scale(0.98);
}

.preview-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
  background: rgba(6, 10, 18, 0.4);
}

.preview-reset-btn {
  width: 100%;
  background: rgba(59, 91, 140, 0.4);
  border: 1px solid rgba(120, 165, 225, 0.35);
  color: #ffffff;
  padding: 0.65rem 1rem;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.25s ease;
}

.preview-reset-btn:hover {
  background: rgba(59, 91, 140, 0.75);
  border-color: #8bb3e8;
  box-shadow: 0 0 18px rgba(90, 140, 220, 0.4);
  transform: translateY(-1px);
}

.preview-reset-btn:active {
  transform: scale(0.98);
}

.preview-tip {
  font-size: 0.68rem;
  color: rgba(200, 218, 240, 0.5);
  margin: 0;
  letter-spacing: 0.05em;
}

@keyframes drift {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(-8%);
  }
}

@keyframes rain-fall {
  0% {
    background-position: 0 0, 0 0;
  }
  100% {
    background-position: 0 420px, 0 300px;
  }
}

@keyframes snow {
  from {
    background-position: 0 0, 40px 20px, 0 0;
  }
  to {
    background-position: 40px 220px, 10px 240px, -30px 220px;
  }
}

@keyframes lightning {
  0%,
  86%,
  100% {
    opacity: 0;
  }
  87% {
    opacity: 0.55;
  }
  88% {
    opacity: 0.08;
  }
  89.5% {
    opacity: 0.4;
  }
  91% {
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .clouds,
  .precip,
  .lightning,
  .landscape,
  .light,
  .stars,
  .fog,
  .status,
  .footer,
  .logo {
    animation: none !important;
    transition: none !important;
  }

  .landscape,
  .logo {
    transform: none !important;
  }
}
