/* Still — cynthialoy.com
   One quiet page. The sky follows the visitor's local time of day;
   JS sets the --sky-* and --sun-* variables, these are the night defaults. */

:root {
  --sky-top: #0d1222;
  --sky-mid: #1b2233;
  --sky-low: #3a3550;
  --sun: #f3d9b1;
  --sun-y: 70%;
  --sun-glow: 0.25;
  --star-opacity: 0.8;
  --ink: #f2efe8;
  --ink-soft: rgba(242, 239, 232, 0.62);
  --breath: 9s;
  --ring: rgba(242, 239, 232, 0.45);
  --ring-strong: rgba(242, 239, 232, 0.9);
}

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

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

body {
  min-height: 100svh;
  overflow: hidden;
  background: var(--sky-mid);
  color: var(--ink);
  font-family: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  -webkit-font-smoothing: antialiased;
}

a {
  color: inherit;
}

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

/* ---------- Sky ---------- */

.sky,
.stars,
.sun,
.water,
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.sky {
  background: linear-gradient(
    to bottom,
    var(--sky-top) 0%,
    var(--sky-mid) 45%,
    var(--sky-low) 62%
  );
  transition: background 4s ease;
}

.stars {
  opacity: var(--star-opacity);
  transition: opacity 6s ease;
  background-image:
    radial-gradient(1px 1px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 27% 8%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 41% 22%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 58% 12%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 66% 30%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 79% 16%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 88% 34%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 6% 40%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 34% 44%, #fff 50%, transparent 51%),
    radial-gradient(1px 1px at 93% 6%, #fff 50%, transparent 51%);
  animation: twinkle 7s ease-in-out infinite alternate;
}

@keyframes twinkle {
  from { filter: brightness(0.75); }
  to   { filter: brightness(1.15); }
}

.sun {
  inset: auto;
  left: 50%;
  top: var(--sun-y);
  width: min(34vmin, 260px);
  aspect-ratio: 1;
  translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--sun) 0%, transparent 68%);
  opacity: var(--sun-glow);
  filter: blur(6px);
  transition: top 6s ease, opacity 6s ease, background 4s ease;
}

/* ---------- Water ---------- */

.water {
  top: 62%;
  width: 100%;
  height: 38%;
}

.grain {
  opacity: 0.07;
  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.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

/* ---------- Stage ---------- */

.stage {
  position: relative;
  z-index: 2;
  min-height: 100svh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 1.6rem;
  padding: 2rem 1.5rem 22vh;
  text-align: center;
}

.ring {
  width: 7.5rem;
  height: 7.5rem;
  padding: 0;
  border: 1px solid var(--ring);
  border-radius: 50%;
  background: transparent;
  display: grid;
  place-items: center;
  cursor: pointer;
  animation: breathe var(--breath) ease-in-out infinite;
  transition: border-color 0.6s ease;
}

.ring:hover,
.ring:focus-visible {
  border-color: var(--ring-strong);
  outline: none;
}

.ring-core {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--ink);
  box-shadow: 0 0 18px 4px rgba(243, 217, 177, 0.45);
}

@keyframes breathe {
  0%, 100% { transform: scale(0.82); box-shadow: 0 0 0 0 rgba(242, 239, 232, 0); }
  45%      { transform: scale(1.12); box-shadow: 0 0 60px 6px rgba(242, 239, 232, 0.08); }
  55%      { transform: scale(1.12); }
}

.line {
  margin: 0;
  max-width: 22ch;
  font-size: clamp(1.6rem, 4.2vw, 2.6rem);
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1.25;
  transition: opacity 1.2s ease, filter 1.2s ease;
}

.line.is-fading {
  opacity: 0;
  filter: blur(6px);
}

.breath {
  display: none;
  margin: 0;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.72rem;
  letter-spacing: 0.32em;
  text-transform: lowercase;
  color: var(--ink-soft);
}

.js .breath {
  display: block;
}

/* ---------- Corners ---------- */

.readout,
.credit {
  position: fixed;
  z-index: 3;
  bottom: max(1.1rem, env(safe-area-inset-bottom));
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  text-transform: lowercase;
  color: var(--ink-soft);
}

.readout {
  left: 1.25rem;
  display: none;
}

.js .readout {
  display: block;
}

.readout .dot {
  margin: 0 0.4em;
}

.credit {
  right: 1.25rem;
}

.credit a {
  text-decoration: none;
  border-bottom: 1px solid rgba(242, 239, 232, 0.25);
}

.credit a:hover {
  color: var(--ink);
}

@media (max-width: 520px) {
  .readout,
  .credit {
    left: 0;
    right: 0;
    text-align: center;
    font-size: 0.6rem;
    letter-spacing: 0.12em;
  }

  .readout {
    bottom: calc(max(1.1rem, env(safe-area-inset-bottom)) + 1.4rem);
  }
}

/* ---------- 404 and simple pages ---------- */

.plain .stage {
  padding-bottom: 2rem;
}

.plain .line {
  max-width: 28ch;
}

.plain p.small {
  margin: 0;
  color: var(--ink-soft);
  font-size: 1rem;
}

/* ---------- Respect reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .stars,
  .ring {
    animation: none;
  }

  .sky,
  .sun,
  .line {
    transition: none;
  }
}
