/* Hub and progress pages. */

body.site {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(1100px 560px at 78% -8%, rgba(34, 211, 238, 0.11), transparent 62%),
        radial-gradient(900px 520px at -4% 12%, rgba(249, 115, 22, 0.07), transparent 60%),
        linear-gradient(rgba(148, 163, 184, 0.04) 1px, transparent 1px) 0 0 / 64px 64px,
        linear-gradient(90deg, rgba(148, 163, 184, 0.04) 1px, transparent 1px) 0 0 / 64px 64px,
        var(--bg);
    background-attachment: fixed;
}

.wrap {
    width: min(1240px, 100% - 48px);
    margin-inline: auto;
}

main.wrap {
    flex: 1;
}

/* ===== Header ===== */
.site-head {
    position: sticky;
    top: 0;
    z-index: 20;
    background: rgba(6, 9, 18, 0.8);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(10px);
}

.site-head .wrap {
    display: flex;
    align-items: center;
    gap: 28px;
    height: 60px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--ink);
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    text-decoration: none;
}

.brand-mark {
    width: 28px;
    height: 28px;
    color: var(--accent);
}

.site-nav {
    display: flex;
    gap: 24px;
    margin-right: auto;
}

.site-nav a {
    color: var(--ink-2);
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-decoration: none;
}

.site-nav a:hover,
.site-nav a.is-here {
    color: var(--ink);
}

.site-nav a.is-here {
    box-shadow: 0 2px 0 var(--accent);
}

/* ===== Hero ===== */
.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
    gap: 44px;
    align-items: center;
    padding: 60px 0 44px;
}

.hero h1 {
    margin-top: 10px;
    font-size: clamp(2.6rem, 5.2vw, 4.5rem);
    line-height: 0.98;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.hero h1 em {
    font-style: normal;
    color: var(--accent);
}

.lede {
    max-width: 33em;
    margin-top: 18px;
    font-size: 1.3rem;
    color: var(--ink-2);
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

.btn-lg {
    padding: 0.85rem 1.5rem;
    font-size: 1.06rem;
}

.hero-facts {
    display: flex;
    flex-wrap: wrap;
    gap: 30px;
    margin: 30px 0 0;
    padding: 0;
    list-style: none;
    color: var(--ink-3);
}

.hero-facts b {
    display: block;
    font-size: 1.5rem;
    line-height: 1.15;
    color: var(--ink);
}

/* ===== Profile card ===== */
.profile-card {
    padding: 22px 24px;
    background: linear-gradient(180deg, #121c31, #0c1322);
    border: 1px solid var(--line-2);
    border-radius: 18px;
    box-shadow: var(--shadow);
}

.profile-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
}

.profile-label {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-3);
}

.profile-score {
    font-size: 4rem;
    font-weight: 700;
    line-height: 0.95;
}

.profile-score small {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--ink-3);
}

.profile-rank {
    text-align: right;
}

.profile-rank .rank {
    font-size: 1.35rem;
}

.profile-note {
    margin-top: 6px;
    font-size: 0.95rem;
    color: var(--ink-3);
}

.skills {
    display: grid;
    gap: 11px;
    margin: 20px 0 18px;
}

.skill {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr) 34px 124px;
    align-items: center;
    gap: 12px;
}

.skill-name {
    font-weight: 700;
}

.skill-value {
    font-weight: 700;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.skill .rank {
    font-size: 0.85rem;
}

.profile-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.profile-stat b {
    display: block;
    font-size: 1.3rem;
    line-height: 1.15;
}

.profile-stat span {
    font-size: 0.82rem;
    color: var(--ink-3);
}

.profile-more {
    display: inline-block;
    margin-top: 14px;
    color: var(--accent);
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    font-size: 0.88rem;
    text-decoration: none;
}

.profile-more:hover {
    text-decoration: underline;
}

/* ===== Today's challenge ===== */
.today {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 14px 36px;
    margin: 12px 0 4px;
    padding: 20px 24px;
    background:
        radial-gradient(520px 180px at 0% 0%, rgba(249, 115, 22, 0.12), transparent 70%),
        var(--surface);
    border: 1px solid rgba(249, 115, 22, 0.35);
    border-radius: 16px;
    scroll-margin-top: 70px;
}

.today .eyebrow {
    color: var(--hot);
}

.today h2 {
    margin-top: 4px;
    font-size: 2rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.today p {
    margin-top: 4px;
    color: var(--ink-2);
}

.today-side {
    display: grid;
    justify-items: center;
    gap: 8px;
}

.today-week {
    display: flex;
    gap: 6px;
}

.today-day {
    display: grid;
    justify-items: center;
    gap: 7px;
    width: 42px;
    padding: 6px 0 9px;
    border: 1px solid var(--line);
    border-radius: 9px;
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-3);
}

.today-day.is-today {
    border-color: rgba(249, 115, 22, 0.7);
    color: var(--ink);
}

/* A day missed: the gem is an empty outline, as for an unranked drill */
.today-day:not(.is-played) .rank-gem {
    background: transparent;
    border: 1.5px solid var(--ink-3);
    box-shadow: none;
}

.today-streak {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--ink-3);
}

