/* =========================================================
   GIULIANO INFANTINO — STYLESHEET (v3)
========================================================= */

:root {
    --bg:           #f3eee5;
    --bg-alt:       #ece6d9;
    --bg-deep:      #e3dccb;
    --text:         #1a1a1a;
    --text-soft:    #4a4540;
    --text-muted:   #8c8473;
    --accent:       #d94e2c;
    --accent-deep:  #b13c1f;
    --accent-soft:  rgba(217, 78, 44, 0.12);
    --rule:         #d4cab5;
    --rule-soft:    #e3dccb;

    --serif:        'Instrument Serif', 'Times New Roman', Georgia, serif;
    --sans:         'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --mono:         'JetBrains Mono', ui-monospace, monospace;

    --ease:         cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring:  cubic-bezier(0.34, 1.4, 0.64, 1);
}

:root[data-theme="dark"] {
    --bg:           #0c0a08;
    --bg-alt:       #16130f;
    --bg-deep:      #1f1b15;
    --text:         #f3eee5;
    --text-soft:    #c8c0b0;
    --text-muted:   #8c8473;
    --accent:       #ff6b3d;
    --accent-deep:  #ff8a5c;
    --accent-soft:  rgba(255, 107, 61, 0.16);
    --rule:         #28241d;
    --rule-soft:    #1c1914;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg:           #0c0a08;
        --bg-alt:       #16130f;
        --bg-deep:      #1f1b15;
        --text:         #f3eee5;
        --text-soft:    #c8c0b0;
        --text-muted:   #8c8473;
        --accent:       #ff6b3d;
        --accent-deep:  #ff8a5c;
        --accent-soft:  rgba(255, 107, 61, 0.16);
        --rule:         #28241d;
        --rule-soft:    #1c1914;
    }
}

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

html { scroll-behavior: smooth; }

body {
    font-family: var(--sans);
    font-size: 17px;
    line-height: 1.6;
    color: var(--text);
    background-color: var(--bg);
    font-feature-settings: "kern" 1, "liga" 1, "ss01" 1;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: background-color 600ms var(--ease), color 600ms var(--ease);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

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

a {
    color: var(--text);
    text-decoration: none;
    position: relative;
    transition: color 200ms var(--ease);
}
a.bare { color: inherit; }

em {
    font-family: var(--serif);
    font-style: italic;
    font-weight: 400;
    letter-spacing: -0.005em;
}

strong { font-weight: 600; }

/* =========================================================
   GRAIN OVERLAY (subtle texture)
========================================================= */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 200;
    opacity: 0.025;
    background-image:
        radial-gradient(circle at 20% 30%, var(--text) 0.5px, transparent 0.5px),
        radial-gradient(circle at 70% 60%, var(--text) 0.5px, transparent 0.5px),
        radial-gradient(circle at 40% 80%, var(--text) 0.5px, transparent 0.5px);
    background-size: 3px 3px, 5px 5px, 7px 7px;
    mix-blend-mode: multiply;
}
:root[data-theme="dark"] body::before { mix-blend-mode: screen; opacity: 0.03; }

/* =========================================================
   TOPBAR
========================================================= */
.topbar {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 26px 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.6rem;
    position: relative;
    z-index: 10;
}

.topbar .brand {
    font-family: var(--serif);
    font-size: 1.15rem;
    letter-spacing: -0.01em;
    color: var(--text);
    transition: color 200ms var(--ease);
    white-space: nowrap;
    font-style: italic;
}
.topbar .brand:hover { color: var(--accent); }

.topbar nav {
    display: flex;
    gap: 1.8rem;
    margin-left: auto;
}
.topbar nav a {
    font-family: var(--sans);
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--text-muted);
    transition: color 200ms var(--ease);
    white-space: nowrap;
    letter-spacing: -0.005em;
}
.topbar nav a:hover { color: var(--text); }
.topbar nav a.current {
    color: var(--text);
    font-weight: 500;
}
.topbar nav a.current::before {
    content: '';
    display: inline-block;
    width: 5px; height: 5px;
    border-radius: 50%;
    background: var(--accent);
    margin-right: 0.5rem;
    vertical-align: 0.18em;
}

