/*
  Prep NCET (Child) — Frontend CSS
  Scope:
    • Light, surgical CSS to complement theme.json + block styles
    • Mobile-first polish, Woo Blocks tweaks, accessibility helpers
  Notes:
    • Keep this file small; patterns/layout should be block-driven
    • Versioned enqueue handled in functions.php via prepncet_asset()
*/

/* ---------- Base polish ---------- */
html { scroll-behavior: smooth; }
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  background: var(--wp--preset--color--bg);
  color: var(--wp--preset--color--ink);
}

/* Safe-area padding for phones with notches (helps bottom nav & sticky bars) */
@supports (padding: max(0px)) {
  .pn-mobile-nav,
  .pn-sticky-cta {
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
}

/* Links: subtle underline on hover only */
a { text-decoration: none; }
a:hover { text-decoration: underline; }

/* Better focus rings (A11y) */
:where(a, button, [role="button"], input, select, textarea):focus-visible {
  outline: 2px solid var(--wp--preset--color--primary);
  outline-offset: 2px;
  border-radius: 10px;
}

/* Utility: visually hidden (but accessible to screen readers) */
.pn-visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Utility: muted text */
.pn-muted { color: #6B7280; }

/* Utility: mini tags & badges */
.pn-tag {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px;
  border: 1px solid #e8eef6; border-radius: 999px; font-size: 12px; font-weight: 600; background: #fff;
}
.pn-badge {
  display: inline-block; padding: 4px 8px; border-radius: 8px; font-weight: 700; font-size: 12px;
  background: rgba(37,99,235,.12); color: var(--wp--preset--color--primary);
}

/* Utility grids (use thoughtfully inside Group/Columns blocks) */
.pn-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pn-grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
@media (max-width: 768px){
  .pn-grid-2, .pn-grid-3 { grid-template-columns: 1fr; }
}

/* Cards: variants */
.pn-card--soft { background: #fff; border: 1px solid #e8eef6; border-radius: var(--pn-radius,16px); box-shadow: var(--pn-shadow, 0 10px 30px rgba(0,0,0,.06)); }
.pn-card--ghost { background: transparent; border: 1px dashed #e8eef6; }

/* Headline sheen (applied via class in markup already) */
.pn-headline-gradient { /* defined in style.css; kept here for future extensions */ }

/* Details/summary (FAQ) — nicer affordance */
.wp-block-details summary {
  cursor: pointer; list-style: none; position: relative;
  padding: 10px 12px; border: 1px solid #e8eef6; border-radius: 12px; font-weight: 700;
  background: #fff;
}
.wp-block-details[open] summary {
  border-bottom-left-radius: 0; border-bottom-right-radius: 0; border-bottom-color: transparent;
}
.wp-block-details summary::-webkit-details-marker { display: none; }
.wp-block-details summary::after {
  content: "▾"; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); opacity: .7;
}
.wp-block-details[open] summary::after { transform: translateY(-50%) rotate(180deg); }
.wp-block-details > *:not(summary) {
  padding: 12px; border: 1px solid #e8eef6; border-top: 0; border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; background: #fff;
}

/* Tables — progressive enhancement (CSS-only card fallback already in style.css) */
table.pn-table { width: 100%; border-collapse: separate; border-spacing: 0; border: 1px solid #e8eef6; border-radius: 12px; overflow: hidden; }
table.pn-table th, table.pn-table td { padding: 12px; border-bottom: 1px solid #eef3fb; }
table.pn-table th { text-align: left; font-size: 12px; color: #6B7280; text-transform: uppercase; letter-spacing: .04em; }
table.pn-table tr:last-child td { border-bottom: 0; }

/* Embeds — tidy aspect handling (YouTube, etc.) */
.wp-block-embed.is-type-rich iframe,
.wp-block-video video {
  border-radius: 12px;
}

/* ---------- WooCommerce Blocks polish ---------- */
/* Product gallery rounding (already inside a card) */
.wc-block-components-product-image,
.wc-block-components-product-gallery { border-radius: 12px; overflow: hidden; }

/* Price emphasis */
.pn-sticky-cta-price,
.wc-block-components-product-price__value,
.wc-block-price-filter__amount {
  font-feature-settings: "tnum" 1; /* tabular numbers */
}

/* Add-to-cart buttons: stronger weight (buttons inherit radius from theme.json) */
.wp-block-woocommerce-add-to-cart-form .wp-block-button__link,
.wc-block-components-button,
.wc-block-cart__submit-container .wc-block-components-button {
  font-weight: 800;
}

/* Checkout: step visual rhythm */
.wc-block-checkout__step,
.wc-block-cart-items,
.wc-block-components-totals-wrapper {
  background: #fff; border: 1px solid #e8eef6; border-radius: 16px; padding: 16px; box-shadow: var(--pn-shadow, 0 10px 30px rgba(0,0,0,.06));
  margin-bottom: 14px;
}

/* Form controls: height & radius */
.wc-block-components-text-input input,
.wc-block-components-text-input textarea,
.wc-block-components-select select,
.wc-block-components-address-form input,
input.input-text, textarea, select {
  border-radius: 12px !important;
  min-height: 44px;
}

/* Payment methods — bigger tap targets */
.wc-block-components-radio-control__option {
  padding: 8px 10px; border-radius: 12px;
}
.wc-block-components-radio-control__option:hover {
  background: rgba(37,99,235,.06);
}

/* Totals: subtle separators */
.wc-block-components-totals-item:not(:last-child) {
  border-bottom: 1px dashed #e8eef6;
}

/* Empty cart/checkout messages — center nicely */
.wc-block-cart__empty-cart__title,
.wc-block-components-empty-state__title {
  text-align: center; font-weight: 900;
}

/* Cart table responsive spacing */
.wc-block-cart-items td, .wc-block-cart-items th { padding: 10px; }

/* Notices */
.woocommerce-error, .woocommerce-info, .woocommerce-message {
  border-radius: 12px;
}

/* ---------- Header / Nav tweaks ---------- */
.pn-header .wp-block-navigation__responsive-dialog {
  backdrop-filter: saturate(1.1) blur(8px);
}
.pn-main-nav .wp-block-navigation-item__content {
  padding: 8px 10px; border-radius: 10px;
}
@media (hover:hover){
  .pn-main-nav .wp-block-navigation-item__content:hover {
    background: rgba(37,99,235,.08);
  }
}

/* ---------- Footer polish ---------- */
.pn-footer .wp-block-social-links .wp-block-social-link-anchor { opacity: .9; }
.pn-footer .wp-block-social-links .wp-block-social-link-anchor:hover { opacity: 1; transform: translateY(-1px); }

/* ---------- Mobile bottom nav extras ---------- */
.pn-mobile-nav { /* base in style.css; extras here */ }
.pn-mobile-nav a.pn-mobile-link { transition: background .2s ease, transform .2s ease; }
@media (hover:hover){
  .pn-mobile-nav a.pn-mobile-link:hover { transform: translateY(-1px); }
}

/* ---------- Sticky CTA (product) extras ---------- */
.pn-sticky-cta-wrap {
  box-shadow: 0 -8px 20px rgba(0,0,0,.06);
}

/* ---------- Little shimmer for placeholders (optional utility) ---------- */
.pn-shimmer {
  position: relative; overflow: hidden; background: #eef3fb;
}
.pn-shimmer::after {
  content:""; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,.65) 50%, rgba(255,255,255,0) 100%);
  transform: translateX(-100%); animation: pn-shimmer 1.4s infinite;
}
@keyframes pn-shimmer { 100% { transform: translateX(100%); } }
