/* Loie 的家 — 虹彩云缘 (The Iridescent Edge)
   seed 748c70a2 · code-led · zero external runtime requests */

:root {
  --cloud: #ffffff;
  --mist: #f2f4f7;
  --mist-deep: #e8ebf1;
  --slate: #5a6470;
  --slate-deep: #3e4550;
  --mint: #8fd8c2;
  --rose: #f2a9c4;
  --violet: #a79fd8;
  --hairline: rgba(90, 100, 112, 0.16);
  --font-latin: "Albert Sans";
  --font-cjk: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

@font-face {
  font-family: "Albert Sans";
  src: url("fonts/albert-sans-latin-wght.woff2") format("woff2-variations");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+2000-206F, U+2013-2014, U+2018-2019, U+201C-201D, U+2026;
}

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

html {
  background: var(--mist);
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-latin), var(--font-cjk);
  font-weight: 380;
  color: var(--slate);
  background: var(--mist);
  line-height: 1.85;
  font-size: 1.0625rem;
  caret-color: var(--violet);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* ---- browser surfaces, themed ---- */
::selection { background: rgba(242, 169, 196, 0.35); color: var(--slate-deep); }
::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: var(--mist); }
::-webkit-scrollbar-thumb { background: #c6cdd8; border-radius: 5px; border: 2px solid var(--mist); }
::-webkit-scrollbar-thumb:hover { background: var(--violet); }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; border-radius: 2px; }

/* ---- the living top hairline ---- */
.edge-hairline {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 2px;
  z-index: 30;
  background: linear-gradient(90deg, var(--mint), var(--rose), var(--violet), var(--mint));
  background-size: 300% 100%;
  animation: hairline-drift 14s linear infinite alternate;
  opacity: 0.9;
}
@keyframes hairline-drift {
  from { background-position: 0% 0; }
  to { background-position: 100% 0; }
}

/* ---- the painterly cloud edge ---- */
#edge-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  filter: blur(14px) saturate(1.15);
}

/* ---- header (quiet controls) ---- */
header {
  position: fixed;
  top: 0; right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 22px 28px;
}
header a.privacy-link {
  font-size: 0.82rem;
  font-weight: 420;
  letter-spacing: 0.02em;
  color: var(--slate);
  text-decoration: none;
  padding-bottom: 2px;
  background: linear-gradient(90deg, var(--mint), var(--rose), var(--violet), var(--mint)) no-repeat left 100% / 0% 1px;
  transition: color 0.4s var(--ease-out), background-size 0.6s var(--ease-out);
}
header a.privacy-link:hover {
  color: var(--slate-deep);
  background-size: 300% 1px;
  animation: hairline-drift 14s linear infinite alternate;
}
.lang-pill {
  display: inline-flex;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(6px);
}
.lang-pill button {
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 420;
  padding: 5px 13px;
  border: none;
  background: transparent;
  color: var(--slate);
  cursor: pointer;
  transition: color 0.3s var(--ease-out), background 0.3s var(--ease-out);
}
.lang-pill button[aria-pressed="true"] {
  color: var(--slate-deep);
  background: linear-gradient(120deg, rgba(143, 216, 194, 0.25), rgba(242, 169, 196, 0.25), rgba(167, 159, 216, 0.3));
}
.lang-pill button:hover { color: var(--slate-deep); }

/* ---- layout ---- */
main {
  position: relative;
  z-index: 1;
}
section {
  max-width: 68ch;
  margin: 0 auto;
  padding: 0 28px;
}

