/* ============================================================
   Selva & Enes — Nişan Davetiyesi
   İpek Saten • Altın Varak • Canlı Hareketli Manolya Çiçekleri
   (iOS Safari & Masaüstü Tam Uyumlu)
============================================================ */

:root {
  --ivory: #FBF7F1;
  --paper: #F5ECE2;
  --gold: #B8935A;
  --gold-soft: #D8BE8C;
  --gold-deep: #8C6A38;
  --ink: #3A2F27;
  --ink-soft: #5E5146;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  min-height: -webkit-fill-available;
  font-family: "Cormorant Garamond", Georgia, serif;
  color: var(--ink);
  background-color: #EFE4D8;
  background-image:
    radial-gradient(ellipse at 15% 10%, rgba(248, 236, 224, .9) 0%, transparent 55%),
    radial-gradient(ellipse at 85% 90%, rgba(235, 219, 200, .85) 0%, transparent 55%),
    linear-gradient(155deg, #F6EEE5 0%, #EADCCF 48%, #F3E8DC 100%);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

#petals {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 10;
}

.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;
}

/* Altın varak yazı */
.gold-text {
  color: var(--gold);
  background: linear-gradient(120deg, #8C6A38 0%, #C9A462 28%, #E8CF98 45%, #B48C50 62%, #8C6A38 80%, #C9A462 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: foil 8s linear infinite;
}
@keyframes foil { to { background-position: 200% center; } }

/* ===================== ZARF (3D açılış sahnesi) ===================== */
.intro {
  --w: 320px;
  --h: 218px;
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 24px;
  background:
    radial-gradient(ellipse at 50% 40%, #FBF5EC 0%, #F1E4D3 60%, #E8D7C1 100%);
  transition: opacity 1.1s ease, visibility 1.1s ease;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

@media (max-width: 390px) {
  .intro {
    --w: 276px;
    --h: 188px;
  }
}

.intro.done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.intro-top, .intro-hint {
  position: relative;
  text-align: center;
  transition: opacity .6s ease, transform .6s ease;
}
.intro-top small {
  display: block;
  font-family: "Cinzel", serif;
  font-size: 11px;
  letter-spacing: .42em;
  text-transform: uppercase;
  color: var(--gold-deep);
}
.intro-top b {
  display: inline-block;
  font-family: "Great Vibes", cursive;
  font-weight: 400;
  font-size: 46px;
  line-height: 1.3;
  padding: 0 .35em;
  white-space: nowrap;
}
.intro-hint {
  font-style: italic;
  font-size: 17px;
  color: var(--ink-soft);
  display: flex;
  align-items: center;
  gap: 10px;
}
.intro-hint::before, .intro-hint::after {
  content: "";
  width: 28px;
  height: 1px;
  background: var(--gold-soft);
}
.opening .intro-top { opacity: 0; transform: translateY(-16px); }
.opening .intro-hint { opacity: 0; transform: translateY(16px); }

.env-float { animation: envFloat 4.5s ease-in-out infinite; }
.opening .env-float { animation: none; }
@keyframes envFloat {
  0%, 100% { transform: translateY(0) rotate(-0.6deg); }
  50%      { transform: translateY(-8px) rotate(0.6deg); }
}

.env-move { transition: transform 1.3s cubic-bezier(.45, 0, .2, 1); }
.letter-out .env-move { transform: translateY(134px); }

.env {
  position: relative;
  width: var(--w);
  height: var(--h);
  cursor: pointer;
  -webkit-perspective: 1200px;
  perspective: 1200px;
  -webkit-tap-highlight-color: transparent;
}
.env:focus-visible { outline: 2px solid var(--gold); outline-offset: 8px; }

.env-back {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  border-radius: 6px;
  background: linear-gradient(180deg, #CDB491 0%, #DCC6A6 100%);
  box-shadow: 0 26px 36px -8px rgba(100, 70, 35, .32);
  z-index: 1;
}

/* Zarfın içindeki davetiye kartı */
.letter-clip {
  position: absolute;
  left: 6%;
  right: 6%;
  bottom: 0;
  height: 600px;
  overflow: hidden;
  z-index: 2;
  pointer-events: none;
}
.letter {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -380px;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 -4px 16px rgba(90, 60, 30, .18);
  transition: transform 1.35s cubic-bezier(.42, 0, .18, 1);
}
.letter-img {
  display: block;
  width: 100%;
  height: auto;
}
.letter-out .letter {
  transform: translateY(-310px);
}

/* Ön cep */
.env-front {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 4;
  pointer-events: none;
}

/* Kapak */
.env-flap {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 60%;
  -webkit-transform-origin: 50% 0;
  transform-origin: 50% 0;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
  z-index: 5;
  transition: transform .9s cubic-bezier(.5, 0, .25, 1), z-index 0s linear .45s;
}
.env-flap svg { width: 100%; height: 100%; display: block; }
.flap-open .env-flap {
  -webkit-transform: rotateX(180deg);
  transform: rotateX(180deg);
  z-index: 1;
}

/* Mum mühür */
.env-seal {
  position: absolute;
  left: 50%;
  top: 56%;
  width: 64px;
  height: 64px;
  transform: translate(-50%, -50%);
  z-index: 6;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 35% 30%, #E0BF82 0%, #B88E50 45%, #8A652F 85%, #6C4D22 100%);
  box-shadow: 0 6px 14px -3px rgba(90, 60, 25, .55),
              inset 0 2px 3px rgba(255, 255, 255, .45),
              inset 0 -3px 5px rgba(0, 0, 0, .35);
  transition: transform .5s cubic-bezier(.6, -0.3, .7, 0), opacity .45s ease;
  animation: sealPulse 2.8s ease-in-out infinite;
}
.env-seal::before {
  content: "";
  position: absolute;
  top: 12%;
  right: 12%;
  bottom: 12%;
  left: 12%;
  border-radius: 50%;
  border: 1px dashed rgba(255, 240, 210, .55);
}
.env-seal span {
  font-family: "Great Vibes", cursive;
  font-size: 24px;
  color: #FFF4DE;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .45);
}
.env:hover .env-seal { transform: translate(-50%, -50%) scale(1.07) rotate(-5deg); }
.opening .env-seal {
  transform: translate(-50%, -50%) scale(1.35) rotate(15deg) !important;
  opacity: 0;
  animation: none;
}
@keyframes sealPulse {
  0%, 100% { box-shadow: 0 6px 14px -3px rgba(90,60,25,.55), inset 0 2px 3px rgba(255,255,255,.45), inset 0 -3px 5px rgba(0,0,0,.35), 0 0 0 0 rgba(200,160,100,.5); }
  50%      { box-shadow: 0 6px 14px -3px rgba(90,60,25,.55), inset 0 2px 3px rgba(255,255,255,.45), inset 0 -3px 5px rgba(0,0,0,.35), 0 0 0 14px rgba(200,160,100,0); }
}

.finish .env-back,
.finish .env-front { transform: translateY(70px); opacity: 0; transition: transform 1s ease, opacity .9s ease; }
.finish .env-flap  { opacity: 0; transition: opacity .6s ease; }
.finish .letter-clip { overflow: visible; }
.finish .letter {
  transform: translateY(-340px) scale(1.08);
  opacity: 0;
  transition: transform 1.1s ease, opacity 1s ease .2s;
}

/* ===================== SAYFA & DAVETİYE KARTI ===================== */
.page {
  position: relative;
  z-index: 2;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 42px 16px 44px;
}

.card {
  position: relative;
  width: 100%;
  max-width: 500px;
  border-radius: 6px;
  overflow: hidden;
  background: #F3E9DE;
  box-shadow:
    0 38px 75px -26px rgba(92, 64, 32, .42),
    0 14px 28px -12px rgba(92, 64, 32, .20),
    0 0 0 1px rgba(184, 147, 90, .28);
  opacity: 0;
  transform: translateY(28px) scale(.96);
  transition: opacity 1.15s ease, transform 1.35s cubic-bezier(.2, .7, .2, 1);
  -webkit-user-select: none;
  user-select: none;
}
.card.revealed {
  opacity: 1;
  transform: none;
}

.card-base {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

/* İpek saten üzerinde hafif altın ışıltı geçişi */
.card-shimmer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: linear-gradient(
    115deg,
    transparent 35%,
    rgba(255, 250, 240, 0.24) 50%,
    transparent 65%
  );
  background-size: 260% 100%;
  animation: cardSheen 9s ease-in-out infinite;
  pointer-events: none;
  z-index: 2;
}
@keyframes cardSheen {
  0%, 100% { background-position: 180% 0; }
  50%      { background-position: -60% 0; }
}

/* ===================== HAREKETLİ ÇİÇEK KATMANLARI ===================== */
.floral-group {
  position: absolute;
  pointer-events: none;
  z-index: 3;
}

/* Sol üst çiçek grubu (305x310 / 682x1024) */
.floral-group-tl {
  top: 0;
  left: 0;
  width: 44.7214%;
  height: 30.2734%;
  transform-origin: 0% 0%;
}

/* Sağ alt çiçek grubu (300x380 / 682x1024) */
.floral-group-br {
  bottom: 0;
  right: 0;
  width: 43.9883%;
  height: 37.1094%;
  transform-origin: 100% 100%;
}

.fl-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: block;
  will-change: transform;
}

/* Sol Üst: Üst kemer boyunca uzanan yaprak dalı */
.fl-tl-branch-top {
  -webkit-transform-origin: 34.4% 14.5%;
  transform-origin: 34.4% 14.5%;
  animation: swayBranchTop 4.4s ease-in-out infinite alternate;
}
/* Sol Üst: Ortadaki büyük yaprak */
.fl-tl-leaf-mid {
  -webkit-transform-origin: 22.3% 30.6%;
  transform-origin: 22.3% 30.6%;
  animation: swayLeafMid 3.6s ease-in-out infinite alternate;
}
/* Sol Üst: Aşağı sarkan yaprak dalı */
.fl-tl-branch-down {
  -webkit-transform-origin: 7.2% 56.5%;
  transform-origin: 7.2% 56.5%;
  animation: swayBranchDown 4.9s ease-in-out infinite alternate;
}
/* Sol Üst: Ana büyük manolya çiçeği */
.fl-tl-flower-1 {
  -webkit-transform-origin: 28.9% 14.5%;
  transform-origin: 28.9% 14.5%;
  animation: bloomFlower1 5.2s ease-in-out infinite alternate;
}
/* Sol Üst: İkinci manolya çiçeği */
.fl-tl-flower-2 {
  -webkit-transform-origin: 9.2% 49.7%;
  transform-origin: 9.2% 49.7%;
  animation: bloomFlower2 4.3s ease-in-out infinite alternate;
}

/* Sağ Alt: Yukarı uzanan yaprak dalı */
.fl-br-branch-up {
  -webkit-transform-origin: 81.0% 50.3%;
  transform-origin: 81.0% 50.3%;
  animation: swayBrUp 4.6s ease-in-out infinite alternate;
}
/* Sağ Alt: Sola uzanan alt yaprak dalı */
.fl-br-branch-left {
  -webkit-transform-origin: 67.7% 73.9%;
  transform-origin: 67.7% 73.9%;
  animation: swayBrLeft 5.1s ease-in-out infinite alternate;
}
/* Sağ Alt: Büyük manolya çiçeği */
.fl-br-flower-1 {
  -webkit-transform-origin: 74.3% 61.6%;
  transform-origin: 74.3% 61.6%;
  animation: bloomBrFlower 5.5s ease-in-out infinite alternate;
}

@keyframes swayBranchTop {
  0%   { transform: rotate(-4.2deg) scale(1.01); }
  100% { transform: rotate(4.2deg)  scale(1.03); }
}
@keyframes swayLeafMid {
  0%   { transform: rotate(4.0deg)  scale(1.01); }
  100% { transform: rotate(-4.8deg) scale(1.03); }
}
@keyframes swayBranchDown {
  0%   { transform: translateX(-1px) rotate(-4.5deg) scale(1.02); }
  100% { transform: translateX(-1px) rotate(4.5deg)  scale(1.04); }
}
@keyframes bloomFlower1 {
  0%   { transform: translate(-1px, -1px) rotate(-2.6deg) scale(1.03); }
  100% { transform: translate(-1px, -1px) rotate(2.8deg)  scale(1.075); }
}
@keyframes bloomFlower2 {
  0%   { transform: translateX(-1px) rotate(2.8deg)  scale(1.065); }
  100% { transform: translateX(-1px) rotate(-2.8deg) scale(1.025); }
}
@keyframes swayBrUp {
  0%   { transform: translateX(1px) rotate(-4.4deg) scale(1.02); }
  100% { transform: translateX(1px) rotate(4.0deg)  scale(1.04); }
}
@keyframes swayBrLeft {
  0%   { transform: translateY(1px) rotate(4.2deg)  scale(1.02); }
  100% { transform: translateY(1px) rotate(-4.2deg) scale(1.04); }
}
@keyframes bloomBrFlower {
  0%   { transform: translate(1px, 1px) rotate(-2.8deg) scale(1.03); }
  100% { transform: translate(1px, 1px) rotate(3.0deg)  scale(1.075); }
}

/* ===================== ALT BÖLÜM ===================== */
.extras {
  width: 100%;
  max-width: 500px;
  margin-top: 44px;
  text-align: center;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 1s ease, transform 1s ease;
}

.ico { width: 22px; height: 22px; color: var(--gold); flex-shrink: 0; }
.ico-sm { width: 17px; height: 17px; }

.countdown {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 28px;
}
.countdown div { display: flex; flex-direction: column; min-width: 54px; }
.countdown b {
  font-family: "Cormorant Garamond", serif;
  font-weight: 500;
  font-size: 34px;
  line-height: 1;
  color: var(--ink);
}
.countdown small {
  margin-top: 6px;
  font-family: "Cinzel", serif;
  font-size: 10px;
  letter-spacing: .25em;
  text-transform: uppercase;
  color: var(--gold-deep);
}
.countdown i { width: 1px; height: 32px; background: var(--gold-soft); }

.actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 13px 22px;
  border-radius: 999px;
  font-family: "Cinzel", serif;
  font-size: 12px;
  letter-spacing: .18em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: all .35s ease;
}
.btn-gold {
  color: #FFF9EF;
  border: none;
  background: linear-gradient(135deg, #C9A462 0%, #A9834A 100%);
  box-shadow: 0 10px 22px -10px rgba(140, 100, 50, .7);
}
.btn-gold .ico { color: #FFF9EF; }
.btn-gold .ico circle { fill: #B48C50; }
.btn-line {
  color: var(--ink);
  background: rgba(255, 253, 249, .75);
  border: 1px solid var(--gold-soft);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 14px 26px -12px rgba(140, 100, 50, .6); }

.signature {
  margin-top: 36px;
  font-family: "Great Vibes", cursive;
  font-size: 32px;
  color: var(--gold);
}

.replay {
  margin-top: 18px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 16px;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--gold-soft);
}
.replay:hover { color: var(--ink); }

@media (max-width: 420px) {
  .page { padding: 24px 12px 36px; }
  .countdown { gap: 10px; }
  .btn { padding: 11px 18px; font-size: 11px; }
}

/* ===================== RESİM MODU (?resim) ===================== */
.export .extras, .export #petals, .export .intro { display: none !important; }
.export .page { min-height: 0; padding: 0; }
.export .card { width: 682px; max-width: none; border-radius: 0; box-shadow: none; opacity: 1 !important; transform: none !important; }
.export *, .export *::before, .export *::after { transition: none !important; animation: none !important; }
