/* ==========================================================================
   Mohamed Amine Kerkouri — Refined Academic
   Design system: warm-paper light (default) + calm dark, Fraunces + Inter,
   a single indigo accent, hairline borders, generous whitespace.
   ========================================================================== */

/* ---------- Design tokens: Light (default) ---------- */
:root {
    --bg:            #fcfbf8;   /* warm paper                */
    --bg-elevated:   #ffffff;   /* cards, header             */
    --bg-secondary:  #f4f1ea;   /* alternating sections      */
    --bg-tertiary:   #ece7dc;   /* chips, wells              */
    --text:          #201e1a;   /* ink                       */
    --text-secondary:#54504a;
    --text-muted:    #8a857b;
    --border:        #e7e2d6;
    --border-strong: #d6cfbf;
    --accent:        #3b4bd0;
    --accent-hover:  #2c3aad;
    --accent-contrast:#ffffff;
    --accent-soft:   rgba(59, 75, 208, 0.08);

    --font-serif: 'Fraunces', Georgia, 'Times New Roman', serif;
    --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono:  ui-monospace, 'SF Mono', 'JetBrains Mono', 'Fira Code', Menlo, Consolas, monospace;

    --max-width:     1120px;
    --reading-width: 720px;
    --header-height: 68px;

    --shadow-sm: 0 1px 2px rgba(30, 25, 15, 0.05);
    --shadow-md: 0 6px 20px -8px rgba(30, 25, 15, 0.14);
    --shadow-lg: 0 18px 48px -18px rgba(30, 25, 15, 0.22);

    --radius-sm: 5px;
    --radius-md: 9px;
    --radius-lg: 14px;
    --radius-full: 999px;

    --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

/* ---------- Design tokens: Dark ---------- */
[data-theme="dark"] {
    --bg:            #0e0e11;
    --bg-elevated:   #17171c;
    --bg-secondary:  #121216;
    --bg-tertiary:   #1e1e24;
    --text:          #eae7e0;
    --text-secondary:#a8a49b;
    --text-muted:    #726e66;
    --border:        #26262d;
    --border-strong: #35353f;
    --accent:        #a5adff;
    --accent-hover:  #c0c6ff;
    --accent-contrast:#0e0e11;
    --accent-soft:   rgba(165, 173, 255, 0.12);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 6px 20px -8px rgba(0, 0, 0, 0.6);
    --shadow-lg: 0 18px 48px -18px rgba(0, 0, 0, 0.7);
}

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

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-sans);
    font-size: 17px;
    line-height: 1.7;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    transition: background 0.4s var(--ease), color 0.4s var(--ease);
}

main { flex: 1 0 auto; }

::selection { background: var(--accent-soft); color: var(--text); }

a { color: var(--accent); text-decoration: none; transition: color 0.15s var(--ease); }
a:hover { color: var(--accent-hover); }

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

h1, h2, h3, h4, h5, h6 { color: var(--text); font-weight: 600; line-height: 1.22; }

/* Fraunces reserved for display + numerals */
.serif,
.hero-name, .section-title, .page-title, .post-title,
.prose h2, .prose h3,
.stat-number, .metric-num, .pub-year-label {
    font-family: var(--font-serif);
    font-weight: 500;
    letter-spacing: -0.01em;
    font-optical-sizing: auto;
}

/* ---------- Layout helpers ---------- */
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.5rem; }
.section { padding: 6rem 0; }
.section--tight { padding: 4.5rem 0; }
.section--alt { background: var(--bg-secondary); }
.divider { height: 1px; background: var(--border); border: 0; }

.eyebrow {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 0.9rem;
}

.section-head { max-width: 640px; margin-bottom: 3rem; }
.section-head.center { margin-left: auto; margin-right: auto; text-align: center; }
.section-title { font-size: clamp(1.9rem, 3.4vw, 2.5rem); }
.section-subtitle { color: var(--text-secondary); font-size: 1.075rem; margin-top: 0.75rem; }

.section-foot { margin-top: 2.75rem; }
.section-foot.center { text-align: center; }

