/* Renkler brand/demokrat-parti/palette.json dosyasından. */
:root {
  --kirmizi: #E30613;
  --grad-ust: #851811;
  --grad-orta: #A91815;
  --grad-alt: #E10E18;
  --beyaz: #FFFFFF;
  --metin: #1D1D1B;
  --ortu: #6A120D;            /* gradyanUst'ün bir ton koyusu: örtü zemini */
  --kagit: #F3F3F3;           /* sayfa yüklenene kadar görünen zemin */
  --dugme: rgba(255, 255, 255, 0.16);
  --dugme-ust: rgba(255, 255, 255, 0.3);
  --yazi: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --yumusak: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; }

body {
  background: var(--grad-orta) linear-gradient(180deg, var(--grad-ust) 0%, var(--grad-orta) 50%, var(--grad-alt) 100%) fixed;
  color: var(--beyaz);
  font-family: var(--yazi);
  overflow: hidden;
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

.uygulama {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
}
/* Satırlar sabit: üst bant gizlenince sahne esnek satırda kalır. */
.ust { grid-row: 1; }
.sahne { grid-row: 2; }
.alt { grid-row: 3; }

/* Üst bant */
.ust {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) 8px max(16px, env(safe-area-inset-left));
}
.ust img { height: 34px; width: auto; display: block; }
.baslik {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  white-space: nowrap;
}

/* Sahne */
.sahne {
  position: relative;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px 14px;
  overflow: hidden;
}

.kitap-kap {
  position: relative;
  flex: none;
}
.kitap-kap.hazir { transition: transform 0.8s var(--yumusak); }
/* Çift sayfa düzeninde kapalı kitap ortada durur. */
.kitap-kap[data-konum="on"] { transform: translateX(-25%); }
.kitap-kap[data-konum="arka"] { transform: translateX(25%); }

/* Gölge duran sayfalara bağlı: çevrilen sayfa gölgesini kütüphane çizer.
   Çift sayfada her sayfanın gölgesi sırt tarafında kırpılır, komşusuna düşmez. */
.stf__item.--simple {
  box-shadow: 0 14px 44px rgba(40, 0, 0, 0.5), 0 2px 8px rgba(40, 0, 0, 0.35);
}
.stf__wrapper.--landscape .stf__item.--simple.--left { clip-path: inset(-90px 0 -90px -90px); }
.stf__wrapper.--landscape .stf__item.--simple.--right { clip-path: inset(-90px -90px -90px 0); }
.kitap-kap[data-konum="on"] .stf__item.--simple,
.kitap-kap[data-konum="arka"] .stf__item.--simple { clip-path: none; }

.kitap { position: relative; z-index: 1; }

.sayfa { background: var(--kagit); overflow: hidden; }
.sayfa img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
  pointer-events: none;
}

/* Çift sayfada sırt gölgesi: çok hafif. */
.stf__wrapper.--landscape .stf__item::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 7%;
  pointer-events: none;
}
.stf__wrapper.--landscape .stf__item.--left::after {
  right: 0;
  background: linear-gradient(to left, rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0));
}
.stf__wrapper.--landscape .stf__item.--right::after {
  left: 0;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0));
}

.ipucu {
  position: absolute;
  left: 50%;
  bottom: 22px;
  z-index: 5;
  margin: 0;
  padding: 9px 16px;
  border-radius: 999px;
  background: rgba(29, 29, 27, 0.82);
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  transform: translateX(-50%);
  pointer-events: none;
  transition: opacity 0.4s ease;
}
.ipucu.gizli { opacity: 0; }

/* Alt bant */
.alt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 6px 16px max(14px, env(safe-area-inset-bottom));
}

.dugme {
  flex: none;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--dugme);
  color: var(--beyaz);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.dugme svg { width: 22px; height: 22px; fill: currentColor; }
.dugme svg.cizgi {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.dugme:disabled { opacity: 0.35; cursor: default; }
.dugme:focus-visible { outline: 3px solid var(--beyaz); outline-offset: 2px; }
.dugme.koyu { background: rgba(29, 29, 27, 0.82); }
@media (hover: hover) {
  .dugme:not(:disabled):hover { background: var(--dugme-ust); }
  .dugme.koyu:not(:disabled):hover { background: rgba(29, 29, 27, 0.95); }
}

.sayac {
  min-width: 104px;
  text-align: center;
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Örtüler */
.ortu {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--ortu);
}
.ortu[hidden] { display: none; }

/* Yakınlaştırma */
.yakin-kaydir {
  position: absolute;
  inset: 0;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  cursor: grab;
}
.yakin-kaydir.tutuyor { cursor: grabbing; }
.yakin-ic {
  display: flex;
  width: max-content;
  min-width: 100%;
  min-height: 100%;
  justify-content: center;
  align-items: flex-start;
}
.yakin-ic img {
  display: block;
  flex: none;
  width: var(--sayfa-en, 720px);
  height: auto;
  aspect-ratio: 900 / 1277;
  background: var(--kagit) center / cover no-repeat;
  user-select: none;
  -webkit-user-drag: none;
}
.yakin-dugmeler {
  position: absolute;
  right: max(14px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  display: flex;
  gap: 10px;
}

/* Tüm sayfalar */
.izgara { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.izgara[hidden] { display: none; }
.izgara-ust {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(12px, env(safe-area-inset-top)) 16px 10px;
}
.izgara-ust h2 { margin: 0; font-size: 18px; font-weight: 700; }
.izgara-liste {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
  gap: 14px 12px;
  align-content: start;
  padding: 6px 16px max(24px, env(safe-area-inset-bottom));
}
.kucuk {
  display: block;
  padding: 0;
  border: 0;
  background: none;
  color: var(--beyaz);
  font: inherit;
  cursor: pointer;
  text-align: center;
}
.kucuk img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 900 / 1277;
  background: var(--kagit);
  box-shadow: 0 4px 14px rgba(40, 0, 0, 0.45);
}
.kucuk span {
  display: block;
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.kucuk[aria-current="page"] img { outline: 3px solid var(--beyaz); outline-offset: 2px; }
.kucuk:focus-visible img { outline: 3px solid var(--beyaz); outline-offset: 2px; }

/* Yedek: kütüphane yüklenmezse sayfalar alt alta. */
body.yedek { overflow: auto; }
body.yedek .uygulama { height: auto; display: block; }
body.yedek .alt, body.yedek .ipucu { display: none; }
body.yedek .sahne { display: block; overflow: visible; }
body.yedek .kitap-kap { width: min(100%, 720px) !important; margin: 0 auto; }
body.yedek .sayfa { margin-bottom: 12px; }
body.yedek .sayfa img { height: auto; }

.noscript { margin: 0; padding: 24px 16px; text-align: center; }

/* Yatay telefon: dikey alan dar, bantlar küçülür. */
@media (max-height: 460px) {
  .ust { display: none; }
  .sahne { padding: 8px 16px 6px; }
  .alt { padding: 2px 16px max(6px, env(safe-area-inset-bottom)); gap: 8px; }
  .dugme { width: 38px; height: 38px; }
  .ipucu { bottom: 10px; }
}

@media (max-width: 380px) {
  .baslik { font-size: 11px; letter-spacing: 0.1em; }
  .ust img { height: 30px; }
  .alt { gap: 6px; }
  .sayac { min-width: 88px; }
}

@media (prefers-reduced-motion: reduce) {
  .kitap-kap.hazir, .ipucu { transition: none; }
}
