/* ---------- fonts (local files only) ---------- */
@font-face {
  font-family: "Noto Serif TC";
  src: url("fonts/NotoSerifTC-VF.ttf") format("truetype");
  font-weight: 200 900;
  font-display: block;
}
@font-face {
  font-family: "Instrument Serif";
  src: url("fonts/InstrumentSerif-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: block;
}
@font-face {
  font-family: "JetBrains Mono";
  src: url("fonts/JetBrainsMono-Bold.ttf") format("truetype");
  font-weight: 700;
  font-display: block;
}
@font-face {
  font-family: "Inter";
  src: url("fonts/Inter.ttf") format("truetype");
  font-weight: 100 900;
  font-display: block;
}

:root {
  --cream: #f4ede1;
  --cream-soft: rgba(244, 237, 225, 0.72);
  --cream-faint: rgba(244, 237, 225, 0.34);
  --wall: #17130f;
  --charcoal: #1b1714;
  --lamp: #ffc779;              /* core of the arch's lamp line */
  --lamp-glow: 255, 150, 60;    /* its orange halo, as r,g,b */
  --serif: "Noto Serif TC", serif;
  --sans: "Inter", system-ui, sans-serif;
  --shadow: 0 1px 2px rgba(10, 6, 4, 0.35), 0 2px 18px rgba(10, 6, 4, 0.45);
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--wall);
  color: var(--cream);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }

/* ---------- top navigation ---------- */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 10;
  height: 64px;
  padding: 0 52px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}

.brand {
  justify-self: start;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  line-height: 1;
}
.brand__zh {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 19px;
  letter-spacing: 0.32em;
}
.brand__en {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 8.5px;
  letter-spacing: 0.46em;
  color: var(--cream-soft);
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 26px;
}
.nav__link {
  position: relative;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 13.5px;
  letter-spacing: 0.34em;
  padding: 8px 0 8px 0.34em; /* left pad balances the trailing tracking */
  color: var(--cream-soft);
}
/* underline drawn by main.js (scaleX eased in requestAnimationFrame) */
.nav__link::after {
  content: "";
  position: absolute;
  left: 0.34em; right: 0.34em; bottom: 2px;
  height: 1px;
  background: var(--cream);
  transform-origin: 50% 50%;
  transform: scaleX(var(--h, 0));
}
.nav__sep {
  width: 3px; height: 3px;
  border-radius: 50%;
  background: var(--cream-faint);
}

.nav__cta {
  justify-self: end;
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 20px 0 calc(20px + 0.3em);
  border: 1px solid rgba(244, 237, 225, 0.55);
  font-family: var(--serif);
  font-weight: 500;
  font-size: 12.5px;
  letter-spacing: 0.3em;
}
.nav__cta-fill {
  position: absolute;
  inset: 0;
  background: var(--cream);
  transform-origin: 50% 100%;
  transform: scaleY(var(--h, 0));
}
.nav__cta-label { position: relative; }

/* ---------- smooth scroll layer ---------- */
.scroll-spacer { width: 1px; }      /* height set by main.js = page height */
.smooth {
  position: fixed;
  top: 0; left: 0;
  width: 100%;
  will-change: transform;
}

/* ---------- hero ---------- */
/* ~4 screens tall; the sticky .hero stays put while main.js zooms the wall */
.hero-scroll {
  position: relative;
  height: 400vh;
}
.hero {
  position: absolute;   /* held in view by main.js (translateY), like sticky */
  top: 0; left: 0;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

/* Both picture layers live in a .stage (the cover-cropped 1672x941 box), so
   their transform-origin is given in picture %: the centre of the arch
   opening (x 49.46%, y 50.96%). main.js sets --zoom on each per frame:
   wall 1x -> 12x, landscape 1x -> 1.35x (much slower = parallax). */
.hero__bg-wrap { z-index: 0; }
.hero__fg-wrap { z-index: 2; }
.stage-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  pointer-events: none;
  transform-origin: 49.46% 50.96%;
  transform: scale(var(--zoom, 1));
  will-change: transform;
}

.hero__welcome-scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0;
  background:
    radial-gradient(ellipse 46% 30% at 50% 60%, rgba(14, 9, 6, 0.46), rgba(14, 9, 6, 0.18) 62%, rgba(14, 9, 6, 0) 100%);
}

