/* ==========================================================================
   Pablo Climent — portfolio
   Plain CSS. Colors, spacing and type live in the tokens below.
   ========================================================================== */

:root {
  --bg: #f5f4f0;
  --fg: #111111;
  --mute: #77756e;
  --line: #e1dfd9;
  --tile: #e6e4de;
  --ink-inv: 0.2;      /* lights off: logos take the page's ink (dark gray #333 on the light theme, off-white on the dark one) */
  --bulb-on: transparent;     /* the bulb works the other way round on the light theme: lit = empty, lights off = filled */
  --bulb-off: var(--mute);

  --pad: clamp(20px, 4vw, 64px);   /* page side padding */
  --gap: clamp(24px, 3.2vw, 52px);   /* gap between tiles (the mosaic's row unit is built on it, see app.js layoutGrid) */

  --sans: "Inter", "Helvetica Neue", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  color-scheme: light dark;
}

/* Dark theme: automatic from the system, unless the visitor picked one with the switch (html[data-theme]) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d0d0d;
    --fg: #f1f0ec;
    --mute: #8a8880;
    --line: #232323;
    --tile: #1a1a1a;
    --ink-inv: 0.94;
    --bulb-on: var(--mute);
    --bulb-off: transparent;
  }
}
:root[data-theme="dark"] {
  --bg: #0d0d0d;
  --fg: #f1f0ec;
  --mute: #8a8880;
  --line: #232323;
  --tile: #1a1a1a;
  --ink-inv: 0.94;
  --bulb-on: var(--mute);
  --bulb-off: transparent;
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

*, *::before, *::after { box-sizing: border-box; }

html {
  background: var(--bg);              /* the canvas itself is never the browser's default white, even for the instant a layer is repainted */
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;                 /* the page never moves sideways... */
  overscroll-behavior-x: none;        /* ...not even with the rubber band */
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;                   /* clip (not hidden) so the sticky header keeps working */
  touch-action: pan-y pinch-zoom;     /* vertical drag only */
}

body:has(dialog[open]) { overflow: hidden; }

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

:focus-visible { outline: 2px solid var(--fg); outline-offset: 3px; }

[hidden] { display: none !important; }

/* ---------- Header ---------- */
.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  padding: 22px var(--pad);
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--bg) 94%, transparent);   /* no backdrop-filter: blurring what is behind a sticky bar makes the browser repaint the WHOLE page whenever a video starts, which showed as a white flash */
}
.brand { display: flex; align-items: baseline; gap: 12px; flex: 0 0 auto; white-space: nowrap; }   /* name and role always on ONE line */
.brand:hover { text-decoration: none; }
.brand-name { font-weight: 600; letter-spacing: -0.01em; }
.brand-role { color: var(--mute); }
.top nav { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: baseline; gap: 6px 22px; }
.tools { display: flex; gap: 16px; padding-left: 22px; border-left: 1px solid var(--line); }
.tool { font: 11px/1.5 var(--mono); text-transform: uppercase; letter-spacing: 0.04em; color: var(--mute); }
.tool:hover { color: var(--fg); }

