/* giovannibrunetti.it - site stylesheet
   One file, no framework. Tokens first, then base, layout, components, pages. */

/* ---------- Fonts (self-hosted Geist, SIL OFL) ---------- */
@font-face {
    font-family: "Geist";
    src: url("../fonts/geist/Geist-Variable.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Geist Mono";
    src: url("../fonts/geist/GeistMono-Variable.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

/* ---------- Tokens ---------- */
:root {
    color-scheme: light dark;

    --bg: #f6f6f4;
    --surface: #fdfdfc;
    --text: #16171a;
    --muted: #575b62;
    --line: #dfdfda;
    --accent: #c8193c;
    --accent-hover: #a81432;
    --on-accent: #fff8f9;
    --accent-soft: rgb(200 25 60 / 0.08);
    --shadow: 0 1px 2px rgb(22 23 26 / 0.06), 0 8px 24px -12px rgb(22 23 26 / 0.18);
    --card-bg: var(--surface);
    --card-shadow: 0 0 0 transparent;

    --font-sans: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

    --radius: 10px;
    --radius-pill: 999px;

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;
    --space-8: 4rem;
    --space-9: 6rem;

    --header-h: 64px;
    --gutter: 16px;
    --max: 1200px;

    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #111214;
        --surface: #18191c;
        --text: #ededeb;
        --muted: #a2a6ad;
        --line: #2b2d31;
        --accent: #ff5c73;
        --accent-hover: #ff7b8e;
        --on-accent: #1a0a0d;
        --accent-soft: rgb(255 92 115 / 0.1);
        --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px -12px rgb(0 0 0 / 0.6);
        --card-bg: linear-gradient(145deg, #1d1e22, #16171a);
        --card-shadow: inset 0 1px 0 rgb(255 255 255 / 0.05), 0 14px 32px -14px rgb(0 0 0 / 0.75),
            0 2px 6px rgb(0 0 0 / 0.35);
    }
}

@media (min-width: 768px) {
    :root {
        --gutter: 32px;
    }
}

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scroll-padding-top: calc(var(--header-h) + var(--space-4));
    scrollbar-color: var(--line) var(--bg);
}

@media (prefers-reduced-motion: no-preference) {
    html {
        scroll-behavior: smooth;
    }
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 1.0625rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    caret-color: var(--accent);
}

::selection {
    background: var(--accent);
    color: var(--on-accent);
}

h1,
h2,
h3,
h4 {
    margin: 0;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -0.02em;
    text-wrap: balance;
}

p,
ul {
    margin: 0;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

a {
    color: inherit;
    text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
    transition: color 0.2s var(--ease-out), text-decoration-color 0.2s var(--ease-out);
}

a:hover {
    color: var(--accent);
    text-decoration-color: currentColor;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 4px;
}

.icon {
    width: 1.25em;
    height: 1.25em;
    flex: none;
}

.skip-link {
    position: absolute;
    left: var(--space-4);
    top: -100px;
    z-index: 100;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius);
    background: var(--accent);
    color: var(--on-accent);
    font-weight: 600;
    text-decoration: none;
}

.skip-link:focus {
    top: var(--space-4);
}

.skip-link:hover,
.skip-link:focus {
    color: var(--on-accent);
}

.wrap {
    width: 100%;
    max-width: var(--max);
    margin-inline: auto;
    padding-inline: var(--gutter);
}

.mono {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

/* ---------- Buttons ---------- */
.btn {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    min-height: 44px;
    padding: 0 var(--space-5);
    border: 1px solid transparent;
    border-radius: var(--radius-pill);
    font-weight: 550;
    font-size: 0.975rem;
    line-height: 1;
    white-space: nowrap;
    text-decoration: none;
    transition: background-color 0.2s var(--ease-out), color 0.2s var(--ease-out),
        border-color 0.2s var(--ease-out), transform 0.15s var(--ease-out);
}

.btn::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    border-radius: inherit;
    transform: scaleX(0);
    transform-origin: left center;
    transition: transform 0.45s var(--ease-out);
}

.btn .icon {
    transition: transform 0.3s var(--ease-out);
}

.btn:active {
    transform: translateY(1px) scale(0.98);
}

.btn-primary {
    background: var(--accent);
    color: var(--on-accent);
}

.btn-primary::before {
    background: var(--accent-hover);
}

.btn-primary:hover {
    color: var(--on-accent);
}

.btn-ghost {
    border-color: var(--line);
    color: var(--text);
}

.btn-ghost::before {
    background: var(--text);
}

.btn-ghost:hover {
    border-color: var(--text);
    color: var(--bg);
}

@media (hover: hover) {
    .btn:hover::before {
        transform: scaleX(1);
    }

    .btn:hover {
        transform: translateY(-2px);
    }

    .btn:hover .icon {
        transform: translateX(2px);
    }

    .btn:active {
        transform: translateY(1px) scale(0.98);
    }
}

.btn-sm {
    min-height: 36px;
    padding: 0 var(--space-4);
    font-size: 0.9rem;
}

/* ---------- Header ---------- */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    border-bottom: 1px solid var(--line);
    -webkit-backdrop-filter: saturate(150%) blur(10px);
    backdrop-filter: saturate(150%) blur(10px);
}

.site-header .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-5);
    height: var(--header-h);
}

