/* ==========================================================================
   DIVLAB PROJECT — single-project layout
   --------------------------------------------------------------------------
   Markup comes from dvl_projects_render() in divlab-projects.php.

   Every rule is scoped under .dvl-project at specificity (0,2,0) or more.
   That is not fussiness: the Elementor kit writes `.elementor-kit-N h1`,
   `h2`, `a` at (0,1,1), which beats a single class, and Hello's reset styles
   dl/dd/figure bare. A lone `.dvl-project__title` loses to all of them.

   The media stack is edge-to-edge, so the container holding the shortcode
   must be FULL WIDTH with ZERO padding. The text rows carry their own
   gutter — the same clamp as every other DivLab page, so the title lines up
   with the logo in the header.
   ========================================================================== */

.dvl-project {
  /* ---- palette ---- */
  --dvl-project-ink: #3A301E;                     /* "Divlab font dark" */
  --dvl-project-ink-soft: rgba(58, 48, 30, 0.5);  /* the <LABEL> tags */

  /* ---- type ----
     IBM_Plex_Mono with UNDERSCORES is the family name the site's own
     @font-face rules register; the spaced name is the fallback for
     anywhere else. */
  --dvl-project-font: "Inter", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --dvl-project-font-mono: "IBM_Plex_Mono", "IBM Plex Mono", ui-monospace,
                           "SFMono-Regular", Menlo, Consolas, monospace;

  /* Measured off the comp at 1185px wide; the vw terms reproduce it there
     and scale with it. */
  --dvl-project-title-size: clamp(40px, 4.7vw, 88px);
  --dvl-project-body-size: clamp(13px, 1.05vw, 18px);
  --dvl-project-label-size: clamp(10px, 0.76vw, 13px);

  /* ---- rhythm ---- */
  --dvl-project-pad: clamp(24px, 4.2vw, 62px);           /* side gutter */
  --dvl-project-top: clamp(96px, 20vw, 300px);           /* above the title */
  --dvl-project-head-gap: clamp(56px, 10.2vw, 170px);    /* title -> details */
  --dvl-project-meta-gap: clamp(28px, 3.1vw, 52px);      /* details -> media */
  --dvl-project-bottom: clamp(64px, 8vw, 140px);         /* after the stack */

  /* ---- the stack ----
     The comp shows a single frame, so the gap between frames is a guess:
     set it to 0 for one continuous strip. Inset > 0 pulls the media in off
     the edges (e.g. var(--dvl-project-pad) to align with the text). */
  --dvl-project-media-gap: clamp(12px, 1.25vw, 20px);
  --dvl-project-media-inset: 0px;
  /* Rows of natural-size items (phone screens): the space between them,
     and the extra air above and below the row so it doesn't butt into the
     full-width frames either side. */
  --dvl-project-row-gap: clamp(16px, 2.5vw, 40px);
  --dvl-project-row-pad: clamp(16px, 3.5vw, 64px);

  /* THE Z-INDEX TRAP: a full-bleed block needs its own stacking layer, or
     a fixed canvas later in the DOM (dvl-stage.js) paints over it. */
  position: relative;
  z-index: 1;

  display: block;
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0 0 var(--dvl-project-bottom);
  box-sizing: border-box;
  color: var(--dvl-project-ink);
  font-family: var(--dvl-project-font);
}

.dvl-project *,
.dvl-project *::before,
.dvl-project *::after {
  box-sizing: border-box;
}

/* part="head|meta|media": each shortcode renders its own <article>, so only
   the one holding the head gets the top space, and only the last the bottom. */
.dvl-project.dvl-project--meta,
.dvl-project.dvl-project--head {
  padding-bottom: 0;
}

/* ---------------------------------------------------------------- head */

.dvl-project .dvl-project__head {
  padding: var(--dvl-project-top) var(--dvl-project-pad) 0;
}

