/* ==========================================================================
   tomislavmarsic.eu — styles.css
   Palette: navy #0a1628 · gold #c9a962 (decorative only) · cream #f8f5f0
   Text-role gold: --color-accent-ink on light, --color-accent-soft on dark
   ========================================================================== */

/* --------------------------------------------------------------------------
   Fonts — variable, latin subset (real faces first in every stack;
   no faux bold: one variable file per face/style)
   -------------------------------------------------------------------------- */
@font-face {
    font-family: 'Playfair Display';
    font-style: normal;
    font-weight: 400 700;
    font-display: swap;
    src: url('../fonts/playfair-display-normal.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Playfair Display';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/playfair-display-italic-400.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'IBM Plex Sans';
    font-style: normal;
    font-weight: 400 600;
    font-display: swap;
    src: url('../fonts/ibm-plex-sans-latin-var.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --color-navy: #0a1628;
    --color-navy-dark: #060e1a;
    --color-navy-light: #162a45;
    --color-gold: #c9a962;        /* DECORATIVE ONLY: rules, frames, bars, borders */
    --color-gold-light: #e0c88b;  /* reserved bright gold */
    --color-accent-ink: #7a6124;  /* gold as TEXT on light/cream — 5.42:1 on #f8f5f0 */
    --color-accent-soft: #d9bc7a; /* gold as TEXT on navy/dark — 9.86:1 on #0a1628 */
    --color-cream: #f8f5f0;
    --color-white: #ffffff;
    --color-text-dark: #1a1a1a;
    --color-text-light: #666666;
    --color-cream-muted: #d6d0c4; /* secondary text on navy — 11.8:1 */

    --font-heading: 'Playfair Display', Georgia, 'Times New Roman', serif;
    --font-body: 'IBM Plex Sans', 'Segoe UI', system-ui, sans-serif;

    --transition-standard: all 0.3s ease;
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 20px 40px rgba(0, 0, 0, 0.12);
    --radius: 2px;

    --hero-height: 60vh;
    --hero-min-height: 450px;
    --nav-safe-height: 92px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--color-white);
    color: var(--color-text-dark);
    line-height: 1.6;
    overflow-x: hidden;
}

/* The copy-email button ships with the `hidden` attribute; the .btn display
   rule below would override the UA default, so enforce it. */
[hidden] {
    display: none !important;
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--color-navy);
}

a {
    text-decoration: none;
    color: inherit;
    text-underline-offset: 2px;
    transition: var(--transition-standard);
}

/* Browser surfaces */
::selection {
    background-color: var(--color-navy);
    color: var(--color-cream);
}

body.dark-mode ::selection,
.contact-section ::selection {
    background-color: var(--color-accent-soft);
    color: var(--color-navy);
}

:focus-visible {
    outline: 2px solid var(--color-accent-ink);
    outline-offset: 2px;
}

body.dark-mode :focus-visible,
.contact-section :focus-visible,
.navbar :focus-visible,
.footer :focus-visible {
    outline-color: var(--color-accent-soft);
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 15px;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 500;
    letter-spacing: 0.02em;
    line-height: 1.2;
    padding: 12px 26px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.btn-primary {
    background-color: var(--color-navy);
    border-color: var(--color-navy);
    color: var(--color-cream);
}

.btn-primary:hover {
    background-color: var(--color-navy-dark);
    border-color: var(--color-accent-ink);
    color: var(--color-cream);
}

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

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

/* Buttons on the navy contact band */
.contact-section .btn-primary {
    background-color: var(--color-cream);
    border-color: var(--color-cream);
    color: var(--color-navy);
}

.contact-section .btn-primary:hover {
    background-color: var(--color-white);
    border-color: var(--color-accent-soft);
    color: var(--color-navy);
}

.contact-section .btn-secondary {
    background-color: transparent;
    border-color: rgba(248, 245, 240, 0.5);
    color: var(--color-cream);
}

.contact-section .btn-secondary:hover {
    background-color: var(--color-cream);
    border-color: var(--color-cream);
    color: var(--color-navy);
}

/* Typography Utils */
.section-title {
    font-size: 3rem;
    margin-bottom: 1rem;
    position: relative;
    display: inline-block;
}

.section-divider {
    height: 3px;
    width: 60px;
    background-color: var(--color-gold); /* decorative bar */
    margin-bottom: 3rem;
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    padding: 20px 0;
    z-index: 1000;
    transition: var(--transition-standard);
    background-color: transparent;
    color: var(--color-white);
}

.navbar.scrolled {
    background-color: var(--color-navy);
    padding: 15px 0;
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.2);
}