.today-act {
    display: grid;
    justify-items: end;
    gap: 8px;
}

.today-done {
    display: flex;
    align-items: baseline;
    gap: 12px;
}

.today-done b {
    font-size: 2.2rem;
    line-height: 1;
}

@media (max-width: 980px) {
    .today {
        grid-template-columns: 1fr;
    }

    .today-side,
    .today-act {
        justify-items: start;
    }
}

/* ===== Sections ===== */
.section {
    padding: 36px 0;
    scroll-margin-top: 70px;
}

.section-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 6px;
}

.section-head h2 {
    font-size: 2.1rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.section-head p {
    color: var(--ink-3);
}

/* Categories sit side by side on a four-column grid, each as wide as the
   number of drills it holds, so short categories share a row. */
#drillList {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 26px 14px;
    margin-top: 20px;
}

.category {
    grid-column: span var(--span, 4);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.category-head {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: baseline;
    gap: 2px 12px;
    margin-bottom: 12px;
}

.category-head h3 {
    font-size: 1.2rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.category-blurb {
    grid-column: 1 / -1;
    grid-row: 2;
    min-height: 2.9em;
    color: var(--ink-3);
}

/* ===== Drill cards ===== */
.drill-grid {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(var(--span, 4), minmax(0, 1fr));
    gap: 14px;
}

.drill-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    color: inherit;
    text-decoration: none;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.drill-card:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.45);
}

.drill-thumb {
    position: relative;
    aspect-ratio: 16 / 9;
    background: #070b14;
}

.drill-thumb canvas {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
}

.drill-thumb::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(16, 24, 40, 0.92), rgba(16, 24, 40, 0) 42%);
}

.drill-time {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 1;
    padding: 0.05rem 0.55rem;
    border: 1px solid var(--line-2);
    border-radius: 999px;
    background: rgba(6, 9, 18, 0.8);
    font-size: 0.82rem;
    font-weight: 700;
}

.drill-play {
    position: absolute;
    left: 14px;
    bottom: 10px;
    z-index: 1;
    padding: 0.2rem 0.75rem;
    border-radius: 8px;
    background: var(--accent);
    color: var(--accent-ink);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 0.15s, transform 0.15s;
}

.drill-card:hover .drill-play,
.drill-card:focus-visible .drill-play {
    opacity: 1;
    transform: none;
}

.drill-body {
    display: grid;
    gap: 4px;
    padding: 12px 14px 14px;
}

.drill-name {
    font-size: 1.4rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    line-height: 1.1;
    text-transform: uppercase;
}

.drill-tag {
    min-height: 2.9em;
    color: var(--ink-2);
}

.drill-foot {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 10px;
    margin-top: 6px;
    padding-top: 10px;
    border-top: 1px solid var(--line);
}

.drill-best-label {
    font-size: 0.78rem;
    color: var(--ink-3);
}

.drill-best-value {
    font-size: 1.3rem;
    font-weight: 700;
    line-height: 1.1;
}

.drill-foot .rank {
    font-size: 0.85rem;
}

.drill-trend {
    display: grid;
    justify-items: end;
    gap: 2px;
}

/* ===== Routine and free-play cards ===== */
.routine-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(285px, 1fr));
    gap: 14px;
    margin-top: 16px;
}

.routine-card,
.free-card {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 18px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 14px;
    color: inherit;
    text-decoration: none;
    transition: border-color 0.15s, transform 0.15s;
}