.dvl-project .dvl-project__title {
  margin: 0;
  padding: 0;
  color: var(--dvl-project-ink);
  font-family: var(--dvl-project-font);
  font-size: var(--dvl-project-title-size);
  font-weight: 400;
  font-style: normal;
  line-height: 1.1;
  letter-spacing: -0.04em;
  text-transform: none;
  /* The site's Inter is a variable font with an opsz axis (14-32). Left on
     auto, a heading this size switches to the Display cut, whose tighter
     sidebearings plus the negative tracking make it read cramped against
     the comp, which is set in the Text cut. */
  font-optical-sizing: none;
  font-variation-settings: "opsz" 14;
  /* Hanging the tracking back: letter-spacing is applied after the last
     glyph too, so the ink sits |tracking| short of the box's right edge. */
  padding-right: 0.04em;
  text-wrap: balance;
}

.dvl-project .dvl-project__tag,
.dvl-project .dvl-project__label {
  margin: 0;
  padding: 0;
  color: var(--dvl-project-ink-soft);
  font-family: var(--dvl-project-font-mono);
  font-size: var(--dvl-project-label-size);
  font-weight: 400;
  font-style: normal;
  line-height: 1.3;
  letter-spacing: 0;
  text-transform: uppercase;
}

.dvl-project .dvl-project__tag {
  margin-top: 1em;
}

/* The <LABEL> brackets are decoration, so they come from CSS: a screen
   reader hears "Date", not "less-than Date greater-than". The second
   `content` gives them empty alt text where supported; the first is the
   fallback for browsers that reject the slash syntax. */
.dvl-project .dvl-project__label::before {
  content: "<";
  content: "<" / "";
}
.dvl-project .dvl-project__label::after {
  content: ">";
  content: ">" / "";
}

/* ---------------------------------------------------------------- meta
   The comp's columns, measured as fractions of the content width at 1185:
     description   0     -> 50.2%
     (air)         50.2% -> 60.6%
     date / link   60.6% -> 72.2%
     category/role 72.2% -> 100%
   ------------------------------------------------------------------------ */

.dvl-project .dvl-project__meta {
  display: grid;
  grid-template-columns: minmax(0, 50.2fr) minmax(0, 10.4fr) minmax(0, 39.4fr);
  align-items: start;
  margin: 0;
  padding: var(--dvl-project-head-gap) var(--dvl-project-pad) 0;
}

/* Without a head above it (part="meta"), the meta row keeps only the top
   space the head would have had. */
.dvl-project.dvl-project--meta .dvl-project__meta {
  padding-top: var(--dvl-project-top);
}

.dvl-project .dvl-project__about {
  grid-column: 1;
}

.dvl-project .dvl-project__text,
.dvl-project .dvl-project__value {
  color: var(--dvl-project-ink);
  font-family: var(--dvl-project-font);
  font-size: var(--dvl-project-body-size);
  font-weight: 300;
  line-height: 1.45;
  letter-spacing: -0.01em;
}

.dvl-project .dvl-project__text {
  margin-top: 0.45em;
}

.dvl-project .dvl-project__text p {
  margin: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}
.dvl-project .dvl-project__text p + p {
  margin-top: 1em;
}

.dvl-project .dvl-project__facts {
  grid-column: 3;
  display: grid;
  grid-template-columns: minmax(0, 29.5fr) minmax(0, 70.5fr);
  column-gap: 16px;
  row-gap: clamp(8px, 0.85vw, 16px);
  margin: 0;
  padding: 0;
}

.dvl-project .dvl-project__fact {
  margin: 0;
  padding: 0;
  min-width: 0;
}

.dvl-project .dvl-project__value {
  margin: 0.3em 0 0;
  padding: 0;
  overflow-wrap: anywhere;
}

/* The launch link. Kit hover/visited colours come in at (0,2,1) with
   :hover, so the colour is locked with !important on every state. */
