/* ═══════════════════════════════════════════════════════════════════
   ScholarlyBrightMinds · Shared visual system
   All palette values are injected by theme.config.js at runtime.
   Do not hard-code colors here — use the --var names.
   ═══════════════════════════════════════════════════════════════════ */

:root {
    --display: 'Fraunces', Georgia, serif;
    --body:    'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
    --mono:    'JetBrains Mono', ui-monospace, monospace;
    --ease:    cubic-bezier(0.22, 0.61, 0.36, 1);

    --container-max: 1080px;
    --radius:        14px;
    --radius-s:      8px;

    /* These have default values here but are overwritten by theme.config.js */
    --bg: #0d1411; --bg-soft: #131a17; --bg-deep: #080d0b;
    --card: #182220; --card-soft: #141d1a;
    --text: #ebe4d0; --text-soft: #b5ad98; --muted: #6e685c;
    --border: #253029; --border-s: #1d2522;
    --accent: #6fab98; --accent-d: #93c8b4;
    --accent-bg: rgba(111,171,152,0.10); --accent-glow: rgba(111,171,152,0.20);
    --amber: #d4a668; --amber-bg: rgba(212,166,104,0.10); --amber-glow: rgba(212,166,104,0.18);

    --shadow-card:  0 20px 40px -24px rgba(0,0,0,0.55);
    --shadow-modal: 0 30px 80px -20px rgba(0,0,0,0.65);
    --mol-opacity:  0.09;
    --grid-opacity: 0.05;
    --overlay:      rgba(5,9,7,0.7);
}
:root[data-theme="light"] {
    --shadow-card:  0 18px 40px -24px rgba(45,55,50,0.18);
    --shadow-modal: 0 30px 80px -20px rgba(40,45,40,0.25);
    --mol-opacity:  0.06;
    --grid-opacity: 0.035;
    --overlay:      rgba(42,41,37,0.45);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
    font-family: var(--body);
    font-weight: 400;
    line-height: 1.55;
    background: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
    transition: background-color .6s var(--ease), color .4s var(--ease);
}

/* ─── Subtle hex grid texture (global) ─── */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 60 52' fill='none' stroke='%236fab98' stroke-width='0.5'><polygon points='30,2 56,17 56,37 30,52 4,37 4,17'/></svg>");
    background-size: 60px 52px;
    opacity: var(--grid-opacity);
    pointer-events: none;
    z-index: 0;
    transition: opacity .6s var(--ease);
}

/* ─── Floating molecular structures (fixed, subtle) ─── */
.mol-bg {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}
.mol-bg svg {
    position: absolute;
    opacity: var(--mol-opacity);
    stroke: var(--accent);
    fill: none;
    stroke-width: 1.2;
    transition: opacity .6s var(--ease);
}
.mol-bg svg circle { fill: var(--accent); stroke: none; }
.mol-bg svg.amber  { stroke: var(--amber); }
.mol-bg svg.amber circle { fill: var(--amber); }

.mol-1 { top: 8%;    left: 6%;   width: 140px; animation: drift1 52s ease-in-out infinite; }
.mol-2 { top: 32%;   right: 4%;  width: 110px; animation: drift2 68s ease-in-out infinite; }
.mol-3 { bottom: 14%; left: 8%;  width: 160px; animation: drift3 58s ease-in-out infinite; }
.mol-4 { top: 58%;   right: 10%; width: 95px;  animation: drift4 74s ease-in-out infinite; }
.mol-5 { top: 18%;   left: 45%;  width: 80px;  animation: drift5 62s ease-in-out infinite; }

@keyframes drift1 { 0%,100%{transform:translate(0,0) rotate(0)} 50%{transform:translate(28px,18px) rotate(14deg)} }
@keyframes drift2 { 0%,100%{transform:translate(0,0) rotate(0)} 50%{transform:translate(-22px,24px) rotate(-12deg)} }
@keyframes drift3 { 0%,100%{transform:translate(0,0) rotate(0)} 50%{transform:translate(20px,-16px) rotate(10deg)} }
@keyframes drift4 { 0%,100%{transform:translate(0,0) rotate(0)} 50%{transform:translate(-18px,-22px) rotate(-8deg)} }
@keyframes drift5 { 0%,100%{transform:translate(0,0) rotate(0)} 50%{transform:translate(15px,20px) rotate(18deg)} }

