/* ==========================================================================
   Marco Basile — site styles
   Pale blue field, navy display type, overlapping photo collage.
   No framework.
   ========================================================================== */

/* --- Tokens ------------------------------------------------------------- */

:root {
  --sky:       #dde8fb;   /* the page itself */
  --sky-deep:  #c9dbf7;   /* the circle behind the hero words */
  --white:     #ffffff;
  --navy:      #16247e;   /* display type */
  --ink:       #23305c;   /* body copy */
  --muted:     #5f6d9c;
  --rule:      #c2d3f0;
  --rule-soft: #d4e0f6;

  --r-tile: 22px;
  --r-soft: 14px;
  --r-pill: 999px;

  --measure: 34rem;
  --gutter: clamp(1.25rem, 4vw, 3.5rem);
  --page: 78rem;
  --bar-h: 4.25rem;

  --step--1: 0.875rem;
  --step-0:  1.0625rem;
  --step-1:  1.25rem;
  --step-2:  1.5rem;
  --step-3:  2rem;
  --step-4:  clamp(2.25rem, 5vw, 3.5rem);
  --step-5:  clamp(2.75rem, 7.5vw, 5.5rem);
}

/* --- Reset -------------------------------------------------------------- */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--sky);
  color: var(--ink);
  font-family: Figtree, "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4 { margin: 0; color: var(--navy); font-weight: 600; line-height: 1.1; letter-spacing: -0.025em; }
p, ul, ol { margin: 0 0 1em; }
ul, ol { padding-left: 1.15em; }
li { margin-bottom: 0.3em; }

a { color: inherit; text-underline-offset: 0.2em; text-decoration-thickness: 1.5px; }
a:hover { color: var(--navy); }

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

