/* ==========================================================================
   Senin Evrenin — Vera için
   Renk: gece mavisi / nebula moru / yıldız beyazı / sıcak altın / kor pembesi
   Tipografi: Bodoni Moda (sinematik jenerik) + Manrope (metin) + JetBrains Mono (veri)
   ========================================================================== */

:root {
  --void: #04050c;
  --deep: #0d0824;
  --nebula: #4a1d5c;
  --rose: #8c2f52;
  --star: #f6f0ff;
  --gold: #f0c489;
  --ember: #ff5d7e;

  --star-dim: rgba(246, 240, 255, 0.58);
  --star-faint: rgba(246, 240, 255, 0.3);
  --hairline: rgba(246, 240, 255, 0.16);

  --font-display: 'Bodoni Moda', 'Times New Roman', serif;
  --font-body: 'Manrope', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'Courier New', monospace;

  --pad: clamp(1.25rem, 4vw, 3.5rem);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: auto;
}

body {
  margin: 0;
  background: var(--void);
  color: var(--star);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

body.is-locked {
  overflow: hidden;
  height: 100vh;
}

::selection {
  background: var(--ember);
  color: var(--void);
}

:focus-visible {
  outline: 1px solid var(--gold);
  outline-offset: 4px;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

/* --------------------------------------------------------------------------
   Sahne tuvali
   -------------------------------------------------------------------------- */

#stage {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  touch-action: pan-y;
}

#vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 45%, transparent 42%, rgba(4, 5, 12, 0.72) 100%),
    linear-gradient(to bottom, rgba(4, 5, 12, 0.55) 0%, transparent 22%, transparent 74%, rgba(4, 5, 12, 0.8) 100%);
}

/* --------------------------------------------------------------------------
   Doğuş ekranı
   -------------------------------------------------------------------------- */

#intro {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 50% 50%, #0b0720 0%, #04050c 62%);
  transition: opacity 1.5s var(--ease), visibility 1.5s;
}

#intro.is-gone {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-inner {
  text-align: center;
  padding: var(--pad);
}

.intro-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 300;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--star-faint);
  margin: 0 0 1.6rem;
  animation: rise 1.6s var(--ease) 0.2s both;
}

.intro-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.9rem, 12vw, 7.5rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--star);
  animation: rise 1.8s var(--ease) 0.45s both;
}

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

.intro-orb {
  width: 108px;
  height: 108px;
  margin: clamp(2rem, 7vh, 4rem) auto 0;
  border-radius: 50%;
  position: relative;
  background: radial-gradient(circle, #fffdf6 0%, var(--gold) 34%, rgba(255, 93, 126, 0.3) 62%, transparent 72%);
  animation: pulse 2.8s ease-in-out infinite, rise 1.8s var(--ease) 0.7s both;
  cursor: pointer;
  border: none;
  padding: 0;
  display: block;
}

.intro-orb::after {
  content: '';
  position: absolute;
  inset: -34px;
  border-radius: 50%;
  border: 1px solid rgba(240, 196, 137, 0.28);
  animation: ripple 2.8s ease-out infinite;
}

.intro-hint {
  display: block;
  margin-top: 1.9rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: var(--star-dim);
  animation: rise 1.8s var(--ease) 0.95s both;
}

.intro-loading {
  position: absolute;
  bottom: clamp(1.5rem, 5vh, 3rem);
  left: 0;
  right: 0;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: rgba(246, 240, 255, 0.22);
}

@keyframes pulse {
  0%, 100% { transform: scale(1); filter: brightness(1); }
  50% { transform: scale(1.09); filter: brightness(1.28); }
}

@keyframes ripple {
  0% { transform: scale(0.72); opacity: 0.9; }
  100% { transform: scale(1.5); opacity: 0; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

/* --------------------------------------------------------------------------
   Kaydırma katmanı ve sahne panelleri
   -------------------------------------------------------------------------- */

/* Kaydırma yüksekliğini veren boş katman */
#scroller {
  position: relative;
  z-index: 5;
  pointer-events: none;
}

/* Paneller sayfa akışında değil: kamera nerede ise o panel görünür */
#panels {
  position: fixed;
  inset: 0;
  z-index: 15;
  pointer-events: none;
}

.slot {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  padding: 12svh var(--pad);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.8s var(--ease), visibility 0.8s;
}

.slot.is-active {
  opacity: 1;
  visibility: visible;
}

.slot--left {
  justify-content: flex-start;
}

.slot--right {
  justify-content: flex-end;
  text-align: right;
}

.slot--center {
  justify-content: center;
  text-align: center;
}

.panel {
  max-width: 30rem;
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.9s var(--ease) 0.15s, transform 0.9s var(--ease) 0.15s;
}

.slot.is-active .panel {
  opacity: 1;
  transform: none;
}

.slot--right .panel-kicker {
  justify-content: flex-end;
}

.slot--center .panel-kicker {
  justify-content: center;
}

.slot--right .panel-body {
  margin-left: auto;
}

.slot--center .panel-body {
  margin-inline: auto;
}

.panel-kicker {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.64rem;
  font-weight: 400;
  letter-spacing: 0.36em;
  text-transform: uppercase;
  color: var(--gold);
  margin: 0 0 1.2rem;
}

.panel-kicker span {
  color: var(--star-faint);
}

.panel-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.1rem, 6.4vw, 4.2rem);
  line-height: 1.02;
  letter-spacing: -0.015em;
  margin: 0 0 1.1rem;
  white-space: pre-line;
}