/* ---------- welcome line (fades in after passing the window) ---------- */
.welcome {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 60%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  text-shadow: var(--shadow);
}
.welcome__zh {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(40px, 5.2vw, 96px);   /* ~75px at 1440 */
  line-height: 1.2;
  letter-spacing: 0.2em;
  padding-left: 0.2em;                    /* balances trailing tracking */
}
.welcome__en {
  margin: 22px 0 0;
  font-family: "Instrument Serif", serif;
  font-weight: 400;
  font-size: clamp(18px, 1.75vw, 30px);  /* ~25px at 1440 */
  line-height: 1.2;
  letter-spacing: 0.06em;
  color: var(--cream);
}

/* A .stage box has the exact size/position the cover-cropped 1672x941 image has
   (set by main.js), so % inside it are % of the picture: the arch window is
   x 28.2%-70.7% (centre 49.46%), y 5.4%-96.5%. */
.stage {
  position: absolute;
  left: 50%; top: 50%;
  width: var(--stage-w, 100%);
  height: var(--stage-h, 100%);
  transform: translate(-50%, -50%);
  pointer-events: none;
  container-type: size;
}

.hero__scrim {
  z-index: 1;
  background:
    radial-gradient(ellipse 26% 27% at 49.46% 64%, rgba(14, 9, 6, 0.50), rgba(14, 9, 6, 0.22) 60%, rgba(14, 9, 6, 0) 100%),
    linear-gradient(to bottom, rgba(14, 9, 6, 0) 70%, rgba(14, 9, 6, 0.42) 96.5%);
}

.hero__content { z-index: 3; }

.hero__title-block {
  position: absolute;
  left: 49.46%;
  top: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  white-space: nowrap;
  text-shadow: var(--shadow);
}

.hero__title {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 5.1cqw;          /* ~82px at 1440x900 */
  line-height: 1.34;
  letter-spacing: 0.18em;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hero__line { padding-left: 0.18em; } /* balances trailing tracking */

.hero__sub {
  margin: 2.1cqw 0 0;
  display: flex;
  align-items: center;
  gap: 18px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: max(13px, 0.94cqw); /* ~15px at 1440x900 */
  letter-spacing: 0.36em;
  color: var(--cream);
}
.hero__sub-text { padding-left: 0.36em; }
.hero__rule {
  width: 28px; height: 1px;
  background: var(--cream-soft);
  box-shadow: 0 0 8px rgba(10, 6, 4, 0.4);
}

/* ---------- scroll hint ---------- */
.scroll-hint {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 44px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  pointer-events: none;
}
.scroll-hint__label {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 11.5px;
  letter-spacing: 0.42em;
  padding-left: 0.42em;
  color: var(--cream);
  text-shadow: var(--shadow);
}
.scroll-hint__track {
  position: relative;
  width: 1px;
  height: 40px;
  background: var(--cream-faint);
  overflow: hidden;
}
.scroll-hint__dot {
  position: absolute;
  left: 0; top: 0;
  width: 1px; height: 14px;
  background: var(--cream);
  transform: translateY(var(--y, -14px));
}

/* ---------- "every window" section ---------- */
.frame-section {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 40px;
  padding: 120px 24px;
  background:
    radial-gradient(ellipse 46% 34% at 50% 47%, rgba(var(--lamp-glow), 0.075), rgba(var(--lamp-glow), 0) 100%),
    var(--charcoal);
}
/* soft hand-over from the landscape above into the charcoal */
.frame-section::before {
  content: "";
  position: absolute;
  left: 0; right: 0;
  bottom: 100%;
  height: 220px;
  background: linear-gradient(to bottom, rgba(27, 23, 20, 0), var(--charcoal));
  pointer-events: none;
}

.glow-frame {
  position: relative;
  padding: 50px 84px;
  border: 1.5px solid var(--lamp);
  border-radius: 26px;
  box-shadow:
    0 0 3px rgba(255, 210, 150, 0.9),
    0 0 14px rgba(var(--lamp-glow), 0.55),
    0 0 46px rgba(var(--lamp-glow), 0.22),
    inset 0 0 3px rgba(255, 210, 150, 0.7),
    inset 0 0 18px rgba(var(--lamp-glow), 0.22);
}
.glow-frame__text {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(24px, 2.8vw, 44px);   /* ~40px at 1440 */
  line-height: 1.3;
  letter-spacing: 0.22em;
  padding-left: 0.22em;                   /* balances trailing tracking */
  white-space: nowrap;
  color: var(--cream);
}
.glow-frame__text .ch {
  display: inline-block;
  opacity: 0;                             /* main.js reveals each one */
  will-change: transform, filter, opacity;
}

.frame-note {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 0.32em;
  padding-left: 0.32em;
  color: var(--cream-soft);
  opacity: 0;
}
.frame-note__slash {
  font-family: "JetBrains Mono", monospace;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--lamp);
}

