/*
Theme Name: Kitbox
Theme URI: https://example.com/kitbox
Author: Kitbox
Description: Современный минималистичный шаблон каталога программ. Кастомный тип записи "Программа" с полями версии, размера, ОС и лицензии, архив с поиском и фильтром по категориям, детальная страница со спецификацией.
Version: 1.1.0
Requires at least: 6.0
Requires PHP: 7.4
License: GPL v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: kitbox
*/

:root{
  --bg: #EEF0F4;
  --surface: #FFFFFF;
  --surface-alt: #E3E7EE;
  --border: #D3D8E3;
  --ink: #171B2E;
  --ink-soft: #5B6178;
  --ink-faint: #8890A8;
  --accent: #3454D1;
  --accent-ink: #1F3AA8;
  --accent-soft: #DCE3FA;
  --success: #1B9C5C;
  --success-ink: #0F7A47;
  --success-soft: #DEF3E6;
  color-scheme: light;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#0D1020; --surface:#151A2E; --surface-alt:#1C2138; --border:#2A3050;
    --ink:#E9EBF6; --ink-soft:#A2A8C4; --ink-faint:#6F7592;
    --accent:#7C94FF; --accent-ink:#A9B7FF; --accent-soft:#232A52;
    --success:#3FCB84; --success-ink:#6FE0A6; --success-soft:#16321F;
    color-scheme: dark;
  }
}
:root[data-theme="dark"]{
  --bg:#0D1020; --surface:#151A2E; --surface-alt:#1C2138; --border:#2A3050;
  --ink:#E9EBF6; --ink-soft:#A2A8C4; --ink-faint:#6F7592;
  --accent:#7C94FF; --accent-ink:#A9B7FF; --accent-soft:#232A52;
  --success:#3FCB84; --success-ink:#6FE0A6; --success-soft:#16321F;
  color-scheme: dark;
}

*{box-sizing:border-box;}
body{
  margin:0; background:var(--bg); color:var(--ink);
  font-family:"IBM Plex Sans", system-ui, sans-serif;
  -webkit-font-smoothing:antialiased;
}
a{color:inherit;}
img{max-width:100%;}
.wrap{max-width:1120px; margin-inline:auto; padding-inline:16px;}
h1,h2,h3{font-family:"Fraunces", Georgia, serif; text-wrap:balance; margin:0;}
.mono{font-family:"IBM Plex Mono", ui-monospace, monospace;}

/* header */
header.site{position:sticky; top:0; z-index:20; background:color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter:blur(10px); border-bottom:1px solid var(--border);}
.header-row{display:flex; align-items:center; gap:20px; padding-block:14px;}
.logo{display:flex; align-items:center; gap:10px; flex-shrink:0; text-decoration:none;}
.logo-mark{width:34px; height:34px; display:block;}
.logo-word{font-family:"Fraunces", serif; font-weight:700; font-size:1.28rem; letter-spacing:-0.01em; color:var(--ink);}
.logo-word b{color:var(--accent); font-weight:700;}
.search-form{flex:1; max-width:420px; display:flex; align-items:center; gap:8px; background:var(--surface); border:1px solid var(--border); border-radius:10px; padding:9px 14px; color:var(--ink-faint);}
.search-form svg{width:16px; height:16px; flex-shrink:0;}
.search-form input[type="search"]{border:0; outline:0; background:transparent; color:var(--ink); font:inherit; font-size:0.92rem; width:100%;}
.search-form input::placeholder{color:var(--ink-faint);}
nav.top-menu{margin-left:auto; flex-shrink:0;}
nav.top-menu ul{list-style:none; display:flex; gap:4px; margin:0; padding:0;}
nav.top-menu a{font-size:0.86rem; font-weight:500; color:var(--ink-soft); padding:8px 12px; border-radius:8px; text-decoration:none; display:block;}
nav.top-menu a:hover{color:var(--ink); background:var(--surface-alt);}
@media (max-width:680px){ .search-form{display:none;} }

/* hero */
.hero{padding-block:40px 28px; display:flex; flex-wrap:wrap; gap:28px; align-items:flex-end; justify-content:space-between;}
.hero h1{font-size:clamp(1.7rem, 1.2rem + 2vw, 2.5rem); font-weight:700; max-width:16ch; line-height:1.08;}
.hero .eyebrow{font-family:"IBM Plex Mono"; font-size:0.72rem; letter-spacing:0.14em; text-transform:uppercase; color:var(--accent); margin-bottom:10px; display:block;}
.hero p{color:var(--ink-soft); max-width:46ch; margin-top:10px; line-height:1.55;}