.panel-body {
  margin: 0;
  font-size: clamp(0.95rem, 2.4vw, 1.05rem);
  color: var(--star-dim);
  max-width: 26rem;
}

/* --------------------------------------------------------------------------
   HUD
   -------------------------------------------------------------------------- */

#hud {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.4s var(--ease);
}

#hud.is-visible {
  opacity: 1;
}

.hud-rail {
  position: absolute;
  left: var(--pad);
  bottom: clamp(1.5rem, 5vh, 3rem);
  display: flex;
  align-items: flex-end;
  gap: 0.9rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--star-faint);
}

.hud-track {
  width: 1px;
  height: 92px;
  background: var(--hairline);
  position: relative;
}

.hud-progress {
  position: absolute;
  top: 0;
  left: -1px;
  width: 3px;
  height: 0;
  background: linear-gradient(to bottom, var(--gold), var(--ember));
  transition: height 0.25s linear;
}

.hud-label {
  padding-bottom: 0.1rem;
  line-height: 1.9;
}

.hud-label b {
  display: block;
  font-weight: 400;
  color: var(--star);
}

.hud-sound {
  position: absolute;
  top: clamp(1rem, 3vh, 2rem);
  right: var(--pad);
  pointer-events: auto;
  width: 42px;
  height: 42px;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--star-dim);
  transition: color 0.3s, border-color 0.3s, transform 0.3s var(--ease);
}

.hud-sound:hover {
  color: var(--gold);
  border-color: rgba(240, 196, 137, 0.5);
  transform: scale(1.06);
}

.hud-sound svg {
  width: 17px;
  height: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hud-scroll {
  position: absolute;
  bottom: clamp(1.5rem, 5vh, 3rem);
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  color: var(--star-faint);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  transition: opacity 0.6s;
}

.hud-scroll::after {
  content: '';
  width: 1px;
  height: 28px;
  background: linear-gradient(to bottom, var(--star-faint), transparent);
  animation: drop 2s ease-in-out infinite;
}

.hud-scroll.is-hidden {
  opacity: 0;
}

@keyframes drop {
  0% { transform: scaleY(0); transform-origin: top; opacity: 0; }
  40% { transform: scaleY(1); opacity: 1; }
  100% { transform: scaleY(1); transform-origin: bottom; opacity: 0; }
}

/* --------------------------------------------------------------------------
   Yörünge sayaçları
   -------------------------------------------------------------------------- */

#orbit-readouts {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.7s var(--ease);
}

#orbit-readouts.is-visible {
  opacity: 1;
}

.readout {
  position: absolute;
  transform: translate(-50%, -50%);
  min-width: 9.5rem;
  padding: 0.55rem 0.8rem;
  border-left: 1px solid var(--gold);
  background: rgba(4, 5, 12, 0.55);
  backdrop-filter: blur(6px);
  will-change: left, top;
}

.readout-label {
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold);
  white-space: nowrap;
}

.readout-value {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-variant-numeric: tabular-nums;
  color: var(--star);
  white-space: nowrap;
}

.readout-unit {
  font-family: var(--font-mono);
  font-size: 0.54rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--star-faint);
  white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Takımyıldız katmanı
   -------------------------------------------------------------------------- */

#reason-layer {
  position: fixed;
  inset: 0;
  z-index: 22;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.7s var(--ease);
}

#reason-layer.is-visible {
  opacity: 1;
}

.reason-pop {
  position: absolute;
  max-width: 17rem;
  transform: translate(-50%, -120%);
  padding: 0.7rem 0.95rem;
  background: rgba(9, 6, 26, 0.82);
  border: 1px solid var(--hairline);
  border-left: 1px solid var(--ember);
  backdrop-filter: blur(8px);
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--star);
  animation: pop 0.5s var(--ease) both;
}

