/* THE CARD TURNS OVER — the detail face on the back of a wall panel.
 *
 * Ported from playground/css_animations/big-landing-final/click-6-flip-detail.html
 * ("Varianta 6 · Detalii pe card"). Nothing about the ring's geometry, timing
 * or easing changes: the six panels and the six back plates keep the exact
 * transforms every variation already ships, and with nothing flipped the wall
 * is the baseline wall. This file adds three things and no others — a
 * composed rotateY on the two members of each pair, the hit testing that lets
 * the front card be pressed, and the face that is painted on the plate.
 *
 * WHY THIS IS ONE SHARED FILE. The nine variations differ in --pw, --ss, in
 * their palettes and in their chrome; they do NOT differ in the ring, in the
 * plate markup, or in what belongs on the back of a card. Nine copies of the
 * rules below would be nine places to get the transform seam wrong. Per-page
 * CSS keeps only what is genuinely per-page: the --tint / --acc tokens each
 * file already declares, and v8-lumina's light-ground override.
 *
 * IT MUST BE LINKED LAST IN <head>, AFTER THE PAGE'S OWN <style>. Section 1
 * restates the `transform` and `transition` shorthands on .panel at plain
 * class specificity (0,1,0), which is exactly the weight the pages' own
 * .panel rules carry — so the later stylesheet is the one that wins. Linked
 * earlier, the page's own `transform: rotateY(...) translateZ(...)
 * rotateX(...)` would silently drop the flip and the card would never turn.
 * Section 6 pays the same debt back for the pages' reduced-motion blocks. */

:root {
  /* THE FLIP IS ITS OWN MOTION, faster than the 1.1s ring turn. That is
     affordable because nothing else on these pages ever changes a panel's
     transform: the ring turn rotates the TRACK (--turn) and writes only
     --dist onto the panels, so retiming `transform` on .panel costs nothing.
     The depth fade (opacity) stays on --dur, so it still tracks the wall. */
  --flip-dur: 0.72s;
  --flip-ease: cubic-bezier(0.22, 0.7, 0.22, 1);

  /* the two readings of a KPI delta. `dir` is the industry's OWN read, not
     the sign of the number ("Întârziate −2 săpt." is dir "up" because fewer
     is better), so these drive COLOUR only — see kpiTile() in flip.js. */
  --pos: #5fdba0;
  --neg: #ff8b9a;
}

/* ── 1. THE TRANSFORM SEAM ─────────────────────────────────────────────────
   THE CARD IS ALREADY DOUBLE-SIDED. Every variation welds a .panel (the
   dashboard shot, facing out) and a .panel--back plate (ghost + frost, facing
   in) to the same ring slot, back-to-back, both backface-culled. A flip is
   therefore not a new object — it is that existing pair turning together.
   Adding a THIRD coplanar element would have put another quad at exactly the
   z where the depth sort is already documented as unreliable at ties.

   THE FLIP COMPOSES, IT DOES NOT REPLACE. Both chains are restated with a
   trailing rotateY(var(--flip, 0deg)) APPENDED, so at rest --flip resolves to
   0deg, the appended term is the identity, and the computed matrices are
   bit-identical to the baseline page's. That property is the whole
   correctness argument for this file: the wall at rest must not move by a
   pixel. At --flip: 180deg the panel has turned to face away (culled) and the
   plate, which carries its own rotateY(180deg), has come round to 360deg —
   facing the camera, content the right way round, exactly coplanar where the
   panel used to be. The hand-off falls at 90deg where the pair is edge-on at
   zero width: the same hand-off the ring already relies on, which is why
   nothing pops and z-fighting is impossible.

   The flip axis is the card's OWN vertical: the rotateY is appended AFTER
   rotateX(--pitch), so it turns about the card's local, already-pitched Y
   rather than about the world axis. */
.panel {
  /* base.css's shorthand is restated in full rather than patched with
     transition-duration, because the shorthand is what has to be beaten and
     the two would otherwise fight per-property */
  transition:
    transform var(--flip-dur) var(--flip-ease),
    opacity var(--dur) var(--ease),
    filter var(--dur) var(--ease);
  transform:
    rotateY(calc(var(--slot) * var(--angle)))
    translateZ(var(--radius))
    rotateX(var(--pitch))
    rotateY(var(--flip, 0deg));
}
.panel--back {
  transform:
    rotateY(calc(var(--slot) * var(--angle)))
    translateZ(var(--radius))
    rotateX(var(--pitch))
    rotateY(180deg)
    rotateY(var(--flip, 0deg));
}
/* set on BOTH members of the pair by flip.js, so they turn as one rigid card */
.panel.is-flipped { --flip: 180deg; }

