@font-face {
  font-family: "Quicksand";
  src: url("fonts/quicksand-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: "Hanken Grotesk";
  src: url("fonts/hanken-latin.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "ZCOOL XiaoWei";
  src: url("fonts/zcool-mengjing.woff2") format("woff2");
  font-display: swap;
}

:root {
  --night: #07132B;
  --night-2: #0C1A3A;
  --night-3: #13234A;
  --thread: #E9E6F0;
  --thread-dim: #C3C7DD;
  --thread-faint: #8D95B8;
  --gold: #FFC857;
  --gold-deep: #E0A53A;
  --rain: #1DBAA6;
  --rain-deep: #146E66;
  --mist: #6E8FD0;
  --dust: #E07A9E;
  --dawn: #F2B48A;

  --display: "Quicksand", ui-rounded, "Hiragino Maru Gothic ProN", sans-serif;
  --text: "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
  --zh: "ZCOOL XiaoWei", "Songti SC", serif;

  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --gutter: clamp(1.25rem, 4vw, 4rem);
  --stitch: 1.5px dashed;

  color-scheme: dark;
}

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

html {
  background: var(--night);
  scroll-behavior: smooth;
  scrollbar-color: var(--night-3) var(--night);
}
html::-webkit-scrollbar { width: 12px; }
html::-webkit-scrollbar-track { background: var(--night); }
html::-webkit-scrollbar-thumb { background: var(--night-3); border-radius: 12px; border: 3px solid var(--night); }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--text);
  font-size: 1.0625rem;
  line-height: 1.6;
  color: var(--thread-dim);
  background-color: var(--night);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'%3E%3Cg fill='none' stroke='%23324170' stroke-width='1' stroke-dasharray='3 4' stroke-linecap='round'%3E%3Cpath d='M0 48 L48 0 M48 96 L96 48 M0 48 L48 96 M48 0 L96 48'/%3E%3C/g%3E%3C/svg%3E");
  background-size: 96px 96px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection { background: var(--gold); color: var(--night); }

a { color: inherit; text-underline-offset: .25em; text-decoration-thickness: 1px; }

:focus-visible {
  outline: 2px dashed var(--gold);
  outline-offset: 4px;
  border-radius: 6px;
}

.defs { position: absolute; }
.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;
}
.zh { font-family: var(--zh); font-style: normal; letter-spacing: .04em; }

/* Raised-thread lettering: light catches the top edge, the cloth shadows the bottom. */
.satin {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2.5rem, 4.9vw, 5rem);
  line-height: 1.04;
  letter-spacing: .035em;
  text-transform: uppercase;
  text-wrap: balance;
  color: var(--thread);
  text-shadow:
    0 -1px 0 rgba(255, 255, 255, .28),
    0 1px 0 rgba(2, 6, 18, .85),
    0 3px 6px rgba(2, 6, 18, .5);
}
.satin-sm { font-size: clamp(1.75rem, 2.8vw, 2.6rem); }

/* ---------- Header ---------- */
.top {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: clamp(1.25rem, 2.6vw, 2rem) var(--gutter);
}
.mark { display: grid; gap: .2rem; text-decoration: none; }
.mark-name {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--thread);
}
.mark-sub {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  font-size: .78rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--thread-faint);
}
.mark-sub .zh { font-size: .95rem; color: var(--gold); letter-spacing: .1em; }
.top-nav { display: flex; gap: clamp(1rem, 2.5vw, 2.25rem); }
.top-nav a {
  font-size: .82rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--thread-dim);
  padding: .4rem 0;
  text-decoration: underline 1px dashed transparent;
  text-underline-offset: .5em;
  transition: color .3s var(--ease-out), text-decoration-color .3s var(--ease-out);
}
.top-nav a:hover { color: var(--thread); text-decoration-color: var(--gold); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 46fr) minmax(0, 54fr);
  align-items: center;
  min-height: min(calc(100vh - 6rem), 860px);
  padding: 0 var(--gutter) clamp(3rem, 6vw, 5rem);
  overflow-x: clip;
}
.hero-copy { position: relative; z-index: 2; max-width: 36rem; }
.hero h1 { font-size: clamp(2.6rem, 5vw, 5.25rem); }