.reason-pop.is-fading {
  animation: popOut 0.6s var(--ease) both;
}

@keyframes pop {
  from { opacity: 0; transform: translate(-50%, -100%) scale(0.94); }
  to { opacity: 1; transform: translate(-50%, -120%) scale(1); }
}

@keyframes popOut {
  from { opacity: 1; transform: translate(-50%, -120%); }
  to { opacity: 0; transform: translate(-50%, -150%); }
}

.reason-hud {
  position: absolute;
  bottom: clamp(2rem, 7vh, 4.5rem);
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  text-align: center;
  pointer-events: auto;
}

.reason-count {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--star-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.reason-all {
  position: relative;
  padding: 0.9rem 2.1rem;
  border: 1px solid rgba(240, 196, 137, 0.5);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(240, 196, 137, 0.14), rgba(255, 93, 126, 0.09));
  backdrop-filter: blur(10px);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  white-space: nowrap;
  box-shadow: 0 10px 34px rgba(255, 93, 126, 0.16);
  animation: breathe 3.6s ease-in-out infinite;
  transition: color 0.35s var(--ease), background 0.35s var(--ease),
    border-color 0.35s var(--ease), box-shadow 0.35s var(--ease), transform 0.35s var(--ease);
}

.reason-all::before {
  content: '✦';
  margin-right: 0.75em;
  letter-spacing: 0;
}

.reason-all:hover,
.reason-all:focus-visible {
  color: #1a0a12;
  background: linear-gradient(180deg, #ffdcae 0%, #ff9fb0 100%);
  border-color: transparent;
  box-shadow: 0 0 46px rgba(255, 93, 126, 0.45);
  transform: translateY(-2px);
  animation: none;
}

.reason-all:active {
  transform: translateY(0);
}

.reason-all.is-hidden {
  display: none;
}

@keyframes breathe {
  0%, 100% { box-shadow: 0 10px 30px rgba(255, 93, 126, 0.12); }
  50% { box-shadow: 0 10px 44px rgba(255, 93, 126, 0.3); }
}

/* --------------------------------------------------------------------------
   Mektup
   -------------------------------------------------------------------------- */

.letter {
  position: relative;
  width: min(38rem, 100%);
  padding: clamp(1.8rem, 5vw, 3.2rem);
  background: linear-gradient(160deg, rgba(20, 12, 44, 0.82), rgba(6, 6, 18, 0.88));
  border: 1px solid rgba(240, 196, 137, 0.24);
  box-shadow: 0 0 90px rgba(74, 29, 92, 0.5), inset 0 0 60px rgba(240, 196, 137, 0.04);
  backdrop-filter: blur(10px);
  pointer-events: auto;
  max-height: 82svh;
  overflow-y: auto;
}

.letter::before {
  content: '';
  position: absolute;
  inset: 7px;
  border: 1px solid rgba(240, 196, 137, 0.14);
  pointer-events: none;
}

.letter-salutation {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.5rem, 4.5vw, 2.2rem);
  color: var(--gold);
  margin: 0 0 1.3rem;
}

.letter-text p {
  margin: 0 0 1.05rem;
  font-size: clamp(0.92rem, 2.3vw, 1.02rem);
  line-height: 1.85;
  color: rgba(246, 240, 255, 0.86);
}

.letter-caret {
  display: inline-block;
  width: 2px;
  height: 1em;
  margin-left: 2px;
  background: var(--gold);
  vertical-align: -0.15em;
  animation: blink 1s steps(2) infinite;
}

@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

.letter-signature {
  margin: 1.8rem 0 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05rem;
  line-height: 1.6;
  white-space: pre-line;
  color: var(--gold);
  opacity: 0;
  transition: opacity 1.2s var(--ease);
}

.letter-signature.is-visible {
  opacity: 1;
}

/* --------------------------------------------------------------------------
   Final
   -------------------------------------------------------------------------- */

.finale-line {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.2rem, 8vw, 5rem);
  line-height: 1.05;
  margin: 0;
}

.finale-sub {
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--star-faint);
  margin: 1.6rem 0 0;
}

.finale-again {
  margin-top: 2.4rem;
  padding: 0.7rem 1.6rem;
  border: 1px solid var(--hairline);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--star-dim);
  pointer-events: auto;
  transition: color 0.3s, border-color 0.3s;
}

.finale-again:hover {
  color: var(--gold);
  border-color: rgba(240, 196, 137, 0.5);
}

/* --------------------------------------------------------------------------
   Fotoğraf görüntüleyici
   -------------------------------------------------------------------------- */

