/* ═══════════════════════════════════════════════════════════════
   BrainiaClub — Visual refresh (homepage)
   Adds topic imagery, category grouping, hero topic strip and
   illustrated feature cards. Loaded AFTER styles/polish/popups.
   Remove this file + js/pages/home-visuals.js to roll back.
   ═══════════════════════════════════════════════════════════════ */

/* ── Topic grid ─────────────────────────────────────────────── */
.topics-grid.tv-ready {
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 22px;
}

/* Category headings that span the whole grid row */
.tv-group-head {
    grid-column: 1 / -1;
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0 -4px;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--primary-dark);
}
.tv-group-head:first-child { margin-top: 0; }
.tv-group-head .tv-gh-icon {
    width: 34px; height: 34px;
    display: inline-grid; place-items: center;
    border-radius: 10px;
    background: var(--primary-accent);
    color: #fff;
    font-size: 0.9rem;
}
.tv-group-head .tv-gh-count {
    font-size: 0.78rem;
    font-weight: 500;
    opacity: 0.6;
}
.tv-group-head::after {
    content: "";
    flex: 1;
    height: 1px;
    background: currentColor;
    opacity: 0.12;
}
body.dark-mode .tv-group-head { color: var(--text-dark); }

/* Image topic card */
.topic-card.tv-card {
    padding: 0;
    overflow: hidden;
    text-align: left;
    display: flex;
    flex-direction: column;
    animation: none;               /* calmer grid: no floating */
}
.topic-card.tv-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--neumorphic-shadow), 0 14px 30px rgba(15, 30, 58, 0.18);
}
.tv-media {
    position: relative;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--primary-accent);
}
.tv-media img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.6s ease;
}
.topic-card.tv-card:hover .tv-media img { transform: scale(1.06); }
.tv-media::after {
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(15,30,58,0) 45%, rgba(15,30,58,0.55) 100%);
}
.tv-body {
    position: relative;
    padding: 26px 16px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex: 1;
}
.tv-badge {
    position: absolute;
    top: -21px; left: 16px;
    width: 42px; height: 42px;
    display: grid; place-items: center;
    border-radius: 12px;
    background: var(--primary-accent);
    border: 3px solid var(--primary-bg);
    box-shadow: 0 4px 10px rgba(0,0,0,0.18);
}
.topic-card.tv-card .tv-badge i {
    font-size: 1.05rem;
    margin: 0;
    color: #fff;
}
.topic-card.tv-card h3 {
    font-size: 1.05rem;
    margin: 0;
    color: var(--primary-dark);
}
body.dark-mode .topic-card.tv-card h3 { color: var(--text-dark); }
.topic-card.tv-card .tc-progress-label {
    font-size: 0.76rem;
    opacity: 0.7;
}
.tv-bar {
    height: 5px;
    border-radius: 999px;
    background: rgba(27, 50, 94, 0.12);
    overflow: hidden;
    margin-top: auto;
}
body.dark-mode .tv-bar { background: rgba(255, 255, 255, 0.1); }
.tv-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #4f7df0, var(--primary-accent));
}

