/* ==========================================================
   HATIRA DEFTERİ — yalnızca Nikah bölümünün sonunda
   Kapak CSS perspective/rotateY ile açılır; 3B kütüphane yok.
   ========================================================== */

.defter {
  margin-top: 64px;
  text-align: center;
}

.defter__ust {
  display: block;
  font-family: var(--yazi-serif);
  font-size: 11.5px;
  letter-spacing: .4em;
  text-indent: .4em;
  text-transform: uppercase;
  color: var(--d-altin);
}

/* Yalnızca KAPAK 3B döner (kendi perspective() işleviyle). Sayfa ve kapak aynı 3B
   sahneyi paylaşmaz; böylece tarayıcı derinlik sıralaması yapmaz ve kapak, z-index
   sayesinde her koşulda sayfanın üstünde çizilir (GPU'lu tarayıcılarda kapanırken
   sayfanın kapağın üstüne binmesi hatasının kök çözümü). */
.defter__sahne {
  margin-top: 26px;
}

.defter__kitap {
  position: relative;
  width: min(100%, 340px);
  height: 470px;
  margin: 0 auto;
  transform: scale(.84);
  transition: transform 1.3s cubic-bezier(.3, .1, .2, 1);
}
.defter.acik .defter__kitap { transform: scale(1); }

/* Arka kapak: sayfalar kapaktan biraz küçüktür. Böylece ön kapağın kenarından
   krem sayfa sızıp açık renkli çizgi oluşturamaz; sızan olursa bordo görünür. */
