/* Solmayan Bahçe — çevrimiçi kitap */

@font-face {
  font-family: "Playfair Kitap";
  src: url("../fonts/PlayfairDisplay-Regular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #4b3a2b;
  --ink-soft: rgba(75, 58, 43, .62);
  --ink-faint: rgba(75, 58, 43, .14);
  --desk: #eee2c8;
  --desk-deep: #dccaa6;
  --page: #f9eed8;
  --accent: #d97a2b;
  --serif: "Playfair Kitap", Georgia, "Times New Roman", serif;
  --bar-h: 52px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  height: 100vh;
  height: 100dvh;
  font-family: var(--serif);
  color: var(--ink);
  background: var(--desk);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "locl" 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

button { font: inherit; color: inherit; }
img { -webkit-user-drag: none; user-select: none; }

/* ---------- Zemin: krem kâğıt, lif dokusu, vinyet ---------- */
.desk {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-color: var(--desk);
  background-image:
    radial-gradient(ellipse 75% 70% at 50% 46%, rgba(255, 248, 232, .75) 0%, rgba(255, 248, 232, 0) 62%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .36 0 0 0 0 .26 0 0 0 0 .15 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='900'%3E%3Cfilter id='m'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.006 .012' numOctaves='4' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 .55 0 0 0 0 .4 0 0 0 0 .22 0 0 0 .1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23m)'/%3E%3C/svg%3E");
  background-size: auto, 300px 300px, 900px 900px;
}
.desk::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 120% 95% at 50% 45%, rgba(0, 0, 0, 0) 58%, rgba(92, 62, 30, .2) 100%);
  pointer-events: none;
}

/* ---------- Başlık ---------- */
.masthead {
  grid-row: 1;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 14px;
  padding: 20px 24px 6px;
  text-align: center;
}
.masthead { position: relative; }
.home-link {
  position: absolute;
  left: 28px;
  top: 50%;
  transform: translateY(-30%);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  font-size: 13px;
  letter-spacing: .02em;
  color: var(--ink-soft);
  text-decoration: none;
  transition: color .2s, background-color .2s;
}
.home-link svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.home-link:hover { color: var(--ink); background: rgba(120, 90, 55, .08); }
.masthead__title {
  margin: 0;
  font-weight: 400;
  font-size: 19px;
  letter-spacing: .02em;
  color: var(--ink);
}
.masthead__by {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 11px;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.masthead__by::before {
  content: "";
  width: 28px;
  height: 1px;
  background: currentColor;
  opacity: .5;
}

/* ---------- Telefonu yan çevir ipucu ---------- */
.rotate-hint {
  grid-row: 2;
  display: none;
  margin: 2px auto 0;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  letter-spacing: .02em;
  color: var(--ink-soft);
}
.rotate-hint svg {
  width: 16px; height: 16px;
  fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round;
}
@media (orientation: portrait) and (max-width: 820px) {
  .rotate-hint { display: inline-flex; justify-self: center; }
}

/* ---------- Sahne ve kitap ---------- */
.stage {
  grid-row: 3;
  position: relative;
  overflow: hidden;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: 14px 40px 18px;
}
.shift {
  position: relative;
  transition: transform .7s cubic-bezier(.33, .9, .3, 1);
  will-change: transform;
}
.book { position: relative; }
.book .stf__parent { touch-action: pan-y; }

/* kitabın masaya düşen gölgesi */
.bed {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  border-radius: 2px;
  pointer-events: none;
  opacity: 0;
  box-shadow:
    0 1px 1px rgba(70, 45, 20, .12),
    0 6px 12px -4px rgba(70, 45, 20, .22),
    0 26px 48px -16px rgba(70, 45, 20, .42),
    0 50px 90px -40px rgba(70, 45, 20, .35);
  transition: left .7s cubic-bezier(.33, .9, .3, 1), width .7s cubic-bezier(.33, .9, .3, 1), opacity .6s ease;
}
.is-ready .bed { opacity: 1; }

.page {
  background: var(--page);
  overflow: hidden;
}
.page img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity .35s ease;
  pointer-events: none;
}
.page.is-loaded img { opacity: 1; }
/* yüklenmemiş sayfada ince nefes alan iz */
.page::before {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 26px; height: 26px;
  margin: -13px 0 0 -13px;
  border-radius: 50%;
  border: 1.5px solid rgba(75, 58, 43, .18);
  border-top-color: rgba(75, 58, 43, .5);
  animation: spin 1s linear infinite;
}
.page.is-loaded::before { display: none; }

/* cilt yeri: sayfanın iç kenarında yumuşak kıvrım gölgesi */
.page::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 9%;
  pointer-events: none;
  opacity: 0;
  transition: opacity .3s;
}
.is-spread .page.--left:not(.--hard)::after {
  right: 0;
  opacity: 1;
  background: linear-gradient(to left, rgba(40, 25, 10, .26) 0%, rgba(40, 25, 10, .1) 22%, rgba(40, 25, 10, .03) 55%, rgba(40, 25, 10, 0) 100%);
}
.is-spread .page.--right:not(.--hard)::after {
  left: 0;
  opacity: 1;
  background: linear-gradient(to right, rgba(40, 25, 10, .24) 0%, rgba(255, 250, 238, .08) 14%, rgba(40, 25, 10, .03) 45%, rgba(40, 25, 10, 0) 100%);
}

