:root {
  color-scheme: light;
  --ink: #514650;
  --glass: rgba(255, 248, 240, 0.48);
  --line: rgba(91, 72, 83, 0.16);
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: linear-gradient(180deg, #9ebed8 0%, #f7dcc5 100%);
}

body {
  color: var(--ink);
  transition: color 1.8s ease;
}

[hidden] { display: none !important; }

#scene {
  position: fixed;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
  cursor: grab;
  -webkit-tap-highlight-color: transparent;
}

#scene:active { cursor: grabbing; }
#scene:focus-visible { outline: 2px solid rgba(255, 247, 232, 0.8); outline-offset: -5px; }

.experience {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.title-block {
  position: absolute;
  top: clamp(26px, 5.2vh, 58px);
  left: clamp(22px, 4.6vw, 68px);
  max-width: min(470px, 70vw);
  text-shadow: 0 2px 24px rgba(255, 246, 232, 0.38);
  transition: text-shadow 1.8s ease;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 13px;
  font-size: 10px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: 0.21em;
  text-transform: uppercase;
  opacity: 0.72;
}

.eyebrow span {
  width: 7px;
  height: 7px;
  background: #e9a8bf;
  box-shadow: 5px 0 0 #f3c4d5, 0 5px 0 #f7d7e2, -5px 0 0 #f3c4d5, 0 -5px 0 #f7d7e2;
  transform: rotate(45deg) scale(0.72);
}

h1 {
  margin: 0;
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  font-size: clamp(36px, 4.4vw, 62px);
  font-weight: 400;
  line-height: 0.98;
  letter-spacing: -0.045em;
}

h1 em {
  display: block;
  font-weight: 400;
  letter-spacing: -0.055em;
}

.subtitle {
  max-width: 330px;
  margin: 18px 0 0;
  font-size: 13px;
  font-weight: 450;
  line-height: 1.65;
  letter-spacing: 0.015em;
  opacity: 0.72;
}

.time-pill {
  position: absolute;
  top: clamp(24px, 4.8vh, 52px);
  right: clamp(20px, 3.8vw, 58px);
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass);
  box-shadow: 0 8px 30px rgba(81, 65, 78, 0.06);
  backdrop-filter: blur(14px) saturate(115%);
  -webkit-backdrop-filter: blur(14px) saturate(115%);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  transition: background 1.8s ease, border-color 1.8s ease;
}

.time-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e6ad70;
  box-shadow: 0 0 0 4px rgba(230, 173, 112, 0.14), 0 0 13px rgba(255, 205, 137, 0.7);
}

.hint {
  position: absolute;
  left: clamp(22px, 4.6vw, 68px);
  bottom: clamp(78px, 12vh, 112px);
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  font-size: 10px;
  font-weight: 550;
  letter-spacing: 0.08em;
  opacity: 0.58;
}

.drag-mark {
  position: relative;
  width: 14px;
  height: 19px;
  border: 1px solid currentColor;
  border-radius: 8px;
  opacity: 0.8;
}

.drag-mark::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 5px;
  width: 2px;
  height: 4px;
  border-radius: 2px;
  background: currentColor;
}

.motion-toggle {
  position: absolute;
  left: clamp(20px, 4.4vw, 64px);
  bottom: clamp(22px, 4.4vh, 44px);
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 39px;
  padding: 0 15px 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--glass);
  color: inherit;
  box-shadow: 0 8px 30px rgba(81, 65, 78, 0.07);
  backdrop-filter: blur(14px) saturate(115%);
  -webkit-backdrop-filter: blur(14px) saturate(115%);
  font: inherit;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.08em;
  pointer-events: auto;
  cursor: pointer;
  transition: transform 180ms ease, background 1.8s ease, border-color 1.8s ease;
}

.motion-toggle:hover { transform: translateY(-1px); }
.motion-toggle:active { transform: translateY(0); }
.motion-toggle:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }

