/* CalcSolver article library and study guide pages */

:root {
    --article-bg: #f6f8ff;
    --article-paper: #ffffff;
    --article-ink: #11183f;
    --article-muted: #65708c;
    --article-line: rgba(42, 57, 107, 0.15);
    --article-blue: #315dff;
    --article-teal: #14a8bf;
    --article-orange: #f29a24;
    --article-soft-blue: rgba(49, 93, 255, 0.1);
}

[data-theme="dark"] {
    --article-bg: #101827;
    --article-paper: #162237;
    --article-ink: #f5f7ff;
    --article-muted: #aab4cf;
    --article-line: rgba(208, 218, 255, 0.16);
    --article-soft-blue: rgba(120, 150, 255, 0.16);
}

.articles-shell {
    box-sizing: border-box;
    width: 100%;
    min-height: 100vh;
    padding: 96px 24px 72px;
    background:
        radial-gradient(circle at 1px 1px, rgba(49, 93, 255, 0.1) 1px, transparent 0) 0 0 / 22px 22px,
        linear-gradient(180deg, var(--article-bg) 0%, #ffffff 100%);
}

.articles-shell *,
.articles-shell *::before,
.articles-shell *::after {
    box-sizing: border-box;
}

[data-theme="dark"] .articles-shell {
    background:
        radial-gradient(circle at 1px 1px, rgba(190, 205, 255, 0.1) 1px, transparent 0) 0 0 / 22px 22px,
        linear-gradient(180deg, var(--article-bg) 0%, #0d1320 100%);
}

.articles-container {
    width: min(1140px, 100%);
    margin: 0 auto;
}

.articles-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
    gap: 36px;
    align-items: center;
    margin-bottom: 36px;
}

.articles-hero > *,
.article-card,
.guide-toc,
.guide-article {
    min-width: 0;
}

.article-kicker {
    display: inline-flex;
    width: fit-content;
    min-height: 28px;
    align-items: center;
    padding: 4px 10px;
    border: 1px solid rgba(49, 93, 255, 0.2);
    border-radius: 8px;
    background: var(--article-soft-blue);
    color: var(--article-blue);
    font-size: 0.76rem;
    font-weight: 850;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.articles-hero h1,
.guide-title {
    margin: 12px 0 14px;
    color: var(--article-ink);
    font-size: clamp(2rem, 5vw, 4.35rem);
    line-height: 0.98;
    letter-spacing: 0;
    overflow-wrap: anywhere;
}

.articles-hero p,
.guide-lede {
    max-width: 720px;
    margin: 0;
    color: var(--article-muted);
    font-size: 1.05rem;
    line-height: 1.75;
}

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

.article-button {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    padding: 10px 15px;
    border: 1px solid var(--article-line);
    border-radius: 8px;
    background: var(--article-paper);
    color: var(--article-ink);
    font-weight: 800;
    text-decoration: none;
    transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.article-button.primary {
    border-color: var(--article-blue);
    background: var(--article-blue);
    color: #ffffff;
}

.article-button:hover,
.article-button:focus-visible,
.article-card:hover,
.article-card:focus-visible {
    border-color: rgba(49, 93, 255, 0.55);
    transform: translateY(-2px);
    outline: none;
}

.guide-visual,
.article-cover,
.guide-hero-art {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--article-line);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(255, 255, 255, 0.92), rgba(206, 231, 255, 0.86)),
        var(--article-paper);
    box-shadow: 0 22px 60px rgba(29, 49, 112, 0.12);
}

.guide-visual {
    height: clamp(230px, 24vw, 290px);
}

.guide-visual img,
.article-cover img,
.guide-hero-art img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.article-library-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: end;
    margin: 18px 0 18px;
}

.article-library-head h2 {
    margin: 0;
    color: var(--article-ink);
    font-size: 1.6rem;
}

.article-library-head p {
    max-width: 560px;
    margin: 0;
    color: var(--article-muted);
    line-height: 1.6;
}

.article-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 16px;
}