/* Everything above the background */
.header, main, footer, .nav { position: relative; z-index: 2; }

/* Scrollbar */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ═══════════════════════════════════════════════════════════════════
   NAV (shared across all pages)
   ═══════════════════════════════════════════════════════════════════ */
.nav {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 1.8rem 3rem 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}
.brand {
    font-family: var(--display);
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: 0.005em;
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--text);
    text-decoration: none;
}
.brand-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--accent);
    position: relative;
    flex-shrink: 0;
}
.brand-dot::after {
    content: '';
    position: absolute; inset: -4px;
    border-radius: 50%;
    border: 1px solid var(--accent);
    opacity: 0;
    animation: pulse 3s ease-out infinite;
}
@keyframes pulse {
    0%   { transform: scale(0.8); opacity: 0.7; }
    70%  { transform: scale(1.8); opacity: 0;   }
    100% { opacity: 0; }
}
.brand-meta {
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    padding-left: 0.7rem;
    margin-left: 0.4rem;
    border-left: 1px solid var(--border);
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1.6rem;
}
.nav-menu {
    display: flex;
    gap: 1.4rem;
    align-items: center;
}
.nav-item {
    font-family: var(--body);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: var(--muted);
    text-decoration: none;
    padding: 0.4rem 0.1rem;
    transition: color .2s;
    position: relative;
}
.nav-item:hover { color: var(--accent); }
.nav-item.active {
    color: var(--text);
}
.nav-item.active::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0.1rem;
    right: 0.1rem;
    height: 1px;
    background: var(--accent);
}

.theme-toggle {
    width: 34px; height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--card);
    cursor: pointer;
    display: grid;
    place-items: center;
    color: var(--text-soft);
    transition: all .3s var(--ease);
    padding: 0;
}
.theme-toggle:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: rotate(15deg);
}
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun  { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* Hamburger (mobile) */
.hamburger {
    display: none;
    cursor: pointer;
    width: 28px;
    flex-direction: column;
    gap: 5px;
}
.hamburger .bar {
    height: 1.5px;
    background: var(--text);
    border-radius: 2px;
    transition: transform .3s var(--ease), opacity .3s;
}
.hamburger.active .bar:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.hamburger.active .bar:nth-child(2) { opacity: 0; }
.hamburger.active .bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ═══════════════════════════════════════════════════════════════════
   MAIN CONTAINER
   ═══════════════════════════════════════════════════════════════════ */
main {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 3rem 4rem;
}
.container {
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 3rem;
}

/* ═══════════════════════════════════════════════════════════════════
   HERO (home page)
   ═══════════════════════════════════════════════════════════════════ */
.hero {
    padding: 4rem 0 3.5rem;
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 3rem;
    align-items: center;
}
.hero-text { min-width: 0; }
.hero-status {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    font-family: var(--mono);
    font-size: 0.7rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--accent);
    background: var(--accent-bg);
    border: 1px solid var(--accent-glow);
    padding: 0.4rem 0.85rem;
    border-radius: 2rem;
    margin-bottom: 1.8rem;
}
.hero-status .live-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent);
    position: relative;
}
.hero-status .live-dot::after {
    content: '';
    position: absolute; inset: -3px;
    border-radius: 50%;
    border: 1px solid var(--accent);
    animation: pulse 2.4s ease-out infinite;
}
.hero-meta {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 1.4rem;
}
.hero-meta::before {
    content: '';
    display: inline-block;
    width: 22px; height: 1px;
    background: var(--accent);
    vertical-align: middle;
    margin-right: 0.7rem;
    transform: translateY(-2px);
}
.hero h1 {
    font-family: var(--display);
    font-size: clamp(2.8rem, 6.5vw, 4.8rem);
    font-weight: 300;
    line-height: 1.02;
    letter-spacing: -0.02em;
    margin-bottom: 1.3rem;
    color: var(--text);
}
.hero h1 em {
    font-style: italic;
    font-weight: 300;
    color: var(--accent);
    position: relative;
}
.hero h1 em::after {
    content: '·';
    color: var(--amber);
    position: absolute;
    right: -0.3em; top: -0.1em;
    font-style: normal;
    font-size: 0.7em;
}
.hero-tagline {
    font-family: var(--display);
    font-size: clamp(1.05rem, 1.6vw, 1.25rem);
    font-style: italic;
    font-weight: 300;
    color: var(--text-soft);
    line-height: 1.5;
    max-width: 540px;
    margin-bottom: 2rem;
}
.hero-bio {
    color: var(--text-soft);
    font-size: 0.96rem;
    line-height: 1.75;
    max-width: 560px;
    margin-bottom: 2rem;
}
.hero-bio a { color: var(--accent); text-decoration: none; border-bottom: 1px dotted var(--accent-glow); }
.hero-bio a:hover { color: var(--accent-d); }

