:root {
  --zemin: #1f3b2d;          /* koyu orman yeşili masa */
  --zemin-2: #17291f;
  --kagit: #fbf8f1;
  --kagit-kenar: #ece5d6;
  --murekkep: #22241f;
  --soluk: #6b6a60;
  --vurgu: #2f6b4a;
  --altin: #b8892c;
  --gumus: #8b929a;
  --bronz: #a8683a;
  --cubuk-h: 56px;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  color: var(--murekkep);
  font-family: var(--sans);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; }

/* ---------- kitap ve şerit ---------- */
#kitap {
  position: fixed;
  inset: 0 0 var(--cubuk-h) 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
#serit {
  --sayfa-g: 100vw;
  --sayfa-y: calc(100dvh - var(--cubuk-h));
  width: var(--sayfa-g);
  height: var(--sayfa-y);
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
  outline: none;
}
#serit::-webkit-scrollbar { display: none; }

.sayfa {
  flex: 0 0 var(--sayfa-g);
  width: var(--sayfa-g);
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  background: var(--kagit);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 18px 18px 14px;
}

/* masaüstü: iki sayfa yan yana */
@media (min-width: 900px) and (min-height: 520px) {
  #serit {
    --sayfa-y: min(calc(100vh - var(--cubuk-h) - 40px), 980px);
    --sayfa-g: min(calc(var(--sayfa-y) * 0.74), calc((100vw - 80px) / 2));
    width: calc(var(--sayfa-g) * 2);
    box-shadow: 0 30px 60px rgba(0,0,0,.45), 0 8px 18px rgba(0,0,0,.3);
    border-radius: 4px;
  }
  .sayfa { padding: 28px 30px 20px; }
  .sayfa:nth-child(even) { scroll-snap-align: none; }
  .sayfa:nth-child(odd)::after,
  .sayfa:nth-child(even)::after {
    content: "";
    position: absolute;
    top: 0; bottom: 0;
    width: 46px;
    pointer-events: none;
  }
  /* cilt gölgesi */
  .sayfa:nth-child(odd)::after { right: 0; background: linear-gradient(to left, rgba(0,0,0,.13), rgba(0,0,0,0)); }
  .sayfa:nth-child(even)::after { left: 0; background: linear-gradient(to right, rgba(0,0,0,.16), rgba(0,0,0,0)); }
}

/* sayfa başlığı ve numarası */
.ust {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--soluk);
  border-bottom: 1px solid var(--kagit-kenar);
  padding-bottom: 8px;
  margin-bottom: 10px;
  flex: none;
}
.ust .baslik { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 12px; }
.alt-no {
  flex: none;
  text-align: center;
  font-size: 11px;
  color: var(--soluk);
  padding-top: 8px;
  font-variant-numeric: tabular-nums;
}

/* ---------- eser sayfası ---------- */
.eser-alan {
  flex: 0 1 auto;
  min-height: 0;
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px 0 10px;
}
.cerceve-resim {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  border: 6px solid #fff;
  background: #ece7dc;
  box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 6px 18px rgba(0,0,0,.16);
  cursor: zoom-in;
}
.cerceve-resim:focus-visible { outline: 3px solid var(--altin); outline-offset: 3px; }
.kapak .mozaik img, .kazanan img { opacity: 0; transition: opacity .35s ease; }
.kapak .mozaik img.yuklendi, .kazanan img.yuklendi { opacity: 1; }

.kunye {
  flex: none;
  margin-bottom: auto;
  text-align: center;
  padding: 2px 6px 0;
}
.kunye .ad {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(20px, 5.4vw, 28px);
  line-height: 1.15;
  margin: 0 0 4px;
  letter-spacing: -.005em;
}
.kunye .okul { font-size: 15px; font-weight: 600; color: var(--vurgu); margin: 0; }
.kunye .yer { font-size: 14px; color: var(--soluk); margin: 2px 0 0; }
.kunye .cicek { color: var(--altin); font-size: 34px; line-height: 1; }