.routine-card:hover,
.free-card:hover {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.routine-card h3,
.free-card h3 {
    font-size: 1.4rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.routine-card p,
.free-card p {
    color: var(--ink-2);
}

.routine-steps-list {
    margin: 2px 0 0;
    padding: 0 0 0 1.25rem;
    color: var(--ink-3);
    font-size: 0.95rem;
}

.routine-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--line);
    font-size: 0.9rem;
    color: var(--ink-3);
}

.routine-meta b {
    color: var(--ink);
}

/* Free play keeps a tally, not a score: one line of it above the link. */
.free-meta {
    display: grid;
    gap: 6px;
    margin-top: auto;
    padding-top: 10px;
    border-top: 1px solid var(--line);
    font-size: 0.9rem;
    color: var(--ink-3);
}

/* "Done" on a lesson card */
.lesson-state {
    margin-left: 10px;
    padding: 0.02rem 0.55rem;
    border: 1px solid rgba(74, 222, 128, 0.55);
    border-radius: 999px;
    background: rgba(74, 222, 128, 0.1);
    color: var(--ink);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.free-go,
.routine-go {
    color: var(--accent);
    font-size: 0.88rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

/* ===== Footer ===== */
.site-foot {
    margin-top: 28px;
    padding: 20px 0;
    border-top: 1px solid var(--line);
    color: var(--ink-3);
    font-size: 0.9rem;
}

.site-foot .wrap {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.site-foot a {
    color: var(--ink-2);
}

/* ===== Progress page ===== */
.page-head {
    padding: 40px 0 8px;
}

.page-head h1 {
    margin-top: 6px;
    font-size: 2.8rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.page-head p {
    margin-top: 6px;
    color: var(--ink-3);
}

.kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 12px;
    margin-top: 22px;
}

.kpis .tile-stat-value {
    font-size: 2rem;
}

.kpi-hero .tile-stat-value {
    font-size: 3.2rem;
    line-height: 1;
}

.panels {
    display: grid;
    grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
    gap: 14px;
    margin-top: 14px;
}

.panel {
    padding: 16px 18px;
    min-width: 0;
}

.panel h2 {
    margin-bottom: 10px;
    font-size: 1.1rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.panel .skills {
    margin: 4px 0 0;
}

.drill-table {
    width: 100%;
    border-collapse: collapse;
}

.drill-table th,
.drill-table td {
    padding: 0.5rem 0.7rem;
    text-align: right;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.drill-table th {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-3);
}

.drill-table th:first-child,
.drill-table td:first-child,
.drill-table th:nth-child(2),
.drill-table td:nth-child(2),
.drill-table th:nth-child(3),
.drill-table td:nth-child(3) {
    text-align: left;
}

.drill-table td {
    font-variant-numeric: tabular-nums;
}

.drill-table tbody tr {
    cursor: pointer;
}

.drill-table tbody tr:hover,
.drill-table tbody tr.is-open {
    background: rgba(34, 211, 238, 0.06);
}

.drill-table .rank {
    font-size: 0.85rem;
}

.drill-table-name {
    font-weight: 700;
}

.drill-table .muted {
    color: var(--ink-3);
}

.table-wrap {
    overflow-x: auto;
}

.detail {
    display: grid;
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.7fr);
    gap: 18px;
    align-items: start;
    margin-top: 14px;
}

.detail-side {
    display: grid;
    gap: 10px;
}

.detail-side h3 {
    font-size: 1.5rem;
    text-transform: uppercase;
}

.detail-side p {
    color: var(--ink-2);
}

.detail-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.empty-state {
    padding: 40px 20px;
    text-align: center;
    color: var(--ink-3);
}

.empty-state .btn {
    margin-top: 14px;
}

@media (max-width: 1120px) {
    #drillList {
        grid-template-columns: 1fr;
    }

    .category {
        grid-column: 1;
    }

    .category-blurb {
        min-height: 0;
    }

    .drill-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }
}

@media (max-width: 980px) {
    .hero,
    .panels,
    .detail {
        grid-template-columns: 1fr;
    }

    .site-nav {
        display: none;
    }

    .site-head .wrap {
        justify-content: space-between;
    }
}

@media (max-width: 520px) {
    .skill {
        grid-template-columns: 80px minmax(0, 1fr) 30px;
    }

    .skill .rank {
        display: none;
    }

    .profile-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}
