/* Colors for day and night. Accent is tezontle red (the volcanic stone of old Mexico City buildings). */
:root {
  --sky-top: #8fc0e8;
  --sky-bottom: #f4e4cf;
  --orb: #fff3d6;
  --ridge-far: #b9c4d4;
  --izta: #8d9bb4;
  --popo: #7e8eaa;
  --snow: #fbfdff;
  --smoke: rgba(235, 232, 228, 0.7);
  --hills: #66756d;
  --city: #3b4641;
  --window: transparent;
  --text: #1e2830;
  --muted: #5a6570;
  --paper: rgba(255, 252, 246, 0.84);
  --accent: #a8462a;
  --stars: 0;
  --cloud: rgba(255, 255, 255, 0.6);
}

[data-theme="night"] {
  --sky-top: #0a1230;
  --sky-bottom: #2c3760;
  --orb: #e9ecf5;
  --ridge-far: #27314f;
  --izta: #212a45;
  --popo: #1d2641;
  --snow: #c5cfe6;
  --smoke: rgba(150, 160, 190, 0.35);
  --hills: #141a2b;
  --city: #0c101b;
  --window: #ffd27a;
  --text: #ebe8df;
  --muted: #a7adbd;
  --paper: rgba(14, 19, 36, 0.8);
  --accent: #f2a67c;
  --stars: 1;
  --cloud: rgba(170, 182, 215, 0.12);
}

* { box-sizing: border-box; }

/* Mobile first: these are the phone styles. Bigger screens add to them at the end. */

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--sky-bottom);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

/* Show only the chosen language */
[data-lang="es"] body [lang="en"],
[data-lang="en"] body [lang="es"] { display: none; }

/* ---------- landscape ---------- */
.sky,
.landscape {
  position: fixed;
  left: 0;
  width: 100%;
  z-index: -1;
}
.sky { top: 0; height: 100%; }
/* Phone (portrait): a 2:1 band at the bottom, cropped to the two volcanoes by script.js */
.landscape { bottom: 0; height: 50vw; }

.sky-top { stop-color: var(--sky-top); }
.sky-bottom { stop-color: var(--sky-bottom); }
.orb { fill: var(--orb); }
.ridge-far { fill: var(--ridge-far); }
.izta { fill: var(--izta); }
.popo { fill: var(--popo); }
.snow { fill: var(--snow); }
.hills { fill: var(--hills); }
.city rect { fill: var(--city); }
.city .win { fill: var(--window); }
.stars { opacity: var(--stars); transition: opacity 0.6s; }
.stars circle { fill: #fff; }
.clouds g { fill: var(--cloud); transition: fill 0.6s; }
.meteors line { stroke: url(#meteor-tail); stroke-width: 2; stroke-linecap: round; }

.landscape * { transition: fill 0.6s, stop-color 0.6s; }

.smoke circle {
  fill: var(--smoke);
  transform-box: fill-box;
  transform-origin: center;
  animation: puff 12s linear infinite;
  opacity: 0;
}
.smoke circle:nth-child(2) { animation-delay: -3s; }
.smoke circle:nth-child(3) { animation-delay: -6s; }
.smoke circle:nth-child(4) { animation-delay: -9s; }

@keyframes puff {
  0%   { transform: translate(0, 0) scale(0.6); opacity: 0; }
  10%  { opacity: 1; }
  100% { transform: translate(90px, -110px) scale(3.2); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .smoke circle { animation: none; opacity: 0.6; }
}

/* ---------- controls ---------- */
.controls {
  position: absolute; /* scrolls away on phones, so it never covers the text */
  top: 0.9rem;
  right: 0.9rem;
  display: flex;
  gap: 0.4rem;
  z-index: 2;
}
.controls button {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  min-height: 2.25rem;
  color: var(--text);
  background: var(--paper);
  border: 1px solid color-mix(in srgb, var(--text) 15%, transparent);
  border-radius: 999px;
  padding: 0 0.9rem;
  cursor: pointer;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.controls button:hover { border-color: var(--accent); }
[data-theme="day"] .when-night,
[data-theme="night"] .when-day { display: none; }

/* ---------- content ---------- */
main {
  /* top: room for the buttons; bottom: room so the text never ends on top of the volcanoes */
  padding: 4.5rem 1.4rem 1rem;
}

h1 {
  font-size: clamp(2.1rem, 9vw, 3.6rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin: 0;
}
.tagline {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--muted);
  margin: 0.6rem 0 1.5rem;
}
.message p { margin: 0 0 1rem; }
.message strong { font-weight: 700; }

a {
  color: var(--accent);
  font-weight: 600;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { text-decoration-thickness: 2px; }

.links {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
  border-top: 1px solid color-mix(in srgb, var(--text) 15%, transparent);
}
.links li {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0.75rem 0; /* big enough to tap */
  border-bottom: 1px solid color-mix(in srgb, var(--text) 15%, transparent);
}
.links .label {
  width: 5rem;
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.links a { overflow-wrap: anywhere; }

/* On phones the footer ends the page: scrolling to the bottom leaves the volcanoes clear */
footer {
  padding: calc(50vw + 1rem) 1rem 0.6rem;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--snow);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* ---------- wider screens ---------- */

/* Phone turned sideways, tablets, laptops: the full wide landscape */
@media (orientation: landscape) {
  .landscape { height: 62vh; }
  footer { padding-top: 62vh; }
}

/* Big landscape screens: everything fits, so the footer stays in the corner */
@media (orientation: landscape) and (min-height: 600px) {
  footer { position: fixed; left: 1rem; right: 1rem; bottom: 0.5rem; padding: 0; }
  .controls { position: fixed; }
}

@media (min-width: 640px) {
  body { font-size: 1.05rem; }
  main { padding-left: 2.5rem; padding-right: 2.5rem; max-width: 40rem; }
}

@media (min-width: 900px) and (orientation: landscape) {
  main { max-width: 44rem; margin-left: 7vw; padding-top: 12vh; }
  .message { max-width: 36rem; }
  .links { max-width: 30rem; }
  .tagline { font-size: 1.05rem; }
  footer { left: auto; text-align: right; }
}
