/* Fonts are hosted locally (variable woff2, latin + latin-ext from Google Fonts). */
@font-face {
    font-family: 'Open Sans';
    font-style: normal;
    font-weight: 300 800;
    font-display: swap;
    src: url(../fonts/open-sans-latin-ext.woff2) format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Open Sans';
    font-style: normal;
    font-weight: 300 800;
    font-display: swap;
    src: url(../fonts/open-sans-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Roboto Mono';
    font-style: normal;
    font-weight: 100 700;
    font-display: swap;
    src: url(../fonts/roboto-mono-latin-ext.woff2) format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Roboto Mono';
    font-style: normal;
    font-weight: 100 700;
    font-display: swap;
    src: url(../fonts/roboto-mono-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
    --main-color: #FFFFFF;
    --main-bg-color: #252626;
    --main-highlight-color: #FF635A;
    --main-highlight-rgb: 255, 99, 90;
    --inactive-color: #958C89;
    --mild-color: #444545;
    --surface-color: #1C1D1D;
    --surface-rgb: 28, 29, 29;
}
html {
    scroll-behavior: smooth;
}
body {
    background-color: var(--main-bg-color);
    color: var(--main-color);
    font-family: 'Open Sans', Roboto, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
}
/* Subtle fixed backdrop: a faint dot grid that fades out towards the bottom. */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px) 0 0 / 24px 24px;
    -webkit-mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.6) 100%);
    mask-image: linear-gradient(to bottom, #000 0%, rgba(0, 0, 0, 0.6) 100%);
}
.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 0 20px;
}
h1, h2, h3, nav, .logo, .typing-effect, .subtitle {
    font-family: 'Roboto Mono', monospace;
}
:focus-visible {
    outline: 2px solid var(--main-highlight-color);
    outline-offset: 3px;
}
.skip-link {
    position: absolute;
    left: 10px;
    top: -100px;
    z-index: 2000;
    background: var(--main-highlight-color);
    color: var(--surface-color);
    padding: 8px 12px;
}
.skip-link:focus { top: 10px; }

header {
    background-image: linear-gradient(rgba(var(--surface-rgb), 0.85), var(--main-bg-color)), url('../img/header.jpg');
    background-size: cover;
    background-position: center;
    padding: 100px 0;
    text-align: center;
}
/* main.js measures the rendered text once the fonts are loaded and sets --typing-width and --chars. */
.typing-effect {
    display: inline-block;
    overflow: hidden;
    white-space: nowrap;
    border-right: .15em solid var(--main-highlight-color);
    animation: blink-caret .75s step-end infinite;
}
.js .typing-effect { width: 0; }
.js .typing-effect.is-typing {
    width: var(--typing-width);
    animation: typing 2s steps(var(--chars), end), blink-caret .75s step-end infinite;
}
@keyframes typing { from { width: 0 } }
@keyframes blink-caret { from, to { border-color: transparent } 50% { border-color: var(--main-highlight-color); } }

h1 { font-size: 3rem; color: var(--main-color); margin-bottom: 10px; text-shadow: 0 0 10px rgba(var(--main-highlight-rgb), 0.5); }
h2 { font-size: 1.5rem; color: var(--inactive-color); }
.subtitle { font-size: 1.5rem; font-weight: bold; color: var(--inactive-color); margin: 0; }

nav {
    background-color: rgba(var(--surface-rgb), 0.85);
    backdrop-filter: blur(10px);
    padding: 15px 20px;
    position: sticky;
    top: 0;
    z-index: 1000;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.logo {
    font-weight: bold;
    font-size: 1.5rem;
    color: var(--main-color);
    text-decoration: none;
    position: relative;
    z-index: 1;
    padding: 2px 8px;
    margin: -2px -8px; /* Prevent layout shift from padding */
    transition: color 0.3s ease-in-out;
}
.logo::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background-color: var(--main-color);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s cubic-bezier(0.77, 0, 0.175, 1);
    z-index: -1;
}
.logo:hover::before { transform: scaleX(1); }
.logo:hover, .logo:hover span { color: var(--main-bg-color); }
.logo span { color: var(--main-highlight-color); transition: color 0.3s ease-in-out; }

.nav-right { display: flex; align-items: center; }
.nav-links { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; }
.nav-links li { margin-left: 25px; }
.nav-links a { color: var(--main-color); text-decoration: none; font-size: 1rem; position: relative; padding: 5px 0; }

.nav-links a::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 2px;
    background-color: var(--main-highlight-color);
    transition: width 0.3s ease-in-out;
}
.nav-links a:hover::after, .nav-links a:focus::after {
    width: 100%;
}

