:root {
  color-scheme: light dark;
  --blue: #164A78;
  --blue-soft: #e8eff6;
  --ink: #1b2430;
  --muted: #5b6676;
  --line: #e2e6ec;
  --bg: #ffffff;
  --bg-alt: #f6f8fa;
  --card: #ffffff;
  --accent: #b5532b;
  --serif: "Source Serif 4", Georgia, serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --blue: #8db8e3;
    --blue-soft: #1c2a3a;
    --ink: #e6e9ee;
    --muted: #9aa5b4;
    --line: #2a3340;
    --bg: #11161d;
    --bg-alt: #161c24;
    --card: #19202a;
    --accent: #e39a72;
  }
}

* { box-sizing: border-box; }
html { scroll-padding-top: 72px; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0; }
h2 { font-size: 2rem; color: var(--blue); }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 24px; }
@media (max-width: 600px) { .wrap { padding: 0 16px; } }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 16px; }
.brand { font-family: var(--serif); font-weight: 600; font-size: 1.15rem; color: var(--ink); text-decoration: none; white-space: nowrap; }
.nav { display: flex; gap: 22px; overflow-x: auto; scrollbar-width: none; }
.nav a { color: var(--muted); text-decoration: none; font-size: .93rem; font-weight: 500; white-space: nowrap; }
.nav a:hover { color: var(--blue); }
.nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--blue); }
.nav .nav-cv { color: var(--blue); border: 1px solid var(--blue); border-radius: 999px; padding: 1px 12px; }
.nav-home { display: none; }
.menu-btn { display: none; }
@media (max-width: 760px) {
  .menu-btn {
    display: flex; flex-direction: column; justify-content: center; gap: 5px;
    width: 42px; height: 42px; margin-right: -8px; padding: 0 9px;
    background: none; border: 0; cursor: pointer; border-radius: 8px;
  }
  .menu-btn span { display: block; height: 2px; background: var(--ink); border-radius: 2px; transition: transform .2s, opacity .2s; }
  .menu-open .menu-btn span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .menu-open .menu-btn span:nth-child(2) { opacity: 0; }
  .menu-open .menu-btn span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .nav {
    display: none; position: absolute; top: 100%; right: 16px; min-width: 210px;
    flex-direction: column; gap: 0; padding: 8px;
    background: var(--card); border: 1px solid var(--line); border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0,0,0,.14);
  }
  .menu-open .nav { display: flex; }
  .nav a { padding: 10px 12px; border-radius: 8px; font-size: 1rem; }
  .nav a:hover { background: var(--bg-alt); }
  .nav a[aria-current="page"] { box-shadow: none; background: var(--blue-soft); color: var(--blue); }
  .nav-home { display: block; }
  .nav .nav-cv { margin-top: 6px; text-align: center; padding: 8px 12px; }
}

/* ---------- Hero ---------- */
.hero { display: grid; grid-template-columns: 1fr 280px; gap: 56px; align-items: center; padding-top: 72px; padding-bottom: 48px; }
.eyebrow { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 0 0 12px; }
.hero h1 { font-size: clamp(2.6rem, 6vw, 3.8rem); color: var(--ink); letter-spacing: -.01em; }
.lede { font-family: var(--serif); font-size: 1.22rem; line-height: 1.6; margin: 20px 0 28px; max-width: 38em; }
.lede strong { font-weight: 600; }
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 26px; }
.btn {
  display: inline-block; padding: 10px 18px; border-radius: 8px; font: 500 .95rem var(--sans);
  text-decoration: none; border: 1px solid var(--line); color: var(--ink); background: var(--card); cursor: pointer;
}
.btn:hover { border-color: var(--blue); color: var(--blue); }
.btn-primary { background: var(--blue); border-color: var(--blue); color: var(--bg); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-ghost { margin-top: 12px; }
.profiles { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: .9rem; }
.profiles a { color: var(--muted); }
.profiles a:hover { color: var(--blue); }

.portrait { margin: 0; position: relative; aspect-ratio: 660/601; border-radius: 14px; overflow: hidden; background: var(--blue-soft); }
.portrait img { width: 100%; height: 100%; object-fit: cover; display: block; position: relative; z-index: 1; }
.portrait .initials {
  position: absolute; inset: 0; display: grid; place-items: center;
  font: 600 4.5rem var(--serif); color: var(--blue); opacity: .55;
}
@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; gap: 28px; padding-top: 36px; }
  .portrait { order: -1; width: 140px; border-radius: 50%; aspect-ratio: 1; }
  .portrait .initials { font-size: 2.6rem; }
  .lede { font-size: 1.1rem; }
}