.brand {
    display: inline-flex;
    border-radius: 50%;
}

.brand img {
    width: 40px;
    height: 40px;
}

.nav {
    display: flex;
    align-items: center;
    gap: var(--space-6);
}

.nav-list {
    display: flex;
    align-items: center;
    gap: var(--space-5);
    list-style: none;
    padding: 0;
}

.nav-list a {
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
}

.nav-list a:hover,
.nav-list a[aria-current="page"] {
    color: var(--text);
}

.lang-switch {
    font-family: var(--font-mono);
    font-size: 0.85rem !important;
    letter-spacing: 0.04em;
    padding: var(--space-1) var(--space-2);
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
}

.menu-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    margin-right: calc(var(--space-2) * -1);
    padding: 0;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--text);
    cursor: pointer;
}

.menu-toggle .icon {
    width: 24px;
    height: 24px;
}

.menu-toggle .icon-close {
    display: none;
}

.menu-toggle[aria-expanded="true"] .icon-open {
    display: none;
}

.menu-toggle[aria-expanded="true"] .icon-close {
    display: block;
}

@media (max-width: 899px) {
    .menu-toggle {
        display: inline-flex;
    }

    .nav {
        position: absolute;
        inset: var(--header-h) 0 auto 0;
        flex-direction: column;
        align-items: stretch;
        gap: var(--space-5);
        padding: var(--space-5) var(--gutter) var(--space-6);
        background: var(--bg);
        border-bottom: 1px solid var(--line);
        box-shadow: var(--shadow);
    }

    .js .nav:not(.is-open) {
        display: none;
    }

    .nav-list {
        flex-direction: column;
        align-items: flex-start;
        gap: 0;
    }

    .nav-list li {
        width: 100%;
    }

    .nav-list a {
        display: block;
        padding: var(--space-3) 0;
        font-size: 1.125rem;
        color: var(--text);
    }

    .nav-list a.lang-switch {
        display: inline-block;
        margin-top: var(--space-3);
        padding: var(--space-1) var(--space-3);
    }

    .nav .btn {
        align-self: flex-start;
    }
}

/* ---------- Hero ---------- */
.hero {
    padding-block: var(--space-7) var(--space-8);
}

.hero .wrap {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-7);
    align-items: center;
}

