/* Reset -------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: var(--sfm-font-body);
    color: var(--sfm-color-body);
    background: var(--sfm-white);
    line-height: 1.6;
    font-size: 15px;
    padding-bottom: var(--sfm-player-height);
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
ul, ol { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, h4, h5, h6 {
    font-family: var(--sfm-font-display);
    color: var(--sfm-color-heading);
    line-height: 1.25;
    margin: 0 0 0.5em;
    font-weight: 600;
}
p { margin: 0 0 1em; }
:lang(ml), .sfm-ml { font-family: var(--sfm-font-malayalam); }

/* Layout --------------------------------------------------------------- */
.sfm-container {
    max-width: var(--sfm-container);
    margin-inline: auto;
    padding-inline: var(--sfm-gutter);
}
.sfm-container--narrow { max-width: var(--sfm-container-narrow); }
.sfm-section { padding-block: 3.5rem; }
.sfm-section + .sfm-section { border-top: 1px solid transparent; }
.sfm-section--muted { background: var(--sfm-bg-blue-50); }
.sfm-section--navy { background: var(--sfm-navy-700); color: rgba(255, 255, 255, 0.85); }
.sfm-section--navy h1, .sfm-section--navy h2, .sfm-section--navy h3 { color: var(--sfm-white); }
.sfm-grid { display: grid; gap: 1.5rem; }
.sfm-flex { display: flex; align-items: center; }
.sfm-flex--between { justify-content: space-between; }
.sfm-flex--wrap { flex-wrap: wrap; }
.sfm-flex--gap-sm { gap: 0.5rem; }
.sfm-flex--gap-md { gap: 1rem; }

@media (min-width: 700px) {
    /* minmax(0, 1fr), not bare 1fr: a bare 1fr track's minimum is its
       content's min-content width (its longest unbreakable word), so a
       card with a longer word than its row-mates gets a wider column at
       their expense. minmax(0, ...) removes that content-based floor so
       every column splits the row equally regardless of what's in it. */
    .sfm-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .sfm-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .sfm-grid--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    .sfm-grid--5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
    .sfm-grid--6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}

/* Section heading pattern ----------------------------------------------- */
.sfm-eyebrow {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--sfm-orange-600);
    margin-bottom: 0.5rem;
}
.sfm-section-head { margin-bottom: 2rem; }
.sfm-section-head__row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}
.sfm-section-title {
    font-size: clamp(1.5rem, 2.5vw, 2.1rem);
    margin: 0;
}
.sfm-section-lede {
    color: var(--sfm-color-body);
    max-width: 46em;
    margin-top: 0.75rem;
}
.sfm-accent { color: var(--sfm-blue-600); }
.sfm-viewall {
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--sfm-blue-600);
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    white-space: nowrap;
}

/* Buttons ---------------------------------------------------------------- */
.sfm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.7rem 1.4rem;
    border-radius: var(--sfm-radius-sm);
    font-weight: 600;
    font-size: 0.9rem;
    border: 2px solid transparent;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
    white-space: nowrap;
}
.sfm-btn--primary { background: var(--sfm-orange-600); color: var(--sfm-white); }
.sfm-btn--primary:hover { background: var(--sfm-orange-700); }
.sfm-btn--outline { background: transparent; border-color: var(--sfm-navy-600); color: var(--sfm-navy-600); }
.sfm-btn--outline:hover { background: var(--sfm-navy-600); color: var(--sfm-white); }
.sfm-btn--outline-light { background: transparent; border-color: rgba(255, 255, 255, 0.6); color: var(--sfm-white); }
.sfm-btn--outline-light:hover { background: rgba(255, 255, 255, 0.15); }
.sfm-btn--sm { padding: 0.45rem 0.9rem; font-size: 0.8rem; }
.sfm-btn--block { width: 100%; }

/* Badges / pills ----------------------------------------------------------- */
.sfm-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.2rem 0.6rem;
    border-radius: var(--sfm-radius-pill);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.sfm-badge--live { background: var(--sfm-orange-600); color: var(--sfm-white); }
