/* =====================================================================
   work.css — Work page only
   Project index + per-project case studies (galleries, font/colour chips)
   Loaded AFTER style.css / animations.css / responsive.css
   ===================================================================== */

/* ---------- Page header ---------- */
.work-hero {
  padding: clamp(120px, 17vh, 200px) 0 clamp(40px, 7vh, 80px);
}
.work-hero__inner { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gut); }
.work-hero h1 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: .96;
  letter-spacing: -.02em;
  font-size: clamp(2.8rem, 9vw, 7.5rem);
  color: var(--ink);
  margin: .18em 0 .35em;
}
.work-hero h1 .y { color: var(--accent); }
.work-hero__lead {
  max-width: 46ch;
  color: var(--muted);
  font-size: clamp(1rem, 1.4vw, 1.18rem);
  line-height: 1.6;
}

/* ---------- Project index (sticky-ish overview list) ---------- */
.work-index {
  max-width: var(--maxw);
  margin: 0 auto clamp(50px, 9vh, 110px);
  padding-inline: var(--gut);
  border-top: 1px solid var(--line);
}
.work-index__row {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  align-items: center;
  gap: 20px;
  padding: clamp(16px, 2.4vw, 26px) 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  transition: color .35s var(--ease);
}
.work-index__row:hover { color: var(--ink-soft); }
.work-index__num {
  font-family: var(--font-mono);
  font-size: .8rem;
  color: var(--muted);
}
.work-index__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.5rem, 3.6vw, 2.7rem);
  letter-spacing: -.015em;
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: .6em;
  flex-wrap: wrap;
}
.work-index__name small {
  font-family: var(--font-body);
  font-weight: 500;
  font-size: .8rem;
  color: var(--muted);
  letter-spacing: 0;
}
.work-index__arrow {
  width: 30px; height: 30px;
  flex: none;
  color: var(--muted);
  transition: transform .4s var(--ease), color .35s var(--ease);
}
.work-index__row:hover .work-index__arrow { transform: translate(4px, -4px); color: var(--ink); }
.work-index__arrow svg { width: 100%; height: 100%; }

/* ---------- A single project case study ---------- */
.case {
  scroll-margin-top: 90px;            /* so #anchor lands below fixed nav */
  padding: clamp(54px, 9vh, 120px) 0;
  border-top: 1px solid var(--line);
}
.case:nth-of-type(even) { background: var(--bone); }
.case__inner { max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gut); }

/* header: number + title + meta side by side */
.case__head {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: clamp(24px, 4vw, 64px);
  align-items: start;
}
.case__num {
  font-family: var(--font-mono);
  font-size: .85rem;
  color: var(--accent-ink);
  background: var(--accent);
  display: inline-block;
  padding: 3px 10px;
  border-radius: 100px;
  margin-bottom: 18px;
}
.case__title {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: .98;
  letter-spacing: -.02em;
  color: var(--ink);
  font-size: clamp(2.4rem, 6vw, 5rem);
  margin: 0 0 .12em;
}
.case__tagline {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.05rem, 2vw, 1.6rem);
  color: var(--ink-soft);
  letter-spacing: -.01em;
  margin: 0;
}
.case__desc {
  color: var(--muted);
  line-height: 1.7;
  font-size: clamp(.98rem, 1.2vw, 1.08rem);
  max-width: 50ch;
}
.case__desc + .case__desc { margin-top: 1em; }

/* meta: font + colour chips */
.case__meta {
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding-top: 6px;
}
.meta-block .label {
  display: block;
  font-family: var(--font-mono);
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.meta-block__value {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
  color: var(--ink);
}
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 6px 10px 6px 6px;
  border-radius: 100px;
}
.case:nth-of-type(even) .swatch { background: var(--paper); }
.swatch i {
  width: 16px; height: 16px;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.08);
  flex: none;
}

/* ---------- Gallery ---------- */
.case__gallery {
  margin-top: clamp(34px, 5vw, 64px);
  display: grid;
  gap: clamp(12px, 1.6vw, 22px);
  grid-template-columns: repeat(12, 1fr);
}
.case__gallery figure {
  margin: 0;
  overflow: hidden;
  border-radius: 14px;
  background: var(--bone);
  aspect-ratio: 1 / 1;
}
.case:nth-of-type(even) .case__gallery figure { background: var(--paper); }
.case__gallery img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .9s var(--ease-out);
}
.case__gallery figure:hover img { transform: scale(1.04); }

