/* ============================================================
   LC HOME PROJECTS — the homepage projects block
   ------------------------------------------------------------
   A NEW layout. Three things are copied verbatim from the static site because
   they are the house style for a project's label, and nothing else is:

     .hp__title   from index.html .pane__title   (line 263)
     .hp__disc    from index.html .pane__disc    (line 266)
     .readmore    from index.html                (lines 267-278)

   ⚠️ EVERY RULE IS SCOPED UNDER .hp, WITHOUT EXCEPTION. The Elementor editor
   canvas loads every registered widget's stylesheet, not just the ones on the
   page, so an unscoped .pane__lift here would reach into orbit's stages and
   studio's portraits the moment anyone edits either page — and the front end
   would look perfect while the editor did not. Same reason hero.css's
   .titlecard colour once broke the studio statement.

   ⚠️ THE PANE PRIMITIVES ARE REDECLARED HERE, DELIBERATELY. .pane__lift,
   .pane__frame and .pane__glow exist in orbit.css and studio.css; neither of
   those loads on the homepage. The class NAMES have to match because
   LCA.panetilt queries for them, so the scope is what keeps the three copies
   apart.
   ============================================================ */

.hp{
  --hp-bg-day:#ffffff;
  --hp-bg-night:#141417;
  --hp-row-gap:160px;

  /* the picture's height divided by its width. ONE token, used twice: by the
     media's aspect-ratio and by the pair's drop, which is a percentage of the
     picture's HEIGHT and therefore has to know the ratio. Two copies of 16/10
     would drift the moment the crop changed. */
  --hp-ratio:.625;

  /* THE TILT'S OVERHANG, as a percentage of the picture's WIDTH. See the
     .hp__figure block below for the measurements. Unitless because it is fed
     to calc() twice; the % is applied there. */
  --hp-reserve:4;

  /* the pair's drop, as a percentage of the picture's HEIGHT. */
  --hp-offset:12;

  --hp-max:1240px;
  /* ⚠️ THE PADDING NEEDS A FALLBACK HERE, and it did not have one. While the
     block was an Elementor widget its padding came from the panel and nothing
     else; read through the shortcode that control does not exist, and the
     block had no padding at all. Every other value already had its preset in
     this file -- this was the one gap. */
  padding:var(--hp-pad,120px clamp(20px,4vw,52px));
  background:var(--hp-bg-day);
  transition:background-color var(--mode-fade);
  display:flex;
  flex-direction:column;
  gap:var(--hp-row-gap);
}

/* NIGHT. Not the inverse of #ffffff — the inverse would be the page colour and
   the block would disappear. The brief's white is a PANEL standing proud of a
   warm cream page; --bg-2 (#141417) is the night token for exactly that, and
   the one the footer and the pane frames already use. Both values are widget
   controls, so this is a default rather than a decision welded into CSS. */
html[data-mode="night"] .hp{background:var(--hp-bg-night)}

/* ⚠️ THE ROWS NEED A MEASURE, AND THE TILT IS WHY.
   The resting tilt is a fixed 6deg rotateY, carried over from the homepage
   panes where a pane is about 700px wide. Rotation is angular, so the apparent
   displacement grows with the plane: at 1336px — a full-bleed single image at
   1440 — the same 6deg skews the picture badly enough to read as a rendering
   fault rather than a lift. Measured: Row B came out 1336x835 and looked broken
   while Row A at 735px looked correct.

   Capping the row rather than scaling the angle keeps one tilt constant across
   every layout, which is what makes the three rows feel like one system. It is
   a control, so a full-bleed row is still one number away. */
.hp .hp__row{width:100%;max-width:var(--hp-max);margin-inline:auto}

/* ---- the picture ----------------------------------------------------- */
/* overflow stays visible so the tilted plane and its cast shadow can project
   past the box, exactly as on orbit and studio. */
