/* Self-hosted fonts (SIL Open Font License, see fonts/OFL-*.txt).
   Only the styles the page uses; latin-ext files load only if such characters appear. */
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 900;
    font-display: swap;
    src: url('fonts/inter-900-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: 'Inter';
    font-style: normal;
    font-weight: 900;
    font-display: swap;
    src: url('fonts/inter-900-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: 'Jost';
    font-style: normal;
    font-weight: 400 900;
    font-display: swap;
    src: url('fonts/jost-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: 'Jost';
    font-style: normal;
    font-weight: 400 900;
    font-display: swap;
    src: url('fonts/jost-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: 'Jost';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/jost-italic-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: 'Jost';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/jost-italic-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;
}

:root {
    --bg: #03030F;
    --text: #E0E0E0;
    --accent: #FACC15;
    --accent2: #B30000;
    --box-bg: #1A1A1A;
    --highlight: #AACCFF;
    --border: #9A9A9A;
    --vh: 100vh;
    --focus-ring: 2px solid var(--highlight);
    --dialog-padding: clamp(1rem, 5vw, 5rem);
    --radius-card: 0.75rem;
    --shadow-raised: 0 10px 20px rgba(0, 0, 0, 0.5);
}

@supports (height: 100svh) {
    :root {
        --vh: 100svh;
    }
}

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

html,
body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Jost', sans-serif;
    font-optical-sizing: auto;
    font-style: normal;
    background-color: var(--bg);
    color: var(--text);
    line-height: 1.6;
    font-size: 1.2rem;
}

main {
    overflow-y: scroll;
    height: var(--vh);
    scroll-behavior: auto;
}

header {
    height: 120vh;
    width: 100vw;
    position: relative;
}

/* Hero Section */
.hero-wrapper {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    font-family: 'Inter', sans-serif;
    flex-direction: column;
    font-size: 12vw;
    font-weight: 900;
    line-height: 0.90;
    text-align: center;
    z-index: 2;
    white-space: nowrap;
    pointer-events: none;
}

.hero-wrapper span {
    display: block;
    will-change: transform;
}

/* --hero-progress (0..1) is set on <main> by app.js while scrolling */
.hero-top-line {
    transform: translateY(calc(var(--hero-progress, 0) * -100vh));
}

.hero-bottom-line {
    transform: translateY(calc(var(--hero-progress, 0) * 100vh));
}

/* Static Tagline Section */
.static-tagline-wrapper {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 100vw;
    z-index: 1;
    pointer-events: none;
}

.static-tagline {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: clamp(0, (var(--hero-progress, 0) - 0.05) / 0.3, 1);
    z-index: 1;
    white-space: nowrap;
}

.static-tagline.is-hidden {
    display: none;
}

/* Scroll Tagline Section */
.scroll-tagline-wrapper {
    align-items: center;
    justify-content: center;
    display: flex;
    width: 100%;
    visibility: hidden;
    position: relative;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.scroll-tagline-wrapper.show {
    visibility: visible;
}

.scroll-tagline,
.static-tagline {
    font-size: calc(1.125rem + 1vw);
    text-align: center;
}

/* Content */
.content {
    scroll-snap-align: start;
    padding: 4rem 5rem;
    max-width: 1280px;
    margin: auto;
}

.content p {
    margin-bottom: 0.5rem;
    text-align: justify;
}

/* Section */
.section-title {
    font-size: 2rem;
    margin-bottom: 2rem;
    font-weight: 600;
    position: relative;
}

.section-title::after {
    content: "";
    position: absolute;
    bottom: -0.5rem;
    left: 0;
    width: 6rem;
    height: 0.25rem;
    background-color: var(--accent2);
}

/* Stack */
.stack-item {
    background-color: var(--box-bg);
    padding: 1.5rem;
    border-radius: var(--radius-card);
    margin-bottom: 1rem;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease-out;
}

/* Each stack item groups a <dt> label and its <dd> values inside <dl class="stack-list">,
   shown on one line like running text */
.stack-item dt,
.stack-item dd {
    display: inline;
}

.stack-item:hover {
    transform: translateX(5px) !important;
    box-shadow: var(--shadow-raised);
}

/* Skills */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 2rem;
}

.skill-card {
    background-color: var(--box-bg);
    padding: 1.5rem;
    border-radius: var(--radius-card);
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease-out, transform 0.6s ease-out;
    transition-delay: var(--reveal-delay, 0ms);
}

.skill-card.show {
    opacity: 1;
    transform: translateY(0);
}

.skill-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-raised);
}