.seam-wave { display: block; width: min(26rem, 90%); height: auto; margin: 1.4rem 0 1.6rem; overflow: visible; }
.seam-thread { fill: none; stroke: var(--thread-dim); stroke-width: 1.6; stroke-dasharray: 5 6; stroke-linecap: round; }
.seam-draw { fill: none; stroke: #fff; stroke-width: 6; stroke-dasharray: 1; stroke-dashoffset: 0; }
.knot { fill: var(--gold); }

.lede { max-width: 33rem; margin: 0 0 2rem; font-size: 1.125rem; color: var(--thread-dim); }
.lede em { font-style: normal; color: var(--thread-faint); }
.lede .zh { color: var(--gold); font-size: 1.15em; }

/* ---------- Waitlist form ---------- */
.wait { max-width: 34rem; }
.wait-label {
  display: block;
  margin-bottom: .55rem;
  font-size: .78rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--thread-faint);
}
.wait-row { display: flex; gap: .65rem; }
.wait-input {
  flex: 1 1 auto;
  min-width: 0;
  height: 3.4rem;
  padding: 0 1.15rem;
  font: inherit;
  font-size: 1rem;
  color: var(--thread);
  caret-color: var(--gold);
  background: rgba(7, 19, 43, .72);
  border: var(--stitch) rgba(195, 199, 221, .55);
  border-radius: 16px;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .35);
  transition: border-color .3s var(--ease-out), background-color .3s var(--ease-out);
}
.wait-input::placeholder { color: #7880A4; }
.wait-input:hover { border-color: rgba(233, 230, 240, .8); }
.wait-input:focus { outline: none; border-color: var(--gold); background: rgba(12, 26, 58, .9); }
.wait-input:focus-visible { outline: 2px dashed transparent; }
.wait-input[aria-invalid="true"] { border-color: var(--dust); }

.wait-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  height: 3.4rem;
  padding: 0 1.35rem 0 1.15rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: .9rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #fff;
  background: var(--rain-deep);
  border: 0;
  border-radius: 16px;
  outline: 1.5px dashed rgba(255, 255, 255, .55);
  outline-offset: -6px;
  box-shadow: 0 6px 14px -6px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .18);
  cursor: pointer;
  transition: background-color .3s var(--ease-out), transform .3s var(--ease-out), box-shadow .3s var(--ease-out);
}
.wait-btn svg { width: 1rem; height: 1rem; fill: var(--gold); flex: none; transition: transform .6s var(--ease-out); }
.wait-btn:hover { background-color: #18847A; transform: translateY(-1px); box-shadow: 0 10px 20px -8px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255,255,255,.2); }
.wait-btn:hover svg { transform: rotate(45deg) scale(1.15); }
.wait-btn:active { transform: translateY(1px); }
.wait-btn:focus-visible { outline: 2px dashed var(--gold); outline-offset: 3px; }
.wait-btn[disabled] { cursor: progress; background-color: #11564F; }
.wait-btn[disabled] svg { animation: spin 1.4s linear infinite; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.wait-hint { margin: .75rem 0 0; font-size: .9rem; color: var(--thread-faint); min-height: 1.5em; }
.wait-hint.is-error { color: #F3A3BF; }
.wait-hint.is-done { color: var(--gold); }

.wait.is-done .wait-row { display: none; }
.wait.is-done .wait-label { display: none; }
.wait.is-done .wait-hint { font-size: 1.05rem; }
.wait.is-done .wait-hint button {
  margin-left: .4rem;
  padding: 0;
  font: inherit;
  font-size: .9rem;
  color: var(--thread-faint);
  background: none;
  border: 0;
  text-decoration: underline;
  text-underline-offset: .25em;
  cursor: pointer;
}

/* ---------- City illustration ---------- */
.city {
  position: relative;
  z-index: 1;
  margin: 0;
  align-self: stretch;
  display: flex;
  align-items: center;
}
.city-frame {
  position: relative;
  flex: none;
  width: 150%;
  margin-left: -40%;
  aspect-ratio: 16 / 9;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 22%, #000 97%, transparent 100%), linear-gradient(180deg, transparent 0%, #000 8%, #000 90%, transparent 100%);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(90deg, transparent 0%, #000 22%, #000 97%, transparent 100%), linear-gradient(180deg, transparent 0%, #000 8%, #000 90%, transparent 100%);
  mask-composite: intersect;
}
.city-img { display: block; width: 100%; height: 100%; object-fit: cover; }
.city-overlay { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

.d-label {
  font-family: var(--display);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: .2em;
  text-transform: uppercase;
  fill: var(--thread);
  paint-order: stroke;
  stroke: rgba(4, 10, 26, .55);
  stroke-width: 3px;
  opacity: .92;
}

.twinkles use { fill: var(--gold); transform-box: fill-box; transform-origin: center; animation: twinkle 6s ease-in-out infinite; }
.twinkles use:nth-child(2) { animation-delay: 1.7s; }
.twinkles use:nth-child(3) { animation-delay: 3.1s; }
.twinkles use:nth-child(4) { animation-delay: 4.4s; }

.your-light { opacity: 0; }
.your-light .glow { fill: var(--gold); opacity: .22; filter: blur(10px); }
.light-stitch { fill: none; stroke: var(--gold); stroke-width: .7; stroke-dasharray: 1.6 1.4; stroke-linecap: round; }
.light-fill { fill: var(--gold); }
.light-leader { fill: none; stroke: var(--thread-dim); stroke-width: 1.6; stroke-dasharray: 4 5; stroke-linecap: round; }
.light-label {
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: .22em;
  text-transform: uppercase;
  fill: var(--gold);
  paint-order: stroke;
  stroke: rgba(4, 10, 26, .6);
  stroke-width: 3px;
}
.light-mask { fill: #fff; }

.is-lit .your-light { opacity: 1; }
.is-lit .light-mask { r: 40px; }
.is-lighting .your-light { animation: fade-in .4s var(--ease-out) both; }
.is-lighting .light-stitch { animation: stitch-in 1.1s var(--ease-out) both; }
.is-lighting .light-mask { animation: light-fill 1.2s .7s var(--ease-out) both; }
.is-lighting .glow { animation: glow-in 1.6s .9s var(--ease-out) both; }
.is-lighting .light-leader,
.is-lighting .light-label { animation: fade-in .6s 1.3s var(--ease-out) both; }

/* ---------- How a dream wakes ---------- */
.how {
  padding: clamp(3.5rem, 7vw, 6rem) var(--gutter) clamp(4rem, 8vw, 7rem);
  max-width: 82rem;
  margin: 0 auto;
}
.how-intro { max-width: 34rem; margin: 1rem 0 clamp(3rem, 6vw, 4.5rem); font-size: 1.125rem; }

.seam {
  position: relative;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.5rem, 4vw, 4rem);
}
.seam::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 1.1rem;
  border-top: 1.6px dashed rgba(195, 199, 221, .45);
}
.stage { position: relative; padding-top: 3.4rem; }
.stage-knot {
  position: absolute;
  top: .35rem;
  left: 0;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--night);
  border: 1.6px dashed rgba(195, 199, 221, .6);
}
.stage.is-now .stage-knot {
  top: -.15rem;
  width: 2.5rem;
  height: 2.5rem;
  margin-left: -.5rem;
  border: 0;
  background: none;
  display: grid;
  place-items: center;
}
.stage.is-now .stage-knot svg { width: 2.5rem; height: 2.5rem; fill: var(--gold); filter: drop-shadow(0 2px 6px rgba(255, 200, 87, .35)); }
.stage-name {
  margin: 0 0 .6rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--thread);
}
.stage.is-now .stage-name { color: var(--gold); }
.stage p { margin: 0; max-width: 22rem; }
.stage .stage-here {
  display: inline-block;
  margin-top: 1rem;
  padding: .3rem .8rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: .75rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold);
  border: 1.5px dashed rgba(255, 200, 87, .6);
  border-radius: 999px;
}
.stage:not(.is-now) { color: var(--thread-faint); }
.stage:not(.is-now) .stage-name { color: var(--thread-dim); }

/* ---------- Night notes ---------- */
.notes {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(2rem, 6vw, 6rem);
  max-width: 82rem;
  margin: 0 auto;
  padding: clamp(3rem, 6vw, 5rem) var(--gutter) clamp(5rem, 10vw, 8rem);
}
.notes-head p { margin: 1rem 0 0; max-width: 24rem; }
.notes-list { border-top: 1.6px dashed rgba(195, 199, 221, .35); }
.notes-list details { border-bottom: 1.6px dashed rgba(195, 199, 221, .35); }
.notes-list summary {
  position: relative;
  display: block;
  padding: 1.35rem 3rem 1.35rem 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: .02em;
  color: var(--thread);
  cursor: pointer;
  list-style: none;
  transition: color .3s var(--ease-out);
}
.notes-list summary::-webkit-details-marker { display: none; }
.notes-list summary::after {
  content: "";
  position: absolute;
  right: .4rem;
  top: 50%;
  width: 14px;
  height: 14px;
  margin-top: -7px;
  background: var(--gold);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-12 -12 24 24'%3E%3Cpath d='M0,-10 C1.2,-2.4 2.4,-1.2 10,0 C2.4,1.2 1.2,2.4 0,10 C-1.2,2.4 -2.4,1.2 -10,0 C-2.4,-1.2 -1.2,-2.4 0,-10Z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-12 -12 24 24'%3E%3Cpath d='M0,-10 C1.2,-2.4 2.4,-1.2 10,0 C2.4,1.2 1.2,2.4 0,10 C-1.2,2.4 -2.4,1.2 -10,0 C-2.4,-1.2 -1.2,-2.4 0,-10Z'/%3E%3C/svg%3E") center / contain no-repeat;
  opacity: .55;
  transition: transform .5s var(--ease-out), opacity .3s;
}
.notes-list summary:hover { color: #fff; }
.notes-list summary:hover::after { opacity: 1; }
.notes-list details[open] summary::after { transform: rotate(45deg) scale(1.2); opacity: 1; }
.notes-list details p { margin: 0 0 1.5rem; max-width: 38rem; }
.notes-list details .zh { color: var(--gold); }

/* ---------- Dawn ---------- */
.dawn {
  position: relative;
  display: grid;
  justify-items: center;
  text-align: center;
  padding: clamp(6rem, 12vw, 10rem) var(--gutter) clamp(6rem, 11vw, 9rem);
  background: linear-gradient(180deg, transparent 0%, rgba(19, 35, 74, .6) 40%, #1C2350 72%, #33295A 88%, #4E3558 100%);
  overflow: hidden;
}
.dawn .wait-hint, .dawn .wait-label { color: var(--thread-dim); }
.dawn::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 0;
  border-top: 1.6px dashed rgba(242, 180, 138, .55);
}
.dawn h2 { font-size: clamp(2.2rem, 4.4vw, 4.25rem); }
.wait-dawn { width: min(100%, 34rem); margin-top: 2.5rem; text-align: left; }
.wait-dawn .wait-hint { text-align: center; }

/* ---------- Footer ---------- */
.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 1.75rem var(--gutter) 2rem;
  font-size: .82rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--thread-dim);
  background: #4E3558;
}
.foot-zh { font-family: var(--zh); font-size: 1.1rem; letter-spacing: .3em; color: var(--dawn); text-transform: none; }

