/* ============================================================
   DESIGN SYSTEM
   ============================================================ */
:root {
    /* Palette — warm ivory / deep charcoal / muted bronze */
    --ivory:        #F5F1E8;
    --ivory-panel:  #EDE7DA;
    --charcoal:     #17181C;
    --charcoal-2:   #212228;
    --bronze:       #A96B44;   /* accent: large text, rules, icons, non-text (needs 3:1) */
    --bronze-deep:  #8C5634;
    --bronze-text:    #8C5634;  /* small bronze TEXT on light surfaces — WCAG AA (≥4.5:1) */
    --bronze-on-dark: #B77E52;  /* small bronze TEXT on charcoal surfaces — WCAG AA (≥4.5:1) */
    --ink:          #2C2B27;   /* primary body text on light */
    --ink-soft:     #55524A;   /* secondary body text */
    --muted:        #726C5D;   /* labels / meta — deepened for legibility */
    --line:         #DAD3C4;   /* hairlines on light */
    --on-dark:      #ECE6D8;   /* text on charcoal */
    --on-dark-soft: #B7B1A3;
    --line-dark:    rgba(236,230,216,0.14);

    /* Typography */
    --serif: "Cormorant Garamond", Georgia, "Times New Roman", serif;
    --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

    /* Fluid type scale */
    --fs-display: clamp(3rem, 8vw, 6rem);
    --fs-h2:      clamp(2.4rem, 6vw, 5rem);
    --fs-lead:    clamp(1.15rem, 1.7vw, 1.5rem);
    --fs-body:    1.0625rem;
    --fs-label:   0.72rem;

    /* Layout */
    --container: 1320px;
    --gutter: clamp(1.4rem, 5vw, 6rem);
    --section-y: clamp(5.5rem, 13vw, 12rem);

    /* Motion */
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --dur: 0.9s;
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    font-family: var(--sans);
    font-size: var(--fs-body);
    line-height: 1.65;
    color: var(--ink);
    background: var(--ivory);
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

::selection { background: var(--bronze); color: var(--ivory); }

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

a { color: inherit; }

/* ---- Skip link ---- */
.skip-link {
    position: absolute; left: -9999px; top: 0; z-index: 999;
    background: var(--charcoal); color: var(--on-dark);
    padding: .8rem 1.4rem; font-size: .8rem; letter-spacing: .1em;
    text-transform: uppercase; text-decoration: none;
}
.skip-link:focus { left: 1rem; top: 1rem; }

/* ---- Visually hidden, available to assistive tech (live region) ---- */
.sr-only {
    position: absolute; width: 1px; height: 1px;
    padding: 0; margin: -1px; overflow: hidden;
    clip: rect(0 0 0 0); clip-path: inset(50%);
    white-space: nowrap; border: 0;
}

/* ---- Shared layout ---- */
.container {
    width: 100%;
    max-width: var(--container);
    margin: 0 auto;
    padding-inline: var(--gutter);
}

.section { padding-block: var(--section-y); }

/* Offset anchored sections so the fixed header never covers their titles */
section[id], footer[id], #top { scroll-margin-top: clamp(5rem, 10vh, 7rem); }

/* ---- Editorial labels ---- */
.label {
    display: inline-flex; align-items: center; gap: .7rem;
    font-family: var(--sans);
    font-size: var(--fs-label);
    font-weight: 500;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--bronze-text);
}
.label::before {
    content: ""; width: 2rem; height: 1px; background: var(--bronze-text);
    opacity: .6;
}

/* ---- Headings ---- */
h1, h2, h3 { font-family: var(--serif); font-weight: 400; line-height: 1.02; text-wrap: balance; }

.h2 {
    font-size: var(--fs-h2);
    letter-spacing: -0.01em;
    line-height: 1.04;
    color: var(--charcoal);
}

.lead {
    font-size: var(--fs-lead);
    line-height: 1.5;
    color: var(--ink-soft);
    font-weight: 300;
    max-width: 46ch;
    text-wrap: pretty;
}

p.body { color: var(--ink-soft); max-width: 62ch; text-wrap: pretty; }
p.body + p.body { margin-top: 1.2rem; }

em { font-style: italic; }

