/* ============================================================
   Chemistry Made Easy — Global Stylesheet
   ============================================================ */

/* ── Google Font ─────────────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── CSS Variables ───────────────────────────────────────── */
:root {
    /* Core palette */
    --color-navy: #0f172a;
    --color-teal: #14b8a6;
    --color-white: #ffffff;
    --color-light-gray: #f1f5f9;

    /* Derived / utility colours */
    --color-teal-dark: #0d9488;
    --color-teal-light: #5eead4;
    --color-navy-light: #1e293b;
    --color-text: #334155;
    --color-text-muted: #64748b;

    /* Typography */
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;

    /* Spacing scale */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;
    --space-2xl: 3rem;
    --space-3xl: 4rem;

    /* Sizing */
    --nav-height: 72px;
    --max-width: 1200px;

    /* Borders & effects */
    --radius-sm: 0.375rem;
    --radius-md: 0.75rem;
    --radius-lg: 1rem;
    --radius-xl: 1.5rem;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);

    /* Transitions */
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ── Reset & Base ────────────────────────────────────────── */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    scroll-padding-top: var(--nav-height);
}

body {
    font-family: var(--font-family);
    font-size: 1rem;
    line-height: 1.6;
    color: var(--color-text);
    background-color: var(--color-light-gray);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
}

img {
    max-width: 100%;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

ul,
ol {
    list-style: none;
}

/* ── Typography Utilities ────────────────────────────────── */
h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--color-navy);
    font-weight: 700;
    line-height: 1.2;
}

h1 {
    font-size: clamp(2rem, 5vw, 3.25rem);
}

h2 {
    font-size: clamp(1.5rem, 4vw, 2.25rem);
}

h3 {
    font-size: clamp(1.25rem, 3vw, 1.75rem);
}

h4 {
    font-size: 1.25rem;
}

p {
    max-width: 65ch;
}

/* ── Glassmorphism Card ──────────────────────────────────── */
.glass-card {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-md);
    transition: transform 0.3s var(--ease-out),
        box-shadow 0.3s var(--ease-out);
}

.glass-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-xl);
}

/* ── Layout Utilities ────────────────────────────────────── */
.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--space-lg);
}

.section {
    padding: var(--space-3xl) 0;
}

/* ============================================================
   Navigation Bar
   ============================================================ */
.navbar {
    position: sticky;
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height);
    z-index: 1000;

    /* Glassmorphism */
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(14px) saturate(180%);
    -webkit-backdrop-filter: blur(14px) saturate(180%);
    border-bottom: 1px solid rgba(255, 255, 255, 0.35);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);

    transition: background 0.3s ease, box-shadow 0.3s ease;
}

/* Darker navbar once the user scrolls */
.navbar.scrolled {
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow-md);
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

/* ── Brand / Logo ────────────────────────────────────────── */
.navbar__brand {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-weight: 800;
    font-size: 1.25rem;
    color: var(--color-navy);
    white-space: nowrap;
}

.navbar__brand span {
    color: var(--color-teal);
}

/* ── Desktop Links ───────────────────────────────────────── */
.navbar__links {
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

.navbar__links a {
    position: relative;
    padding: var(--space-sm) var(--space-md);
    font-weight: 500;
    font-size: 0.938rem;
    color: var(--color-navy);
    border-radius: var(--radius-sm);
    transition: color 0.25s ease, background 0.25s ease;
}

.navbar__links a:hover,
.navbar__links a:focus-visible {
    color: var(--color-teal);
    background: rgba(20, 184, 166, 0.08);
}

/* Animated underline */
.navbar__links a::after {
    content: '';
    position: absolute;
    bottom: 4px;
    left: 50%;
    width: 0;
    height: 2px;
    background: var(--color-teal);
    border-radius: 1px;
    transition: width 0.3s var(--ease-out), left 0.3s var(--ease-out);
}

.navbar__links a:hover::after {
    width: 60%;
    left: 20%;
}

/* Active link */
.navbar__links a.active {
    color: var(--color-teal);
    font-weight: 600;
}

.navbar__links a.active::after {
    width: 60%;
    left: 20%;
}

/* CTA button in nav */
.navbar__links .nav-cta {
    background: var(--color-teal);
    color: var(--color-white);
    padding: var(--space-sm) var(--space-lg);
    border-radius: var(--radius-md);
    font-weight: 600;
    transition: background 0.25s ease, transform 0.25s ease;
}

.navbar__links .nav-cta:hover {
    background: var(--color-teal-dark);
    transform: translateY(-1px);
}

.navbar__links .nav-cta::after {
    display: none;
}

/* ── Hamburger Button (mobile) ───────────────────────────── */
.navbar__toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 36px;
    height: 36px;
    padding: 6px;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1100;
}

