/* ============================================================
   shared.css: tokens + components shared by Arivu and Ariyam.
   Map-only styles (Leaflet glue, sidebar, pins) live in Ariyam's
   ariyam.css, not here.
============================================================ */


        :root {
            --ink: #1b2433;
            --ink-2: #2a3548;
            --ink-3: #4a5568;
            --ink-4: #7a8595;
            --paper: #f5ecd6;
            --paper-2: #efe4c8;
            --paper-3: #e6d9b8;
            --paper-4: #dccca5;
            --accent: #c8342a;
            --accent-2: #d8523a;
            --gold: #e8b73a;
            --gold-2: #f0c860;
            --sage: #3e7050;
            --slate: #344d60;
            --border: rgba(27, 36, 51, 0.18);
            --border-2: rgba(27, 36, 51, 0.28);
            --serif: 'Playfair Display', Georgia, serif;
            --sans: 'Instrument Sans', sans-serif;
            --mono: 'IBM Plex Mono', monospace;
            --mal: 'Noto Sans Malayalam', sans-serif;
            --hand: 'Caveat', cursive;
            --hand-2: 'Kalam', cursive;
            --hand-3: 'Instrument Sans', sans-serif;
            --marker: 'Caveat', cursive;
            --footer-year: "2025";
            --highlighter-yellow: rgba(255, 230, 110, 0.55);
            --highlighter-pink: rgba(255, 175, 195, 0.5);
            --highlighter-blue: rgba(170, 205, 245, 0.5);
            --sticky-yellow: #fff3a8;
            --sticky-pink: #ffd6dc;
            --sticky-blue: #c8e0ff;
            --sticky-green: #d4ecbb;
            --margin-red: #d23b3b;
            --pencil-gray: #6b7280;
            --focus-ring: 0 0 0 3px rgba(200, 57, 43, 0.4), 0 0 0 6px rgba(200, 57, 43, 0.15);
            --focus-ring-high-contrast: 0 0 0 3px #000, 0 0 0 6px rgba(200, 57, 43, 0.6);
            --shadow-sm: 0 1px 1px rgba(0, 0, 0, 0.05), 0 2px 4px rgba(0, 0, 0, 0.06);
            --shadow-md: 0 1px 1px rgba(0, 0, 0, 0.05), 0 4px 8px rgba(0, 0, 0, 0.08), 0 8px 16px rgba(0, 0, 0, 0.05);
            --shadow-lg: 0 1px 1px rgba(0, 0, 0, 0.05), 0 4px 8px rgba(0, 0, 0, 0.08), 0 12px 24px rgba(0, 0, 0, 0.06), 0 24px 48px rgba(0, 0, 0, 0.04);
            --shadow-xl: 0 2px 2px rgba(0, 0, 0, 0.05), 0 6px 12px rgba(0, 0, 0, 0.08), 0 16px 32px rgba(0, 0, 0, 0.07), 0 32px 64px rgba(0, 0, 0, 0.05);
            --shadow-interactive: 0 8px 24px rgba(180, 50, 35, 0.25), 0 4px 12px rgba(180, 50, 35, 0.15);
            --shadow-pressed: 0 1px 2px rgba(0, 0, 0, 0.2), inset 0 2px 6px rgba(0, 0, 0, 0.18);
            --shadow-inner: inset 0 3px 6px rgba(0, 0, 0, 0.1), inset 0 1px 3px rgba(0, 0, 0, 0.06);
            --shadow-raised: 0 2px 1px rgba(255, 255, 255, 0.4) inset, 0 -2px 4px rgba(0, 0, 0, 0.12);
            --shadow-inset-well: inset 0 4px 8px rgba(0, 0, 0, 0.12), inset 0 2px 4px rgba(0, 0, 0, 0.08), 0 1px 0 rgba(255, 255, 255, 0.25);
            --shadow-bevel-out: 0 1px 0 rgba(255, 255, 255, 0.4) inset, 0 -1px 0 rgba(0, 0, 0, 0.1) inset, 0 2px 4px rgba(0, 0, 0, 0.06);
            --shadow-bevel-in: 0 -1px 0 rgba(255, 255, 255, 0.3) inset, 0 1px 0 rgba(0, 0, 0, 0.15) inset, 0 2px 8px rgba(0, 0, 0, 0.05);
            --shadow-paper: 0 1px 1px rgba(0, 0, 0, 0.05), 0 4px 8px rgba(0, 0, 0, 0.08), 0 12px 24px rgba(0, 0, 0, 0.06);
            --shadow-paper-hover: 0 2px 2px rgba(0, 0, 0, 0.06), 0 8px 16px rgba(0, 0, 0, 0.1), 0 20px 40px rgba(0, 0, 0, 0.08);
            --radius-sm: 4px;
            --radius-md: 6px;
            --radius-lg: 8px;
            --radius-xl: 10px;
            --radius-pill: 9999px;
            --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
            --transition-normal: 250ms cubic-bezier(0.4, 0, 0.2, 1);
            --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
            --transition-bounce: 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
            --texture-paper: url("data:image/svg+xml,%3Csvg width='200' height='200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
            --ruled-lines: repeating-linear-gradient(0deg, transparent 0, transparent 31px, rgba(27, 36, 51, 0.06) 31px, rgba(27, 36, 51, 0.06) 32px);
            --squiggle-underline: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='8' viewBox='0 0 200 8' preserveAspectRatio='none'%3E%3Cpath d='M0,4 Q5,0 10,4 T20,4 T30,4 T40,4 T50,4 T60,4 T70,4 T80,4 T90,4 T100,4 T110,4 T120,4 T130,4 T140,4 T150,4 T160,4 T170,4 T180,4 T190,4 T200,4' stroke='%234a5568' stroke-width='1.4' fill='none' stroke-linecap='round' opacity='0.55'/%3E%3C/svg%3E");
            --ink-smudge: radial-gradient(ellipse 240px 200px at 80% 20%, rgba(27, 36, 51, 0.06) 0%, transparent 60%);
            --metallic-dark: linear-gradient(145deg, #1b2433 0%, #2a3548 40%, #1b2433 100%);
            color-scheme: light;
        }


        /* Full variable override: keep everything that reads CSS vars in sync */
        html.dark {
            /* Primary text: warm white for easy reading, no blue cast */
            --ink: #f2ead6;
            --ink-2: #e8dfc2;
            --ink-3: #cdc0a0;
            --ink-4: #a89878;

            /* Backgrounds: deep warm dark, NOT pure black */
            --paper: #18160f;
            --paper-2: #201d14;
            --paper-3: #2a261a;
            --paper-4: #352f22;

            /* Accent colours: boosted for dark contrast */
            --accent: #f05a4a;
            --accent-2: #f47a64;
            --gold: #f5cc60;
            --gold-2: #fad980;
            --sage: #74b488;
            --slate: #78aac8;

            --border: rgba(242, 234, 214, 0.13);
            --border-2: rgba(242, 234, 214, 0.22);

            /* Highlighters: more saturated for dark paper */
            --highlighter-yellow: rgba(255, 224, 80, 0.35);
            --highlighter-pink: rgba(255, 130, 160, 0.3);
            --highlighter-blue: rgba(120, 190, 255, 0.28);

            /* Sticky-note palette: warm, dimmed */
            --sticky-yellow: #4d4018;
            --sticky-pink: #4d2528;
            --sticky-blue: #1f3a55;
            --sticky-green: #2a4225;

            --margin-red: #d44545;
            --pencil-gray: #9a9080;

            --focus-ring: 0 0 0 3px rgba(240, 90, 74, 0.6), 0 0 0 6px rgba(240, 90, 74, 0.2);
            --focus-ring-high-contrast: 0 0 0 3px #fff, 0 0 0 6px rgba(240, 90, 74, 0.6);

            /* Deeper, more pronounced shadows for dark */
            --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45), 0 2px 6px rgba(0, 0, 0, 0.4);
            --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.45), 0 6px 12px rgba(0, 0, 0, 0.5), 0 12px 20px rgba(0, 0, 0, 0.35);
            --shadow-lg: 0 2px 4px rgba(0, 0, 0, 0.45), 0 8px 16px rgba(0, 0, 0, 0.55), 0 20px 36px rgba(0, 0, 0, 0.4), 0 36px 56px rgba(0, 0, 0, 0.3);
            --shadow-xl: 0 4px 8px rgba(0, 0, 0, 0.45), 0 12px 24px rgba(0, 0, 0, 0.55), 0 24px 48px rgba(0, 0, 0, 0.5), 0 48px 80px rgba(0, 0, 0, 0.35);
            --shadow-interactive: 0 6px 20px rgba(240, 90, 74, 0.4), 0 3px 10px rgba(240, 90, 74, 0.25);
            --shadow-pressed: 0 1px 2px rgba(0, 0, 0, 0.5), inset 0 2px 6px rgba(0, 0, 0, 0.5);
            --shadow-inner: inset 0 3px 8px rgba(0, 0, 0, 0.5), inset 0 1px 4px rgba(0, 0, 0, 0.35);
            --shadow-raised: 0 2px 1px rgba(255, 240, 190, 0.07) inset, 0 -2px 4px rgba(0, 0, 0, 0.5);
            --shadow-inset-well: inset 0 4px 10px rgba(0, 0, 0, 0.55), inset 0 2px 4px rgba(0, 0, 0, 0.4), 0 1px 0 rgba(255, 240, 190, 0.06);
            --shadow-bevel-out: 0 1px 0 rgba(255, 240, 190, 0.09) inset, 0 -1px 0 rgba(0, 0, 0, 0.45) inset, 0 2px 6px rgba(0, 0, 0, 0.35);
            --shadow-bevel-in: 0 -1px 0 rgba(255, 240, 190, 0.07) inset, 0 1px 0 rgba(0, 0, 0, 0.55) inset, 0 2px 10px rgba(0, 0, 0, 0.35);
            --shadow-paper: 0 2px 4px rgba(0, 0, 0, 0.45), 0 6px 12px rgba(0, 0, 0, 0.5), 0 16px 30px rgba(0, 0, 0, 0.4);
            --shadow-paper-hover: 0 4px 8px rgba(0, 0, 0, 0.5), 0 12px 24px rgba(0, 0, 0, 0.6), 0 28px 48px rgba(0, 0, 0, 0.45);

            /* Metallic gradients re-tuned for dark */
            --metallic-dark: linear-gradient(145deg, #100f0c 0%, #201d14 40%, #100f0c 100%);

            /* Ruled lines + smudge: subtle on dark */
            --ruled-lines: repeating-linear-gradient(0deg, transparent 0, transparent 31px, rgba(242, 234, 214, 0.05) 31px, rgba(242, 234, 214, 0.05) 32px);
            --ink-smudge: radial-gradient(ellipse 240px 200px at 80% 20%, rgba(242, 234, 214, 0.07) 0%, transparent 60%);

            /* Squiggle underline: lighter stroke for dark bg */
            --squiggle-underline: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='8' viewBox='0 0 200 8' preserveAspectRatio='none'%3E%3Cpath d='M0,4 Q5,0 10,4 T20,4 T30,4 T40,4 T50,4 T60,4 T70,4 T80,4 T90,4 T100,4 T110,4 T120,4 T130,4 T140,4 T150,4 T160,4 T170,4 T180,4 T190,4 T200,4' stroke='%23cdb88a' stroke-width='1.6' fill='none' stroke-linecap='round' opacity='0.75'/%3E%3C/svg%3E");

            color-scheme: dark;
        }


/* Shared component styles */

.btn-primary,
.btn-ghost {
    min-height: 48px;
    min-width: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-pill);
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color var(--transition-bounce), color var(--transition-bounce), border-color var(--transition-bounce), box-shadow var(--transition-bounce), transform var(--transition-bounce), opacity var(--transition-bounce);
    position: relative;
    font-weight: 600;
}

