/* ==========================================================================
   lucabonaldo.dev — paper & ink
   Tokens
   ========================================================================== */

:root {
    /* surfaces */
    --paper: #f5f2ea;
    --paper-soft: #eeeade;
    --ink: #1a1712;
    --ink-soft: rgba(26, 23, 18, 0.64);
    --rule: rgba(26, 23, 18, 0.18);

    /* dark (contact) surface counterparts */
    --paper-on-ink: #f0ecdf;
    --paper-on-ink-soft: rgba(240, 236, 223, 0.62);
    --rule-on-ink: rgba(240, 236, 223, 0.22);

    /* accent: vermilion ink */
    --accent: #b02e0c;
    --accent-bright: #e0522d; /* on dark surfaces only */

    /* type */
    --font-display: 'Fraunces', Georgia, serif;
    --font-text: 'Inter', -apple-system, 'Segoe UI', sans-serif;

    /* layout */
    --max: 1360px;
    --gutter: clamp(1.25rem, 4vw, 4rem);
    --header-h: 3.5rem;

    /* motion */
    --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
    --dur: 600ms;
}

/* ==========================================================================
   Base
   ========================================================================== */

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

html {
    overflow-x: clip;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 1rem);
}

body {
    margin: 0;
    overflow-x: clip;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--font-text);
    font-size: 1.0625rem;
    line-height: 1.65;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 500;
    line-height: 1.1;
    margin: 0;
    text-wrap: balance;
}

p {
    margin: 0 0 1em;
}

p:last-child {
    margin-bottom: 0;
}

a {
    color: inherit;
}

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

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

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

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.skip-link {
    position: fixed;
    top: 0.5rem;
    left: 0.5rem;
    z-index: 100;
    padding: 0.5rem 0.875rem;
    background: var(--ink);
    color: var(--paper);
    font-size: 0.875rem;
    text-decoration: none;
    transform: translateY(-300%);
}

.skip-link:focus-visible {
    transform: none;
}

/* Shared small-caps label */
.overline,
.section__index,
.xp__period,
.edu__period,
.practice__tech,
.hero__facts dt,
.langs dt {
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

/* Editorial text link */
.text-link {
    display: inline-block;
    font-weight: 500;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.35em;
    text-decoration-color: var(--rule);
    transition: text-decoration-color 180ms var(--ease-out), color 180ms var(--ease-out);
}

.text-link:hover {
    color: var(--accent);
    text-decoration-color: var(--accent);
    text-decoration-thickness: 2px;
}

/* ==========================================================================
   Header
   ========================================================================== */

.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: var(--paper);
    border-bottom: 1px solid var(--rule);
}

