/* ==========================================================================
   Francesco Renaldini — Portfolio
   Visual system derived from the MSc thesis "Design at your fingertips":
   Inter Tight (text + headings), Funnel Display (display), ink #111827,
   gold #B8860B, thin rules, bordered figures, numbered chapters.
   ========================================================================== */

:root {
  --ink: #111827;
  --gold: #b8860b;
  --muted: #6b7280;
  --rule: #d1d5db;
  --paper: #ffffff;
  --paper-2: #f6f6f4;

  --font-text: "Inter Tight", "Helvetica Neue", Arial, sans-serif;
  --font-display: "Funnel Display", "Inter Tight", "Helvetica Neue", Arial, sans-serif;

  --wrap: 1280px;
  --gutter: clamp(20px, 4vw, 56px);
  --col-gap: clamp(24px, 3.2vw, 48px);
  --header-h: 64px;
}

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

html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 24px); }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-text);
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
p { margin: 0 0 0.9em; }
p:last-child { margin-bottom: 0; }

::selection { background: var(--gold); color: #fff; }

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ---------- Type --------------------------------------------------------- */

.display {
  font-family: var(--font-text);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.055em;
  line-height: 0.9;
  margin: 0;
  font-size: clamp(48px, 9vw, 132px);
}

.subtitle {
  color: var(--gold);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin: 0.15em 0 0;
  font-size: clamp(22px, 2.6vw, 36px);
}

.h-upper {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.035em;
  line-height: 1;
  margin: 0;
}

.label {
  display: block;
  color: var(--gold);
  font-weight: 600;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.value {
  display: block;
  font-weight: 600;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.lead {
  font-size: clamp(20px, 1.9vw, 26px);
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.muted { color: var(--muted); }
.gold { color: var(--gold); }

/* ---------- Header ------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: saturate(160%) blur(8px);
  -webkit-backdrop-filter: saturate(160%) blur(8px);
}

.site-header .wrap {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid var(--ink);
}

.brand {
  text-decoration: none;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.04em;
  font-size: 17px;
  line-height: 1;
}

.brand span { color: var(--gold); font-weight: 500; }

.nav {
  display: flex;
  gap: 28px;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: -0.01em;
}

.nav a { text-decoration: none; position: relative; }
.nav a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -4px;
  height: 1px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.25s ease;
}
.nav a:hover::after,
.nav a[aria-current="page"]::after { transform: scaleX(1); }

.header-chapter {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--gold);
  letter-spacing: -0.01em;
  opacity: 0;
  transition: opacity 0.2s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-chapter.is-visible { opacity: 1; }

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

.site-footer { margin-top: clamp(80px, 10vw, 140px); }

.site-footer .wrap {
  border-top: 1px solid var(--rule);
  padding-top: 18px;
  padding-bottom: 32px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  font-size: 14px;
  color: var(--muted);
}

.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--ink); }

/* ---------- Figures ------------------------------------------------------ */

.figure { margin: 0; }

.figure .frame {
  border: 1px solid var(--ink);
  overflow: hidden;
  background: var(--paper-2);
}

.figure img {
  width: 100%;
  cursor: zoom-in;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.figure .frame:hover img { transform: scale(1.012); }

.figure figcaption {
  margin-top: 10px;
  font-size: 13px;
  font-style: italic;
  color: var(--muted);
  line-height: 1.35;
}

/* ---------- Boxes (bordered panels, as on thesis spec pages) ------------- */

.box {
  border: 1px solid var(--ink);
  padding: clamp(20px, 2.4vw, 32px);
}

.box-title {
  font-weight: 600;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  margin: 0 0 14px;
}

.box-grid {
  display: grid;
  gap: 16px;
}

.box-grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.box-grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.box-grid.cols-4 { grid-template-columns: repeat(4, 1fr); }

/* ==========================================================================
   HOME
   ========================================================================== */

.hero {
  padding-top: clamp(48px, 7vw, 96px);
}

.hero-title .display { font-size: clamp(54px, 10.5vw, 156px); }

.hero-body {
  margin-top: clamp(48px, 7vw, 96px);
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: var(--col-gap);
  align-items: end;
}

.portrait .frame { aspect-ratio: 3 / 4; }
.portrait img { height: 100%; object-fit: cover; object-position: 50% 50%; cursor: default; }
.portrait .frame:hover img { transform: none; }

.hero-text .lead { max-width: 30ch; margin-bottom: 1.2em; }
.hero-text p { max-width: 58ch; }

.hero-meta {
  margin-top: clamp(40px, 5vw, 64px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.hero-meta div { display: flex; flex-direction: column; gap: 4px; }

/* Section header: rule + number + bilingual-style double title */

.section-head {
  margin-top: clamp(96px, 12vw, 168px);
  border-top: 1px solid var(--ink);
  padding-top: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--col-gap);
  align-items: start;
}

.section-head .h-upper { font-size: clamp(28px, 3.4vw, 44px); }
.section-head .h-upper .gold { display: block; font-weight: 500; }
.section-head p { max-width: 46ch; margin-top: 6px; }

/* Project index (contents-table style) */

.project-list { margin-top: clamp(32px, 4vw, 56px); }

.project-row {
  display: grid;
  grid-template-columns: 7fr 5fr;
  gap: var(--col-gap);
  text-decoration: none;
  padding-bottom: clamp(32px, 4vw, 56px);
  border-bottom: 1px solid var(--rule);
}

.project-row + .project-row { padding-top: clamp(32px, 4vw, 56px); }

.project-row .frame { aspect-ratio: 16 / 9; }
.project-row .frame img { height: 100%; object-fit: cover; cursor: pointer; }
.project-row:hover .frame img { transform: scale(1.02); }

.project-info {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
}

.project-num {
  font-family: var(--font-text);
  font-weight: 300;
  font-size: clamp(88px, 10vw, 148px);
  line-height: 0.78;
  letter-spacing: -0.06em;
}

.project-info .h-upper { font-size: clamp(30px, 3.2vw, 46px); }
.project-info .subtitle { font-size: clamp(18px, 1.7vw, 22px); }

.project-tags {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 24px;
  border-top: 1px solid var(--rule);
  padding-top: 18px;
}

.project-tags div { display: flex; flex-direction: column; gap: 4px; }
.project-tags .value { font-size: 14px; }

.arrow-link {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 14px;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.arrow-link::after {
  content: "→";
  color: var(--gold);
  transition: transform 0.25s ease;
}

.arrow-link:hover::after,
.project-row:hover .arrow-link::after { transform: translateX(6px); }

/* Contact */

.contact-grid {
  margin-top: clamp(32px, 4vw, 48px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.contact-grid .box { display: flex; flex-direction: column; gap: 10px; text-decoration: none; transition: background 0.2s ease, color 0.2s ease; }
.contact-grid a.box:hover { background: var(--ink); color: #fff; }
.contact-grid .value { font-size: 17px; text-transform: none; letter-spacing: -0.02em; }

/* ==========================================================================
   CASE STUDY
   ========================================================================== */

.case-cover { padding-top: clamp(48px, 7vw, 96px); }

.case-cover .display { font-size: clamp(46px, 8.4vw, 124px); }

.case-cover .figure { margin-top: clamp(40px, 5vw, 64px); }

.case-meta {
  margin-top: clamp(32px, 4vw, 48px);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px 24px;
}

.case-meta div { display: flex; flex-direction: column; gap: 4px; }
.case-meta .value { font-size: 14px; }

.back-link {
  display: inline-flex;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  text-decoration: none;
  margin-bottom: 28px;
}
.back-link::before { content: "←"; color: var(--gold); transition: transform 0.25s ease; }
.back-link:hover::before { transform: translateX(-5px); }

/* Contents table */

.contents {
  margin-top: clamp(80px, 10vw, 140px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--col-gap);
}

.contents-head {
  border-bottom: 1px solid var(--ink);
  padding-bottom: 10px;
  font-weight: 600;
  font-size: 15px;
  text-transform: uppercase;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--col-gap);
}

.contents ol {
  list-style: none;
  margin: 0;
  padding: 0;
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: repeat(3, auto);
  grid-auto-flow: column;
  gap: 14px var(--col-gap);
}

.contents li a {
  display: grid;
  grid-template-columns: 2.2em 1fr auto;
  align-items: baseline;
  gap: 8px;
  border: 1px solid var(--ink);
  padding: 14px 16px;
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: -0.01em;
  transition: background 0.2s ease, color 0.2s ease;
}
.contents li a span:last-child { font-weight: 400; color: var(--muted); text-transform: none; font-size: 14px; }
.contents li a:hover { background: var(--ink); color: #fff; }
.contents li a:hover span:last-child { color: #c7c9cf; }

/* Chapter opener (thesis-style: big figure + numeral + double title) */

.chapter { margin-top: clamp(110px, 13vw, 190px); }

.chapter-opener .figure .frame { aspect-ratio: 16 / 9; }
.chapter-opener .figure img { height: 100%; object-fit: cover; }

.chapter-title {
  margin-top: clamp(24px, 3vw, 40px);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--col-gap);
  align-items: end;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--rule);
}

.chapter-num {
  font-weight: 300;
  font-size: clamp(120px, 17vw, 240px);
  line-height: 0.74;
  letter-spacing: -0.07em;
  margin: 0;
}

.chapter-title h2 {
  margin: 0;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.04em;
  line-height: 0.98;
  font-size: clamp(30px, 3.6vw, 50px);
}

.chapter-title h2 small {
  display: block;
  font-size: inherit;
  font-weight: 500;
  color: var(--gold);
}

/* Sub-section (thesis "1.1  TITLE" + two columns) */

.sub {
  margin-top: clamp(64px, 8vw, 112px);
  border-top: 1px solid var(--ink);
  padding-top: 20px;
}

.sub-head {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--col-gap);
  margin-bottom: clamp(24px, 3vw, 36px);
}

.sub-head h3 {
  margin: 0;
  display: grid;
  grid-template-columns: 3.2em 1fr;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.035em;
  line-height: 1;
  font-size: clamp(22px, 2.2vw, 30px);
}

.sub-head h3 .n {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0;
  padding-top: 0.35em;
}

.sub-head .kicker { color: var(--gold); font-weight: 500; letter-spacing: -0.02em; font-size: clamp(18px, 1.6vw, 22px); line-height: 1.15; }

.cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--col-gap);
  align-items: start;
}

.cols-7-5 { grid-template-columns: 7fr 5fr; }
.cols-5-7 { grid-template-columns: 5fr 7fr; }

.stack > * + * { margin-top: clamp(24px, 3vw, 40px); }

.fig-row { margin-top: clamp(28px, 3.4vw, 44px); }

.statement {
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.08;
  font-size: clamp(26px, 3.2vw, 44px);
  margin: 0;
  max-width: 26ch;
}

.statement .gold { font-weight: 600; }

.quote {
  margin: 0;
  border-left: 2px solid var(--gold);
  padding: 2px 0 2px 18px;
  font-size: 19px;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.quote cite {
  display: block;
  margin-top: 8px;
  font-style: normal;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--gold);
}

.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: 9px 0; border-bottom: 1px solid var(--rule); }
.list-plain li:first-child { border-top: 1px solid var(--rule); }

.kv { display: flex; flex-direction: column; gap: 4px; }

/* Insights */

.insight .label { margin-bottom: 14px; }
.insight h4 { margin: 0; font-size: 18px; font-weight: 700; text-transform: uppercase; letter-spacing: -0.025em; line-height: 1.08; }

/* Journey steps */

.steps {
  counter-reset: step;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.steps li {
  counter-increment: step;
  border: 1px solid var(--ink);
  padding: 16px;
  min-height: 116px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.steps li::before {
  content: counter(step, decimal-leading-zero);
  color: var(--gold);
  font-size: 14px;
  font-weight: 600;
}

.steps li small { display: block; margin-top: 6px; font-size: 13px; font-weight: 400; text-transform: none; letter-spacing: 0; color: var(--muted); line-height: 1.3; }

/* Storyboard */

.phase {
  margin-top: clamp(44px, 5vw, 72px);
}

.phase-label {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 24px;
}

.phase-label .h-upper { font-size: 20px; }

.scenes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(32px, 4vw, 56px) var(--col-gap);
}

.scene .scene-title {
  margin: 16px 0 10px;
  display: flex;
  gap: 12px;
  align-items: baseline;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: -0.025em;
  font-size: 18px;
  line-height: 1.05;
}

.scene .scene-title span { color: var(--gold); font-size: 13px; font-weight: 600; letter-spacing: 0; }
.scene p { font-size: 16px; }
.scene .quote { font-size: 16px; margin-top: 12px; }

.scene.wide { grid-column: 1 / -1; }

/* Cast */

.cast .box { display: flex; flex-direction: column; gap: 10px; }
.cast .name { font-weight: 700; text-transform: uppercase; letter-spacing: -0.025em; font-size: 18px; line-height: 1.05; }
.cast p { font-size: 15px; }

/* Stats */

.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
}

.stat { padding: 20px 18px 18px 0; }
.stat + .stat { border-left: 1px solid var(--rule); padding-left: 18px; }
.stat .num { font-weight: 300; font-size: clamp(44px, 5vw, 72px); letter-spacing: -0.05em; line-height: 0.9; }
.stat .label { margin-top: 10px; }

/* Value chain */

.chain {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0;
  border: 1px solid var(--ink);
}

.chain > div { padding: 18px; display: flex; flex-direction: column; gap: 10px; font-size: 15px; line-height: 1.35; }
.chain > div + div { border-left: 1px solid var(--ink); }
.chain > div:last-child { background: var(--ink); color: #fff; }
.chain > div:last-child .label { color: #e2b54a; }

/* Swatches */

.swatches {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px 24px;
}

.swatch { display: grid; grid-template-columns: 56px 1fr; gap: 14px; align-items: center; }
.swatch i { display: block; width: 56px; height: 56px; border: 1px solid var(--ink); }
.swatch b { display: block; font-size: 15px; letter-spacing: -0.01em; }
.swatch span { font-size: 13px; color: var(--muted); text-transform: uppercase; }

.type-specimen .big { font-size: clamp(56px, 7vw, 96px); line-height: 1; letter-spacing: -0.03em; margin: 6px 0 4px; }

/* Next project */

.next {
  margin-top: clamp(110px, 13vw, 180px);
  border-top: 1px solid var(--ink);
  padding-top: 20px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--col-gap);
  align-items: end;
}

.next .h-upper { font-size: clamp(30px, 4vw, 56px); }

/* ---------- Lightbox ----------------------------------------------------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.97);
  display: none;
  align-items: center;
  justify-content: center;
  padding: clamp(16px, 4vw, 56px);
  cursor: zoom-out;
}

.lightbox.is-open { display: flex; }
.lightbox img { max-height: 100%; max-width: 100%; border: 1px solid var(--ink); }

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: 0;
  font: 600 14px/1 var(--font-text);
  text-transform: uppercase;
  cursor: pointer;
  color: var(--ink);
}

.lightbox-caption {
  position: absolute;
  left: 0; right: 0; bottom: 16px;
  text-align: center;
  font-size: 13px;
  font-style: italic;
  color: var(--muted);
  padding: 0 24px;
}

/* ---------- Reveal ------------------------------------------------------- */

/* Only hidden when JS is running (html.js is set in <head>) */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1); }
.js .reveal.is-in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .figure img { transition: none; }
}

/* ---------- Responsive --------------------------------------------------- */

@media (max-width: 1020px) {
  .case-meta { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(2, 1fr); }
  .box-grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .swatches { grid-template-columns: repeat(2, 1fr); }
  .chain { grid-template-columns: 1fr; }
  .chain > div + div { border-left: 0; border-top: 1px solid var(--ink); }
}

@media (max-width: 820px) {
  body { font-size: 16px; }
  .nav { gap: 18px; }
  .hero-body,
  .project-row,
  .section-head,
  .chapter-title,
  .sub-head,
  .cols,
  .cols-7-5,
  .cols-5-7,
  .scenes,
  .next,
  .contents ol,
  .contents-head { grid-template-columns: 1fr; }
  .contents-head span:last-child { display: none; }
  .contents ol { grid-template-rows: none; grid-auto-flow: row; }
  .hero-meta,
  .contact-grid,
  .box-grid.cols-3 { grid-template-columns: 1fr; }
  .box-grid.cols-2 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(3) { border-left: 0; padding-left: 0; border-top: 1px solid var(--rule); }
  .stat:nth-child(4) { border-top: 1px solid var(--rule); }
  .portrait { max-width: 420px; }
  .header-chapter { display: none; }
  .chapter-num { font-size: 120px; }
}

@media (max-width: 520px) {
  .nav a.hide-sm { display: none; }
  .brand { font-size: 15px; white-space: nowrap; }
  .nav { gap: 14px; font-size: 13px; }
  .case-meta,
  .project-tags,
  .steps,
  .box-grid.cols-4,
  .swatches { grid-template-columns: 1fr; }
  .site-footer .wrap { flex-direction: column; }
}

/* ==========================================================================
   Additions: galleries, natural-ratio figures, figure numbering,
   bachelor project cards
   ========================================================================== */

main.numbered { counter-reset: fig; }
main.numbered .figure[data-zoom] { counter-increment: fig; }
main.numbered .figure[data-zoom] figcaption::before { content: "Fig. " counter(fig) ": "; }

/* Figures that keep their own proportions (A4 pages, spreads) */
.chapter-opener .figure.natural .frame,
.figure.natural .frame { aspect-ratio: auto; }
.chapter-opener .figure.natural img { height: auto; }

.gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(24px, 3vw, 40px) var(--col-gap);
  align-items: start;
}
.gallery.cols-2 { grid-template-columns: repeat(2, 1fr); }
.gallery .span-all { grid-column: 1 / -1; }
.gallery .span-2 { grid-column: span 2; }

/* Project cover for smaller (bachelor) projects: image + text side by side */
.case-split {
  margin-top: clamp(40px, 5vw, 64px);
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: var(--col-gap);
  align-items: start;
}

/* Bachelor projects index on the home page */
.card-grid {
  margin-top: clamp(32px, 4vw, 56px);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(40px, 5vw, 64px) var(--col-gap);
}

.card { text-decoration: none; display: flex; flex-direction: column; gap: 14px; }
.card .frame { aspect-ratio: 4 / 3; }
.card .frame img { height: 100%; object-fit: cover; cursor: pointer; }
.card:hover .frame img { transform: scale(1.03); }
.card-head { display: flex; align-items: baseline; gap: 12px; }
.card-head .num { color: var(--gold); font-weight: 600; font-size: 14px; }
.card .h-upper { font-size: clamp(22px, 2vw, 28px); }
.card .subtitle { font-size: 17px; margin-top: 2px; }
.card .meta { font-size: 13px; color: var(--muted); text-transform: uppercase; font-weight: 600; letter-spacing: -0.01em; }

.next-link { text-decoration: none; }
.next-link:hover .h-upper { color: var(--gold); }

@media (max-width: 1020px) {
  .card-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 820px) {
  .gallery, .gallery.cols-2, .case-split { grid-template-columns: 1fr; }
  .gallery .span-2 { grid-column: auto; }
}

@media (max-width: 520px) {
  .card-grid { grid-template-columns: 1fr; }
}

.steps.steps-3 { grid-template-columns: repeat(3, 1fr); }
.steps li { overflow-wrap: anywhere; }
@media (max-width: 1020px) { .steps.steps-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .steps.steps-3 { grid-template-columns: 1fr; } }

/* Stat rows set inline to 3 columns collapse on small screens */
@media (max-width: 520px) {
  .stats { grid-template-columns: 1fr 1fr !important; }
  .stats .stat:nth-child(3) { border-left: 0; padding-left: 0; border-top: 1px solid var(--rule); }
  .stat .num { font-size: 40px; }
}
@media (max-width: 520px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .stats .stat { min-width: 0; }
  .stats .stat:nth-child(3) { padding-left: 0; }
  .stats .stat:nth-child(odd) { border-left: 0; padding-left: 0; }
}