.navbar__toggle .bar {
    display: block;
    width: 100%;
    height: 2.5px;
    background: var(--color-navy);
    border-radius: 2px;
    transition: transform 0.35s var(--ease-out),
        opacity 0.25s ease;
    transform-origin: center;
}

/* Animate to  when open */
.navbar__toggle.open .bar:nth-child(1) {
    transform: translateY(7.5px) rotate(45deg);
}

.navbar__toggle.open .bar:nth-child(2) {
    opacity: 0;
}

.navbar__toggle.open .bar:nth-child(3) {
    transform: translateY(-7.5px) rotate(-45deg);
}

/* ── Mobile Menu ─────────────────────────────────────────── */
@media (max-width: 768px) {
    .navbar__toggle {
        display: flex;
    }

    .navbar__links {
        /* Off-canvas drawer */
        position: fixed;
        top: 0;
        right: 0;
        width: min(320px, 85vw);
        height: 100vh;
        height: 100dvh;
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
        padding: calc(var(--nav-height) + var(--space-lg)) var(--space-xl) var(--space-xl);

        /* Solid background — no transparency on mobile */
        background: #ffffff;
        border-left: 1px solid rgba(15, 23, 42, 0.08);
        box-shadow: -8px 0 30px rgba(0, 0, 0, 0.12);

        transform: translateX(100%);
        transition: transform 0.4s var(--ease-out);
        z-index: 1050;
        overflow-y: auto;
    }

    .navbar__links.open {
        transform: translateX(0);
    }

    .navbar__links a {
        width: 100%;
        padding: var(--space-md) var(--space-sm);
        font-size: 1.1rem;
        border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    }

    .navbar__links a::after {
        display: none;
    }

    .navbar__links .nav-cta {
        margin-top: var(--space-lg);
        text-align: center;
        width: 100%;
    }
}

/* Overlay behind mobile drawer */
.navbar__overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.navbar__overlay.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

/* ── Navbar Dropdown ─────────────────────────────────────── */
.navbar__dropdown {
    position: relative;
    display: flex;
    align-items: center;
}

.navbar__dropdown-toggle {
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

.navbar__dropdown-toggle svg {
    transition: transform 0.3s ease;
}

.navbar__dropdown-menu {
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    min-width: 220px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(15, 23, 42, 0.08);
    border-radius: var(--radius-md);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.12);
    padding: var(--space-xs) 0;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    z-index: 1200;
}

.navbar__dropdown:hover .navbar__dropdown-menu,
.navbar__dropdown.open .navbar__dropdown-menu {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}

.navbar__dropdown-menu a {
    display: block;
    padding: var(--space-sm) var(--space-lg) !important;
    font-size: 0.9rem !important;
    font-weight: 500;
    color: var(--color-navy);
    transition: background 0.15s ease, color 0.15s ease;
    border-radius: 0 !important;
}

.navbar__dropdown-menu a:hover {
    background: rgba(20, 184, 166, 0.08);
    color: var(--color-teal);
}