.btn-primary {
    background: transparent;
    color: var(--ink);
    padding: 0.85rem 2.25rem;
    font-size: 0.875rem;
    letter-spacing: 0.04em;
    border: 2px solid var(--ink);
    transform: rotate(-0.4deg);
    isolation: isolate;
}

.btn-primary::before {
    content: '';
    position: absolute;
    left: 6px;
    right: 6px;
    bottom: 4px;
    height: 38%;
    background: var(--highlighter-yellow);
    z-index: -1;
    border-radius: 2px;
    transition: height var(--transition-normal), background var(--transition-fast);
    transform: skewX(-2deg);
}

.btn-primary:hover,
.btn-primary:focus-visible {
    transform: rotate(-0.4deg) translateY(-2px);
    border-width: 2.5px;
}

.btn-primary:hover::before,
.btn-primary:focus-visible::before {
    height: 78%;
}

.btn-primary:active {
    transform: rotate(-0.4deg) translateY(0);
}

.btn-ghost {
    color: var(--ink);
    padding: 0.85rem 1.75rem;
    font-size: 0.875rem;
    letter-spacing: 0.04em;
    border: 2px dashed var(--ink-3);
    background: transparent;
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
    border-color: var(--ink);
    border-style: solid;
    transform: translateY(-2px);
    text-decoration: underline;
    text-decoration-style: wavy;
    text-decoration-color: var(--accent);
    text-underline-offset: 5px;
    text-decoration-thickness: 1.5px;
}