/* ---- Buttons / links ---- */
.btn {
    display: inline-flex; align-items: center; gap: .8rem;
    font-family: var(--sans);
    font-size: .78rem; font-weight: 500;
    letter-spacing: 0.18em; text-transform: uppercase;
    text-decoration: none;
    padding: 1.15rem 2.2rem;
    background: var(--charcoal);
    color: var(--on-dark);
    border: 1px solid var(--charcoal);
    border-radius: 0;
    cursor: pointer;
    transition: background .5s var(--ease), color .5s var(--ease), transform .5s var(--ease);
}
.btn:hover { background: transparent; color: var(--charcoal); }
/* Same button on charcoal surfaces: the fill and the border swap sides */
.btn--on-dark {
    background: var(--ivory); color: var(--charcoal); border-color: var(--ivory);
}
.btn--on-dark:hover { background: transparent; color: var(--ivory); }

/* ============================================================
   HEADER / NAV
   ============================================================ */
.site-header {
    position: fixed; top: 0; left: 0; width: 100%; z-index: 100;
    background: transparent;
    transition: background .6s var(--ease), box-shadow .6s var(--ease), backdrop-filter .6s var(--ease);
}
.site-header.scrolled {
    background: rgba(245,241,232,0.86);
    backdrop-filter: saturate(140%) blur(14px);
    -webkit-backdrop-filter: saturate(140%) blur(14px);
    box-shadow: 0 1px 0 var(--line);
}
.header-inner {
    display: flex; align-items: center; justify-content: space-between;
    padding-block: 2.1rem;
    transition: padding-block .5s var(--ease);
}
.scrolled .header-inner { padding-block: 1.15rem; }

.brand {
    font-family: var(--serif);
    font-size: 1.35rem;
    letter-spacing: 0.02em;
    color: var(--charcoal);
    text-decoration: none;
    white-space: nowrap;
}
.brand .brand-dot { color: var(--bronze); }

.nav {
    display: flex; align-items: center; gap: 2.75rem;
}
.nav-links { display: flex; align-items: center; gap: 2.25rem; }
.nav-links a {
    font-size: .74rem; font-weight: 500;
    letter-spacing: 0.16em; text-transform: uppercase;
    color: var(--ink-soft); text-decoration: none;
    position: relative; padding-bottom: 2px;
    transition: color .4s var(--ease);
}
.nav-links a::after {
    content: ""; position: absolute; left: 0; bottom: -2px; height: 1px;
    width: 100%; background: var(--bronze);
    transform: scaleX(0); transform-origin: left;
    transition: transform .45s var(--ease);
}
.nav-links a:hover { color: var(--charcoal); }
.nav-links a:hover::after { transform: scaleX(1); }
.nav-links a.is-active { color: var(--charcoal); }
.nav-links a.is-active::after { transform: scaleX(1); }

.nav-utility { display: flex; align-items: center; gap: 1.5rem; }

/* Language switch */
.lang {
    display: inline-flex; align-items: center;
    font-size: .74rem; font-weight: 500; letter-spacing: .1em;
}
.lang button {
    background: none; border: none; cursor: pointer;
    font: inherit; color: var(--muted);
    padding: .2rem .1rem; letter-spacing: .1em;
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 24px;
    transition: color .35s var(--ease);
}
.lang button[aria-pressed="true"] { color: var(--charcoal); }
.lang .sep { color: var(--line); margin-inline: .35rem; }
.lang button:hover { color: var(--bronze-text); }
/* Touch targets: enlarge the language switch on touch / coarse pointers (WCAG 2.5.8) */
@media (hover: none), (pointer: coarse) {
    .lang button { min-width: 44px; min-height: 44px; }
}

/* Socials */
.socials { display: inline-flex; align-items: center; gap: 1.1rem; }
.socials a {
    color: var(--muted); display: inline-flex;
    transition: color .35s var(--ease), transform .35s var(--ease);
}
.socials a:hover { color: var(--bronze); transform: translateY(-2px); }
.socials svg { width: 17px; height: 17px; }

/* Hamburger */
.menu-toggle {
    display: none; background: none; border: none; cursor: pointer;
    width: 30px; height: 22px; position: relative; color: var(--charcoal);
    z-index: 210;
}
.menu-toggle span {
    position: absolute; left: 0; width: 100%; height: 1.5px;
    background: currentColor; transition: transform .45s var(--ease), opacity .3s var(--ease), top .45s var(--ease);
}
.menu-toggle span:nth-child(1) { top: 3px; }
.menu-toggle span:nth-child(2) { top: 10.5px; }
.menu-toggle span:nth-child(3) { top: 18px; }
body.menu-open .menu-toggle span:nth-child(1) { top: 10.5px; transform: rotate(45deg); }
body.menu-open .menu-toggle span:nth-child(2) { opacity: 0; }
body.menu-open .menu-toggle span:nth-child(3) { top: 10.5px; transform: rotate(-45deg); }