.navbar__dropdown-menu a::after {
    display: none !important;
}

/* Mobile dropdown */
@media (max-width: 768px) {
    .navbar__dropdown {
        flex-direction: column;
        align-items: flex-start;
        width: 100%;
    }

    .navbar__dropdown-toggle {
        width: 100%;
        padding: var(--space-md) var(--space-sm);
        font-size: 1.1rem;
        border-bottom: 1px solid rgba(15, 23, 42, 0.06);
        justify-content: space-between;
    }

    /* Rotate chevron when open */
    .navbar__dropdown.open .navbar__dropdown-toggle svg {
        transform: rotate(180deg);
    }

    .navbar__dropdown-menu {
        position: static;
        transform: none;
        box-shadow: none;
        background: transparent;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
        border: none;
        padding: 0;
        min-width: unset;
        width: 100%;
        /* Hidden by default on mobile, shown when .open */
        max-height: 0;
        opacity: 0;
        visibility: hidden;
        overflow: hidden;
        transition: max-height 0.35s ease, opacity 0.25s ease, visibility 0.25s ease;
    }

    .navbar__dropdown.open .navbar__dropdown-menu {
        max-height: 300px;
        opacity: 1;
        visibility: visible;
    }

    .navbar__dropdown-menu a {
        padding: var(--space-sm) var(--space-sm) var(--space-sm) var(--space-xl) !important;
        font-size: 1rem !important;
        border-bottom: 1px solid rgba(15, 23, 42, 0.04);
        color: var(--color-navy);
    }
}

/* ── Button Utilities ────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0.75rem 1.75rem;
    font-family: var(--font-family);
    font-weight: 600;
    font-size: 1rem;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.25s var(--ease-out);
}

.btn-primary {
    background: var(--color-teal);
    color: var(--color-white);
    box-shadow: 0 4px 14px rgba(20, 184, 166, 0.35);
}

.btn-primary:hover {
    background: var(--color-teal-dark);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(20, 184, 166, 0.45);
}

.btn-secondary {
    background: transparent;
    color: var(--color-navy);
    border: 2px solid var(--color-navy);
}

.btn-secondary:hover {
    background: var(--color-navy);
    color: var(--color-white);
    transform: translateY(-2px);
}

/* ── Footer ──────────────────────────────────────────────── */
.footer {
    background: var(--color-navy);
    color: rgba(255, 255, 255, 0.7);
    padding: var(--space-2xl) 0 var(--space-lg);
    font-size: 0.875rem;
}

.footer a {
    color: var(--color-teal-light);
    transition: color 0.2s ease;
}

.footer a:hover {
    color: var(--color-white);
}

/* ── Accessibility ───────────────────────────────────────── */
:focus-visible {
    outline: 2px solid var(--color-teal);
    outline-offset: 2px;
}

/* Respect reduced-motion preferences */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* ============================================================
   HOMEPAGE — Hero Section
   ============================================================ */
.hero {
    position: relative;
    min-height: calc(100vh - var(--nav-height));
    display: flex;
    align-items: center;
    overflow: hidden;
    background: linear-gradient(135deg, var(--color-navy) 0%, var(--color-navy-light) 50%, #0f3a3a 100%);
}

.hero__inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3xl);
    align-items: center;
    position: relative;
    z-index: 2;
}

.hero__content {
    color: var(--color-white);
}

.hero__eyebrow {
    font-size: 0.938rem;
    font-weight: 600;
    color: var(--color-teal-light);
    margin-bottom: var(--space-md);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.hero__title {
    color: var(--color-white);
    margin-bottom: var(--space-lg);
    line-height: 1.1;
}

.hero__title span {
    color: var(--color-teal);
}

.hero__subtitle {
    color: rgba(255, 255, 255, 0.75);
    font-size: 1.15rem;
    max-width: 50ch;
    margin-bottom: var(--space-xl);
    line-height: 1.7;
}

.hero__actions {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
}

.hero__actions .btn-secondary {
    border-color: rgba(255, 255, 255, 0.4);
    color: var(--color-white);
}

.hero__actions .btn-secondary:hover {
    background: var(--color-white);
    color: var(--color-navy);
    border-color: var(--color-white);
}

.btn-lg {
    padding: 1rem 2.25rem;
    font-size: 1.1rem;
}

/* Decorative blobs */
.hero__blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.25;
    animation: float 8s ease-in-out infinite;
}

