/* =========================================================================
   Vars & Reset
   ========================================================================= */
:root {
    /* Dimensions derived from root 16px (1rem) */
    --font-heading: 'Raleway', sans-serif;
    --font-body: 'Raleway', sans-serif;

    /* Layout */
    --max-width: 50rem;
    /* Adjusted for single column readability ~800px */

    /* Colors Light Mode (Default) */
    --bg-base: #fdfaf7;
    --bg-card: rgba(255, 255, 255, 0.7);
    --text-main: #333333;
    --text-dim: #666666;
    --accent: #222222;
    --accent-light: #d1cbc5;
    --divider: #e8dbd0;

    /* Lang toggles */
    --display-de: block;
    --display-en: none;
    --display-de-inline: inline;
    --display-de-inline-block: inline-block;
    --display-en-inline: none;
    --display-en-inline-block: none;
}

/* Dark Mode Overrides (Controlled via :has pseudo-class to affect html/body directly) */
html:has(#dark-mode:checked) {
    --bg-base: #1a1a1a;
    --bg-card: rgba(30, 30, 30, 0.7);
    --text-main: #f0f0f0;
    --text-dim: #bbbbbb;
    --accent: #ffffff;
    --accent-light: #555555;
    --divider: #444444;
}

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

html {
    background-color: var(--bg-base);
    color: var(--text-main);
    font-family: var(--font-body);
    line-height: 1.8em;
    transition: background-color 0.3s, color 0.3s;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* =========================================================================
   Typography
   ========================================================================= */
h1,
h2,
h3,
h4 {
    font-family: var(--font-heading);
    color: var(--accent);
    line-height: 1.2;
    margin-bottom: 1rem;
}

h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    text-align: center;
}

h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 2rem;
    color: var(--text-main);
    border-bottom: 2px solid var(--divider);
    padding-bottom: 0.5rem;
}

h4 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.5rem;
}

p,
li,
span {
    font-size: 1rem;
}

a {
    color: var(--text-main);
    text-decoration: none;
    border-bottom: 1px solid var(--accent);
    transition: color 0.2s, border-color 0.2s;
}

a:hover {
    color: var(--text-dim);
    border-bottom: 1px solid transparent;
}

a.no-underline {
    border-bottom: none;
}

a.no-underline:hover {
    opacity: 0.8;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* =========================================================================
   State / Toggles (Language)
   ========================================================================= */
#lang-toggle:checked~.main-wrapper {
    --display-de: none;
    --display-en: block;
    --display-de-inline: none;
    --display-en-inline: inline;
    --display-de-inline-block: none;
    --display-en-inline-block: inline-block;
}

.de {
    display: var(--display-de);
}

.en {
    display: var(--display-en);
}

span.de {
    display: var(--display-de-inline);
}

span.en {
    display: var(--display-en-inline);
}

div.de {
    display: var(--display-de);
}

/* Controls UI */
.controls {
    position: absolute;
    /* Scroll with page on mobile */
    top: 1rem;
    right: 1rem;
    display: flex;
    flex-direction: row-reverse;
    /* Darkmode (right), EN/DE (mid), Print (left) */
    gap: 0.75rem;
    z-index: 100;
}

/* Fix controls to viewport on desktop */
@media (min-width: 48rem) {
    .controls {
        position: fixed;
    }
}

.icon-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--divider);
    color: var(--text-main);
    cursor: pointer;
    backdrop-filter: blur(5px);
    transition: all 0.2s;
    font-weight: 700;
    font-size: 1rem;
}

.icon-btn:hover {
    background: var(--divider);
    transform: scale(1.05);
}

.print-btn {
    appearance: none;
}

/* Lang Toggle Logic */
.lang-show-en,
.lang-show-de {
    display: none;
}

#lang-toggle:not(:checked)~.main-wrapper .lang-show-en {
    display: block;
    /* DE mode active, show EN to toggle */
}

#lang-toggle:checked~.main-wrapper .lang-show-de {
    display: block;
    /* EN mode active, show DE to toggle */
}

/* Dark Mode Toggle Logic */
.icon-light-mode,
.icon-dark-mode {
    display: none;
}

#dark-mode:not(:checked)~.main-wrapper .icon-dark-mode {
    display: block;
    /* Light mode active, show moon icon */
}

#dark-mode:checked~.main-wrapper .icon-light-mode {
    display: block;
    /* Dark mode active, show sun icon */
}