.btn-ghost:active {
    transform: translateY(0);
}

.theme-toggle,
.lang-toggle {
    min-width: 44px;
    min-height: 44px;
    background: transparent;
    border: 1.5px dashed var(--ink-3);
    border-radius: var(--radius-pill);
    cursor: pointer;
    color: var(--ink);
    font-family: var(--hand);
    font-size: 1.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: border-color 220ms ease, background-color 220ms ease, color 220ms ease,
        transform 260ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 220ms ease;
    transform: rotate(-1deg);
}

.theme-toggle:hover,
.theme-toggle:focus-visible,
.lang-toggle:hover,
.lang-toggle:focus-visible {
    border-color: var(--gold);
    border-style: solid;
    transform: rotate(8deg) translateY(-2px) scale(1.1);
    background: var(--highlighter-yellow);
    color: var(--ink);
    box-shadow: 0 4px 16px rgba(245, 204, 96, 0.3);
}

.theme-toggle:focus-visible,
.lang-toggle:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.theme-toggle #theme-icon {
    display: inline-block;
    line-height: 1;
    transition: transform 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.theme-toggle:hover #theme-icon {
    transform: rotate(25deg) scale(1.15);
}

@keyframes quizChipIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes quizChipSelect {
    0% { transform: scale(1); }
    30% { transform: scale(0.82, 1.2); }
    50% { transform: scale(1.18, 0.82); }
    70% { transform: scale(0.92, 1.08); }
    85% { transform: scale(1.05, 0.95); }
    100% { transform: scale(1); }
}

.mf-chip {
    padding: 0.55rem 1rem;
    border-radius: var(--radius-pill);
    font-size: 0.75rem;
    font-weight: 600;
    border: 2px solid var(--border);
    background: linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%);
    color: var(--ink-2);
    transition: background-color var(--transition-bounce), color var(--transition-bounce), border-color var(--transition-bounce), box-shadow var(--transition-bounce), transform var(--transition-bounce), opacity var(--transition-bounce);
    user-select: none;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.6);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    animation: quizChipIn 460ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.mf-chip:hover,
.mf-chip:focus-visible {
    border-color: var(--ink-3);
    outline: none;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.mf-chip.selected {
    background: linear-gradient(180deg, #2e2820 0%, #1a1510 40%, #0f0e0c 100%);
    color: var(--paper);
    border-color: var(--ink);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25), 0 2px 4px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.15), inset 0 -2px 0 rgba(0, 0, 0, 0.3);
    animation: quizChipSelect 340ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 14, 12, 0.55);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-normal), visibility var(--transition-normal);
}

.modal-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--paper);
    background-image: var(--ruled-lines), var(--texture-paper);
    border: 1.5px solid var(--ink);
    border-radius: var(--radius-lg);
    max-width: 640px;
    width: 100%;
    max-height: 85vh;
    max-height: 85dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 2rem 2.25rem;
    box-shadow: var(--shadow-xl);
    position: relative;
    transform: translateY(20px) scale(0.96);
    transition: transform var(--transition-bounce);
}