/* ---------- cabin photo with hotspots ---------- */
.cabin {
  position: relative;
  z-index: 1;
  height: 100vh;
  overflow: hidden;
  background: var(--charcoal);
}
/* photo (z 0) < edge gradients (z 1) < hotspots (z 2); both stages share the photo's box */
.cabin__photo-stage { z-index: 0; container-type: normal; }
.cabin__stage { z-index: 2; container-type: normal; }
.cabin__photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
}
/* blend in from the charcoal section above, and keep the corner note legible */
.cabin::before,
.cabin::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  z-index: 1;
  pointer-events: none;
}
.cabin::before { top: 0; height: 180px; background: linear-gradient(to bottom, var(--charcoal), rgba(27, 23, 20, 0)); }
.cabin::after { bottom: 0; height: 200px; background: linear-gradient(to top, rgba(14, 9, 6, 0.55), rgba(14, 9, 6, 0)); }

.hotspot {
  position: absolute;
  z-index: 2;
  left: var(--x);
  top: var(--y);
  width: 0; height: 0;
  pointer-events: auto;   /* .stage turns pointer events off for its box */
}
.hotspot.is-open { z-index: 3; }
/* invisible bridge over the gap between dot and card, so the mouse can move
   onto the card without leaving the hotspot */
.hotspot.is-open::after {
  content: "";
  position: absolute;
  left: 0; top: -60px;
  width: 40px; height: 120px;
}

.hotspot__dot {
  position: absolute;
  left: -22px; top: -22px;
  width: 44px; height: 44px;           /* comfortable hover target */
  margin: 0; padding: 0;
  border: 0;
  background: none;
  border-radius: 50%;
  cursor: pointer;
}
.hotspot__core {
  position: absolute;
  left: 50%; top: 50%;
  width: 12px; height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: var(--cream);
  box-shadow: 0 0 0 3px rgba(255, 199, 121, 0.45), 0 0 14px rgba(var(--lamp-glow), 0.8);
}
/* ring scale/opacity driven by main.js (requestAnimationFrame) */
.hotspot__ring {
  position: absolute;
  left: 50%; top: 50%;
  width: 12px; height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  border: 1.5px solid var(--lamp);
  box-shadow: 0 0 10px rgba(var(--lamp-glow), 0.55);
  transform: scale(var(--ring-s, 1));
  opacity: var(--ring-o, 0);
}

.hotspot__label {
  position: absolute;
  left: 22px;
  top: 0;
  transform: translateY(-50%);
  padding: 6px 12px 6px calc(12px + 0.24em);
  white-space: nowrap;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.24em;
  color: var(--cream);
  background: rgba(20, 15, 11, 0.55);
  border: 1px solid rgba(244, 237, 225, 0.22);
  border-radius: 999px;
  pointer-events: none;
  opacity: var(--label-o, 1);
}

/* tooltip card: appear/tilt values are set by main.js every frame */
.tip-card {
  position: absolute;
  left: 34px;
  top: 0;
  width: 290px;
  margin: 0;
  transform-origin: 0% 50%;
  transform:
    translateY(-50%)
    perspective(900px)
    translate3d(0, var(--card-y, 12px), 0)
    rotateX(var(--card-rx, 0deg))
    rotateY(var(--card-ry, 0deg))
    scale(var(--card-s, 0.92));
  opacity: var(--card-o, 0);
  visibility: hidden;
  pointer-events: none;
  background: #f4ede1;
  color: #2a211a;
  border-radius: 14px;
  overflow: hidden;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.6) inset,
    0 18px 40px rgba(10, 6, 4, 0.45),
    0 0 0 1px rgba(255, 199, 121, 0.35);
}
.tip-card__img {
  position: relative;
  height: 172px;
  overflow: hidden;
}
.tip-card__img img {
  position: absolute;
  display: block;
  max-width: none;
}
.tip-card__text {
  margin: 0;
  padding: 15px 18px 17px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 13.5px;
  line-height: 1.6;
  letter-spacing: 0.1em;
  white-space: nowrap;   /* one line */
}
/* sheen that follows the tilt */
.tip-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at var(--glare-x, 50%) var(--glare-y, 0%), rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0) 55%);
}