.theme-toggle {
    background: transparent;
    border: 1px solid var(--rule);
    border-radius: 999px;
    padding: 6px 12px 6px 26px;
    font-family: var(--sans);
    font-size: 0.74rem;
    font-weight: 400;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 250ms var(--ease);
    position: relative;
}
.theme-toggle::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 0 var(--accent-soft);
    transition: box-shadow 400ms var(--ease);
}
.theme-toggle:hover {
    color: var(--text);
    border-color: var(--accent);
}
.theme-toggle:hover::before { box-shadow: 0 0 0 5px var(--accent-soft); }

/* =========================================================
   PAGE / MAIN
========================================================= */
main {
    flex: 1;
    width: 100%;
    max-width: 980px;
    margin: 0 auto;
    padding: 30px 40px 100px;
}

/* =========================================================
   HOME — HERO
========================================================= */
.home-hero {
    display: grid;
    grid-template-columns: 1.15fr 1fr;
    gap: 3rem;
    align-items: center;
    margin: 1.5rem 0 6rem;
    min-height: 60vh;
}

.hero-text { position: relative; }

.hero-status {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-family: var(--sans);
    font-size: 0.78rem;
    color: var(--text-muted);
    margin-bottom: 1.6rem;
    padding: 5px 12px 5px 10px;
    border: 1px solid var(--rule);
    border-radius: 999px;
    background: var(--bg-alt);
}
.hero-status .dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--accent);
    position: relative;
    flex-shrink: 0;
}
.hero-status .dot::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: 50%;
    background: var(--accent);
    opacity: 0.4;
    animation: pulse 2.6s ease-out infinite;
}
@keyframes pulse {
    0%   { transform: scale(0.8); opacity: 0.5; }
    100% { transform: scale(2.4); opacity: 0; }
}

.display-name {
    font-family: var(--serif);
    font-weight: 400;
    font-size: clamp(3.6rem, 10vw, 6.4rem);
    line-height: 0.92;
    letter-spacing: -0.025em;
    margin-bottom: 1.2rem;
    color: var(--text);
}
.display-name .word {
    display: inline-block;
    overflow: hidden;
    vertical-align: bottom;
}
.display-name .word > span {
    display: inline-block;
    transform: translateY(110%);
    animation: word-rise 1s var(--ease) forwards;
}
.display-name .word.italic > span {
    font-style: italic;
    letter-spacing: -0.035em;
}
.display-name .word:nth-of-type(1) > span { animation-delay: 0.15s; }
.display-name .word:nth-of-type(2) > span { animation-delay: 0.32s; }

@keyframes word-rise {
    to { transform: translateY(0); }
}

.role {
    font-family: var(--sans);
    font-size: clamp(1.05rem, 1.6vw, 1.25rem);
    font-weight: 400;
    color: var(--text-soft);
    line-height: 1.45;
    max-width: 36ch;
    opacity: 0;
    animation: fade-up 800ms var(--ease) 0.7s forwards;
}
.role em {
    color: var(--text);
    font-size: 1.05em;
}

@keyframes fade-up {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Photo + animated halo */
.hero-photo {
    position: relative;
    aspect-ratio: 4 / 5;
    perspective: 1000px;
    opacity: 0;
    animation: fade-up 1000ms var(--ease) 0.4s forwards;
}
.photo-frame {
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    border-radius: 6px;
    z-index: 2;
    transition: transform 500ms var(--ease);
    transform-style: preserve-3d;
    box-shadow:
        0 1px 2px rgba(0,0,0,0.04),
        0 16px 60px -20px rgba(0,0,0,0.18);
}
.photo-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: saturate(0.92) contrast(1.02);
    transition: transform 1.2s var(--ease), filter 600ms var(--ease);
}
:root[data-theme="dark"] .photo-frame img {
    filter: saturate(0.85) brightness(0.92) contrast(1.05);
}
.photo-frame:hover img {
    transform: scale(1.04);
    filter: saturate(1) contrast(1.05);
}
:root[data-theme="dark"] .photo-frame:hover img {
    filter: saturate(0.95) brightness(1) contrast(1.08);
}