.article-card {
    display: grid;
    grid-template-rows: 154px auto;
    min-height: 330px;
    border: 1px solid var(--article-line);
    border-radius: 8px;
    background: var(--article-paper);
    color: var(--article-ink);
    text-decoration: none;
    overflow: hidden;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.article-card:hover,
.article-card:focus-visible {
    box-shadow: 0 18px 36px rgba(26, 40, 88, 0.12);
}

.article-cover {
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.article-card-body {
    display: grid;
    align-content: start;
    gap: 10px;
    padding: 18px;
}

.article-tag {
    width: fit-content;
    min-height: 26px;
    padding: 4px 9px;
    border-radius: 8px;
    background: rgba(20, 168, 191, 0.12);
    color: #0f7788;
    font-size: 0.72rem;
    font-weight: 850;
    text-transform: uppercase;
}

[data-theme="dark"] .article-tag {
    color: #76e1ef;
}

.article-card h3 {
    margin: 0;
    color: var(--article-ink);
    font-size: 1.08rem;
    line-height: 1.28;
}

.article-card p {
    margin: 0;
    color: var(--article-muted);
    font-size: 0.92rem;
    line-height: 1.58;
}

.guide-page {
    display: grid;
    grid-template-columns: 240px minmax(0, 820px);
    gap: 28px;
    align-items: start;
}

.guide-toc {
    position: sticky;
    top: 88px;
    display: grid;
    gap: 6px;
    padding: 18px;
    border: 1px solid var(--article-line);
    border-radius: 8px;
    background: var(--article-paper);
}

.guide-toc strong {
    color: var(--article-ink);
    font-size: 0.82rem;
    text-transform: uppercase;
}

.guide-toc a {
    padding: 10px 12px;
    border-radius: 8px;
    color: var(--article-muted);
    text-decoration: none;
    font-size: 0.92rem;
}

.guide-toc a:hover,
.guide-toc a:focus-visible {
    background: var(--article-soft-blue);
    color: var(--article-blue);
    outline: none;
}

.guide-article {
    padding: 30px;
    border: 1px solid var(--article-line);
    border-radius: 8px;
    background: var(--article-paper);
}

.guide-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0 0 18px;
    color: var(--article-muted);
    font-size: 0.88rem;
}

.guide-hero-art {
    height: clamp(240px, 34vw, 360px);
    margin: 22px 0 26px;
}

.guide-article h2 {
    margin: 34px 0 12px;
    color: var(--article-ink);
    font-size: 1.55rem;
    line-height: 1.2;
}

.guide-article h3 {
    margin: 22px 0 8px;
    color: var(--article-ink);
    font-size: 1.12rem;
}

.guide-article p,
.guide-article li {
    color: var(--article-muted);
    line-height: 1.78;
}

.guide-article ul,
.guide-article ol {
    display: grid;
    gap: 8px;
    margin: 0 0 20px 1.25rem;
}

.formula-panel,
.mistake-panel,
.example-panel-article {
    margin: 18px 0;
    padding: 18px;
    border: 1px solid var(--article-line);
    border-radius: 8px;
    background: var(--article-soft-blue);
}

.formula-panel strong,
.mistake-panel strong,
.example-panel-article strong {
    display: block;
    margin-bottom: 8px;
    color: var(--article-ink);
}

.formula-panel code {
    display: block;
    width: fit-content;
    max-width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.82);
    color: var(--article-blue);
    overflow-wrap: anywhere;
}

[data-theme="dark"] .formula-panel code {
    background: rgba(255, 255, 255, 0.08);
}

.guide-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 34px;
    padding-top: 22px;
    border-top: 1px solid var(--article-line);
}