/* ---------- Header / navigation ---------- */
.site-header {
    position: fixed;
    inset: 0 0 auto 0;
    height: var(--header-height);
    background: color-mix(in srgb, var(--bg-elevated) 82%, transparent);
    backdrop-filter: saturate(140%) blur(14px);
    -webkit-backdrop-filter: saturate(140%) blur(14px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
}

.nav-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 1.5rem;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.site-logo {
    font-family: var(--font-serif);
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    color: var(--text);
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
}
.site-logo:hover { color: var(--text); }
.site-logo .logo-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

.nav-menu { display: flex; list-style: none; gap: 1.6rem; align-items: center; }
.nav-menu a {
    color: var(--text-secondary);
    font-size: 0.92rem;
    font-weight: 500;
    padding: 0.4rem 0;
    position: relative;
}
.nav-menu a::after {
    content: '';
    position: absolute; left: 0; bottom: -2px;
    width: 0; height: 1.5px; background: var(--accent);
    transition: width 0.22s var(--ease);
}
.nav-menu a:hover { color: var(--text); }
.nav-menu a:hover::after, .nav-menu a.active::after { width: 100%; }
.nav-menu a.active { color: var(--text); }

.theme-toggle {
    background: transparent;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    width: 38px; height: 38px;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; color: var(--text-secondary);
    transition: all 0.2s var(--ease);
}
.theme-toggle:hover { color: var(--text); border-color: var(--border-strong); background: var(--bg-tertiary); }
.theme-toggle svg { width: 18px; height: 18px; }
.theme-toggle .moon-icon { display: none; }
.theme-toggle .sun-icon  { display: block; }
[data-theme="dark"] .theme-toggle .moon-icon { display: block; }
[data-theme="dark"] .theme-toggle .sun-icon  { display: none; }

.nav-toggle {
    display: none; flex-direction: column; gap: 5px;
    background: none; border: none; cursor: pointer; padding: 6px;
}
.nav-toggle span { display: block; width: 24px; height: 2px; background: var(--text); border-radius: 2px; transition: all 0.25s var(--ease); }
.nav-toggle.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex; align-items: center; gap: 0.5rem;
    padding: 0.7rem 1.35rem;
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-weight: 500; font-size: 0.925rem;
    line-height: 1; cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.18s var(--ease);
}
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover { background: var(--accent-hover); color: var(--accent-contrast); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--border-strong); }
.btn-secondary:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost { background: transparent; color: var(--text-secondary); padding: 0.4rem 0; }
.btn-ghost:hover { color: var(--accent); }
.btn-ghost .arrow { transition: transform 0.2s var(--ease); }
.btn-ghost:hover .arrow { transform: translateX(4px); }

/* ---------- Hero ---------- */
.hero { padding: calc(var(--header-height) + 5rem) 0 4.5rem; }
.hero-container {
    max-width: var(--max-width); margin: 0 auto; padding: 0 1.5rem;
    display: grid; grid-template-columns: 1.35fr 1fr; gap: 4rem; align-items: center;
}
.hero-eyebrow { color: var(--accent); }
.hero-name {
    font-size: clamp(2.8rem, 6vw, 4.4rem);
    line-height: 1.02; letter-spacing: -0.02em; font-weight: 500;
    margin-bottom: 1.1rem;
}
.hero-role { font-size: 1.2rem; color: var(--text); font-weight: 500; margin-bottom: 1.1rem; }
.hero-role .sep { color: var(--border-strong); margin: 0 0.55rem; }
.hero-description { font-size: 1.075rem; color: var(--text-secondary); max-width: 40rem; margin-bottom: 2rem; }
.hero-cta { display: flex; gap: 0.85rem; flex-wrap: wrap; align-items: center; }

.hero-portrait { position: relative; justify-self: center; }
.hero-portrait::before {
    content: ''; position: absolute; inset: 14px -14px -14px 14px;
    border: 1px solid var(--accent); border-radius: var(--radius-lg); z-index: 0;
    opacity: 0.6;
}
.hero-photo {
    position: relative; z-index: 1;
    width: 320px; max-width: 100%; aspect-ratio: 4 / 5; object-fit: cover;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    filter: saturate(1.02);
}

