:root {
  --paper: #ebe2d2;
  --paper-deep: #e3d8c5;
  --ink: #2e2419;
  --ink-soft: #5c4b39;
  --ink-faint: #9a8870;
  --rule: #c7b79d;
  --accent: #7a2e22;

  --measure: 34rem;
  --gutter: clamp(1.25rem, 5vw, 3rem);
  --font: "EB Garamond", "Garamond", "Iowan Old Style", Georgia, serif;
  --font-display: "IM Fell French Canon", "EB Garamond", Georgia, serif;
  --font-signature: "Italianno", "EB Garamond", cursive;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-kerning: normal;
  font-variant-ligatures: common-ligatures;
  /* telefon yan çevrilince Safari yazıları kendiliğinden büyütmesin (defter çizgilerinden kayardı) */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body { overflow: hidden; }

/* Kâğıt dokusu */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  opacity: 0.35;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 .45  0 0 0 0 .36  0 0 0 0 .25  0 0 0 .22 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

/* Kenarlarda hafif gölge: kitap sırtı hissi */
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(90, 65, 35, 0.12) 100%);
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
  text-decoration-color: var(--rule);
  transition: text-decoration-color 0.2s;
}
a:hover { text-decoration-color: var(--ink); }

::selection { background: rgba(122, 46, 34, 0.18); }

/* ---- Görünümler: raf / kitap ---- */
body[data-view="shelf"] .book,
body[data-view="book"] .shelf-view { display: none; }
body[data-view="book"] .book { animation: open-book 0.45s ease both; }
body[data-view="shelf"] .shelf-view { animation: fade-in 0.4s ease both; }
@keyframes open-book {
  from { opacity: 0; transform: scale(0.985); }
  to { opacity: 1; transform: none; }
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ---- Kitaplık (raf) ---- */
.shelf-view {
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  padding: 0 var(--gutter);
}
.library {
  max-width: 52rem;
  margin: 0 auto;
  padding: clamp(3rem, 10vh, 6rem) 0 3rem;
  text-align: center;
}
.library__kicker {
  margin: 0 0 1.25rem;
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.28em;
  padding-left: 0.28em;
  font-size: 0.78rem;
  color: var(--ink-soft);
}
.library__name {
  margin: 0;
  font-family: var(--font-signature);
  font-weight: 400;
  font-size: clamp(3.4rem, 13vw, 5.2rem);
  line-height: 1;
}
.library__desc {
  margin: 0.9rem 0 0;
  font-style: italic;
  color: var(--ink-soft);
  font-size: 1.1rem;
}

.shelf {
  list-style: none;
  margin: 1rem 0 0;
  padding: 0 0 1.25rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 2.75rem clamp(1.25rem, 5vw, 3rem);
  /* raf tahtası */
  background:
    linear-gradient(var(--rule), var(--rule)) bottom / 100% 1px no-repeat;
}
.shelf__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.8rem;
  width: clamp(8.5rem, 38vw, 11.5rem);
}
.shelf__link {
  display: block;
  width: 100%;
  text-decoration: none;
  color: inherit;
}
.shelf__caption {
  font-size: 0.9rem;
  font-style: italic;
  color: var(--ink-soft);
}

/* Kitap kapağı (bez cilt) */
.spine-cover {
  position: relative;
  container-type: inline-size;
  display: block;
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 2px 5px 5px 2px;
  background:
    linear-gradient(90deg, rgba(0,0,0,.28) 0, rgba(0,0,0,.08) 5%, rgba(255,255,255,.06) 7%, transparent 12%),
    linear-gradient(160deg, rgba(255,255,255,.07), transparent 55%, rgba(0,0,0,.14)),
    var(--cloth);
  box-shadow:
    0 1px 0 rgba(0,0,0,.08),
    0 10px 18px -8px rgba(40, 25, 10, .45),
    inset 0 0 0 1px rgba(0,0,0,.15);
  color: #eadfc8;
  transition: transform .35s ease, box-shadow .35s ease;
}
.spine-cover::after { /* bez dokusu */
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: .35;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.2' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.spine-cover__frame {
  position: absolute;
  inset: 9% 10% 8% 15%;
  border: 1px solid rgba(234, 223, 200, .45);
  outline: 1px solid rgba(234, 223, 200, .2);
  outline-offset: 3px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16% 6% 10%;
  text-align: center;
}
.spine-cover__title {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: .14em;
  padding-left: .14em;
  font-size: min(1.3rem, calc(74cqi / var(--chars, 3)));
  line-height: 1.15;
}
.spine-cover__sub {
  margin-top: .45rem;
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(.78rem, 3vw, .92rem);
  opacity: .85;
  line-height: 1.2;
}
.spine-cover__orn { margin-top: auto; font-size: .6rem; opacity: .6; }
.spine-cover__author {
  margin-top: .5rem;
  font-family: var(--font-signature);
  font-size: clamp(1.05rem, 4vw, 1.3rem);
  line-height: 1;
  opacity: .9;
}
.shelf__link:hover .spine-cover,
.shelf__link:focus-visible .spine-cover {
  transform: translateY(-8px) rotate(-.6deg);
  box-shadow:
    0 1px 0 rgba(0,0,0,.08),
    0 22px 26px -10px rgba(40, 25, 10, .5),
    inset 0 0 0 1px rgba(0,0,0,.15);
}
.shelf__item--soon .spine-cover {
  opacity: .32;
  filter: grayscale(.5);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.15);
}
.library__hint {
  margin: 1.5rem 0 0;
  font-size: .9rem;
  font-style: italic;
  color: var(--ink-faint);
}
.cover__back {
  margin: 1.25rem 0 0;
  font-size: .95rem;
  color: var(--ink-soft);
}
.cover__back a { text-decoration: none; }
.chapter__body strong { font-weight: 600; }

