/* TIMEEXIST · time.timeexist.com — cosmic laboratory */

:root {
  --bg: #050816;
  --bg-elevated: #0a1024;
  --bg-card: rgba(14, 22, 48, 0.72);
  --border: rgba(140, 170, 255, 0.14);
  --border-strong: rgba(160, 190, 255, 0.28);
  --text: #e8eefc;
  --text-muted: #9aabd0;
  --text-soft: #6d7fa8;
  --accent: #8eb4ff;
  --accent-soft: rgba(142, 180, 255, 0.15);
  --glow: #6b8cff;
  --violet: #a78bfa;
  --cyan: #67e8f9;
  --gold: #f0d78c;
  --font-display: "Cormorant Garamond", "Noto Sans TC", "Noto Sans SC", Georgia, serif;
  --font-body: "Outfit", "Noto Sans TC", "Noto Sans SC", system-ui, sans-serif;
  --radius: 18px;
  --header-h: 72px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --max: 1120px;
}

body.lang-zh-TW {
  --font-body: "Noto Sans TC", "Outfit", system-ui, sans-serif;
  --font-display: "Noto Sans TC", "Cormorant Garamond", Georgia, serif;
}

body.lang-zh-CN {
  --font-body: "Noto Sans SC", "Outfit", system-ui, sans-serif;
  --font-display: "Noto Sans SC", "Cormorant Garamond", Georgia, serif;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
}

body {
  font-family: var(--font-body);
  font-weight: 300;
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body.no-webgl {
  background: #050816 url("../assets/og-spacetime.jpg") center / cover fixed;
}

img {
  max-width: 100%;
  display: block;
}

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

button,
input,
textarea,
select {
  font-family: inherit;
  color: inherit;
}

#space {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: auto;
  touch-action: none;
}

main {
  pointer-events: none;
}

.site-header,
.site-footer,
.dwell,
.glass,
.btn,
.way,
.nav,
.nav-toggle,
.brand,
.answer-card,
.def,
.theory,
.slider,
.mode-list,
.choices,
.ask-box,
.prompts,
.q,
.hero-actions,
a,
button,
input,
textarea,
label {
  pointer-events: auto;
}

.nebula {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 80% 50% at 20% 10%, rgba(80, 60, 180, 0.18), transparent 55%),
    radial-gradient(ellipse 60% 40% at 85% 30%, rgba(40, 100, 200, 0.14), transparent 50%),
    radial-gradient(ellipse 70% 50% at 50% 90%, rgba(90, 40, 140, 0.12), transparent 55%);
}

.site-header,
main,
.site-footer {
  position: relative;
  z-index: 1;
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1.25rem, 4vw, 2.5rem);
  background: linear-gradient(to bottom, rgba(5, 8, 22, 0.92), rgba(5, 8, 22, 0.55) 70%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
}

.site-header.scrolled {
  background: rgba(5, 8, 22, 0.88);
  box-shadow: 0 1px 0 var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  font-size: 0.85rem;
}

.brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--border-strong), 0 0 24px rgba(100, 140, 255, 0.35);
}

.brand-name {
  font-weight: 500;
  letter-spacing: 0.22em;
}

.brand-sub {
  color: var(--gold);
  letter-spacing: 0.28em;
  font-size: 0.72rem;
  margin-left: 0.15rem;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.25rem 1.35rem;
}

.nav a {
  font-size: 0.86rem;
  font-weight: 400;
  color: var(--text-muted);
  transition: color 0.2s ease;
}

.nav a:hover,
.nav a:focus-visible,
.nav a.active {
  color: var(--text);
}

.nav-cta {
  padding: 0.45rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  color: var(--text) !important;
  background: var(--accent-soft);
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin-left: 0.35rem;
  padding: 0.2rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(10, 16, 36, 0.45);
}

.lang-btn {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--text-soft);
  background: transparent;
  border: none;
  border-radius: 999px;
  padding: 0.35rem 0.55rem;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  line-height: 1;
}