/* ── Hero topic strip ───────────────────────────────────────── */
.hero-topic-strip {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 26px;
    flex-wrap: wrap;
}
.hts-avatars { display: flex; }
.hts-avatars img {
    width: 44px; height: 44px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary-bg);
    box-shadow: 0 3px 8px rgba(0,0,0,0.15);
    margin-left: -12px;
    transition: transform 0.25s ease;
}
.hts-avatars img:first-child { margin-left: 0; }
.hts-avatars img:hover { transform: translateY(-3px); }
.hts-text { margin: 0; font-size: 0.88rem; opacity: 0.85; }
.hts-text strong { color: var(--primary-accent); }
body.dark-mode .hts-text strong { color: #8fb0ff; }

/* ── Feature cards with imagery ─────────────────────────────── */
.feature-card.tv-feature {
    padding: 0;
    overflow: hidden;
    text-align: left;
    display: flex;
    flex-direction: column;
}
.fc-media {
    position: relative;
    aspect-ratio: 16 / 9;
    overflow: hidden;
}
.fc-media > img {
    width: 100%; height: 100%;
    object-fit: cover; display: block;
    transition: transform 0.6s ease;
}
.feature-card.tv-feature:hover .fc-media img { transform: scale(1.05); }
.fc-media::after {
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(180deg, rgba(15,30,58,0) 50%, rgba(15,30,58,0.5) 100%);
    pointer-events: none;
}
.fc-mosaic {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 3px;
    height: 100%;
}
.fc-mosaic img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fc-body {
    position: relative;
    padding: 30px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex: 1;
}
.feature-card.tv-feature .feature-icon {
    position: absolute;
    top: -24px; left: 24px;
    width: 48px; height: 48px;
    display: grid; place-items: center;
    margin: 0;
    font-size: 1.2rem;
    color: #fff;
    background: var(--primary-accent);
    border-radius: 14px;
    border: 3px solid var(--primary-bg);
    box-shadow: 0 4px 10px rgba(0,0,0,0.18);
}
.feature-card.tv-feature .feature-title { margin: 0; }
.feature-card.tv-feature .fc-link { margin-top: auto; padding-top: 6px; }

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
    .topics-grid.tv-ready { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 16px; }
}
@media (max-width: 520px) {
    .topics-grid.tv-ready { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .tv-body { padding: 22px 12px 12px; }
    .tv-badge { width: 36px; height: 36px; top: -18px; left: 12px; border-radius: 10px; }
    .topic-card.tv-card .tv-badge i { font-size: 0.9rem; }
    .topic-card.tv-card h3 { font-size: 0.95rem; }
    @media (prefers-reduced-motion: reduce) {
    .tv-media img, .fc-media > img, .hts-avatars img { transition: none; }
}
}   /* closes the 520px block above (its brace was missing) */

/* ── Topic board: category panels (bento layout) ─────────────────
   home-visuals.js wraps each category in a .tv-panel and sizes it
   (--tv-span columns of a 5-column board) so every row is full. */
.topics-grid.tv-bento {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 22px;
    align-items: stretch;
}
.tv-panel {
    grid-column: span var(--tv-span, 5);
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-width: 0;
    padding: 18px 18px 20px;
    border-radius: 26px;
    background: linear-gradient(160deg, rgba(79, 125, 240, 0.07), rgba(27, 50, 94, 0.03));
    border: 1px solid rgba(27, 50, 94, 0.08);
}
body.dark-mode .tv-panel {
    background: linear-gradient(160deg, rgba(120, 150, 255, 0.07), rgba(255, 255, 255, 0.02));
    border-color: rgba(255, 255, 255, 0.06);
}
.tv-panel .tv-group-head { margin: 0; grid-column: auto; }
.tv-panel-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(var(--tv-span, 5), minmax(0, 1fr));
    grid-auto-flow: row dense;
    gap: 16px;
}

/* Feature tile: the first topic of a bigger category */
.topic-card.tv-card.tv-hero--big  { grid-column: span 2; grid-row: span 2; }
.topic-card.tv-card.tv-hero--tall { grid-row: span 2; }
.topic-card.tv-card.tv-hero {
    position: relative;
    justify-content: flex-end;
    min-height: 260px;
}
.tv-hero .tv-media {
    position: absolute;
    inset: 0;
    aspect-ratio: auto;
}
.tv-hero .tv-media::after {
    background: linear-gradient(180deg, rgba(10, 20, 42, 0) 35%, rgba(10, 20, 42, 0.88) 100%);
}
.tv-hero .tv-body {
    flex: 0 0 auto;
    padding: 28px 22px 22px;
    color: #fff;
}
.topic-card.tv-card.tv-hero h3,
body.dark-mode .topic-card.tv-card.tv-hero h3 { color: #fff; font-size: 1.45rem; }
.topic-card.tv-card.tv-hero--tall h3 { font-size: 1.25rem; }
.tv-hero .tc-progress-label { opacity: 0.85; }
.tv-hero .tv-badge { position: static; margin-bottom: 4px; border-color: rgba(255, 255, 255, 0.25); }
.tv-hero .tv-bar { background: rgba(255, 255, 255, 0.22); margin-top: 6px; }

/* One category shown on its own (filter chip) → full width */
.topics-grid.tv-bento.tv-solo .tv-panel { grid-column: 1 / -1; }
.topics-grid.tv-bento.tv-solo .tv-panel-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }

