/*
Theme Name:  Читалики
Description: Тема кейса «Читалики»: 8 шаблонов по типам страниц (главная, архив, сказка, раскраска, животное, сборник, страница, поиск/404). Шапка и подвал — шаблонные части, правка в одном месте меняет все страницы. Работает в паре с плагином Chitaliki Core.
Version:     0.1.1
Author:      JUST studio
Requires PHP: 8.0
Text Domain: chitaliki
*/

/* ---------- Токены: палитра «Читалик» ---------- */
:root{
  --ink:#231a13; --ink2:#56423b; --line:#ddc1b6; --acc:#9a4111; --acc2:#c9622a;
  --sd:#43664f; --surf:#fff8f5; --surfc:#feeadf; --card:#fff;
  --r:1.05rem; --r-lg:1.35rem; --wrap:1180px;
  --sh:0 10px 30px rgba(35,26,19,.10); --sh-sm:0 3px 12px rgba(35,26,19,.07);
}

/* ---------- База ---------- */
*,*::before,*::after{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}
body{margin:0;background:var(--surf);color:var(--ink);
  font-family:'Plus Jakarta Sans',system-ui,-apple-system,Segoe UI,sans-serif;
  font-size:17px;line-height:1.62;-webkit-font-smoothing:antialiased}
h1,h2,h3,h4,.hl{font-family:'Playfair Display',Georgia,serif;font-weight:700;line-height:1.18;overflow-wrap:anywhere;margin:0 0 .5em}
h1{font-size:clamp(1.9rem,4.2vw,3.1rem)}
h2{font-size:clamp(1.45rem,2.6vw,2.05rem)}
h3{font-size:1.2rem}
p{margin:0 0 1em}
a{color:var(--acc);text-decoration:none}
a:hover{text-decoration:underline}
img{max-width:100%;height:auto;display:block}
ul,ol{padding-left:1.2em}
.wrap{max-width:var(--wrap);margin:0 auto;padding:0 1.25rem}
.wrap-narrow{max-width:760px}
.mt2{margin-top:2rem}.mt3{margin-top:3rem}.mb0{margin-bottom:0}
.muted{color:var(--ink2)}
.center{text-align:center}
.skip{position:absolute;left:-9999px}
.skip:focus{left:1rem;top:1rem;z-index:99;background:#fff;padding:.6rem 1rem;border-radius:.5rem}

/* ---------- Шапка ---------- */
.site-head{position:sticky;top:0;z-index:50;background:rgba(255,248,245,.94);
  border-bottom:1px solid var(--line);backdrop-filter:blur(10px)}
.site-head .wrap{display:flex;align-items:center;gap:1.1rem;flex-wrap:wrap;min-height:68px;padding-top:.4rem;padding-bottom:.4rem}
.brand{display:inline-flex;align-items:center;gap:.55rem;white-space:nowrap;min-height:44px;color:var(--ink)}
.brand:hover{text-decoration:none}
.brand .mk{width:38px;height:38px;flex:0 0 38px;border-radius:11px}
.brand .tx{font-size:1.3rem;line-height:1;letter-spacing:-.01em;font-family:'Playfair Display',Georgia,serif;font-weight:700}
.brand .tx em{font-style:normal;color:var(--acc)}
.site-nav{margin-left:auto;display:flex;align-items:center;gap:.15rem;flex-wrap:wrap}
.site-nav a{padding:.5rem .8rem;border-radius:.75rem;color:var(--ink);font-weight:600;font-size:.98rem}
.site-nav a:hover,.site-nav a[aria-current]{background:#fff1e9;color:var(--acc);text-decoration:none}
.site-nav a.cta{border:1px solid var(--line);color:var(--ink2);font-weight:600;margin-left:.25rem}
.site-nav a.cta:hover{border-color:var(--acc);color:var(--acc);background:#fff}
.menu-toggle{display:none}

/* ---------- Кнопки ---------- */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:.5rem;height:56px;min-width:150px;
  padding:0 1.4rem;border-radius:999px;font-weight:700;font-size:1rem;font-family:inherit;
  background:var(--acc);color:#fff;border:1px solid var(--acc);cursor:pointer;text-decoration:none}
.btn:hover{text-decoration:none;filter:brightness(1.07)}
.btn.alt{background:transparent;color:var(--acc)}
.btn.ghost{background:transparent;color:var(--ink2);border-color:var(--line)}
.btn.ghost:hover{background:#f6ece5;color:var(--ink)}
.btn[disabled]{opacity:.5;cursor:default}
.btn-row{display:flex;flex-wrap:wrap;gap:.75rem;align-items:center}

/* ---------- Крошки ---------- */
.crumbs{font-size:.88rem;color:var(--ink2);padding:.9rem 0 0}
.crumbs a{color:var(--ink2)}
.crumbs span.sep{margin:0 .4rem;opacity:.6}

/* ---------- Первый экран ---------- */
.hero{position:relative;isolation:isolate;display:flex;align-items:flex-start;
  min-height:clamp(430px,62vh,680px);margin-top:1.1rem;border-radius:var(--r-lg);overflow:hidden;background:var(--surfc)}
.hero-bg{position:absolute;inset:0;z-index:-2}
.hero-bg img{width:100%;height:100%;object-fit:cover;object-position:center}
/* картинка яркая: завесу поверх всей картинки не ставим — читаемость даёт плашка под текстом */
.hero-inner{width:100%;padding:clamp(1.1rem,2.4vw,2rem)}
.hero-plate{max-width:640px;background:rgba(255,252,250,.965);border:1px solid rgba(221,193,182,.75);
  border-radius:var(--r-lg);padding:clamp(1.1rem,2.3vw,1.9rem);box-shadow:0 14px 38px rgba(35,26,19,.16)}
.hero-plate h1{margin-bottom:.35em}
.hero-kicker{font-size:.9rem;font-weight:700;letter-spacing:.02em;text-transform:uppercase;color:var(--acc);margin-bottom:.35rem}
.hero-lead{font-size:1.1rem;line-height:1.62;color:var(--ink2);margin:0 0 .9rem;max-width:58ch}
.hero-tags{display:flex;flex-wrap:wrap;gap:.4rem;margin:.5rem 0 .9rem}
.hero-tags span{background:#fff1e9;color:#4a352c;border:1px solid var(--line);
  border-radius:999px;padding:.3rem .75rem;font-size:.85rem;font-weight:600}
.hero-row{display:flex;flex-wrap:wrap;gap:.75rem;align-items:stretch}
.hero-row .hero-acts{flex:0 0 auto;display:flex;gap:.75rem;flex-wrap:wrap}
.hero-row .hero-acts .btn{height:100%;min-width:clamp(140px,14vw,172px);padding-left:1rem;padding-right:1rem}
/* без картинки первый экран — просто блок с текстом */
.hero.plain{background:linear-gradient(180deg,#fff1e9,#fff8f5);min-height:0}
.hero.plain .hero-plate{box-shadow:none;border-color:var(--line)}

/* ---------- Плеер ---------- */
.player{display:flex;align-items:center;gap:.75rem;flex:0 1 430px;min-width:260px;height:69px;
  background:#fff1e9;border:1px solid var(--line);border-radius:999px;padding:.5rem .9rem}
.player button.pb{width:54px;height:54px;flex:0 0 54px;border:0;border-radius:50%;background:var(--acc);
  color:#fff;display:grid;place-items:center;cursor:pointer;padding:0}
.player button.pb svg{width:22px;height:22px;fill:currentColor}
.player .pmeta{flex:1 1 auto;min-width:0}
.player .ptitle{font-weight:700;font-size:.97rem;line-height:1.2}
.player .ptime{font-size:.8rem;color:var(--ink2);margin-top:.1rem}
.player .ptrack{height:5px;border-radius:999px;background:#f0d9cc;margin-top:.35rem;overflow:hidden;cursor:pointer}
.player .ptrack i{display:block;height:100%;width:0;background:var(--acc)}

/* ---------- Секции и сетки ---------- */
.sect{padding:2.6rem 0 0}
.sect-head{display:flex;align-items:baseline;gap:1rem;flex-wrap:wrap;margin-bottom:1rem}
.sect-head .cnt{font-size:.86rem;font-weight:600;color:var(--ink2);opacity:.75}
.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:1.25rem}
.grid.wide{grid-template-columns:repeat(auto-fill,minmax(320px,1fr))}

/* ---------- Карточка ---------- */
.card{display:flex;flex-direction:column;background:var(--card);border:1px solid var(--line);
  border-radius:var(--r);overflow:hidden;box-shadow:var(--sh-sm);color:var(--ink)}
.card:hover{text-decoration:none;box-shadow:var(--sh);transform:translateY(-2px)}
.card .thumb{aspect-ratio:16/10;background:#fff1e9;overflow:hidden}
.card .thumb img{width:100%;height:100%;object-fit:cover}
/* контурные листы квадратные — их не режем */
.card.square .thumb{aspect-ratio:1/1}
.card.square .thumb img{object-fit:contain}
.card .body{padding:.9rem 1rem 1.05rem;display:flex;flex-direction:column;flex:1}
.card h3{font-size:1.08rem;margin:0 0 .35rem}
.card .dim{margin-top:auto;font-size:.93rem;color:var(--ink2)}
.card.flat{box-shadow:none;border-color:var(--line)}

/* ---------- Текст сказки ---------- */
.skazka-text{max-width:70ch;font-size:1.13rem;line-height:1.78}
.skazka-text p{margin:0 0 1.05em}
.skazka-text p.dlg{margin-left:1.6rem;color:var(--ink2)}

/* ---------- Листы раскрасок ---------- */
.sheets{display:grid;grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:1rem}
.sheet{background:#fff;border:1px solid var(--line);border-radius:var(--r);padding:.6rem;display:flex;flex-direction:column}
.sheet img{aspect-ratio:1/1;object-fit:contain;background:#fff}
.sheet figcaption{font-size:.88rem;color:var(--ink2);margin-top:.4rem;text-align:center}
.sheet .pdf{margin-top:.5rem;text-align:center;font-size:.88rem;font-weight:600}

/* ---------- Помощник в тексте ---------- */
.note{background:var(--surfc);border:1px solid var(--line);border-radius:var(--r);padding:1rem 1.15rem}
.note h3{margin-top:0}
.note ul{margin:.4em 0 0}

/* ---------- Подвал ---------- */
.site-foot{background:var(--surfc);border-top:1px solid var(--line);margin-top:4rem}
.site-foot .cols{padding:2.6rem 1.25rem 1.4rem;display:grid;
  grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:2rem}
.site-foot .cols a{display:block;color:var(--ink);padding:.15rem 0}
.site-foot .bot{padding:1rem 1.25rem 1.6rem;border-top:1px solid var(--line);
  color:var(--ink2);font-size:.85rem}
.site-foot h4{font-size:1.02rem;margin:0 0 .4rem}

/* ---------- Пагинация, поиск, 404 ---------- */
.pager{display:flex;gap:.5rem;justify-content:center;margin:2rem 0}
.pager .page-numbers{padding:.5rem .85rem;border:1px solid var(--line);border-radius:.7rem;color:var(--ink)}
.pager .page-numbers.current{background:var(--acc);color:#fff;border-color:var(--acc)}
.no-results{background:#fff;border:1px dashed var(--line);border-radius:var(--r);padding:1.4rem}

/* ---------- Адаптив ---------- */
@media (max-width:900px){
  .hero{min-height:clamp(380px,58vh,560px)}
  .hero-plate{max-width:none}
  .btn{height:56px}
}
@media (max-width:760px){
  body{font-size:16px}
  .site-head .wrap{min-height:60px}
  .brand .mk{width:32px;height:32px;flex-basis:32px}
  .site-nav a{padding:.45rem .6rem;font-size:.94rem}
  .player{flex:1 1 100%}
  .hero-row .hero-acts{flex:1 1 100%}
  .hero-row .hero-acts .btn{flex:1 1 auto}
}
@media (max-width:560px){
  .hero{border-radius:1rem}
  .hero-plate{padding:1rem}
  .btn{width:100%}
  .grid,.grid.wide,.sheets{grid-template-columns:1fr 1fr;gap:.8rem}
  .card .body{padding:.7rem .75rem .85rem}
}
@media print{
  .site-head,.site-foot,.player,.btn,.crumbs{display:none!important}
  body{background:#fff}
}

/* ---------- Тексты материалов: разделы «### …» из .md ----------
   Конвертер отдаёт их как <h4> + <ul>. Раньше стилей не было вовсе, потому что
   заголовки приезжали текстом «### Что раскрашивать» внутри абзаца. 27.09.2026 */
article h3,article h4,.skazka-text h3,.skazka-text h4{font-size:1.22rem;margin:1.7em 0 .55em}
article h3:first-child,article h4:first-child,
.skazka-text h3:first-child,.skazka-text h4:first-child{margin-top:0}
article ul,article ol{margin:0 0 1.25em;padding-left:1.35em}
article li{margin:.28em 0}
article li::marker{color:var(--acc)}
.note h4{font-size:1.22rem;margin:1.7em 0 .55em}