.lang-btn:hover {
  color: var(--text);
}

.lang-btn.active {
  color: var(--text);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px rgba(142, 180, 255, 0.25);
}

body.lang-zh-TW .hero-title,
body.lang-zh-CN .hero-title,
body.lang-zh-TW h2,
body.lang-zh-CN h2,
body.lang-zh-TW h3,
body.lang-zh-CN h3 {
  letter-spacing: 0.02em;
  font-weight: 500;
}

body.lang-zh-TW .eyebrow,
body.lang-zh-CN .eyebrow {
  letter-spacing: 0.16em;
}

.now-chip {
  display: none;
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: var(--cyan);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
}

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 1.5px;
  background: var(--text);
}

.container {
  width: min(100% - 2.5rem, var(--max));
  margin-inline: auto;
}

.container.narrow {
  width: min(100% - 2.5rem, 740px);
}

.section {
  padding: clamp(4.5rem, 10vw, 7.5rem) 0;
}

.section-head {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 3.2rem;
}

.section-head h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(2rem, 4.5vw, 3.05rem);
  line-height: 1.2;
  margin-bottom: 1rem;
  text-shadow: 0 8px 40px rgba(5, 8, 22, 0.95);
}

.lede {
  color: var(--text-muted);
  font-size: 1.05rem;
  text-shadow: 0 4px 24px rgba(5, 8, 22, 0.9);
}

.eyebrow {
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 1rem;
}

.hero {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: calc(var(--header-h) + 2rem) 1.5rem 4rem;
  text-align: center;
}

.hero-inner {
  max-width: 820px;
}

.hero-logo {
  width: 92px;
  height: 92px;
  margin: 0 auto 1.4rem;
  border-radius: 22px;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--border-strong), 0 0 48px rgba(103, 232, 249, 0.18);
}

.hero-title {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(3.1rem, 9vw, 6.4rem);
  line-height: 0.95;
  letter-spacing: 0.02em;
  text-shadow: 0 12px 48px rgba(5, 8, 22, 0.8);
}

.hero-title em {
  font-style: italic;
  color: var(--gold);
}

.hero-sub {
  margin-top: 1.4rem;
  color: var(--text-muted);
  font-size: clamp(1.05rem, 2vw, 1.25rem);
  max-width: 34em;
  margin-inline: auto;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  justify-content: center;
  margin-top: 2rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.72rem 1.3rem;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  font-size: 0.92rem;
  font-weight: 400;
  transition: transform 0.25s var(--ease), box-shadow 0.25s, background 0.25s, border-color 0.25s;
  cursor: pointer;
  background: transparent;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(180deg, rgba(142, 180, 255, 0.28), rgba(142, 180, 255, 0.08));
  box-shadow: 0 0 28px rgba(107, 140, 255, 0.18);
}

.btn-ghost:hover {
  border-color: var(--accent);
}

.scroll-hint {
  margin-top: 3.2rem;
  color: var(--text-soft);
  font-size: 0.72rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
}

.scroll-line {
  width: 1px;
  height: 42px;
  margin: 0.6rem auto 0;
  background: linear-gradient(to bottom, var(--accent), transparent);
}

.glass {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

.answer-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.answer-card {
  padding: 1.4rem 1.3rem;
}

.answer-card h3 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  font-weight: 500;
  margin-bottom: 0.55rem;
}

.answer-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.kicker {
  color: var(--gold);
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 0.45rem;
}

.prose {
  color: var(--text-muted);
  font-size: 1.05rem;
  text-shadow: 0 4px 22px rgba(5, 8, 22, 0.9);
}

.prose p + p {
  margin-top: 1rem;
}

.prose strong {
  color: var(--text);
  font-weight: 500;
}

.definition-list {
  display: grid;
  gap: 0.8rem;
  margin-top: 2rem;
}

.def {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 1rem;
  padding: 1.05rem 1.2rem;
  align-items: start;
}