/* ============================================================
   HERO
   ============================================================ */
.hero {
    min-height: 100svh;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    align-items: center;
    gap: clamp(2rem, 5vw, 5rem);
    padding-top: clamp(7rem, 14vh, 10rem);
    padding-bottom: clamp(3rem, 7vh, 6rem);
}
.hero-copy { max-width: 40rem; }

.hero h1 {
    font-size: var(--fs-display);
    line-height: 0.96;
    letter-spacing: -0.015em;
    color: var(--charcoal);
}
.hero h1 em { color: var(--bronze); font-weight: 400; }
.hero .lead { margin-top: clamp(1.6rem, 3vw, 2.4rem); }
.hero-actions {
    margin-top: clamp(2rem, 4vw, 3rem);
    display: flex; align-items: center; gap: 2.2rem; flex-wrap: wrap;
}

/* Media wrappers (shared) */
.media {
    position: relative; overflow: hidden;
    background: var(--ivory-panel);
}
.media img {
    width: 100%; height: 100%; object-fit: cover;
    transition: transform 1.4s var(--ease), filter 1.4s var(--ease);
}
.media.zoom:hover img { transform: scale(1.045); }
/* Graceful placeholder if an image is missing */
.media--placeholder img { display: none; }
.media--placeholder::after {
    content: attr(data-placeholder);
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-family: var(--serif); font-style: italic; font-size: 1.1rem;
    color: var(--muted); letter-spacing: .02em;
    background: repeating-linear-gradient(135deg, var(--ivory-panel), var(--ivory-panel) 12px, #E7E0D2 12px, #E7E0D2 24px);
}

.hero-media {
    position: relative;
    aspect-ratio: 4 / 5;
    width: 100%;
}
.hero-media .media { width: 100%; height: 100%; }
.hero-media img {
    filter: grayscale(100%) contrast(1.02);
    transform: scale(1.06);
    transition: transform 1.9s var(--ease), filter 1.4s var(--ease);
}
body.is-loaded .hero-media img { transform: scale(1); }

/* ============================================================
   ROLES & AFFILIATIONS — the dark panel under the hero.
   Carried by the institutional logos alone: no visible heading
   (see .facts--logos for the row treatment).
   ============================================================ */
.intersection {
    background: var(--charcoal);
    color: var(--on-dark);
}

/* ============================================================
   BIOGRAPHY
   Long-form text: the heading column stays put while the
   paragraphs scroll past it, so the reader never loses the place.
   ============================================================ */
.bio-grid {
    display: grid; grid-template-columns: minmax(0, 26rem) minmax(0, 1fr);
    gap: clamp(2rem, 5vw, 4.5rem);
    align-items: start;
}
.bio-head { position: sticky; top: clamp(6rem, 12vh, 8rem); }
.bio-text .body { max-width: 68ch; }

/* Greyscale to match the hero portrait — the page has only these two
   photographs and one in colour would jar. The max-height keeps the
   whole sticky column inside the viewport: if it grew taller, its
   bottom would be clipped off-screen and never scroll into view. */
.bio-portrait {
    margin-top: clamp(1.8rem, 3vw, 2.5rem);
    aspect-ratio: 1 / 1;
    max-height: calc(100vh - 20rem);
}
.bio-portrait img { filter: grayscale(100%) contrast(1.02); }

@media (max-width: 900px) {
    .bio-grid { grid-template-columns: 1fr; gap: clamp(1.5rem, 4vw, 2.5rem); }
    .bio-head { position: static; }
    .bio-portrait { max-height: none; }
}

/* ============================================================
   AGENDA — upcoming dates, same hairline rhythm as .facts
   ============================================================ */
.agenda-list {
    list-style: none;
    border-top: 1px solid var(--line);
    margin-top: clamp(2.5rem, 5vw, 4rem);
}
.agenda-row {
    display: grid; grid-template-columns: minmax(8rem, 12rem) 1fr;
    gap: clamp(1rem, 3vw, 3rem);
    align-items: baseline;
    padding: 1.4rem 0;
    border-bottom: 1px solid var(--line);
}
.agenda-date {
    font-family: var(--sans);
    font-size: .74rem; letter-spacing: .14em; text-transform: uppercase;
    color: var(--bronze-text); font-weight: 500;
    font-variant-numeric: tabular-nums;
}
.agenda-title { font-family: var(--serif); font-size: 1.3rem; font-weight: 400; line-height: 1.3; }
.agenda-meta { margin-top: .35rem; font-size: .92rem; color: var(--muted); }
.agenda-empty { margin-top: clamp(2rem, 4vw, 3rem); color: var(--muted); font-style: italic; }

@media (max-width: 640px) {
    .agenda-row { grid-template-columns: 1fr; gap: .5rem; padding: 1.2rem 0; }
}

/* ============================================================
   FACTS LIST — the Intersection section's definition rows
   ============================================================ */
.facts {
    border-top: 1px solid var(--line);
    margin-top: clamp(2.5rem, 5vw, 4rem);
}
.facts-row {
    display: grid;
    grid-template-columns: minmax(8rem, 14rem) 1fr;
    gap: clamp(1rem, 3vw, 3rem);
    align-items: baseline;
    padding: 1.15rem 0;
    border-bottom: 1px solid var(--line);
}
.facts dt {
    font-size: .72rem; letter-spacing: .16em; text-transform: uppercase;
    color: var(--bronze-text); font-weight: 500;
}
.facts dd { margin: 0; color: var(--ink); font-size: 1.02rem; line-height: 1.5; }
.facts--dark { border-color: var(--line-dark); }
.facts--dark .facts-row { border-color: var(--line-dark); }
.facts--dark dt { color: var(--bronze-on-dark); }
.facts--dark dd { color: var(--on-dark); }

/* Logo variant. The supplied files are dark lockups on an opaque white
   background, so they are re-rendered as white-on-transparent marks in
   img/loghi/mono (originals kept alongside). Heights are set per logo
   via --logo-h: a wide wordmark and a compact symbol need different
   heights to carry the same optical weight. */
.facts--logos { margin-top: 0; }
.facts--logos .facts-row {
    grid-template-columns: minmax(0, 14rem) 1fr;
    align-items: center;
    padding: 1.7rem 0;
}
.facts--logos dt {
    display: flex; flex-direction: column; align-items: flex-start;
    gap: .75rem;
}
.facts-logo {
    height: var(--logo-h, 2.6rem); width: auto; max-width: 100%;
    object-fit: contain; object-position: left center;
    opacity: .92;
}

@media (max-width: 640px) {
    .facts-row { grid-template-columns: 1fr; gap: .3rem; padding: 1rem 0; }
    /* Needs the .facts--logos prefix to outrank the two-column rule above:
       a media query adds no specificity of its own. */
    .facts--logos .facts-row {
        grid-template-columns: 1fr;
        align-items: start;
        gap: .7rem; padding: 1.5rem 0;
    }
}

/* ============================================================
   CONTACT BUTTON — a mailto: link styled as .btn; the footer copy
   sits under the role line, so it needs the gap
   ============================================================ */
.footer-mail { margin-top: 1.6rem; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
    background: var(--charcoal); color: var(--on-dark);
    padding-block: clamp(3.5rem, 6vw, 5.5rem);
}
.footer-inner {
    display: grid; grid-template-columns: 1fr auto; gap: 2rem;
    align-items: end;
}
.footer-name { font-family: var(--serif); font-size: 2rem; color: var(--ivory); }
.footer-role {
    margin-top: .6rem; font-size: .78rem; letter-spacing: .16em;
    text-transform: uppercase; color: var(--on-dark-soft);
}
.footer-right { display: flex; flex-direction: column; align-items: flex-end; gap: 1.2rem; }
.footer-right .socials a { color: var(--on-dark-soft); }
.footer-right .socials a:hover { color: var(--bronze); }
.footer-meta {
    margin-top: clamp(2.5rem, 5vw, 4rem);
    padding-top: 1.6rem; border-top: 1px solid var(--line-dark);
    display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
    font-size: .76rem; color: var(--on-dark-soft); letter-spacing: .04em;
}
.site-footer .lang button { color: var(--on-dark-soft); }
.site-footer .lang button[aria-pressed="true"] { color: var(--ivory); }
.site-footer .lang button:hover { color: var(--bronze-on-dark); }
.site-footer .lang .sep { color: var(--line-dark); }
.footer-credit a {
    color: var(--on-dark); text-decoration: none;
    border-bottom: 1px solid var(--line-dark); padding-bottom: 1px;
    transition: color .35s var(--ease), border-color .35s var(--ease);
}
.footer-credit a:hover { color: var(--bronze-on-dark); border-color: var(--bronze-on-dark); }

/* ============================================================
   SCROLL REVEAL
   ============================================================ */
[data-reveal] {
    opacity: 0; transform: translateY(24px);
    transition: opacity 1s var(--ease), transform 1s var(--ease);
    transition-delay: var(--reveal-delay, 0s);
}
[data-reveal].is-visible { opacity: 1; transform: none; }

/* ============================================================
   CUSTOM CURSOR — a quiet bronze ring that trails the pointer
   (native cursor kept; desktop pointers only)
   ============================================================ */
.cursor-ring {
    position: fixed; left: 0; top: 0; z-index: 9999;
    width: 22px; height: 22px;
    border: 1.5px solid var(--bronze); border-radius: 50%;
    pointer-events: none; opacity: 0;
    transform: translate(-100px, -100px) translate(-50%, -50%);
    transition: transform .12s ease-out, opacity .35s var(--ease),
                width .3s var(--ease), height .3s var(--ease), background-color .3s var(--ease);
    will-change: transform;
}
.cursor-ring.is-visible { opacity: .6; }
.cursor-ring.is-hover {
    width: 42px; height: 42px;
    background: rgba(169, 107, 68, 0.08);
    opacity: .85;
}
@media (hover: none), (pointer: coarse) { .cursor-ring { display: none !important; } }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1024px) {
    .hero {
        grid-template-columns: 1fr;
        gap: clamp(2rem, 5vw, 3rem);
        min-height: auto;
        padding-top: clamp(6rem, 13vh, 9rem);
    }
    /* On stacked layouts, lead with Giuseppe's portrait */
    .hero-media { order: -1; max-width: 30rem; justify-self: center; aspect-ratio: 4/5; }
}