.rozet {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: #fff;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.rozet.d1 { background: var(--altin); }
.rozet.d2 { background: var(--gumus); }
.rozet.d3 { background: var(--bronz); }

/* ---------- ön sayfalar ---------- */
.yazi-sayfa { overflow-y: auto; }
.yazi-sayfa .icerik { flex: 1 1 auto; overflow-y: auto; padding: 4px 2px; }
.yazi-sayfa h2 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(24px, 6vw, 32px);
  line-height: 1.1;
  margin: 6px 0 14px;
  color: var(--vurgu);
}
.yazi-sayfa h3 { font-family: var(--serif); font-weight: 600; font-size: 18px; margin: 18px 0 6px; }
.yazi-sayfa p, .yazi-sayfa li { font-size: 15.5px; line-height: 1.55; margin: 0 0 10px; }
.yazi-sayfa ul { padding-left: 20px; margin: 0 0 10px; }
.alinti {
  font-family: var(--serif);
  font-size: clamp(19px, 4.8vw, 23px);
  line-height: 1.35;
  border-left: 3px solid var(--altin);
  padding: 2px 0 2px 14px;
  margin: 8px 0 16px;
}
table.takvim { width: 100%; border-collapse: collapse; font-size: 14.5px; }
table.takvim td { padding: 8px 4px; border-bottom: 1px solid var(--kagit-kenar); vertical-align: top; }
table.takvim td:last-child { text-align: right; white-space: nowrap; color: var(--vurgu); font-weight: 600; }