.nav-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
}

.nav-logo {
    font-family: var(--font-heading);
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--color-white);
    letter-spacing: 2px;
    margin-right: auto;
    opacity: 0;
    transform: translateY(-5px);
    transition: opacity 0.3s ease, transform 0.3s ease, color 0.3s ease;
    pointer-events: none;
}

.navbar.scrolled .nav-logo {
    color: var(--color-accent-soft);
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.nav-links {
    display: flex;
    gap: 30px;
}

.nav-item {
    font-family: var(--font-body);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--color-white);
    position: relative;
    padding-bottom: 5px;
}

.nav-item::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 1px;
    background-color: var(--color-gold); /* decorative underline */
    transition: width 0.3s ease;
}

.nav-item:hover::after {
    width: 100%;
}

.navbar.scrolled .nav-item {
    color: var(--color-cream);
}

.nav-item.active {
    color: var(--color-accent-soft);
}

.nav-item.active::after {
    width: 100%;
}

/* Language switcher — stays visible in the bar on all viewports */
.nav-lang {
    display: flex;
    align-items: center;
    gap: 14px;
}

.nav-lang-item {
    font-family: var(--font-body);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: rgba(255, 255, 255, 0.75);
    padding-bottom: 2px;
    border-bottom: 1px solid transparent;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.nav-lang-item:hover {
    color: var(--color-accent-soft);
}

.nav-lang-item.active {
    color: var(--color-accent-soft);
    border-bottom-color: var(--color-accent-soft);
}

/* Mobile Toggle (real button; JS adds .open and CSS morphs the spans to an X) */
.nav-toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: transparent;
    border: none;
    padding: 6px 2px;
    cursor: pointer;
}

.nav-toggle span {
    display: block;
    width: 25px;
    height: 2px;
    background-color: var(--color-white);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-toggle.open span:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
}

.nav-toggle.open span:nth-child(2) {
    opacity: 0;
}

.nav-toggle.open span:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
}

/* Hero Section */
.hero {
    height: var(--hero-height);
    min-height: var(--hero-min-height);
    width: 100%;
    background-image: url('../images/oxford-radfahrer-hero.jpg');
    background-repeat: no-repeat;
    background-position: 15% 100%;
    background-size: cover;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: var(--nav-safe-height);
    padding-bottom: 70px; /* Reserve space for scroll indicator */
    background-attachment: fixed; /* Parallax */
}

/* Strengthened navy overlay: keeps white hero text >= 4.5:1 over the
   grayscale photograph */
.hero-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(10, 22, 40, 0.85) 0%, rgba(10, 22, 40, 0.55) 100%);
}

.hero-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: var(--color-white);
    padding: 18px 28px;
    background: linear-gradient(160deg, rgba(10, 22, 40, 0.55) 0%, rgba(10, 22, 40, 0.28) 100%);
    border: 1px solid rgba(224, 200, 139, 0.42);
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.25);
    backdrop-filter: blur(2px);
}