.skip { position: absolute; left: -9999px; top: 0; background: var(--navy); color: #fff; padding: 0.6rem 1rem; z-index: 100; }
.skip:focus { left: 0; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip-path: inset(50%); white-space: nowrap;
}

/* --- Layout primitives -------------------------------------------------- */

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

.spread {
  display: grid;
  gap: 0.75rem 3rem;
  grid-template-columns: 1fr;
  padding-block: clamp(3.5rem, 8vw, 6.5rem);
}
@media (min-width: 62rem) {
  .spread { grid-template-columns: 12rem 1fr; gap: 0 4rem; }
  .spread__label { position: sticky; top: calc(var(--bar-h) + 2.5rem); align-self: start; }
}

.spread__label h2 { font-size: var(--step-2); font-weight: 600; }
.spread__label p { margin: 0.5rem 0 0; font-size: var(--step--1); color: var(--muted); line-height: 1.5; }

.prose { max-width: var(--measure); }

/* A white card is how content sits on the blue field. */
.card {
  background: var(--white);
  border-radius: var(--r-tile);
  padding: clamp(1.5rem, 4vw, 2.75rem);
}

/* --- Top bar ------------------------------------------------------------ */

.bar {
  position: sticky; top: 0; z-index: 40;
  height: var(--bar-h);
  display: flex; align-items: center;
  background: rgba(221, 232, 251, 0.85);
  backdrop-filter: saturate(1.5) blur(12px);
}
.bar > .wrap { display: flex; align-items: center; gap: 1.5rem; width: 100%; }

.bar__name {
  font-size: var(--step-1);
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.03em;
  text-decoration: none;
  margin-right: auto;
  white-space: nowrap;
}

.bar__nav ul { display: flex; gap: clamp(0.9rem, 2.4vw, 2rem); list-style: none; margin: 0; padding: 0; }
.bar__nav a {
  font-size: var(--step-0);
  color: var(--ink);
  text-decoration: none;
  padding-block: 0.3rem;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.bar__nav a:hover { color: var(--navy); }
.bar__nav a[aria-current="true"] { color: var(--navy); border-bottom-color: var(--navy); }

.bar__toggle {
  display: none;
  background: none; border: 0; font: inherit;
  color: var(--navy); font-weight: 600;
  padding: 0.4rem 0.1rem; cursor: pointer;
}

@media (max-width: 47.99rem) {
  .bar__toggle { display: block; }
  .bar__nav {
    position: absolute; inset: var(--bar-h) 0 auto 0;
    background: var(--sky); display: none;
    box-shadow: 0 12px 24px rgba(22, 36, 126, 0.08);
  }
  .bar__nav[data-open="true"] { display: block; }
  .bar__nav ul { flex-direction: column; gap: 0; padding: 0.5rem var(--gutter) 1.25rem; }
  .bar__nav a { display: block; padding: 0.65rem 0; border-bottom: 0; }
}

/* --- Hero: the collage -------------------------------------------------- */

.hero { position: relative; padding-block: 1rem 3rem; }

.stage {
  position: relative;
  max-width: var(--page);
  margin-inline: auto;
  padding-inline: var(--gutter);
  /* On small screens the words come first and the images follow. */
  display: flex;
  flex-direction: column-reverse;
}

.tile { margin: 0; overflow: hidden; border-radius: var(--r-tile); }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile--round { border-radius: 50%; }

.hero__words { position: relative; z-index: 3; }

.hero__name {
  font-size: var(--step-5);
  font-weight: 600;
  letter-spacing: -0.045em;
  line-height: 0.95;
}
.hero__lede {
  max-width: 30rem;
  margin: 1.25rem 0 0;
  font-size: var(--step-1);
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: -0.015em;
  color: var(--navy);
}
.hero__meta { margin: 1.25rem 0 0; font-size: var(--step-0); color: var(--muted); max-width: 28rem; }

.cta {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 2rem;
  font-size: var(--step-1);
  font-weight: 600;
  color: var(--navy);
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.35em;
}
.cta svg { flex: none; transition: transform 0.25s ease; }
.cta:hover svg { transform: translateX(5px); }
@media (prefers-reduced-motion: reduce) { .cta svg { transition: none; } }

/* Small screens: the collage becomes a plain band of images below the words. */
.stage__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-top: 2.5rem;
}
.stage__grid .tile--a { grid-row: span 2; }
.stage__grid .tile--a img { aspect-ratio: 3 / 5; }
.stage__grid .tile--a { grid-row: span 2; }
.stage__grid .tile--b img,
.stage__grid .tile--c img { aspect-ratio: 4 / 3; }
.stage__grid .tile--d { display: none; }

/* The circle fades into the page on its right edge, so the headline
   stays legible whatever photo sits behind it. */
.tile--d { position: relative; }
.tile--d::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: linear-gradient(100deg, rgba(221, 232, 251, 0) 45%, rgba(221, 232, 251, 0.92) 88%);
}

/* Wide screens: overlapping composition. */
@media (min-width: 62rem) {
  .hero { padding-block: 1.5rem 4rem; }

  .stage { display: block; min-height: 36rem; }

  .stage__grid { display: block; margin: 0; }
  .stage__grid .tile { position: absolute; }
  .stage__grid .tile--d { display: block; }

  .tile--a { left: 0;  top: 0;      width: 19rem; height: 28rem; }
  .tile--b { left: 42%; top: -0.5rem; width: 15rem; height: 7.5rem; }
  .tile--c { right: 0; top: 0;      width: 17rem; height: 27rem; }
  .tile--d { left: 11%; top: 13rem; width: 23rem; height: 23rem; z-index: 2; }

  .hero__words {
    position: absolute;
    left: 36%;
    top: 16.5rem;
    width: min(26rem, 38%);
  }
  .hero__name { font-size: clamp(2.5rem, 4.4vw, 3.9rem); }
  .hero__lede { font-size: var(--step-1); }
}

/* --- About -------------------------------------------------------------- */

.about__grid { display: grid; gap: 2.5rem; grid-template-columns: 1fr; align-items: start; }
@media (min-width: 45rem) { .about__grid { grid-template-columns: minmax(0, 1fr) 14rem; gap: 3rem; } }

