/* Masal Okuyalım — tasarım sistemi */
:root {
  --bg: #fbf7f1;
  --surface: #ffffff;
  --surface-2: #f4eee5;
  --ink: #2b2540;
  --muted: #6b6480;
  --line: #ece4d8;
  --primary: #4b3fa6;
  --primary-ink: #ffffff;
  --primary-soft: #ece9ff;
  --accent: #ffc35c;
  --coral: #ff7a6b;
  --mint: #2f9e87;
  --shadow: 0 6px 24px rgba(43, 37, 64, .08);
  --radius: 18px;
  --font-head: "Baloo 2", "Nunito", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --story-size: 19px;
  --a12: #ff8fb1; --a34: #ff9f43; --a56: #2fb37f; --a78: #3b8beb; --a910: #8e63d6;
  color-scheme: light;
}
:root[data-fs="1"] { --story-size: 21px; }
:root[data-fs="2"] { --story-size: 23px; }
:root[data-fs="-1"] { --story-size: 17px; }
:root[data-theme="dark"] {
  --bg: #141128;
  --surface: #1e1a38;
  --surface-2: #262148;
  --ink: #f1ecff;
  --muted: #b7afd6;
  --line: #312b58;
  --primary: #a99cff;
  --primary-ink: #18142e;
  --primary-soft: #2c2655;
  --accent: #ffd27f;
  --shadow: 0 6px 24px rgba(0, 0, 0, .35);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.6 var(--font-body);
  transition: background .25s, color .25s;
}
img, svg { display: block; max-width: 100%; height: auto; }
a { color: var(--primary); text-underline-offset: 3px; }
h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 4.5vw, 2.8rem); font-weight: 800; }
h2 { font-size: clamp(1.35rem, 3vw, 1.75rem); font-weight: 700; }
p { margin: 0 0 1em; }
.wrap { width: min(1160px, 100% - 32px); margin-inline: auto; }
.narrow { width: min(820px, 100% - 32px); }
.center { text-align: center; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--primary); color: var(--primary-ink); padding: 8px 14px; border-radius: 8px; z-index: 99; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* Düğmeler, rozetler */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--primary); color: var(--primary-ink); border: 0; border-radius: 999px;
  padding: 12px 22px; font: 700 1rem var(--font-body); text-decoration: none; cursor: pointer;
  transition: transform .15s, filter .15s;
}
.btn:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn-ghost { background: var(--primary-soft); color: var(--primary); }
.badges { display: flex; flex-wrap: wrap; gap: 6px; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px;
  font-size: .8rem; font-weight: 700; color: #fff; text-decoration: none; white-space: nowrap;
}
.badge svg { width: 14px; height: 14px; }
.age-1-2 { background: var(--a12); } .age-3-4 { background: var(--a34); } .age-5-6 { background: var(--a56); }
.age-7-8 { background: var(--a78); } .age-9-10 { background: var(--a910); }
.badge-time { background: var(--surface-2); color: var(--muted); }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  padding: 6px 14px; border-radius: 999px; background: var(--primary-soft); color: var(--primary);
  font-weight: 700; font-size: .85rem; text-decoration: none;
}
.pill.active { background: var(--primary); color: var(--primary-ink); }
.eyebrow { display: inline-block; font-weight: 800; font-size: .85rem; letter-spacing: .04em; text-transform: uppercase; color: var(--coral); margin-bottom: 8px; }