/* Animated gradient blob behind photo */
.hero-photo::before {
    content: '';
    position: absolute;
    inset: -8% -8% -8% -8%;
    background:
        radial-gradient(60% 60% at 30% 25%, var(--accent) 0%, transparent 60%),
        radial-gradient(50% 50% at 75% 75%, var(--accent-deep) 0%, transparent 55%);
    filter: blur(40px);
    opacity: 0.55;
    z-index: 1;
    animation: morph 14s ease-in-out infinite;
    border-radius: 50%;
}
:root[data-theme="dark"] .hero-photo::before { opacity: 0.45; }

@keyframes morph {
    0%, 100% { transform: translate(0, 0) scale(1) rotate(0deg); }
    33%      { transform: translate(2%, -3%) scale(1.06) rotate(8deg); }
    66%      { transform: translate(-2%, 3%) scale(0.96) rotate(-6deg); }
}

@media (max-width: 840px) {
    .home-hero {
        grid-template-columns: 1fr;
        gap: 2.4rem;
        margin: 0.5rem 0 4rem;
    }
    .hero-photo {
        max-width: 320px;
        order: -1;
    }
}

/* =========================================================
   HOME — ABOUT / NOW
========================================================= */
.home-block {
    display: grid;
    grid-template-columns: 100px 1fr;
    gap: 2rem;
    padding: 2.4rem 0;
    border-top: 1px solid var(--rule);
}
.home-block .block-label {
    font-family: var(--sans);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-muted);
    padding-top: 0.45rem;
}
.home-block .block-body {
    font-family: var(--sans);
    font-size: 1.08rem;
    line-height: 1.55;
    color: var(--text-soft);
    max-width: 56ch;
}
.home-block .block-body strong { color: var(--text); font-weight: 500; }
.home-block .block-body p + p { margin-top: 0.9rem; }
.home-block .block-body em { color: var(--text); }

@media (max-width: 640px) {
    .home-block {
        grid-template-columns: 1fr;
        gap: 0.6rem;
        padding: 2rem 0;
    }
    .home-block .block-label { padding-top: 0; font-size: 0.66rem; }
    .home-block .block-body { font-size: 1rem; }
}

/* =========================================================
   HOME — BIG NAV LIST
========================================================= */
.big-nav {
    margin: 1rem 0 4rem;
    border-top: 1px solid var(--rule);
}
.big-nav a.row {
    display: grid;
    grid-template-columns: 60px 1fr auto 50px;
    gap: 2rem;
    align-items: center;
    padding: 1.6rem 0;
    border-bottom: 1px solid var(--rule);
    color: var(--text);
    transition: padding 400ms var(--ease), background 350ms var(--ease);
    position: relative;
    overflow: hidden;
}
.big-nav a.row::before {
    content: '';
    position: absolute;
    left: 0; right: 0; top: 0; bottom: 0;
    background: linear-gradient(90deg, var(--accent-soft), transparent 50%);
    opacity: 0;
    transition: opacity 350ms var(--ease);
    pointer-events: none;
}
.big-nav a.row:hover { padding-left: 16px; padding-right: 16px; }
.big-nav a.row:hover::before { opacity: 1; }
.big-nav .num {
    font-family: var(--mono);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 400;
    position: relative;
    z-index: 1;
}
.big-nav .title {
    font-family: var(--serif);
    font-size: clamp(1.8rem, 3.5vw, 2.4rem);
    font-style: italic;
    line-height: 1;
    letter-spacing: -0.015em;
    color: var(--text);
    position: relative;
    z-index: 1;
}
.big-nav .desc {
    font-family: var(--sans);
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.4;
    max-width: 30ch;
    text-align: right;
    position: relative;
    z-index: 1;
}
.big-nav .arrow {
    font-family: var(--serif);
    color: var(--text-muted);
    font-size: 1.4rem;
    line-height: 1;
    transition: transform 400ms var(--ease), color 250ms var(--ease);
    text-align: right;
    position: relative;
    z-index: 1;
}
.big-nav a.row:hover .arrow {
    color: var(--accent);
    transform: translateX(10px);
}

@media (max-width: 720px) {
    .big-nav a.row {
        grid-template-columns: 36px 1fr 28px;
        gap: 1rem;
        padding: 1.3rem 0;
    }
    .big-nav .desc { display: none; }
    .big-nav .title { font-size: 1.6rem; }
    .big-nav a.row:hover { padding-left: 8px; padding-right: 8px; }
}