/* category chips */
.chips{display:flex; gap:8px; overflow-x:auto; padding-block:4px 26px; scrollbar-width:none; list-style:none; margin:0;}
.chips::-webkit-scrollbar{display:none;}
.chips a{display:flex; align-items:center; gap:7px; flex-shrink:0; background:var(--surface); border:1px solid var(--border); padding:8px 14px; border-radius:999px; font-size:0.84rem; font-weight:500; color:var(--ink-soft); text-decoration:none;}
.chips a.active{background:var(--accent-soft); border-color:var(--accent); color:var(--accent-ink);}
.chips a:hover{border-color:var(--accent);}

/* grid + cards */
.grid{display:grid; grid-template-columns:repeat(auto-fill, minmax(252px,1fr)); gap:14px; padding-bottom:56px;}
.card{background:var(--surface); border:1px solid var(--border); border-radius:16px; padding:18px; display:flex; flex-direction:column; gap:12px; box-shadow:0 1px 2px rgba(23,27,46,0.06), 0 8px 24px -12px rgba(23,27,46,0.18); text-decoration:none; color:inherit;}
.card-top{display:flex; gap:12px; align-items:flex-start;}
.app-icon{width:46px; height:46px; border-radius:12px; flex-shrink:0; object-fit:cover; background:var(--accent-soft);}
.card-title{font-weight:600; font-size:1rem; line-height:1.25; font-family:"IBM Plex Sans";}
.card-pub{font-size:0.78rem; color:var(--ink-faint); margin-top:2px;}
.badge{font-family:"IBM Plex Mono"; font-size:0.66rem; letter-spacing:0.04em; padding:2px 7px; border-radius:5px; background:var(--success-soft); color:var(--success-ink); margin-left:auto; white-space:nowrap; flex-shrink:0;}
.card p.desc{color:var(--ink-soft); font-size:0.86rem; line-height:1.5; margin:0; flex:1;}
.meta-row{display:flex; gap:12px; flex-wrap:wrap; font-family:"IBM Plex Mono"; font-size:0.72rem; color:var(--ink-faint); border-top:1px solid var(--border); padding-top:10px;}
.btn-dl{display:flex; align-items:center; justify-content:center; gap:7px; background:var(--success); color:#fff; text-decoration:none; font-weight:600; font-size:0.9rem; border:0; border-radius:10px; padding:11px 16px; cursor:pointer; width:100%; transition:transform .12s ease, background .15s ease;}
.btn-dl:hover{background:var(--success-ink); transform:translateY(-1px); color:#fff;}

/* single program page */
.back-link{display:inline-flex; align-items:center; gap:6px; color:var(--ink-soft); font-size:0.86rem; text-decoration:none; margin-block:22px 8px;}
.back-link:hover{color:var(--accent);}
.detail-head{display:flex; gap:20px; align-items:flex-start; flex-wrap:wrap; padding-block:18px 26px; border-bottom:1px solid var(--border);}
.detail-head .app-icon{width:72px; height:72px; border-radius:18px;}
.detail-head h1{font-size:1.9rem; font-weight:700;}
.detail-tags{display:flex; gap:8px; margin-top:10px; flex-wrap:wrap;}
.tag{font-family:"IBM Plex Mono"; font-size:0.68rem; padding:3px 8px; border-radius:6px; background:var(--surface-alt); color:var(--ink-soft); border:1px solid var(--border);}
.detail-cta{margin-left:auto; display:flex; flex-direction:column; gap:8px; width:220px; flex-shrink:0;}
.detail-cta .btn-dl{padding:13px 16px; font-size:0.96rem;}
.detail-cta .hint{font-size:0.7rem; color:var(--ink-faint); text-align:center; font-family:"IBM Plex Mono";}
.detail-body{display:grid; grid-template-columns:1.6fr 1fr; gap:32px; padding-block:28px 60px;}
@media (max-width:760px){ .detail-body{grid-template-columns:1fr;} .detail-cta{width:100%; margin-left:0;} }
.detail-body h2{font-size:1.05rem; font-weight:600; margin-bottom:10px; font-family:"IBM Plex Sans";}
.detail-body p{color:var(--ink-soft); line-height:1.65; font-size:0.92rem;}
.spec-list{display:flex; flex-direction:column; border:1px solid var(--border); border-radius:12px; overflow:hidden; background:var(--surface);}
.spec-row{display:flex; justify-content:space-between; gap:12px; padding:11px 14px; font-size:0.82rem; border-bottom:1px solid var(--border);}
.spec-row:last-child{border-bottom:0;}
.spec-row dt{color:var(--ink-faint); margin:0;}
.spec-row dd{margin:0; font-family:"IBM Plex Mono"; color:var(--ink); text-align:right; word-break:break-all; max-width:60%;}

/* theme toggle */
.theme-toggle{flex-shrink:0; width:36px; height:36px; display:grid; place-items:center; border-radius:9px; border:1px solid var(--border); background:var(--surface); color:var(--ink-soft); cursor:pointer;}
.theme-toggle:hover{color:var(--ink); border-color:var(--accent);}
.theme-toggle svg{width:17px; height:17px;}
.theme-toggle .i-sun{display:none;}
:root[data-theme="dark"] .theme-toggle .i-sun{display:block;}
:root[data-theme="dark"] .theme-toggle .i-moon{display:none;}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]) .theme-toggle .i-sun{display:block;}
  :root:not([data-theme="light"]) .theme-toggle .i-moon{display:none;}
}
:focus-visible{outline:2px solid var(--accent); outline-offset:2px;}