.modal-backdrop.show .modal {
    transform: translateY(0) scale(1);
}

.modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1.5px solid var(--ink-3);
    background: var(--paper);
    color: var(--ink);
    cursor: pointer;
    font-size: 1.2rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast), opacity var(--transition-fast);
}

.modal-close:hover {
    background: var(--accent);
    color: var(--paper);
    border-color: var(--accent);
    transform: rotate(90deg);
}

.modal-cat { font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.5rem; }
.modal-name { font-family: var(--serif); font-size: 1.85rem; font-weight: 700; color: var(--ink); margin-bottom: 0.5rem; line-height: 1.15; }
.modal-inst { font-family: var(--hand-2); font-size: 1.05rem; color: var(--ink-2); margin-bottom: 1.25rem; }
.modal-img { width: 100%; border-radius: var(--radius-md); margin-bottom: 1rem; display: none; }
.modal-badges { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.modal-desc { font-size: 1rem; line-height: 1.75; color: var(--ink-3); margin-bottom: 1.5rem; }
.modal-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.5rem; }
.modal-meta-item { padding: 0.85rem 1rem; background: var(--paper-2); border-radius: var(--radius-md); border: 1px solid var(--border); }
.modal-meta-item .label-sm { font-family: var(--mono); font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-4); display: block; margin-bottom: 0.2rem; }
.modal-meta-item .value-sm { font-family: var(--hand-2); font-size: 1rem; color: var(--ink); font-weight: 500; }
.modal-actions { display: flex; gap: 0.75rem; flex-wrap: wrap; padding-top: 1rem; border-top: 1px dashed var(--border); }
.modal-btn { padding: 0.6rem 1.1rem; border-radius: var(--radius-pill); border: 1.5px solid var(--ink-3); background: transparent; color: var(--ink); cursor: pointer; font-family: var(--hand-2); font-size: 0.9rem; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; min-height: 44px; transition: background-color var(--transition-bounce), color var(--transition-bounce), border-color var(--transition-bounce), box-shadow var(--transition-bounce), transform var(--transition-bounce), opacity var(--transition-bounce); }
.modal-btn:hover { border-color: var(--ink); background: var(--highlighter-yellow); transform: translateY(-2px); }

.ecosystem-input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 2px solid var(--ink-3);
    border-radius: 0;
    padding: 0.6rem 0.25rem;
    color: var(--ink);
    font-family: var(--hand-2);
    font-size: 1.05rem;
    outline: none;
    transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast), opacity var(--transition-fast);
    min-height: 48px;
    box-shadow: none;
}

.ecosystem-input:focus {
    border-color: var(--accent);
    box-shadow: var(--focus-ring);
    background: transparent;
}

.ecosystem-input::placeholder { color: var(--ink-4); font-family: var(--hand-2); font-style: italic; }

.paper-panel {
    background: var(--paper);
    background-image: var(--ruled-lines), var(--texture-paper);
    border: 1.5px solid var(--ink);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
}

.badge { display: inline-flex; align-items: center; padding: 0.3rem 0.75rem; border-radius: var(--radius-pill); background: var(--paper-2); border: 1px solid var(--border); font-family: var(--mono); font-size: 0.72rem; letter-spacing: 0.06em; color: var(--ink-2); }

.washi-tape {
    position: absolute;
    pointer-events: none;
    width: 80px;
    height: 24px;
    background: linear-gradient(135deg, rgba(255, 175, 195, 0.55) 0%, rgba(255, 175, 195, 0.4) 50%, rgba(255, 175, 195, 0.55) 100%);
    border-left: 1px dashed rgba(0, 0, 0, 0.1);
    border-right: 1px dashed rgba(0, 0, 0, 0.1);
    opacity: 0.85;
    z-index: 2;
}

.washi-tape.wt-yellow { background: linear-gradient(135deg, rgba(255, 230, 110, 0.55) 0%, rgba(255, 230, 110, 0.4) 50%, rgba(255, 230, 110, 0.55) 100%); }
.washi-tape.wt-blue { background: linear-gradient(135deg, rgba(170, 205, 245, 0.55) 0%, rgba(170, 205, 245, 0.4) 50%, rgba(170, 205, 245, 0.55) 100%); }

.paperclip-demo { position: absolute; top: -18px; right: 14px; width: 22px; height: 38px; border: 2px solid var(--ink-3); border-radius: 11px 11px 0 0; border-bottom: none; transform: rotate(8deg); pointer-events: none; z-index: 5; }
.paperclip-demo::after { content: ''; position: absolute; top: 14px; left: 50%; transform: translateX(-50%); width: 2px; height: 18px; background: var(--ink-3); }

.ink-stamp { position: absolute; pointer-events: none; width: 80px; height: 80px; border: 2.5px solid var(--accent); border-radius: 50%; color: var(--accent); font-family: var(--hand); font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.1em; display: flex; align-items: center; justify-content: center; text-align: center; line-height: 1.1; transform: rotate(-12deg); opacity: 0.55; background: radial-gradient(circle, rgba(200, 57, 43, 0.05) 60%, transparent 65%); box-shadow: 0 0 0 1px rgba(200, 57, 43, 0.3); }
.ink-stamp::before { content: ''; position: absolute; inset: 4px; border-radius: 50%; border: 1px dashed var(--accent); }