.def dt {
  font-weight: 500;
  color: var(--cyan);
  letter-spacing: 0.04em;
}

.def dd {
  color: var(--text-muted);
}

.ways-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.way {
  padding: 1.35rem 1.25rem 1.2rem;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.25s, transform 0.25s var(--ease), box-shadow 0.25s;
}

.way:hover,
.way.active {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 12px 40px rgba(10, 16, 40, 0.35);
}

.way .num {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--text-soft);
}

.way h3 {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 500;
  margin: 0.35rem 0 0.4rem;
}

.way p {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.lab {
  padding-top: 2rem;
}

.lab-shell {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 1.2rem;
  min-height: 72vh;
}

.lab-stage {
  position: relative;
  min-height: 62vh;
  overflow: hidden;
  pointer-events: none;
  background: rgba(14, 22, 48, 0.18);
}

.lab-stage .hint {
  position: absolute;
  left: 1.2rem;
  bottom: 1.2rem;
  font-size: 0.78rem;
  color: var(--text-soft);
  letter-spacing: 0.08em;
}

.lab-panel {
  padding: 1.3rem 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.lab-panel h3 {
  font-family: var(--font-display);
  font-size: 1.7rem;
  font-weight: 500;
}

.lab-panel p {
  color: var(--text-muted);
  font-size: 0.95rem;
}

.mode-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 280px;
  overflow: auto;
}

.mode-list button {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 10px;
  text-align: left;
  padding: 0.45rem 0.6rem;
  color: var(--text-muted);
  cursor: pointer;
}

.mode-list button.active,
.mode-list button:hover {
  color: var(--text);
  background: var(--accent-soft);
  border-color: var(--border);
}

.slider {
  display: grid;
  gap: 0.3rem;
}

.slider label {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.slider input {
  appearance: none;
  height: 4px;
  border-radius: 999px;
  background: rgba(142, 180, 255, 0.25);
  outline: none;
}

.slider input::-webkit-slider-thumb {
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 12px rgba(103, 232, 249, 0.6);
  cursor: pointer;
}

.theory-stack {
  display: grid;
  gap: 1.2rem;
}

.theory {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 1.4rem;
  padding: 1.4rem;
  align-items: center;
}

.theory img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  border-radius: 14px;
}

.theory h3 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 500;
  margin: 0.2rem 0 0.7rem;
}

.theory p {
  color: var(--text-muted);
}

.theory.flip {
  grid-template-columns: 1fr 1.1fr;
}

.theory.flip .theory-copy {
  order: -1;
}

.chat {
  display: grid;
  grid-template-columns: 1fr 300px;
  gap: 1rem;
}

.transcript {
  min-height: 420px;
  max-height: 560px;
  overflow: auto;
  padding: 1.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.bubble {
  max-width: 86%;
  padding: 0.85rem 1rem;
  border-radius: 16px;
  line-height: 1.55;
}

.bubble.time {
  align-self: flex-start;
  background: rgba(103, 232, 249, 0.1);
  border: 1px solid rgba(103, 232, 249, 0.2);
}

.bubble.you {
  align-self: flex-end;
  background: var(--accent-soft);
  border: 1px solid var(--border);
}

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0 0.2rem;
}

.choices button,
.ask-box button {
  border: 1px solid var(--border-strong);
  background: rgba(10, 16, 36, 0.5);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
  font-size: 0.88rem;
}

.choices button:hover,
.ask-box button:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.ask-box {
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.ask-box h3 {
  font-family: var(--font-display);
  font-size: 1.5rem;
}

.ask-box textarea,
.ask-box input {
  width: 100%;
  background: rgba(5, 8, 22, 0.6);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  resize: vertical;
  min-height: 90px;
}

.prompts {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.prompts button {
  text-align: left;
  background: transparent;
  border: 0;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.86rem;
}

.prompts button:hover {
  color: var(--gold);
}

.romance-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 1.2rem;
}

.quote-card blockquote {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3vw, 2.15rem);
  font-style: italic;
  line-height: 1.3;
  padding: 1.6rem;
}

