/* ==========================================================================
   DSA index (/dsa/) — components unique to this page, layered on top of
   listing.css (hero, section) and core.css (chrome + tokens).
   Covers: live band (daily + progress ring + quick browse), pattern grid,
   curated lists, "where to start" cards, and the practice rubric.
   ========================================================================== */

.section-title { font-size: var(--fs-xl); font-weight: 700; color: var(--text); margin-bottom: var(--sp-2); letter-spacing: -0.02em; }
.section-sub { font-size: var(--fs-base); color: var(--text-muted); margin-bottom: var(--sp-5); }

/* --------------------------------------------------------------------------
   Live band — Problem of the Day + personal progress
   -------------------------------------------------------------------------- */
.dsa-live-grid { display: grid; grid-template-columns: 1fr 1.15fr; gap: var(--sp-4); margin-bottom: var(--sp-4); }

.daily-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    background: linear-gradient(135deg, var(--accent-subtle), color-mix(in srgb, var(--accent) 5%, transparent));
    border: 1px solid var(--border-accent);
    border-radius: var(--r-lg);
    padding: var(--sp-5);
    text-decoration: none;
    color: var(--text);
    overflow: hidden;
    transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease),
                box-shadow var(--dur) var(--ease);
}
.daily-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--accent), #a78bfa, #f472b6); }
.daily-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow-lg), var(--glow-accent); }
.daily-tag { font-size: var(--fs-xs); font-weight: 700; color: var(--accent); letter-spacing: 0.02em; }
.daily-title { font-size: var(--fs-xl); font-weight: 800; letter-spacing: -0.02em; line-height: 1.25; }
.daily-meta { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; min-height: 1.4rem; }
.daily-go { margin-top: auto; font-size: var(--fs-sm); font-weight: 600; color: var(--accent); }

/* Difficulty / topic pips used in the daily card and the sign-in prompt */
.qd { font-size: var(--fs-xs); font-weight: 700; padding: 2px 8px; border-radius: var(--r-xs); text-transform: capitalize; }
.qd.easy, .qd.solved { background: color-mix(in srgb, var(--easy) 14%, transparent); color: var(--easy); }
.qd.medium { background: color-mix(in srgb, var(--medium) 14%, transparent); color: var(--medium); }
.qd.hard { background: color-mix(in srgb, var(--hard) 14%, transparent); color: var(--hard); }
.qt { font-size: var(--fs-xs); color: var(--text-dim); background: var(--accent-subtle); border: 1px solid var(--border-accent); padding: 2px 7px; border-radius: var(--r-xs); }

/* Progress card */
.prog-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-5); }
.prog-head { font-size: var(--fs-base); font-weight: 700; margin-bottom: var(--sp-4); color: var(--text); }
.prog-body { display: flex; align-items: center; gap: var(--sp-5); }
.prog-ring { position: relative; width: 120px; height: 120px; flex-shrink: 0; }
.prog-ring-c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.prog-ring-c b { font-size: var(--fs-2xl); font-weight: 800; line-height: 1; color: var(--text); }
.prog-ring-c span { font-size: var(--fs-xs); color: var(--text-dim); }
.prog-side { flex: 1; display: flex; flex-direction: column; gap: var(--sp-2); min-width: 0; }
.db-row { display: flex; align-items: center; gap: var(--sp-3); font-size: var(--fs-sm); }
.db-name { width: 58px; font-weight: 600; }
.db-track { flex: 1; height: 6px; background: var(--surface-3); border-radius: var(--r-full); overflow: hidden; }
.db-fill { height: 100%; border-radius: var(--r-full); transition: width 0.4s var(--ease); }
.db-num { width: 48px; text-align: right; color: var(--text-dim); font-size: var(--fs-xs); }
.prog-streak { margin-top: 0.3rem; font-size: var(--fs-sm); color: var(--text-muted); }
.prog-streak b { color: var(--warning); }
.prog-streak a { color: var(--accent); text-decoration: none; }
.prog-streak a:hover { text-decoration: underline; }
.prog-signin p { font-size: var(--fs-sm); color: var(--text-muted); line-height: 1.55; margin-bottom: var(--sp-4); }
.prog-signin-btn {
    background: var(--accent);
    color: var(--accent-contrast);
    border: none;
    padding: 0.6rem 1.2rem;
    min-height: 44px;
    border-radius: var(--r-md);
    font-size: var(--fs-sm);
    font-weight: 600;
    cursor: pointer;
    transition: transform var(--dur-fast) var(--ease), box-shadow var(--dur-fast) var(--ease);
}
.prog-signin-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-accent); }
.prog-diffs { display: flex; gap: var(--sp-2); margin-top: var(--sp-4); flex-wrap: wrap; }