@media (max-width: 860px) {
    .nav-links, .nav .nav-utility .socials { display: none; }
    .menu-toggle { display: block; }

    /* Solid header on mobile: the translucent blur reads muddy and drops
       contrast when dark sections scroll under it (and blur is janky on
       mobile Safari). Keep the glass effect for desktop only. */
    .site-header.scrolled {
        background: var(--ivory);
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    /* Full-screen mobile menu */
    .nav {
        position: fixed; inset: 0;
        background: var(--ivory);
        flex-direction: column; justify-content: center; align-items: center;
        gap: 0;
        opacity: 0; visibility: hidden;
        transform: translateY(-8px);
        transition: opacity .5s var(--ease), transform .5s var(--ease), visibility .5s;
        z-index: 200;
    }
    body.menu-open .nav { opacity: 1; visibility: visible; transform: none; }
    body.menu-open { overflow: hidden; }

    .nav-links {
        display: flex; flex-direction: column; align-items: center;
        gap: 0; margin-bottom: 3rem;
    }
    .nav-links a {
        font-family: var(--serif); font-size: 2.4rem; text-transform: none;
        letter-spacing: 0; color: var(--charcoal); padding: .55rem 0;
    }
    .nav-links a::after { display: none; }
    .nav-utility { flex-direction: column; gap: 2rem; }
    .nav .nav-utility .socials { display: inline-flex; }
    .lang { font-size: 1rem; }
    .lang button { font-size: 1rem; }

    .footer-inner { grid-template-columns: 1fr; }
    .footer-right { align-items: flex-start; }
}

@media (max-width: 520px) {
    .hero h1 { font-size: clamp(2.8rem, 15vw, 4.5rem); }
}

/* ============================================================
   ACCESSIBILITY: focus + reduced motion
   ============================================================ */
a:focus-visible, button:focus-visible {
    outline: 2px solid var(--bronze); outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
    [data-reveal] { opacity: 1; transform: none; }
    .media img { transition: none; }
    .hero-media img { transform: none !important; }
    .cursor-ring { display: none !important; }
}