.hero-title {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.hero-title .hello {
    font-size: 1.125rem;
    font-weight: 500;
    letter-spacing: 0;
    color: var(--muted);
}

.hero-title .name {
    color: var(--accent);
    font-size: clamp(2.5rem, 7vw, 4.25rem);
    font-weight: 650;
    letter-spacing: -0.035em;
    line-height: 1.02;
}

.hero-title .role {
    min-height: 1.2em;
    font-size: clamp(1.25rem, 2.4vw, 1.625rem);
    font-weight: 500;
    letter-spacing: -0.01em;
    color: var(--text);
}

.role-text.is-typing::after {
    content: "";
    display: inline-block;
    width: 2px;
    height: 1em;
    margin-left: 3px;
    vertical-align: -0.12em;
    background: var(--accent);
    animation: caret 1s steps(1) infinite;
}

@keyframes caret {
    50% {
        opacity: 0;
    }
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-top: var(--space-6);
}

@media (min-width: 900px) {
    .hero-actions {
        margin-top: var(--space-7);
    }
}

.hero-photo {
    position: relative;
    margin: 0;
}

.hero-photo img {
    width: 100%;
    aspect-ratio: 4 / 5;
    object-fit: cover;
    object-position: 60% 40%;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

@media (max-width: 767px) {
    .hero {
        padding-block: var(--space-6) var(--space-7);
    }

    .hero-photo {
        max-width: 360px;
    }
}

@media (min-width: 900px) {
    .hero {
        padding-block: var(--space-8) var(--space-9);
    }

    .hero .wrap {
        grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
        gap: var(--space-8);
    }

    .hero-photo img {
        max-height: calc(100dvh - var(--header-h) - 8rem);
        min-height: 420px;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .reveal {
        animation: rise 0.8s var(--ease-out) both;
    }

    .reveal-2 {
        animation-delay: 0.08s;
    }

    .reveal-3 {
        animation-delay: 0.16s;
    }

    .hero-photo.reveal {
        animation-name: settle;
        animation-duration: 1s;
    }
}

@keyframes rise {
    from {
        opacity: 0;
        transform: translateY(12px);
    }
}

@keyframes settle {
    from {
        opacity: 0;
        transform: scale(0.98);
    }
}

/* ---------- Sections ---------- */
.section {
    padding-block: var(--space-8);
    border-top: 1px solid var(--line);
}

@media (min-width: 900px) {
    .section {
        padding-block: var(--space-9);
    }
}

.section-title {
    color: var(--accent);
    font-size: clamp(1.875rem, 4vw, 2.75rem);
    letter-spacing: -0.03em;
}

.section-label {
    display: block;
    margin-bottom: var(--space-3);
    font-family: var(--font-mono);
    font-size: 0.8rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

/* About (bio, directly under the hero) */
.about {
    padding-block: 0 var(--space-8);
}

.about p {
    max-width: 62ch;
    font-size: clamp(1.125rem, 2vw, 1.375rem);
    line-height: 1.55;
    letter-spacing: -0.01em;
}

.about b {
    font-weight: 600;
    color: var(--accent);
}

@media (min-width: 900px) {
    .about p {
        margin-left: calc(100% / 12);
    }
}

/* What I do: heading column + offset two-column list */
.features .wrap {
    display: grid;
    gap: var(--space-6);
}

.stack-label {
    margin-top: var(--space-5);
    font-size: 0.95rem;
    font-weight: 600;
}

.stack {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    max-width: 30rem;
    margin-top: var(--space-3);
    padding: 0;
    list-style: none;
}

.stack li {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-1) var(--space-3);
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: var(--surface);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    transition: border-color 0.25s var(--ease-out), color 0.25s var(--ease-out), transform 0.25s var(--ease-out);
}

.stack-logo {
    width: 14px;
    height: 14px;
    flex: none;
}

@media (hover: hover) {
    .stack li:hover {
        border-color: var(--accent);
        color: var(--accent);
        transform: translateY(-2px);
    }
}

.feature-list {
    display: grid;
    gap: var(--space-6) var(--space-7);
    list-style: none;
    padding: 0;
}

.feature {
    padding-top: var(--space-4);
    border-top: 2px solid var(--text);
    transition: border-color 0.3s var(--ease-out), translate 0.35s var(--ease-out);
}

.feature h3 {
    transition: color 0.3s var(--ease-out);
}

@media (hover: hover) {
    .feature:hover {
        border-top-color: var(--accent);
        translate: 0 -4px;
    }

    .feature:hover h3 {
        color: var(--accent);
    }

    .feature:hover .feature-icon {
        transform: translateY(-2px) scale(1.08);
    }
}

.feature-icon {
    display: block;
    width: 28px;
    height: 28px;
    margin-bottom: var(--space-3);
    color: var(--accent);
    transition: transform 0.35s var(--ease-out);
}

.feature h3 {
    font-size: 1.25rem;
    margin-bottom: var(--space-2);
}

.feature p {
    color: var(--muted);
    max-width: 48ch;
}

@media (min-width: 768px) {
    .feature-list {
        grid-template-columns: 1fr 1fr;
    }

    .feature:nth-child(even) {
        transform: translateY(var(--space-7));
    }

    .features {
        padding-bottom: calc(var(--space-9) + var(--space-7));
    }
}

@media (min-width: 900px) {
    .features .wrap {
        grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
        gap: var(--space-8);
    }

    .features-head {
        position: sticky;
        top: calc(var(--header-h) + var(--space-6));
        align-self: start;
    }
}

/* Resume */
.resume-head {
    margin-bottom: var(--space-7);
}

.resume-block + .resume-block {
    margin-top: var(--space-8);
}

.block-title {
    color: var(--text);
    font-size: 1.375rem;
    margin-bottom: var(--space-5);
}

.job {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-4);
    padding-block: var(--space-6);
    border-top: 1px solid var(--line);
}

.job:last-child {
    padding-bottom: 0;
}

.job-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3) var(--space-4);
}