/* ---------- Metric strip ---------- */
.metrics {
    display: flex; flex-wrap: wrap; gap: 2.5rem 3.5rem;
    padding: 1.75rem 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.metrics.metrics--boxed {
    border: 1px solid var(--border); border-radius: var(--radius-lg);
    padding: 1.75rem 2rem; background: var(--bg-elevated); justify-content: space-between;
}
.metric-num { display: block; font-size: 2.4rem; line-height: 1; color: var(--text); }
.metric-num .plus { color: var(--accent); }
.metric-label { display: block; font-size: 0.8rem; color: var(--text-muted); margin-top: 0.5rem; letter-spacing: 0.02em; }
.metric-source { font-size: 0.8rem; color: var(--text-muted); }
.metric-source a { color: var(--text-secondary); }

/* ---------- News / highlights ---------- */
.news-list { display: flex; flex-direction: column; }
.news-item {
    display: grid; grid-template-columns: 108px 1fr; gap: 1.5rem;
    padding: 1.15rem 0; border-top: 1px solid var(--border);
    align-items: baseline;
}
.news-item:last-child { border-bottom: 1px solid var(--border); }
.news-date { font-size: 0.82rem; font-weight: 600; letter-spacing: 0.04em; color: var(--accent); text-transform: uppercase; }
.news-text { color: var(--text-secondary); font-size: 1rem; }
.news-text strong { color: var(--text); font-weight: 600; }
.news-text a { font-weight: 500; }

/* ---------- Publications ---------- */
.pub-controls { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; margin-bottom: 2rem; }
.pub-filters { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.filter-chip {
    font-family: var(--font-sans); font-size: 0.82rem; font-weight: 500;
    padding: 0.4rem 0.9rem; border-radius: var(--radius-full);
    border: 1px solid var(--border); background: transparent; color: var(--text-secondary);
    cursor: pointer; transition: all 0.16s var(--ease);
}
.filter-chip:hover { border-color: var(--border-strong); color: var(--text); }
.filter-chip.active { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); }
.pub-search {
    font-family: var(--font-sans); font-size: 0.9rem; color: var(--text);
    background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 0.5rem 0.9rem; min-width: 220px;
}
.pub-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.pub-year-group { margin-bottom: 2.5rem; }
.pub-year-label { font-size: 1.6rem; color: var(--text-muted); margin-bottom: 1rem; }

.pub-list { display: flex; flex-direction: column; }
.pub-item {
    display: grid; grid-template-columns: 1fr auto; gap: 1.25rem;
    padding: 1.4rem 0; border-top: 1px solid var(--border);
    transition: opacity 0.2s var(--ease);
}
.pub-item:last-child { border-bottom: 1px solid var(--border); }
.pub-title { font-size: 1.075rem; font-weight: 600; line-height: 1.4; margin-bottom: 0.4rem; }
.pub-title a { color: var(--text); }
.pub-title a:hover { color: var(--accent); }
.pub-authors { font-size: 0.92rem; color: var(--text-secondary); margin-bottom: 0.3rem; }
.pub-authors strong { color: var(--text); font-weight: 600; }
.pub-venue { font-size: 0.9rem; color: var(--text-muted); }
.pub-venue .venue-name { font-style: italic; }
.pub-badges { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; align-items: center; }
.pub-type {
    font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
    color: var(--accent); background: var(--accent-soft); padding: 0.2rem 0.55rem; border-radius: var(--radius-sm);
}
.pub-cites { font-size: 0.78rem; color: var(--text-muted); }
.pub-links { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.pub-link {
    font-size: 0.78rem; font-weight: 500; padding: 0.25rem 0.7rem;
    border: 1px solid var(--border); border-radius: var(--radius-full);
    color: var(--text-secondary); background: transparent; cursor: pointer;
    transition: all 0.15s var(--ease); display: inline-flex; align-items: center; gap: 0.3rem;
}
.pub-link:hover { border-color: var(--accent); color: var(--accent); }
.pub-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.6rem; text-align: right; white-space: nowrap; }
.pub-empty { color: var(--text-muted); padding: 2rem 0; display: none; }

/* Cite modal */
.cite-modal {
    position: fixed; inset: 0; z-index: 2000; display: none;
    align-items: center; justify-content: center; padding: 1.5rem;
    background: color-mix(in srgb, #000 55%, transparent);
    backdrop-filter: blur(3px);
}
.cite-modal.open { display: flex; }
.cite-box {
    background: var(--bg-elevated); border: 1px solid var(--border);
    border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
    max-width: 640px; width: 100%; padding: 1.75rem;
}
.cite-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.cite-head h3 { font-size: 1.1rem; }
.cite-close { background: none; border: none; cursor: pointer; color: var(--text-muted); font-size: 1.5rem; line-height: 1; }
.cite-close:hover { color: var(--text); }
.cite-pre {
    font-family: var(--font-mono); font-size: 0.82rem; line-height: 1.6;
    background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-md);
    padding: 1rem; overflow-x: auto; white-space: pre; color: var(--text-secondary);
}
.cite-actions { margin-top: 1rem; display: flex; justify-content: flex-end; }

/* ---------- Cards (selected work / research / projects / posts) ---------- */
.card-grid { display: grid; gap: 1.5rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

.card {
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.75rem;
    transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
    display: flex; flex-direction: column;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }

/* Selected work */
.work-card .work-topic { font-size: 0.74rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); margin-bottom: 0.75rem; }
.work-card .work-title { font-size: 1.15rem; font-weight: 600; line-height: 1.35; margin-bottom: 0.6rem; }
.work-card .work-title a { color: var(--text); }
.work-card .work-title a:hover { color: var(--accent); }
.work-card .work-meta { font-size: 0.86rem; color: var(--text-muted); margin-top: auto; padding-top: 1rem; }
.work-card .work-meta .cites { color: var(--accent); font-weight: 600; }

/* Research areas */
.area-card .area-icon {
    width: 44px; height: 44px; border-radius: var(--radius-md);
    background: var(--accent-soft); color: var(--accent);
    display: flex; align-items: center; justify-content: center; margin-bottom: 1.1rem;
}
.area-card .area-icon svg { width: 22px; height: 22px; }
.area-card h3 { font-size: 1.15rem; margin-bottom: 0.5rem; }
.area-card p { color: var(--text-secondary); font-size: 0.94rem; }

/* Projects */
.project-card .project-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.9rem; }
.project-name { font-family: var(--font-mono); font-size: 1.02rem; font-weight: 600; color: var(--text); display: inline-flex; align-items: center; gap: 0.5rem; }
.project-name svg { width: 18px; height: 18px; color: var(--text-muted); }
.project-stars { font-size: 0.8rem; color: var(--text-muted); display: inline-flex; align-items: center; gap: 0.3rem; }
.project-stars svg { width: 14px; height: 14px; }
.project-desc { color: var(--text-secondary); font-size: 0.94rem; margin-bottom: 1rem; }
.project-paper { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 1rem; font-style: italic; }
.project-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: auto; }
.tag {
    font-size: 0.72rem; font-weight: 500; letter-spacing: 0.02em;
    padding: 0.22rem 0.6rem; border-radius: var(--radius-full);
    background: var(--bg-tertiary); color: var(--text-secondary);
}
.tag.lang { color: var(--accent); background: var(--accent-soft); }