/* A FLIPPED PLATE IS THE ONLY PLATE THAT IS EVER AT THE FRONT OF THE RING.
   Every other visible plate sits at z < -radius, behind every panel, so the
   base pages can leave the ordering to the depth sort. This one is coplanar
   with the card the whole wall is pointed at, and Chrome's depth sort is not
   reliable at exactly those ties. The neighbours at 60deg do not overlap the
   front card horizontally — their projected boxes clear its edges — but their
   shadows do, so the ordering is stated outright instead of hoped for.
   z-index alone is enough because the plates are appended AFTER the panels,
   so DOM order already agrees with it. Only ever one card is flipped (see THE
   ONE ASSERTION in flip.js), so this can never boost two. */
.panel--back.is-flipped { z-index: 2; }

/* ── 2. HIT TESTING ───────────────────────────────────────────────────────
   The base pages turn the whole wall off for the pointer, because the floor
   reflection hangs a full panel-height below its panel and lands on the chip
   row (3D-transformed elements are depth-sorted, not painted in DOM order).
   That reasoning is about the REFLECTION, not the card: the panel box itself
   sits inside the stage, well above the chrome. So the cull moves down onto
   the parts that actually overhang, and the card face gets the pointer back.

   Only the three FRONT-facing slots are re-enabled. The other three are
   backface-culled — invisible — and re-arming them would mean clicks landing
   on cards nobody can see. data-face is carousel.js's own hook and is written
   on the front panels only, so `[data-face]` can never match a plate. */
.panel:not(.panel--back)[data-face="0"],
.panel:not(.panel--back)[data-face="1"],
.panel:not(.panel--back)[data-face="5"] {
  pointer-events: auto;
  cursor: pointer;
}
/* every painted child stays transparent to the pointer, so the target is
   always the panel BOX and the reflection can never steal a chip click */
.panel picture,
.panel .shot { pointer-events: none; }
/* a flipped panel is culled; the plate in front of it takes the clicks */
.panel.is-flipped:not(.panel--back) { pointer-events: none; }
.panel--back.is-flipped { pointer-events: auto; cursor: pointer; }

/* Affordance. Border and shadow only — nothing that moves the panel, so a
   hover can never fight the turn transition. The border weight is the pages'
   own calc(1px * var(--ss)); only its brightness changes. */
.panel:not(.panel--back):hover {
  border-color: rgba(255, 255, 255, 0.62);
}
.panel:focus-visible {
  outline: 2px solid var(--glow-c);
  outline-offset: calc(6px * var(--ss));
}

/* ── 3. THE DETAIL FACE ───────────────────────────────────────────────────
   Lives inside the plate, above the ghost (z 0) and the frost (z 1) and above
   glass.css's .panel::after sheen (z 2).

   `visibility: hidden` rather than display:none is deliberate: it keeps the
   layout resolved (no reflow, and no sparkline re-measure, mid-flip) AND it
   takes the close button out of the tab order for free, which is what "hidden
   faces must not be focusable" needs. The plate itself carries aria-hidden.

   THE TYPE RATIO. Every size on this face is an `em` of this one number, and
   this one number is a RATIO OF --panel-w — which, thanks to the z-shift, is
   the card's exact on-screen width. So the face follows the card at every
   breakpoint and on every variation, and one figure moves all of it.

   /35 AND NOT THE REFERENCE'S /38, because this face carries one block less:
   the reference put the dashboard's own `action` string on a call-to-action
   pill, which on a landing page that already has real CTAs would be a button
   that goes nowhere. Dropping it hands ~1.2em of the footer back to the type.
   Bigger than /35 does not fit: the card is 16:10 everywhere, so the ratio
   either clears the content on all nine variations or on none of them, and at
   /35 the tightest card (v5-sticky's 378px) still measures inside its box. */