@media (max-width: 1024px) {
    .articles-hero,
    .guide-page {
        grid-template-columns: 1fr;
    }

    .guide-toc {
        position: static;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .guide-toc strong {
        grid-column: 1 / -1;
    }

    .article-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 680px) {
    .articles-shell {
        padding: 82px 14px 48px;
    }

    .article-library-head {
        align-items: start;
        flex-direction: column;
    }

    .article-grid,
    .guide-toc {
        grid-template-columns: 1fr;
    }

    .guide-article {
        padding: 20px 16px;
    }

    .guide-hero-art,
    .guide-visual {
        height: 210px;
    }
}

/* September paper-workbench sync */
:root {
    --article-bg: #f3ead8;
    --article-paper: #fffaf0;
    --article-paper-strong: #fff4d6;
    --article-ink: #22201c;
    --article-muted: #6e6255;
    --article-line: rgba(46, 38, 28, 0.22);
    --article-blue: #2563eb;
    --article-teal: #15803d;
    --article-orange: #d97706;
    --article-soft-blue: rgba(191, 215, 241, 0.76);
    --article-rose: #e8b4b8;
    --article-mint: #bfe6d2;
    --article-soft: #f5dfaf;
    --article-shadow: rgba(82, 55, 24, 0.18);
    --article-sketch-font: "Comic Sans MS", "Comic Relief", "Bradley Hand ITC", cursive;
}

[data-theme="dark"] {
    --article-bg: #15130f;
    --article-paper: #242018;
    --article-paper-strong: #33291a;
    --article-ink: #fff7e7;
    --article-muted: #d7c7ac;
    --article-line: rgba(255, 239, 207, 0.2);
    --article-blue: #93c5fd;
    --article-teal: #86efac;
    --article-orange: #fbbf24;
    --article-soft-blue: #264968;
    --article-rose: #6b2c37;
    --article-mint: #1f5a43;
    --article-soft: #47371f;
    --article-shadow: rgba(0, 0, 0, 0.42);
}

.articles-shell {
    padding-top: 72px;
    background:
        linear-gradient(rgba(255, 250, 240, 0.72) 0 0),
        repeating-linear-gradient(0deg, transparent 0 31px, rgba(54, 43, 30, 0.08) 32px),
        repeating-linear-gradient(90deg, transparent 0 31px, rgba(54, 43, 30, 0.045) 32px),
        var(--article-bg);
}

[data-theme="dark"] .articles-shell {
    background:
        linear-gradient(rgba(21, 19, 15, 0.86) 0 0),
        repeating-linear-gradient(0deg, transparent 0 31px, rgba(255, 239, 207, 0.055) 32px),
        repeating-linear-gradient(90deg, transparent 0 31px, rgba(255, 239, 207, 0.035) 32px),
        var(--article-bg);
}

.articles-hero {
    position: relative;
    padding: 20px 0 8px;
}

.articles-hero::before,
.guide-article::before {
    content: "study notes";
    position: absolute;
    left: 10px;
    top: 0;
    color: var(--article-orange);
    font-family: var(--article-sketch-font);
    font-size: 0.9rem;
    font-weight: 800;
    opacity: 0.72;
    transform: rotate(-6deg);
    pointer-events: none;
}

.articles-hero h1,
.guide-title,
.article-library-head h2,
.guide-article h2,
.guide-article h3,
.article-card h3 {
    font-family: var(--article-sketch-font);
    letter-spacing: 0;
}

.articles-hero h1,
.guide-title {
    max-width: 17ch;
    font-size: clamp(2.15rem, 4.2vw, 3.65rem);
    line-height: 1.04;
}

.guide-title {
    max-width: 20ch;
}

.guide-meta {
    display: none;
}

.article-kicker,
.article-tag {
    border: 2px solid var(--article-ink);
    border-radius: 6px;
    background: var(--article-soft);
    color: var(--article-orange);
    box-shadow: 2px 2px 0 rgba(34, 32, 28, 0.1);
    font-family: var(--article-sketch-font);
    letter-spacing: 0;
    text-transform: none;
}

.article-button {
    border: 2px solid var(--article-ink);
    border-radius: 6px;
    background: var(--article-paper);
    color: var(--article-ink);
    box-shadow: 3px 3px 0 rgba(34, 32, 28, 0.12);
}

.article-button.primary {
    border-color: var(--article-ink);
    background: var(--article-ink);
    color: var(--article-paper);
}

.article-button:hover,
.article-button:focus-visible {
    background: var(--article-orange);
    color: #ffffff;
    box-shadow: 1px 1px 0 rgba(34, 32, 28, 0.18);
    transform: translateY(1px);
}

.guide-visual,
.article-cover,
.guide-hero-art {
    border: 2px solid var(--article-ink);
    border-radius: 8px;
    background:
        linear-gradient(135deg, rgba(255, 244, 214, 0.88), rgba(191, 215, 241, 0.82)),
        var(--article-paper);
    box-shadow: 5px 5px 0 rgba(34, 32, 28, 0.13);
}

.article-card,
.guide-toc,
.guide-article,
.formula-panel,
.mistake-panel,
.example-panel-article {
    border: 2px solid var(--article-ink);
    border-radius: 8px;
    background: var(--article-paper);
    box-shadow: 4px 4px 0 rgba(34, 32, 28, 0.11);
}

.article-card {
    transform: rotate(-0.25deg);
}

.article-card:nth-child(3n + 1) {
    background: var(--article-paper-strong);
}

.article-card:nth-child(3n + 2) {
    background: var(--article-mint);
    transform: rotate(0.35deg);
}

.article-card:nth-child(3n) {
    background: var(--article-soft-blue);
    transform: rotate(-0.15deg);
}

.article-card:hover,
.article-card:focus-visible {
    border-color: var(--article-ink);
    box-shadow: 2px 2px 0 rgba(34, 32, 28, 0.2);
    transform: translateY(2px) rotate(0deg);
}

.article-card .article-cover {
    border-width: 0 0 2px;
    border-radius: 0;
    box-shadow: none;
}

.guide-page {
    grid-template-columns: minmax(210px, 240px) minmax(0, 860px);
}

.guide-toc {
    top: 96px;
    background: var(--article-paper-strong);
}

.guide-toc a {
    border-radius: 6px;
}

.guide-toc a:hover,
.guide-toc a:focus-visible {
    background: var(--article-soft);
    color: var(--article-orange);
}

.guide-article {
    position: relative;
    padding-top: 42px;
    background:
        repeating-linear-gradient(0deg, transparent 0 27px, rgba(46, 38, 28, 0.035) 28px),
        var(--article-paper);
}

.formula-panel,
.mistake-panel,
.example-panel-article {
    background: var(--article-paper-strong);
}

.formula-panel code {
    border: 1px solid var(--article-line);
    background: rgba(255, 250, 240, 0.82);
    color: var(--article-orange);
}

@media (max-width: 1024px) {
    .guide-page {
        grid-template-columns: 1fr;
    }

    .guide-toc {
        top: auto;
    }
}

@media (max-width: 680px) {
    .articles-shell {
        padding-top: 58px;
    }

    .articles-hero {
        padding-top: 24px;
    }

    .articles-hero h1,
    .guide-title {
        max-width: 100%;
        font-size: clamp(1.95rem, 11vw, 2.7rem);
        line-height: 1.05;
    }

    .article-card {
        transform: none;
    }

    .guide-article {
        padding: 38px 16px 20px;
    }
}