/* Profile image side of hero */
.hero-image {
    position: relative;
    aspect-ratio: 1 / 1;
    max-width: 340px;
    margin: 0 auto;
}
.hero-image::before {
    content: '';
    position: absolute;
    inset: -12px;
    border: 1px solid var(--border);
    border-radius: 50%;
    opacity: 0.5;
}
.hero-image::after {
    content: '';
    position: absolute;
    inset: -28px;
    border: 1px dashed var(--accent-glow);
    border-radius: 50%;
    opacity: 0.5;
    animation: spinSlow 90s linear infinite;
}
@keyframes spinSlow { to { transform: rotate(360deg); } }
.hero-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 2px solid var(--border);
    filter: saturate(0.95);
}

/* Hero chips */
.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 2rem;
}
.chip {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 2rem;
    padding: 0.45rem 0.95rem;
    font-size: 0.76rem;
    color: var(--text-soft);
    font-weight: 500;
    transition: all .25s var(--ease);
}
.chip:hover {
    transform: translateY(-1px);
    border-color: var(--accent);
    color: var(--text);
}
.chip .dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent);
    flex-shrink: 0;
}
.chip.gold .dot { background: var(--amber); }
.chip.gold     { border-color: var(--amber-glow); }

/* Social row */
.social-links {
    display: flex;
    gap: 0.7rem;
    flex-wrap: wrap;
}
.social-icon {
    width: 38px; height: 38px;
    border-radius: 50%;
    background: var(--card);
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
    transition: all .25s var(--ease);
    color: var(--text-soft);
    text-decoration: none;
}
.social-icon:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
}
.social-icon svg {
    width: 16px; height: 16px;
}

/* ═══════════════════════════════════════════════════════════════════
   SECTION STRUCTURE (shared across pages)
   ═══════════════════════════════════════════════════════════════════ */
.rule {
    border: none;
    height: 1px;
    background: var(--border);
    margin: 4.5rem 0 3rem;
    position: relative;
}
.rule::before {
    content: '';
    display: block;
    width: 40px;
    height: 1px;
    background: var(--accent);
}
.rule::after {
    content: '';
    position: absolute;
    left: 40px; top: -3px;
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--amber);
    opacity: 0.6;
}

.sec-kicker {
    font-family: var(--mono);
    font-size: 0.68rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
}
.sec-kicker::before {
    content: '§';
    font-family: var(--display);
    font-style: italic;
    color: var(--amber);
    font-size: 1.1em;
}
.sec-title {
    font-family: var(--display);
    font-size: clamp(1.8rem, 3.4vw, 2.3rem);
    font-weight: 300;
    line-height: 1.15;
    letter-spacing: -0.015em;
    margin-bottom: 2.2rem;
    color: var(--text);
}
.sec-title em {
    font-style: italic;
    color: var(--accent);
}

/* Sub-page hero (used on about/projects/pubs/blog) */
.sub-hero {
    padding: 4rem 0 2rem;
}
.sub-hero h1 {
    font-family: var(--display);
    font-size: clamp(2.4rem, 5vw, 3.6rem);
    font-weight: 300;
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: var(--text);
    margin-bottom: 0.5rem;
}
.sub-hero h1 em { font-style: italic; color: var(--accent); }
.sub-hero .sub-meta {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
}

