/* lysdal.nu — cozy pixel night */
@font-face {
  font-family: 'Press Start 2P';
  src: url('fonts/PressStart2P-Regular.ttf') format('truetype');
  font-display: swap;
}

:root {
  --sky-top: #050914;
  --sky-mid: #0a1230;
  --sky-low: #182450;
  --star: #fff6d8;
  --window: #ffd97a;
  --accent: #7ee787;
  --btn: #2f6fed;
  --btn-dark: #1c3f8f;
  --text: #eef2ff;
  --cloud: #33406b;
  --skyline: #0d1126;
  --tagline: #b8c6ff;
  --footer-text: #8fa0d8;
  --title-shadow: #1c3f8f;
  --btn-edge: #0d1126;
}

[data-theme="morning"] {
  --sky-top: #8ec5e8;
  --sky-mid: #f6c39b;
  --sky-low: #f4907a;
  --cloud: #f6ddc2;
  --skyline: #3a2f4a;
  --window: #ffb35c;
  --accent: #a24936;
  --tagline: #6b4226;
  --footer-text: #8a5a44;
  --text: #3b2430;
  --title-shadow: #f7ddb8;
  --btn-edge: #3a2f4a;
}
[data-theme="morning"] .win:nth-child(even) { opacity: 0.15; animation: none; }
[data-theme="morning"] .star, [data-theme="morning"] .shooting-star,
[data-theme="day"] .star, [data-theme="day"] .shooting-star { display: none; }

[data-theme="day"] {
  --sky-top: #3f97d8;
  --sky-mid: #74bdea;
  --sky-low: #b9e2f8;
  --cloud: #f6fbff;
  --skyline: #5a6f95;
  --window: #2c3a55;
  --accent: #14532d;
  --tagline: #17395e;
  --footer-text: #2c4a72;
  --title-shadow: #1c3f8f;
  --btn-edge: #16326e;
}
[data-theme="day"] .win { animation: none; }

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: 'Press Start 2P', monospace;
  color: var(--text);
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 55%, var(--sky-low) 100%);
}

.scene { position: relative; height: 100dvh; overflow: hidden; }

.sky { position: absolute; inset: 0; overflow: hidden; }

.star {
  position: absolute;
  background: var(--star);
  animation: twinkle 3s steps(2, jump-none) infinite;
}
@keyframes twinkle {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}

.shooting-star {
  position: absolute;
  width: 4px;
  height: 4px;
  background: #fff;
  box-shadow:
    -6px 2px 0 0 rgba(255, 255, 255, 0.7),
    -12px 4px 0 0 rgba(255, 255, 255, 0.45),
    -18px 6px 0 0 rgba(255, 255, 255, 0.2);
  animation: shoot 0.9s linear forwards;
}
@keyframes shoot {
  from { transform: translate(0, 0); opacity: 1; }
  to { transform: translate(38vw, 14vw); opacity: 0; }
}

.moon, .mug, .sun {
  position: absolute;
  top: 8%;
  right: 8%;
  width: clamp(72px, 10vw, 128px);
}
.mug, .sun { display: none; }
[data-theme="morning"] .moon, [data-theme="day"] .moon { display: none; }
[data-theme="morning"] .mug { display: block; }
[data-theme="day"] .sun { display: block; }

.steam { animation: steam-rise 2.6s steps(5) infinite; opacity: 0; }
.steam-2 { animation-delay: -0.9s; }
.steam-3 { animation-delay: -1.7s; }
@keyframes steam-rise {
  0% { transform: translateY(0); opacity: 0; }
  20% { opacity: 0.9; }
  100% { transform: translateY(-4px); opacity: 0; }
}

.bird {
  position: absolute;
  width: clamp(18px, 2.4vw, 30px);
  animation: bird-fly linear forwards;
}
.bird .bird-f1 { animation: flap-a 0.5s steps(1) infinite; }
.bird .bird-f2 { animation: flap-b 0.5s steps(1) infinite; }
@keyframes flap-a { 0% { opacity: 1; } 50% { opacity: 0; } 100% { opacity: 1; } }
@keyframes flap-b { 0% { opacity: 0; } 50% { opacity: 1; } 100% { opacity: 0; } }
@keyframes bird-fly {
  from { transform: translate(0, 0); }
  to { transform: translate(112vw, -3vh); }
}

.cloud {
  position: absolute;
  left: 0;
  width: clamp(90px, 14vw, 180px);
  animation: drift linear infinite;
}
.cloud-1 { top: 12%; opacity: 0.8; animation-duration: 95s; animation-delay: -20s; }
.cloud-2 { top: 30%; opacity: 0.55; animation-duration: 140s; animation-delay: -75s; }
.cloud-3 { top: 52%; opacity: 0.4; animation-duration: 170s; animation-delay: -130s; }
@keyframes drift {
  from { transform: translateX(-25vw); }
  to { transform: translateX(115vw); }
}
#px-cloud { fill: var(--cloud); }

.content {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 34px;
  text-align: center;
  padding: 0 16px 40px;
}

.title {
  font-size: clamp(20px, 4.5vw, 44px);
  letter-spacing: 2px;
  text-shadow: 4px 4px 0 var(--title-shadow);
}

.tagline {
  font-size: clamp(9px, 1.6vw, 14px);
  line-height: 1.9;
  color: var(--tagline);
  white-space: pre-line;
  min-height: 3.8em;
  max-width: 36em;
}

.cursor {
  display: inline-block;
  width: 0.6em;
  height: 1em;
  margin-left: 2px;
  vertical-align: -0.1em;
  background: var(--accent);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.pixel-btn {
  display: inline-block;
  font-family: inherit;
  font-size: clamp(10px, 1.5vw, 14px);
  line-height: 1;
  color: #fff;
  text-decoration: none;
  background: var(--btn);
  padding: 16px 22px;
  border: 4px solid var(--btn-edge);
  box-shadow: inset -4px -4px 0 0 var(--btn-dark), 0 6px 0 0 var(--btn-edge);
}
.pixel-btn:hover,
.pixel-btn:focus-visible {
  transform: translateY(2px);
  box-shadow: inset -4px -4px 0 0 var(--btn-dark), 0 4px 0 0 var(--btn-edge);
}
.pixel-btn:active {
  transform: translateY(6px);
  box-shadow: inset -4px -4px 0 0 var(--btn-dark), 0 0 0 0 var(--btn-edge);
}

.skyline {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
}
.skyline svg {
  display: block;
  width: 100%;
  height: auto;
  min-height: 60px;
}
.bldg { fill: var(--skyline); }

.win { fill: var(--window); }
.win-a { animation: window-flicker 11s steps(1) infinite; }
.win-b { animation: window-flicker 17s steps(1) infinite; animation-delay: -5s; }
.win-c { animation: window-flicker 23s steps(1) infinite; animation-delay: -13s; }
@keyframes window-flicker {
  0%, 88%, 100% { opacity: 1; }
  90%, 96% { opacity: 0.12; }
}

.footer {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  z-index: 3;
  text-align: center;
  font-size: clamp(7px, 1.1vw, 10px);
  color: var(--footer-text);
}

.glyph-icon {
  height: 0.9em;
  width: 0.9em;
  vertical-align: middle;
  margin: 0 0.1em;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .star, .cursor, .cloud, .win-a, .win-b, .win-c { animation: none; }
  .shooting-star { display: none; }
  .steam { animation: none; opacity: 0.6; }
  .bird { display: none; }
}