/* =========================================================
   HOME — CONTACT
========================================================= */
.home-contact {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem 1.4rem;
    padding-top: 2rem;
    border-top: 1px solid var(--rule);
    font-family: var(--sans);
    font-size: 0.92rem;
    color: var(--text-muted);
}
.home-contact .email {
    color: var(--text);
    font-weight: 500;
}
.home-contact .links {
    margin-left: auto;
    display: flex;
    gap: 1.2rem;
}
.home-contact a { color: var(--text-muted); transition: color 200ms var(--ease); }
.home-contact a:hover { color: var(--accent); }

@media (max-width: 640px) {
    .home-contact .links { margin-left: 0; flex-wrap: wrap; }
    .home-contact .email { width: 100%; }
}

/* =========================================================
   SUBPAGE — HERO
========================================================= */
.hero {
    margin: 1rem 0 3rem;
    padding-bottom: 1rem;
}
.hero .eyebrow {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 0.9rem;
}
.hero h1 {
    font-family: var(--serif);
    font-size: clamp(2.6rem, 6vw, 4rem);
    font-weight: 400;
    font-style: italic;
    letter-spacing: -0.025em;
    line-height: 1;
    margin-bottom: 0.8rem;
}
.hero .lede {
    font-family: var(--sans);
    font-size: 1.05rem;
    color: var(--text-soft);
    max-width: 56ch;
    line-height: 1.5;
}

/* =========================================================
   SECTION TITLES
========================================================= */
.section-title {
    font-family: var(--sans);
    font-size: 0.74rem;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
    margin: 3rem 0 1.4rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.hero + .section-title,
.section-title:first-of-type { margin-top: 0.5rem; }
.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--rule);
}

/* =========================================================
   PROSE
========================================================= */
.prose p {
    margin-bottom: 1rem;
    max-width: 62ch;
    color: var(--text-soft);
    font-family: var(--sans);
    font-size: 1rem;
}
.prose p strong { color: var(--text); font-weight: 500; }
.prose p em { color: var(--text); }

.diss-title {
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.5rem;
    font-weight: 400;
    color: var(--text);
    line-height: 1.25;
    margin-bottom: 0.7rem;
    max-width: 62ch;
    letter-spacing: -0.015em;
}
.diss-meta {
    font-family: var(--mono);
    font-size: 0.74rem;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 1.4rem;
}

/* =========================================================
   CHAPTERS
========================================================= */
.chapters { margin-top: 0.5rem; }
.chapter {
    display: grid;
    grid-template-columns: 3rem 1fr;
    gap: 1.2rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--rule-soft);
    transition: padding-left 350ms var(--ease);
    position: relative;
}
.chapter::before {
    content: '';
    position: absolute;
    left: -8px; top: 50%;
    transform: translateY(-50%) scaleX(0);
    transform-origin: left;
    width: 4px; height: 30%;
    background: var(--accent);
    transition: transform 350ms var(--ease);
}
.chapter:hover { padding-left: 8px; }
.chapter:hover::before { transform: translateY(-50%) scaleX(1); }
.chapter:last-child { border-bottom: none; }
.chapter .ch-num {
    font-family: var(--mono);
    font-size: 0.78rem;
    color: var(--accent);
    letter-spacing: 0.04em;
    padding-top: 0.25rem;
}
.chapter .ch-title {
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.15rem;
    color: var(--text);
    line-height: 1.35;
    margin-bottom: 0.15rem;
    letter-spacing: -0.01em;
}
.chapter .ch-gloss {
    font-family: var(--sans);
    font-size: 0.82rem;
    color: var(--text-muted);
}
@media (max-width: 560px) {
    .chapter { grid-template-columns: 1fr; gap: 0.3rem; }
}

