/*
 * superSorterAlgorithmsStyles.css
 * TNT | SuperSorter — Sorting Algorithms Reference
 * Page-specific styles for superSorterAlgorithms.html
 *
 * This file extends:
 *   ../styles/tnt-base-styles.css   — dark navbar, dark footer tokens
 *   styles/superSorterHomeStyles.css — hero, spark-bar, CSS custom properties
 *
 * DO NOT redefine #hero, .spark-bar, or navbar overrides — those rules
 * already live in superSorterHomeStyles.css and must not be duplicated here.
 */

/* ── Main content area ─────────────────────────────────────────────────── */
#mainContent {
    background-color: #f0f7fb;
    padding: 2rem 0;
}

/* ── Family section headings ───────────────────────────────────────────── */
/*
 * .family-heading — large Boogaloo display heading with a coloured left
 * border that signals which algorithm family we are in.
 */
.family-heading {
    font-family: 'Boogaloo', cursive;
    font-size: clamp(1.6rem, 4vw, 2.4rem);
    padding-left: 0.9rem;
    border-left: 5px solid transparent;
    margin-bottom: 0.75rem;
}

/* Swap-and-repeat family — Bootstrap primary blue */
.family-heading.swap     { border-color: #0d6efd; }

/* Pick-and-place family — Bootstrap success green */
.family-heading.place    { border-color: #198754; }

/* Divide-and-conquer family — Bootstrap indigo/purple */
.family-heading.divide   { border-color: #6f42c1; }

/* Heap-based family — amber */
.family-heading.heap     { border-color: #c47b0a; }

/* Adaptive / real-world family — teal */
.family-heading.adaptive { border-color: #0e6d7a; }

/* Absurdist family — muted gray */
.family-heading.absurd   { border-color: #6c757d; }

/* ── Algorithm cards ───────────────────────────────────────────────────── */
.algo-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border-top: 4px solid transparent;   /* coloured strip added by modifier below */
}

/* Top-border colour by family */
.algo-card.swap-family     { border-top-color: #0d6efd; }
.algo-card.place-family    { border-top-color: #198754; }
.algo-card.divide-family   { border-top-color: #6f42c1; }
.algo-card.heap-family     { border-top-color: #c47b0a; }
.algo-card.adaptive-family { border-top-color: #0e6d7a; }
.algo-card.absurd-family   { border-top-color: #6c757d; }

/* ── Key-insight callout ───────────────────────────────────────────────── */
/*
 * Amber left-border box used to highlight the most important take-away
 * in each algorithm section.
 */
.key-insight {
    border-left: 4px solid #E69F4D;
    background-color: rgba(230, 159, 77, 0.10);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
}

.key-insight p:last-child { margin-bottom: 0; }

/* ── Analogy box ───────────────────────────────────────────────────────── */
/*
 * Light-blue tinted box used for real-world analogies that make each
 * algorithm easier to picture.
 */
.analogy-box {
    background-color: rgba(13, 110, 253, 0.06);
    border: 1px solid rgba(13, 110, 253, 0.15);
    border-radius: 8px;
    padding: 0.75rem 1rem;
    margin: 1rem 0;
}

.analogy-box p:last-child { margin-bottom: 0; }

/* ── History blurb ─────────────────────────────────────────────────────── */
/*
 * Italicised, slightly muted paragraph used for the historical context
 * notes at the top of each algorithm section.
 */
.history-blurb {
    font-style: italic;
    font-size: 0.88rem;
    color: #5a6170;
    padding-left: 0.85rem;
    border-left: 2px solid #dee2e6;
    margin-bottom: 1rem;
}

/* ── Big O badges ──────────────────────────────────────────────────────── */
/*
 * Inline monospace chips that display Big O notation inline with prose,
 * styled like a dark code-editor theme so they stand out clearly.
 */
.big-o {
    display: inline-block;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.82rem;
    padding: 0.1rem 0.45rem;
    border-radius: 4px;
    background: #1e1e2e;
    color: #cdd6f4;
    vertical-align: middle;
    white-space: nowrap;
}

/* ── Complexity table ──────────────────────────────────────────────────── */
.complexity-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.complexity-table thead tr {
    background-color: #0a0e1a;
    color: #ffffff;
}

.complexity-table th,
.complexity-table td {
    padding: 0.55rem 0.85rem;
    text-align: left;
    border: 1px solid #dee2e6;
    vertical-align: middle;
}

/* Alternating row shading */
.complexity-table tbody tr:nth-child(even) { background-color: #f8fafc; }
.complexity-table tbody tr:nth-child(odd)  { background-color: #ffffff; }
.complexity-table tbody tr:hover           { background-color: #e8f2fb; }

/* ── Complexity badge pills (in table cells) ───────────────────────────── */
/*
 * Small coloured pill badges used in the Best / Average / Worst columns
 * to make the relative complexity immediately scannable.
 */
.tc-best,
.tc-avg,
.tc-worst,
.tc-special {
    display: inline-block;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.78rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    font-weight: 600;
    white-space: nowrap;
}

.tc-best    { background-color: #d1e7dd; color: #0a3622; }
.tc-avg     { background-color: #fff3cd; color: #5c3a00; }
.tc-worst   { background-color: #f8d7da; color: #58151c; }
.tc-special { background-color: #e2e3e5; color: #383d41; }

/* ── Code panel styles ─────────────────────────────────────────────────── */
/*
 * Styles for the offcanvas language-tab strip and the dark code block.
 */
.code-tabs {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
}

.code-block {
    background: #0d1117;
    color: #e6edf3;
    font-family: 'Courier New', Courier, monospace;
    font-size: 0.82rem;
    border-radius: 8px;
    padding: 1rem;
    overflow-x: auto;
    white-space: pre;
    max-height: 70vh;
    overflow-y: auto;
    border: 1px solid #30363d;
    margin: 0;
    line-height: 1.55;
}

.copy-btn {
    background-color: #c47b0a;
    color: #ffffff;
    border: none;
    font-size: 0.78rem;
    padding: 0.2rem 0.65rem;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}

.copy-btn:hover,
.copy-btn:focus { background-color: #a86608; color: #ffffff; }

/* ── CTA box ───────────────────────────────────────────────────────────── */
/*
 * Dark call-to-action panel at the bottom of the page.
 */
.cta-box {
    max-width: 600px;
    margin: 2rem auto;
    padding: 2.5rem;
    border-radius: 16px;
    background: linear-gradient(135deg, #0a0e1a 0%, #0f1928 60%, #0d1e3a 100%);
    color: #e0eeff;
    border: 1px solid rgba(26, 127, 212, 0.25);
    text-shadow: none;
}

.cta-box .btn-primary {
    background-color: #1a7fd4;
    border-color: #1a7fd4;
    font-weight: 700;
}

.cta-box .btn-primary:hover {
    background-color: #1566b0;
    border-color: #1566b0;
}

/* ── Button width reset ────────────────────────────────────────────────── */
/*
 * A legacy superSorterStyles.css rule sets button { width: 50px; }.
 * Override it so Bootstrap and content determine button widths on this page.
 */
button { width: auto; }