/* ═══════════════════════════════════════════════════════════════════
   FOOTER (shared)
   ═══════════════════════════════════════════════════════════════════ */
footer {
    max-width: var(--container-max);
    margin: 3rem auto 0;
    padding: 2.2rem 3rem 2.5rem;
    border-top: 1px solid var(--border);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 1.6rem;
    align-items: start;
    font-family: var(--mono);
    font-size: 0.74rem;
    color: var(--muted);
    position: relative;
    z-index: 2;
}
.footer-left { line-height: 1.75; }
.footer-left .colophon {
    margin-top: 0.35rem;
    font-size: 0.66rem;
    opacity: 0.75;
    max-width: 480px;
}
.footer-left .colophon a { color: var(--muted); }
.footer-left .colophon a:hover { color: var(--accent); }
.footer-links {
    display: flex;
    gap: 1.4rem;
    align-items: center;
    flex-wrap: wrap;
}
.footer-links a {
    color: var(--muted);
    text-decoration: none;
    transition: color .2s;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}
.footer-links a:hover { color: var(--accent); }
.footer-links a::before {
    content: '→';
    color: var(--accent);
    opacity: 0;
    transform: translateX(-4px);
    transition: all .2s var(--ease);
}
.footer-links a:hover::before { opacity: 1; transform: translateX(0); }

/* ═══════════════════════════════════════════════════════════════════
   REVEAL ANIMATIONS
   ═══════════════════════════════════════════════════════════════════ */
.reveal {
    opacity: 0;
    transform: translateY(20px);
    transition: opacity .7s var(--ease), transform .7s var(--ease);
}
.reveal.vis {
    opacity: 1;
    transform: translateY(0);
}
.reveal-d1 { transition-delay: .08s; }
.reveal-d2 { transition-delay: .16s; }
.reveal-d3 { transition-delay: .24s; }
.reveal-d4 { transition-delay: .32s; }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
.hero > * { opacity: 0; animation: fadeIn .8s var(--ease) forwards; }
.hero > *:nth-child(1) { animation-delay: .1s; }
.hero > *:nth-child(2) { animation-delay: .22s; }

.hero-text > * { opacity: 0; animation: fadeIn .8s var(--ease) forwards; }
.hero-text > *:nth-child(1) { animation-delay: .15s; }
.hero-text > *:nth-child(2) { animation-delay: .27s; }
.hero-text > *:nth-child(3) { animation-delay: .39s; }
.hero-text > *:nth-child(4) { animation-delay: .51s; }
.hero-text > *:nth-child(5) { animation-delay: .63s; }
.hero-text > *:nth-child(6) { animation-delay: .75s; }

/* ═══════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 900px) {
    .hero { grid-template-columns: 1fr; gap: 2.4rem; }
    .hero-image { max-width: 260px; }
}
@media (max-width: 760px) {
    .nav, main, footer, .container {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
    .nav { flex-wrap: wrap; gap: 1rem; z-index: 100; }
    .brand-meta { display: none; }
    .nav-right { gap: 1rem; }
    .hamburger { display: flex; }
    .nav-menu {
        display: none;
        position: absolute;
        top: 100%; left: 0; right: 0;
        background: var(--card);
        border-top: 1px solid var(--border);
        border-bottom: 1px solid var(--border);
        padding: 1rem 1.5rem 1.2rem;
        flex-direction: column;
        gap: 0.5rem;
        align-items: flex-start;
        z-index: 101;
        box-shadow: 0 20px 40px -10px rgba(0,0,0,0.35);
    }
    .nav-menu.show { display: flex; }
    .nav-item { padding: 0.7rem 0.3rem; width: 100%; font-size: 0.92rem; }
    .nav-item.active::after { display: none; }
    .nav-item.active { color: var(--accent); }
    footer { grid-template-columns: 1fr; gap: 1.2rem; }
}
@media (prefers-reduced-motion: reduce) {
    .mol-bg svg { animation: none !important; }
    .brand-dot::after, .hero-status .live-dot::after,
    .hero-image::after { animation: none !important; }
    .hero > *, .hero-text > * { animation: none; opacity: 1; }
    .reveal { opacity: 1; transform: none; }
}