.portrait { border-radius: 50%; aspect-ratio: 1; object-fit: cover; width: 100%; }

.facts { list-style: none; margin: 2rem 0 0; padding: 0; max-width: var(--measure); }
.facts li {
  display: grid;
  grid-template-columns: 8.5rem 1fr;
  gap: 1rem;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--rule-soft);
  margin: 0;
  font-size: var(--step--1);
}
.facts li:first-child { border-top: 1px solid var(--rule-soft); }
.facts .k { color: var(--muted); }
@media (max-width: 30rem) { .facts li { grid-template-columns: 1fr; gap: 0.1rem; } }

/* --- CV ----------------------------------------------------------------- */

.cv__cols { display: grid; gap: clamp(2rem, 4vw, 3rem); grid-template-columns: 1fr; }
@media (min-width: 56rem) { .cv__cols { grid-template-columns: 1fr 1fr; } }

.cv__head { font-size: var(--step-1); font-weight: 600; color: var(--navy); margin-bottom: 1.5rem; }
.cv__head:not(:first-child) { margin-top: 2.75rem; }

.entry { margin-bottom: 1.75rem; }
.entry h4 { font-size: var(--step-1); font-weight: 600; }
.entry__when { font-size: var(--step--1); color: var(--muted); margin: 0.3rem 0 0.5rem; font-variant-numeric: tabular-nums; }
.entry__where { font-size: var(--step--1); color: var(--muted); }
.entry p, .entry li { font-size: var(--step--1); line-height: 1.55; }
.entry ul { padding-left: 1.05em; }

/* --- Work index --------------------------------------------------------- */