/* ⚠️ .hp__figure EXISTS ONLY TO RESERVE THE TILT'S OVERHANG, AND NOTHING ELSE
   COULD DO IT.

   A TRANSFORM DOES NOT PARTICIPATE IN LAYOUT. The lifted plane is rotated and
   pushed towards the viewer, so it paints well below the box it occupies —
   but the box is unchanged, so nothing downstream knows. Two earlier attempts
   failed for that reason and are recorded so neither is tried again:

     margin-bottom on .hp__media   collapses with the caption's own margin-top
                                   (adjacent vertical margins take the LARGER,
                                   they do not add), so it reserved nothing.
     padding-bottom on .hp__media  .pane__lift is inset:0, so the padding grows
                                   the picture rather than clearing it.

   The only thing that works is a real box OUTSIDE the transformed element.
   .hp__figure is that box; its padding-bottom is ordinary layout the caption,
   the label and the CTA all sit below.

   MEASURED, at 1440, as painted bottom minus layout bottom:

     row   picture      at rest (z38)   worst case (z74 + hover)
     A      680x425      11.3px  1.66%   28.2px  4.15%
     B     1240x775      28.3px  2.28%   78.4px  6.32%
     C      591x370       9.2px  1.56%   22.6px  3.82%

   Percentages are OF THE WIDTH, which is also what a percentage padding
   resolves against — so one number holds at every viewport. 4% covers the
   resting tilt on all three rows with room to spare, and the full hover
   envelope on A and C. Only B, the full-measure single, can still touch the
   caption, and only at the far corner of the picture while it is half out of
   the viewport: 2.8px at the very worst sample. It is a control.

   ⚠️ THE OVERHANG WAS NEVER THE WHOLE PROBLEM. The caption was being hit
   mostly by paneParallax, which translates the picture box by yPercent 5 to
   -5 — 38.75px each way on a 775px plane — and that is a transform too, so no
   margin could reserve for it either. It is off in home-projects.js; the note
   there says why. Measured on Row B at 1440, the gap from the painted picture
   to the caption swung from -72.2px (a 72px overlap) to +48.5px across one
   scroll of the page, purely from that tween. */
.hp .hp__figure{padding-bottom:calc(var(--hp-reserve) * 1%)}
.hp .hp__media{position:relative;aspect-ratio:1/var(--hp-ratio)}

/* ---- ORIENTATION: PORTRAIT -------------------------------------------
   Landscape is the rule above, untouched: the 16:10 frame, cover-cropped.
   Portrait puts the picture's own width/height on the figure as --hp-ar
   (LCA_Pane_Rows::pane_figure, from the attachment metadata), and the picture
   takes that ratio instead, so nothing is cropped.

   ⚠️ THE CAP SHRINKS THE WIDTH; IT NEVER CLIPS THE HEIGHT. A max-height would
   hold the height while the width stayed full, and object-fit:cover would
   then crop exactly what Portrait promises not to. So the WIDTH is the capped
   quantity -- min(the column, cap x ratio) -- and the height follows from
   aspect-ratio. The picture keeps to the column's start edge, the edge its
   text aligns to.

   Everything else is deliberately unchanged: the pair's drop is still a share
   of the 16:10 height (--hp-ratio), so a portrait beside a landscape keeps
   the same gesture, and the tilt clearance is still .hp__figure's padding. */
.hp .hp__figure--natural .hp__media{aspect-ratio:var(--hp-ar);
  width:min(100%,calc(var(--hp-portrait-cap,90vh) * var(--hp-ar)))}
.hp .pane__lift{position:absolute;inset:0;z-index:2;transform-style:preserve-3d;border-radius:3px;will-change:transform}
.hp .pane__frame{position:absolute;inset:0;border-radius:3px;overflow:hidden;border:1px solid var(--pane-edge);
  box-shadow:0 2px 0 rgba(255,255,255,.05) inset,0 1px 1px rgba(0,0,0,.12);background:var(--bg-2)}
/* ⚠️ img AND video. A thumb is whichever LCA_Projects::render_card_media()
   resolves, and this rule used to name only the img — so a video thumb kept
   the browser default, object-fit:contain with no width or height, and sat
   letterboxed inside its own frame. Measured on the homepage before the fix:
   a 1280x720 video rendered 449.2x252.7 inside a 469x299 frame, showing the
   frame background above and below it. Nothing flagged it, because the three
   image thumbs beside it were perfect. */