/* =========================================================
   ITEMS
========================================================= */
.items { margin: 0 0 0.5rem; }
.item {
    display: grid;
    grid-template-columns: 5.5rem 1fr;
    gap: 1rem;
    padding: 0.95rem 0;
    border-bottom: 1px solid var(--rule-soft);
    font-family: var(--sans);
    font-size: 0.96rem;
    line-height: 1.5;
    transition: padding-left 300ms var(--ease);
    border-radius: 2px;
}
.item:hover { padding-left: 8px; }
.item:last-child { border-bottom: none; }
.item .meta {
    font-family: var(--mono);
    font-size: 0.74rem;
    color: var(--text-muted);
    padding-top: 0.18rem;
}
.item .body { color: var(--text-soft); }
.item .body em {
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.05em;
    color: var(--text);
}
.item .venue {
    display: block;
    color: var(--text-muted);
    font-size: 0.86rem;
    margin-top: 0.18rem;
}
.item .venue em {
    font-family: var(--serif);
    font-style: italic;
    color: var(--text-muted);
}
.item .venue a { color: var(--text-muted); border-bottom: 1px solid transparent; transition: border-color 200ms var(--ease), color 200ms var(--ease); }
.item .venue a:hover { color: var(--accent); border-bottom-color: var(--accent); }
.item .mark {
    color: var(--accent);
    font-family: var(--mono);
    font-size: 0.72rem;
    padding-left: 0.3rem;
}

@media (max-width: 560px) {
    .item { grid-template-columns: 1fr; gap: 0.2rem; }
    .item:hover { padding-left: 0; }
}

/* =========================================================
   CV DOWNLOAD
========================================================= */
.cv-download {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.1rem;
    border: 1px solid var(--text);
    border-radius: 999px;
    font-family: var(--sans);
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text);
    transition: all 300ms var(--ease);
    margin-top: 1rem;
    background: transparent;
}
.cv-download:hover {
    background: var(--accent);
    color: var(--bg);
    border-color: var(--accent);
    transform: translateY(-1px);
}

/* =========================================================
   LEGEND
========================================================= */
.legend {
    font-family: var(--sans);
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-top: 2.5rem;
}
.legend a { color: var(--text-muted); border-bottom: 1px solid var(--rule); transition: color 200ms var(--ease), border-color 200ms var(--ease); }
.legend a:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* =========================================================
   FOOTER
========================================================= */
footer {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 24px 40px 28px;
    border-top: 1px solid var(--rule);
    font-family: var(--sans);
    font-size: 0.78rem;
    color: var(--text-muted);
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
}
footer em {
    font-family: var(--serif);
    color: var(--text-muted);
}

/* =========================================================
   ANIMATION HELPERS
========================================================= */
@keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
.reveal {
    opacity: 0;
    animation: rise 800ms var(--ease) forwards;
}
.reveal-1 { animation-delay: 60ms; }
.reveal-2 { animation-delay: 140ms; }
.reveal-3 { animation-delay: 220ms; }
.reveal-4 { animation-delay: 300ms; }
.reveal-5 { animation-delay: 380ms; }
.reveal-6 { animation-delay: 460ms; }

.stagger > * {
    opacity: 0;
    animation: rise 700ms var(--ease) forwards;
}
.stagger > *:nth-child(1) { animation-delay: 80ms; }
.stagger > *:nth-child(2) { animation-delay: 130ms; }
.stagger > *:nth-child(3) { animation-delay: 180ms; }
.stagger > *:nth-child(4) { animation-delay: 230ms; }
.stagger > *:nth-child(5) { animation-delay: 280ms; }
.stagger > *:nth-child(6) { animation-delay: 330ms; }
.stagger > *:nth-child(7) { animation-delay: 380ms; }
.stagger > *:nth-child(8) { animation-delay: 430ms; }
.stagger > *:nth-child(9) { animation-delay: 480ms; }
.stagger > *:nth-child(n+10) { animation-delay: 520ms; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-delay: 0ms !important;
        transition-duration: 0.001ms !important;
    }
    html { scroll-behavior: auto; }
    .reveal, .stagger > *, .role, .hero-photo { opacity: 1; transform: none; }
    .display-name .word > span { transform: translateY(0); }
}

/* =========================================================
   RESPONSIVE
========================================================= */
@media (max-width: 720px) {
    .topbar {
        padding: 20px 24px;
        flex-wrap: wrap;
        gap: 0.8rem;
    }
    .topbar nav {
        order: 3;
        width: 100%;
        margin-left: 0;
        gap: 1.2rem;
        flex-wrap: wrap;
    }
    main { padding: 20px 24px 80px; }
    footer { padding: 22px 24px; }
}

@media (max-width: 480px) {
    .topbar nav { gap: 0.9rem; }
    .topbar nav a { font-size: 0.78rem; }
    .topbar .brand { font-size: 1rem; }
    .theme-toggle { font-size: 0.72rem; }
}