/* kapak */
.kapak {
  padding: 0;
  background: var(--zemin-2);
  color: #fff;
}
.kapak .mozaik {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-rows: 1fr;
  gap: 3px;
  opacity: .9;
}
.kapak .mozaik img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kapak .ortu {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(15,32,23,.72) 0%, rgba(15,32,23,.6) 30%, rgba(15,32,23,.78) 60%, rgba(15,32,23,.94) 100%);
}
.kapak .kapak-icerik {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 28px 24px 26px;
  text-align: center;
}
.kapak .kurum { font-size: 12.5px; letter-spacing: .14em; text-transform: uppercase; line-height: 1.6; opacity: .92; }
.kapak h1 {
  font-family: var(--serif);
  font-weight: 700;
  font-size: clamp(34px, 9.5vw, 54px);
  line-height: 1.04;
  margin: 0 0 16px;
  letter-spacing: -.01em;
}
.kapak .tur { font-size: 15px; letter-spacing: .2em; text-transform: uppercase; color: #e9cf8f; margin: 0 0 6px; }
.kapak .alt-baslik { font-family: var(--serif); font-size: 19px; margin: 0; opacity: .95; }
.kapak .tarih { font-size: 13px; letter-spacing: .18em; text-transform: uppercase; opacity: .85; }
.kapak .ipucu { font-size: 13px; opacity: .75; margin-top: 10px; }

/* dereceye girenler */
.kazananlar { display: grid; gap: 14px; }
.kazanan {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 14px;
  align-items: center;
  text-align: left;
  background: #fff;
  border: 1px solid var(--kagit-kenar);
  border-radius: 6px;
  padding: 8px;
  cursor: pointer;
  color: inherit;
  width: 100%;
}
.kazanan img { width: 96px; height: 72px; object-fit: cover; border-radius: 3px; display: block; }
.kazanan .rozet { margin-bottom: 4px; padding: 2px 9px; font-size: 10.5px; }
.kazanan .ad { font-family: var(--serif); font-weight: 600; font-size: 18px; display: block; line-height: 1.2; }
.kazanan .okul { font-size: 13.5px; color: var(--soluk); display: block; }

/* içindekiler */
.liste { list-style: none; margin: 0; padding: 0; }
.liste li { margin: 0; }
.liste button {
  width: 100%;
  display: flex;
  align-items: baseline;
  gap: 8px;
  background: none;
  border: 0;
  border-bottom: 1px dotted #d8d0bf;
  padding: 4px 2px;
  text-align: left;
  cursor: pointer;
  color: inherit;
  font-size: 14.5px;
  line-height: 1.35;
}
.liste button:hover, .liste button:focus-visible { background: #f1ecdf; outline: none; }
.liste .no { width: 2.2em; flex: none; color: var(--soluk); font-variant-numeric: tabular-nums; }
.liste .ad { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.liste .il { flex: none; font-size: 12.5px; color: var(--soluk); max-width: 40%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* kapanış */
.kapanis { background: var(--zemin-2); color: #fff; text-align: center; justify-content: center; }
.kapanis .kapak-icerik { justify-content: center; gap: 18px; }
.kapanis h2 { font-family: var(--serif); font-size: clamp(26px, 7vw, 36px); margin: 0; }
.kapanis p { font-size: 15.5px; line-height: 1.6; max-width: 34ch; margin: 0 auto; opacity: .92; }
.kapanis .kucuk { font-size: 13px; opacity: .75; }
.kapanis a { color: #e9cf8f; }
.kapanis .basa { margin-top: 8px; }

/* ---------- alt çubuk ---------- */
#cubuk {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: var(--cubuk-h);
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: #fff;
  background: rgba(10, 20, 14, .55);
  backdrop-filter: blur(6px);
}
.dugme {
  background: rgba(255,255,255,.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  min-width: 44px;
  height: 40px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
}
.dugme.metin { font-size: 14px; padding: 0 14px; }
.dugme:hover { background: rgba(255,255,255,.2); }
.dugme:disabled { opacity: .35; cursor: default; }
.kapak .dugme.basla, .kapanis .dugme { font-size: 15px; padding: 0 22px; height: 44px; margin: 0 auto; }
#sayac { min-width: 78px; text-align: center; font-size: 14px; font-variant-numeric: tabular-nums; }

/* ---------- büyüteç ---------- */
#buyutec {
  position: fixed;
  inset: 0;
  z-index: 10;
  background: rgba(8, 12, 10, .96);
  display: flex;
  flex-direction: column;
}
#buyutec[hidden] { display: none; }
#buyutec-alan {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  touch-action: pan-x pan-y pinch-zoom;
}
#buyutec-resim {
  margin: auto;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  cursor: zoom-in;
}
#buyutec.yakin #buyutec-resim { max-width: none; max-height: none; width: 200%; cursor: zoom-out; }
#buyutec-yazi { flex: none; color: #fff; text-align: center; padding: 10px 16px calc(14px + env(safe-area-inset-bottom)); font-size: 14px; opacity: .9; }
#buyutec-yazi strong { font-family: var(--serif); font-size: 18px; font-weight: 600; display: block; }
#buyutec-kapat { position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 10px; background: rgba(0,0,0,.5); }

@media (prefers-reduced-motion: reduce) {
  #serit { scroll-behavior: auto; }
  .cerceve img { transition: none; }
}

/* ---------- sunum katmanları ---------- */
#ortam { position: fixed; inset: 0; z-index: -1; overflow: hidden; background: var(--zemin-2); }
#ortam .katman {
  position: absolute; inset: -60px;
  background-size: cover; background-position: center;
  filter: blur(48px) saturate(1.25) brightness(.55);
  opacity: 0;
  transition: opacity 1.1s ease;
}
#ortam .katman.acik { opacity: 1; }
body { background: transparent; }

#ilerleme { position: absolute; left: 0; right: 0; top: 0; height: 3px; background: rgba(255,255,255,.1); }
#ilerleme span { display: block; height: 100%; width: 0; background: var(--altin); transition: width .3s ease; }

.dugme .etiket { display: none; }
.dugme.metin { min-width: 44px; padding: 0 12px; }
.dugme .simge { font-size: 18px; }
#oynat[aria-pressed="true"] { background: var(--altin); border-color: var(--altin); }
@media (min-width: 720px) {
  .dugme .etiket { display: inline; }
  .dugme .simge { display: none; }
  #cubuk { gap: 10px; }
}
@media (max-width: 360px) {
  #cubuk { gap: 3px; }
  .dugme { min-width: 40px; padding: 0 6px; }
  #sayac { min-width: 64px; font-size: 13px; }
}

/* eser sayfaya gelince hafifçe belirsin */
.sayfa.eser .eser-alan, .sayfa.eser .kunye { transition: transform .6s ease, opacity .6s ease; }
.sayfa.eser:not(.gorunur) .eser-alan { transform: scale(.97); opacity: .6; }
.sayfa.eser:not(.gorunur) .kunye { transform: translateY(8px); opacity: 0; }

/* galeri */
#galeri {
  position: fixed; inset: 0; z-index: 9;
  background: rgba(14, 26, 19, .97);
  color: #fff;
  display: flex; flex-direction: column;
}
#galeri[hidden] { display: none; }
.galeri-ust {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  border-bottom: 1px solid rgba(255,255,255,.12);
}
.galeri-ust h2 { font-family: var(--serif); font-weight: 600; font-size: 22px; margin: 0; }
#galeri-izgara {
  flex: 1 1 auto; overflow-y: auto;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
  gap: 10px;
  padding: 14px 16px calc(20px + env(safe-area-inset-bottom));
  align-content: start;
}
@media (min-width: 720px) { #galeri-izgara { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; padding: 18px 24px 28px; } }
.galeri-oge {
  background: none; border: 0; padding: 0; color: inherit; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 5px;
}
.galeri-oge img {
  width: 100%; aspect-ratio: 1 / 1; object-fit: cover; display: block;
  border-radius: 4px; background: rgba(255,255,255,.08);
  transition: transform .2s ease;
}
.galeri-oge:hover img, .galeri-oge:focus-visible img { transform: scale(1.03); }
.galeri-oge:focus-visible { outline: 2px solid var(--altin); outline-offset: 3px; border-radius: 4px; }
.galeri-oge .gno { font-size: 11px; opacity: .6; font-variant-numeric: tabular-nums; }
.galeri-oge .gad { font-size: 13px; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  #ortam .katman, .sayfa.eser .eser-alan, .sayfa.eser .kunye, #ilerleme span { transition: none; }
}

/* açılış mesajı */
.yazi-sayfa .hitap { font-family: var(--serif); font-weight: 600; font-size: 17px; color: var(--murekkep); }
.yazi-sayfa .hitap.ilk { font-size: 20px; color: var(--vurgu); margin-top: 6px; }
.yazi-sayfa .imza { text-align: right; margin-top: 18px; line-height: 1.5; }
.yazi-sayfa .imza strong { font-family: var(--serif); font-size: 17px; }

/* içindekiler (tek sayfa) */
.liste.bolumler button, .liste.ilk-uc button { padding: 7px 2px; font-size: 15.5px; }
.liste .ad small { display: block; font-size: 12.5px; color: var(--soluk); }
.liste.bolumler .no, .liste.ilk-uc .no { width: auto; margin-left: auto; color: var(--vurgu); font-weight: 600; }
.liste.ilk-uc { margin: 4px 0 6px 12px; }
.liste.ilk-uc .rozet { margin: 0; padding: 2px 8px; font-size: 10px; flex: none; }
.yazi-sayfa .aciklama { font-size: 13.5px; color: var(--soluk); margin-bottom: 8px; }
.harf-dizini { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 6px; margin: 0 0 12px; }
.harf-dizini button, .harf-dizini span {
  height: 38px; display: flex; align-items: center; justify-content: center;
  font-family: var(--serif); font-weight: 600; font-size: 17px; border-radius: 6px;
}
.harf-dizini button { background: #fff; border: 1px solid var(--kagit-kenar); color: var(--vurgu); cursor: pointer; }
.harf-dizini button:hover, .harf-dizini button:focus-visible { background: var(--vurgu); color: #fff; outline: none; }
.harf-dizini span { color: #cfc8b8; }