.hero-title {
    font-size: clamp(2rem, 4.2vw, 3rem);
    font-weight: 700;
    color: var(--color-white);
    margin-bottom: 0.6rem;
    letter-spacing: -1px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

/* Hero subtitle: sans-serif voice now — uppercase letterspaced */
.hero-subtitle {
    font-family: var(--font-body);
    font-size: clamp(0.8rem, 1.2vw, 0.95rem);
    font-weight: 500;
    letter-spacing: 2.2px;
    text-transform: uppercase;
    line-height: 1.6;
    color: var(--color-accent-soft);
    margin-bottom: 0.8rem;
}

.hero-divider {
    width: 72px;
    height: 2px;
    background-color: var(--color-white);
    margin: 0 auto;
    opacity: 0.7;
}

/* Scroll Indicator */
.scroll-indicator {
    position: absolute;
    bottom: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2;
    opacity: 0.65;
}

.mouse {
    width: 30px;
    height: 50px;
    border: 2px solid var(--color-white);
    border-radius: 20px;
    display: block;
    position: relative;
}

.wheel {
    width: 4px;
    height: 8px;
    background: var(--color-white);
    border-radius: 2px;
    position: absolute;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    animation: scroll 1.5s infinite;
}

@keyframes scroll {
    0% { top: 10px; opacity: 1; }
    100% { top: 30px; opacity: 0; }
}

/* Sections General */
.section {
    padding: 120px 0;
}

/* About Section */
.about-section {
    background-color: var(--color-cream);
}

.about-grid {
    display: grid;
    grid-template-columns: minmax(300px, 0.95fr) minmax(0, 1.45fr);
    gap: clamp(32px, 5vw, 72px);
    align-items: start;
}

.about-image-wrapper {
    padding: 16px;
    align-self: start;
    position: sticky;
    top: 120px;
}

.image-frame {
    position: relative;
    z-index: 2;
    border-radius: 4px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
}

.profile-image {
    width: 100%;
    height: auto;
    display: block;
    transition: transform 0.5s ease;
}

.about-image-wrapper:hover .profile-image {
    transform: scale(1.03);
}

.image-accent {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border: 2px solid var(--color-gold); /* decorative frame */
    z-index: 1;
    transform: translate(-20px, -20px);
    transition: transform 0.5s ease;
}

.about-image-wrapper:hover .image-accent {
    transform: translate(-10px, -10px);
}

.about-text {
    background: var(--color-white);
    border-left: 3px solid var(--color-gold); /* decorative bar */
    padding: clamp(24px, 4vw, 42px);
    box-shadow: var(--shadow-soft);
}

.about-text .section-title {
    margin-bottom: 1.4rem;
}

.bio-content p {
    margin-bottom: 1.2rem;
    font-family: var(--font-body);
    font-size: 1.02rem;
    line-height: 1.8;
    color: var(--color-text-light);
    max-width: 68ch;
    hyphens: auto;
}

.bio-content .bio-lead {
    font-size: 1.08rem;
    color: var(--color-text-dark);
}

/* Publications (homepage + publications/posts pages) */
.publications-section {
    background-color: var(--color-cream);
}

.publications-list {
    display: flex;
    flex-direction: column;
    gap: 30px;
    max-width: 900px;
    margin: 0 auto;
}

.publication-item {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 30px;
    padding-bottom: 30px;
    border-bottom: 1px solid rgba(10, 22, 40, 0.1);
}

.publication-item:last-child {
    border-bottom: none;
}

.pub-year {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--color-accent-ink);
}

/* Homepage publication titles are h3; h4 kept as an identical fallback for
   the publications/posts pages until the markup switch lands there too */
.pub-details h3,
.pub-details h4 {
    font-family: var(--font-heading);
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    line-height: 1.3;
}

.pub-details p {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    color: var(--color-text-light);
    font-style: normal;
}

/* Work Sections (homepage case studies) */
.work-section {
    padding: 120px 0;
}

.work-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: clamp(32px, 5vw, 64px);
    align-items: center;
}

.work-copy p {
    font-size: 1rem;
    line-height: 1.7;
    color: var(--color-text-light);
    margin-bottom: 1rem;
    max-width: 68ch;
    hyphens: auto;
}

.work-copy .work-lead {
    font-size: 1.08rem;
    color: var(--color-text-dark);
}

.work-shot a {
    display: block;
}

.work-shot img {
    width: 100%;
    height: auto;
    display: block;
    border: 1px solid rgba(10, 22, 40, 0.12);
    border-radius: var(--radius);
    box-shadow: var(--shadow-soft);
    transition: box-shadow 0.3s ease;
}

.work-shot a:hover img,
.work-shot a:focus-visible img {
    box-shadow: var(--shadow-hover);
}

/* Contact band — full-width navy bookend to the hero */
.contact-section {
    background-color: var(--color-navy);
    color: var(--color-cream);
    padding: 120px 0;
}

.contact-section .section-title {
    color: var(--color-cream);
}

.contact-inner {
    max-width: 760px;
    margin: 0 auto;
    text-align: center;
}

.contact-lead {
    font-size: 1.15rem;
    line-height: 1.7;
    color: var(--color-cream-muted); /* 11.8:1 on navy */
    max-width: 60ch;
    margin: 0 auto 2.25rem;
}

.contact-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 16px;
    margin-top: 2.25rem;
}