.sfm-badge--live::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
}
.sfm-badge--muted { background: var(--sfm-gray-100); color: var(--sfm-gray-700); }
.sfm-badge--category { background: rgba(255, 255, 255, 0.9); color: var(--sfm-navy-700); }
.sfm-pill-tabs { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.sfm-pill-tab {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border-radius: var(--sfm-radius-pill);
    border: 1px solid var(--sfm-color-border);
    background: var(--sfm-white);
    color: var(--sfm-gray-700);
    font-size: 0.85rem;
    font-weight: 600;
}
.sfm-pill-tab.is-active { background: var(--sfm-blue-600); border-color: var(--sfm-blue-600); color: var(--sfm-white); }

/* Cards ------------------------------------------------------------------ */
.sfm-card {
    background: var(--sfm-white);
    border-radius: var(--sfm-radius-md);
    border: 1px solid var(--sfm-color-border);
    overflow: hidden;
}
.sfm-card--shadow { border: none; box-shadow: var(--sfm-shadow-sm); }
.sfm-card__media {
    /* display:block matters here, not just tidiness — this is often an <a>
       or <span>, and aspect-ratio (like width/height) has no effect on a
       plain inline box. It went unnoticed wherever a real <img> was already
       uploaded (an inline replaced element sizes itself from its own
       intrinsic dimensions regardless), which is exactly why it only
       surfaced once generated_artwork() — a non-replaced <span> that relies
       on this element's height for its own 100% sizing — started rendering
       here in the many places nothing had been uploaded yet. */
    display: block;
    position: relative;
    aspect-ratio: 4 / 3;
    background: var(--sfm-bg-blue-50);
    overflow: hidden;
}
.sfm-card__media img, .sfm-card__media .sfm-artwork { width: 100%; height: 100%; object-fit: cover; }
.sfm-card__body { padding: 1rem; }
.sfm-card__title { font-size: 1rem; margin: 0 0 0.25rem; }
.sfm-card__meta { font-size: 0.8rem; color: var(--sfm-gray-400); }

/* Generated placeholder artwork (inc/template-tags.php::generated_artwork())
   — a radio-wave motif behind an icon or a person's initials, standing in
   for a missing photo. The <svg> fills the box; the glyph is a separate
   centered overlay so an icon (already sized by .sfm-icon) and plain
   initials text can share one layout without the SVG's own viewBox scaling
   fighting the icon's real width/height. */
.sfm-artwork {
    /* It's a <span> (inline by default) so width/height from every consuming
       context (.sfm-avatar, .sfm-card__media, etc.) would otherwise be
       silently ignored — inline elements don't size to explicit width/
       height at all, which also starved container-type below of a real
       size to measure, producing wildly oversized initials. */
    display: block;
    position: relative;
    overflow: hidden;
    background: var(--sfm-bg-blue-50);
    container-type: inline-size;
}
.sfm-artwork svg:first-child { position: absolute; inset: 0; width: 100%; height: 100%; }
.sfm-artwork__glyph {
    /* Fills the box so the icon's own width/height percentages (below)
       resolve against the artwork's real pixel size, not this span's
       shrink-to-fit content box. */
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-family: var(--sfm-font-display);
    font-weight: 700;
    letter-spacing: 0.02em;
    /* font-size can't be a % of this element's own box (only of the
       inherited parent font-size), so initials need container query units
       to track the artwork's actual size across every context it's used
       in (a 36px avatar and a 480px card share this same rule). The fixed
       fallback keeps initials legible in browsers without cqw support. */
    font-size: 1.4rem;
    font-size: 38cqw;
}
.sfm-artwork__glyph .sfm-icon { width: 32%; height: 32%; color: #fff; opacity: 0.92; stroke-width: 1.5; }

.sfm-play-dot {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}
.sfm-play-dot > span {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--sfm-navy-700);
    box-shadow: var(--sfm-shadow-md);
}
.sfm-card__media .sfm-badge {
    position: absolute;
    top: 0.6rem;
    left: 0.6rem;
}
.sfm-duration-tag {
    position: absolute;
    left: 0.6rem;
    bottom: 0.6rem;
    background: rgba(11, 31, 58, 0.75);
    color: var(--sfm-white);
    font-size: 0.72rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
}

/* Avatars ------------------------------------------------------------------ */
.sfm-avatar {
    border-radius: 50%;
    overflow: hidden;
    background: var(--sfm-bg-blue-50);
    flex-shrink: 0;
}
.sfm-avatar img, .sfm-avatar .sfm-artwork { width: 100%; height: 100%; object-fit: cover; }
.sfm-avatar .sfm-icon { width: 42%; height: 42%; }

/* Stat / icon tiles --------------------------------------------------------- */
.sfm-stat {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
}
.sfm-stat__icon {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: var(--sfm-bg-blue-50);
    color: var(--sfm-blue-600);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.sfm-stat__value { font-family: var(--sfm-font-display); font-weight: 700; color: var(--sfm-navy-900); font-size: 1.1rem; }
.sfm-stat__label { font-size: 0.78rem; color: var(--sfm-gray-400); }

/* Forms --------------------------------------------------------------------- */
.sfm-field {
    padding: 0.7rem 1rem;
    border-radius: var(--sfm-radius-sm);
    border: 1px solid var(--sfm-color-border);
    font: inherit;
    width: 100%;
    background: var(--sfm-white);
}
.sfm-field:focus { outline: 2px solid var(--sfm-blue-500); outline-offset: 1px; }
.sfm-search { position: relative; }
.sfm-search .sfm-icon { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--sfm-gray-400); }
.sfm-search .sfm-field { padding-left: 2.75rem; }
.sfm-inline-form { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.sfm-inline-form .sfm-field { flex: 1 1 220px; }
.sfm-newsletter-message { font-size: 0.85rem; margin: 0.5rem 0 0; }
.sfm-newsletter-message.is-success { color: var(--sfm-blue-500); }
.sfm-newsletter-message.is-error { color: var(--sfm-orange-600); }

/* Breadcrumb ------------------------------------------------------------------ */
.sfm-breadcrumb { font-size: 0.82rem; color: var(--sfm-gray-400); padding-block: 0.9rem; }
.sfm-breadcrumb a { color: var(--sfm-gray-600); }
.sfm-breadcrumb a:hover { color: var(--sfm-blue-600); }

/* Utility --------------------------------------------------------------------- */
.sfm-hide-mobile { display: none; }
.sfm-hide-desktop { display: block; }
@media (min-width: 960px) {
    .sfm-hide-mobile { display: block; }
    .sfm-hide-desktop { display: none; }
}
.sfm-scroller {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding-bottom: 0.5rem;
}
.sfm-scroller > * { scroll-snap-align: start; flex: 0 0 auto; }
.sfm-scroller::-webkit-scrollbar { height: 6px; }
.sfm-scroller::-webkit-scrollbar-thumb { background: var(--sfm-color-border); border-radius: 3px; }

.sfm-htmx-indicator { display: none; }
.htmx-request .sfm-htmx-indicator { display: inline-flex; }
.sfm-loadmore-wrap { text-align: center; margin-top: 1.75rem; }

@media (max-width: 699px) {
    .sfm-section { padding-block: 2.25rem; }
    .sfm-container { padding-inline: 1.1rem; }
}