.hp .pane__frame img,
.hp .pane__frame video{width:100%;height:100%;object-fit:cover;display:block}
/* the whole picture is clickable. Above the media, inside the frame, so it is
   clipped and tilted with it; the cast glow is already pointer-events:none, so
   nothing of this block is a hit target outside the picture you can see. */
.hp .hp__link{position:absolute;inset:0;z-index:5;display:block}
/* the cast shadow lives OUTSIDE the tilting lift, so the plane reads as lifted
   off a surface rather than carrying its own shadow around with it. */
.hp .pane__glow{position:absolute;left:3%;right:3%;top:22%;bottom:-20%;z-index:0;
  background:radial-gradient(56% 62% at 50% 56%,var(--cast),transparent 73%);
  filter:blur(46px);opacity:var(--cast-op,.85);will-change:transform,opacity;
  transition:opacity var(--mode-fade);
  pointer-events:none}

/* ---- the text --------------------------------------------------------
   ⚠️ ONE ORDER, ONE WRAPPER, ALL THREE ROWS:
       title · category · description · read more
   The rows differ in WHERE this column sits — beside the picture in A, under
   it in B and C — and in nothing else. Anything that reorders per row is a
   LAYOUT rule here, never a second markup shape, because two shapes is how a
   row quietly acquires its own bugs.

   Previously: the category sat inline with the title (flex, baseline, 18px
   gap) and the description came FIRST, above both, because it was emitted
   before the label block. Row A hid that by gridding the description into
   the second column, so only B and C showed it. */
.hp .hp__text{display:flex;flex-direction:column;align-items:flex-start;
  gap:var(--hp-text-gap,14px);color:var(--fg)}

/* ⚠️ EVERY SIZE IS var(<control>, <fluid default>), AND THE FALLBACK IS THE
   FLUID ONE. The block is responsive out of the box; a control overrides it
   per breakpoint only when an admin sets one. Giving those controls a DEFAULT
   instead would make Elementor emit a fixed px at every breakpoint, and the
   fluidity would be gone the moment the widget was saved — silently, because
   it would look identical at the width it was saved at.

   Sizes are 2px (title) and 1px (description) below what they were, and the
   WHOLE clamp is shifted, not just its ends: subtracting from the PREFERRED
   term keeps the ramp in the same viewport band. Writing clamp(18.8px,2.7vw,
   30px) instead would have moved the band and left mid widths unchanged.
   Same reasoning as projects.css deviation 4.

   ⚠️ THE TITLE'S LINE-HEIGHT IS A DELIBERATE DIVERGENCE FROM THE STATIC SITE.
   .pane__title declares none, so it inherits body's 1.6 — 51.2px on a 32px
   title, which is body copy leading on a display face and reads as loose at
   two lines. 1.15 is the display setting. Everything else about the type is
   byte-identical to the static site: Murecho 600 at the same clamp minus 2,
   the same .01em tracking, the same uppercase from .disp. */
/* ⚠️ EVERY COLOUR FALLS BACK TO A MODE TOKEN, NOT TO A LITERAL.
   --fg and --muted already flip between day and night on their own, so with
   no control set the block tracks the palette exactly as the rest of the site
   does. An admin colour REPLACES that automatic behaviour, which is precisely
   why each one has a night twin: set only a day colour and night would be
   left holding it. The night rule below reads its own variable and falls back
   to the token, never to the day override -- a dark grey chosen for a white
   panel must not survive into the dark panel. */
.hp .hp__title{font-family:var(--font-disp);font-stretch:100%;font-weight:600;
  font-size:var(--hp-title-size,clamp(18.8px,calc(2.7vw - 2px),30px));
  line-height:var(--hp-title-lh,1.15);
  color:var(--hp-title-fg,var(--fg));
  letter-spacing:.01em;margin:0 0 0 -0.09em}