/* Üst menü */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; gap: 16px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); flex-shrink: 0; }
.logo-mark { width: 42px; height: 42px; }
.brand-text { font: 700 1.45rem/1 var(--font-head); }
.brand-text b { color: var(--primary); font-weight: 800; }
.main-nav { margin-left: auto; }
.main-nav > ul { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.main-nav a, .sub-toggle {
  display: block; padding: 10px 12px; border-radius: 10px; color: var(--ink); text-decoration: none;
  font: 700 .95rem var(--font-body); background: none; border: 0; cursor: pointer; white-space: nowrap;
}
.main-nav a:hover, .sub-toggle:hover { background: var(--primary-soft); color: var(--primary); }
.has-sub { position: relative; }
.sub-toggle::after { content: " ▾"; font-size: .75em; }
.sub {
  display: none; position: absolute; top: 100%; left: 0; min-width: 210px; list-style: none; margin: 6px 0 0; padding: 8px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
}
.has-sub:hover .sub, .has-sub.open .sub { display: block; }
.header-tools { display: flex; gap: 4px; }
.icon-btn {
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; border: 0;
  background: transparent; color: var(--ink); cursor: pointer;
}
.icon-btn:hover { background: var(--primary-soft); color: var(--primary); }
.icon-btn svg { width: 22px; height: 22px; }
.menu-btn { display: none; }

/* Ana sayfa */
.hero { padding: 40px 0 24px; background:
  radial-gradient(circle at 85% 10%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 40%),
  radial-gradient(circle at 5% 90%, color-mix(in srgb, var(--primary) 14%, transparent), transparent 45%); }
.hero-grid { display: grid; grid-template-columns: 1.05fr 1fr; gap: 36px; align-items: center; }
.hero h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); }
.lead { font-size: 1.15rem; color: var(--muted); }
.search-form { display: flex; gap: 8px; background: var(--surface); padding: 6px; border-radius: 999px; box-shadow: var(--shadow); border: 1px solid var(--line); max-width: 560px; }
.search-form input { flex: 1; min-width: 0; border: 0; background: transparent; padding: 10px 16px; font: 1rem var(--font-body); color: var(--ink); }
.search-form input:focus { outline: none; }
.quick-ages { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.quick-ages .badge { font-size: .9rem; padding: 6px 14px; }
.tonight { background: var(--surface); border-radius: 24px; overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); }
.tonight-img img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.tonight-body { padding: 20px 24px 24px; }
.tonight-body h2 a { color: var(--ink); text-decoration: none; }
.tonight-body .badges { margin-bottom: 16px; }
.section { margin-block: 40px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section-head h2 { margin: 0; }
.more { font-weight: 800; text-decoration: none; }
.age-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.age-tile { display: flex; flex-direction: column; align-items: center; padding: 22px 12px; border-radius: var(--radius); color: #fff; text-decoration: none; font-weight: 700; box-shadow: var(--shadow); transition: transform .15s; }
.age-tile:hover, .type-tile:hover { transform: translateY(-3px); }
.age-num { font: 800 2.1rem/1 var(--font-head); }
.type-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.type-tile { display: flex; align-items: center; gap: 12px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); font-weight: 800; text-decoration: none; transition: transform .15s; }
.type-icon { font-size: 1.8rem; }
.prose-box { background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 28px; }

/* Kartlar */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 20px; }
.card { display: flex; flex-direction: column; background: var(--surface); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); transition: transform .15s; }
.card:hover { transform: translateY(-3px); }
.card-img img { width: 100%; aspect-ratio: 16/9; object-fit: cover; }
.card-body { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px 18px; flex: 1; }
.card-cat { font-size: .8rem; font-weight: 800; color: var(--muted); }
.card-title { font-size: 1.2rem; margin: 0; }
.card-title a { color: var(--ink); text-decoration: none; }
.card-title a:hover { color: var(--primary); }
.card-desc { color: var(--muted); font-size: .95rem; margin: 0 0 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card .badges { margin-top: auto; }
.card-sm .card-desc { display: none; }

/* Sayfa yolu */
.crumbs ol { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 18px 0; font-size: .9rem; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-right: 6px; }
.crumbs a { color: var(--muted); }

/* Masal sayfası */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 40px; align-items: start; }
.story-head { text-align: center; }
.story-head .pills { justify-content: center; margin-bottom: 14px; }
.story-head .lead { max-width: 640px; margin-inline: auto; }
.meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 16px; color: var(--muted); font-size: .9rem; margin-bottom: 20px; }
.story-img img { width: 100%; border-radius: 24px; aspect-ratio: 16/9; object-fit: cover; }
.story-img { margin: 0 0 18px; }
.reader-tools { display: flex; gap: 8px; justify-content: flex-end; margin-bottom: 8px; }
.tool { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 6px 14px; font: 700 .9rem var(--font-body); cursor: pointer; }
.tool:hover { border-color: var(--primary); color: var(--primary); }
.story-body { font-size: var(--story-size); line-height: 1.85; max-width: 68ch; margin-inline: auto; }
.story-body p { margin-bottom: 1.1em; }
.story-page .story-body > p:first-child::first-letter { float: left; font: 800 3.4em/0.9 var(--font-head); color: var(--primary); margin: 6px 10px 0 0; }
.story-body h2 { margin-top: 1.4em; }
.the-end { text-align: center; font-weight: 800; color: var(--primary); }
.box { border-radius: 20px; padding: 20px 24px; margin: 24px 0; }
.box h2 { font-size: 1.3rem; }
.box-lesson { background: color-mix(in srgb, var(--mint) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--mint) 30%, transparent); }
.box-questions { background: color-mix(in srgb, var(--accent) 18%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.box ol { margin: 0; padding-left: 1.3em; } .box li { margin-bottom: .4em; }
.box p:last-child { margin-bottom: 0; }
.story-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 24px 0; }
.related { margin-top: 32px; }
.sidebar { display: flex; flex-direction: column; gap: 20px; position: relative; }
.side-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.side-box h2 { font-size: 1.15rem; }
.side-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.side-list a { display: flex; gap: 12px; align-items: center; text-decoration: none; color: var(--ink); font-weight: 700; line-height: 1.3; }
.side-list img { width: 96px; border-radius: 10px; aspect-ratio: 16/9; object-fit: cover; flex-shrink: 0; }
.side-list small { display: block; color: var(--muted); font-weight: 600; margin-top: 2px; }
.side-sticky { position: sticky; top: 88px; }

/* Kategori + sayfalar */
.cat-head { text-align: center; max-width: 760px; margin: 8px auto 20px; }
.cat-icon { font-size: 2.6rem; }
.count { font-weight: 800; color: var(--muted); }
.chips { justify-content: center; margin-bottom: 24px; }
.pager { display: flex; gap: 8px; justify-content: center; margin: 28px 0; }
.pager a { padding: 8px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; font-weight: 800; }
.pager a.active { background: var(--primary); color: var(--primary-ink); }
.page { padding-bottom: 32px; }
.page-body { font-size: 1.05rem; max-width: none; }
.toc { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; margin-bottom: 24px; }
.toc ol { margin: 8px 0 0; }
.search-status { color: var(--muted); font-weight: 700; margin: 16px 0; }
.search-form + .search-status { margin-top: 20px; }

/* Reklam alanları — yer ayırarak kaymayı (CLS) önler */
.ad-slot { position: relative; display: grid; place-items: center; min-height: 280px; margin: 28px auto; border-radius: 14px; background: var(--surface-2); border: 1px dashed var(--line); }
.ad-sidebar { min-height: 600px; margin: 0; }
.ad-label { position: absolute; top: 6px; left: 12px; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.ad-slot ins { width: 100%; }

/* Alt bilgi */
.site-footer { margin-top: 56px; background: var(--surface); border-top: 1px solid var(--line); padding: 40px 0 20px; font-size: .95rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 28px; }
.site-footer h2 { font-size: 1.05rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--primary); }
.brand-footer { margin-bottom: 10px; }
.footer-bottom { border-top: 1px solid var(--line); margin-top: 28px; padding-top: 16px; color: var(--muted); font-size: .85rem; }

/* Çerez bildirimi */
.cookie { position: fixed; z-index: 60; left: 16px; right: 16px; bottom: 16px; max-width: 760px; margin: auto; display: flex; gap: 14px; align-items: center; justify-content: space-between; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 18px; padding: 14px 18px; }
.cookie[hidden] { display: none; }
.cookie p { margin: 0; font-size: .92rem; }
.cookie div { display: flex; gap: 8px; flex-shrink: 0; }
.cookie .btn { padding: 9px 16px; font-size: .9rem; }

/* Mobil */
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .hero-grid { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1100px) {
  .menu-btn { display: grid; }
  .header-tools { margin-left: auto; }
  .main-nav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--surface); border-bottom: 1px solid var(--line); box-shadow: var(--shadow); padding: 8px 16px 16px; max-height: calc(100vh - 68px); overflow: auto; }
  .main-nav.open { display: block; }
  .main-nav > ul { flex-direction: column; }
  .sub { position: static; box-shadow: none; border: 0; padding: 0 0 0 12px; margin: 0; }
  .has-sub:hover .sub { display: none; }
  .has-sub.open .sub { display: block; }
}
@media (max-width: 560px) {
  .brand-text { font-size: 1.2rem; }
  .logo-mark { width: 36px; height: 36px; }
  .icon-btn { width: 38px; height: 38px; }
  .footer-grid { grid-template-columns: 1fr; }
  .cookie { flex-direction: column; align-items: stretch; }
  .reader-tools { justify-content: center; }
  .story-body { --story-size-mobile: calc(var(--story-size) - 1px); font-size: var(--story-size-mobile); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* Ebeveyn rehberi */
.nav-guide { color: var(--primary) !important; background: var(--primary-soft); }
.guide .story-head { margin-bottom: 8px; }
.more-guides { margin-top: 24px; }
.more-guides ul { margin: 0; padding-left: 1.2em; display: grid; gap: 6px; }
.page-body table { width: 100%; border-collapse: collapse; margin: 0 0 1.2em; font-size: .95rem; }
.page-body th, .page-body td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
.page-body th { background: var(--surface-2); }

/* Masal içi görseller */
.story-fig { margin: 1.6em auto; max-width: 680px; }
.story-fig img { width: 100%; height: auto; border-radius: 20px; box-shadow: var(--shadow); }