/* breadcrumbs */
.crumbs{display:flex; flex-wrap:wrap; gap:8px; font-size:0.8rem; color:var(--ink-faint); margin-block:22px 4px;}
.crumbs a{color:var(--ink-soft); text-decoration:none;}
.crumbs a:hover{color:var(--accent);}
.crumbs [aria-current]{color:var(--ink);}

/* [button-green] shortcode */
.kb-btn-wrap{display:flex; margin-block:18px;}
.kb-pos-left{justify-content:flex-start;}
.kb-pos-center{justify-content:center;}
.kb-pos-right{justify-content:flex-end;}
.kb-btn-green{
  display:inline-flex; align-items:center; gap:9px;
  background:var(--success); color:#fff !important; text-decoration:none !important;
  font-family:"IBM Plex Sans", system-ui, sans-serif; font-weight:600; font-size:1rem;
  padding:13px 28px; border-radius:12px;
  box-shadow:0 1px 0 rgba(255,255,255,0.18) inset, 0 6px 18px -8px color-mix(in srgb, var(--success) 70%, transparent);
  transition:transform .12s ease, background .15s ease, box-shadow .15s ease;
}
.kb-btn-green svg{width:18px; height:18px;}
.kb-btn-green:hover{background:var(--success-ink); transform:translateY(-1px); box-shadow:0 1px 0 rgba(255,255,255,0.18) inset, 0 10px 24px -8px color-mix(in srgb, var(--success) 80%, transparent);}
.kb-btn-green:active{transform:translateY(0);}
@media (max-width:480px){ .kb-btn-green{width:100%; justify-content:center;} }

/* download box on single page */
.dl-box{display:flex; align-items:center; justify-content:space-between; gap:16px; flex-wrap:wrap; margin-top:28px; padding:18px 20px; border:1px solid var(--border); border-radius:14px; background:var(--success-soft); transition:box-shadow .3s ease;}
.dl-box .kb-btn-wrap{margin:0;}
.dl-box-title{font-weight:600; font-size:1rem;}
.dl-box-meta{font-size:0.74rem; color:var(--ink-soft); margin-top:3px;}
.dl-box.flash{box-shadow:0 0 0 3px var(--success);}

/* post content */
.entry{color:var(--ink-soft); line-height:1.7; font-size:0.95rem;}
.entry h2,.entry h3{color:var(--ink); margin-block:1.4em 0.5em; font-family:"IBM Plex Sans", sans-serif; font-weight:600;}
.entry img{border-radius:10px; border:1px solid var(--border); height:auto;}
.entry a{color:var(--accent);}
.entry ul,.entry ol{padding-left:1.2em;}
.entry .wp-block-gallery,.entry .gallery{display:grid; grid-template-columns:repeat(auto-fill,minmax(200px,1fr)); gap:10px;}

/* related */
.related{padding-bottom:20px;}
.related h2{font-size:1.3rem; margin-bottom:16px;}

/* pagination */
.navigation.pagination{padding-bottom:40px;}
.nav-links{display:flex; gap:6px; flex-wrap:wrap;}
.nav-links .page-numbers{min-width:38px; height:38px; display:grid; place-items:center; padding-inline:10px; border-radius:9px; border:1px solid var(--border); background:var(--surface); text-decoration:none; font-family:"IBM Plex Mono"; font-size:0.85rem; color:var(--ink-soft);}
.nav-links .page-numbers.current{background:var(--accent); border-color:var(--accent); color:#fff;}

@media (prefers-reduced-motion: reduce){ *{transition:none !important; scroll-behavior:auto !important;} }

footer.site{border-top:1px solid var(--border); padding-block:22px; margin-top:20px;}
footer.site .wrap{display:flex; justify-content:space-between; flex-wrap:wrap; gap:10px; font-size:0.78rem; color:var(--ink-faint);}