/* ---------- Yükleniyor ---------- */
.loader {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  font-size: 14px;
  letter-spacing: .04em;
  color: var(--ink-soft);
  transition: opacity .6s ease, visibility .6s;
}
.is-ready .loader { opacity: 0; visibility: hidden; }
.loader svg { width: 64px; height: 64px; overflow: visible; }
.loader__stem {
  fill: none; stroke: #7a8636; stroke-width: 2; stroke-linecap: round;
  stroke-dasharray: 50; stroke-dashoffset: 50;
  animation: grow 1.6s cubic-bezier(.5, 0, .2, 1) infinite alternate;
}
.loader__leaf { fill: #8c9a42; transform-origin: 39px 56px; transform: scale(0); animation: pop 1.6s .35s cubic-bezier(.5, 0, .2, 1) infinite alternate; }
.loader__leaf--r { transform-origin: 41px 47px; animation-delay: .55s; }
.loader__bloom { fill: var(--accent); transform-origin: 40px 23px; transform: scale(0); animation: pop 1.6s .8s cubic-bezier(.5, 0, .2, 1) infinite alternate; opacity: .9; }
@keyframes grow { to { stroke-dashoffset: 0; } }
@keyframes pop { 0%, 20% { transform: scale(0); } 100% { transform: scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Alt çubuk ---------- */
.bar {
  grid-row: 4;
  justify-self: center;
  display: flex;
  align-items: center;
  gap: 6px;
  height: var(--bar-h);
  margin: 0 16px max(18px, env(safe-area-inset-bottom));
  padding: 0 8px 0 10px;
  border-radius: 999px;
  background: rgba(253, 248, 238, .74);
  border: 1px solid rgba(120, 90, 55, .14);
  box-shadow: 0 1px 0 rgba(255, 255, 255, .7) inset, 0 10px 30px -14px rgba(80, 52, 22, .35);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  backdrop-filter: blur(10px) saturate(1.1);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity .6s .2s ease, transform .6s .2s ease;
}
.is-ready .bar { opacity: 1; transform: none; }

.bar__chapters, .bar__nav, .bar__tools { display: flex; align-items: center; }
.bar__chapters { gap: 2px; padding-right: 8px; margin-right: 4px; border-right: 1px solid var(--ink-faint); }
.bar__tools { gap: 2px; padding-left: 8px; margin-left: 4px; border-left: 1px solid var(--ink-faint); }

.chap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-size: 14px;
  letter-spacing: .01em;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color .25s, background-color .25s;
}
.chap i {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--c);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 0%, transparent);
  transition: box-shadow .3s;
}
.chap:hover { color: var(--c); background: color-mix(in srgb, var(--c) 7%, transparent); }
.chap.is-active { color: var(--c); }
.chap.is-active i { box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 22%, transparent); }