.cap {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  padding: 1.15em 1.35em 1.05em;
  border-radius: var(--glass-radius);
  overflow: hidden;
  text-align: left;
  font-size: calc(var(--panel-w) / 35);
  line-height: 1.35;
  color: var(--ink);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;

  opacity: 0;
  visibility: hidden;
  /* HIDE ONLY ONCE THE CARD IS EDGE-ON. On close the pair turns 180 -> 0, and
     the plate stays camera-facing for the first half of that. Swapping the
     face out at t=0 would pop the detail away while you can still see it;
     delaying by exactly half the flip lands the swap in the blind spot at
     90deg. Opening needs no delay (the plate is culled until 90deg anyway),
     so the open state turns the transition off. */
  transition:
    opacity 0s linear calc(var(--flip-dur) / 2),
    visibility 0s linear calc(var(--flip-dur) / 2);

  background:
    radial-gradient(120% 90% at 88% 2%,
      color-mix(in srgb, var(--acc) 30%, transparent), transparent 62%),
    linear-gradient(158deg,
      color-mix(in srgb, var(--tint, #0a0e1c) 88%, #000) 0%,
      rgba(4, 6, 16, 0.985) 100%);
}
.panel--back.is-flipped .cap {
  opacity: 1;
  visibility: visible;
  transition: none;
}

/* HEADER. `flex: none` — the name and the strapline are never what gives way
   when a bullet wraps to a third line; the body is (see .cap__body).

   It used to carry `padding-right: 2.9em`, which was the close button's
   footprint plus air so that a long industry name could not run under the ×.
   The × was removed 2026-09-03 (flip.js's interaction note says why), and the
   padding went with it rather than being left behind as a margin nothing
   explains — "Clinici & cabinete" now uses the width it was being kept off. */
.cap__head {
  flex: none;
}
.cap__name {
  margin: 0;
  font-size: 1.45em;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.08;
}
.cap__result {
  margin: 0.28em 0 0;
  font-size: 0.72em;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink-dim);
}

/* THE TWO COLUMNS. 0.92fr / 1.08fr, not 1fr / 1fr: the KPI side has to hold
   two tiles across with a real number in each, while the bullets are text
   that wraps gracefully at any measure — so the few px go to the side that
   cannot give them back. `min-height: 0` lets the grid actually shrink inside
   the flex column instead of forcing the card taller (the default
   `min-height: auto` on a flex item is the classic overflow), and
   `minmax(0, …)` does the same for each track so a long unbroken value cannot
   widen a column.

   Two columns is what buys the type its size. Stacked in one column, three
   bullets alone eat half the card and the KPI tiles are squeezed to nothing;
   side by side both halves finish at roughly the same depth, so no third of
   the card is left empty while another overflows. */
.cap__body {
  flex: 1 1 auto;
  min-height: 0;
  margin-top: 0.8em;
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: 1.2em;
  align-content: start;
}
.cap__col { min-width: 0; }

/* the two section headings — small caps over an accent hairline, the same
   device the wall's own captions use, sized so they read as labels rather
   than competing with the name above them */
.cap__h {
  margin: 0;
  font-size: 0.63em;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-dim);
}
.cap__h::after {
  content: '';
  display: block;
  margin-top: 0.5em;
  height: 1px;
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--acc) 55%, transparent), transparent 78%);
}

/* ── 4. CE REZOLVĂ ────────────────────────────────────────────────────────
   The bullets column is the SHORT one — three lines against the KPI grid's
   four tiles — so it is the one piece of the face with room to spend, and it
   spends it on size rather than leaving a bigger hole under itself. */
.cap__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.6em;
  margin: 0.8em 0 0;
  padding: 0;
  font-size: 0.86em;
  line-height: 1.4;
  color: #dfe5f4;
}
.cap__list li {
  position: relative;
  padding-left: 1.25em;
}
.cap__list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.46em;
  width: 0.45em;
  height: 0.45em;
  border-radius: 2px;
  background: var(--acc);
  box-shadow: 0 0 0.9em color-mix(in srgb, var(--acc) 60%, transparent);
}

/* ── 5. INDICATORI ────────────────────────────────────────────────────────
   Four tiles, 2x2. The sparkline is an inline <polyline> built in flip.js
   from the kpi's own `spark` array, normalised to ITS OWN min/max — the four
   series are unrelated quantities (lei, %, minutes, counts), so a shared
   scale would flatten three of them into flat lines. No library, no <defs>,
   no ids (six copies of this markup share a document). */
.cap__kpis {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45em;
  margin-top: 0.75em;
}
.cap__kpi {
  min-width: 0;
  padding: 0.45em 0.5em 0.4em;
  border-radius: 0.6em;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.09);
}
/* the labels are the one string on the face with no room to wrap — a second
   line would push the tile's sparkline off the card — so they are clipped
   rather than allowed to reflow the grid */