.filters { display: flex; flex-wrap: wrap; gap: 0.5rem; margin: 0 0 2rem; padding: 0; }
.filters button {
  font: inherit;
  font-size: var(--step--1);
  font-weight: 500;
  color: var(--ink);
  background: var(--white);
  border: 0;
  border-radius: var(--r-pill);
  padding: 0.45rem 1.1rem;
  cursor: pointer;
}
.filters button:hover { color: var(--navy); }
.filters button[aria-pressed="true"] { background: var(--navy); color: #fff; }

.index { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.75rem; }
.index li { margin: 0; }

.index a {
  display: grid;
  grid-template-columns: 6rem 3.5rem 1fr 7rem;
  gap: 1.5rem;
  align-items: center;
  background: var(--white);
  border-radius: var(--r-soft);
  padding: 0.9rem 1.5rem 0.9rem 0.9rem;
  text-decoration: none;
  transition: transform 0.2s ease;
}
.index a:hover { transform: translateX(4px); color: inherit; }
.index a:hover .index__title { color: var(--navy); }
@media (prefers-reduced-motion: reduce) { .index a { transition: none; } }

.index__thumb {
  width: 6rem; height: 4rem;
  object-fit: cover;
  border-radius: 10px;
  background: var(--sky-deep);
}
.index__year { font-size: var(--step--1); color: var(--muted); font-variant-numeric: tabular-nums; }
.index__title { font-size: var(--step-1); font-weight: 600; color: var(--ink); letter-spacing: -0.02em; }
.index__note { display: block; font-size: var(--step--1); font-weight: 400; color: var(--muted); margin-top: 0.1rem; line-height: 1.4; }
.index__kind { font-size: var(--step--1); color: var(--muted); text-align: right; }

@media (max-width: 47.99rem) {
  .index a { grid-template-columns: 4.5rem 1fr; align-items: start; gap: 0.15rem 1rem; padding: 0.75rem; }
  .index__thumb { grid-row: span 3; width: 4.5rem; height: 4.5rem; }
  .index__year, .index__kind { grid-column: 2; text-align: left; }
}

/* --- Contact ------------------------------------------------------------ */

.contact__links { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.6rem; }
.contact__links li { margin: 0; }
.contact__links a {
  display: inline-block;
  background: var(--white);
  border-radius: var(--r-pill);
  padding: 0.5rem 1.2rem;
  font-size: var(--step-0);
  font-weight: 500;
  text-decoration: none;
}
.contact__links a:hover { background: var(--navy); color: #fff; }

/* --- Footer ------------------------------------------------------------- */

.foot { padding-block: 2rem 3.5rem; font-size: var(--step--1); color: var(--muted); }
.foot .wrap { display: flex; flex-wrap: wrap; gap: 1rem 2rem; justify-content: space-between; }

/* --- Detail pages ------------------------------------------------------- */

.detail__head { padding-block: clamp(1.5rem, 5vw, 3rem) clamp(1.75rem, 4vw, 2.5rem); }
.detail__crumb { font-size: var(--step--1); color: var(--muted); margin-bottom: 1rem; }
.detail__crumb a { text-decoration: none; }
.detail__crumb a:hover { text-decoration: underline; }
.detail__event { font-size: var(--step-0); color: var(--muted); margin-bottom: 0.75rem; }
.detail__title { font-size: var(--step-4); font-weight: 600; letter-spacing: -0.035em; line-height: 1.08; max-width: 22ch; }

.detail__body { display: grid; gap: 2rem; grid-template-columns: 1fr; padding-bottom: clamp(2.5rem, 6vw, 4rem); }
@media (min-width: 62rem) { .detail__body { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 2.5rem; } }

.gallery { margin: 0; }
.gallery__strip {
  display: flex; gap: 0.75rem;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: thin;
  padding-bottom: 0.5rem;
}
.gallery__strip > * { flex: 0 0 100%; scroll-snap-align: start; margin: 0; }
.gallery__strip img { width: 100%; border-radius: var(--r-tile); }
.gallery--single .gallery__strip { overflow: visible; }

.gallery__nav { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.75rem; font-size: var(--step--1); color: var(--muted); }
.gallery__nav button {
  font: inherit;
  background: var(--white);
  border: 0;
  border-radius: 50%;
  width: 2.25rem; height: 2.25rem;
  cursor: pointer;
  color: var(--navy);
  line-height: 1;
}
.gallery__nav button:hover { background: var(--navy); color: #fff; }
.gallery__nav button[disabled] { opacity: 0.4; cursor: default; background: var(--white); color: var(--navy); }
.gallery__count { font-variant-numeric: tabular-nums; }

.frame {
  position: relative;
  overflow: hidden;
  padding-top: 56.25%;
  margin-bottom: 1.25rem;
  background: var(--sky-deep);
  border-radius: var(--r-soft);
}
.frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

.detail__side {
  background: var(--white);
  border-radius: var(--r-tile);
  padding: clamp(1.5rem, 3vw, 2.25rem);
  align-self: start;
}
.detail__side h3 { font-size: var(--step-1); font-weight: 600; margin-bottom: 1rem; }
.detail__side p { font-size: var(--step--1); line-height: 1.6; }

.resources { list-style: none; margin: 1.5rem 0 0; padding: 0; }
.resources li { margin: 0; border-top: 1px solid var(--rule-soft); }
.resources a { display: flex; justify-content: space-between; gap: 1rem; padding: 0.75rem 0; font-size: var(--step--1); font-weight: 500; text-decoration: none; }
.resources a:hover { color: var(--navy); }
.resources .what { color: var(--muted); font-weight: 400; }

.chapters { list-style: none; margin: 0; padding: 0; counter-reset: ch; }
.chapters > li { counter-increment: ch; margin-bottom: 2rem; }
.chapters h3 { font-size: var(--step-1); font-weight: 600; margin-bottom: 0.9rem; }
.chapters h3::before {
  content: counter(ch, decimal-leading-zero);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-right: 0.7rem;
  font-weight: 500;
}
.chapters--grid { display: grid; gap: 0 2.5rem; grid-template-columns: 1fr; padding-bottom: 2rem; }
@media (min-width: 56rem) { .chapters--grid { grid-template-columns: 1fr 1fr; } }

.back-link { display: inline-block; margin-top: 0.5rem; font-size: var(--step-0); font-weight: 500; }
