/*
Theme Name: AutoParts Wiki
Theme URI: https://autoparts.blog
Description: Дочірня тема GeneratePress для ГО «АВТОПАРТС ВІКІ» — освітній проєкт про автозапчастини.
Author: AUTOPARTS WIKI
Template: generatepress
Version: 1.0
Text Domain: autopartswiki
*/

/* ===== Base ===== */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  overflow-x: hidden;
  background: #F5F6F9;
  color: #171B24;
  font-family: "IBM Plex Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: #1D45D0; text-decoration: none; }
a:hover { color: #123099; }
h1, h2, h3, h4 { font-family: "Manrope", system-ui, sans-serif; margin: 0; }
p { margin: 0; }
img { max-width: 100%; height: auto; }
button { font-family: inherit; cursor: pointer; }
input, textarea { font-family: inherit; }
::selection { background: #1D45D0; color: #fff; }
::placeholder { color: #98A0AE; }
*:focus-visible { outline: 2px solid #1D45D0; outline-offset: 3px; border-radius: 3px; }
@keyframes ap-fade { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ===== Header ===== */
.apw-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(245,246,249,0.86);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid #E4E7EE;
}
.apw-header-inner {
  max-width: 1160px; margin: 0 auto;
  padding: 0 clamp(1.15rem,4vw,2.5rem);
  min-height: 74px;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.apw-logo { display: flex; align-items: center; gap: 11px; color: inherit; }
.apw-logo:hover { color: inherit; }
.apw-logo-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; border-radius: 11px; background: #1D45D0; color: #fff; flex-shrink: 0;
}
.apw-logo-word { font-family: "Manrope"; font-weight: 800; font-size: 1.02rem; letter-spacing: -0.01em; }
.apw-logo-word b { background: #171B24; color: #fff; padding: 1px 6px 2px; border-radius: 5px; margin-left: 1px; font-weight: 800; }
.apw-logo-sub { font-size: 0.66rem; color: #6A7180; letter-spacing: 0.03em; margin-top: 5px; }

.apw-nav { display: flex; align-items: center; gap: 2rem; }
.apw-nav a { color: #171B24; font-size: 0.94rem; font-weight: 500; }
.apw-nav a:hover { color: #1D45D0; }
.apw-nav a.apw-nav-cta {
  display: inline-flex; align-items: center; padding: 9px 17px; border-radius: 9px;
  background: #171B24; color: #fff; font-weight: 600;
}
.apw-nav a.apw-nav-cta:hover { background: #1D45D0; color: #fff; }

.apw-burger { display: none; flex-direction: column; gap: 5px; padding: 11px; background: #fff; border: 1px solid #E4E7EE; border-radius: 10px; cursor: pointer; }
.apw-burger span { display: block; width: 20px; height: 2px; background: #171B24; border-radius: 2px; }

/* Mobile menu (checkbox hack) */
@media (max-width: 899px) {
  .apw-burger { display: inline-flex; }
  .apw-nav {
    display: none; position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0;
    background: #fff; border-top: 1px solid #E4E7EE;
    padding: 0.6rem clamp(1.15rem,4vw,2.5rem) 1.2rem;
  }
  .apw-nav-toggle:checked ~ .apw-nav { display: flex; }
  .apw-nav a { padding: 13px 0; border-bottom: 1px solid #EEF0F4; }
  .apw-nav a.apw-nav-cta { margin-top: 14px; justify-content: center; text-align: center; padding: 13px; border-radius: 10px; border-bottom: none; }
}

/* ===== Content prose (pages & articles) ===== */
.ap-prose { font-size: clamp(1.02rem,1.4vw,1.12rem); line-height: 1.75; color: #3A4150; }
.ap-prose > * + * { margin-top: 1.15rem; }
.ap-prose h2 { font-size: clamp(1.5rem,3vw,2rem); font-weight: 800; letter-spacing: -0.015em; color: #171B24; margin-top: 2.2rem; line-height: 1.2; }
.ap-prose h3 { font-size: clamp(1.2rem,2.2vw,1.45rem); font-weight: 700; color: #171B24; margin-top: 1.6rem; }
.ap-prose ul, .ap-prose ol { padding-left: 1.3rem; }
.ap-prose li + li { margin-top: 0.5rem; }
.ap-prose a { color: #1D45D0; text-decoration: underline; text-underline-offset: 2px; }
.ap-prose strong { color: #171B24; }
.ap-prose table { width: 100%; border-collapse: collapse; margin-top: 1.3rem; font-size: 0.96rem; }
.ap-prose th, .ap-prose td { border: 1px solid #E4E7EE; padding: 10px 12px; text-align: left; vertical-align: top; }
.ap-prose th { background: #EAEFFF; color: #171B24; font-family: "Manrope"; }
.ap-prose blockquote { margin: 1.3rem 0; padding-left: 1.15rem; border-left: 3px solid #E38B24; color: #3A4150; }
@media (max-width: 640px) { .ap-prose table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; } }

/* ===== Blog list cards ===== */
.apw-blog-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(280px,1fr)); gap: 1.4rem; }
.apw-card { display: flex; flex-direction: column; background: #F8F9FC; border: 1px solid #E4E7EE; border-radius: 16px; overflow: hidden; color: inherit; }
.apw-card:hover { color: inherit; border-color: #C8D0E6; }
.apw-card-thumb { aspect-ratio: 16/10; background: repeating-linear-gradient(135deg,#EAEFFF,#EAEFFF 11px,#E1E8FC 11px,#E1E8FC 22px); display: flex; align-items: flex-end; padding: 16px; }
.apw-card-thumb span { font-family: "IBM Plex Mono"; font-size: 0.72rem; color: #5566B8; background: #fff; padding: 5px 9px; border-radius: 6px; }
.apw-card-body { padding: 22px 22px 24px; display: flex; flex-direction: column; gap: 11px; flex: 1; }
.apw-card-cat { font-family: "IBM Plex Mono"; font-size: 0.68rem; letter-spacing: 0.12em; text-transform: uppercase; color: #E38B24; }
.apw-card-title { font-size: 1.2rem; font-weight: 700; line-height: 1.28; letter-spacing: -0.01em; color: #171B24; }
.apw-card-more { margin-top: auto; display: inline-flex; align-items: center; gap: 7px; color: #1D45D0; font-weight: 600; font-size: 0.92rem; }

/* ===== FAQ (native details) ===== */
.apw-faq { background: #fff; border: 1px solid #E4E7EE; border-radius: 14px; overflow: hidden; }
.apw-faq + .apw-faq { margin-top: 0.85rem; }
.apw-faq summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 20px 22px; font-family: "Manrope"; font-weight: 700; font-size: 1.06rem; color: #171B24; }
.apw-faq summary::-webkit-details-marker { display: none; }
.apw-faq summary::after { content: "+"; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; background: #EAEFFF; color: #1D45D0; font-size: 1.3rem; line-height: 1; }
.apw-faq[open] summary::after { content: "\2013"; }
.apw-faq-a { padding: 0 22px 22px; font-size: 1rem; line-height: 1.7; color: #4A5262; }

/* ===== WPForms dark form (contacts) ===== */
.apw-dark-form { margin-top: 2rem; }
.apw-dark-form .wpforms-field-label { color: #EDEFF4 !important; font-weight: 600; }
.apw-dark-form .wpforms-field-description,
.apw-dark-form .wpforms-required-label { color: #AEB6C8 !important; }
.apw-dark-form input[type=text],
.apw-dark-form input[type=email],
.apw-dark-form input[type=tel],
.apw-dark-form input[type=url],
.apw-dark-form textarea,
.apw-dark-form select {
  background: rgba(255,255,255,0.05) !important;
  border: 1px solid rgba(255,255,255,0.16) !important;
  color: #fff !important;
  border-radius: 11px !important;
  padding: 14px 16px !important;
}
.apw-dark-form input::placeholder, .apw-dark-form textarea::placeholder { color: #8791A6 !important; }
.apw-dark-form .wpforms-submit {
  background: #E38B24 !important; color: #231402 !important;
  border: none !important; border-radius: 12px !important;
  padding: 15px 26px !important; font-weight: 700 !important; font-size: 1.02rem !important;
  cursor: pointer;
}
.apw-dark-form .wpforms-submit:hover { background: #cf7d1c !important; }
.apw-dark-form .wpforms-confirmation-container-full {
  background: rgba(255,255,255,0.06) !important;
  border: 1px solid rgba(143,166,255,0.4) !important;
  color: #EDEFF4 !important; border-radius: 16px !important; padding: 1.5rem !important;
}

/* Hide GeneratePress default chrome remnants if any leak */
.generate-back-to-top { z-index: 40; }