.contact-noscript {
    margin-top: 1.5rem;
    font-size: 0.85rem;
    color: #aca699; /* 7.5:1 on navy */
}

/* Footer */
.footer {
    background-color: var(--color-navy);
    color: var(--color-white);
    /* bottom clearance so the fixed dock never covers the colophon */
    padding: 80px 0 calc(30px + 88px);
}

.footer-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 50px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 50px;
}

.footer-brand .logo-text {
    font-family: var(--font-heading);
    font-size: 2rem;
    display: block;
    margin-bottom: 5px;
}

.footer-role {
    color: var(--color-accent-soft);
    font-family: var(--font-heading);
    font-style: italic;
    letter-spacing: 1px;
}

.footer-links {
    display: flex;
    gap: 30px;
}

.footer-links a {
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.footer-links a:hover {
    color: var(--color-accent-soft);
}

.footer-bottom {
    text-align: center;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
}

/* Animations — gated behind html.js so visitors without JavaScript see all
   content immediately; the JS observer adds .visible to reveal them */
html.js .fade-in,
html.js .fade-in-up,
html.js .fade-in-left,
html.js .fade-in-right {
    opacity: 0;
}

html.js .fade-in { transition: opacity 1s ease-out; }
html.js .fade-in-up { transform: translateY(30px); transition: all 1s ease-out; }
html.js .fade-in-left { transform: translateX(-30px); transition: all 1s ease-out; }
html.js .fade-in-right { transform: translateX(30px); transition: all 1s ease-out; }

.visible,
html.js .visible {
    opacity: 1;
    transform: translate(0, 0);
}

/* Responsive */
@media (max-width: 992px) {
    .about-grid {
        grid-template-columns: 1fr;
        text-align: left;
    }

    .about-image-wrapper {
        position: relative;
        max-width: 420px;
    }

    .about-text {
        border-left: none;
        border-top: 3px solid var(--color-gold);
    }

    .image-accent {
        left: 0;
        width: 100%;
        transform: translate(-16px, -16px);
    }

    .about-image-wrapper:hover .image-accent {
        transform: translate(-8px, -8px);
    }
}

/* ===== SUBPAGE STYLES ===== */
body.subpage {
    padding-top: 0;
}

/* Page Header (for subpages) */
.page-header {
    height: 35vh;
    min-height: 280px;
    width: 100%;
    background-image: url('../images/oxford-radfahrer-hero.jpg');
    background-repeat: no-repeat;
    background-position: 15% 100%;
    background-size: cover;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding-top: var(--nav-safe-height);
}

.page-header-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(10, 22, 40, 0.88) 0%, rgba(10, 22, 40, 0.6) 100%);
}

.page-header-content {
    position: relative;
    z-index: 2;
    text-align: center;
    color: var(--color-white);
}

.page-title {
    font-size: clamp(2rem, 4vw, 3.5rem);
    font-weight: 700;
    margin-bottom: 0.8rem;
    letter-spacing: -1px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    color: var(--color-white);
}

.page-header-divider {
    width: 80px;
    height: 3px;
    background-color: var(--color-gold); /* decorative bar */
    margin: 0 auto;
}

/* ===== CV PAGE LAYOUT ===== */
.cv-layout {
    display: grid;
    grid-template-columns: 280px 1fr;
    max-width: 1400px;
    margin: 0 auto;
    padding: 60px 30px;
    gap: 60px;
}

/* CV Sidebar Navigation */
.cv-sidebar {
    position: sticky;
    top: 100px;
    height: fit-content;
}