.hero__blob--1 {
    width: 500px;
    height: 500px;
    background: var(--color-teal);
    top: -100px;
    right: -100px;
    animation-delay: 0s;
}

.hero__blob--2 {
    width: 350px;
    height: 350px;
    background: #6366f1;
    bottom: -80px;
    left: -60px;
    animation-delay: -3s;
}

.hero__blob--3 {
    width: 250px;
    height: 250px;
    background: var(--color-teal-light);
    top: 50%;
    left: 50%;
    animation-delay: -5s;
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-30px) scale(1.05);
    }
}

/* Animated atom visual */
.hero__visual {
    display: flex;
    align-items: center;
    justify-content: center;
}

.hero__atom {
    position: relative;
    width: 300px;
    height: 300px;
}

.hero__atom-nucleus {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    background: radial-gradient(circle, var(--color-teal-light), var(--color-teal));
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 40px rgba(20, 184, 166, 0.6), 0 0 80px rgba(20, 184, 166, 0.3);
}

.hero__atom-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    border: 2px solid rgba(20, 184, 166, 0.35);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    animation: spin 6s linear infinite;
}

.hero__atom-ring--1 {
    width: 180px;
    height: 80px;
    transform: translate(-50%, -50%) rotateX(70deg) rotateZ(0deg);
    animation-duration: 5s;
}

.hero__atom-ring--2 {
    width: 220px;
    height: 90px;
    transform: translate(-50%, -50%) rotateX(70deg) rotateZ(60deg);
    animation-duration: 7s;
    animation-direction: reverse;
}

.hero__atom-ring--3 {
    width: 260px;
    height: 100px;
    transform: translate(-50%, -50%) rotateX(70deg) rotateZ(120deg);
    animation-duration: 9s;
}

@keyframes spin {
    to {
        transform: translate(-50%, -50%) rotateX(70deg) rotateZ(360deg);
    }
}

@media (max-width: 768px) {
    .hero__inner {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .hero__subtitle {
        margin-left: auto;
        margin-right: auto;
    }

    .hero__actions {
        justify-content: center;
    }

    .hero__visual {
        display: none;
    }
}

/* ============================================================
   Section Titles (shared)
   ============================================================ */
.section__title {
    text-align: center;
    margin-bottom: var(--space-sm);
}

.section__subtitle {
    text-align: center;
    color: var(--color-text-muted);
    font-size: 1.1rem;
    margin-bottom: var(--space-2xl);
    max-width: 50ch;
    margin-left: auto;
    margin-right: auto;
}

/* ============================================================
   Features Grid
   ============================================================ */
.features__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-xl);
}

.features__card {
    padding: var(--space-xl);
    text-align: center;
}

.features__icon {
    width: 64px;
    height: 64px;
    margin: 0 auto var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.15), rgba(20, 184, 166, 0.05));
    border-radius: var(--radius-lg);
    color: var(--color-teal);
}

.features__card h3 {
    margin-bottom: var(--space-sm);
}

.features__card p {
    color: var(--color-text-muted);
    margin: 0 auto;
}

/* ============================================================
   Testimonials
   ============================================================ */
.testimonials {
    background: linear-gradient(180deg, var(--color-light-gray) 0%, rgba(20, 184, 166, 0.04) 100%);
}

.testimonials__grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: var(--space-xl);
}

