/* Design tokens */
:root {
    --bg: #f6f7fb;
    --surface: #ffffff;
    --surface-alt: #eef1f7;
    --text: #1b2333;
    --muted: #5d6879;
    --border: #e1e5ee;
    --accent: #3b6fd4;
    --navy: #131a2b;
    --radius: 16px;
    --shadow: 0 1px 2px rgba(19, 26, 43, 0.06), 0 8px 24px rgba(19, 26, 43, 0.06);
    --font: "Inter", "Open Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0e131f;
        --surface: #161d2e;
        --surface-alt: #1c2438;
        --text: #e7ebf3;
        --muted: #9aa5b8;
        --border: #263049;
        --accent: #7ba3f5;
        --navy: #0a0e18;
        --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    }
}

*, *::before, *::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
    color-scheme: light dark;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    * { transition: none !important; animation: none !important; }
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
}

/* Navigation (language switch) */
nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 10;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1.5rem;
    background: rgba(19, 26, 43, 0.55);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

nav .nav_name {
    font-weight: 600;
    color: #ffffff;
    padding-left: 0;
}

.nav_menu {
    display: flex;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: 0.9rem;
}

section[id],
header[id] {
    scroll-margin-top: 4rem;
}

section.publications {
    margin-top: 4rem;
}

.publication_grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1.25rem;
}

.publication_tile {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    transition: transform 0.2s, border-color 0.2s;
}

.publication_tile:hover {
    transform: translateY(-3px);
    border-color: var(--accent);
}

.publication_tile h3 {
    margin: 0.5rem 0 0.75rem;
    font-size: 1.1rem;
    line-height: 1.35;
}

.publication_tile p {
    margin: 0 0 0.5rem;
    padding: 0;
}

.publication_meta {
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
}

.publication_authors {
    font-size: 0.9rem;
    color: var(--muted);
}

.publication_venue {
    font-size: 0.9rem;
    font-style: italic;
}

.publication_links {
    margin-top: auto !important;
    padding-top: 0.75rem !important;
    font-size: 0.9rem;
    font-weight: 500;
}

nav a {
    color: rgba(255, 255, 255, 0.75);
    text-decoration: none;
    padding: 0.2em 0.6em;
    border-radius: 999px;
    transition: background 0.2s, color 0.2s;
}

nav a:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.15);
}


/* Hero */
header {
    position: relative;
    min-height: 100vh;
    min-height: 100svh;
    padding: 5rem 1.5rem 6rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #ffffff;
    background:
        radial-gradient(ellipse at 20% 10%, rgba(59, 111, 212, 0.35), transparent 55%),
        linear-gradient(180deg, rgba(19, 26, 43, 0.82), rgba(19, 26, 43, 0.95)),
        url(images/sentinel_2_isfjorden_false_colors.jpg) center / cover;
    background-attachment: scroll, scroll, fixed;
}

header h1 {
    margin: 0;
    font-size: clamp(2.5rem, 7vw, 4.5rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    line-height: 1.1;
}

header h2 {
    margin: 1rem 0 0;
    max-width: 36em;
    font-size: clamp(1rem, 2.4vw, 1.3rem);
    font-weight: 400;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.8);
}

header > p:empty {
    display: none;
}

.header_next {
    position: absolute;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    animation: bob 2.4s ease-in-out infinite;
}

.header_next img {
    display: block;
    opacity: 0.8;
}

@keyframes bob {
    0%, 100% { transform: translate(-50%, 0); }
    50% { transform: translate(-50%, 8px); }
}

/* Contact icons */
.logos {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 2rem;
}

.logo a {
    display: flex;
    padding: 0.75rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.15);
    transition: transform 0.2s, background 0.2s;
}

.logo a:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-3px);
}

.logo img {
    display: block;
    height: 32px;
    width: 32px;
}

/* Main layout */
main {
    max-width: 62rem;
    margin: 0 auto;
    padding: 4rem 1.5rem;
}

h2.section_title {
    margin: 0 0 1.5rem;
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    text-align: left;
}

/* About */
section.about_me {
    padding: 2.5rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.about_me_flex {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
    gap: 2.5rem;
    align-items: center;
}

.about_me_img p {
    margin: 0;
    padding: 0;
}

.img_content {
    display: block;
    width: 100%;
    max-width: 280px;
    height: auto;
    aspect-ratio: 1;
    object-fit: cover;
    margin: 0 auto;
    border-radius: 50%;
    border: 4px solid var(--surface);
    box-shadow: 0 0 0 2px var(--accent), var(--shadow);
    transition: transform 0.3s;
}

.img_content:hover {
    transform: scale(1.03);
}

.about_me_text p {
    margin: 0;
    padding: 0;
}

/* CV */
section.cv {
    margin-top: 4rem;
}

.grid_cv_item {
    display: grid;
    grid-template-columns: minmax(7rem, 1fr) 4fr;
    column-gap: 2rem;
}

.cv_section_title {
    grid-column: 1 / -1;
    margin-top: 2.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.cv_section_title:first-child {
    margin-top: 0;
}

.cv_section_title h3 {
    margin: 0;
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent);
}

.cv_section_title hr {
    display: none;
}

.cv_item_left,
.cv_item_right {
    padding-top: 1.25rem;
}

.cv_item_left p {
    margin: 0;
    padding: 0;
    font-size: 0.9rem;
    font-variant-numeric: tabular-nums;
    color: var(--muted);
}

.cv_item_right p {
    margin: 0;
    padding: 0;
}

.cv_item_right strong {
    font-weight: 600;
}

/* Text */
p {
    margin: 0 0 1em;
}

p.justify {
    text-align: left;
    hyphens: auto;
}

a {
    color: var(--accent);
    text-underline-offset: 0.2em;
}

hr {
    border: 0;
    border-top: 1px solid var(--border);
}

/* Footer */
footer {
    margin-top: 2rem;
    padding: 3rem 1.5rem 2rem;
    background: var(--navy);
    color: rgba(255, 255, 255, 0.7);
}

.footer_content {
    max-width: 62rem;
    margin: 0 auto;
}

.footer_content .logos {
    margin-top: 0;
}

p.footer_text {
    margin: 1.5rem 0 0;
    text-align: center;
    font-size: 0.85rem;
}

/* Focus */
a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

/* Mobile */
@media (max-width: 720px) {
    main {
        padding: 2.5rem 1rem;
    }

    section.about_me {
        padding: 1.5rem;
    }

    .about_me_flex {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .grid_cv_item {
        grid-template-columns: 1fr;
    }

    .cv_item_left {
        padding-top: 1.25rem;
        padding-bottom: 0.1rem;
    }

    .cv_item_right {
        padding-top: 0;
    }

    header {
        background-attachment: scroll;
    }
}