/* span helpers (12-col grid) */
.g-12 { grid-column: span 12; aspect-ratio: 16 / 10; }
.g-8  { grid-column: span 8; aspect-ratio: 4 / 3; }
.g-6  { grid-column: span 6; }
.g-4  { grid-column: span 4; }
.g-wide { aspect-ratio: 16 / 9; }
.g-tall { aspect-ratio: 3 / 4; }

/* back-to-top / next cue */
.work-end {
  text-align: center;
  padding: clamp(60px, 10vh, 120px) var(--gut);
  border-top: 1px solid var(--line);
}
.work-end p {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 4vw, 3rem);
  color: var(--ink);
  letter-spacing: -.015em;
  margin: 0 0 .6em;
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .case__head { grid-template-columns: 1fr; gap: 26px; }
  .case__meta { flex-direction: row; flex-wrap: wrap; gap: 30px 40px; }
  .work-index__row { grid-template-columns: 48px 1fr auto; }
}
@media (max-width: 620px) {
  .g-8, .g-6, .g-4 { grid-column: span 6; aspect-ratio: 1 / 1; }
  .g-12 { aspect-ratio: 4 / 3; }
  .case__gallery { grid-template-columns: repeat(6, 1fr); }
  .work-index__name { font-size: 1.5rem; }
  .work-index__name small { width: 100%; }
}

/* =====================================================================
   PROJECT PAGES (progetto-*.html)
   Each project now lives on its own page. This block styles:
   · .pswitch  — back arrow + the list of all categories (top / sticky)
   · .case--solo — the single case study
   · .pnav     — previous / next project
   · .work-index — the Work page list of projects (no previews)
   ===================================================================== */

/* ---------- Category switcher (sticky under the navbar) ---------- */
.pswitch {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255,255,255,.86);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
  padding: 84px var(--gut) 0;      /* clears the fixed navbar */
  display: flex; align-items: center; gap: clamp(14px,2.4vw,34px);
}
.pswitch__back {
  display: inline-flex; align-items: center; gap: 9px; flex: none;
  font-family: var(--font-mono); font-size: .7rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
  padding-bottom: 14px;
  transition: color .3s var(--ease), transform .3s var(--ease-out);
}
.pswitch__back svg { width: 16px; height: 16px; transition: transform .35s var(--ease-out); }
.pswitch__back:hover { color: var(--ink); }
.pswitch__back:hover svg { transform: translateX(-4px); }

/* horizontal, scrollable on small screens — never wraps into a wall */
.pswitch__list {
  display: flex; gap: clamp(10px,1.6vw,26px);
  overflow-x: auto; scrollbar-width: none;
  margin: 0; padding: 0;
}
.pswitch__list::-webkit-scrollbar { display: none; }
.pswitch__link {
  display: inline-flex; align-items: baseline; gap: 7px; white-space: nowrap;
  padding: 0 0 14px; border-bottom: 2px solid transparent;
  color: var(--muted);
  transition: color .3s var(--ease), border-color .3s var(--ease);
}
.pswitch__n { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .1em; }
.pswitch__name { font-family: var(--font-display); font-weight: 700; font-size: .96rem; letter-spacing: -.01em; }
.pswitch__link:hover { color: var(--ink); }
.pswitch__link.is-active { color: var(--ink); border-color: var(--accent); }

/* ---------- The single case study ---------- */
.case--solo { border-top: 0; background: var(--paper); padding-top: clamp(40px,6vh,72px); }
.case--solo .case__title { font-size: clamp(2.8rem, 7vw, 6rem); }
.case--solo .swatch { background: var(--bone); }

/* ---------- Previous / next ---------- */
.pnav { border-top: 1px solid var(--line); background: var(--bone); }
.pnav__inner {
  max-width: var(--maxw); margin-inline: auto; padding: clamp(28px,5vw,54px) var(--gut);
  display: flex; justify-content: space-between; gap: 20px;
}
.pnav__item { display: grid; gap: 6px; transition: transform .4s var(--ease-out); }
.pnav__item--next { text-align: right; }
.pnav__item--prev:hover { transform: translateX(-6px); }
.pnav__item--next:hover { transform: translateX(6px); }
.pnav__lbl {
  font-family: var(--font-mono); font-size: .68rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--muted);
}
.pnav__name {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(1.1rem, 2.4vw, 1.7rem); letter-spacing: -.015em; color: var(--ink);
}

@media (max-width: 780px) {
  .pswitch { padding-top: 76px; }
  .pnav__inner { flex-direction: column; }
  .pnav__item--next { text-align: left; }
}