#viewer {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  background: rgba(4, 5, 12, 0.92);
  backdrop-filter: blur(18px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s var(--ease), visibility 0.5s;
}

#viewer.is-open {
  opacity: 1;
  visibility: visible;
}

.viewer-frame {
  position: relative;
  width: min(88vw, 62vh * 0.8);
  max-height: 78svh;
  transform: scale(0.94);
  transition: transform 0.6s var(--ease);
}

#viewer.is-open .viewer-frame {
  transform: scale(1);
}

.viewer-frame img {
  display: block;
  width: 100%;
  max-height: 78svh;
  object-fit: contain;
  border: 1px solid rgba(240, 196, 137, 0.2);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.7);
}

.viewer-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  color: var(--star-dim);
  font-size: 1.4rem;
  transition: color 0.3s;
}

.viewer-btn:hover {
  color: var(--gold);
}

.viewer-prev { left: max(0.5rem, calc(50vw - min(44vw, 62vh * 0.4) - 3.4rem)); }
.viewer-next { right: max(0.5rem, calc(50vw - min(44vw, 62vh * 0.4) - 3.4rem)); }

.viewer-close {
  position: absolute;
  top: clamp(1rem, 3vh, 2rem);
  right: var(--pad);
  width: 42px;
  height: 42px;
  border: 1px solid var(--hairline);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--star-dim);
  transition: color 0.3s, border-color 0.3s, transform 0.3s var(--ease);
}

.viewer-close:hover {
  color: var(--gold);
  border-color: rgba(240, 196, 137, 0.5);
  transform: rotate(90deg);
}

/* --------------------------------------------------------------------------
   Mobil
   -------------------------------------------------------------------------- */

@media (max-width: 720px) {
  .slot {
    align-items: flex-end;
    padding-bottom: 18svh;
  }

  .slot--right {
    justify-content: flex-start;
    text-align: left;
  }

  .slot--right .panel-kicker {
    justify-content: flex-start;
  }

  .slot--right .panel-body {
    margin-left: 0;
  }

  .slot--letter,
  .slot--finale {
    align-items: center;
    padding-bottom: 12svh;
  }

  .hud-track {
    height: 56px;
  }

  .hud-rail {
    font-size: 0.55rem;
  }

  .readout {
    min-width: 8rem;
    padding: 0.45rem 0.6rem;
  }

  .reason-pop {
    max-width: 15rem;
    font-size: 0.8rem;
  }

  /* Takımyıldız sahnesinde metin üstte kalsın, buton altta nefes alsın */
  .slot--constellation {
    align-items: flex-start;
    padding-top: 14svh;
    padding-bottom: 0;
  }

  .reason-all {
    padding: 0.8rem 1.6rem;
    font-size: 0.6rem;
    letter-spacing: 0.24em;
  }

  .viewer-prev { left: 0.25rem; }
  .viewer-next { right: 0.25rem; }
}

@media (max-width: 720px) and (orientation: portrait) {
  .viewer-frame {
    width: 92vw;
  }
}

/* --------------------------------------------------------------------------
   WebGL yoksa: düz sürüm
   -------------------------------------------------------------------------- */

.flat {
  position: relative;
  z-index: 10;
  pointer-events: auto;
  max-width: 62rem;
  margin: 0 auto;
  padding: 0 var(--pad);
}

.flat-section {
  padding: 14svh 0;
  border-bottom: 1px solid var(--hairline);
}

.flat-section:last-child {
  border-bottom: none;
}

.flat-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.6rem;
  margin-top: 2.4rem;
}

.flat-gallery img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  cursor: pointer;
  filter: saturate(0.95) brightness(0.92);
  transition: filter 0.3s, transform 0.3s var(--ease);
}

.flat-gallery img:hover {
  filter: none;
  transform: scale(1.03);
}

.flat-counters {
  display: grid;
  gap: 1rem;
  margin-top: 2.4rem;
}

.flat-counter {
  border-left: 1px solid var(--gold);
  padding-left: 0.9rem;
}

.flat-counter b {
  display: block;
  font-family: var(--font-mono);
  font-weight: 400;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
}

.flat-reasons {
  margin: 2.4rem 0 0;
  padding: 0;
  list-style: none;
  counter-reset: reason;
  display: grid;
  gap: 0.9rem;
}

.flat-reasons li {
  counter-increment: reason;
  padding-left: 2.6rem;
  position: relative;
  color: var(--star-dim);
}

.flat-reasons li::before {
  content: counter(reason, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0.15rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.2em;
  color: var(--gold);
}

.flat-finale {
  text-align: center;
  padding: 20svh 0;
}

/* --------------------------------------------------------------------------
   Hareket azaltma
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.15s !important;
  }
}