.cv-nav {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.cv-nav-item {
    padding: 12px 20px;
    font-size: 0.9rem;
    color: var(--color-text-light);
    border-left: 3px solid transparent;
    transition: all 0.3s ease;
}

.cv-nav-item:hover,
.cv-nav-item.active {
    color: var(--color-navy);
    border-left-color: var(--color-gold);
    background-color: rgba(201, 169, 98, 0.08);
}

/* CV Content Area */
.cv-content {
    max-width: 900px;
}

.cv-section {
    margin-bottom: 60px;
    scroll-margin-top: 100px;
}

.cv-section-title {
    font-size: 2rem;
    margin-bottom: 0.8rem;
    color: var(--color-navy);
}

.cv-section-divider {
    height: 3px;
    width: 50px;
    background-color: var(--color-gold); /* decorative bar */
    margin-bottom: 30px;
}

/* CV Entries */
.cv-entries {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.cv-entry {
    display: grid;
    grid-template-columns: 170px 1fr; /* wide enough for "March 2019 – May 2023" on one line */
    gap: 30px;
    padding-bottom: 25px;
    border-bottom: 1px solid rgba(10, 22, 40, 0.08);
}

.cv-entry--no-date {
    grid-template-columns: 1fr;
}

.cv-entry:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.cv-date {
    font-family: var(--font-heading);
    font-size: 0.95rem;
    color: var(--color-accent-ink);
    font-weight: 600;
}

.cv-details h3 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    line-height: 1.4;
    color: var(--color-navy);
}

.cv-details h3 a {
    color: var(--color-text-dark);
    text-decoration: underline;
    text-decoration-color: rgba(42, 63, 94, 0.35);
    text-underline-offset: 2px;
    transition: var(--transition-standard);
}

.cv-details h3 a:hover {
    color: var(--color-navy);
    text-decoration-color: rgba(42, 63, 94, 0.65);
}

.cv-institution {
    font-family: var(--font-heading);
    font-size: 1rem;
    color: var(--color-text-light);
    font-style: italic;
    margin-bottom: 0.3rem;
}

.cv-institution a {
    color: var(--color-accent-ink);
    text-decoration: underline;
    text-decoration-color: rgba(122, 97, 36, 0.4);
}

.cv-institution a:hover {
    text-decoration-color: var(--color-accent-ink);
}

.cv-description {
    font-size: 0.95rem;
    color: var(--color-text-light);
    line-height: 1.6;
    margin-bottom: 0.3rem;
}

.cv-description,
.cv-details {
    overflow-wrap: anywhere;
}

.cv-description a {
    color: #2a3f5e;
    text-decoration: underline;
    text-decoration-color: rgba(42, 63, 94, 0.35);
    text-underline-offset: 2px;
}

.cv-description a:hover {
    color: var(--color-navy);
    text-decoration-color: rgba(42, 63, 94, 0.65);
}

.pub-details h3 a,
.pub-details h4 a,
.legal-content a,
.bio-content a {
    color: var(--color-text-dark);
    text-decoration: underline;
    text-decoration-color: rgba(42, 63, 94, 0.35);
    text-underline-offset: 2px;
    transition: var(--transition-standard);
}

.pub-details h3 a:hover,
.pub-details h4 a:hover,
.legal-content a:hover,
.bio-content a:hover {
    color: var(--color-navy);
    text-decoration-color: rgba(42, 63, 94, 0.65);
}

.cv-content p a,
.cv-content li a {
    color: #2a3f5e;
    text-decoration: underline;
    text-decoration-color: rgba(42, 63, 94, 0.35);
    text-underline-offset: 2px;
    transition: var(--transition-standard);
}

.cv-content p a:hover,
.cv-content li a:hover {
    color: var(--color-navy);
    text-decoration-color: rgba(42, 63, 94, 0.65);
}

body.publications-page .cv-entry--no-date {
    padding-bottom: 20px;
}

body.publications-page .cv-entries {
    gap: 0;
}

/* Legal Pages */
.legal-section {
    padding: 72px 0 96px;
    background-color: var(--color-cream);
}

.legal-content {
    max-width: 720px; /* ~70ch long-form measure */
    margin: 0 auto;
    background: var(--color-white);
    padding: 42px 36px;
    box-shadow: var(--shadow-soft);
    border-top: 3px solid var(--color-gold);
}

.legal-content h2 {
    font-size: 2rem;
    margin-bottom: 1.2rem;
}

.legal-content h3 {
    font-size: 1.35rem;
    margin: 2rem 0 0.8rem;
}

.legal-content p,
.legal-content li {
    color: var(--color-text-light);
    font-size: 1rem;
    line-height: 1.7;
    hyphens: auto;
}

.legal-content ul {
    margin: 0.6rem 0 0.6rem 1.2rem;
}

.legal-note {
    margin-top: 2.2rem;
    color: var(--color-text-light);
    font-size: 0.9rem;
}

/* ===== RESPONSIVE STYLES ===== */
@media (max-width: 992px) {
    .cv-layout {
        grid-template-columns: 1fr;
        padding: 40px 20px;
    }

    .cv-sidebar {
        position: static;
        border-bottom: 1px solid rgba(10, 22, 40, 0.1);
        padding-bottom: 20px;
        margin-bottom: 20px;
    }

    .cv-nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 10px;
    }

    .cv-nav-item {
        padding: 8px 15px;
        border-left: none;
        border-bottom: 2px solid transparent;
        font-size: 0.8rem;
    }

    .cv-nav-item:hover,
    .cv-nav-item.active {
        border-left: none;
        border-bottom-color: var(--color-gold);
    }
}