.hand-divider { display: flex; align-items: center; justify-content: center; gap: 1rem; margin: 3rem 0 2rem; position: relative; }
.hand-divider::before,
.hand-divider::after { content: ''; flex: 1; height: 2px; background: var(--ink-3); opacity: 0.4; max-width: 120px; background-image: var(--squiggle-underline); background-size: 16px 8px; background-repeat: repeat-x; }
.hand-divider .star { font-family: var(--hand); font-size: 1.8rem; color: var(--accent); }

.toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 1100; display: flex; flex-direction: column; gap: 0.6rem; max-width: 320px; pointer-events: none; }
.toast { background: var(--paper); border: 1.5px solid var(--ink); border-left: 4px solid var(--accent); border-radius: var(--radius-md); padding: 0.85rem 1.1rem; box-shadow: var(--shadow-lg); font-family: var(--hand-2); font-size: 0.92rem; color: var(--ink); pointer-events: auto; display: flex; align-items: center; gap: 0.6rem; opacity: 0; transform: translateX(100%); transition: opacity var(--transition-normal), transform var(--transition-bounce); }
.toast.show { opacity: 1; transform: translateX(0); }
.toast.success { border-left-color: var(--sage); }
.toast.info { border-left-color: var(--slate); }
.toast.warn { border-left-color: var(--gold); }
.toast-icon { font-size: 1.1rem; line-height: 1; }

@keyframes scrollBounce {
    0%, 100% { transform: translateX(-50%) translateY(0); }
    50% { transform: translateX(-50%) translateY(8px); }
}

.hero-scroll-indicator { position: absolute; bottom: 2rem; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 0.5rem; z-index: 5; animation: scrollBounce 2.5s ease-in-out infinite; }
.hero-scroll-indicator span { font-family: var(--hand); font-size: 1rem; color: var(--ink-3); }
.hero-scroll-indicator .chevron { width: 26px; height: 30px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='26' height='30' viewBox='0 0 26 30' fill='none'%3E%3Cpath d='M4 4 C8 14, 18 14, 22 4' stroke='%234a5568' stroke-width='1.8' stroke-linecap='round' fill='none' opacity='0.7'/%3E%3Cpath d='M4 14 C8 24, 18 24, 22 14' stroke='%234a5568' stroke-width='1.8' stroke-linecap='round' fill='none' opacity='0.7'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: center; }