.cabin__note {
  position: absolute;
  z-index: 2;
  left: 52px;
  bottom: 40px;
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 13px;
  letter-spacing: 0.32em;
  color: var(--cream);
  text-shadow: var(--shadow);
}

/* ---------- day / night room ---------- */
.daynight {
  position: relative;
  z-index: 1;
  height: 100vh;
  overflow: hidden;
  background: var(--charcoal);
}
/* both photos share framing (1672x941) and identical cover-crop, so they
   line up exactly; main.js fades the night one over the day one */
.daynight__photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  display: block;
  user-select: none;
}
.daynight__photo--night { opacity: 0; }
.daynight::before {      /* blend in from the cabin photo above */
  content: "";
  position: absolute;
  left: 0; right: 0; top: 0;
  height: 120px;
  z-index: 1;
  background: linear-gradient(to bottom, rgba(14, 9, 6, 0.55), rgba(14, 9, 6, 0));
  pointer-events: none;
}

.daynight__panel {
  position: absolute;
  z-index: 2;
  left: 52px;
  top: 56px;
  padding: 26px 30px 28px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 22px;
  background: rgba(22, 16, 12, 0.46);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(244, 237, 225, 0.16);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(10, 6, 4, 0.25);
}
.daynight__caption {
  margin: 0;
  display: grid;           /* both lines in one cell, crossfaded by main.js */
}
.daynight__line {
  grid-area: 1 / 1;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  line-height: 1.4;
  letter-spacing: 0.16em;
  white-space: nowrap;
  color: var(--cream);
}
#line-night { opacity: 0; }

.dn-switch {
  position: relative;
  display: inline-flex;
  align-items: center;
  height: 38px;
  padding: 0 4px;
  margin: 0;
  border: 1px solid rgba(244, 237, 225, 0.5);
  border-radius: 999px;
  background: rgba(244, 237, 225, 0.06);
  cursor: pointer;
  font: inherit;
  color: var(--cream);
}
.dn-switch__thumb {        /* slides under the active option (main.js) */
  position: absolute;
  top: 3px;
  left: 0;
  height: 30px;
  width: var(--thumb-w, 64px);
  border-radius: 999px;
  background: var(--cream);
  box-shadow: 0 0 0 1px rgba(255, 199, 121, calc(var(--night, 0) * 0.6)), 0 0 calc(var(--night, 0) * 16px) rgba(var(--lamp-glow), calc(var(--night, 0) * 0.7));
  transform: translateX(var(--thumb-x, 4px));
}
.dn-switch__opt {
  position: relative;
  padding: 0 14px 0 calc(14px + 0.22em);
  font-family: var(--serif);
  font-weight: 500;
  font-size: 13.5px;
  letter-spacing: 0.22em;
  line-height: 38px;
}
.dn-switch__sep {
  position: relative;
  font-family: var(--serif);
  font-size: 12px;
  color: rgba(244, 237, 225, 0.4);
}

/* ---------- footer ---------- */
.footer {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 24px;
  padding: 44px 52px 48px;
  background: var(--charcoal);
  border-top: 1px solid rgba(255, 199, 121, 0.28);
}
.footer p { margin: 0; }
.footer__brand {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 15px;
  letter-spacing: 0.3em;
  color: var(--cream);
}
.footer__note {
  font-family: var(--serif);
  font-weight: 400;
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--cream-soft);
}

@media (max-width: 820px) {
  .glow-frame { padding: 34px 26px; }
  .glow-frame__text { font-size: 22px; letter-spacing: 0.14em; padding-left: 0.14em; }
  .nav { padding: 0 20px; }
  .daynight__panel { left: 16px; right: 16px; top: 24px; }
  .daynight__line { font-size: 18px; white-space: normal; }
  .footer { flex-direction: column; padding: 32px 20px; }
  .nav__links { display: none; }
  .nav { grid-template-columns: 1fr 1fr; }
  .hero__title { font-size: max(5.1cqw, 64px); }
}