/* ---------- News ---------- */
.news { padding-bottom: 56px; }
.small-h { font: 600 .8rem var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.news-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--line); }
.news-list li { display: grid; grid-template-columns: 90px 1fr; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: .95rem; }
.news-list time, .plain-list time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .88rem; }

/* ---------- Sections ---------- */
.section { padding: 72px 0; }
.section-alt { background: var(--bg-alt); }
.section-intro { font-family: var(--serif); font-size: 1.15rem; max-width: 42em; margin: 14px 0 32px; }
.section-head { display: flex; justify-content: space-between; align-items: end; flex-wrap: wrap; gap: 16px; margin-bottom: 24px; }
.sub-h { font-size: 1.25rem; margin: 40px 0 12px; }
.sub-h.first { margin-top: 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; margin-top: 24px; }
@media (max-width: 760px) { .two-col { grid-template-columns: 1fr; gap: 32px; } .section { padding: 52px 0; } h2 { font-size: 1.7rem; } }

.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
@media (max-width: 760px) { .cards { grid-template-columns: 1fr; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 22px 24px; }
.card h3 { font-size: 1.2rem; margin-bottom: 8px; }
.card p { margin: 0 0 10px; }
.card-meta { font-size: .85rem; color: var(--muted); }
.card-muted { background: transparent; border-style: dashed; }

.facts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin: 40px 0 0; padding: 24px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.facts div { display: flex; flex-direction: column; }
.fact-n { font: 600 2.2rem var(--serif); color: var(--blue); line-height: 1.1; }
.fact-l { font-size: .88rem; color: var(--muted); }
@media (max-width: 600px) { .facts { grid-template-columns: repeat(2, 1fr); } }

.plain-list { padding-left: 1.1em; margin: 0; }
.plain-list li { margin-bottom: 8px; }
.stays { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.stays li { font-size: .9rem; color: var(--muted); border-left: 2px solid var(--blue); padding-left: 12px; }
.stays span { display: block; color: var(--ink); font-weight: 600; }

/* ---------- Publications ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filters button {
  font: 500 .88rem var(--sans); padding: 6px 14px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
}
.filters button[aria-selected="true"] { background: var(--blue); border-color: var(--blue); color: var(--bg); }
.pubs { padding-left: 2.6em; margin: 0; }
.pubs li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.pubs li::marker { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.pub-title { font-family: var(--serif); font-size: 1.08rem; font-weight: 600; color: var(--ink); text-decoration: none; }
.pub-title:hover { color: var(--blue); text-decoration: underline; }
.pub-authors { font-size: .92rem; color: var(--muted); margin-top: 2px; }
.pub-authors strong { color: var(--ink); font-weight: 600; }
.pub-venue { font-size: .92rem; }
.pub-link { font-size: .82rem; margin-left: 6px; overflow-wrap: anywhere; }

.tag { display: inline-block; font: 600 .68rem var(--sans); letter-spacing: .04em; text-transform: uppercase; padding: 2px 8px; border-radius: 4px; vertical-align: 1px; white-space: nowrap; }
.tag-preprint { background: #fff1e8; color: #a14a20; }
.tag-conference { background: var(--blue-soft); color: var(--blue); }
.tag-invited { background: var(--blue); color: var(--bg); }
.tag-seminar { background: var(--blue-soft); color: var(--blue); }
.tag-contributed { background: transparent; color: var(--muted); border: 1px solid var(--line); }
@media (prefers-color-scheme: dark) { .tag-preprint { background: #3a2518; color: #f0b08c; } }
.legend { display: flex; gap: 8px; margin: 0; }

/* ---------- Talks ---------- */
.talk-year { display: grid; grid-template-columns: 80px 1fr; gap: 16px; border-top: 1px solid var(--line); padding: 16px 0; }
.talk-year h3 { font-size: 1.3rem; color: var(--blue); }
.talks { list-style: none; padding: 0; margin: 0; }
.talks li { display: grid; grid-template-columns: 64px 1fr auto; gap: 14px; align-items: baseline; padding: 6px 0; }
.talks time { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.talk-title { display: block; }
.talk-where { display: block; color: var(--muted); font-size: .88rem; }
@media (max-width: 600px) {
  .talk-year { grid-template-columns: 1fr; gap: 6px; }
  .talks li { grid-template-columns: 1fr; gap: 0; padding: 8px 0; }
  .talks .tag { justify-self: start; margin-top: 4px; }
}

/* ---------- Teaching ---------- */
.courses { list-style: none; padding: 0; margin: 0; }
.courses li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.courses strong { display: block; font-weight: 600; }
.courses span { font-size: .88rem; color: var(--muted); }
.note { font-size: .92rem; color: var(--muted); }

/* ---------- Beyond ---------- */
.videos { display: grid; gap: 14px; }
.video { display: grid; grid-template-columns: 150px 1fr; gap: 14px; align-items: center; text-decoration: none; color: var(--ink); }
.video img { width: 100%; aspect-ratio: 16/9; object-fit: cover; border-radius: 8px; background: var(--blue-soft); }
.video span { font-weight: 500; }
.video:hover span { color: var(--blue); }

/* ---------- Pages ---------- */
.page { padding-top: 56px; }
.page-title { font-size: clamp(2.2rem, 5vw, 3rem); color: var(--ink); }
.section-head .page-title { margin: 0; }
.page > .wrap > .page-title { margin-bottom: 8px; }
.page .two-col { margin-top: 32px; }
.more-link { font-weight: 500; text-decoration: none; }
.more-link:hover { text-decoration: underline; }
.pubs-plain { list-style: none; padding-left: 0; }
.talks-recent li { grid-template-columns: 110px 1fr auto; border-bottom: 1px solid var(--line); padding: 12px 0; }
@media (max-width: 600px) { .talks-recent li { grid-template-columns: 1fr; } }

/* ---------- Contact & footer ---------- */
.contact h2 { margin-bottom: 8px; }
.contact p { font-size: 1.2rem; margin: 0; }
.contact address { font-style: normal; color: var(--muted); }
.footer { padding: 36px 0; font-size: .88rem; color: var(--muted); border-top: 1px solid var(--line); background: var(--bg-alt); margin-top: 24px; }
.footer-inner { display: grid; grid-template-columns: 1fr 1.4fr auto; gap: 24px; align-items: start; }
.footer strong { color: var(--ink); }
.footer address { font-style: normal; }
@media (max-width: 760px) { .footer-inner { grid-template-columns: 1fr; gap: 14px; } }

/* ---------- Teaching history ---------- */
.facts-top { margin: 0 0 48px; }
.teach-head { margin: 0 0 4px; }
.teach-head .sub-h { margin: 0; }
.mini-h { font: 600 .8rem var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 6px; }
.mini-h + .courses { margin-bottom: 24px; }
.two-col-tight { margin-top: 12px; }
.key { font-size: .82rem; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; margin-left: 10px; }
.key::before { content: ""; width: 10px; height: 10px; border-radius: 2px; background: var(--c); }
.key-course, .seg-course, .dot-course { --c: var(--blue); }
.key-phd, .seg-phd, .dot-phd { --c: var(--accent); }
.key-exercises, .seg-exercises, .dot-exercises { --c: #7fa3c7; }
.key-other, .seg-other, .dot-other { --c: #b8c3cf; }
@media (prefers-color-scheme: dark) {
  .key-exercises, .seg-exercises, .dot-exercises { --c: #4f7396; }
  .key-other, .seg-other, .dot-other { --c: #5a6573; }
}
.teach-years { border-top: 1px solid var(--line); margin: 8px 0 16px; }
.teach-year { border-bottom: 1px solid var(--line); }
.teach-year summary {
  display: grid; grid-template-columns: 130px 1fr 56px; gap: 16px; align-items: center;
  padding: 11px 0; cursor: pointer; list-style: none;
}
.teach-year summary::-webkit-details-marker { display: none; }
.teach-year summary:hover .ty-label { color: var(--blue); }
.ty-label { font-weight: 600; font-variant-numeric: tabular-nums; }
.ty-label::before { content: "▸"; display: inline-block; width: 1.1em; color: var(--muted); transition: transform .15s; }
.teach-year[open] .ty-label::before { transform: rotate(90deg); }
.ty-label em { font-style: normal; font-size: .7rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); margin-left: 4px; }
.ty-bar { display: flex; height: 14px; border-radius: 3px; overflow: hidden; }
.seg { background: var(--c); height: 100%; }
.seg + .seg { border-left: 2px solid var(--bg); }
.ty-total { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); font-size: .9rem; }
.ty-items { list-style: none; margin: 0 0 12px; padding: 0 0 0 calc(130px + 16px); }
.ty-items li { display: grid; grid-template-columns: 12px 1fr auto; gap: 12px; align-items: baseline; padding: 6px 0; }
.ty-items strong { display: block; font-weight: 600; }
.ty-items span { font-size: .88rem; color: var(--muted); }
.ty-items .hrs { font-variant-numeric: tabular-nums; }
.dot { width: 10px; height: 10px; border-radius: 2px; background: var(--c); }
@media (max-width: 600px) {
  .teach-year summary { grid-template-columns: 96px 1fr 48px; gap: 10px; }
  .ty-items { padding-left: 0; }
  .key { margin: 0 10px 0 0; }
  .legend { flex-wrap: wrap; }
}
.theses summary { cursor: pointer; font-weight: 600; padding: 10px 0; border-bottom: 1px solid var(--line); }
.summary-hint { font-weight: 400; color: var(--muted); font-size: .9rem; }
.theses[open] .summary-hint { display: none; }
.page-title + .facts-top { margin: 24px 0 36px; }

/* ---------- Big section headings inside a page ---------- */
.big-h { font-size: 2rem; margin: 72px 0 20px; padding-top: 40px; border-top: 1px solid var(--line); }
.org-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 900px) { .org-cards { grid-template-columns: 1fr; } }
.org { display: flex; flex-direction: column; }
.org h3 { font-size: 1.1rem; margin: 6px 0 8px; }
.org p { font-size: .92rem; color: var(--muted); flex: 1; }
.org a { font-weight: 500; text-decoration: none; font-size: .92rem; }
.org-year { font: 600 .8rem var(--sans); color: var(--accent); letter-spacing: .04em; }

/* ---------- Publication groups ---------- */
.pub-groups { border-top: 1px solid var(--line); }
.pub-group { border-bottom: 1px solid var(--line); }
.pub-group > summary {
  display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 4px 16px;
  padding: 20px 0; cursor: pointer; list-style: none;
}
.pub-group > summary::-webkit-details-marker { display: none; }
.pg-title { font: 600 1.5rem var(--serif); color: var(--blue); }
.pg-title::before { content: "▸"; display: inline-block; width: 1.1em; font-size: .8em; color: var(--muted); transition: transform .15s; }
.pub-group[open] .pg-title::before { transform: rotate(90deg); }
.pub-group > summary:hover .pg-title { color: var(--accent); }
.pg-count { color: var(--muted); font-size: .92rem; }
.pub-group > .pubs { margin-bottom: 20px; }

/* Abstracts and arXiv links */
.pub-arxiv { white-space: nowrap; }
.pub-abs { margin-top: 4px; }
.pub-abs > summary { display: inline-block; cursor: pointer; list-style: none; font: 500 .8rem var(--sans); color: var(--muted); padding: 2px 0; }
.pub-abs > summary::-webkit-details-marker { display: none; }
.pub-abs > summary::before { content: "▸"; display: inline-block; width: 1em; transition: transform .15s; }
.pub-abs[open] > summary::before { transform: rotate(90deg); }
.pub-abs > summary:hover { color: var(--blue); }
.pub-abs p { margin: 6px 0 4px; padding: 10px 14px; border-left: 3px solid var(--line); font-size: .9rem; line-height: 1.55; color: var(--ink, inherit); max-width: 70ch; }

/* Keyboard focus */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

/* Footer always at the bottom, even on short pages */
body { display: flex; flex-direction: column; min-height: 100vh; }
body > main { flex: 1; }

/* ---------- Email (no mailto) ---------- */
.email-box { display: inline-flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.email-box .email { font-weight: 500; font-size: 1.02rem; }
.email { user-select: all; }

/* ---------- Profile tiles (Research) ---------- */
.profile-tiles { list-style: none; padding: 0; margin: 0 0 40px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 760px) { .profile-tiles { grid-template-columns: repeat(2, 1fr); } }
.profile-tiles a {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; height: 100%;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card);
  color: var(--ink); text-decoration: none; font-weight: 500; font-size: .95rem;
}
.profile-tiles a:hover { border-color: var(--brand, var(--blue)); color: var(--blue); }
.profile-tiles li { display: block; }
.pt-logo { flex: none; width: 32px; height: 32px; display: grid; place-items: center; font-size: 28px; color: var(--brand); }
.pt-badge { border-radius: 6px; background: var(--brand); color: #fff; font: 700 .8rem var(--sans); letter-spacing: .02em; }
.pt-badge-sm { font-size: .5rem; letter-spacing: 0; }
@media (prefers-color-scheme: dark) { .pt-logo:not(.pt-badge) { filter: brightness(1.25); } }

[hidden] { display: none !important; }

.pt-img { object-fit: contain; }
.home-profiles { padding-bottom: 48px; }
.profile-tiles-home { margin: 0; }
.email-label { font: 600 .72rem var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.actions { align-items: center; }
.email-box { margin-right: 10px; }

/* ---------- Career timeline ---------- */
.portrait img { object-position: 45% 30%; }
.home-timeline { padding-bottom: 48px; }
.timeline-scroll { overflow-x: auto; border-top: 1px solid var(--line); padding-top: 8px; }
#timeline svg { display: block; width: 100%; min-width: 680px; height: auto; font-family: var(--sans); }
.tl-bar { stroke: var(--blue); stroke-width: 9; }
.tl-axis { stroke: var(--muted); stroke-width: 1; }
.tl-stem { stroke: var(--line); stroke-width: 1; }
.tl-dot { fill: var(--blue); opacity: .75; }
.tl-tick { font-size: 12px; fill: var(--muted); }
.tl-pos { font-size: 13px; fill: var(--muted); }
.tl-visit, .tl-note { font-size: 12px; font-style: italic; fill: var(--muted); }
.tl-phase { font-size: 12px; font-style: italic; fill: var(--muted); }
.tl-brace { fill: none; stroke: var(--muted); stroke-width: 1; }
.tl-brace-strong { stroke: var(--blue); }
.tl-strong { fill: var(--blue); font-weight: 600; }

/* ============================================================
   TEMA "DEEP": barra, fascia della home e piè di pagina in blu pieno.
   Per tornare al tema chiaro basta togliere class="deep" da <html>.
   ============================================================ */
:root { --deep: #123e66; --deep-2: #0c2d4c; --on-deep: #ffffff; --on-deep-muted: rgba(255,255,255,.74); --deep-accent: #9cc6ec; --tint: #eef3f9; }
@media (prefers-color-scheme: dark) {
  :root { --deep: #0f2236; --deep-2: #0a1828; --tint: #151d27; }
}

/* top bar */
.deep .topbar { background: var(--deep); border-bottom-color: transparent; backdrop-filter: none; }
.deep .brand { color: var(--on-deep); }
.deep .nav a { color: var(--on-deep-muted); }
.deep .nav a:hover { color: var(--on-deep); }
.deep .nav a[aria-current="page"] { color: var(--on-deep); box-shadow: inset 0 -2px 0 var(--deep-accent); }
.deep .nav .nav-cv { color: var(--on-deep); border-color: rgba(255,255,255,.55); }
.deep .nav .nav-cv:hover { background: var(--on-deep); color: var(--deep); }
.deep .menu-btn span { background: var(--on-deep); }
@media (max-width: 760px) {
  .deep .nav { background: var(--deep-2); border-color: rgba(255,255,255,.1); }
  .deep .nav a:hover { background: rgba(255,255,255,.08); }
  .deep .nav a[aria-current="page"] { background: rgba(255,255,255,.12); box-shadow: none; }
}

/* home: hero on a light tinted band (same tint as "Selected publications") */
.deep .hero {
  background: var(--tint);
  box-shadow: 0 0 0 100vmax var(--tint);
  clip-path: inset(0 -100vmax);
  padding-bottom: 64px; margin-bottom: 40px;
}
.deep .hero h1 { color: var(--deep); }
@media (prefers-color-scheme: dark) { .deep .hero h1 { color: var(--ink); } }
.deep .portrait { box-shadow: 0 10px 28px rgba(18,62,102,.18); }

/* subpages: title area tinted */
.deep .page { padding-top: 0; }
.deep .page > .wrap > .page-title,
.deep .page > .wrap > .section-head:first-child {
  background: var(--tint);
  box-shadow: 0 0 0 100vmax var(--tint);
  clip-path: inset(0 -100vmax);
  padding-top: 48px; padding-bottom: 28px; margin-bottom: 32px;
}
.deep .page > .wrap > .section-head:first-child .page-title { padding: 0; }
.deep .page-title { color: var(--deep); }
@media (prefers-color-scheme: dark) { .deep .page-title { color: var(--ink); } }
.deep .page > .wrap > .page-title + .facts-top { margin-top: 0; }

/* alternate sections */
.deep .section-alt { background: var(--tint); }

/* footer */
.deep .footer { background: var(--deep); color: var(--on-deep-muted); border-top: 0; }
.deep .footer strong, .deep .footer .email { color: var(--on-deep); }
.deep .footer a { color: var(--deep-accent); }

/* ---------- Recommended readings ---------- */
.readings-link {
  display: block; margin-top: 48px; padding: 22px 26px; border-radius: 12px; text-decoration: none;
  background: var(--tint, var(--bg-alt)); border: 1px solid var(--line); color: var(--ink);
}
.readings-link:hover { border-color: var(--blue); }
.rl-kicker { display: block; font: 600 .72rem var(--sans); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.rl-title { display: block; font: 600 1.35rem var(--serif); color: var(--blue); margin: 2px 0 4px; }
.rl-sub { color: var(--muted); font-size: .95rem; }
.books { list-style: none; padding: 0; margin: 0 0 32px; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.book {
  display: flex; flex-direction: column; gap: 6px; min-height: 170px; padding: 18px 18px 16px 22px;
  background: var(--card); border: 1px solid var(--line); border-radius: 4px 10px 10px 4px;
  border-left: 8px solid var(--spine); box-shadow: 0 2px 6px rgba(0,0,0,.05);
}
.book-math { --spine: var(--blue); }
.book-science { --spine: #3f8f8a; }
.book-fiction { --spine: var(--accent); }
.book-essay { --spine: #8a7a4f; }
.book-tag { font: 600 .68rem var(--sans); letter-spacing: .06em; text-transform: uppercase; color: var(--spine); }
.book-title { font: 600 1.05rem/1.3 var(--serif); flex: 1; }
.book-author { font-size: .88rem; color: var(--muted); }
.book-review { margin: 8px 0 0; padding-top: 8px; border-top: 1px solid var(--line); font: italic .92rem/1.5 var(--serif); color: var(--ink); }

/* Book stack illustration (readings) */
.readings-head { display: grid; grid-template-columns: 1fr 220px; gap: 40px; align-items: center; margin-bottom: 32px; }
.readings-head .section-intro { margin: 0; }
.book-stack { width: 100%; height: auto; }
.bs-book rect:first-child { fill: var(--c); }
.bs-pages { fill: #f6f1e6; }
.bs-band { fill: rgba(255,255,255,.35); }
.bs-label { fill: rgba(255,255,255,.8); }
.bs-shadow { fill: rgba(0,0,0,.08); }
.bs-cover { fill: var(--deep, var(--blue)); }
.bs-page { fill: #fbf8f1; stroke: #d9d2c3; stroke-width: 1; }
.bs-line { fill: none; stroke: #c9c1b0; stroke-width: 1.2; stroke-linecap: round; }
@media (prefers-color-scheme: dark) { .bs-pages { fill: #d8d2c4; } .bs-shadow { fill: rgba(0,0,0,.4); } .bs-cover { fill: var(--blue); } }
@media (max-width: 760px) {
  .readings-head { grid-template-columns: 1fr 110px; gap: 16px; }
}

/* 404 page */
.notfound-links { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 10px 22px; font-weight: 500; }