.job-head h4 {
    font-size: 1.25rem;
}

.org {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
}

.org img {
    width: 28px;
    height: 28px;
    border-radius: var(--radius);
    object-fit: contain;
    background: #fdfdfc;
}

.date {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-size: 0.875rem;
    color: var(--muted);
}

.job-summary {
    color: var(--muted);
}

.projects {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: var(--space-5);
    margin-top: var(--space-2);
}

.project {
    padding: var(--space-5);
    border-radius: var(--radius);
    background: var(--card-bg);
    border: 1px solid var(--line);
    box-shadow: var(--card-shadow);
    transition: transform 0.35s var(--ease-out), box-shadow 0.35s var(--ease-out),
        border-color 0.35s var(--ease-out);
}

@media (hover: hover) {
    .project:hover {
        transform: translateY(-4px);
        border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
        box-shadow: var(--card-shadow), var(--shadow);
    }
}

.project-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-1) var(--space-4);
    margin-bottom: var(--space-3);
}

.project-head h5 {
    margin: 0;
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.project-head .by {
    display: block;
    font-size: 0.9rem;
    color: var(--muted);
}

.project p,
.project li {
    font-size: 0.975rem;
}

.project p {
    color: var(--muted);
    max-width: 75ch;
}

.project ul {
    display: grid;
    gap: var(--space-2);
    margin-top: var(--space-3);
    padding-left: 1.1em;
    max-width: 75ch;
}

.project li::marker {
    color: var(--muted);
}

@media (min-width: 900px) {
    .job {
        grid-template-columns: minmax(0, 3fr) minmax(0, 9fr);
        gap: var(--space-6);
    }

    .job-side {
        position: sticky;
        top: calc(var(--header-h) + var(--space-5));
        align-self: start;
    }

    .job-head {
        flex-direction: column;
        align-items: flex-start;
    }

    .projects {
        margin-top: 0;
    }
}

/* Education + certifications */
.edu-grid {
    display: grid;
    gap: var(--space-7);
}

@media (min-width: 900px) {
    .edu-grid {
        grid-template-columns: 1fr 1fr;
        gap: var(--space-8);
    }
}

.edu-group h4 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: var(--space-2);
}

.edu-list {
    list-style: none;
    padding: 0;
}

.edu-item {
    display: grid;
    grid-template-columns: 40px 1fr;
    gap: var(--space-2) var(--space-4);
    padding-block: var(--space-5);
    border-top: 1px solid var(--line);
}

.edu-item img {
    transition: transform 0.3s var(--ease-out), border-color 0.3s var(--ease-out);
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    object-fit: contain;
    background: #fdfdfc;
    border: 1px solid var(--line);
}

.edu-item .mark {
    width: 40px;
    height: 40px;
}

.edu-item h5 {
    margin: 0;
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.3;
}

.edu-item .meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-3);
    margin-top: var(--space-1);
    font-size: 0.9rem;
    color: var(--muted);
}

.edu-item p {
    grid-column: 2;
    font-size: 0.95rem;
    color: var(--muted);
}

/* Contact */
.contact .wrap {
    display: grid;
    gap: var(--space-6);
}