.cap__kpi-label {
  display: block;
  font-size: 0.6em;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cap__kpi-value {
  display: block;
  margin-top: 0.1em;
  font-size: 0.95em;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.cap__kpi-delta {
  display: block;
  margin-top: 0.04em;
  font-size: 0.66em;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
}
/* colour only, never an arrow glyph — half the deltas would be contradicted
   by one (see the --pos / --neg note at the top of this file) */
.cap__kpi--up   .cap__kpi-delta { color: var(--pos); }
.cap__kpi--down .cap__kpi-delta { color: var(--neg); }

.cap__spark {
  display: block;
  width: 100%;
  height: 1.2em;
  margin-top: 0.28em;
  overflow: visible;
}
/* preserveAspectRatio="none" stretches the 100x28 viewBox to the tile, so the
   stroke has to opt out of that scaling or it would go elliptical */
.cap__spark polyline {
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.cap__kpi--up   .cap__spark polyline { stroke: var(--pos); }
.cap__kpi--down .cap__spark polyline { stroke: var(--neg); }

/* ── 6. THE FOOTER ────────────────────────────────────────────────────────
   ONE THING ON IT: the way further in.

   The reference put a call-to-action pill here carrying the dashboard's own
   `action` string ("Lucrare nouă"), and it came out because it was a dead
   button sitting a few hundred pixels from the section's real CTA. What went
   back in (2026-09-03) wears the same pill and is the opposite of dead: a
   real link to that industry's own page, which is not a second CTA competing
   with the form but the only route off a wall whose whole job is to make a
   reader say "that one is mine".

   It shipped first as a bare underlined string, deliberately quiet so as not
   to read as the page's primary action. That was right while the footer also
   held a dismissal hint and the face still had an × in its corner — three
   pieces of chrome, and the link had to be the middle one. Both of the others
   were removed the same day, and the argument inverted with them: the link is
   now the ONLY control on the face, and the quietest treatment in the footer
   is the wrong weight for the only thing a reader can act on. Hence the pill.

   `justify-content: flex-end` rather than the anchor's own `margin-left:
   auto`: with the hint gone the row has one child, and a rule on the
   container says "this row is right-aligned" where a margin on the child says
   "this child pushes off whatever is to its left" — which is now nothing. */
.cap__foot {
  flex: none;
  display: flex;
  justify-content: flex-end;
  margin-top: 0.75em;
}

/* THE LINK OUT, AS A BUTTON — and it borrows the page's own button, rather
   than inventing a weight for itself.
   ---------------------------------------------------------------------------
   It shipped first as an accent-tinted wash behind an accent hairline, which
   was the quiet reading of "make it a pill". Reported back as not looking
   like a button at all, and the report was right: a 15%-alpha wash on a face
   that is already a wash, bounded by a 42%-alpha hairline on a face already
   ruled with hairlines, is a chip. Nothing on it said press me.

   So it takes .btn's grammar off base.css and the pages, which is the one
   vocabulary on the page a reader has already learned means BUTTON: a solid
   fill, a 1px border on the fill colour, weight 600, `line-height` near 1, a
   3px corner (0.25em here, because everything on this face is an em of the
   card) and a 1px press on :active. Everything but the size is the same.

   WHY THE FILL IS THE FACE'S INK AND NOT ITS ACCENT, which is what
   .btn--primary uses. The six accents split: #f2a03d, #8098ff, #4db8f5 and
   #a8e04a take dark text, while #0d9488 and #db2777 are dark enough to need
   white. ui.css already solves this and calls the answer --on-acc — but that
   token is declared on `.ui--{key}`, the FRONT panel's dashboard, and the
   plates only ever get `--tint` and `--acc`. Reaching it from here means
   either adding --on-acc to `.panel--back[data-key]` in all 23 pages, or
   copying ui.css's six values into this file. The first is a wide edit for a
   button; the second is the duplicated colour table this repo keeps writing
   comments about. Measured, the shortcut of using --tint on --acc for all six
   fails: 4.0:1 on medical and 3.5:1 on realestate, against 4.5 for text this
   size.

   `--ink` on `--tint` needs no table and measures ~15:1 on every one of the
   six, because both are already declared on the plate for exactly these two
   roles. The cost is that the button is not in its card's colour; the gain is
   that it is legible on all six and cannot silently stop being. The one face
   this is wrong for is v8-lumina's paper card, whose `--ink` is dark ink over
   a light surface — it overrides all of this with its own .btn--primary, in
   its own <style>, next to the rest of its paper kit.

   The arrow is a flex sibling of the text and `flex: none`, so it can never
   be the thing that wraps: an arrow alone on line two is the classic failure
   of this pattern. */
.cap__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  padding: 0.65em 1.05em;
  border-radius: 0.25em;
  border: 1px solid var(--ink);
  font-size: 0.68em;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: 0.01em;
  text-decoration: none;
  cursor: pointer;
  color: var(--tint, #0a0e1c);
  background: var(--ink);
  /* the one thing on the face that sits ON it rather than IN it, and the
     shadow is what says so — every other block here is flush */
  box-shadow: 0 0.18em 0.55em rgba(0, 0, 0, 0.38);
  transition: background 0.18s, border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.cap__link:hover {
  background: #fff;
  border-color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 0.3em 0.8em rgba(0, 0, 0, 0.46);
}
/* .btn--primary's own press, to the pixel: the affordance a reader checks a
   control with when they are not sure it is one */
.cap__link:active {
  transform: translateY(1px);
  box-shadow: 0 0.1em 0.3em rgba(0, 0, 0, 0.32);
}
.cap__link:focus-visible {
  outline: 2px solid var(--glow-c);
  outline-offset: 3px;
}
.cap__link-arrow {
  flex: none;
  width: 0.85em;
  height: 0.85em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── 7. THE PHONE CARD ────────────────────────────────────────────────────
   A DIFFERENT SHAPE, NOT A SMALLER ONE: the pages' mobile branch switches the
   card to 0.78 aspect, so it is proportionally taller and the ratio has to be
   re-picked. /35 would land at ~10px here, which is not type; /27 is a real
   phone body size, and because every size on the face is an em of it the
   whole face comes with it.

   WHAT GIVES WAY, because even at /27 the content is taller than the card:
   the `result` strapline (carousel.js prints the same string in the caption
   directly under the wall, at a size a phone can read). The four KPIs, the
   three bullets, both headings and the name all stay.

   THE FOOTER ITSELF NO LONGER GIVES WAY, and that is a change (2026-09-03).
   It used to be `display: none` here, which was right when the only thing on
   it was a hint about a key phones do not have. That hint has since been
   deleted outright, and what is on the row now is the card's one link to that
   industry's page — hiding it on the half of the traffic that is on a phone
   would be hiding it from the readers it is for. So the row stays, and the
   height the strapline and the old hint used to take is what pays for it. */
@media (max-width: 760px) {
  .cap {
    font-size: calc(var(--panel-w) / 27);
    padding: 1em 1.05em 0.95em;
  }
  .cap__name { font-size: 1.35em; }
  .cap__result { display: none; }
  /* The row's own margin is what pays for the pill's hit area. Measured on a
     390x844 card the pill's text sets at ~9px, so the padding is doing all the
     work of making it a thumb target rather than a phrase; the margin gives
     back what the extra padding costs, verified against the plate's own bottom
     edge at 390 on all six cards of all 23 pages. It is still short of the
     44px WCAG target — the whole card is 284px tall — but it is a control you
     can hit, and the card behind it is not a destructive one to hit by
     mistake: a stray tap turns it back over. */
  .cap__foot { margin-top: 0.4em; }
  .cap__link { padding: 0.8em 1em; }
  .cap__head { padding-right: 2.6em; }
  .cap__body { margin-top: 0.7em; gap: 1em; }
  .cap__list { gap: 0.5em; margin-top: 0.7em; font-size: 0.82em; }
  .cap__kpis { gap: 0.4em; margin-top: 0.6em; }
  .cap__kpi { padding: 0.4em 0.44em 0.36em; }
  .cap__spark { height: 1.05em; }
}

/* ── 8. REDUCED MOTION ────────────────────────────────────────────────────
   .panel HAS TO BE RESTATED HERE. Every page's own reduced-motion block
   already says `transition-duration: 0.01ms` on it, but section 1 above
   re-declares the whole `transition` SHORTHAND at the same specificity and,
   because this file is linked last, sits later in the cascade — so it would
   silently put 0.72s back. A later shorthand resets what an earlier longhand
   set; the same trap the pages document for backdrop-filter.

   In practice the pages replace the ring with a static .ring-grid under
   reduced motion and their carousel script returns before createCarousel, so
   nothing here is ever reached — which is exactly why it has to be right by
   construction rather than by observation. */
@media (prefers-reduced-motion: reduce) {
  .panel,
  html.is-moving .panel { transition-duration: 0.01ms; }
  /* once the flip is instant the card SWAPS faces instead of turning, and the
     delayed hide on .cap has nothing left to cover for — left in, it would
     strand the detail face on screen for 360ms after the card is already
     showing its dashboard again */
  .cap,
  .cap__link { transition: none; }
}