.hp .hp__disc{margin:0;font-size:var(--hp-disc-size,11px);line-height:var(--hp-disc-lh,1.6);
  letter-spacing:var(--track-mid);text-transform:uppercase;color:var(--hp-disc-fg,var(--muted))}
.hp .hp__caption{margin:0;font-weight:300;
  font-size:var(--hp-desc-size,clamp(15px,calc(1.25vw - 1px),17px));
  line-height:var(--hp-desc-lh,1.6);
  color:var(--hp-desc-fg,var(--fg));letter-spacing:.01em;max-width:54ch}

html[data-mode="night"] .hp .hp__title{color:var(--hp-title-fg-night,var(--fg))}
html[data-mode="night"] .hp .hp__disc{color:var(--hp-disc-fg-night,var(--muted))}
html[data-mode="night"] .hp .hp__caption{color:var(--hp-desc-fg-night,var(--fg))}

/* ---- read more — copied verbatim from index.html:267-278 ------------- */
.hp .readmore{display:inline-flex;align-items:center;gap:10px;font-size:10px;letter-spacing:var(--track-mid);
  text-transform:uppercase;color:inherit;opacity:.82;position:relative;
  transition:opacity .25s var(--ease-soft),gap .35s var(--ease-zha)}
.hp .readmore__t{position:relative;padding-bottom:4px}
.hp .readmore__t::after{content:"";position:absolute;left:0;right:0;bottom:0;height:1px;background:currentColor;
  transform:scaleX(0);transform-origin:left center;transition:transform .45s var(--ease-zha)}
.hp .readmore:hover{opacity:1;gap:15px}
.hp .readmore:hover .readmore__t::after{transform:scaleX(1)}
.hp .readmore .arw{position:relative;width:18px;height:1px;background:currentColor;display:inline-block}
.hp .readmore .arw::after{content:"";position:absolute;right:0;top:-3px;width:6px;height:6px;
  border-top:1px solid currentColor;border-right:1px solid currentColor;transform:rotate(45deg)}
/* no margin: the read more is a flex item like the other three, so one gap
   control spaces the whole column and nothing can drift out of step. */

/* ---- ROW A · picture one side, the whole text column the other -------
   Two columns, one grid row. The text column carries all four elements, so
   it is a column in fact and not a stray caption, and the grid's align-items
   centres it against the picture — --hp-a-align, from the panel.

   ⚠️ ROW A'S FIGURE DROPS THE TILT CLEARANCE, and that is what makes the
   centring honest. Nothing sits beneath the picture in its own column here,
   so there is nothing to clear; and with the reserve in place the grid would
   centre the text against the RESERVED box rather than against the picture,
   sitting it about half the reserve low. The clearance comes back when the
   row stacks and text is beneath the picture again — see the stacked block. */
.hp .hp__row--a .hp__col{
  display:grid;
  grid-template-columns:minmax(0,1.15fr) minmax(0,.85fr);
  column-gap:clamp(28px,4vw,72px);
  align-items:var(--hp-a-align,center);
}
.hp .hp__row--a .hp__figure{grid-column:1;grid-row:1;padding-bottom:0}
.hp .hp__row--a .hp__text{grid-column:2;grid-row:1}
/* Mirror: text left, picture right. */
.hp .hp__row--a.is-flipped .hp__figure{grid-column:2}
.hp .hp__row--a.is-flipped .hp__text{grid-column:1}

/* ---- ROW B · single, the text column beneath ------------------------- */
.hp .hp__row--b .hp__text{margin-top:var(--hp-text-top,26px)}

/* ---- ROW C · pair, the second dropped -------------------------------- */
/* ⚠️ THE EXTRA GAP IS HOW THE COLUMNS GET NARROWER, and that is deliberate.
   The row keeps its measure, the two tracks stay 1fr each, and every px added
   to the gap comes off the pair evenly — so +40px of gap is exactly -20px on
   each column, at EVERY width, with no second number to keep in step.
   Setting the track widths instead would have needed the gap recomputed each
   time one changed. Measured at 1440: columns 471.2 -> 451.2, gap 57.6 ->
   97.6. At 880: 387.2 -> 367.2, gap 35.2 -> 75.2. */