.contact-mail {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    margin-top: var(--space-5);
    font-size: clamp(1.375rem, 4.5vw, 2.5rem);
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.2;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.contact-mail .icon {
    color: var(--accent);
    transition: transform 0.25s var(--ease-out);
}

.contact-mail:hover .icon {
    transform: translate(2px, -2px);
}

.contact-note {
    margin-top: var(--space-3);
    color: var(--muted);
}

.contact-card {
    display: grid;
    gap: var(--space-4);
    align-content: start;
}

.contact-card .who {
    font-weight: 600;
}

.contact-card .who span {
    display: block;
    font-weight: 400;
    color: var(--muted);
}

.social {
    display: flex;
    flex-wrap: nowrap;
    gap: var(--space-3);
    list-style: none;
    padding: 0;
}

/* three social buttons: one row where it fits, one column on narrow phones */
@media (max-width: 479px) {
    .social {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (min-width: 1100px) {
    .contact .wrap {
        grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
        align-items: end;
    }
}

/* Footer */
.site-footer {
    /* bottom space keeps the fixed back-to-top button clear of the footer text */
    padding-block: var(--space-7) calc(var(--space-7) + 64px);
    border-top: 1px solid var(--line);
    font-size: 0.925rem;
    color: var(--muted);
}

.site-footer .wrap {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.site-footer .brand img {
    width: 48px;
    height: 48px;
}

/* ---------- Notes page ---------- */
.notes-hero {
    padding-block: var(--space-8) var(--space-7);
}

.notes-hero h1 {
    color: var(--accent);
    font-size: clamp(2.25rem, 6vw, 3.75rem);
    letter-spacing: -0.035em;
    max-width: 16ch;
}

.notes-hero h1 span {
    color: var(--accent);
}

.notes-hero p {
    max-width: 60ch;
    margin-top: var(--space-5);
    font-size: 1.125rem;
    color: var(--muted);
}

.notes-intro {
    margin-bottom: var(--space-6);
    font-weight: 500;
}

.topics {
    columns: 1;
    column-gap: var(--space-8);
}

@media (min-width: 768px) {
    .topics {
        columns: 2;
    }
}

.topic {
    break-inside: avoid;
    padding-block: var(--space-5) var(--space-6);
    border-top: 2px solid var(--text);
}

.topic h2 {
    color: var(--accent);
    font-size: 1.375rem;
    margin-bottom: var(--space-3);
}

.topic ul {
    list-style: none;
    padding: 0;
    display: grid;
    gap: var(--space-1);
}

.topic li a {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding-block: var(--space-1);
    font-weight: 500;
    text-decoration: none;
}

.topic li a .icon {
    width: 1em;
    height: 1em;
    color: var(--muted);
    transition: transform 0.2s var(--ease-out), color 0.2s var(--ease-out);
}

.topic li a:hover .icon {
    color: var(--accent);
    transform: translate(2px, -2px);
}

.topic .tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-4);
    list-style: none;
    padding: 0;
}

.topic .tags li {
    padding: 2px var(--space-2);
    border-radius: var(--radius-pill);
    background: var(--accent-soft);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text);
}

.notes-back {
    padding-block: var(--space-6) var(--space-8);
}

/* ---------- 404 ---------- */
.notfound {
    min-height: 100dvh;
    display: grid;
    place-items: center;
    padding: var(--space-6) var(--gutter);
    text-align: center;
}

.notfound .code {
    font-family: var(--font-mono);
    font-size: clamp(4rem, 14vw, 6rem);
    font-weight: 600;
    line-height: 1;
    color: var(--accent);
}

.notfound h1 {
    margin-top: var(--space-4);
    font-size: 1.75rem;
}

.notfound p {
    margin: var(--space-3) auto var(--space-6);
    max-width: 40ch;
    color: var(--muted);
}

/* ---------- Back to top ---------- */
.to-top {
    position: fixed;
    right: max(var(--space-4), env(safe-area-inset-right));
    bottom: max(var(--space-4), env(safe-area-inset-bottom));
    z-index: 40;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border: 1px solid var(--line);
    border-radius: var(--radius-pill);
    background: var(--surface);
    color: var(--text);
    box-shadow: var(--shadow);
    transition: opacity 0.25s var(--ease-out), transform 0.25s var(--ease-out),
        border-color 0.2s var(--ease-out), color 0.2s var(--ease-out);
}

.to-top:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.to-top:active {
    transform: translateY(1px) scale(0.96);
}

.js .to-top:not([data-shown]) {
    opacity: 0;
    transform: translateY(8px);
    pointer-events: none;
    visibility: hidden;
    transition: opacity 0.25s var(--ease-out), transform 0.25s var(--ease-out), visibility 0s 0.25s;
}

@media (min-width: 768px) {
    .to-top {
        right: var(--space-6);
        bottom: var(--space-6);
    }
}

@media (hover: hover) {
    .edu-item:hover img {
        transform: translateY(-2px) rotate(-3deg);
        border-color: var(--accent);
    }

    .to-top:hover {
        transform: translateY(-3px);
    }
}