@media (max-width: 768px) {
    .legal-content {
        padding: 28px 20px;
    }

    /* Compact, content-driven hero so the biography starts near the fold */
    .hero {
        height: auto;
        min-height: 0;
        padding-top: var(--nav-safe-height);
        padding-bottom: 64px;
        background-attachment: scroll;
        background-size: cover;
        background-position: 15% 100%;
    }

    .page-header {
        background-attachment: scroll;
        background-size: cover;
        background-position: 15% 100%;
    }

    .hero-content {
        width: min(92%, 680px);
        padding: 16px 20px;
    }

    .hero-title { font-size: 1.8rem; }
    .hero-subtitle { font-size: 0.8rem; letter-spacing: 1.8px; }

    .section,
    .work-section,
    .contact-section {
        padding: 64px 0;
    }

    .work-grid {
        grid-template-columns: 1fr;
        gap: 28px;
    }

    .nav-links {
        display: none;
    }

    .nav-toggle { display: flex; }

    /* .nav-lang stays visible in the bar on mobile by design */

    .publication-item {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .nav-links.active {
        display: flex;
        flex-direction: column;
        position: absolute;
        top: 100%; /* Position right below the navbar */
        left: 0;
        width: 100%;
        max-height: calc(100vh - 92px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        background-color: var(--color-navy);
        padding: 20px 0;
        text-align: left;
        box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
        animation: slideDown 0.3s ease forwards;
    }

    .nav-links.active .nav-item {
        display: block;
        width: 100%;
        text-align: left;
        padding: 10px 24px;
    }

    @keyframes slideDown {
        from { opacity: 0; transform: translateY(-10px); }
        to { opacity: 1; transform: translateY(0); }
    }

    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: 30px;
    }

    .cv-entry {
        grid-template-columns: 1fr;
        gap: 8px;
    }

    .cv-date {
        font-size: 0.9rem;
    }

    .page-header {
        min-height: 220px;
    }

    body.subpage .cv-sidebar {
        border-bottom: none;
        padding-bottom: 0;
        margin-bottom: 10px;
    }

    body.subpage .cv-nav {
        display: flex;
        flex-wrap: wrap;
        gap: 8px;
        overflow-x: visible;
        padding: 0 0 10px;
        scrollbar-width: thin;
    }

    body.subpage .cv-nav-item {
        flex: 1 1 calc(50% - 8px);
        white-space: normal;
        border-bottom: 2px solid transparent;
        border-left: none;
        background-color: rgba(201, 169, 98, 0.1);
        border-radius: 10px;
        font-size: 0.78rem;
        line-height: 1.3;
        padding: 9px 10px;
    }

    body.subpage .cv-description a {
        overflow-wrap: anywhere;
        word-break: break-word;
    }

    body.subpage .cv-nav-item:hover,
    body.subpage .cv-nav-item.active {
        border-bottom-color: transparent;
        background-color: rgba(201, 169, 98, 0.2);
    }
}

/* ===== DOCK ===== */
.dock {
    position: fixed;
    bottom: 16px;
    right: 28px;
    z-index: 2000;
}

.dock-container {
    display: flex;
    align-items: flex-end;
    gap: 4px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 9999px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.10);
}

.dock-item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 9999px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #555;
    transition: background 0.2s ease, color 0.2s ease;
    transform-origin: bottom center;
    will-change: transform;
    position: relative;
    font-family: inherit;
    padding: 0;
}

.dock-item:hover {
    background: rgba(10, 22, 40, 0.08);
    color: var(--color-navy);
}

.dock-item svg {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

.dock-separator {
    width: 1px;
    height: 24px;
    background: rgba(0, 0, 0, 0.12);
    margin: 0 4px;
    align-self: center;
    flex-shrink: 0;
}

/* Dock tooltip */
.dock-item::before {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%) scale(0.8);
    background: var(--color-navy);
    color: var(--color-white);
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.72rem;
    font-family: var(--font-body);
    letter-spacing: 0.5px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s ease, transform 0.15s ease;
}