.skill-title {
    font-size: 1.3rem;
    font-weight: 900;
    text-transform: uppercase;
    margin-bottom: 0.5rem;
}

.skill-list {
    list-style: none;
}

.skill-list li {
    margin-bottom: 1rem;
}

/* Footer */
footer {
    text-align: center;
    color: var(--border);
    font-size: 0.9rem;
    padding: 4rem 2rem;
}

section,
footer {
    padding: 2rem 0;
    max-width: 1200px;
    margin: auto;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.8s ease-out;
}

section.show,
footer.show,
.stack-item.show {
    opacity: 1;
    transform: translateY(0);
}

/* Text button: a <button> that looks like the surrounding text.
   Declared before the utility classes so .red/.yellow/.underlined win. */
.text-button {
    font: inherit;
    color: inherit;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
}

.text-button:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Utility Classes */
.red {
    color: var(--accent2);
}

.yellow {
    color: var(--accent)
}

.italic {
    font-style: italic;
}

.underlined {
    text-decoration: underline;
}

.bold {
    font-weight: 600;
}

/* Topiunda (native <dialog>, opened with showModal() and centred by the browser) */
.topiunda {
    margin: auto; /* the global "* { margin: 0 }" reset would otherwise undo the browser's centring */
    max-width: none;
    max-height: none;
    background: rgba(26, 26, 26, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 0;
    border-radius: 1rem;
    padding: var(--dialog-padding);
    opacity: 0;
    transition: opacity 0.3s ease, overlay 0.3s ease allow-discrete, display 0.3s ease allow-discrete;
}

.topiunda[open] {
    opacity: 1;
}

@starting-style {
    .topiunda[open] {
        opacity: 0;
    }
}

.topiunda:focus {
    outline: none;
}

.topiunda::backdrop {
    background: transparent;
}

.topiunda img {
    display: block;
    width: auto;
    height: auto;
    max-width: calc(90vw - 2 * var(--dialog-padding));
    max-height: calc(90vh - 2 * var(--dialog-padding));
    margin: 0 auto;
    border-radius: 0.25rem;
}

/* Toast: short non-blocking feedback at the bottom of the screen (filled by app.js) */
.toast {
    position: fixed;
    left: 50%;
    bottom: 2rem;
    z-index: 20;
    max-width: calc(100vw - 2rem);
    padding: 1rem 1.5rem;
    background-color: var(--box-bg);
    color: var(--text);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-raised);
    font-size: 1rem;
    text-align: center;
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 1rem);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.toast.show {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, 0);
}

.toast a {
    color: var(--accent);
}

.toast a:focus-visible {
    outline: var(--focus-ring);
    outline-offset: 2px;
}

/* Reduced motion: no slide-ins or hover nudges; the hero fades out instead of
   splitting apart (it is fixed to the viewport, so it still has to leave). */
@media (prefers-reduced-motion: reduce) {
    section,
    footer,
    .stack-item,
    .skill-card {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .stack-item:hover,
    .skill-card:hover {
        transform: none !important;
    }

    .hero-top-line,
    .hero-bottom-line {
        transform: none;
        opacity: clamp(0, 1 - var(--hero-progress, 0) * 2, 1);
    }

    .topiunda,
    .toast {
        transition: none;
    }
}

/* Breakpoints */
@media (max-width: 1024px) {
    .content {
        padding: 2rem 2rem;
    }
    .section-title {
        font-size: calc(1.5rem + 1vw);
    }
    .skills-grid {
        grid-template-columns: 1fr;
    }
    .hero-wrapper {
        font-size: 10vw;
    }
    .scroll-tagline,
    .static-tagline {
        font-size: calc(1.125rem + 1vw);
    }
    .skill-title {
        font-size: calc(0.8rem + 1vw);
    }
}

@media (max-width: 480px) {
    .hero-wrapper {
        font-size: 14vw;
    }
    body {
        font-size: 1rem;
    }
    .section-title::after {
        width: 4rem;
    }
    .scroll-tagline,
    .static-tagline {
        font-size: calc(12px + 1vw);
    }
    .skill-title {
        font-size: calc(0.8rem + 1vw);
    }
}