.testimonials__card {
    padding: var(--space-xl);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.testimonials__stars {
    color: #f59e0b;
    font-size: 1.25rem;
    letter-spacing: 2px;
}

.testimonials__quote {
    font-style: italic;
    color: var(--color-text);
    line-height: 1.7;
    flex: 1;
}

.testimonials__author {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid rgba(15, 23, 42, 0.06);
}

.testimonials__avatar {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--color-teal), var(--color-navy));
    color: var(--color-white);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
    flex-shrink: 0;
}

.testimonials__name {
    font-weight: 600;
    color: var(--color-navy);
}

.testimonials__role {
    font-size: 0.813rem;
    color: var(--color-text-muted);
}

/* ============================================================
   CTA Banner
   ============================================================ */
.cta-banner {
    background: linear-gradient(135deg, var(--color-navy) 0%, #0f3a3a 100%);
    padding: var(--space-3xl) 0;
}

.cta-banner__inner {
    text-align: center;
}

.cta-banner h2 {
    color: var(--color-white);
    margin-bottom: var(--space-sm);
}

.cta-banner p {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.1rem;
    margin: 0 auto var(--space-xl);
    max-width: 50ch;
}

/* ============================================================
   Footer Layout
   ============================================================ */
.footer__inner {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: var(--space-xl);
}

.footer__brand {
    font-weight: 800;
    font-size: 1.1rem;
    color: var(--color-white);
    margin-bottom: var(--space-sm);
}

.footer__brand span {
    color: var(--color-teal);
}

.footer__col h4 {
    color: var(--color-white);
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: var(--space-md);
}

.footer__col ul {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.footer__bottom {
    margin-top: var(--space-xl);
    padding-top: var(--space-lg);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

@media (max-width: 768px) {
    .footer__inner {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-xl) var(--space-lg);
    }
}

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

/* ============================================================
   Page Hero (inner pages)
   ============================================================ */
.page-hero {
    background: linear-gradient(135deg, var(--color-navy) 0%, var(--color-navy-light) 50%, #0f3a3a 100%);
    padding: var(--space-3xl) 0;
    text-align: center;
}

.page-hero h1 {
    color: var(--color-white);
    margin-bottom: var(--space-md);
}

.page-hero__subtitle {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.15rem;
    max-width: 55ch;
    margin: 0 auto;
    line-height: 1.7;
}

/* ============================================================
   AQA Topics Grid
   ============================================================ */
.topics__grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--space-xl);
}

.topic-card {
    padding: var(--space-xl);
    position: relative;
    overflow: hidden;
}

.topic-card__number {
    position: absolute;
    top: var(--space-md);
    right: var(--space-md);
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--color-teal);
    background: rgba(20, 184, 166, 0.08);
    padding: 4px 10px;
    border-radius: 999px;
    line-height: 1;
    pointer-events: none;
}

.topic-card__icon {
    font-size: 2rem;
    margin-bottom: var(--space-md);
}

.topic-card__title {
    margin-bottom: var(--space-sm);
    font-size: 1.15rem;
}

.topic-card__desc {
    color: var(--color-text-muted);
    font-size: 0.925rem;
    margin-bottom: var(--space-lg);
    line-height: 1.6;
}