/* Dark Mode Avatar Logic */
.avatar-dark {
    display: none;
}

#dark-mode:checked~.main-wrapper .avatar-light {
    display: none;
}

#dark-mode:checked~.main-wrapper .avatar-dark {
    display: inline-block;
}

.bg-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: url('img/bg.jpg');
    background-position: center;
    background-attachment: fixed;
    background-size: cover;
    opacity: 0.05;
    z-index: -1;
}

/* =========================================================================
   Main Grid Layout (Single Column)
   ========================================================================= */
.cv-container {
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 5rem 2rem 4rem;
    display: flex;
    flex-direction: column;
    gap: 4rem;
}

/* Header & Avatar */
.header-content {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    align-items: center;
    text-align: center;
}

.avatar-container {
    display: flex;
    /* ensures exact dimension containment for children */
    justify-content: center;
}

.avatar {
    width: 100%;
    max-width: 10rem;
    aspect-ratio: 1;
    border-radius: 50%;
    object-fit: cover;
    filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.1));
}

.contact-info {
    font-style: normal;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.5rem 2rem;
    margin-bottom: 0;
    /* Remove extra bottom margin to equalize spacing */
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 500;
    font-size: 0.95rem;
}

.contact-item .material-icons {
    color: var(--text-main);
    font-size: 1.2rem;
}

.contact-item .social-icon {
    color: var(--text-main);
    width: 1.2rem;
    height: 1.2rem;
}

.intro {
    margin-top: 1rem;
}

/* Matched top margin logic */

/* Structure inside main */
main {
    display: flex;
    flex-direction: column;
    gap: 3.5rem;
    /* Matched the visual distance between Intro and Experience */
}

/* Timeline Components (Simplified per user request) */
.timeline {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.timeline-item {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.timeline-date {
    font-weight: 700;
    color: var(--text-dim);
    font-size: 0.95rem;
}

/* Desktop layout for timeline: align side by side */
@media (min-width: 48rem) {
    .timeline-item {
        flex-direction: row;
        gap: 3rem;
        align-items: baseline;
    }

    .timeline-date {
        flex: 0 0 10rem;
        padding-top: 0;
    }
}

/* Skills styling per requirement (Inline dot-separated) */
.skill-list {
    list-style-type: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.skill-list li {
    display: flex;
    align-items: center;
    font-weight: 400;
    /* Reverted to standard font weight */
}

.skill-list li:not(:last-child)::after {
    content: '•';
    color: var(--accent);
    margin-left: 0.5rem;
}

/* Knowledge List styling (Simple bullet points, no arrows) */
.knowledge-list {
    list-style-type: disc;
    padding-left: 1.5rem;
    color: var(--text-dim);
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.knowledge-list li::marker {
    color: var(--accent);
}

.print-only-contact {
    display: none;
}

/* =========================================================================
   Print Optimization
   ========================================================================= */
@media print {

    /* @page allows setting margins for the physical paper */
    @page {
        margin: 2cm;
    }

    .no-print,
    .controls,
    .print-btn,
    .hide-print,
    .bg-overlay {
        display: none !important;
    }

    html {
        font-size: 12px;
    }

    body {
        background: white;
        color: black;
    }

    :root {
        --bg-base: white;
        --bg-card: white;
        --text-main: black;
        --text-dim: #333333;
        --accent: black;
        --accent-light: #aaa;
        --divider: #ccc;
    }

    /* Print specific link styling: remove underlines */
    a {
        border-bottom: none !important;
        color: black !important;
        text-decoration: none !important;
    }

    .cv-container {
        padding: 0;
        margin: 0;
        max-width: 100%;
        gap: 2rem;
    }

    .contact-info {
        /* Force phone and website to wrap together by reducing gap and bounding container logically */
        gap: 1rem 1.5rem;
        max-width: 80%;
        /* Constrain width so the last two links (phone & web) drop to next line */
        margin: 0 auto;
        /* Keep centered */
    }

    main {
        gap: 2rem;
    }

    .print-only-contact {
        display: block;
        margin-top: 2rem;
        padding-top: 1rem;
        border-top: 1px solid var(--accent);
        font-size: 0.9rem;
        color: var(--text-dim);
    }

    section {
        break-inside: avoid;
    }

    .timeline-item {
        break-inside: avoid;
    }
}