/* ============================================================
   Soofos — Shared component / helper classes
   Ported from Presentation/assets/tokens.css (non-:root section).
   All visual values reference CSS custom properties defined in
   tokens.css (theme root). No hardcoded hex/font/spacing here.
   ============================================================ */

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: var(--body);
  background: var(--page);
  -webkit-font-smoothing: antialiased;
}
a { text-decoration: none; color: inherit; }
button { font-family: var(--font); }
img { max-width: 100%; display: block; }

/* ---------- Checkbox / radio inside a label ----------
   One shared rule: drop the browser's default vertical margin (3px top and
   bottom) that pushes the box off the text centre, never let a flex row
   squash the box, and centre it on inline text. Single-line labels in
   flex rows centre via align-items:center on the label; multi-line rows
   (align-items:flex-start) align the box to the first line. Zero
   specificity (:where) on purpose: any component or plugin rule (Woo,
   FunnelKit, .sfob-radio input …) still sizes and places its own box. */
:where(label > input[type="checkbox"], label > input[type="radio"]) {
  margin-block: 0;
  flex: none;
  vertical-align: middle;
}

/* ---------- Buttons (8px, weight 700-800, soft shadow + hover lift) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: var(--r-btn); cursor: pointer;
  font: 800 14px var(--font); padding: 12px 22px;
  transition: background .15s, border-color .15s, box-shadow .15s, transform .12s;
  text-decoration: none;
}
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--blue); color: var(--on-navy); box-shadow: 0 4px 12px rgba(99,156,224,.35); }
.btn-primary:hover { background: var(--blue-hover); transform: translateY(-2px); box-shadow: 0 7px 18px rgba(99,156,224,.42); }
.btn-primary.lg { padding: 15px 30px; font-size: 16px; }
.btn-buy { background: var(--red); color: var(--on-navy); box-shadow: 0 4px 12px rgba(255,72,89,.32); }
.btn-buy:hover { background: var(--red-hover); transform: translateY(-2px); box-shadow: 0 7px 18px rgba(255,72,89,.4); }
.btn-buy.lg { padding: 15px 30px; font-size: 16px; }
.btn-primary:focus-visible, .btn-buy:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.btn-save { background: var(--green); color: var(--on-navy); box-shadow: 0 4px 12px rgba(34,182,109,.3); }
.btn-save:hover { background: var(--green-hover); transform: translateY(-2px); box-shadow: 0 7px 18px rgba(34,182,109,.38); }
.btn-ghost { background: var(--white); color: var(--ink); border: 2px solid #d7dfea; }
.btn-ghost:hover { border-color: var(--blue); }
.btn-readmore { background: var(--blue-fill); color: var(--deep-blue); }
.btn-readmore:hover { background: #d8e6f7; }
.btn-navy { background: var(--player-dark); color: var(--on-navy); }
.btn-navy:hover { background: var(--ink-soft); }
.btn-sm { padding: 9px 15px; font-size: 13px; }

/* ---------- Entitlement-aware upgrade CTA (parts/upgrade-cta.php) ---------- */
.upgrade-cta { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.upgrade-cta__benefit { margin: 0; font: 600 14px/1.5 var(--font); color: var(--muted); }
.upgrade-cta__arrow { display: inline-flex; }
.upgrade-cta__arrow svg { width: 18px; height: 18px; }
.upgrade-cta__btn:focus-visible { outline: 2px solid var(--deep-blue); outline-offset: 2px; }

/* ---------- Cards ---------- */
.card { background: var(--white); border: 1px solid var(--card-border); border-radius: var(--r-card); overflow: hidden; }
.card-pad { padding: 22px 24px; }

/* ---------- Hover utilities ---------- */
.hov-card { transition: box-shadow .15s, border-color .15s, transform .1s; }
.hov-card:hover { box-shadow: var(--shadow-card); }
.hov-lift:hover { box-shadow: var(--shadow-card); transform: translateY(-2px); }
.hov-blue { transition: border-color .15s, background .15s; }
.hov-blue:hover { border-color: var(--blue); }
.hov-blue-bg:hover { border-color: var(--blue); background: var(--blue-tint); }
.hov-blue-text { transition: color .15s; }
.hov-blue-text:hover { color: var(--blue); }
.hov-tint { transition: background .15s; }
.hov-tint:hover { background: var(--blue-tint); }
.hov-strip:hover { background: var(--strip); }

/* ---------- Pills / chips / badges ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; border-radius: var(--r-pill); font: 800 13px var(--font); padding: 6px 14px; background: var(--blue-fill); color: var(--deep-blue); }
.chip-mono { font: 800 11px var(--mono); background: var(--blue-fill); color: var(--deep-blue); border-radius: var(--r-pill); padding: 3px 9px; }
.badge-amber { font: 900 11px var(--font); color: var(--yellow-ink); background: var(--yellow-fill); border-radius: var(--r-pill); padding: 2px 8px; }
.badge-blue  { font: 900 11px var(--font);   color: var(--deep-blue);  background: var(--blue-fill);  border-radius: var(--r-pill); padding: 2px 7px; }
.badge-green { font: 800 12px var(--font);    color: var(--green-ink);  background: var(--green-fill); border-radius: var(--r-pill); padding: 3px 9px; }

/* category chip helpers (fill + ink), one hue per topic */
.chip-purple{background:var(--purple-fill);color:var(--purple-ink)} .chip-lightblue{background:var(--lightblue-fill);color:var(--lightblue-ink)}
.chip-green{background:var(--green-fill);color:var(--green-ink)} .chip-orange{background:var(--orange-fill);color:var(--orange-ink)}
.chip-blue{background:var(--blue-fill);color:var(--deep-blue)} .chip-yellow{background:var(--yellow-fill);color:var(--yellow-ink)}
.chip-red{background:var(--red-fill);color:var(--red-ink)}

/* ---------- Image placeholder (diagonal stripes, topic-tinted) ---------- */
.ph { background: repeating-linear-gradient(45deg,var(--blue-fill),var(--blue-fill) 8px,var(--blue-tint) 8px,var(--blue-tint) 16px); display: grid; place-items: center; font: 11px var(--mono); color: var(--muted-2); text-align: center; padding: 6px; }
.ph-lg { background: repeating-linear-gradient(45deg,var(--blue-fill),var(--blue-fill) 10px,var(--blue-tint) 10px,var(--blue-tint) 20px); }
.ph-purple{background:repeating-linear-gradient(45deg,var(--purple-fill),var(--purple-fill) 8px,#f7f2ff 8px,#f7f2ff 16px);color:var(--purple-ink)}
.ph-green{background:repeating-linear-gradient(45deg,var(--green-fill),var(--green-fill) 8px,#f2fbf6 8px,#f2fbf6 16px);color:var(--green-ink)}
.ph-orange{background:repeating-linear-gradient(45deg,var(--orange-fill),var(--orange-fill) 8px,#fff6ef 8px,#fff6ef 16px);color:var(--orange-ink)}
.ph-lightblue{background:repeating-linear-gradient(45deg,var(--lightblue-fill),var(--lightblue-fill) 8px,#eefaff 8px,#eefaff 16px);color:var(--lightblue-ink)}
.ph-yellow{background:repeating-linear-gradient(45deg,var(--yellow-fill),var(--yellow-fill) 8px,#fffce8 8px,#fffce8 16px);color:var(--yellow-ink)}

/* ---------- Course card ---------- */
.course-card { background:var(--white); border:1px solid var(--card-border); border-radius:var(--r-card); overflow:hidden; cursor:pointer; }
.course-card:hover { box-shadow: var(--shadow-card); }

/* ---------- Course card: browse-rebuild opt-in elements ----------
 * Opt-in only via card-card.php $args (fit_line, show_link_strip,
 * card_variant). Every existing call site that doesn't pass these args
 * renders none of the markup/selectors below. */

/* card_variant 'browse': lift + border + shadow + thumbnail zoom on hover. */
.course-card.sf-card--browse { transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease; }
.course-card.sf-card--browse .course-card__thumb img { transition: transform .25s ease; }
.course-card.sf-card--browse:hover {
    transform: translateY(-3px);
    border-color: var(--blue);
    box-shadow: var(--shadow-card);
}
.course-card.sf-card--browse:hover .course-card__thumb img { transform: scale(1.025); }

@media (prefers-reduced-motion: reduce) {
    .course-card.sf-card--browse,
    .course-card.sf-card--browse .course-card__thumb img {
        transition: none !important;
    }
    .course-card.sf-card--browse:hover {
        transform: none !important;
    }
    .course-card.sf-card--browse:hover .course-card__thumb img {
        transform: none !important;
    }
}

/* fit_line: short differentiator sentence under the title. Reserves a
 * fixed 2-line height only under the browse variant so grid rows stay
 * aligned regardless of whether a given card's fit_line is short/absent. */
.course-card__fit-line {
    font-size: 12px;
    color: var(--muted);
    line-height: 1.45;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.course-card.sf-card--browse .course-card__fit-line { min-height: calc(11.5px * 1.45 * 2); }

/* show_link_strip: "View course" strip pinned flush to the card's bottom
 * edge, full-bleed against the body's own padding (base padding: 10px 12px,
 * see .course-card__body in shell.css). */
.course-card__link-strip {
    margin: auto -12px -10px;
    padding: 11px 16px;
    border-top: 1px solid var(--card-border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 800;
    color: var(--deep-blue);
    transition: background .15s ease;
}
.course-card.sf-card--browse:hover .course-card__link-strip { background: var(--blue-fill); }

/* ---------- Section helpers ---------- */
.section { padding: 0 64px 44px; }
.h-xl { font-size: 50px; font-weight: 900; color: var(--ink); line-height: 1.1; letter-spacing: -.5px; }
.h-lg { font-size: 24px; font-weight: 800; color: var(--ink); }
.h-md { font-size: 18px; font-weight: 800; color: var(--ink); }
.text-muted { color: var(--muted); }

/* ---------- Outline icon system (soofos_icon() helper) ----------
   One coherent 18–20px stroke family. Icons inherit color via currentColor
   and never carry their own hardcoded color. Base sizing lives here so the
   portal, player, Studio, manager and public surfaces share one grammar. */
.sf-icon {
    flex: none;
    width: 20px;
    height: 20px;
    display: inline-block;
    vertical-align: middle;
    color: inherit;
    stroke: currentColor;
}
.sf-icon--sm { width: 18px; height: 18px; }
.sf-icon--lg { width: 24px; height: 24px; }

.goal-ring { display: grid; place-items: center; border-radius: 50%; }

.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.grow { flex: 1; min-width: 0; }
.ml-auto { margin-left: auto; }
.hidden { display: none !important; }

/* ----------------------------------------------------------------------
 * Global prefers-reduced-motion guard (TASK-073).
 * Components.css is loaded by every logged-in and public surface and is
 * the most upstream place to suppress decorative transitions + transforms
 * for users who request reduced motion at the OS level. Per-page
 * `@keyframes` rules (player.css, path.css, portal-search.css) already
 * have their own scoped guards.
 * -------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .btn,
    .btn-primary,
    .btn-buy,
    .btn-save,
    .btn-ghost,
    .btn-navy,
    .btn-sm,
    .hov-card,
    .hov-lift,
    .hov-blue,
    .hov-blue-bg,
    .hov-blue-text,
    .hov-tint,
    .hov-strip,
    .course-card {
        transition: none !important;
        transform: none !important;
    }
}

/* Visually hidden, still read by screen readers and crawlers (WordPress
   core class name, so core/plugin markup that uses it is covered too). */
.screen-reader-text {
  border: 0;
  clip: rect(1px, 1px, 1px, 1px);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute !important;
  width: 1px;
  word-wrap: normal !important;
}

/* Sloped section edges (.nl Elementor "tilt" shape dividers), shared by every
   public page. Same skewed-pseudo technique as /plans/ and the home page:
   a band of the section's own background is skewed over the neighbour's
   padding. Add `sf-slope` plus `sf-slope--top` and/or `sf-slope--bottom` to a
   full-width section that has its own background; `sf-slope--rev` flips the
   direction. `isolation` keeps the band behind the section's own content and
   in front of the neighbour's background, and pointer-events stay off. */
.sf-slope {
    position: relative;
    isolation: isolate;
    --sf-slope: -1.6deg;
    --sf-slope-h: 56px;
}
.sf-slope--rev { --sf-slope: 1.6deg; }

.sf-slope--top::before,
.sf-slope--bottom::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    z-index: -1;
    height: var(--sf-slope-h);
    background: inherit;
    transform: skewY(var(--sf-slope));
    pointer-events: none;
}
.sf-slope--top::before { top: calc(var(--sf-slope-h) / -2); }
.sf-slope--bottom::after { bottom: calc(var(--sf-slope-h) / -2); }

@media (max-width: 760px) {
    .sf-slope { --sf-slope-h: 28px; }
}

/* Inline icon glyph in stored content (.nl [icon] shortcode, rewritten by
   `wp soofos nl-legacy shortcodes`): a check in lists, red = a negative point. */
.soofos-inline-icon {
    display: inline-block;
    min-width: 1.1em;
    margin-right: 0.35em;
    font-weight: 700;
    line-height: 1;
    color: var(--muted);
}
.soofos-inline-icon--check { color: var(--green-ink); }
.soofos-inline-icon--negative,
.soofos-inline-icon--cross { color: var(--red-ink); }

/* Old WPLMS content shortcodes in stored lessons, rewritten by
   `wp soofos nl-legacy shortcodes`: [note], [pullquote], [divider]. */
.soofos-legacy-note {
    margin: 1em 0;
    padding: 0.9em 1.1em;
    border-left: 3px solid var(--blue);
    border-radius: 6px;
    background: var(--blue-fill);
    color: var(--body);
}
.soofos-legacy-pullquote {
    margin: 1.2em 0;
    padding-left: 1em;
    border-left: 3px solid var(--card-border);
    color: var(--ink);
    font-style: italic;
}
.soofos-legacy-divider {
    margin: 1.5em 0;
    border: 0;
    border-top: 1px solid var(--card-border);
}