.lang-switcher { color: var(--inactive-color); }
.nav-links .lang-switcher a { color: var(--inactive-color); transition: color 0.3s ease; }
.nav-links .lang-switcher a::after { content: none; }
.nav-links .lang-switcher a:hover { color: var(--main-color); }
.nav-links .lang-switcher a[aria-current] { color: var(--main-highlight-color); font-weight: bold; }

/* The outer bars move by bar height + gap onto the middle one, then rotate, so the X crosses exactly in the center. */
.hamburger { --bar-height: 3px; --bar-gap: 4px; display: none; cursor: pointer; flex-direction: column; gap: var(--bar-gap); margin-left: 20px; padding: 6px; background: none; border: 0; }
.hamburger .bar { width: 25px; height: var(--bar-height); border-radius: 2px; background-color: var(--main-color); transition: transform 0.3s ease-in-out, opacity 0.2s ease-in-out; }

@media (max-width: 768px) {
    .nav-right { width: 100%; justify-content: flex-end; }
    .nav-links { display: none; flex-direction: column; width: 100%; position: absolute; top: 68px; right: 0; background-color: rgba(var(--surface-rgb), 0.98); padding: 20px 0; }
    .nav-links.active { display: flex; }
    .nav-links li { margin: 15px 0; text-align: center; }
    .hamburger { display: flex; }
    .hamburger[aria-expanded="true"] .bar:nth-child(1) { transform: translateY(calc(var(--bar-height) + var(--bar-gap))) rotate(45deg); }
    .hamburger[aria-expanded="true"] .bar:nth-child(2) { opacity: 0; }
    .hamburger[aria-expanded="true"] .bar:nth-child(3) { transform: translateY(calc(-1 * (var(--bar-height) + var(--bar-gap)))) rotate(-45deg); }
}

/* Sections only start hidden once the script runs, so the content stays visible without it. */
.js .fade-in-section { opacity: 0; transform: translateY(20px); transition: opacity 0.6s ease-out, transform 0.6s ease-out; }
.js .fade-in-section.is-visible { opacity: 1; transform: translateY(0); }
section { padding: 80px 0; scroll-margin-top: 60px; }
.section-title { text-align: center; font-size: 2.5rem; color: var(--main-highlight-color); margin-bottom: 40px; }

.skills-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 20px; text-align: center; }
.skill-category { background-color: var(--surface-color); padding: 20px; border-radius: 5px; border: 1px solid var(--inactive-color); transition: box-shadow 0.3s ease-in-out, transform 0.3s ease-in-out; }
.skill-category:hover { transform: translateY(-5px); box-shadow: 0 0 15px var(--main-highlight-color); }
.skill-category ul { list-style: none; padding: 0; color: var(--inactive-color) }
.skill-category li { margin-bottom: 10px; }

.project { background-color: var(--surface-color); margin-bottom: 30px; padding: 30px; border-radius: 5px; display: flex; gap: 30px; border: 1px solid var(--inactive-color); transition: box-shadow 0.3s ease-in-out, transform 0.3s ease-in-out; }
.project:hover { transform: translateY(-5px); box-shadow: 0 0 20px var(--main-highlight-color); }
@media (max-width: 600px) { .project { flex-direction: column; } }
.project-image img { width: 200px; height: auto; border-radius: 5px; border: 1px solid var(--inactive-color); }
.project-description p, .project-description ul { color: var(--inactive-color) ; }

.content-link { position: relative; text-decoration: none; color: var(--main-color); transition: color 0.3s ease-in-out; padding-right: 0.5em;}
.content-link:hover { color: var(--main-highlight-color); }
.content-link::after {
    content: '_';
    position: absolute;
    opacity: 0;
    transition: opacity 0.3s ease-in-out;
}
.content-link:hover::after { opacity: 1; }

#contact { text-align: center; }
.contact-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 20px; }
footer { text-align: center; padding: 20px 0; color: var(--inactive-color); font-size: 0.9rem; }
footer .content-link { color: var(--inactive-color); }
footer .content-link:hover { color: var(--main-highlight-color); }

/* Legal pages */
.legal { padding: 60px 0; }
.legal h1 { font-size: 2rem; text-shadow: none; }
.legal h2 { font-size: 1.2rem; color: var(--main-highlight-color); margin-top: 2em; }
.legal p { color: var(--inactive-color); }
.legal-lang { text-align: right; margin: 0; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
    .js .fade-in-section { opacity: 1; transform: none; }
    .skill-category:hover, .project:hover { transform: none; }
}