.topic-card__actions {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.btn-sm {
    padding: 0.5rem 1.15rem;
    font-size: 0.85rem;
}

.btn-outline {
    background: transparent;
    color: var(--color-navy);
    border: 1.5px solid rgba(15, 23, 42, 0.2);
}

.btn-outline:hover {
    background: var(--color-navy);
    color: var(--color-white);
    border-color: var(--color-navy);
}

/* ============================================================
   Tools Page — Sidebar + Main Layout
   ============================================================ */
.tools-layout__wrapper {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: var(--space-xl);
    align-items: start;
}

/* Sidebar */
.tools-sidebar {
    padding: var(--space-lg);
    position: sticky;
    top: calc(var(--nav-height) + var(--space-lg));
}

.tools-sidebar__title {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    margin-bottom: var(--space-md);
}

.tools-sidebar__list {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.tools-sidebar__link {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    font-weight: 500;
    font-size: 0.938rem;
    color: var(--color-text);
    transition: all 0.2s ease;
}

.tools-sidebar__link:hover {
    background: rgba(20, 184, 166, 0.08);
    color: var(--color-teal);
}

.tools-sidebar__link.active {
    background: rgba(20, 184, 166, 0.12);
    color: var(--color-teal);
    font-weight: 600;
}

.tools-sidebar__icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

/* Main tool area */
.tools-main {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

.tools-main__header {
    padding: var(--space-lg) var(--space-xl);
}

.tools-main__header h2 {
    margin-bottom: var(--space-xs);
}

.tools-main__header p {
    color: var(--color-text-muted);
    font-size: 0.938rem;
}

.tools-main__app {
    padding: var(--space-xl);
    min-height: 400px;
}

/* Placeholder */
.tools-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: var(--space-md);
    min-height: 300px;
    color: var(--color-text-muted);
}

.tools-placeholder__icon {
    font-size: 3rem;
}

.tools-placeholder h3 {
    color: var(--color-navy);
}

.tools-placeholder code {
    background: rgba(15, 23, 42, 0.06);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.875rem;
}

@media (max-width: 768px) {
    .tools-layout__wrapper {
        grid-template-columns: 1fr;
    }

    .tools-sidebar {
        position: static;
    }

    .tools-sidebar__list {
        flex-direction: row;
        overflow-x: auto;
        gap: var(--space-sm);
        padding-bottom: var(--space-sm);
    }

    .tools-sidebar__link {
        white-space: nowrap;
    }
}

/* ── Tool Card Grid ─────────────────────────────────────── */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: var(--space-xl);
}

.tool-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: var(--space-2xl) var(--space-xl);
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.tool-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.06), transparent 60%);
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.tool-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-xl), 0 0 40px rgba(20, 184, 166, 0.08);
}

.tool-card:hover::before {
    opacity: 1;
}

.tool-card__icon {
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.15), rgba(20, 184, 166, 0.05));
    border-radius: var(--radius-lg);
    color: var(--color-teal);
    margin-bottom: var(--space-lg);
    transition: transform 0.3s var(--ease-out);
}

.tool-card:hover .tool-card__icon {
    transform: scale(1.1);
}

.tool-card__title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--color-navy);
    margin-bottom: var(--space-sm);
}

.tool-card__desc {
    color: var(--color-text-muted);
    font-size: 0.938rem;
    line-height: 1.65;
    margin-bottom: var(--space-lg);
    max-width: 32ch;
}

.tool-card__cta {
    display: inline-block;
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--color-teal);
    letter-spacing: 0.02em;
    transition: gap 0.2s ease;
}

.tool-card:hover .tool-card__cta {
    color: var(--color-teal-dark);
}

/* ════════════════════════════════════════════════════════════
   Topic Page Styles
   ════════════════════════════════════════════════════════════ */

/* ── Topic Hero ─────────────────────────────────────────── */
.topic-hero {
    padding: calc(var(--nav-height) + var(--space-xl)) 0 var(--space-xl);
    background: linear-gradient(135deg, var(--color-navy) 0%, #1e293b 100%);
    color: var(--color-white);
    position: relative;
    overflow: hidden;
}

.topic-hero::before {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(20, 184, 166, 0.15), transparent 70%);
    top: -100px;
    right: -100px;
    pointer-events: none;
}

.topic-hero__badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    background: rgba(20, 184, 166, 0.15);
    border: 1px solid rgba(20, 184, 166, 0.3);
    color: var(--color-teal-light);
    padding: 6px 16px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    margin-bottom: var(--space-md);
}

.topic-hero h1 {
    font-size: clamp(1.8rem, 4vw, 2.8rem);
    margin-bottom: var(--space-sm);
    color: var(--color-white);
}