/* ---------- Intro ---------- */
.intro { padding: clamp(56px, 11vw, 160px) var(--pad) clamp(48px, 8vw, 112px); }
.tagline {
  margin: 0;
  white-space: pre-line;             /* the line break in the text ("Design +" / "motion graphics") is kept */
  max-width: 20ch;
  font-weight: 500;
  font-size: clamp(30px, 5.2vw, 76px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

/* ---------- Filters ---------- */
.toolbar { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px 24px; padding: 0 var(--pad) clamp(24px, 3vw, 40px); }
.views { margin-left: auto; display: flex; gap: 18px; font: 12px/1.5 var(--mono); text-transform: uppercase; letter-spacing: 0.04em; }
.views button { color: var(--mute); padding: 4px 0; border-bottom: 1px solid transparent; }
.views button:hover { color: var(--fg); }
.views button[aria-pressed="true"] { color: var(--fg); border-bottom-color: var(--fg); }
.views .light[aria-pressed="true"] { color: var(--mute); border-bottom-color: transparent; }
.views .light[aria-pressed="true"]:hover { color: var(--fg); }
/* the lights switch: a thin line bulb. Dark theme: lit = filled with the page's gray, lights off = outline only. Light theme: the other way round
   (lit = outline only, lights off = filled), see --bulb-on / --bulb-off. */
.views .light { display: inline-flex; align-items: center; align-self: center; padding: 4px 6px 4px 0; border-bottom: 0; color: var(--mute); }
.views .light:hover { color: var(--fg); }
.light svg { display: block; overflow: visible; stroke: currentColor; stroke-width: 1.25; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.light .glass { fill: var(--bulb-on); }
.light[aria-pressed="true"] .glass { fill: var(--bulb-off); }
/* the copy of the bulb that sits right after the project's name in the viewer (logo projects only; placed by app.js titleBulb) */
/* It behaves like a superscript of the last word: small (about half the title's size), hugging the word and raised to its cap
   height (top-aligned to the line, nudged down to the cap line). Being inline, it follows the last word even when the title wraps,
   and it cannot make that line taller. */
.light-title { display: inline-block; vertical-align: top; margin: 0.07em 0 0 1px; padding: 3px 4px 4px 3px; line-height: 1; color: var(--mute); }
.light-title svg { display: block; height: 0.5em; width: auto; }
.light-title:hover { color: var(--fg); }

.filters {
  display: flex;
  gap: 18px;
  padding: 0;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.filters button { color: var(--mute); padding: 4px 0; border-bottom: 1px solid transparent; }
.filters button:hover { color: var(--fg); }
.filters button[aria-pressed="true"] { color: var(--fg); border-bottom-color: var(--fg); }
.filters sup { font-size: 9px; margin-left: 2px; }
.filters .sub { display: flex; gap: 18px; padding-left: 18px; border-left: 1px solid var(--line); }
.filters { flex-wrap: wrap; }

/* ---------- Grid: a clean masonry with holes ----------
   A strict grid of square units (--cols columns, row height --u = column width; both set by layoutGrid() in app.js).
   Every tile spans a footprint of columns x rows (style.gridColumn / gridRow, also set in app.js): some are bigger than
   others, and the vertical ones cross their line and take two. "dense" lets later tiles fill the gaps. The media
   fills its footprint (object-fit: cover); the caption sits under it. */
.grid {
  --cols: 12;
  --u: 90px;
  display: grid;
  grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  grid-auto-rows: var(--row, 8px);                   /* thin rows: a tile takes exactly the height it needs (app.js layoutGrid) */
  grid-auto-flow: dense;
  gap: 0 var(--gap);                                 /* the space BETWEEN rows of tiles is each card's padding-bottom */
  padding: 0 var(--pad);
}

.card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  padding-bottom: var(--gap);
}
.card:hover { text-decoration: none; }
/* "fit" tiles = every bitmap (photos, posters, video stills): they keep their exact proportion (--ar): the media is never cropped,
   and the card takes the rows that needs (app.js layoutGrid). Logo panels (.media.vec) are the flexible ones. */
.card.fit { align-self: start; }
.card.fit .media { flex: none; aspect-ratio: var(--ar); }

.media {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  background: var(--tile);
  border-radius: 2px;
}
.media img,
.media video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.card[data-group="design"] .media img { object-position: center top; }   /* tall pages: show the top */
.media video { opacity: 0; transition: opacity 0.35s ease; }
.media video.on { opacity: 1; }

.cap {
  flex: none;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  font-size: 13px;
  line-height: 1.3;
}
.card { container-type: inline-size; }
@container (max-width: 190px) { .cap { flex-direction: column; gap: 2px; } }   /* narrow vertical tiles: title above meta */
.cap .t { font-weight: 500; }
.cap .m { color: var(--mute); font-family: var(--mono); font-size: 11px; white-space: nowrap; padding-top: 1px; }
.card:hover .t, .card:focus-visible .t { text-decoration: underline; text-underline-offset: 3px; }

.status { padding: 24px var(--pad); color: var(--mute); }
.status:empty { display: none; }

/* ---------- About / Contact ---------- */
/* The text sits close to its small gray title: a narrow label column (--lab), then the content. In About the portrait goes BELOW the
   paragraph (above "Hello"), left-aligned with it. A circle touches the text's left edge at a single point and so looks indented,
   which is why it is pulled out by a few percent of its diameter: optical alignment (the text's own side bearing is about 1 px). */
.about, .contact {
  --lab: clamp(84px, 8vw, 112px);
  display: grid;
  grid-template-columns: var(--lab) minmax(0, 1fr);
  gap: 28px clamp(20px, 2.6vw, 36px);
  padding: clamp(96px, 13vw, 200px) var(--pad) 0;
}
.about-body { display: flex; flex-direction: column; align-items: flex-start; gap: clamp(22px, 2.2vw, 30px); }   /* paragraph -> portrait */
.about-text { min-width: 0; }
.about + .contact { padding-top: clamp(52px, 5.2vw, 76px); }   /* portrait -> "Hello": the three read as one group */
.about-photo {
  --photo: clamp(120px, 11vw, 160px);
  flex: none;
  width: var(--photo);
  height: var(--photo);
  margin-left: calc(var(--photo) * -0.035);        /* optical alignment */
  border-radius: 50%;
  object-fit: cover;
  background: var(--tile);
  display: block;
}
.label {
  margin: 0;
  font: 500 12px/1.5 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mute);
}
/* About text: body copy */
.about-text p {
  margin: 0 0 1em;
  font-size: clamp(17px, 1.7vw, 22px);
  line-height: 1.4;
  letter-spacing: -0.01em;
  max-width: 22em;                   /* one compact paragraph (about 6 lines): the portrait takes its height, so a narrower block = a bigger portrait */
}


.foot {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: clamp(80px, 12vw, 160px) var(--pad) 32px;
  color: var(--mute);
  font-size: 13px;
}

@media (max-width: 760px) {
  .about, .contact { grid-template-columns: 1fr; gap: 20px; }
}

/* ---------- Viewer (native <dialog>) ---------- */
.viewer {
  width: 100vw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: var(--bg);
  color: var(--fg);
  overflow-y: auto;
  overflow-x: hidden;
  touch-action: pan-y pinch-zoom;
}
.viewer[open] { display: flex; flex-direction: column; }
.viewer::backdrop { background: var(--bg); }

.viewer-bar {
  position: sticky;                     /* always reachable: the Close button never scrolls away */
  top: 0;
  z-index: 3;
  background: var(--bg);
  display: flex;
  flex-wrap: wrap;                      /* narrow phones: the actions wrap instead of running off the screen */
  justify-content: space-between;
  align-items: center;
  gap: 6px 16px;
  flex: none;
  padding: 20px var(--pad);
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.viewer-count { color: var(--mute); }
.viewer-actions { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-left: auto; }
.txt { font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.txt:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ONE column for every project (video, gallery, grid of videos): .viewer-main is as wide as its media, centered on the page,
   and everything inside it (title, data, description, media, carousel) is left-aligned, so the text lines up with the media's
   left edge. --mw = the media's width: a video takes the height left under the text (--stage-h) at its own ratio (--ar,
   set by app.js); galleries have a fixed width. The column is never narrower than 360 px, so the text of a tall video
   does not wrap into a sliver (the media stays left-aligned inside it). */
.viewer-main {
  --stage-h: calc(100dvh - 250px);                       /* room for the media under the bar and the text */
  --mw: round(down, calc(var(--stage-h) * var(--ar, 1.7778)), 2px);   /* whole pixels: a fractional box edge shows a 1px line */
  width: min(calc(100% - 2 * var(--pad)), max(var(--mw), 360px));
  margin: 0 auto;
  padding-bottom: clamp(48px, 7vw, 96px);
}
.has-clips .viewer-main { --stage-h: calc(100dvh - 450px); }   /* ...and under the carousel too (thumbnails + titles) */
.is-gallery .viewer-main { --mw: 1000px; }
.is-tiles .viewer-main { --mw: 1100px; }
.is-vgrid .viewer-main { --mw: 1240px; }
.viewer-stage { display: block; }
.viewer-foot { display: flex; justify-content: flex-end; margin-top: clamp(40px, 6vw, 72px); font-size: 13px; color: var(--mute); }   /* like the home's footer */
.viewer-foot a:hover { text-decoration: underline; text-underline-offset: 3px; }
.player {
  --ar: 1.7778;
  width: min(100%, var(--mw));
  aspect-ratio: var(--ar);                 /* app.js replaces it with the exact "width / height" of the video */
  background: var(--tile);                 /* never black: on fractional-pixel screens a black box edge shows as a 1px line */
  border-radius: 2px;
  overflow: hidden;
}
.player:has(iframe) { background: #000; }
/* object-fit: cover fills the box to the last pixel (the video already has the box's exact ratio, so nothing is cropped) */
.player video { width: 100%; height: 100%; display: block; border: 0; background: transparent; object-fit: cover; }
.player iframe { width: 100%; height: 100%; display: block; border: 0; background: #000; }

/* design projects: images stacked, info first, the whole viewer scrolls */
.player.gallery {
  width: 100%;                             /* the column (.viewer-main) already has the gallery's width */
  aspect-ratio: auto;
  background: none;
  display: grid;
  gap: var(--gap);
  overflow: visible;
}
.player.gallery img { width: 100%; height: auto; display: block; background: var(--tile); border-radius: 2px; }
/* "layout": "tiles": masonry of small images (columns built in app.js). Images keep their own proportions: never stretched,
   never cropped, never bigger than their real size; gaps between them are fine. */
.player.gallery.tiles { display: block; }
.masonry { display: flex; align-items: flex-start; gap: var(--gap); }
.mcol { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: var(--gap); }
.player.gallery.tiles img {
  width: 100%;
  height: auto;                           /* proportion from the width/height attributes; never stretched */
  flex: none;
  background: #fff;                       /* line art: always on white, like the paper */
}
/* title, data line and description: always ABOVE the media, in the same column, left-aligned with it */
.viewer-info { display: grid; gap: 0; justify-items: start; padding: 8px 0 clamp(24px, 3vw, 36px); }
.viewer-info h2 { margin: 0; font-weight: 500; font-size: clamp(22px, 2.6vw, 32px); letter-spacing: -0.02em; line-height: 1.1; }
.viewer-meta { margin: 10px 0 0; color: var(--mute); font: 12px/1.4 var(--mono); text-transform: uppercase; letter-spacing: 0.04em; }
/* Project description: the SAME style as the gray data line above it (.viewer-meta): same mono font, size,
   color and tracking, in sentence case so a whole paragraph stays readable. */
.viewer-desc {
  margin: 14px 0 0;
  max-width: 62ch;
  font: 12px/1.65 var(--mono);
  letter-spacing: 0.04em;
  color: var(--mute);
}
.viewer-desc:empty { display: none; }
/* Standard link inside a description: blue + underlined (the only external link on the site, asked for by Pablo) */
.viewer-desc a { color: #0b57d0; text-decoration: underline; text-underline-offset: 2px; }
.viewer-desc a:hover { color: #0842a0; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .viewer-desc a { color: #7ab0ff; }
  :root:not([data-theme="light"]) .viewer-desc a:hover { color: #a9caff; }
}
:root[data-theme="dark"] .viewer-desc a { color: #7ab0ff; }
:root[data-theme="dark"] .viewer-desc a:hover { color: #a9caff; }
@media (max-width: 700px) {
  .viewer-main { --stage-h: calc(100dvh - 230px); }              /* phones: the video may use the full width; scrolling is natural there */
  .has-clips .viewer-main { --stage-h: calc(100dvh - 380px); }
  .viewer-actions { gap: 6px 16px; }
  .clips { margin-top: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .media video { transition: none; }
}

/* Phones: brand on its own line, menu + switches below it */
@media (max-width: 560px) {
  .top { flex-direction: column; align-items: flex-start; gap: 4px; padding-top: 12px; padding-bottom: 10px; }
  .top nav { justify-content: flex-start; gap: 4px 16px; }
  .tools { gap: 12px; padding-left: 16px; }
}

/* ---------- Contact form ---------- */
.contact-body { display: grid; gap: 18px; justify-items: start; max-width: 640px; }
.mail { margin: 0; font-weight: 500; font-size: clamp(26px, 5vw, 68px); letter-spacing: -0.035em; line-height: 1; }
.cform { display: grid; gap: 22px; width: 100%; }
.field { display: grid; gap: 6px; font: 11px/1.4 var(--mono); text-transform: uppercase; letter-spacing: 0.04em; color: var(--mute); }
.field input, .field textarea {
  font: 400 16px/1.4 var(--sans);                 /* 16px also stops iOS from zooming on focus */
  text-transform: none;
  letter-spacing: normal;
  color: var(--fg);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  padding: 8px 0;
  width: 100%;
  resize: vertical;
}
.field input:focus, .field textarea:focus { outline: 0; border-bottom-color: var(--fg); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }   /* honeypot, off-screen (not display:none) */
.cform-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; }
.send {
  font: 12px/1 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 12px 22px;
  border: 1px solid var(--fg);
  border-radius: 2px;
  color: var(--bg);
  background: var(--fg);
}
.send:hover { opacity: 0.85; }
.send:disabled { opacity: 0.5; cursor: progress; }
.cform-status { margin: 0; font-size: 14px; }
.cform-status[data-kind="ok"] { color: var(--fg); }
.cform-status[data-kind="error"] { color: #c0392b; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .cform-status[data-kind="error"] { color: #ff8a7a; } }
:root[data-theme="dark"] .cform-status[data-kind="error"] { color: #ff8a7a; }

/* ---------- List view: an alphabetical index by client ---------- */
.list-wrap { padding: 0 var(--pad); }
.list-head, .row {
  display: grid;
  grid-template-columns: minmax(130px, 1.2fr) minmax(160px, 1.6fr) minmax(120px, 1.3fr) 56px minmax(110px, 0.8fr);
  gap: 0 var(--pad);
  align-items: baseline;
}
.list-head {
  padding: 8px 0;
  border-bottom: 1px solid var(--fg);
  font: 11px/1.4 var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mute);
}
.list { list-style: none; margin: 0; padding: 0; }
.item { border-bottom: 1px solid var(--line); }
.row { padding: 14px 0; font-size: 15px; line-height: 1.3; }
.row:hover { text-decoration: none; }
.row .c-client { font-weight: 500; letter-spacing: -0.01em; }
.row .c-client.rep { color: var(--mute); font-weight: 400; }
.row .name { display: block; }
.row .sub { display: block; margin-top: 2px; color: var(--mute); font-size: 13px; }
.row .c-type, .row .c-year, .row .c-format { color: var(--mute); font: 12px/1.4 var(--mono); text-transform: uppercase; letter-spacing: 0.03em; }
.row .c-year { font-variant-numeric: tabular-nums; }
.row .none { color: var(--mute); }
@media (hover: hover) {
  .list:hover .row { opacity: 0.4; transition: opacity 0.15s; }
  .list .row:hover, .list .row:focus-visible { opacity: 1; }
}

/* the floating preview that follows the cursor over a row (mouse only) */
.peek {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 20;
  pointer-events: none;
  overflow: hidden;
  border-radius: 2px;
  background: var(--tile);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
  will-change: transform;
}
.peek img, .peek video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.peek video { opacity: 0; transition: opacity 0.2s; }
.peek video.on { opacity: 1; }

@media (max-width: 700px) {
  .list-head { display: none; }
  .row {
    grid-template-columns: 1fr auto;
    grid-template-areas: "client year" "name format" "type type";
    gap: 2px 12px;
    padding: 12px 0;
  }
  .row .c-client { grid-area: client; }
  .row .c-name { grid-area: name; }
  .row .c-type { grid-area: type; text-transform: none; font-family: var(--sans); font-size: 12px; }
  .row .c-year { grid-area: year; text-align: right; }
  .row .c-format { grid-area: format; text-align: right; }
}

/* ---------- Carousel of extra videos under the player ---------- */
.clips {
  width: 100%;
  max-width: var(--mw);                     /* never wider than the media above it; left-aligned like everything else */
  margin-top: clamp(28px, 3.4vw, 44px);
  display: flex;
  gap: 10px;
  justify-content: flex-start;
  overflow-x: auto;
  padding: 2px 2px 8px;
  scrollbar-width: thin;
  touch-action: pan-x pan-y;                /* the one place that scrolls sideways */
}
/* A thumbnail + its title underneath: truncated to the thumbnail's width, in the font of the small gray line above the project
   (.viewer-meta: mono, 12 px, 0.04em, --mute) but in normal case. Thumbnails share one height (--th), so a vertical one is narrow
   (its title column is never narrower than 96 px). The current one is marked with a 1 px outline in that same gray, nothing else. */
.clips { --th: clamp(96px, 9vw, 128px); align-items: flex-start; gap: 18px; }
.clip {
  flex: none;
  display: grid;
  gap: 9px;
  justify-items: stretch;
  width: max(calc(var(--th) * var(--ar)), 96px);
  text-align: left;
  color: var(--mute);
}
.clip .th {
  position: relative;
  display: block;
  height: var(--th);
  width: calc(var(--th) * var(--ar));
  border-radius: 2px;
  overflow: hidden;
  background: var(--tile);
  outline: 1px solid transparent;
}
.clip .lbl {
  display: block;
  min-width: 0;
  font: 12px/1.4 var(--mono);
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.clip[aria-current="true"] .th { outline-color: var(--mute); }
.clip img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.clip .dur { position: absolute; right: 4px; bottom: 3px; font: 10px/1 var(--mono); color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8); }

/* ---------- Vector images (SVG logos): on a neutral panel with plenty of empty space around them ----------
   The logo is drawn inside a box of --logo-w x --logo-h of the panel (so over half of the panel stays empty),
   centered, then lifted by --lift % of the panel height for optical centering (a mathematically centered logo
   looks too low; the lift is set from js, default 4). The panel is always the same light neutral, in both themes,
   so a black logo never disappears on the dark theme. */
:root { --vec-bg: #efeee9; --logo-w: 44%; --logo-h: 50%; }

.media.vec,
.peek.vec { background: var(--vec-bg); }
.media.vec img,
.card[data-group] .media.vec img,       /* same weight as ".card[data-group=design] .media img" (top-aligned pages), which must NOT win here */
.peek.vec img {
  inset: auto;
  left: calc((100% - var(--logo-w)) / 2);
  top: calc((100% - var(--logo-h)) / 2 - var(--thumb-lift, 0) * 1%);   /* thumbnails: EXACT center by default (Pablo, 2026-11-24); a project can raise it with "thumb_lift"; the viewer keeps --lift */
  width: var(--logo-w);
  height: var(--logo-h);
  object-fit: contain;
  object-position: center;
}

.player.gallery figure.vec {
  position: relative;
  margin: 0;                                  /* left-aligned with the title above it */
  width: min(100%, calc(72vh * 1.6));
  aspect-ratio: 16 / 10;
  border-radius: 2px;
  overflow: hidden;
  background: var(--vec-bg);
}
.player.gallery figure.vec img {
  position: absolute;
  left: calc((100% - var(--logo-w)) / 2);
  top: calc((100% - var(--logo-h)) / 2 - var(--lift, 4) * 1%);
  width: var(--logo-w);
  height: var(--logo-h);
  max-height: none;
  padding: 0;
  object-fit: contain;
  background: transparent;
  border-radius: 0;
}

/* ---------- A video inside a gallery (mixed projects) ---------- */
.player.gallery figure.vid {
  position: relative;
  margin: 0;
  width: min(100%, calc(76vh * var(--ar)));
  background: var(--tile);
  border-radius: 2px;
  overflow: hidden;
}
.player.gallery figure.vid video { width: 100%; height: 100%; display: block; object-fit: cover; background: transparent; }

/* ---------- "layout": "videogrid": many videos as a grid of stills; click = play (loop), controls only on hover ---------- */
.player.gallery.vgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(20px, 3.2vw, 44px); align-items: start; }   /* 3 across, big and with air; 2 on small tablets, 1 on phones */
@media (max-width: 760px) { .player.gallery.vgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .player.gallery.vgrid { grid-template-columns: 1fr; gap: 24px; } }   /* phones: one column, a tap goes full screen */
.vcell video:fullscreen { object-fit: contain; background: #000; }
.vcell video:-webkit-full-screen { object-fit: contain; background: #000; }
.vcell { position: relative; margin: 0; overflow: hidden; border-radius: 2px; background: var(--tile); cursor: pointer; }
.player.gallery.vgrid .vcell img,
.vcell video { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; background: transparent; }
.vcell:not(.on)::after, .vcell:not(.on)::before {   /* small play mark that shows when the pointer is over a still */
  content: ""; position: absolute; left: 50%; top: 50%; opacity: 0; transition: opacity .15s; pointer-events: none;
}
.vcell:not(.on)::after { width: 44px; height: 44px; margin: -22px 0 0 -22px; border-radius: 50%; background: rgba(0, 0, 0, .5); }
.vcell:not(.on)::before {
  z-index: 1; width: 0; height: 0; margin: -8px 0 0 -5px;
  border-style: solid; border-width: 8px 0 8px 14px; border-color: transparent transparent transparent #fff;
}
.vcell:not(.on):hover::after, .vcell:not(.on):focus-visible::after,
.vcell:not(.on):hover::before, .vcell:not(.on):focus-visible::before { opacity: 1; }
.vcell:focus-visible { outline: 2px solid var(--fg, currentColor); outline-offset: 2px; }

/* ---------- Lights off (the bulb next to "Grid"): instant, no animation ----------
   Logo panels lose their background (neutral or the brand's own), and every vector logo becomes one flat ink: black, then
   inverted to the page's off-white (not pure white). Bitmap logos cannot be recolored: that project (Tech Side) is hidden (app.js). */
:root[data-lights="off"] .media.vec:not(.keep),
:root[data-lights="off"] .peek.vec:not(.keep),
:root[data-lights="off"] .player.gallery figure.vec:not(.keep) { background: transparent !important; box-shadow: none; }
:root[data-lights="off"] .media.vec:not(.keep) img,
:root[data-lights="off"] .peek.vec:not(.keep) img,
:root[data-lights="off"] .player.gallery figure.vec:not(.keep) img { filter: brightness(0) invert(var(--ink-inv)); }
/* ".keep" (project field "lights_keep": Philips): logos that do not work in a single color keep their panel and colors */