.ico {
  display: grid;
  place-items: center;
  width: 38px; height: 38px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background-color .2s, opacity .2s;
}
.ico svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.ico:hover { background: rgba(120, 90, 55, .1); }
.ico:active { background: rgba(120, 90, 55, .18); }
.ico:disabled { opacity: .28; cursor: default; background: transparent; }
:focus-visible { outline: 2px solid color-mix(in srgb, var(--accent) 70%, transparent); outline-offset: 2px; }

.counter {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 92px;
  padding: 0 4px;
}
.counter output {
  font-size: 14px;
  letter-spacing: .04em;
  white-space: nowrap;
}
.counter .sep { font-family: Georgia, "Times New Roman", serif; padding: 0 1px; }
.counter .sep--slash { padding: 0 6px; opacity: .45; }
.progress {
  position: relative;
  width: 64px; height: 2px;
  border-radius: 2px;
  background: var(--ink-faint);
  overflow: hidden;
}
.progress span {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0;
  background: var(--pc, var(--accent));
  transition: width .5s ease, background-color .5s ease;
}

#fsBtn .fs-off { display: none; }
.is-fullscreen #fsBtn .fs-on { display: none; }
.is-fullscreen #fsBtn .fs-off { display: block; }
.no-fullscreen #fsBtn { display: none; }

/* ---------- Yakınlaştırma katmanı ---------- */
.zoom {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(38, 28, 19, .94);
  animation: fade .3s ease;
}
.zoom[hidden] { display: none; }
.zoom__viewport {
  position: absolute;
  inset: 0;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
}
.zoom__viewport.is-dragging { cursor: grabbing; }
.zoom__canvas {
  position: absolute;
  left: 0; top: 0;
  display: flex;
  transform-origin: 0 0;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .6);
}
.zoom__canvas img { display: block; height: 100%; width: auto; pointer-events: none; }
.zoom__ctrl {
  position: absolute;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  height: var(--bar-h);
  padding: 0 8px;
  border-radius: 999px;
  background: rgba(253, 248, 238, .92);
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, .5);
}
.zoom__ctrl output { min-width: 54px; text-align: center; font-size: 13px; font-family: Georgia, "Times New Roman", serif; }
.zoom__sep { width: 1px; height: 22px; margin: 0 6px; background: var(--ink-faint); }
.zoom__hint {
  position: absolute;
  top: max(14px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 7px 16px;
  border-radius: 999px;
  background: rgba(38, 28, 19, .72);
  white-space: nowrap;
  font-size: 12px;
  letter-spacing: .03em;
  color: rgba(253, 248, 238, .78);
  pointer-events: none;
  transition: opacity .5s;
}
@keyframes fade { from { opacity: 0; } }

/* ---------- Dar ekran ---------- */
@media (max-width: 760px) {
  :root { --bar-h: 46px; }
  .masthead { flex-direction: column; align-items: center; gap: 4px; padding-top: 18px; }
  .masthead__title { font-size: 18px; }
  .masthead__by { font-size: 10px; }
  .masthead__by::before { display: none; }
  .home-link { left: 6px; top: 12px; transform: none; padding: 8px; }
  .home-link span { display: none; }
  .home-link svg { width: 20px; height: 20px; }
  .stage { padding: 12px 12px 14px; }
  .bar {
    flex-wrap: wrap;
    justify-content: center;
    height: auto;
    border-radius: 22px;
    padding: 4px 6px;
    row-gap: 0;
  }
  .bar__chapters { order: 2; width: 100%; justify-content: center; border-right: 0; border-top: 1px solid var(--ink-faint); padding: 2px 0 0; margin: 2px 0 0; }
  .bar__tools { margin-left: 2px; padding-left: 4px; }
  .chap { height: 34px; font-size: 13px; padding: 0 10px; }
  .counter { min-width: 78px; }
}
/* yatay telefon: başlığı küçült, kitaba yer aç */
@media (max-height: 500px) and (orientation: landscape) {
  :root { --bar-h: 42px; }
  .masthead { display: none; }
  .stage { padding: 8px 16px 6px; }
  .bar { margin-bottom: max(6px, env(safe-area-inset-bottom)); }
  .chap { height: 32px; font-size: 13px; }
  .ico { width: 34px; height: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  .shift, .bed { transition: none; }
  .loader * { animation-duration: 0s !important; }
}