.topic-hero h1 span {
    color: var(--color-teal);
}

.topic-hero__desc {
    font-size: clamp(1rem, 1.5vw, 1.15rem);
    color: rgba(255, 255, 255, 0.75);
    max-width: 700px;
    line-height: 1.7;
}

.topic-hero__breadcrumb {
    margin-top: var(--space-md);
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.5);
}

.topic-hero__breadcrumb a {
    color: var(--color-teal-light);
    text-decoration: none;
    transition: color 0.2s ease;
}

.topic-hero__breadcrumb a:hover {
    color: var(--color-white);
}

.topic-hero__breadcrumb span {
    margin: 0 6px;
}

/* ── Topic Layout (sidebar + content) ───────────────────── */
.topic-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: var(--space-xl);
    align-items: start;
    padding: var(--space-xl) 0;
}

/* ── Topic Sidebar (Table of Contents) ──────────────────── */
.topic-sidebar {
    position: sticky;
    top: calc(var(--nav-height) + var(--space-md));
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    max-height: calc(100vh - var(--nav-height) - 2 * var(--space-md));
    overflow-y: auto;
}

.topic-sidebar__title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-muted);
    font-weight: 700;
    margin-bottom: var(--space-md);
}

.topic-sidebar__list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.topic-sidebar__link {
    display: block;
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    color: var(--color-navy);
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.topic-sidebar__link:hover,
.topic-sidebar__link.active {
    background: rgba(20, 184, 166, 0.08);
    color: var(--color-teal-dark);
    border-left-color: var(--color-teal);
}

/* ── Topic Content ──────────────────────────────────────── */
.topic-content {
    min-width: 0;
}

/* ── Topic Section (each subtopic card) ─────────────────── */
.topic-section {
    background: rgba(255, 255, 255, 0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255, 255, 255, 0.35);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-lg);
    transition: box-shadow 0.3s ease, transform 0.3s ease;
}

.topic-section:hover {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.topic-section h2 {
    font-size: 1.5rem;
    color: var(--color-navy);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 2px solid rgba(20, 184, 166, 0.2);
}

.topic-section h3 {
    font-size: 1.15rem;
    color: var(--color-navy);
    margin-top: var(--space-lg);
    margin-bottom: var(--space-sm);
}

.topic-section h4 {
    font-size: 1rem;
    color: var(--color-teal-dark);
    margin-top: var(--space-md);
    margin-bottom: var(--space-xs);
}

.topic-section p {
    color: var(--color-body);
    line-height: 1.8;
    margin-bottom: var(--space-sm);
}

.topic-section ul,
.topic-section ol {
    color: var(--color-body);
    line-height: 1.8;
    margin-bottom: var(--space-md);
    padding-left: var(--space-lg);
}

.topic-section li {
    margin-bottom: var(--space-xs);
}

/* ── Exam Tip Callout ───────────────────────────────────── */
.exam-tip {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.08), rgba(251, 191, 36, 0.04));
    border: 1px solid rgba(251, 191, 36, 0.25);
    border-left: 4px solid #f59e0b;
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    margin: var(--space-md) 0;
    font-size: 0.92rem;
    line-height: 1.7;
}