.scroll-demo-box::-webkit-scrollbar { width: 8px; }
.scroll-demo-box::-webkit-scrollbar-track { background: var(--paper); border-radius: var(--radius-pill); margin: 4px; }
.scroll-demo-box::-webkit-scrollbar-thumb { background: linear-gradient(180deg, #5a5248 0%, #3a3530 100%); border-radius: var(--radius-pill); border: 2px solid var(--paper); }
.scroll-demo-box::-webkit-scrollbar-thumb:hover { background: var(--ink-2); }

html[data-lang="ml"] body { font-family: var(--mal); }
::selection { background: rgba(200, 57, 43, 0.2); color: var(--ink); }
html.dark ::selection { background: rgba(232, 80, 66, 0.45); color: #fff5ea; }
a { color: inherit; text-decoration: none; }

.nav-logo { font-family: var(--hand); font-size: 1.8rem; font-weight: 700; color: var(--ink); letter-spacing: -0.01em; line-height: 1; }
.nav-logo-mal { font-family: var(--mal); font-size: 0.85rem; font-weight: 400; color: var(--ink-3); letter-spacing: 0; }
.label { display: inline-flex; align-items: center; gap: 0.5rem; font-family: var(--hand); font-size: 1.15rem; letter-spacing: 0.01em; text-transform: none; color: var(--accent); margin-bottom: 1.2rem; padding: 0.15rem 0.6rem 0.25rem; line-height: 1.2; transform: rotate(-1deg); }
.label::before { content: '\270E'; display: inline-block; font-family: var(--hand); color: var(--accent); font-size: 1.1rem; line-height: 1; transform: rotate(8deg); }
.hero-kicker { font-family: var(--hand); font-size: 1.3rem; letter-spacing: 0.01em; text-transform: none; color: var(--accent); margin-bottom: 2rem; display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.1rem 0; width: fit-content; line-height: 1.2; transform: rotate(-1.2deg); }
.hero-kicker::before { content: '\270E'; display: inline-block; font-family: var(--hand); color: var(--accent); font-size: 1.2rem; line-height: 1; transform: rotate(10deg); }
.h2 { font-family: var(--serif); font-size: clamp(2rem, 4vw, 3rem); font-weight: 600; line-height: 1.15; letter-spacing: -0.02em; color: var(--ink); margin-bottom: 1.25rem; text-shadow: 0 1px 0 rgba(245, 236, 214, 0.6); padding-bottom: 0.35rem; background-image: var(--squiggle-underline); background-repeat: no-repeat; background-position: 0 100%; background-size: 100% 7px; display: inline-block; max-width: 100%; }
.h2 em { font-style: italic; color: var(--accent); }
@media (max-width: 640px) { .h2 { font-size: clamp(1.6rem, 5vw, 2.2rem); } }
.hero-h1 { font-family: var(--serif); font-size: clamp(4rem, 8vw, 7.5rem); font-weight: 700; line-height: 0.9; letter-spacing: -0.04em; color: var(--ink); margin-bottom: 1rem; text-shadow: 0 2px 0 rgba(245, 236, 214, 0.5), 0 4px 12px rgba(0, 0, 0, 0.06); }
.hero-h1 span { display: block; color: var(--ink-2); font-style: italic; font-size: clamp(1.4rem, 3vw, 2.8rem); font-weight: 400; letter-spacing: -0.01em; margin-top: 0.5rem; width: fit-content; padding: 0 0.15em; text-shadow: none; background: linear-gradient(180deg, transparent 55%, var(--highlighter-yellow) 55%, var(--highlighter-yellow) 92%, transparent 92%); }
@media (max-width: 640px) { .hero-h1 { font-size: clamp(3rem, 12vw, 5rem); } .hero-h1 span { font-size: clamp(1.2rem, 4vw, 2rem); } }
@media (max-width: 480px) { .hero-h1 { font-size: clamp(2.5rem, 14vw, 4rem); } }
html.dark .h2,
html.dark .hero-h1 { text-shadow: none; }
.body-text { font-size: 1rem; line-height: 1.8; color: var(--ink-3); max-width: 580px; }
@media (max-width: 640px) { .body-text { font-size: 0.95rem; } }
.on-dark .label,
.on-dark .label::before { color: var(--gold-2); }
.on-dark .h2 { color: var(--paper); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='8' viewBox='0 0 200 8' preserveAspectRatio='none'%3E%3Cpath d='M0,4 Q5,0 10,4 T20,4 T30,4 T40,4 T50,4 T60,4 T70,4 T80,4 T90,4 T100,4 T110,4 T120,4 T130,4 T140,4 T150,4 T160,4 T170,4 T180,4 T190,4 T200,4' stroke='%23f0c860' stroke-width='1.4' fill='none' stroke-linecap='round' opacity='0.6'/%3E%3C/svg%3E"); }
.on-dark .h2 em { color: var(--gold-2); }
.on-dark .body-text { color: rgba(245, 236, 214, 0.9); }
.on-dark { --paper: #f5ecd6; }

.ty-title { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; line-height: 1.3; color: var(--ink); }
.ty-meta { font-family: var(--mono); font-size: 0.65rem; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 600; color: var(--ink-4); }
.ty-desc { font-size: 0.88rem; line-height: 1.7; color: var(--ink-3); }
.ty-byline { font-family: var(--hand-2); font-size: 0.95rem; letter-spacing: 0.01em; color: var(--slate); display: inline-block; padding: 0.15rem 0; border-bottom: 1.5px dashed var(--slate); }
.ty-stat { font-family: var(--serif); font-size: 2.5rem; font-weight: 700; line-height: 1; color: var(--ink); }
.ty-stat--accent { color: var(--accent); }
.ty-quote { font-family: var(--serif); font-size: 1.2rem; line-height: 1.7; font-style: italic; }
.ty-mark { padding: 0 0.15em; background: linear-gradient(180deg, transparent 55%, var(--highlighter-yellow) 55%, var(--highlighter-yellow) 92%, transparent 92%); }
.ty-mal { font-family: var(--mal); font-weight: 400; color: var(--ink-3); }

@keyframes tapeFlutter {
    0%, 100% { transform: translateX(-50%) rotate(-3deg); }
    50% { transform: translateX(-50%) rotate(2deg) translateY(-1px); }
}

.paper-card { position: relative; background: var(--paper); border: 1.5px solid var(--ink-3); border-radius: 4px; padding: 2rem 1.75rem 1.5rem; box-shadow: var(--shadow-paper); transition: transform 250ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 250ms ease, border-color 200ms ease; }
.paper-card:nth-child(odd) { transform: rotate(-0.6deg); }
.paper-card:nth-child(even) { transform: rotate(0.8deg); }
.paper-card:hover { transform: translateY(-6px) rotate(0deg); box-shadow: var(--shadow-paper-hover); border-color: var(--ink); }
.paper-card::before { content: ''; position: absolute; top: -10px; left: 50%; width: 64px; height: 22px; background: rgba(232, 230, 200, 0.55); border: 1px solid rgba(180, 170, 140, 0.25); transform: translateX(-50%) rotate(-3deg); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); z-index: 2; opacity: 0.85; }
@media (prefers-reduced-motion: no-preference) { .paper-card::before { animation: tapeFlutter 4s ease-in-out infinite; } }

.sticky-note { display: inline-block; width: 130px; min-height: 80px; padding: 1rem 0.85rem 0.7rem; background-color: var(--sticky-yellow); color: #1a1814; font-family: var(--hand); font-size: 1.05rem; line-height: 1.15; transform: rotate(6deg); box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12); background-image: linear-gradient(180deg, transparent 0, transparent 20px, rgba(27, 36, 51, 0.06) 20px, rgba(27, 36, 51, 0.06) 21px, transparent 21px); }
.sticky-note.sn-pink { background-color: var(--sticky-pink); transform: rotate(-5deg); }
.sticky-note.sn-green { background-color: var(--sticky-green); transform: rotate(4deg); }
.sticky-note.sn-blue { background-color: var(--sticky-blue); transform: rotate(-6deg); }

.filter-bar { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.f-btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0.5rem 1.1rem 0.55rem; border-radius: 4px 4px 0 4px; font-family: var(--hand-2); font-size: 0.95rem; font-weight: 400; letter-spacing: 0.01em; border: 1.5px solid var(--ink-3); color: var(--ink-2); background: var(--paper); cursor: pointer; user-select: none; box-shadow: 2px 2px 0 -1px var(--ink-3); transform: rotate(-0.5deg); transition: background-color var(--transition-bounce), color var(--transition-bounce), border-color var(--transition-bounce), box-shadow var(--transition-bounce), transform var(--transition-bounce), opacity var(--transition-bounce); }
.f-btn:nth-child(even) { transform: rotate(0.6deg); }
.f-btn:hover,
.f-btn:focus-visible { color: var(--ink); border-color: var(--ink); transform: translateY(-2px) rotate(0deg); box-shadow: 3px 3px 0 -1px var(--ink); outline: none; }
.f-btn.active { background: var(--sticky-yellow); color: #1a1814; border-color: var(--ink); font-weight: 700; transform: translateY(-2px) rotate(0deg); box-shadow: 3px 3px 0 -1px var(--ink); }
.f-btn.active::before { content: '\2713 '; font-family: var(--hand); color: var(--accent); font-weight: 700; font-size: 1.05rem; margin-right: 0.25rem; }
.f-btn:active { transform: translateY(1px) rotate(0deg); box-shadow: 1px 1px 0 -1px var(--ink-3); }

.icon-btn { width: 32px; height: 32px; border-radius: 50%; border: 1.5px solid var(--ink-3); background: var(--paper); color: var(--ink-3); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 0.95rem; transition: background-color var(--transition-bounce), color var(--transition-bounce), border-color var(--transition-bounce), box-shadow var(--transition-bounce), transform var(--transition-bounce), opacity var(--transition-bounce); -webkit-tap-highlight-color: transparent; }
.icon-btn:hover { background: var(--highlighter-yellow); color: var(--ink); border-color: var(--ink); transform: scale(1.08); }
.icon-btn[aria-pressed="true"],
.icon-btn.is-active { background: var(--accent); color: var(--paper); border-color: var(--accent); box-shadow: var(--shadow-md); }
.icon-btn[aria-pressed="true"]:hover,
.icon-btn.is-active:hover { background: var(--accent-2); color: var(--paper); }

.pathway-search-wrap { margin: 0 auto; max-width: 480px; position: relative; }
.pathway-search { box-sizing: border-box; width: 100%; padding: 0.85rem 2.6rem; font-family: var(--hand-2); font-size: 1rem; color: var(--ink); background: var(--paper); border: 1.5px solid var(--ink-3); border-radius: var(--radius-pill); box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.06); transition: background-color var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast), transform var(--transition-fast), opacity var(--transition-fast); }
.pathway-search:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus-ring); }
.pathway-search::placeholder { color: var(--ink-4); font-style: italic; }
.pathway-search-icon { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; font-size: 1.1rem; }
.search-clear { position: absolute; right: 0.5rem; top: 50%; transform: translateY(-50%); background: transparent; border: none; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; color: var(--ink-3); font-size: 1rem; display: none; align-items: center; justify-content: center; }
.search-clear.show { display: flex; }
.search-clear:hover { background: var(--highlighter-pink); color: var(--ink); }

.faq-list { max-width: 680px; }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-q { width: 100%; background: none; border: none; cursor: pointer; padding: 1.35rem 0; display: flex; justify-content: space-between; align-items: center; gap: 1rem; font-family: var(--sans); font-size: 0.95rem; font-weight: 600; color: var(--ink); text-align: left; border-radius: var(--radius-md); transition: background var(--transition-fast), transform var(--transition-fast); }
.faq-q:hover,
.faq-q:focus-visible { background: rgba(200, 57, 43, 0.08); outline: none; transform: translateX(4px); }
.faq-icon { font-size: 0.85rem; color: var(--ink-4); flex-shrink: 0; font-style: normal; width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: linear-gradient(180deg, var(--paper) 0%, var(--paper-2) 100%); border: 2px solid var(--border-2); transition: background-color var(--transition-bounce), color var(--transition-bounce), border-color var(--transition-bounce), box-shadow var(--transition-bounce), transform var(--transition-bounce), opacity var(--transition-bounce); }
.faq-item.open .faq-icon { transform: rotate(45deg); background: var(--accent); border-color: var(--accent); color: var(--paper); }
.faq-a { font-size: 0.875rem; line-height: 1.8; color: var(--ink-3); max-height: 0; overflow: hidden; visibility: hidden; transition: max-height 0.4s ease, padding 0.3s, visibility 0s linear 0.4s; padding: 0 0.5rem; }
.faq-item.open .faq-a { max-height: 500px; visibility: visible; transition-delay: 0s; padding: 0.5rem 0.5rem 1.5rem; }


.progress-bar { position: fixed; top: 0; left: 0; height: 3px; width: 0%; z-index: 600; background: linear-gradient(90deg, var(--accent), var(--gold), var(--gold-2)); border-radius: 0 var(--radius-pill) var(--radius-pill) 0; transition: width 80ms linear; box-shadow: 0 0 8px rgba(200, 57, 43, 0.4); }
.chip-particle { position: absolute; pointer-events: none; width: 7px; height: 7px; border-radius: 50%; z-index: 10000; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); animation: chipParticleBlast 650ms cubic-bezier(0.1, 0.8, 0.25, 1) forwards; }
@keyframes chipParticleBlast { 0% { transform: translate(0, 0) scale(1.5); opacity: 1; } 100% { transform: translate(var(--dx), var(--dy)) scale(0.2); opacity: 0; } }

/* ============================================================
   Shared components (badges, counter, no-results, theme transition)
============================================================ */
.pc-badges { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-bottom: 0.85rem; }
.pc-badge { font-family: var(--mono); font-size: 0.55rem; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.2rem 0.6rem; border-radius: var(--radius-pill); font-weight: 600; }
.pc-badge-diff-beginner { color: var(--sage); border: 1.5px solid color-mix(in srgb, var(--sage) 45%, transparent); background: color-mix(in srgb, var(--sage) 10%, transparent); }
.pc-badge-diff-intermediate { color: color-mix(in srgb, var(--gold) 45%, var(--ink)); border: 1.5px solid color-mix(in srgb, var(--gold) 55%, transparent); background: color-mix(in srgb, var(--gold) 14%, transparent); }
.pc-badge-diff-advanced { color: var(--accent); border: 1.5px solid color-mix(in srgb, var(--accent) 40%, transparent); background: color-mix(in srgb, var(--accent) 9%, transparent); }
.pc-badge-exam { color: var(--slate); border: 1.5px solid color-mix(in srgb, var(--slate) 40%, transparent); background: color-mix(in srgb, var(--slate) 8%, transparent); }

.pathway-counter { display: inline-flex; align-items: center; gap: 0.5rem; font-family: var(--mono); font-size: 0.7rem; color: var(--ink-4); padding: 0.3rem 0.8rem; background: var(--paper-2); border-radius: var(--radius-pill); border: 1.5px dashed var(--border-2); margin-top: 1rem; }
.pathway-counter strong { color: var(--accent); font-weight: 700; font-family: var(--mono); }
.pathway-counter .filter-reset { margin-left: 0.5rem; background: transparent; border: 1px dashed var(--ink-3); border-radius: var(--radius-pill); padding: 0.1rem 0.6rem; font-family: var(--hand-2); font-size: 0.78rem; color: var(--ink-3); cursor: pointer; display: none; }
.pathway-counter .filter-reset.show { display: inline-block; }
.pathway-counter .filter-reset:hover { color: var(--accent); border-color: var(--accent); }

.no-results { grid-column: 1 / -1; text-align: center; padding: 3rem 1rem; font-family: var(--hand); font-size: 1.3rem; color: var(--ink-3); }
.no-results strong { color: var(--accent); display: block; font-size: 1.5rem; margin-bottom: 0.5rem; }

.modal-btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.modal-btn.primary:hover { background: var(--accent-2); }

html.theme-transitioning, html.theme-transitioning *, html.theme-transitioning *::before, html.theme-transitioning *::after { transition: background-color 320ms ease, background-image 0ms, border-color 320ms ease, color 320ms ease, fill 320ms ease, stroke 320ms ease, box-shadow 320ms ease, outline-color 320ms ease !important; }

/* ============================================================
   Accessibility + dark-mode fixes
============================================================ */

/* Dark mode: --sticky-yellow dims to brown, so dark text on it is unreadable. */
html.dark .sticky-note,
html.dark .f-btn.active { color: var(--ink); }
/* .mf-chip.selected has a hard-coded dark gradient; --paper is dark in dark mode. */
html.dark .mf-chip.selected { color: var(--ink); }
html.dark .modal-btn.primary { color: var(--paper); }

.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); clip-path: inset(50%); white-space: nowrap; border: 0; }