/* Quick-browse topic pills */
.quick-browse { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.qb-label { font-size: var(--fs-sm); color: var(--text-dim); font-weight: 600; margin-right: 0.2rem; }
.qb-pill {
    font-size: var(--fs-sm);
    color: var(--text-muted);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-full);
    padding: 0.35rem 0.85rem;
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    transition: border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.qb-pill:hover { border-color: var(--accent); color: var(--text); }
.qb-pill em { font-style: normal; color: var(--accent); font-weight: 700; margin-left: 0.25rem; }

/* --------------------------------------------------------------------------
   "Learn the patterns" tile + difficulty chips
   -------------------------------------------------------------------------- */
.dsaf-tile {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    padding: var(--sp-4);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    background: var(--surface);
    text-decoration: none;
    color: var(--text);
    margin-bottom: var(--sp-5);
    transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.dsaf-tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.dsaf-tile svg { width: 22px; height: 22px; color: var(--accent); flex-shrink: 0; }
.dsaf-tile-body { flex: 1; display: flex; flex-direction: column; gap: 0.15rem; }
.dsaf-tile-body strong { font-size: var(--fs-base); }
.dsaf-tile-body span { font-size: var(--fs-sm); color: var(--text-muted); }
.dsaf-tile-arrow { font-size: 1rem; color: var(--text-dim); transition: transform var(--dur) var(--ease), color var(--dur) var(--ease); }
.dsaf-tile:hover .dsaf-tile-arrow { transform: translateX(3px); color: var(--accent); }

.diff-chips { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-bottom: var(--sp-5); }
.diff-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: var(--fs-sm);
    font-weight: 600;
    padding: 0.45rem 0.95rem;
    min-height: 38px;
    border-radius: var(--r-full);
    text-decoration: none;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-muted);
    transition: border-color var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease),
                color var(--dur-fast) var(--ease);
}
.diff-chip:hover { border-color: var(--accent); color: var(--text); transform: translateY(-1px); }
.diff-chip b { font-weight: 800; color: var(--text); }
.diff-chip.easy b { color: var(--easy); }
.diff-chip.medium b { color: var(--medium); }
.diff-chip.hard b { color: var(--hard); }

/* --------------------------------------------------------------------------
   Pattern grid
   -------------------------------------------------------------------------- */
.pattern-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(205px, 1fr)); gap: var(--sp-3); }
.pat-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    min-height: 116px;
    /* Frosted glass over the page mesh — see .surface-card in core.css. This
       card's ::before is already the accent top-bar, so it gets no sheen. */
    background: var(--card-glass);
    backdrop-filter: blur(var(--card-blur));
    -webkit-backdrop-filter: blur(var(--card-blur));
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--sp-4);
    text-decoration: none;
    color: var(--text);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease),
                transform var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}
.pat-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--accent), #a78bfa); opacity: 0; transition: opacity var(--dur) var(--ease); }
.pat-card:hover { background: var(--card-glass-hover); border-color: var(--accent); transform: translateY(-3px); box-shadow: var(--shadow-lg), var(--glow-accent); }
.pat-card:hover::before { opacity: 1; }
.pat-top { display: flex; align-items: center; justify-content: space-between; }
.pat-icon { display: inline-flex; color: var(--accent); }
.pat-icon svg { width: 22px; height: 22px; }
.pat-count { font-size: var(--fs-xs); font-weight: 700; color: var(--accent); background: var(--accent-subtle); border: 1px solid var(--border-accent); padding: 2px 9px; border-radius: var(--r-full); }
.pat-name { font-size: var(--fs-base); font-weight: 700; line-height: 1.25; }
.pat-bar { height: 5px; background: var(--surface-3); border-radius: var(--r-full); overflow: hidden; margin-top: auto; }
.pat-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #a78bfa); border-radius: var(--r-full); width: 0%; transition: width 0.5s var(--ease); }
.pat-solved { font-size: var(--fs-xs); color: var(--text-dim); margin-top: 0.15rem; }
.pat-skeleton {
    min-height: 116px;
    border-radius: var(--r-lg);
    border: 1px solid var(--border);
    background: linear-gradient(100deg, var(--surface) 30%, var(--accent-subtle) 50%, var(--surface) 70%);
    background-size: 200% 100%;
    animation: dsa-shimmer 1.4s linear infinite;
}
@keyframes dsa-shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }

