/* works.css — project plates, service list, values, timeline. Owner pieces: "lavori + project pages", "imagery treatment" */

/* ─────────────────────────────────────────────────────────────────────────────
   THE PLATE
   Every project photograph is a plate in a monograph: a hairline above it
   carrying its number, the photograph itself with nothing laid over it, and
   a quiet caption underneath. No badges, no overlays, no chrome on the image.
   ──────────────────────────────────────────────────────────────────────────── */

.works {
  display: grid;
  /* Registers to the site's declared field (base.css --cols/--gutter), so the
     plates stand on the same column rules as the frame and the colophon. */
  grid-template-columns: repeat(var(--cols, 12), minmax(0, 1fr));
  column-gap: var(--gutter, 26px);
  row-gap: clamp(56px, 7.5vw, 128px);
  align-items: start;
}

.work {
  position: relative;
  grid-column: span 4;
  padding-top: 13px;
  border-top: 1px solid var(--rule);
  /* Each plate is the target of lavori.html#wN. The bar is fixed, so without this
     the anchor parks the plate's hairline underneath it. */
  scroll-margin-top: calc(var(--nav-h) + clamp(20px, 3vw, 44px));
}
.work.size-large { grid-column: span 8; }
.work.size-medium { grid-column: span 6; }
.work.size-small { grid-column: span 4; }

.work > a { display: block; }

/* The hairline redraws in ink on hover — the whole hover, nothing else moves. */
.work::before {
  content: "";
  position: absolute; left: 0; top: -1px; width: 100%; height: 1px;
  background: var(--ink);
  transform: scaleX(0); transform-origin: 0 50%;
  transition: transform .7s var(--ease);
}
.work:hover::before, .work:focus-within::before { transform: scaleX(1); }

/* Plate number: on the rule, above the photograph. Never over it. */
.work-media .stamp {
  position: absolute; left: 0; top: 0; z-index: 2;
  font-size: 10px; line-height: 1; letter-spacing: .2em;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  mix-blend-mode: normal;
  transition: color .4s var(--ease);
}
.work:hover .stamp, .work:focus-within .stamp { color: var(--ink); }

.work-media {
  /* static + no will-change so the stamp escapes this box's clip and sits on
     the rule above. motion.js only ever transforms the child img. */
  position: static;
  will-change: auto;
  overflow: hidden;
  background: var(--paper-2);
  aspect-ratio: 4 / 3;
}
.work.size-large .work-media { aspect-ratio: 16 / 9; }
.work.size-medium .work-media { aspect-ratio: 3 / 2; }

.work-media img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 45%;
  /* ponytail: a flat grade across 22 photos of very uneven origin — they read
     as one commissioned set instead of a folder. Raise only if a client
     supplies a consistently shot library. */
  filter: saturate(.93) contrast(1.03);
  transition: filter .8s var(--ease);
}
.work:hover .work-media img { filter: saturate(1) contrast(1.06); }

/* ── Caption ─────────────────────────────────────────────────────────────── */

.work-info {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: clamp(16px, 2vw, 40px);
  padding-top: 15px;
}
.work-info .title {
  font-size: clamp(16px, 1.35vw, 21px);
  letter-spacing: -0.024em; line-height: 1.16;
}
.work-info .desc {
  font-size: 12px; letter-spacing: .015em; color: var(--muted);
  margin-top: 5px;
}
.work-info .loc {
  font-size: 10px; letter-spacing: .17em; text-transform: uppercase;
  color: var(--muted); white-space: nowrap;
}

/* ─────────────────────────────────────────────────────────────────────────────
   AT DESKTOP: a fixed five-plate cadence, so the page has a measure instead of
   a masonry accident. Band / wide+portrait / portrait+wide, then repeat.
   ──────────────────────────────────────────────────────────────────────────── */