.exam-tip::before {
    content: ' Exam Tip';
    display: block;
    font-weight: 700;
    color: #b45309;
    margin-bottom: var(--space-xs);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Key Fact Callout ───────────────────────────────────── */
.key-fact {
    background: linear-gradient(135deg, rgba(20, 184, 166, 0.08), rgba(20, 184, 166, 0.03));
    border: 1px solid rgba(20, 184, 166, 0.25);
    border-left: 4px solid var(--color-teal);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    margin: var(--space-md) 0;
    font-size: 0.92rem;
    line-height: 1.7;
}

.key-fact::before {
    content: ' Key Fact';
    display: block;
    font-weight: 700;
    color: var(--color-teal-dark);
    margin-bottom: var(--space-xs);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Equation Block ─────────────────────────────────────── */
.equation-block {
    background: rgba(15, 23, 42, 0.04);
    border: 1px solid rgba(15, 23, 42, 0.1);
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    margin: var(--space-md) 0;
    font-family: 'Courier New', Courier, monospace;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--color-navy);
    text-align: center;
    letter-spacing: 0.02em;
    overflow-x: auto;
}

/* ── Worked Example ─────────────────────────────────────── */
.worked-example {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.06), rgba(99, 102, 241, 0.02));
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-left: 4px solid #6366f1;
    border-radius: var(--radius-md);
    padding: var(--space-md) var(--space-lg);
    margin: var(--space-md) 0;
    line-height: 1.7;
}

.worked-example::before {
    content: ' Worked Example';
    display: block;
    font-weight: 700;
    color: #4338ca;
    margin-bottom: var(--space-xs);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.worked-example p {
    margin-bottom: var(--space-xs);
}

.worked-example .step {
    margin-bottom: var(--space-xs);
    padding-left: var(--space-md);
}

/* ── Topic Pagination ───────────────────────────────────── */
.topic-pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-lg) 0 var(--space-2xl);
    border-top: 1px solid rgba(15, 23, 42, 0.08);
    margin-top: var(--space-xl);
    flex-wrap: wrap;
}

.topic-pagination a {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    padding: 12px 24px;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
}

.topic-pagination__prev,
.topic-pagination__next {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(15, 23, 42, 0.1);
    color: var(--color-navy);
}

.topic-pagination__prev:hover,
.topic-pagination__next:hover {
    background: var(--color-teal);
    color: var(--color-white);
    border-color: var(--color-teal);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(20, 184, 166, 0.3);
}

.topic-pagination__hub {
    background: var(--color-navy);
    color: var(--color-white);
}

.topic-pagination__hub:hover {
    background: var(--color-teal-dark);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.3);
}

/* ── Topic Page Responsive ──────────────────────────────── */
@media (max-width: 900px) {
    .topic-layout {
        grid-template-columns: 1fr;
    }

    .topic-sidebar {
        position: static;
        max-height: none;
        padding: var(--space-md);
        margin-bottom: var(--space-md);
        cursor: pointer;
    }

    /* Collapse indicator */
    .topic-sidebar__title {
        display: flex;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 0;
    }

    .topic-sidebar__title::after {
        content: '';
        width: 10px;
        height: 10px;
        border-right: 2px solid var(--color-text-muted);
        border-bottom: 2px solid var(--color-text-muted);
        transform: rotate(45deg);
        transition: transform 0.3s ease;
        flex-shrink: 0;
    }

    .topic-sidebar.open .topic-sidebar__title::after {
        transform: rotate(-135deg);
    }

    .topic-sidebar__list {
        display: flex;
        flex-direction: column;
        gap: 2px;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.4s ease, margin-top 0.3s ease;
        margin-top: 0;
    }

    .topic-sidebar.open .topic-sidebar__list {
        max-height: 800px;
        margin-top: var(--space-md);
    }

    .topic-sidebar__link {
        border-left: none;
        border-bottom: 1px solid rgba(15, 23, 42, 0.04);
        padding: 10px 12px;
        font-size: 0.9rem;
        border-radius: var(--radius-sm);
    }

    .topic-sidebar__link:hover,
    .topic-sidebar__link.active {
        border-left: none;
        background: rgba(20, 184, 166, 0.08);
        color: var(--color-teal-dark);
    }

    .topic-section {
        padding: var(--space-lg);
    }
}

@media (max-width: 600px) {
    .topic-pagination {
        flex-direction: column;
        align-items: stretch;
        text-align: center;
    }

    .topic-pagination a {
        justify-content: center;
    }

    .topic-section h2 {
        font-size: 1.25rem;
    }
}