/* --------------------------------------------------------------------------
   "Where to start" cards
   -------------------------------------------------------------------------- */
.start-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--sp-4); }
.start-card {
    display: flex;
    align-items: center;
    gap: var(--sp-4);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--sp-4) var(--sp-5);
    text-decoration: none;
    color: var(--text);
    transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.start-card:hover { border-color: var(--border-accent); transform: translateY(-2px); }
.start-card-body strong { display: block; font-size: var(--fs-base); color: var(--text); margin-bottom: 0.2rem; }
.start-card-body p { font-size: var(--fs-sm); color: var(--text-muted); line-height: 1.5; }
.start-card-time {
    margin-left: auto;
    font-size: var(--fs-xs);
    color: var(--accent);
    background: var(--accent-subtle);
    border: 1px solid var(--border-accent);
    padding: 3px 9px;
    border-radius: var(--r-xs);
    font-weight: 600;
    white-space: nowrap;
}

/* --------------------------------------------------------------------------
   Curated problem lists
   -------------------------------------------------------------------------- */
.lists-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--sp-4); }
.list-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--sp-4);
    text-decoration: none;
    color: var(--text);
    display: flex;
    flex-direction: column;
    transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease),
                box-shadow var(--dur) var(--ease);
}
.list-card:hover { border-color: var(--border-accent); transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.list-card-top { display: flex; justify-content: flex-end; align-items: center; margin-bottom: var(--sp-3); }
.list-badge { font-size: var(--fs-xs); font-weight: 600; padding: 3px 9px; border-radius: var(--r-xs); background: var(--accent-subtle); border: 1px solid var(--border-accent); color: var(--accent); }
.list-card h3 { font-size: var(--fs-md); font-weight: 700; margin-bottom: 0.4rem; color: var(--text); }
.list-card p { font-size: var(--fs-sm); color: var(--text-muted); flex-grow: 1; line-height: 1.55; margin-bottom: var(--sp-3); }
.list-progress { margin-top: auto; }
.list-progress-track { height: 5px; background: var(--surface-3); border-radius: var(--r-full); overflow: hidden; }
.list-progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #a78bfa); border-radius: var(--r-full); width: 0%; transition: width 0.4s var(--ease); }

/* --------------------------------------------------------------------------
   How-to-practice rubric
   -------------------------------------------------------------------------- */
.practice-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: var(--sp-6); }
.practice-card h2 { font-size: var(--fs-lg); font-weight: 700; margin-bottom: var(--sp-5); color: var(--text); letter-spacing: -0.02em; }
.practice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--sp-3); }
.practice-item {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-3);
    padding: var(--sp-3) var(--sp-4);
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    transition: border-color var(--dur) var(--ease);
}
.practice-item:hover { border-color: var(--border-accent); }
.practice-num {
    width: 24px; height: 24px;
    background: var(--accent); color: var(--accent-contrast);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: var(--fs-xs); font-weight: 700;
    flex-shrink: 0; margin-top: 2px;
}
.practice-content strong { display: block; font-size: var(--fs-sm); color: var(--text); margin-bottom: 0.15rem; }
.practice-content span { font-size: var(--fs-sm); color: var(--text-muted); line-height: 1.5; }

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 860px) {
    .dsa-live-grid { grid-template-columns: 1fr; }
    .pattern-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
@media (max-width: 640px) {
    .start-grid, .lists-grid, .practice-grid { grid-template-columns: 1fr; }
    .practice-card { padding: var(--sp-5) var(--sp-4); }
    .prog-body { flex-direction: column; align-items: flex-start; gap: var(--sp-4); }
    .start-card { flex-direction: column; align-items: flex-start; }
    .start-card-time { margin-left: 0; margin-top: var(--sp-2); }
}