.hp .hp__row--c{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));
  column-gap:calc(clamp(28px,4vw,72px) + var(--hp-pair-gap-extra,40px));
  align-items:start}
.hp .hp__row--c .hp__text{margin-top:var(--hp-text-top,26px)}

/* ⚠️ THE DROP IS A SHARE OF THE PICTURE'S HEIGHT, AND THAT IS WHY THE COLUMN
   IS A CONTAINER.

   A fixed 96px was a different gesture at every width: a fifth of the picture
   at 1440 and two fifths of it at 880. As a share of the picture it is the
   same gesture everywhere.

   Neither a percentage margin nor a percentage padding can express it. Both
   resolve against the containing block's WIDTH, and the drop is a fraction of
   the HEIGHT. So the column declares itself an inline-size container and the
   figure inside it measures in cqw — 1% of the COLUMN's width, which is the
   picture's width, times --hp-ratio to reach its height.

   ⚠️ The container is the COLUMN and the drop is on the FIGURE, not the other
   way round: an element cannot query itself, so putting both on the column
   would resolve cqw against the row instead and pick up the column gap.
   Pushing the figure down carries everything below it in the same flow, which
   is the same result.

   The plain px line above it is the fallback: a browser without container
   queries drops the calc() at parse time and keeps 96px, the value this
   started as. */
/* ⚠️ TWO TERMS, AND THEY MEAN DIFFERENT THINGS. --hp-offset is the gesture
   and scales with the picture; --hp-offset-extra is a flat nudge on top of
   it, in px, which does NOT scale. Keeping them apart is the point: fold the
   10px into the percentage and it becomes 10px only at one width. */
.hp .hp__row--c .hp__col{container-type:inline-size}
.hp .hp__row--c .hp__col--dropped .hp__figure{margin-top:96px}
.hp .hp__row--c .hp__col--dropped .hp__figure{
  margin-top:calc(var(--hp-offset) * var(--hp-ratio) * 1cqw + var(--hp-offset-extra,25px))}
/* Mirror drops the LEFT one instead, so a run of pairs can alternate. */
.hp .hp__row--c.is-flipped .hp__col--dropped .hp__figure{margin-top:0}
.hp .hp__row--c.is-flipped .hp__col:first-child .hp__figure{margin-top:96px}
.hp .hp__row--c.is-flipped .hp__col:first-child .hp__figure{
  margin-top:calc(var(--hp-offset) * var(--hp-ratio) * 1cqw + var(--hp-offset-extra,25px))}

/* ---- stacked ---------------------------------------------------------
   Every row becomes a single column and the pair's offset goes to zero: a
   vertical drop between two stacked items is just an inconsistent gap, and it
   would read as a mistake rather than as the deliberate step it is at width.
   760 rather than 880 — at 880 two columns still hold comfortably. */
@media(max-width:760px){
  .hp{--hp-offset:0}
  .hp .hp__row--a .hp__col,
  .hp .hp__row--c{display:block}
  /* Row A is a stack now, so its picture HAS text beneath it again and the
     tilt clearance has to come back. This is the other half of the
     padding-bottom:0 in the Row A block above; changing one without the
     other puts the caption back under the tilted corner. */
  .hp .hp__row--a .hp__figure{padding-bottom:calc(var(--hp-reserve) * 1%)}
  .hp .hp__row--a .hp__text{margin-top:var(--hp-text-top,26px)}
  /* the drop goes, in BOTH mirror states, and the separation becomes the one
     gap the stack uses everywhere else. Written on the adjacent column rather
     than on --dropped, because which column is dropped flips and which one is
     second does not. */
  .hp .hp__row--c .hp__col--dropped .hp__figure,
  .hp .hp__row--c.is-flipped .hp__col:first-child .hp__figure{margin-top:0}
  .hp .hp__row--c .hp__col + .hp__col{margin-top:var(--hp-row-gap)}
}