.quote-card cite {
  display: block;
  margin-top: 1rem;
  font-style: normal;
  font-size: 0.82rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.love-list {
  display: grid;
  gap: 0.8rem;
}

.love-list article {
  padding: 1.1rem 1.2rem;
}

.love-list h3 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  margin-bottom: 0.3rem;
}

.love-list p {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.play-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.toy {
  padding: 1.3rem;
}

.toy h3 {
  font-family: var(--font-display);
  font-size: 1.55rem;
  margin-bottom: 0.4rem;
}

.toy p {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin-bottom: 1rem;
}

.stat {
  font-variant-numeric: tabular-nums;
  font-size: 2rem;
  color: var(--gold);
  font-weight: 500;
}

.entropy-box {
  height: 160px;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  background: #070b18;
  margin: 0.8rem 0;
}

.entropy-box canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.research-list {
  display: grid;
  gap: 0.9rem;
}

.paper {
  padding: 1.2rem 1.3rem;
  display: grid;
  grid-template-columns: 5.5rem 1fr auto;
  gap: 1rem;
  align-items: start;
}

.paper .year {
  color: var(--gold);
  letter-spacing: 0.12em;
  font-size: 0.8rem;
}

.paper h3 {
  font-size: 1.05rem;
  font-weight: 500;
  margin-bottom: 0.3rem;
}

.paper p {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.paper a {
  color: var(--cyan);
  font-size: 0.82rem;
  white-space: nowrap;
}

.quiz {
  padding: 1.5rem;
}

.quiz h3 {
  font-family: var(--font-display);
  font-size: 1.8rem;
  margin-bottom: 0.4rem;
}

.q {
  margin-top: 1.2rem;
}

.q p {
  margin-bottom: 0.6rem;
}

.q label {
  display: block;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 0.4rem;
  cursor: pointer;
  color: var(--text-muted);
}

.q label:hover,
.q input:checked + span,
.q label:has(input:checked) {
  border-color: var(--accent);
  color: var(--text);
  background: var(--accent-soft);
}

.q input {
  margin-right: 0.55rem;
}

.quiz-result {
  margin-top: 1.2rem;
  padding: 1rem 1.1rem;
  border-left: 2px solid var(--gold);
  color: var(--text-muted);
  display: none;
}

.quiz-result.show {
  display: block;
}

.site-footer {
  padding: 3rem 0 2.4rem;
  border-top: 1px solid var(--border);
  text-align: center;
  color: var(--text-soft);
  font-size: 0.88rem;
}

.site-footer a {
  color: var(--accent);
}

.dwell {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 80;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-soft);
  background: rgba(5, 8, 22, 0.7);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  backdrop-filter: blur(10px);
}

.reveal {
  opacity: 0;
  transform: translateY(16px);
  animation: rise 0.9s var(--ease) forwards;
}

@keyframes rise {
  to {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 980px) {
  .answer-grid,
  .ways-grid,
  .lab-shell,
  .theory,
  .theory.flip,
  .chat,
  .romance-grid,
  .play-grid,
  .paper {
    grid-template-columns: 1fr;
  }

  .theory.flip .theory-copy {
    order: 0;
  }

  .def {
    grid-template-columns: 1fr;
    gap: 0.3rem;
  }

  .now-chip {
    display: none;
  }
}

@media (max-width: 820px) {
  .nav {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    padding: 1rem 1.4rem 1.4rem;
    background: rgba(5, 8, 22, 0.96);
    gap: 0.9rem;
  }

  .nav.open {
    display: flex;
  }

  .nav-toggle {
    display: flex;
  }

  .brand-name {
    letter-spacing: 0.14em;
  }

  .lang-switch {
    margin: 0.85rem 0 0.25rem;
    align-self: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .reveal {
    opacity: 1;
    transform: none;
    animation: none;
  }
}
