/* ==========================================================================
   AQAR — Global chrome (loaded on every page)
   Buttons · forms · badges · alerts · header · footer.
   Component styles (cards, price-box, course player, etc.) load conditionally
   in their own stylesheets from later phases. Depends on tokens.css.
   ========================================================================== */

/* ==========================================================================
   BUTTONS
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  font-family: inherit; font-weight: 700; font-size: var(--fs-sm); line-height: 1;
  padding: 14px 24px; border-radius: var(--r-sm); border: 2px solid transparent;
  cursor: pointer; text-decoration: none; white-space: nowrap; user-select: none;
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
              transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(0); }

.btn-primary { background: var(--c-turquoise); color: #fff; box-shadow: var(--sh-sm); }
.btn-primary:hover { background: var(--c-turquoise-600); box-shadow: var(--sh-md); transform: translateY(-1px); }
.btn-primary:active { background: var(--c-turquoise-700); }

/* Dark button — the neutral "strong" action where teal would be too loud. */
.btn-dark { background: var(--c-ink); color: #fff; }
.btn-dark:hover { background: var(--c-ink-2); transform: translateY(-1px); }

.btn-secondary { background: #fff; color: var(--c-turquoise-700); border-color: var(--c-tint-2); }
.btn-secondary:hover { background: var(--c-tint); border-color: var(--c-turquoise); }

/* Outlined, not invisible: the ghost now reads as a real second action. */
.btn-ghost { background: transparent; color: var(--c-ink); border-color: var(--c-line); }
.btn-ghost:hover { background: var(--c-surface); border-color: var(--c-faint); }

/* Ghost on a dark section (hero, final CTA). */
.btn-ghost-light { background: transparent; color: #fff; border-color: rgba(255,255,255,.25); }
.btn-ghost-light:hover { background: rgba(255,255,255,.10); border-color: rgba(255,255,255,.6); }

.btn-gold { background: var(--c-gold); color: #fff; }
.btn-gold:hover { filter: brightness(.95); }

.btn-lg { padding: 16px 30px; font-size: var(--fs-body); }
.btn-sm { padding: 9px 16px; font-size: var(--fs-xs); }
.btn[disabled], .btn.is-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn-block { display: flex; width: 100%; }

/* ==========================================================================
   FORMS
   ========================================================================== */
.field { margin-bottom: var(--sp-4); max-width: 420px; }
.label { display: block; font-size: var(--fs-sm); font-weight: 600; margin-bottom: var(--sp-2); color: var(--c-ink); }
.input, .select, .textarea {
  width: 100%; font-family: inherit; font-size: var(--fs-body); color: var(--c-ink);
  padding: 12px 14px; background: #fff; border: 1.5px solid var(--c-line); border-radius: var(--r-md);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--c-faint); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--c-turquoise); box-shadow: 0 0 0 3px rgba(18,166,166,.15);
}
.textarea { min-height: 110px; resize: vertical; }
.help { font-size: var(--fs-xs); color: var(--c-faint); margin-top: var(--sp-2); }
.field.has-error .input { border-color: var(--c-danger); box-shadow: 0 0 0 3px rgba(194,74,63,.12); }
.field.has-error .help { color: var(--c-danger); }
.check { display: flex; align-items: flex-start; gap: var(--sp-2); font-size: var(--fs-sm); cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--c-turquoise); flex: none; }

/* ==========================================================================
   BADGES / TAGS / PILLS
   ========================================================================== */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 700;
  padding: 5px 11px; border-radius: var(--r-pill); letter-spacing: .02em; }
.badge-brand { background: var(--c-tint); color: var(--c-turquoise-700); }
.badge-gold { background: var(--c-gold-soft); color: #8a6d1f; }
.badge-free { background: var(--c-success-bg); color: var(--c-success); }
.badge-neutral { background: var(--c-surface); color: var(--c-muted); border: 1px solid var(--c-line); }
.tag { display: inline-block; font-size: var(--fs-xs); font-weight: 600; color: var(--c-muted);
  background: var(--c-surface); border: 1px solid var(--c-line); padding: 4px 10px; border-radius: var(--r-sm); }

/* ==========================================================================
   ALERTS
   ========================================================================== */
.alert { display: flex; gap: var(--sp-3); padding: var(--sp-4); border-radius: var(--r-md);
  font-size: var(--fs-sm); border: 1px solid transparent; margin-bottom: var(--sp-3); }
.alert strong { display: block; margin-bottom: 2px; }
.alert-success { background: var(--c-success-bg); border-color: #BFE6D2; color: #155e40; }
.alert-info { background: var(--c-info-bg); border-color: #BFDFEC; color: #134f62; }
.alert-warning { background: var(--c-warning-bg); border-color: #EBD6A6; color: #7a5210; }
.alert-danger { background: var(--c-danger-bg); border-color: #EFC3BD; color: #8a2f26; }
.alert .ico { flex: none; width: 20px; height: 20px; }

/* ==========================================================================
   ANNOUNCEMENT BAR — the price anchor, first thing on the page
   ========================================================================== */
.announce { background: var(--c-ink); color: #fff; }
.announce-inner { display: flex; align-items: center; justify-content: center; flex-wrap: wrap;
  gap: 10px; padding: 10px var(--sp-5); text-align: center; font-size: var(--fs-xs); line-height: 1.4; }
.announce-muted { color: rgba(255,255,255,.7); }
.announce-strong { font-weight: 700; }
.announce-link { display: inline-flex; align-items: center; gap: 4px; font-weight: 700;
  color: var(--c-turquoise-300); text-underline-offset: 4px; }
.announce-link:hover { text-decoration: underline; color: var(--c-turquoise-300); }
.announce-close { position: absolute; right: var(--sp-3); top: 50%; transform: translateY(-50%);
  display: grid; place-items: center; width: 28px; height: 28px; padding: 0;
  border: 0; border-radius: var(--r-pill); background: none;
  color: rgba(255,255,255,.5); cursor: pointer; }
.announce-close:hover { background: rgba(255,255,255,.1); color: #fff; }
.announce-inner { position: relative; padding-right: 40px; }
@media (max-width: 620px) { .announce-link { display: none; } }

/* ==========================================================================
   HEADER
   Opaque on purpose: a backdrop-filter on a full-width sticky bar repaints on
   every scroll frame and is one of the most expensive things a phone can be
   asked to do. A solid bar with a hairline looks the same and costs nothing.
   ========================================================================== */
.site-header { background: var(--c-canvas); border-bottom: 1px solid var(--c-line);
  position: sticky; top: 0; z-index: 20; transition: box-shadow var(--dur) var(--ease); }
.site-header.is-stuck { box-shadow: 0 8px 24px -16px rgba(6,62,62,.35); }
.nav { display: flex; align-items: center; gap: var(--sp-5); height: 66px; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem;
  letter-spacing: -.02em; color: var(--c-ink); flex: none; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 36px; height: 36px; border-radius: var(--r-sm); background: var(--c-turquoise);
  display: flex; align-items: center; justify-content: center; color: #fff; flex: none; }
.brand-dot { color: var(--c-turquoise); }
/* Cap the custom logo wherever it renders. the_custom_logo() prints the img
   OUTSIDE the .brand wrapper, so this must not be scoped to .brand or it never
   matches and the logo shows at its full upload size. */
img.custom-logo { width: auto; height: 38px; }

.nav-links { display: flex; gap: var(--sp-5); margin: 0 auto 0 var(--sp-6); list-style: none; padding: 0; }
/* nowrap is load-bearing: without it "Soal Jawab Tajwid" breaks across three
   lines between the drawer breakpoint and the point where the bar has room,
   and the whole header grows to fit it. */
.nav-links a { color: var(--c-ink); font-size: var(--fs-sm); font-weight: 600; padding: 6px 0;
  position: relative; white-space: nowrap; }
.nav-links a:hover { color: var(--c-turquoise-600); text-decoration: none; }
.nav-links a.active,
.nav-links li.current-menu-item > a,
.nav-links li.current_page_item > a { color: var(--c-turquoise-700); }
.nav-links a.active::after,
.nav-links li.current-menu-item > a::after,
.nav-links li.current_page_item > a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 2px;
  background: var(--c-turquoise); border-radius: 2px;
}

.nav-actions { display: flex; align-items: center; gap: var(--sp-2); margin-left: auto; }

/* A square icon action in the header (search, cart). */
.icon-btn, .cart-ico { position: relative; flex: none; width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--c-line); border-radius: var(--r-sm);
  background: var(--c-canvas); color: var(--c-ink); cursor: pointer; padding: 0;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease); }
.icon-btn:hover, .cart-ico:hover { border-color: var(--c-faint); background: var(--c-surface); text-decoration: none; }
.nav-search-toggle[aria-expanded="true"] { background: var(--c-ink); border-color: var(--c-ink); color: #fff; }

/* ==========================================================================
   SITE SEARCH PANEL
   Search previously had NO entry point in the chrome — the form existed only on
   the results page and the 404, so the only way to reach it was to get lost.
   ========================================================================== */
.site-search { border-top: 1px solid var(--c-line); background: var(--c-surface); }
.site-search[hidden] { display: none; }
.site-search-inner { padding: var(--sp-4) var(--sp-5); }
.site-search .search-form-row { max-width: 640px; margin: 0 auto; }

/* The search FORM is chrome, not a page component: it appears in the header on
   every page, including the front page. It used to be styled in pages.css, which
   the front page does not load — so the row lost its flex and the "Cari" button
   dropped underneath the box. Layout for a shared component belongs where the
   component lives. */
.search-form-row { display: flex; align-items: stretch; gap: var(--sp-2); }
.search-form-row .search-field { flex: 1 1 auto; min-width: 0; }
.search-form-row .search-submit { flex: none; }
.cart-ico .count { position: absolute; top: -6px; right: -6px; background: var(--c-turquoise); color: #fff; font-size: 11px;
  font-weight: 700; min-width: 18px; height: 18px; padding: 0 4px; border-radius: var(--r-pill);
  display: flex; align-items: center; justify-content: center; }
.cart-ico .count.is-empty { display: none; }

.avatar-menu { display: flex; align-items: center; gap: var(--sp-2); }
.avatar { width: 34px; height: 34px; border-radius: var(--r-pill); flex: none;
  background: linear-gradient(135deg, var(--c-turquoise), var(--c-teal-deep));
  display: flex; align-items: center; justify-content: center; color: #fff; font-size: var(--fs-xs); font-weight: 700; }

/* Hamburger — hidden on desktop */
.nav-toggle { display: none; width: 40px; height: 40px; border-radius: var(--r-md);
  border: 1px solid var(--c-line); background: #fff; color: var(--c-ink);
  align-items: center; justify-content: center; cursor: pointer; }
.nav-toggle svg { width: 22px; height: 22px; }

/* ---- Mobile drawer (<1024px) ----
   Raised from 860px: with five menu items plus search, cart, login and the CTA,
   the bar was still technically "desktop" at 900px but had nowhere to put them. */
@media (max-width: 1024px) {
  .nav-toggle { display: inline-flex; }
  .nav-links {
    position: fixed; inset: 0 0 0 auto; width: min(78vw, 320px);
    flex-direction: column; align-items: flex-start; gap: 0; margin: 0;
    background: var(--c-canvas); box-shadow: var(--sh-lg);
    padding: calc(66px + var(--sp-4)) var(--sp-5) var(--sp-5);
    transform: translateX(100%); transition: transform var(--dur) var(--ease);
    z-index: 30; overflow-y: auto;
  }
  .nav-links.is-open { transform: translateX(0); }
  .nav-links a { display: block; width: 100%; padding: var(--sp-3) 0; font-size: var(--fs-body);
    border-bottom: 1px solid var(--c-line); white-space: normal; }
  .nav-links a.active::after,
  .nav-links li.current-menu-item > a::after { display: none; }
  .nav-drawer-backdrop { position: fixed; inset: 0; background: rgba(6,62,62,.35);
    opacity: 0; visibility: hidden; transition: opacity var(--dur) var(--ease); z-index: 25; }
  .nav-drawer-backdrop.is-open { opacity: 1; visibility: visible; }
}

/* On a phone the header must stay one tidy row. The SECONDARY action (Log Masuk /
   Papan Pemuka) drops out; the primary CTA never does — it is the whole point of
   the bar, and the login link still lives in the drawer and the footer. */
@media (max-width: 620px) {
  .nav { gap: var(--sp-3); }
  .nav-actions .btn-ghost { display: none; }
  .brand-word { font-size: 1rem; }
}

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer { background: var(--c-ink); color: rgba(255,255,255,.6); }
.site-footer a { color: rgba(255,255,255,.6); }
.site-footer a:hover { color: var(--c-turquoise-300); text-decoration: none; }
.foot-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: var(--sp-6); padding: var(--sp-8) 0 var(--sp-6); }
.foot-brand .brand { color: #fff; }
.foot-brand .brand-dot { color: var(--c-turquoise-400); }
.foot-brand p { font-size: var(--fs-sm); max-width: 34ch; }
/* Semantic h2 (no heading-level skip), sized down visually. */
.foot-col .foot-col-title { color: #fff; font-size: var(--fs-sm); font-weight: 700; text-transform: uppercase;
  letter-spacing: var(--ls-eyebrow); margin: 0 0 var(--sp-3); line-height: var(--lh-snug); }
.foot-col ul { list-style: none; padding: 0; margin: 0; font-size: var(--fs-sm); line-height: 2.1; }
.socials { display: flex; gap: var(--sp-2); margin-top: var(--sp-4); }
.socials a { width: 36px; height: 36px; border-radius: var(--r-pill); background: rgba(255,255,255,.08);
  display: flex; align-items: center; justify-content: center; }
.socials a:hover { background: var(--c-turquoise); }
.socials svg { width: 17px; height: 17px; }
/* .5 not .45 — WCAG AA fix, same reasoning as the hero opacity fixes
   (measured .45 = 4.39:1, fails 4.5:1 by a hair). Verified 2026-07-30. */
.foot-bottom { border-top: 1px solid rgba(255,255,255,.1); padding: var(--sp-5) 0;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-2);
  font-size: var(--fs-xs); color: rgba(255,255,255,.5); }
@media (max-width: 860px) { .foot-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 520px) { .foot-grid { grid-template-columns: 1fr; } }

/* The mobile sticky CTA (homepage) sits over the footer's tail — give it room. */
@media (max-width: 1024px) { .site-footer { padding-bottom: var(--sp-8); } }

/* ==========================================================================
   SCROLL TO TOP
   Hidden by default (opacity + visibility, not display, so it never grabs
   layout or a tab stop until nav.js reveals it past the scroll threshold).
   ========================================================================== */
.scroll-top {
  position: fixed; right: var(--sp-5); bottom: var(--sp-5); z-index: 35;
  width: 44px; height: 44px; border-radius: var(--r-pill);
  display: flex; align-items: center; justify-content: center;
  background: var(--c-canvas); border: 1px solid var(--c-turquoise); color: var(--c-turquoise);
  box-shadow: var(--sh-md); cursor: pointer; padding: 0;
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--ease), border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.scroll-top.is-visible { opacity: 1; visibility: visible; transform: translateY(0); }
.scroll-top:hover { background: var(--c-turquoise); color: #fff; }
.scroll-top svg { width: 20px; height: 20px; }

/* Stay clear of the homepage's mobile sticky CTA bar (z-index 40, ~64px tall). */
@media (max-width: 1024px) { .home .scroll-top { bottom: calc(64px + var(--sp-4)); } }