.motion-icon {
  position: relative;
  display: block;
  width: 13px;
  height: 13px;
}

.motion-icon::before,
.motion-icon::after {
  content: "";
  position: absolute;
  top: 2px;
  width: 3px;
  height: 9px;
  border-radius: 1px;
  background: currentColor;
  opacity: 0.76;
}

.motion-icon::before { left: 2px; }
.motion-icon::after { right: 2px; }

.is-paused .motion-icon::before {
  top: 1px;
  left: 3px;
  width: 0;
  height: 0;
  border-top: 5.5px solid transparent;
  border-bottom: 5.5px solid transparent;
  border-left: 8px solid currentColor;
  border-radius: 0;
  background: transparent;
}

.is-paused .motion-icon::after { display: none; }

.loading {
  position: fixed;
  inset: 0;
  z-index: 5;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 25px;
  background: linear-gradient(180deg, #a8c4db 0%, #f5d9c6 100%);
  color: #675660;
  transition: opacity 700ms ease, visibility 700ms ease;
}

.is-ready .loading {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading p {
  margin: 0;
  font-family: "Iowan Old Style", Georgia, serif;
  font-size: 17px;
  font-style: italic;
  letter-spacing: 0.02em;
  opacity: 0.72;
}

.loading-flower {
  position: relative;
  width: 10px;
  height: 10px;
  background: #eeb1c8;
  box-shadow: 14px 0 0 #f6c8d9, 7px 12px 0 #f2b7cd, 7px -12px 0 #f8d4e1, -7px 0 0 #f6c8d9;
  transform: rotate(45deg);
  animation: breathe 2.8s ease-in-out infinite;
}

@keyframes breathe {
  0%, 100% { transform: rotate(45deg) scale(0.9); opacity: 0.72; }
  50% { transform: rotate(45deg) scale(1.08); opacity: 1; }
}

.fallback {
  position: fixed;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, #9ebed8, #f7dcc5);
}

.fallback svg { width: 100%; height: 100%; object-fit: cover; }
.fallback-message {
  position: absolute;
  bottom: 12%;
  margin: 0;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 248, 240, 0.66);
  color: #5c4d57;
  font-family: Georgia, serif;
  font-size: 14px;
  font-style: italic;
}

@media (max-width: 640px) {
  .title-block { top: max(22px, env(safe-area-inset-top)); left: 20px; max-width: 72vw; }
  h1 { font-size: clamp(30px, 8.4vw, 42px); }
  .eyebrow { margin-bottom: 10px; font-size: 8px; letter-spacing: 0.18em; }
  .subtitle { display: none; }
  .time-pill { top: max(20px, env(safe-area-inset-top)); right: 16px; min-height: 30px; padding: 0 11px; font-size: 8px; }
  .hint { left: 20px; bottom: 76px; font-size: 8px; letter-spacing: 0.05em; }
  .motion-toggle { left: 16px; bottom: max(18px, env(safe-area-inset-bottom)); min-height: 36px; font-size: 9px; }
}

@media (max-width: 390px) {
  .time-pill { top: auto; bottom: max(22px, env(safe-area-inset-bottom)); right: 14px; }
  .hint { max-width: 230px; line-height: 1.5; }
}

@media (max-height: 420px) {
  .title-block { top: 18px; left: 20px; }
  h1 { font-size: 28px; }
  .subtitle, .hint { display: none; }
  .eyebrow { margin-bottom: 7px; }
  .time-pill { top: 18px; right: 18px; }
  .motion-toggle { bottom: 16px; }
}

.is-peek .title-block { top: 12px; left: 12px; max-width: 65vw; }
.is-peek h1 { font-size: 21px; }
.is-peek .eyebrow { display: none; }
.is-peek .subtitle, .is-peek .hint, .is-peek .time-pill { display: none; }
.is-peek .motion-toggle { left: 10px; bottom: 10px; min-height: 30px; padding: 0 10px; font-size: 8px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; }
}