/* ---- first viewport ---- */
.first {
  min-height: min(100svh, 1000px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: none;
  padding: 0 8vw;
}
h1 {
  font-size: clamp(3.4rem, 9vw, 6rem);
  font-weight: 250;
  letter-spacing: -0.025em;
  line-height: 1.05;
  color: var(--slate-deep);
}
.her-line {
  margin-top: 1.4rem;
  max-width: 34ch;
  font-size: clamp(1.05rem, 2.1vw, 1.3rem);
  font-weight: 340;
  color: var(--slate);
}
.scroll-cue {
  margin-top: clamp(48px, 12vh, 120px);
  width: 1px;
  height: 56px;
  background: linear-gradient(to bottom, var(--slate), transparent);
  opacity: 0.5;
}

/* ---- sections ---- */
section + section { margin-top: clamp(96px, 22vh, 240px); }
h2 {
  font-size: clamp(1.5rem, 3.4vw, 2.1rem);
  font-weight: 300;
  letter-spacing: -0.015em;
  color: var(--slate-deep);
  margin-bottom: 1.1em;
}
section p { margin-bottom: 1.2em; }
section p:last-child { margin-bottom: 0; }

/* tides: three breathing hairlines */
.tides-lines {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 2.6rem 0 3rem;
}
.tides-lines span {
  display: block;
  height: 1px;
  transform-origin: left center;
  animation: tide-breathe 9s var(--ease-out) infinite alternate;
}
.tides-lines span:nth-child(1) { background: linear-gradient(90deg, var(--mint), transparent 85%); }
.tides-lines span:nth-child(2) { background: linear-gradient(90deg, var(--rose), transparent 85%); animation-delay: -3s; }
.tides-lines span:nth-child(3) { background: linear-gradient(90deg, var(--violet), transparent 85%); animation-delay: -6s; }
@keyframes tide-breathe {
  from { transform: scaleX(0.55); opacity: 0.45; }
  to { transform: scaleX(1); opacity: 0.95; }
}

/* loop: quiet rotating ring */
.loop-ring {
  margin: 2.6rem 0 3rem;
  width: 132px;
  height: 132px;
}
.loop-ring circle {
  fill: none;
  stroke-width: 1.5;
}
.loop-ring .ring-track { stroke: var(--hairline); }
.loop-ring .ring-live {
  stroke: url(#loop-spectrum);
  stroke-dasharray: 60 340;
  stroke-linecap: round;
  transform-origin: 66px 66px;
  animation: ring-turn 24s linear infinite;
}
@keyframes ring-turn { to { transform: rotate(360deg); } }

/* moon */
.moon-block {
  display: flex;
  align-items: center;
  gap: 2.2rem;
  margin: 2.6rem 0 3rem;
  flex-wrap: wrap;
}
.moon-disc { width: 108px; height: 108px; flex: 0 0 auto; }
.moon-facts { font-size: 0.95rem; }
.moon-facts strong {
  display: block;
  font-size: 1.25rem;
  font-weight: 340;
  color: var(--slate-deep);
  letter-spacing: -0.01em;
}

/* close */
.close { padding-bottom: clamp(96px, 16vh, 200px); }
.close .door-link,
a.door-link {
  display: inline-block;
  margin-top: 2.4rem;
  font-weight: 420;
  color: var(--slate-deep);
  text-decoration: none;
  padding-bottom: 3px;
  background: linear-gradient(90deg, var(--mint), var(--rose), var(--violet), var(--mint)) no-repeat left 100% / 300% 1px;
  animation: hairline-drift 14s linear infinite alternate;
  transition: color 0.4s var(--ease-out);
}
.close .door-link:hover,
a.door-link:hover { color: var(--violet); }

/* footer */
footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--hairline);
  padding: 34px 28px 44px;
  font-size: 0.8rem;
  color: var(--slate);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  max-width: 1100px;
  margin: 0 auto;
}
footer a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--hairline); }
footer a:hover { color: var(--slate-deep); border-color: var(--violet); }

/* privacy page reading rhythm */
.reading { padding-top: clamp(120px, 24vh, 260px); padding-bottom: clamp(96px, 14vh, 180px); }
.reading h1 {
  font-size: clamp(2.4rem, 6vw, 3.8rem);
  margin-bottom: 0.6em;
}
.reading section + section { margin-top: clamp(80px, 14vh, 160px); }

/* entrance: visible by default; JS arms the pre-reveal state only when it will animate */
.reveal {
  transition: opacity 1.1s var(--ease-out), transform 1.1s var(--ease-out), filter 1.1s var(--ease-out);
}
html.reveal-armed .reveal:not(.in) {
  opacity: 0;
  transform: translateY(14px);
  filter: blur(3px);
}

@media (max-width: 640px) {
  .first { padding: 0 24px; }
  section { padding: 0 24px; }
  header { padding: 16px 18px; }
  .moon-block { gap: 1.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .edge-hairline, .tides-lines span, .loop-ring .ring-live { animation: none; }
  .reveal { transition: none; opacity: 1; transform: none; filter: none; }
  #edge-canvas { filter: blur(14px) saturate(1.15); }
}