/* ---------- Blog cards & post ---------- */
.post-card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease); display: flex; flex-direction: column; }
.post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.post-card-band { height: 6px; background: linear-gradient(90deg, var(--accent), color-mix(in srgb, var(--accent) 40%, var(--bg-tertiary))); }
.post-card-body { padding: 1.6rem; display: flex; flex-direction: column; flex: 1; }
.post-card-date { font-size: 0.78rem; color: var(--text-muted); letter-spacing: 0.03em; text-transform: uppercase; }
.post-card-title { font-size: 1.2rem; font-weight: 600; line-height: 1.35; margin: 0.55rem 0 0.7rem; }
.post-card-title a { color: var(--text); }
.post-card-title a:hover { color: var(--accent); }
.post-card-excerpt { color: var(--text-secondary); font-size: 0.95rem; }
.post-card-tags { margin-top: 1.1rem; display: flex; flex-wrap: wrap; gap: 0.4rem; }

/* ---------- Page scaffold & prose ---------- */
.page { max-width: var(--max-width); margin: 0 auto; padding: calc(var(--header-height) + 4rem) 1.5rem 5rem; }
.page-header { max-width: var(--reading-width); margin-bottom: 3rem; }
.page-title { font-size: clamp(2.2rem, 4.5vw, 3.1rem); font-weight: 500; }
.page-subtitle { font-size: 1.15rem; color: var(--text-secondary); margin-top: 0.75rem; }

