/* Sky colors are registered so they can fade smoothly when the weather changes. */
@property --sky-top     { syntax: "<color>"; inherits: true; initial-value: #3c74b4; }
@property --sky-mid     { syntax: "<color>"; inherits: true; initial-value: #5b93cc; }
@property --sky-low     { syntax: "<color>"; inherits: true; initial-value: #86b5df; }
@property --sky-horizon { syntax: "<color>"; inherits: true; initial-value: #b6d2ea; }

:root {
  --ink: #ffffff;
  --ink-soft: rgba(255, 255, 255, 0.78);
  --ink-shadow: rgba(32, 62, 108, 0.34);
  --serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --name-font: "Modak", var(--serif);
}

/* ---------- Weather moods (set from live NYC weather) ---------- */

body                      { --sky-top: #3c74b4; --sky-mid: #5b93cc; --sky-low: #86b5df; --sky-horizon: #b6d2ea; }
body[data-mood="cloudy"]  { --sky-top: #4677b0; --sky-mid: #6797c8; --sky-low: #92b9dc; --sky-horizon: #bcd3e7; }
body[data-mood="overcast"]{ --sky-top: #6f849c; --sky-mid: #8b9db2; --sky-low: #aebccb; --sky-horizon: #d3dae2; }
body[data-mood="fog"]     { --sky-top: #8c9cad; --sky-mid: #a6b3c1; --sky-low: #c2ccd6; --sky-horizon: #dde2e8; }
body[data-mood="rain"]    { --sky-top: #55687f; --sky-mid: #71839a; --sky-low: #95a5b8; --sky-horizon: #bcc7d3; }
body[data-mood="snow"]    { --sky-top: #92a8c0; --sky-mid: #b0c2d4; --sky-low: #ccd8e4; --sky-horizon: #e8eef4; }
body[data-mood="storm"]   { --sky-top: #36425a; --sky-mid: #4c5a73; --sky-low: #6b7891; --sky-horizon: #8f9aae; }
body[data-night]          { --sky-top: #0c1834; --sky-mid: #1a2d55; --sky-low: #324a78; --sky-horizon: #5a6c96; }
body[data-night][data-mood="overcast"],
body[data-night][data-mood="fog"],
body[data-night][data-mood="rain"],
body[data-night][data-mood="storm"] { --sky-top: #161c28; --sky-mid: #232b3b; --sky-low: #374153; --sky-horizon: #4f596b; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  /* Fill the full phone screen, including behind Safari's collapsing toolbar. */
  min-height: 100vh;
  min-height: 100lvh;
  overflow: hidden;
  color: var(--ink);
  font-family: var(--serif);
  font-variation-settings: "SOFT" 100, "WONK" 1; /* Fraunces' softest, quirkiest cut */
  background: linear-gradient(
    180deg,
    var(--sky-top) 0%,
    var(--sky-mid) 42%,
    var(--sky-low) 76%,
    var(--sky-horizon) 100%
  ) no-repeat;
  /* Anything past the gradient continues the horizon color instead of
     repeating the dark top of the sky. */
  background-color: var(--sky-horizon);
  transition: --sky-top 4s ease, --sky-mid 4s ease, --sky-low 4s ease, --sky-horizon 4s ease;
  -webkit-font-smoothing: antialiased;
}

.sun {
  position: fixed;
  top: -22vmax;
  right: -14vmax;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 244, 222, 0.45) 0%, rgba(255, 244, 222, 0) 62%);
  pointer-events: none;
  animation: sun-drift 30s ease-in-out infinite alternate;
  transition: opacity 4s ease;
}
body[data-night] .sun,
body[data-mood="overcast"] .sun,
body[data-mood="rain"] .sun,
body[data-mood="storm"] .sun { opacity: 0.25; }

@keyframes sun-drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-3vmax, 2vmax) scale(1.06); }
}

#sky {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
}

/* ---------- Homepage ---------- */

.hero {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  text-align: center;
  pointer-events: none; /* let drags reach the clouds */
}

.name {
  margin: 0 0 1.1rem;
  font-family: var(--name-font);
  font-weight: 400;
  font-size: clamp(4rem, 14vw, 10.5rem);
  line-height: 0.8; /* Modak sits tall; this keeps the links close */
  text-shadow:
    0 3px 34px var(--ink-shadow),
    0 0 2px rgba(32, 62, 108, 0.15);
  animation: emerge 2.4s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.links {
  display: flex;
  gap: clamp(1.6rem, 5vw, 3rem);
  pointer-events: auto;
}

.links a,
.back {
  position: relative;
  color: var(--ink);
  text-decoration: none;
  font-size: clamp(1.05rem, 2.4vw, 1.3rem);
  font-weight: 400;
  letter-spacing: 0.06em;
  text-shadow: 0 1px 16px var(--ink-shadow);
  padding: 0.3em 0.1em;
}

.links a {
  animation: emerge 1.8s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.links a:nth-child(1) { animation-delay: 0.9s; }
.links a:nth-child(2) { animation-delay: 1.05s; }
.links a:nth-child(3) { animation-delay: 1.2s; }

/* A thin underline that draws itself in from the center. */
.links a::after,
.back::after {
  content: "";
  position: absolute;
  left: 50%;
  right: 50%;
  bottom: 0.15em;
  height: 1px;
  background: currentColor;
  transition: left 0.5s ease, right 0.5s ease;
}
.links a:hover::after,
.links a:focus-visible::after,
.back:hover::after,
.back:focus-visible::after {
  left: 0;
  right: 0;
}
a:focus-visible,
button:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 4px;
}
.links a:focus-visible,
.back:focus-visible { outline: none; }

@keyframes emerge {
  from {
    opacity: 0;
    filter: blur(14px);
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    filter: blur(0);
    transform: none;
  }
}

/* Small captions: weather, cloud maker, hint. Same type as the links, just smaller. */
.weather,
.maker,
.hint {
  font-family: var(--serif);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  text-shadow: 0 0 2px rgba(32, 62, 108, 0.45), 0 1px 12px rgba(32, 62, 108, 0.55);
}

/* ---------- Cloud maker ---------- */

.maker {
  margin-top: 2.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  pointer-events: auto;
  animation: emerge 1.8s cubic-bezier(0.2, 0.7, 0.2, 1) 1.5s both;
}

.maker-toggle,
.maker-option {
  padding: 0.25rem 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  text-shadow: inherit;
  cursor: pointer;
}

.maker-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--ink-soft);
  transition: color 0.3s ease;
}
.maker-toggle:hover,
.maker-toggle[aria-expanded="true"] { color: var(--ink); }

.maker-plus {
  display: inline-block;
  font-size: 1rem;
  line-height: 1;
  transition: transform 0.4s ease;
}
.maker-toggle[aria-expanded="true"] .maker-plus { transform: rotate(45deg); }

.maker-shapes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.3rem 1.3rem;
  max-width: 34rem;
}
.maker-shapes[hidden] { display: none; }

.maker-option {
  position: relative;
  animation: option-in 0.6s ease both;
  animation-delay: calc(var(--i) * 45ms);
}
.maker-option::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: 0.1rem;
  height: 1px;
  background: currentColor;
  transition: right 0.35s ease;
}
.maker-option:hover::after { right: 0; }
.maker-option:active { transform: translateY(1px); }

@keyframes option-in {
  from { opacity: 0; transform: translateY(-4px); filter: blur(4px); }
  to   { opacity: 1; transform: none; filter: blur(0); }
}

/* ---------- Weather ---------- */

.weather {
  position: fixed;
  top: 20px;
  left: 20px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  color: var(--ink);
  text-decoration: none;
  line-height: 1.4;
  animation: emerge 1.4s ease both;
}
.weather[hidden] { display: none; }

.w-row { display: flex; gap: 0.9em; }
.w-time, .w-desc, .w-wind { color: var(--ink-soft); }
.w-wind { display: inline-flex; align-items: center; gap: 0.35em; }
.w-arrow {
  width: 0.95em;
  height: 0.95em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 2s ease;
}

/* Hover or focus to reveal where the numbers come from. */
.w-source {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  transition: max-height 0.4s ease, opacity 0.4s ease;
}
.weather:hover .w-source,
.weather:focus-visible .w-source {
  max-height: 2em;
  opacity: 1;
}

/* ---------- Bottom: hint + social links ---------- */

.bottom {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 1.4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  pointer-events: none;
}

.hint {
  margin: 0;
  color: var(--ink-soft);
  opacity: 0;
  animation: hint-in 2s ease 3.2s forwards;
  transition: opacity 1.2s ease;
}
.hint.gone {
  opacity: 0 !important;
  animation: none;
}
@keyframes hint-in {
  to { opacity: 1; }
}

.social {
  display: flex;
  gap: 0.6rem;
  pointer-events: auto;
  animation: emerge 1.8s cubic-bezier(0.2, 0.7, 0.2, 1) 1.5s both;
}
.social a {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  color: var(--ink);
  opacity: 0.85;
  transition: opacity 0.3s ease, transform 0.3s ease;
}
.social a:hover { opacity: 1; transform: translateY(-2px); }
.social svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: currentColor;
  filter: drop-shadow(0 1px 8px rgba(32, 62, 108, 0.55));
}
.social svg.stroke {
  width: 1.3rem;
  height: 1.3rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Inner pages ---------- */

/* No clouds here: a still wash of the current sky, deepened toward navy so
   white text stays easy to read whatever the weather. */
body.inner {
  overflow-y: auto;
  background: linear-gradient(
    180deg,
    color-mix(in oklab, var(--sky-top) 68%, #0b1d3a) 0%,
    color-mix(in oklab, var(--sky-mid) 72%, #0b1d3a) 100%
  ) fixed no-repeat;
  background-color: color-mix(in oklab, var(--sky-mid) 72%, #0b1d3a);
}

.site-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  padding: clamp(2.5rem, 8vh, 4.5rem) 16px 0;
  animation: emerge 1.4s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

.site-name {
  color: var(--ink);
  text-decoration: none;
  font-family: var(--name-font);
  font-size: clamp(2.8rem, 8vw, 4.2rem);
  line-height: 0.8;
  transition: opacity 0.3s ease;
}
.site-name:hover { opacity: 0.85; }

.site-nav {
  display: flex;
  gap: 1.8rem;
}
.site-nav a {
  position: relative;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 1.05rem;
  letter-spacing: 0.05em;
  padding: 0.25em 0.1em;
  transition: color 0.3s ease;
}
.site-nav a:hover,
.site-nav a[aria-current="page"] { color: var(--ink); }
.site-nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0.1em;
  height: 1px;
  background: currentColor;
}

.content {
  max-width: 36rem;
  margin: 0 auto;
  padding: clamp(3rem, 10vh, 5rem) 16px 4rem;
  line-height: 1.7;
  font-size: 1.1rem;
  animation: emerge 1.6s cubic-bezier(0.2, 0.7, 0.2, 1) 0.3s both;
}
.content h1 {
  margin: 0 0 1.2rem;
  font-weight: 350;
  font-style: italic;
  font-size: clamp(2rem, 5vw, 2.6rem);
  line-height: 1.15;
}
.content p { margin: 0 0 1.2em; color: rgba(255, 255, 255, 0.9); }
.content a { color: var(--ink); text-underline-offset: 3px; }

.site-foot {
  display: flex;
  justify-content: center;
  padding: 0 16px 2.5rem;
}
.site-foot .social { animation-delay: 0.6s; }

@media (max-width: 520px) {
  .weather { top: 16px; left: 16px; font-size: 0.85rem; }
}

@media (prefers-reduced-motion: reduce) {
  .sun { animation: none; }
  .name, .links a, .maker, .maker-option, .social, .weather, .site-head, .content {
    animation-duration: 0.01s;
    animation-delay: 0s;
  }
}

/* Kept for screen readers and search engines; the nav already shows the page name. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