@media (min-width: 1181px) {

  /* 1 — the band. Full measure, the practice's own horizon line. */
  .works:not(.flat) .work:nth-child(5n + 1) { grid-column: 1 / 13; }
  .works:not(.flat) .work:nth-child(5n + 1) .work-media { aspect-ratio: 2 / 1; }
  .works:not(.flat) .work:nth-child(5n + 1) .work-info { padding-top: 20px; }
  .works:not(.flat) .work:nth-child(5n + 1) .title { font-size: clamp(22px, 2.1vw, 34px); letter-spacing: -0.03em; }
  .works:not(.flat) .work:nth-child(5n + 1) .desc { font-size: 13px; }
  .works:not(.flat) .work:nth-child(5n + 1) .loc { font-size: 11px; }

  /* 2 — wide, held to the left margin. */
  .works:not(.flat) .work:nth-child(5n + 2) { grid-column: 1 / 8; }
  .works:not(.flat) .work:nth-child(5n + 2) .work-media { aspect-ratio: 3 / 2; }
  .works:not(.flat) .work:nth-child(5n + 2) .title { font-size: clamp(18px, 1.6vw, 26px); }

  /* 3 — portrait, hung off the right edge and dropped down the column.
     Too narrow to spread a caption across, so it stacks instead. */
  .works:not(.flat) .work:nth-child(5n + 3) { grid-column: 9 / 13; margin-top: clamp(48px, 6.5vw, 116px); }
  .works:not(.flat) .work:nth-child(5n + 3) .work-media { aspect-ratio: 4 / 5; }
  .works:not(.flat) .work:nth-child(5n + 3) .work-media img { object-position: 50% 42%; }
  .works:not(.flat) .work:nth-child(5n + 3) .work-info { display: block; }
  .works:not(.flat) .work:nth-child(5n + 3) .loc { display: block; margin-top: 7px; }

  /* 4 — portrait on the left. */
  .works:not(.flat) .work:nth-child(5n + 4) { grid-column: 1 / 6; }
  .works:not(.flat) .work:nth-child(5n + 4) .work-media { aspect-ratio: 4 / 5; }
  .works:not(.flat) .work:nth-child(5n + 4) .work-media img { object-position: 50% 42%; }

  /* 5 — wide on the right, dropped a little less. */
  .works:not(.flat) .work:nth-child(5n + 5) { grid-column: 7 / 13; margin-top: clamp(30px, 4vw, 76px); }
  .works:not(.flat) .work:nth-child(5n + 5) .work-media { aspect-ratio: 3 / 2; }
  .works:not(.flat) .work:nth-child(5n + 5) .title { font-size: clamp(17px, 1.45vw, 23px); }
}

/* ── Portrait originals ──────────────────────────────────────────────────────
   The cadence above is drawn for landscape photographs. Several of the covers are
   phone shots taken vertically, and the 2:1 opening band cropped one of them to a
   strip of render-flat facade with a bush in front of it — the building was gone.
   A portrait source keeps a portrait plate at every width and in every slot; only
   the shape of the box changes, the rhythm of the page is untouched.

   Placed after the 1181 block and above mobile.css's aspect overrides on purpose:
   media queries carry no specificity, so source order is what decides here. */
.works .work[data-ar="p"] .work-media { aspect-ratio: 4 / 5; }
.works .work[data-ar="p"] .work-media img { object-position: 50% 42%; }

@media (prefers-reduced-motion: reduce) {
  .work::before { transition: none; }
  .work-media img { transition: none; }
}

/* ── Featured strip on the home page ─────────────────────────────────────── */