.prose { max-width: var(--reading-width); }
.prose > * + * { margin-top: 1.1rem; }
.prose h2 { font-size: 1.7rem; margin-top: 2.75rem; }
.prose h3 { font-size: 1.28rem; margin-top: 2rem; font-weight: 600; font-family: var(--font-serif); }
.prose p, .prose li { color: var(--text-secondary); }
.prose strong { color: var(--text); }
.prose ul, .prose ol { padding-left: 1.35rem; }
.prose li + li { margin-top: 0.4rem; }
.prose li::marker { color: var(--accent); }
.prose a { text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.prose a:hover { text-decoration-color: var(--accent); }
.prose blockquote { border-left: 3px solid var(--accent); padding-left: 1.2rem; color: var(--text-secondary); font-style: italic; }
.prose code { font-family: var(--font-mono); font-size: 0.88em; background: var(--bg-tertiary); padding: 0.15em 0.4em; border-radius: var(--radius-sm); }
.prose pre { background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 1rem 1.2rem; overflow-x: auto; }
.prose pre code { background: none; padding: 0; }
.prose img { border-radius: var(--radius-md); border: 1px solid var(--border); margin: 1.5rem 0; }

/* Article (blog post) */
.post-article { max-width: var(--reading-width); margin: 0 auto; padding: calc(var(--header-height) + 4rem) 1.5rem 4rem; }
.post-header { margin-bottom: 2.5rem; padding-bottom: 2rem; border-bottom: 1px solid var(--border); }
.post-title { font-size: clamp(2rem, 4.5vw, 3rem); font-weight: 500; line-height: 1.12; }
.post-meta { margin-top: 1rem; font-size: 0.9rem; color: var(--text-muted); display: flex; gap: 0.6rem; flex-wrap: wrap; align-items: center; }
.post-meta .post-category { color: var(--accent); }
.post-content { font-size: 1.075rem; }
.post-tags { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); display: flex; flex-wrap: wrap; gap: 0.5rem; }
.post-nav { max-width: var(--reading-width); margin: 0 auto 4rem; padding: 0 1.5rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.post-nav a { font-size: 0.92rem; color: var(--text-secondary); max-width: 48%; }
.post-nav a:hover { color: var(--accent); }

/* ---------- CV ---------- */
.cv-layout { display: grid; grid-template-columns: 1fr; gap: 3rem; }
.cv-section { margin-bottom: 0; }
.cv-section > h2 { font-family: var(--font-serif); font-weight: 500; font-size: 1.65rem; margin-bottom: 1.5rem; padding-bottom: 0.6rem; border-bottom: 1px solid var(--border); }
.cv-item { padding: 0 0 1.5rem 1.5rem; border-left: 2px solid var(--border); position: relative; }
.cv-item:last-child { padding-bottom: 0; }
.cv-item::before { content: ''; position: absolute; left: -6px; top: 6px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.cv-item-header { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: baseline; }
.cv-item-title { font-size: 1.1rem; font-weight: 600; }
.cv-item-date { font-size: 0.82rem; color: var(--text-muted); font-family: var(--font-mono); white-space: nowrap; }
.cv-item-subtitle { color: var(--accent); font-size: 0.95rem; font-weight: 500; margin: 0.15rem 0 0.5rem; }
.cv-item-description { color: var(--text-secondary); font-size: 0.96rem; }
.cv-item-description ul { padding-left: 1.2rem; margin-top: 0.4rem; }
.cv-skills h4 { font-size: 0.95rem; margin-top: 1.1rem; margin-bottom: 0.2rem; }
.cv-skills h4:first-child { margin-top: 0; }
.cv-skills p { color: var(--text-secondary); font-size: 0.96rem; }

/* ---------- Contact ---------- */
.contact-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 3rem; }
.contact-col h3 { font-family: var(--font-serif); font-weight: 500; font-size: 1.35rem; margin-bottom: 1.25rem; }
.contact-col h3 + p { color: var(--text-secondary); margin-bottom: 1.5rem; }
.contact-item { display: flex; gap: 1rem; padding: 0.9rem 0; border-top: 1px solid var(--border); align-items: center; }
.contact-item:first-of-type { border-top: none; }
.contact-icon { flex-shrink: 0; width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--bg-tertiary); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.contact-icon svg { width: 18px; height: 18px; }
.contact-details strong { display: block; font-size: 0.92rem; color: var(--text); }
.contact-details a, .contact-details span, .contact-details p { font-size: 0.92rem; color: var(--text-secondary); }
.contact-col ul { padding-left: 1.2rem; color: var(--text-secondary); }
.contact-col li::marker { color: var(--accent); }

/* ---------- Footer ---------- */
.site-footer { background: var(--bg-secondary); border-top: 1px solid var(--border); margin-top: auto; }
.footer-container { max-width: var(--max-width); margin: 0 auto; padding: 3rem 1.5rem; display: flex; flex-wrap: wrap; gap: 2rem; align-items: center; justify-content: space-between; }
.footer-name { font-family: var(--font-serif); font-size: 1.2rem; font-weight: 500; color: var(--text); }
.footer-title { font-size: 0.9rem; color: var(--text-muted); margin-top: 0.25rem; }
.footer-links { display: flex; gap: 0.6rem; }
.footer-links a { width: 40px; height: 40px; border-radius: var(--radius-md); border: 1px solid var(--border); display: flex; align-items: center; justify-content: center; color: var(--text-secondary); transition: all 0.18s var(--ease); }
.footer-links a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-2px); }
.footer-copyright { flex-basis: 100%; padding-top: 1.5rem; border-top: 1px solid var(--border); font-size: 0.84rem; color: var(--text-muted); }