.dock-item:hover::before {
    opacity: 1;
    transform: translateX(-50%) scale(1);
}

/* Dock responsive */
@media (max-width: 480px) {
    .dock {
        bottom: 10px;
    }
    .dock-container {
        padding: 6px 10px;
        gap: 2px;
    }
    .dock-item {
        width: 36px;
        height: 36px;
    }
    .dock-item svg {
        width: 18px;
        height: 18px;
    }
}

/* ===== DARK MODE ===== */

/* Smooth transitions for dark-mode toggle */
body,
.about-section,
.publications-section,
.legal-section,
.footer {
    transition: background-color 0.35s ease, color 0.35s ease;
}

.about-text,
.legal-content {
    transition: background-color 0.35s ease, color 0.35s ease, box-shadow 0.35s ease;
}

body.dark-mode {
    background-color: #0d1520;
    color: #c8c2b8;
    /* Neutral shadows on dark: navy tint is invisible here and reads as a colored glow */
    --shadow-soft: 0 10px 30px rgba(0, 0, 0, 0.35);
    --shadow-hover: 0 20px 40px rgba(0, 0, 0, 0.45);
}

body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3,
body.dark-mode h4 {
    color: var(--color-accent-soft);
}

body.dark-mode .section-title {
    color: var(--color-accent-soft);
}

/* Sections */
body.dark-mode .about-section,
body.dark-mode .publications-section,
body.dark-mode .legal-section {
    background-color: #0f1923;
}

/* Cards & containers */
body.dark-mode .about-text {
    background: #152035;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border-left-color: var(--color-gold);
}

body.dark-mode .legal-content {
    background: #152035;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    border-top-color: var(--color-gold);
}

/* Text colors */
body.dark-mode .bio-content p,
body.dark-mode .work-copy p,
body.dark-mode .cv-description,
body.dark-mode .cv-institution,
body.dark-mode .legal-content p,
body.dark-mode .legal-content li,
body.dark-mode .pub-details p {
    color: #8a93a1;
}

body.dark-mode .bio-content .bio-lead,
body.dark-mode .work-copy .work-lead {
    color: #c8c2b8;
}

/* Gold text on light surfaces becomes accent-soft on dark surfaces */
body.dark-mode .pub-year,
body.dark-mode .cv-date,
body.dark-mode .cv-institution a {
    color: var(--color-accent-soft);
}