/* ---- Kitap: yana kayan sayfalar ---- */
.book {
  display: flex;
  height: 100vh;
  height: 100dvh;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.book::-webkit-scrollbar { display: none; }

.page {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  flex-direction: column;
  padding: 0 var(--gutter);
  padding-bottom: env(safe-area-inset-bottom);
  -webkit-overflow-scrolling: touch;
}

.page__inner {
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  flex: 1 0 auto;
  padding: clamp(2.5rem, 7vh, 4.5rem) 0 3rem;
}

/* Üst başlık (kitaplardaki sayfa başı) */
.running-head {
  width: 100%;
  max-width: 44rem;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 0 0.75rem;
  border-bottom: 1px solid var(--rule);
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.running-head a { text-decoration: none; }

/* Alt kısım: önceki / sayfa no / sonraki */
.page-foot {
  width: 100%;
  max-width: 44rem;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: baseline;
  gap: 1rem;
  padding: 1rem 0 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.98rem;
  color: var(--ink-soft);
}
.page-foot__num { font-size: 0.85rem; color: var(--ink-faint); }
.page-foot__side--next { text-align: right; font-style: italic; }
.page-foot a { text-decoration: none; }
.page-foot a:hover { text-decoration: underline; text-decoration-color: var(--rule); }

.ornament {
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.8rem;
  letter-spacing: 1.2em;
  margin: 1.75rem 0;
  padding-left: 1.2em;
}

/* ---- Kapak ---- */
.page__inner--cover {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  text-align: center;
  padding-top: clamp(3rem, 14vh, 8rem);
  padding-bottom: 2rem;
}
.cover__kicker {
  margin: 0 0 2.25rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-soft);
  font-size: 0.74rem;
}
.cover__title {
  font-family: var(--font-display);
  margin: 0;
  font-weight: 400;
  font-size: clamp(3.6rem, 16vw, 6.5rem);
  font-size: min(6.5rem, 16vw, calc(78vw / var(--chars, 3)), calc(30rem / var(--chars, 3)));
  line-height: 0.9;
  letter-spacing: 0.18em;
  padding-left: 0.18em;
  text-transform: uppercase;
}
.cover__subtitle {
  font-family: var(--font-display);
  margin: 0.9rem 0 0;
  font-style: italic;
  font-size: clamp(1.4rem, 5vw, 1.9rem);
  color: var(--ink-soft);
}
.cover__desc {
  margin: 0 auto;
  font-style: italic;
  font-size: 1.1rem;
  line-height: 1.55;
  color: var(--ink-soft);
}
.cover__author {
  margin: 2rem 0 0;
  font-family: var(--font-signature);
  font-size: 2.6rem;
  line-height: 1;
  color: var(--ink);
}
.cover__foot { margin-top: 3rem; }
.turn {
  font-style: italic;
  font-size: 1.15rem;
}
.swipe-hint {
  display: none;
  margin: 0.75rem 0 0;
  font-size: 0.66rem;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  animation: nudge 2.4s ease-in-out infinite;
}
@keyframes nudge {
  0%, 100% { transform: translateX(0); opacity: 0.6; }
  50% { transform: translateX(-6px); opacity: 1; }
}

/* ---- Önsöz ---- */
.preface__title {
  margin: 0;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 400;
  font-style: italic;
  font-size: clamp(2.2rem, 8vw, 2.8rem);
  line-height: 1.1;
}
.preface__body {
  font-size: clamp(1.14rem, 1.05rem + 0.35vw, 1.28rem);
  line-height: 1.62;
}
.preface__body p { margin: 0 0 0.9em; }
.preface__sign {
  margin: 2.25rem 0 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.15rem;
}
.preface__initials {
  font-family: var(--font-display);
  font-size: 1.3rem;
}
.preface__place {
  font-style: italic;
  color: var(--ink-soft);
}

/* ---- İçindekiler ---- */
.contents__title {
  font-family: var(--font-display);
  margin: 0 0 2rem;
  text-align: center;
  font-weight: 400;
  font-size: 0.95rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}
.toc {
  list-style: none;
  margin: 0;
  padding: 0;
}
.toc li { margin: 0; }
.toc__row,
.toc__pending {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  padding: 0.45rem 0;
  font-size: 1.2rem;
  text-decoration: none;
}
.toc__num {
  flex: 0 0 2.2rem;
  color: var(--ink-soft);
}
.toc__dots {
  flex: 1;
  border-bottom: 1px dotted var(--ink-faint);
  transform: translateY(-0.3em);
  min-width: 1.5rem;
}
.toc__page { color: var(--ink-soft); font-variant-numeric: oldstyle-nums; }
.toc__row:hover .toc__title { text-decoration: underline; text-decoration-color: var(--rule); }
  font-family: var(--font-display);
.toc__pending { color: var(--ink-faint); font-style: italic; }
.toc__pending .toc__num,
.toc__pending .toc__title { color: var(--ink-faint); font-style: italic; }
.contents__note {
  margin: 2.5rem 0 0;
  text-align: center;
  font-style: italic;
  color: var(--ink-soft);
  line-height: 1.5;
}
.contents__begin {
  margin: 1.75rem 0 0;
  text-align: center;
  font-style: italic;
  font-size: 1.15rem;
}

/* ---- Bölüm ---- */
.chapter__kicker {
  font-family: var(--font-display);
  margin: 0;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--ink-soft);
  font-size: 0.72rem;
}
.chapter__title {
  font-family: var(--font-display);
  margin: 0.4rem 0 0;
  text-align: center;
  font-weight: 400;
  font-style: italic;
  font-size: clamp(2.6rem, 10vw, 3.6rem);
  line-height: 1.05;
}
.chapter__summary {
  margin: 0.9rem auto 0;
  max-width: 24rem;
  text-align: center;
  font-style: italic;
  color: var(--ink-soft);
  line-height: 1.45;
}
.chapter__body {
  font-size: clamp(1.14rem, 1.05rem + 0.35vw, 1.28rem);
  line-height: 1.62;
  hyphens: auto;
  -webkit-hyphens: auto;
}
.chapter__body p {
  margin: 0;
  text-align: justify;
  text-indent: 1.4em;
}
.chapter__body p:first-child { text-indent: 0; }
.chapter__body p:first-child::first-letter {
  font-family: var(--font-display);
  float: left;
  font-size: 3.3em;
  line-height: 0.8;
  padding: 0.08em 0.1em 0 0;
  margin-bottom: 0.12em;
  font-weight: 400;
}
/* Tek başına duran kısa satırlar ("Sustum.") nefes alsın */
.chapter__body p.beat {
  text-indent: 0;
  text-align: center;
  font-style: italic;
  margin: 1.1em 0;
}
.chapter__end {
  margin: 2.5rem 0 0;
  text-align: center;
  color: var(--ink-faint);
  font-size: 1.4rem;
}