.dvl-project .dvl-project__launch,
.dvl-project .dvl-project__launch:link,
.dvl-project .dvl-project__launch:visited,
.dvl-project .dvl-project__launch:hover,
.dvl-project .dvl-project__launch:focus,
.dvl-project .dvl-project__launch:active {
  color: var(--dvl-project-ink) !important;
  font: inherit;
  text-transform: uppercase;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
  box-shadow: none;
}
.dvl-project .dvl-project__launch:hover {
  text-decoration-thickness: 2px;
}
.dvl-project .dvl-project__launch:focus-visible {
  outline: 1px solid var(--dvl-project-ink);
  outline-offset: 4px;
}

.dvl-project .dvl-project__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* --------------------------------------------------------------- media */

.dvl-project .dvl-project__media {
  display: flex;
  flex-direction: column;
  gap: var(--dvl-project-media-gap);
  margin: 0;
  padding: var(--dvl-project-meta-gap) var(--dvl-project-media-inset) 0;
}

.dvl-project.dvl-project--media .dvl-project__media {
  padding-top: 0;
}

.dvl-project .dvl-project__item {
  margin: 0;
  padding: 0;
  line-height: 0;          /* no descender gap under an inline img/video */
  background: rgba(58, 48, 30, 0.06);   /* the frame before pixels arrive */
}

.dvl-project .dvl-project__item img,
.dvl-project .dvl-project__item video {
  display: block;
  width: 100%;
  max-width: none;
  height: auto;            /* the width/height attributes keep the ratio */
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

/* ---- natural-size items (phone screens) ----
   A "contained" item is never drawn wider than its own pixels: --dvl-w is
   its pixel width, printed by the renderer. A run of them shares a row and
   they shrink together to fit the row; nothing in a row is ever enlarged,
   which is what kept turning a 356px phone capture into a blurred
   screen-wide poster. */
.dvl-project .dvl-project__row {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: var(--dvl-project-row-gap);
  margin: 0;
  padding: var(--dvl-project-row-pad) var(--dvl-project-pad);
}

.dvl-project .dvl-project__item--contained {
  /* The cap is the smaller of: its own pixel width, and (only for
     screen-shaped items, which get --dvl-ar = width/height) the width at
     which it is 88% of the viewport tall. Without --dvl-ar the second term
     is 100x the viewport and never wins. */
  --dvl-cap: min(calc(var(--dvl-w, 600) * 1px), calc(var(--dvl-ar, 100) * 88vh));
  flex: 0 1 var(--dvl-cap);
  min-width: 0;
  max-width: var(--dvl-cap);
  background: none;
}

/* ---------------------------------------------------------- breakpoints
   Elementor's own: tablet <= 1024, mobile <= 767.
   ------------------------------------------------------------------------ */

@media (max-width: 1024px) {
  .dvl-project .dvl-project__meta {
    grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
    column-gap: clamp(32px, 6vw, 64px);
  }
  .dvl-project .dvl-project__facts {
    grid-column: 2;
  }
}

@media (max-width: 767px) {
  .dvl-project {
    --dvl-project-top: clamp(72px, 24vw, 120px);
    --dvl-project-head-gap: 48px;
    --dvl-project-meta-gap: 40px;
    --dvl-project-label-size: 11px;
    --dvl-project-body-size: 15px;
  }
  .dvl-project .dvl-project__meta {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 32px;
  }
  .dvl-project .dvl-project__about,
  .dvl-project .dvl-project__facts {
    grid-column: 1;
  }
  .dvl-project .dvl-project__facts {
    grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  }
  /* Phones on a phone: two per line rather than four slivers. A lone one
     keeps its natural cap and fills the content width. */
  .dvl-project .dvl-project__row {
    flex-wrap: wrap;
    --dvl-project-row-gap: 12px;
  }
  .dvl-project .dvl-project__row:not([data-count="1"]) .dvl-project__item--contained {
    flex-basis: calc(50% - 6px);
  }
}