.defter__kitap::before {
  content: "";
  position: absolute;
  inset: 0 -9px 0 0;
  border-radius: 4px 13px 13px 4px;
  background: linear-gradient(135deg, #4b1f2c, #3a1722);
  box-shadow: 0 24px 50px rgba(15, 8, 12, .5);
}

/* ---------- İç sayfa ---------- */

.defter__sayfa {
  position: absolute;
  inset: 4px -1px 4px 5px;          /* sağda sayfa kenarları kapaktan hafifçe taşar */
  padding: 30px 24px 22px 30px;
  border-radius: 4px 12px 12px 4px;
  text-align: left;
  color: var(--d-murekkep);
  background:
    linear-gradient(to right, rgba(74, 47, 51, .22), transparent 7%),          /* cilt gölgesi */
    linear-gradient(to bottom, #fbf2e2, #f3e3ca);
  box-shadow: 2px 0 0 #efe0c8, 4px 0 0 #e2d0b4, 6px 0 0 #efe0c8;            /* sayfa kenarları */
  overflow: hidden;
}

.defter__sayfa-ic {
  height: 100%;
  display: flex;
  flex-direction: column;
  visibility: hidden;
  opacity: 0;
  transition: opacity .6s ease .7s, visibility 0s linear 1.3s;
}
.defter.acik .defter__sayfa-ic {
  visibility: visible;
  opacity: 1;
  transition: opacity .6s ease .7s, visibility 0s;
}

.defter__sayfa-baslik {
  margin: 0 0 18px;
  text-align: center;
  font-family: var(--yazi-el);
  font-size: 34px;
  line-height: 1.1;
  color: var(--d-bakir-koyu);
  -webkit-text-stroke: .35px currentColor;
}

.defter__form { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.defter__form .alan + .alan { margin-top: 20px; }
.defter__form .alan--mesaj { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.defter__form textarea {
  flex: 1;
  min-height: 96px;
  resize: none;
  border-bottom: 0 !important;
  line-height: 32px;
  padding-top: 0;
  font-style: italic;
  /* satır çizgileri yalnızca mesaj alanında, yazıyla birlikte kayar */
  background-image: repeating-linear-gradient(to bottom, transparent 0 31px, rgba(143, 85, 53, .22) 31px 32px);
  background-attachment: local;
}
.defter__form .form-hata { margin-top: 4px; min-height: 1.2em; font-size: 14.5px; }
.defter__alt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 6px;
}
.defter__alt .buton { margin-top: 0; padding: 11px 20px 10px; font-size: 12px; letter-spacing: .18em; text-indent: .18em; }
.defter__alt .bag { font-size: 14.5px; color: rgba(74, 47, 51, .75); }

.defter__onay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: linear-gradient(to bottom, #fbf2e2, #f3e3ca);
  animation: etkinlik-gelis .5s ease both;
}
.defter__onay p {
  margin: 0;
  font-family: var(--yazi-el);
  font-size: 36px;
  color: var(--d-bakir-koyu);
}

/* ---------- Kapak ---------- */

.defter__kapak {
  position: absolute;
  inset: 0;
  z-index: 2;
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  transform-origin: left center;
  transform-style: preserve-3d;                 /* yalnızca kapağın ön/iç yüzü için */
  transform: perspective(1500px) rotateY(0deg);
  /* kapanış: önce görünür ol, sonra yavaşça kapan */
  transition: transform 1.7s cubic-bezier(.3, .1, .2, 1), opacity .35s ease 0s;
  -webkit-tap-highlight-color: transparent;
}
.defter.acik .defter__kapak {
  transform: perspective(1500px) rotateY(-162deg);
  opacity: 0;                                   /* dar ekranda açılan kapak ekran dışına taşmasın */
  pointer-events: none;
  transition: transform 1.5s cubic-bezier(.3, .1, .2, 1), opacity .5s ease .85s;
}
.defter__kapak:focus-visible { outline: 2px solid var(--d-altin); outline-offset: 6px; }

.defter__kapak-on,
.defter__kapak-ic {
  position: absolute;
  inset: 0;
  border-radius: 4px 12px 12px 4px;
  -webkit-backface-visibility: hidden;
  backface-visibility: hidden;
}

.defter__kapak-on {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(to right, rgba(0, 0, 0, .38) 0, rgba(0, 0, 0, .05) 5%, rgba(255, 255, 255, .07) 7%, transparent 10%),   /* sırt */
    radial-gradient(ellipse 80% 60% at 40% 30%, rgba(255, 210, 170, .13), transparent 70%),
    linear-gradient(135deg, #6a2f3c 0%, #4b1f2c 55%, #3a1722 100%);
  box-shadow: 0 24px 50px rgba(15, 8, 12, .55), 0 0 0 1px rgba(0, 0, 0, .25) inset;
}
.defter__kapak-on::before {                     /* altın çift çerçeve */
  content: "";
  position: absolute;
  inset: 18px 16px 18px 28px;
  border: 1px solid rgba(217, 165, 102, .75);
  border-radius: 4px;
  box-shadow: 0 0 0 4px #4b1f2c, 0 0 0 5px rgba(217, 165, 102, .4);
}

.defter__kapak-isim {
  position: relative;
  padding-left: 12px;
  font-family: var(--yazi-el);
  font-size: 44px;
  line-height: 1.15;
  color: #e7bd85;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .45);
}
.defter__kapak-isim em { font-style: normal; font-size: .7em; display: block; line-height: .9; }

.defter__kapak-sus {
  position: relative;
  width: 64px;
  height: 1px;
  margin: 18px 0 16px 12px;
  background: linear-gradient(to right, transparent, #d9a566, transparent);
}

.defter__kapak-ad {
  position: relative;
  padding-left: 12px;
  font-family: var(--yazi-serif);
  font-size: 13px;
  letter-spacing: .42em;
  text-indent: .42em;
  text-transform: uppercase;
  color: #d9a566;
}

.defter__kapak-ic {                             /* kapağın iç yüzü */
  transform: rotateY(180deg);
  background:
    linear-gradient(to left, rgba(74, 47, 51, .25), transparent 8%),
    linear-gradient(to bottom, #f7e9d3, #ecd9bb);
}

/* ---------- Alt yazılar ---------- */

.defter__ipucu,
.defter__sonuc {
  margin: 14px auto 0;
  max-width: 320px;
  font-family: var(--yazi-serif);
  font-style: italic;
  font-size: 17px;
  line-height: 1.5;
  color: rgba(255, 233, 200, .8);
  transition: opacity .5s ease;
}
.defter.acik .defter__ipucu { opacity: 0; }
.defter__sonuc {
  font-size: 19px;
  color: var(--d-altin);
  animation: etkinlik-gelis 1s ease both;
}

/* ---------- Geniş ekran: açılan kapak solda görünür kalır ---------- */

@media (min-width: 860px) {
  .defter { margin-top: 84px; }
  .defter__kitap { width: 360px; height: 490px; }
  .defter.acik .defter__kitap { transform: translateX(180px) scale(1); }
  .defter.acik .defter__kapak { opacity: 1; transform: perspective(1500px) rotateY(-172deg); }
}

@media (prefers-reduced-motion: reduce) {
  .defter__kitap, .defter__kapak, .defter__sayfa-ic { transition-duration: .01s !important; transition-delay: 0s !important; }
}