/* Low-specificity fallback so every focusable control shows focus; components with their own ring win. */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Touch: 44px targets, and 16px inputs so iOS Safari does not zoom on focus. */
@media (pointer: coarse) {
    .icon-btn { width: 44px; height: 44px; }
    .search-clear { width: 40px; height: 40px; }
    .pathway-search, .ecosystem-input { font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
    .paper-card::before { animation: none; }
    .hero-scroll-indicator { animation: none; }
}

/* ============================================================
   Custom cursor (desktop, fine pointer only). JS adds html.has-custom-cursor
   after the first real mouse move, so the native cursor is never hidden
   unless the ring is actually following it.
============================================================ */
#cursor { position: fixed; inset: 0; pointer-events: none; z-index: 10000; display: none; }
html.has-custom-cursor #cursor { display: block; }
html.has-custom-cursor,
html.has-custom-cursor * { cursor: none !important; }
html.has-custom-cursor input,
html.has-custom-cursor textarea { cursor: text !important; }

#cursor-ring,
#cursor-dot { position: absolute; left: 0; top: 0; width: 0; height: 0; opacity: 0; transition: opacity 200ms ease; will-change: transform; }
html.cursor-visible #cursor-ring,
html.cursor-visible #cursor-dot { opacity: 1; }

#cursor-ring::before,
#cursor-dot::before { content: ''; position: absolute; border-radius: 50%; }
#cursor-ring::before { left: -18px; top: -18px; width: 36px; height: 36px; border: 1.5px solid var(--ink-3); transition: transform var(--transition-bounce), background-color var(--transition-fast), border-color var(--transition-fast); }
#cursor-dot::before { left: -3px; top: -3px; width: 6px; height: 6px; background: var(--accent); transition: transform var(--transition-bounce); }

body.cursor-hover #cursor-ring::before { transform: scale(1.55); background: var(--highlighter-yellow); border-color: var(--ink); }
body.cursor-hover #cursor-dot::before { transform: scale(0.5); }
body.cursor-click #cursor-ring::before { transform: scale(0.8); }

@media (hover: none), (pointer: coarse) { #cursor { display: none !important; } }