.feat {
  display: grid;
  grid-template-columns: 1.18fr .82fr 1fr;
  column-gap: clamp(18px, 2.4vw, 44px);
  align-items: start;
}
.feat-card { border-top: 1px solid var(--rule); padding-top: 13px; position: relative; }
.feat-card::before {
  content: ""; position: absolute; left: 0; top: -1px; width: 100%; height: 1px;
  background: var(--ink); transform: scaleX(0); transform-origin: 0 50%;
  transition: transform .7s var(--ease);
}
.feat-card:hover::before, .feat-card:focus-visible::before { transform: scaleX(1); }
/* All three hang from one rule and share one proportion; the three column widths
   above do the varying. The previous revision offset each card by a different
   margin AND gave each a different aspect, so the row had a ragged top and a
   ragged bottom at once and read as three cards that failed to line up rather
   than as a decision. On the lavori page the stagger is legible because a
   five-plate cadence has the room to establish it; three cards in a row do not. */
/* Landscape, because the photographs are. The card was drawn at 4:5 back when the
   strip happened to be pointed at two vertical phone shots; against a wide
   architectural photograph the same crop keeps a metre of asphalt and throws the
   building away. */
.feat-card .media { aspect-ratio: 3 / 2; overflow: hidden; background: var(--paper-2); }
.feat-card .media img {
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 45%;
  filter: saturate(.93) contrast(1.03);
  transition: filter .8s var(--ease);
}
.feat-card:hover .media img { filter: saturate(1) contrast(1.06); }
.feat-card .title { margin-top: 15px; font-size: clamp(16px, 1.4vw, 22px); letter-spacing: -0.024em; line-height: 1.16; }
.feat-card .meta { font-size: 11px; letter-spacing: .13em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }

/* ── Services ────────────────────────────────────────────────────────────── */

.svc-list { border-top: 1px solid var(--rule-strong); }
.svc {
  display: grid; grid-template-columns: 72px minmax(0, 1fr) minmax(0, 1.5fr) 44px;
  gap: clamp(12px, 2.4vw, 40px);
  align-items: start;
  padding: clamp(22px, 3vw, 40px) 0;
  border-bottom: 1px solid var(--rule);
  transition: background .4s var(--ease), padding-left .4s var(--ease);
}
.svc:hover { background: var(--paper-2); padding-left: 14px; }
.svc .num { font-size: 11px; letter-spacing: .16em; color: var(--muted); padding-top: 6px; }
.svc .name { font-size: clamp(22px, 2.8vw, 42px); letter-spacing: -0.03em; line-height: 1.02; }
.svc .desc { color: var(--ink-2); font-size: 15px; padding-top: 5px; }
.svc .arr { justify-self: end; padding-top: 6px; color: var(--muted); transition: transform .4s var(--ease), color .4s var(--ease); }
.svc:hover .arr { transform: translateX(5px); color: var(--ink); }

/* ── Values ──────────────────────────────────────────────────────────────── */

.values { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(20px, 3vw, 56px); }
.value { border-top: 1px solid var(--rule-strong); padding-top: clamp(16px, 2vw, 26px); }
.value .n { font-size: 11px; letter-spacing: .16em; color: var(--muted); }
.value .title { font-size: clamp(19px, 1.9vw, 28px); letter-spacing: -0.026em; margin: 12px 0 12px; }
.value .body { color: var(--ink-2); font-size: 14px; line-height: 1.65; }

/* ── Timeline ────────────────────────────────────────────────────────────── */

/* Three columns, not four: the phase, what happened, and the plate number. The
   dedicated year column is gone — only two of the four phases have a date on
   record, and the other two stood as bare em-dashes, which reads as a table that
   failed to load rather than as a deliberate blank. The date each phase does have
   travels inside its own title. */
.timeline { border-top: 1px solid var(--rule-strong); }
.timeline-row {
  display: grid; grid-template-columns: minmax(0, 250px) minmax(0, 1fr) 78px;
  gap: clamp(12px, 2.4vw, 40px);
  align-items: start;
  padding: clamp(20px, 2.6vw, 34px) 0;
  border-bottom: 1px solid var(--rule);
}
.timeline-row .title { font-size: clamp(19px, 1.9vw, 29px); letter-spacing: -0.03em; line-height: 1.06; }
.timeline-row .desc { color: var(--ink-2); font-size: 14px; padding-top: 3px; }
/* Still flush with the measure — it is a plate number and it belongs on the grid
   — but the frame's hairline now stands outside it (base.css --frame-out), so it
   no longer looks like a figure resting on the page edge. */