@media (max-width: 1100px) {
    .topics-grid.tv-bento { gap: 16px; }
    .tv-panel { padding: 14px; border-radius: 22px; }
    .tv-panel-grid { gap: 12px; }
}
@media (max-width: 900px) {
    .topics-grid.tv-bento { grid-template-columns: minmax(0, 1fr); }
    .tv-panel { grid-column: 1 / -1; }
    .tv-panel-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}
@media (max-width: 520px) {
    .tv-panel { padding: 12px; }
    .tv-panel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .topic-card.tv-card.tv-hero { min-height: 220px; }
    .topic-card.tv-card.tv-hero h3 { font-size: 1.15rem; }
    .tv-hero .tv-body { padding: 18px 14px 14px; }
    .topic-card.tv-card.tv-wide-sm { grid-column: span 2; }
    .tv-wide-sm .tv-media { aspect-ratio: 16 / 7; }
}

/* ── Photo topic cards (admin Overview look) ─────────────────────
   Full-bleed picture with a dark fade; icon chip + progress ring on
   top; name, levels and progress at the bottom. */
.topic-card.tv-card.tv-photo {
    position: relative;
    isolation: isolate;
    justify-content: space-between;
    min-height: 196px;
    padding: 0;
    border-radius: 24px;
    color: #fff;
    background: #1b2236;
    border: none;
    box-shadow: 0 16px 30px -20px rgba(0, 0, 0, 0.75);
}
.topic-card.tv-card.tv-photo:hover {
    transform: translateY(-4px);
    box-shadow: 0 24px 38px -20px rgba(0, 0, 0, 0.85);
}
.topic-card.tv-card.tv-photo:focus-visible { outline: 2px solid var(--primary-accent); outline-offset: 3px; }
.tv-photo .tv-media {
    position: absolute;
    inset: 0;
    z-index: -1;
    aspect-ratio: auto;
    background: #1b2236;
}
.tv-photo .tv-media img { width: 100%; height: 100%; object-fit: cover; }
.tv-photo .tv-media::after,
.tv-hero.tv-photo .tv-media::after {
    background: linear-gradient(180deg, rgba(12, 16, 28, 0.28) 0%, rgba(12, 16, 28, 0.5) 45%, rgba(12, 16, 28, 0.92) 100%);
}
.tv-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 14px 14px 0;
}
.topic-card.tv-card.tv-photo .tv-badge,
.tv-hero.tv-photo .tv-badge {
    position: static;
    width: 34px; height: 34px;
    margin: 0;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(12, 16, 28, 0.55);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    box-shadow: none;
}
.topic-card.tv-card.tv-photo .tv-badge i { font-size: 0.85rem; color: #fff; }
.tv-ring {
    --p: 0;
    position: relative;
    width: 44px; height: 44px;
    flex: none;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: conic-gradient(#f4f4f5 calc(var(--p) * 1%), rgba(255, 255, 255, 0.22) 0);
}
.tv-ring::before {
    content: "";
    position: absolute;
    inset: 4px;
    border-radius: 50%;
    background: rgba(12, 16, 28, 0.85);
}
.tv-ring > span {
    position: relative;
    font-size: 10.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: #fff;
}
.topic-card.tv-card.tv-photo .tv-body,
.tv-hero.tv-photo .tv-body {
    flex: 0 0 auto;
    padding: 0 16px 16px;
    gap: 4px;
    color: #fff;
}
.topic-card.tv-card.tv-photo h3,
body.dark-mode .topic-card.tv-card.tv-photo h3 {
    color: #fff;
    font-size: 1.05rem;
    font-weight: 650;
    letter-spacing: -0.01em;
    text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}
.tv-meta { font-size: 0.75rem; color: #d4d6dd; }
.topic-card.tv-card.tv-photo .tc-progress-label { display: inline; margin: 0; font-size: inherit; opacity: 1; color: inherit; }
.tv-meta { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topic-card.tv-card.tv-photo .tv-bar,
body.dark-mode .topic-card.tv-card.tv-photo .tv-bar {
    height: 4px;
    margin-top: 8px;
    background: rgba(255, 255, 255, 0.18);
}
.topic-card.tv-card.tv-photo .tv-bar span { background: #f4f4f5; }

/* Feature tiles keep their bigger title */
.topic-card.tv-card.tv-photo.tv-hero h3 { font-size: 1.5rem; }
.topic-card.tv-card.tv-photo.tv-hero--tall h3 { font-size: 1.25rem; }
.tv-hero.tv-photo .tv-ring { width: 54px; height: 54px; }
.tv-hero.tv-photo .tv-ring > span { font-size: 12px; }

@media (max-width: 520px) {
    .topic-card.tv-card.tv-photo { min-height: 168px; border-radius: 20px; }
    .tv-top { padding: 10px 10px 0; }
    .topic-card.tv-card.tv-photo .tv-badge { width: 30px; height: 30px; }
    .tv-ring { width: 38px; height: 38px; }
    .tv-ring > span { font-size: 9.5px; }
    .topic-card.tv-card.tv-photo .tv-body { padding: 0 12px 12px; }
    .topic-card.tv-card.tv-photo h3 { font-size: 0.95rem; }
    .tv-meta { font-size: 0.7rem; }
    .topic-card.tv-card.tv-photo.tv-hero h3 { font-size: 1.2rem; }
}
@media (prefers-reduced-motion: reduce) {
    .topic-card.tv-card.tv-photo:hover { transform: none; }
}

/* ── Hero headline ("Master every topic, one level at a time") ──
   Small brand chip, tighter display type, an animated navy→blue→gold
   gradient on the second line and a gold swash underneath. */
.hero-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 14px;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--primary-accent);
    background: rgba(255, 255, 255, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.7);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}
body.dark-mode .hero-eyebrow {
    color: #c7d7ff;
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.1);
}
.hero-eyebrow-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f5b042, #ffd27a);
    box-shadow: 0 0 0 4px rgba(245, 176, 66, 0.2);
}
.hero h1#heroHeading {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: clamp(2rem, 4.4vw, 3.3rem);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.035em;
    margin-bottom: 20px;
}
.hero h1 .hero-h1-top { color: var(--primary-dark); }
body.dark-mode .hero h1 .hero-h1-top { color: #eef2fb; }
.hero h1 .hero-h1-accent {
    position: relative;
    width: fit-content;
    padding-bottom: 10px;
    background: linear-gradient(100deg, #1B325E 0%, #2f5bc4 30%, #5b8cf0 50%, #2f5bc4 70%, #1B325E 100%);
    background-size: 220% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: hero-sheen 9s ease-in-out infinite;
}
body.dark-mode .hero h1 .hero-h1-accent {
    background-image: linear-gradient(100deg, #8fb0ff 0%, #b9cdff 30%, #ffffff 50%, #b9cdff 70%, #8fb0ff 100%);
}
.hero h1 .hero-h1-accent::after {               /* gold swash */
    content: "";
    position: absolute;
    left: 2px;
    bottom: 0;
    width: 46%;
    height: 5px;
    border-radius: 999px;
    background: linear-gradient(90deg, #f5b042, rgba(245, 176, 66, 0));
}
@keyframes hero-sheen {
    0%, 100% { background-position: 0% 50%; }
    50%      { background-position: 100% 50%; }
}
@media (max-width: 900px) {          /* hero is centred here */
    .hero h1#heroHeading { align-items: center; }
    .hero h1 .hero-h1-accent::after { left: 27%; }
}
@media (max-width: 480px) {
    .hero-eyebrow { font-size: 0.66rem; padding: 5px 12px; margin-bottom: 10px; }
    .hero h1 .hero-h1-accent { padding-bottom: 8px; }
    .hero h1 .hero-h1-accent::after { height: 4px; }
}
@media (prefers-reduced-motion: reduce) {
    .hero h1 .hero-h1-accent { animation: none; }
}