.site-header__inner {
    max-width: var(--max);
    margin-inline: auto;
    height: var(--header-h);
    padding-inline: var(--gutter);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.wordmark {
    font-family: var(--font-display);
    font-weight: 560;
    font-size: 1.15rem;
    text-decoration: none;
    white-space: nowrap;
}

.wordmark__dot {
    color: var(--accent);
}

.wordmark__mark {
    display: none;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: clamp(0.875rem, 2.5vw, 2rem);
    font-size: 0.875rem;
    font-weight: 500;
}

.site-nav a {
    text-decoration: none;
    color: var(--ink-soft);
    transition: color 160ms var(--ease-out);
}

.site-nav a:hover {
    color: var(--accent);
}

.site-nav__cv {
    color: var(--ink) !important;
    border: 1px solid var(--rule);
    padding: 0.3rem 0.7rem;
    transition: border-color 160ms var(--ease-out), color 160ms var(--ease-out);
}

.site-nav__cv:hover {
    color: var(--accent) !important;
    border-color: var(--accent);
}

@media (max-width: 540px) {
    .wordmark__full {
        display: none;
    }

    .wordmark__mark {
        display: inline;
    }

    .site-nav {
        font-size: 0.8125rem;
        gap: 0.875rem;
    }

    /* the CV link stays reachable from the contact section */
    .site-nav__cv {
        display: none;
    }
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    max-width: var(--max);
    margin-inline: auto;
    min-height: calc(100svh - var(--header-h));
}

.hero__copy {
    padding: clamp(3rem, 9vh, 6.5rem) var(--gutter) clamp(2.5rem, 6vh, 4rem);
    align-self: center;
}

.overline {
    color: var(--ink-soft);
    margin-bottom: clamp(1rem, 3vh, 2rem);
}

.hero__name {
    font-size: clamp(3.4rem, 12.5vw, 8.25rem);
    font-weight: 580;
    letter-spacing: -0.02em;
    line-height: 0.92;
    margin-bottom: clamp(1.5rem, 4vh, 2.75rem);
}

.hero__intro {
    max-width: 34em;
    font-size: clamp(1.0625rem, 1.5vw, 1.1875rem);
    color: var(--ink-soft);
    margin-bottom: 2.25rem;
}

.hero__links {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem 2.5rem;
    font-size: 1.0625rem;
}

.hero__field {
    position: relative;
    min-height: 38svh;
    border-top: 1px solid var(--rule);
}

.hero__facts {
    grid-column: 1 / -1;
    margin: 0;
    border-top: 1px solid var(--rule);
    padding: 1.5rem var(--gutter) 2rem;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1.5rem 2rem;
}

.hero__facts dt {
    color: var(--accent);
    margin-bottom: 0.35rem;
}

.hero__facts dd {
    margin: 0;
    font-size: 0.9375rem;
    line-height: 1.45;
}

@media (min-width: 960px) {
    .hero {
        grid-template-columns: minmax(0, 1fr) clamp(340px, 40vw, 640px);
    }

    .hero__field {
        min-height: 0;
        border-top: 0;
        border-left: 1px solid var(--rule);
    }
}

@media (max-width: 720px) {
    .hero__facts {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* ==========================================================================
   Generative field
   ========================================================================== */

.field {
    overflow: hidden;
    contain: strict;
}

.field canvas {
    position: absolute;
    inset: 0;
    display: block;
}

/* dotted texture fallback when p5 fails to load */
.field--fallback {
    background-image: radial-gradient(var(--rule) 1.5px, transparent 1.6px);
    background-size: 26px 26px;
}

.contact .field--fallback {
    background-image: radial-gradient(var(--rule-on-ink) 1.5px, transparent 1.6px);
}

/* ==========================================================================
   Section scaffold
   ========================================================================== */

.section {
    border-top: 1px solid var(--rule);
}

.section:nth-of-type(even) {
    background: var(--paper-soft);
}

.section__inner {
    max-width: var(--max);
    margin-inline: auto;
    padding: clamp(4rem, 10vh, 7.5rem) var(--gutter);
    display: grid;
    grid-template-columns: minmax(0, 4fr) minmax(0, 8fr);
    gap: clamp(2.5rem, 5vw, 6rem);
    align-items: start;
}

.section__head {
    position: sticky;
    top: calc(var(--header-h) + 2rem);
}

.section__index {
    color: var(--accent);
    margin-bottom: 0.75rem;
}

.section__index--dark {
    color: var(--accent-bright);
}

.section__head h2 {
    font-size: clamp(2.1rem, 4.2vw, 3.4rem);
    letter-spacing: -0.015em;
}

.section__note {
    margin-top: 1.25rem;
    max-width: 24em;
    color: var(--ink-soft);
    font-size: 0.9375rem;
}

@media (max-width: 860px) {
    .section__inner {
        grid-template-columns: minmax(0, 1fr);
        gap: 2.5rem;
    }

    .section__head {
        position: static;
    }
}

/* ==========================================================================
   Practice
   ========================================================================== */

.practice {
    list-style: none;
    margin: 0;
    padding: 0;
}

.practice__row {
    display: grid;
    grid-template-columns: 3.5rem minmax(0, 1fr);
    gap: 1rem;
    padding-block: clamp(1.75rem, 3.5vh, 2.5rem);
    border-bottom: 1px solid var(--rule);
}

.practice__row:first-child {
    padding-top: 0.5rem;
}

.practice__num {
    font-family: var(--font-display);
    font-style: italic;
    font-size: 1.5rem;
    line-height: 1.2;
    color: var(--ink-soft);
    transition: color 200ms var(--ease-out);
}

.practice__row:hover .practice__num {
    color: var(--accent);
}

.practice__row h3 {
    font-size: clamp(1.4rem, 2.4vw, 1.85rem);
    margin-bottom: 0.6rem;
    transition: transform 260ms var(--ease-out);
}

.practice__row:hover h3 {
    transform: translateX(0.3rem);
}

.practice__row p {
    max-width: 38em;
    color: var(--ink-soft);
}

.practice__tech {
    margin-top: 0.9rem;
    color: var(--ink);
    opacity: 0.75;
}

/* ==========================================================================
   Experience & education rows
   ========================================================================== */

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

.xp__row,
.edu__row {
    display: grid;
    grid-template-columns: 11rem minmax(0, 1fr);
    gap: 1rem 2rem;
    padding-block: clamp(1.75rem, 3.5vh, 2.5rem);
    border-bottom: 1px solid var(--rule);
}

.xp__row:first-child {
    padding-top: 0.5rem;
}

.xp__period,
.edu__period {
    color: var(--ink-soft);
    padding-top: 0.5rem;
}

.xp__org {
    font-size: clamp(1.5rem, 2.6vw, 2rem);
    margin-bottom: 0.2rem;
}

.xp__role,
.edu__note {
    font-family: var(--font-display);
    font-style: italic;
    font-weight: 400;
    font-size: 0.72em;
    color: var(--ink-soft);
}

.xp__place {
    font-size: 0.875rem;
    color: var(--ink-soft);
    margin-bottom: 0.9rem;
}

.xp__row p:last-child,
.edu__row p:last-child {
    max-width: 40em;
    color: var(--ink-soft);
}

@media (max-width: 640px) {
    .xp__row,
    .edu__row {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.4rem;
    }

    .xp__period,
    .edu__period {
        padding-top: 0;
    }
}

/* ==========================================================================
   About
   ========================================================================== */

.about__lead {
    font-family: var(--font-display);
    font-size: clamp(1.45rem, 2.6vw, 2rem);
    line-height: 1.3;
    letter-spacing: -0.01em;
    margin-bottom: 1.5rem;
    max-width: 24em;
}

.about__bio > p:not(.about__lead) {
    max-width: 42em;
    color: var(--ink-soft);
}

.about__subhead {
    font-size: 1.35rem;
    margin: clamp(2.5rem, 6vh, 4rem) 0 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--rule);
}

.edu__row h4 {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
}

.langs {
    margin: 2rem 0 0;
}

.langs dt {
    color: var(--accent);
    margin-bottom: 0.4rem;
}

.langs dd {
    margin: 0;
    font-size: 0.9375rem;
    color: var(--ink-soft);
    line-height: 1.7;
}

/* ==========================================================================
   Contact (ink surface)
   ========================================================================== */

.contact {
    background: var(--ink);
    color: var(--paper-on-ink);
    border-top: 1px solid var(--ink);
}

.contact__inner {
    max-width: var(--max);
    margin-inline: auto;
    padding: clamp(4rem, 10vh, 7.5rem) var(--gutter) clamp(3rem, 7vh, 5rem);
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: clamp(2.5rem, 5vw, 6rem);
    align-items: stretch;
}

.contact__title {
    font-size: clamp(2.2rem, 5vw, 4rem);
    letter-spacing: -0.015em;
    margin-bottom: 1.5rem;
    max-width: 14em;
}

.contact__title .accent {
    color: var(--accent-bright);
}

.contact__note {
    color: var(--paper-on-ink-soft);
    max-width: 34em;
    margin-bottom: clamp(2rem, 5vh, 3.5rem);
}

.contact__email {
    display: inline-block;
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 4.2vw, 3rem);
    letter-spacing: -0.01em;
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.25em;
    text-decoration-color: var(--rule-on-ink);
    transition: color 200ms var(--ease-out), text-decoration-color 200ms var(--ease-out);
    overflow-wrap: anywhere;
}

.contact__email:hover {
    color: var(--accent-bright);
    text-decoration-color: var(--accent-bright);
}

.contact__links {
    list-style: none;
    margin: clamp(2rem, 5vh, 3rem) 0 0;
    padding: 1.25rem 0 0;
    border-top: 1px solid var(--rule-on-ink);
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 2rem;
    font-size: 0.9375rem;
    font-weight: 500;
}

.contact__links a {
    text-decoration: none;
    color: var(--paper-on-ink-soft);
    transition: color 160ms var(--ease-out);
}

.contact__links a:hover {
    color: var(--accent-bright);
}

.contact__field {
    position: relative;
    min-height: 300px;
    border-left: 1px solid var(--rule-on-ink);
}

.contact :focus-visible {
    outline-color: var(--accent-bright);
}

.footer {
    max-width: var(--max);
    margin-inline: auto;
    padding: 1.5rem var(--gutter);
    border-top: 1px solid var(--rule-on-ink);
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    font-size: 0.8125rem;
    color: var(--paper-on-ink-soft);
}

.footer p {
    margin: 0;
}

@media (max-width: 860px) {
    .contact__inner {
        grid-template-columns: minmax(0, 1fr);
    }

    .contact__field {
        min-height: 220px;
        border-left: 0;
        border-top: 1px solid var(--rule-on-ink);
    }
}

/* ==========================================================================
   Motion
   ========================================================================== */

@media (prefers-reduced-motion: no-preference) {
    html.js .reveal {
        opacity: 0;
        transform: translateY(14px);
        transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
    }

    html.js .reveal.is-in {
        opacity: 1;
        transform: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .practice__row:hover h3 {
        transform: none;
    }
}