.timeline-row .marker {
  font-size: 11px; letter-spacing: .14em; color: var(--muted);
  text-align: right; padding-top: 6px;
  font-variant-numeric: tabular-nums;
}

/* ── Video strip ─────────────────────────────────────────────────────────── */

.video-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: clamp(16px, 2.2vw, 40px); }
.video-card { position: relative; overflow: hidden; background: var(--ink); aspect-ratio: 4 / 3; }
.video-card video, .video-card img { width: 100%; height: 100%; object-fit: cover; }
.video-card video { position: absolute; inset: 0; opacity: 0; transition: opacity .7s var(--ease); }
.video-card.playing video { opacity: 1; }
.video-card .label {
  /* Stops short of the play target's corner: the longest caption used to run
     straight under the button at every width. */
  position: absolute; left: 14px; right: 60px; bottom: 12px; z-index: 2;
  font-size: 10px; letter-spacing: .17em; text-transform: uppercase; line-height: 1.4;
  color: var(--paper); text-shadow: 0 1px 12px rgba(0,0,0,.55);
}
.video-card .play {
  position: absolute; right: 14px; bottom: 12px; z-index: 2;
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(241,239,234,.55);
  display: grid; place-items: center; color: var(--paper);
}
.video-card .play svg { width: 12px; height: 12px; fill: currentColor; }

/* ── Section foot ────────────────────────────────────────────────────────── */

.section-foot { margin-top: clamp(40px, 5.5vw, 84px); display: flex; justify-content: center; }

/* 2026-09-23: four featured cards, and the project lightbox. */
.feat { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (min-width: 901px) and (max-width: 1180px) { .feat { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 40px; } }
.work > a[data-lightbox] { cursor: zoom-in; }

.lb {
  border: 0; padding: 0; margin: 0; max-width: none; max-height: none;
  width: 100vw; height: 100dvh; background: var(--ink); color: var(--paper); overflow: hidden;
}
.lb:not([open]) { display: none; }
.lb[open] { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; }
.lb-bar { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 16px var(--pad); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; }
.lb-stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 0 clamp(44px, 6vw, 90px); }
.lb-stage { overflow: hidden; }
.lb-stage img { max-width: 100%; max-height: calc(100dvh - 130px); width: auto; height: auto; object-fit: contain; }
.lb button { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; padding: 12px; }
.lb-prev, .lb-next { position: absolute; top: 50%; transform: translateY(-50%); font-size: 26px; }
.lb-prev { left: 0; } .lb-next { right: 0; }
.lb-foot { padding: 14px var(--pad) 18px; text-align: center; font-size: 11px; letter-spacing: .18em; color: rgba(241, 239, 234, .6); }

/* lavori.html: a flat 3-column grid, so the order the client asked for (original site order) reads in sequence. */
.works.flat { row-gap: clamp(40px, 5vw, 80px); }
.works.flat .work[data-ar] .work-media, .works.flat .work .work-media { aspect-ratio: 4 / 3; }
@media (max-width: 1180px) { .works.flat .work { grid-column: span 6; } }
@media (max-width: 700px) { .works.flat .work { grid-column: 1 / -1; } }

/* Residenza Stella photos on the home page: column widths follow each photo's own ratio, so equal heights and no cropping. */
.stella-strip { display: grid; grid-template-columns: 16fr 9fr 9fr; gap: clamp(12px, 1.6vw, 26px); align-items: start; }
.stella-photo { margin: 0; overflow: hidden; background: var(--paper-2); }
.stella-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (max-width: 900px) { .stella-strip { grid-template-columns: 1fr; } }