/* ---- Son sayfa ---- */
.page__inner--end {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.end__line {
  font-family: var(--font-display);
  margin: 0;
  font-style: italic;
  font-size: clamp(1.7rem, 6vw, 2.2rem);
}
.end__sub {
  margin: 0.75rem 0 0;
  color: var(--ink-soft);
  font-size: 1.1rem;
}
.end__back {
  margin: 2.5rem 0 0;
  font-style: italic;
}

/* ---- Kenar okları (masaüstü) ---- */
.edge {
  position: fixed;
  top: 50%;
  z-index: 10;
  transform: translateY(-50%);
  width: 3rem;
  height: 5rem;
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  font-family: var(--font);
  font-size: 2.4rem;
  line-height: 1;
  cursor: pointer;
  transition: color 0.2s, transform 0.2s;
}
.edge:hover { color: var(--ink); }
.edge--prev { left: 0.5rem; }
.edge--next { right: 0.5rem; }
.edge--prev:hover { transform: translateY(-50%) translateX(-3px); }
.edge--next:hover { transform: translateY(-50%) translateX(3px); }
.edge[hidden] { display: none; }
.edge:focus-visible, a:focus-visible {
  outline: 1px solid var(--ink-soft);
  outline-offset: 3px;
}

/* ---- Telefon ve dar ekranlar ---- */
@media (max-width: 760px) {
  .edge { display: none; }
  .swipe-hint { display: block; }
  .running-head { font-size: 0.64rem; padding-top: 1rem; }
  .page-foot { font-size: 0.92rem; gap: 0.5rem; }
  .chapter__body p { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  .swipe-hint { animation: none; }
}

@media print {
  body { overflow: visible; }
  body::before, body::after, .edge { display: none; }
  .book { display: block; height: auto; overflow: visible; }
  .page { height: auto; overflow: visible; page-break-after: always; }
}