/* ---------- Scroll reveal (only hidden when JS is available) ---------- */
.js .reveal { opacity: 0; transform: translateY(16px); transition: opacity 0.6s var(--ease), transform 0.6s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
    .hero-container { grid-template-columns: 1fr; gap: 2.5rem; }
    .hero-portrait { order: -1; justify-self: start; }
    .hero-photo { width: 240px; }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
    .contact-grid { grid-template-columns: 1fr; gap: 2rem; }
}

@media (max-width: 720px) {
    body { font-size: 16px; }
    .section { padding: 4rem 0; }
    .nav-toggle { display: flex; }
    .nav-menu {
        position: fixed; inset: var(--header-height) 0 auto 0;
        flex-direction: column; align-items: flex-start; gap: 0.25rem;
        background: var(--bg-elevated); border-bottom: 1px solid var(--border);
        padding: 1rem 1.5rem 1.5rem; box-shadow: var(--shadow-md);
        transform: translateY(-8px); opacity: 0; pointer-events: none;
        transition: opacity 0.2s var(--ease), transform 0.2s var(--ease);
    }
    .nav-menu.active { transform: none; opacity: 1; pointer-events: auto; }
    .nav-menu a { padding: 0.55rem 0; width: 100%; }
    .nav-menu li:last-child { margin-top: 0.5rem; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .metrics { gap: 1.5rem 2.5rem; }
    .metrics.metrics--boxed { padding: 1.5rem; }
    .metric-num { font-size: 2rem; }
    .news-item { grid-template-columns: 1fr; gap: 0.3rem; }
    .pub-item { grid-template-columns: 1fr; }
    .pub-side { flex-direction: row; align-items: center; text-align: left; }
    .pub-controls { flex-direction: column; align-items: stretch; }
    .pub-search { width: 100%; }
    .cv-item-header { flex-direction: column; }
}

/* ---------- Motion preferences ---------- */
@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
    .js .reveal { opacity: 1; transform: none; }
}