/* Borders */
body.dark-mode .publication-item,
body.dark-mode .cv-entry {
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

body.dark-mode .footer-content {
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

body.dark-mode .cv-sidebar {
    border-bottom-color: rgba(255, 255, 255, 0.06);
}

/* Links */
body.dark-mode .pub-details h3 a,
body.dark-mode .pub-details h4 a,
body.dark-mode .cv-description a,
body.dark-mode .cv-details h3 a,
body.dark-mode .cv-content p a,
body.dark-mode .cv-content li a,
body.dark-mode .legal-content a,
body.dark-mode .bio-content a {
    color: #b8cce0;
    text-decoration-color: rgba(184, 204, 224, 0.35);
}

body.dark-mode .pub-details h3 a:hover,
body.dark-mode .pub-details h4 a:hover,
body.dark-mode .cv-description a:hover,
body.dark-mode .cv-details h3 a:hover,
body.dark-mode .cv-content p a:hover,
body.dark-mode .cv-content li a:hover,
body.dark-mode .legal-content a:hover,
body.dark-mode .bio-content a:hover {
    color: var(--color-accent-soft);
    text-decoration-color: rgba(217, 188, 122, 0.6);
}

/* Entry titles: neutral by default, gold only on hover */
body.dark-mode .cv-details h3,
body.dark-mode .pub-details h3,
body.dark-mode .pub-details h4 {
    color: #c8c2b8;
    transition: color 0.2s ease;
}

body.dark-mode .cv-details h3 a,
body.dark-mode .pub-details h3 a,
body.dark-mode .pub-details h4 a {
    color: #c8c2b8;
    text-decoration-color: rgba(200, 194, 184, 0.35);
}

body.dark-mode .cv-details h3:hover,
body.dark-mode .pub-details h3:hover,
body.dark-mode .pub-details h4:hover,
body.dark-mode .cv-details h3 a:hover,
body.dark-mode .pub-details h3 a:hover,
body.dark-mode .pub-details h4 a:hover {
    color: var(--color-accent-soft);
    text-decoration-color: rgba(217, 188, 122, 0.6);
}

/* CV sidebar */
body.dark-mode .cv-nav-item {
    color: #8a93a1;
}

body.dark-mode .cv-nav-item:hover,
body.dark-mode .cv-nav-item.active {
    color: var(--color-accent-soft);
    background-color: rgba(201, 169, 98, 0.1);
}

@media (max-width: 768px) {
    body.dark-mode.subpage .cv-nav-item {
        background-color: rgba(201, 169, 98, 0.08);
    }
    body.dark-mode.subpage .cv-nav-item:hover,
    body.dark-mode.subpage .cv-nav-item.active {
        background-color: rgba(201, 169, 98, 0.15);
    }
}

/* Footer */
body.dark-mode .footer {
    background-color: #070d16;
}

body.dark-mode .footer-links a:hover,
body.dark-mode .footer-role {
    color: var(--color-accent-soft);
}

/* Image */
body.dark-mode .image-frame {
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

body.dark-mode .image-accent {
    border-color: rgba(201, 169, 98, 0.5); /* decorative frame */
}

/* Hero content box in dark mode */
body.dark-mode .hero-content {
    background: linear-gradient(160deg, rgba(10, 22, 40, 0.7) 0%, rgba(10, 22, 40, 0.4) 100%);
}

/* Section dividers */
body.dark-mode .section-divider,
body.dark-mode .cv-section-divider,
body.dark-mode .page-header-divider {
    background-color: var(--color-gold); /* decorative bars */
}

/* Dock dark mode */
body.dark-mode .dock-container {
    background: rgba(13, 21, 32, 0.88);
    border-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}

body.dark-mode .dock-item {
    color: #8a93a1;
}

body.dark-mode .dock-item:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--color-accent-soft);
}

body.dark-mode .dock-separator {
    background: rgba(255, 255, 255, 0.1);
}

body.dark-mode .dock-item::before {
    background: #1a2a40;
    color: var(--color-cream);
}

/* ===== REDUCED MOTION ===== */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        transition-delay: 0ms !important;
        scroll-behavior: auto !important;
    }

    .wheel {
        animation: none;
    }

    /* Show everything immediately: no reveal-on-scroll for these visitors */
    html.js .fade-in,
    html.js .fade-in-up,
    html.js .fade-in-left,
    html.js .fade-in-right {
        opacity: 1;
        transform: none;
        transition: none;
    }
}

/* ===== PRINT ===== */
@media print {
    /* Never let gated reveals hide content on paper */
    html.js .fade-in,
    html.js .fade-in-up,
    html.js .fade-in-left,
    html.js .fade-in-right {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    /* Chrome that makes no sense on paper */
    .navbar,
    .nav-toggle,
    .dock,
    .scroll-indicator,
    .hero-overlay,
    .page-header-overlay {
        display: none !important;
    }

    * {
        box-shadow: none !important;
        text-shadow: none !important;
    }

    body,
    .about-section,
    .publications-section,
    .legal-section,
    .footer,
    .contact-section {
        background: #ffffff !important;
        color: #000000;
    }

    /* Hero background photo: not printable content */
    .hero,
    .page-header {
        background: none !important;
        height: auto;
        min-height: 0;
        padding: 24px 0;
    }

    .hero-content {
        background: none;
        border: none;
        padding: 0;
    }

    h1, h2, h3, h4,
    .hero-title,
    .hero-subtitle,
    .page-title,
    .contact-section .section-title,
    .contact-lead {
        color: #000000 !important;
    }

    .hero-subtitle,
    .pub-year,
    .cv-date,
    .footer-role,
    .cv-institution a {
        color: #333333;
    }

    a {
        text-decoration: none;
        color: #000000;
    }

    .work-shot a {
        text-decoration: none;
    }

    .contact-section .btn-primary,
    .contact-section .btn-secondary,
    .btn-primary,
    .btn-secondary {
        background: #ffffff !important;
        color: #000000 !important;
        border: 1px solid #000000;
    }

    .cv-entry,
    .publication-item,
    .work-grid {
        break-inside: avoid;
    }

    .footer {
        padding: 24px 0;
    }
}