/* ---------- Motion ---------- */
@keyframes twinkle { 0%, 100% { opacity: .35; transform: scale(.85); } 50% { opacity: 1; transform: scale(1.1); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes stitch-in { from { stroke-dashoffset: 40; opacity: 0; } to { stroke-dashoffset: 0; opacity: 1; } }
@keyframes light-fill { from { r: 0; } to { r: 40px; } }
@keyframes glow-in { 0% { opacity: 0; } 60% { opacity: .5; } 100% { opacity: .22; } }
@keyframes seam-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }

@media (prefers-reduced-motion: no-preference) {
  .js .seam-draw { stroke-dashoffset: 1; animation: seam-draw 1.6s .5s var(--ease-out) forwards; }
  .js .hero h1 { animation: rise 1s var(--ease-out) both; }
  .js .lede, .js .hero .wait { animation: rise 1s .25s var(--ease-out) both; }
  .js .city-frame { animation: rise 1.4s .1s var(--ease-out) both; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .twinkles use { animation: none; opacity: .8; }
  .is-lighting .your-light, .is-lighting .light-stitch, .is-lighting .light-mask,
  .is-lighting .glow, .is-lighting .light-leader, .is-lighting .light-label { animation: none; }
  .is-lighting .light-mask { r: 40px; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

@media (max-width: 820px) {
  .top-nav { display: none; }
  .hero {
    grid-template-columns: minmax(0, 1fr);
    min-height: 0;
    padding-bottom: 3rem;
  }
  .city { order: -1; margin: -.5rem calc(var(--gutter) * -1) 0; overflow: hidden; }
  .city-frame {
    width: 135%;
    margin: 0 0 0 -35%;
    -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 80%, transparent 100%);
    mask-image: linear-gradient(180deg, #000 0%, #000 80%, transparent 100%);
  }
  .d-label { font-size: 30px; letter-spacing: .14em; }
  .d-pre { display: none; }
  .light-label { font-size: 30px; }
  .hero-copy { margin-top: .5rem; }
  .seam { grid-template-columns: 1fr; gap: 2.25rem; padding-left: 3rem; }
  .seam::before { left: .7rem; right: auto; top: .5rem; bottom: .5rem; border-top: 0; border-left: 1.6px dashed rgba(195, 199, 221, .45); }
  .stage { padding-top: 0; }
  .stage-knot { left: -3rem; top: .15rem; }
  .stage.is-now .stage-knot { left: -3rem; top: -.35rem; margin-left: -.5rem; }
  .notes { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  body { font-size: 1rem; }
  .wait-row { flex-direction: column; }
  .wait-btn { justify-content: center; }
  .foot { justify-content: center; text-align: center; }
}
