/* ===========================================================
   Engine Den 2027 value case (story-ed-value.js): #ed-value and
   #ed-close. Engine Den's own artwork language: charcoal grunge,
   high-vis yellow, thin gold HUD frames with broken corners, and the
   signature price tag (red numerals in a gold angled-corner frame).
   Every selector is scoped to those two ids; class prefixes edv-
   (shared) and edc- (the receipt slip).
   =========================================================== */

:is(#ed-value, #ed-close) {
  --edv-line: color-mix(in srgb, var(--color-gold) 58%, transparent);
  /* Opaque on purpose: a see-through fill shows the frame layer's
     breaks and gold through it as stripes. */
  --edv-panel: color-mix(in srgb, var(--color-card), var(--color-strong) 3%);
  --edv-gap: clamp(1.25rem, 3.2vw, 3.25rem);
  /* clip, not hidden: hidden makes a scroll box, and the sticky visual
     column (unpinned wide layout) needs the page to be its scroller. */
  overflow: clip;
}

/* ---------- ground: grunge speckle and two low glows ---------- */

:is(#ed-value, #ed-close) .edv-grunge {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(55% 40% at 88% 8%, rgba(255, 240, 0, 0.07), transparent 70%),
    radial-gradient(45% 45% at 4% 96%, rgba(198, 154, 46, 0.08), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='260' height='260'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

:is(#ed-value, #ed-close) .edv-pin,
:is(#ed-value, #ed-close) .edv-after,
#ed-close > .sec-head,
#ed-close .edv-close {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 1320px;
  margin-inline: auto;
}

:is(#ed-value, #ed-close) .edv-pin { isolation: isolate; }

/* Pinned only: the outline figure bleeds off the bottom of the screen,
   under the progress strip, filling the stage's lower margin. */
:is(#ed-value, #ed-close) .edv-ghost {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: -1;
  display: none;
  margin: 0;
  font-family: var(--font-family-display);
  font-weight: 900;
  font-size: min(20vw, 30vh);
  line-height: 0.74;
  letter-spacing: -0.02em;
  white-space: nowrap;
  color: transparent;
  -webkit-text-stroke: 2px color-mix(in srgb, var(--color-primary) 10%, transparent);
  translate: 0 45%;
  pointer-events: none;
  user-select: none;
}

/* ---------- shared frames ----------
   One chamfered shape, two layers: ::before is the line (or gold),
   ::after the fill inset by the line width. The inner cut shrinks by
   bw x (2 - sqrt 2) so the diagonal line keeps the same weight. */

:is(#ed-value, #ed-close) :is(.edv-tag, .edv-hud, .edv-summary) {
  --cut: 14px;
  --bw: 1px;
  position: relative;
  isolation: isolate;
}

:is(#ed-value, #ed-close) :is(.edv-tag, .edv-hud, .edv-summary)::before,
:is(#ed-value, #ed-close) :is(.edv-tag, .edv-hud, .edv-summary)::after {
  content: '';
  position: absolute;
  z-index: -1;
  pointer-events: none;
}

:is(#ed-value, #ed-close) :is(.edv-tag, .edv-hud, .edv-summary)::before {
  inset: 0;
  background: var(--frame, var(--edv-line));
  clip-path: polygon(var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)), calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut));
}

:is(#ed-value, #ed-close) :is(.edv-tag, .edv-hud, .edv-summary)::after {
  --c: calc(var(--cut) - var(--bw) * 0.59);
  inset: var(--bw);
  background: var(--fill, var(--edv-panel));
  clip-path: polygon(var(--c) 0, 100% 0, 100% calc(100% - var(--c)), calc(100% - var(--c)) 100%, 0 100%, 0 var(--c));
}

/* HUD panels: thin gold line, broken twice along the top and bottom. */
:is(#ed-value, #ed-close) .edv-hud {
  --cut: 16px;
  --frame: linear-gradient(90deg,
      var(--edv-line) 0 14%, transparent 14% 17%,
      var(--edv-line) 17% 83%, transparent 83% 86%,
      var(--edv-line) 86%);
}

:is(#ed-value, #ed-close) .edv-n {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

:is(#ed-value, #ed-close) .edv-swap { display: inline-grid; }
:is(#ed-value, #ed-close) .edv-swap > * { grid-area: 1 / 1; }
:is(#ed-value, #ed-close) .edv-swap-from { visibility: hidden; }

/* ---------- stage ---------- */

:is(#ed-value, #ed-close) .edv-stage {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  gap: var(--edv-gap);
  align-items: start;
}

/* Unpinned and wide: the tag and months stay in view beside the cards. */
:is(#ed-value, #ed-close) .edv-visual {
  position: sticky;
  top: clamp(1rem, 5vh, 2.5rem);
  display: grid;
  gap: clamp(1.1rem, 3.2vh, 2.1rem);
  min-width: 0;
}

:is(#ed-value, #ed-close) .edv-beats {
  display: grid;
  gap: clamp(1rem, 2.5vh, 1.5rem);
  min-width: 0;
}

/* ---------- the price tag ---------- */

:is(#ed-value, #ed-close) .edv-tagwrap {
  --stamp: clamp(5.25rem, 8.5vw, 7.5rem);
  position: relative;
  justify-self: start;
  margin: calc(var(--stamp) * 0.42) calc(var(--stamp) * 0.72) 0 0;
}

:is(#ed-value, #ed-close) .edv-tag {
  --cut: clamp(14px, 1.5vw, 22px);
  --bw: 2px;
  --frame: var(--color-gold);
  --fill: radial-gradient(130% 120% at 0% 0%, rgba(222, 42, 38, 0.16), transparent 55%), var(--color-primary-foreground);
  display: inline-grid;
  gap: 0.2rem;
  padding: clamp(0.8rem, 2vh, 1.15rem) clamp(1.3rem, 2.4vw, 2rem) clamp(0.85rem, 2.1vh, 1.2rem);
}

/* Room on the right so the stamp's disc clears the numerals. */
:is(#ed-value, #ed-close) .edv-tagwrap .edv-tag { padding-right: calc(var(--stamp) * 0.3 + 0.6rem); }

:is(#ed-value, #ed-close) .edv-tag-label {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0;
  font-family: var(--font-family-display);
  font-weight: 700;
  font-size: clamp(0.7rem, 0.95vw, 0.82rem);
  line-height: 1.1;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-gold);
}

:is(#ed-value, #ed-close) .edv-tag-year {
  font-weight: 900;
  color: var(--color-primary);
}

:is(#ed-value, #ed-close) .edv-tag-price {
  display: flex;
  align-items: flex-start;
  margin: 0;
  font-family: var(--font-family-display);
  font-weight: 900;
  font-size: clamp(3rem, min(6.4vw, 10.5vh), 5.75rem);
  line-height: 0.92;
  letter-spacing: -0.01em;
  color: var(--color-red);
  text-shadow: 0 0 28px rgba(222, 42, 38, 0.35);
}

:is(#ed-value, #ed-close) .edv-tag-r {
  font-size: 0.5em;
  margin: 0.14em 0.06em 0 0;
}

:is(#ed-value, #ed-close) .edv-tag-was {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
  color: var(--color-muted-foreground);
}

:is(#ed-value, #ed-close) .edv-tag-was s {
  color: var(--color-foreground);
  text-decoration-color: var(--color-red);
  text-decoration-thickness: 2px;
}

/* The stamp borrows the logo: a yellow disc, black brush lettering. */
:is(#ed-value, #ed-close) .edv-stamp {
  position: absolute;
  top: calc(var(--stamp) * -0.42);
  right: calc(var(--stamp) * -0.72);
  z-index: 2;
  display: grid;
  place-items: center;
  width: var(--stamp);
  aspect-ratio: 1;
  margin: 0;
  border-radius: 50%;
  background: var(--color-primary);
  color: var(--color-primary-foreground);
  font-family: var(--font-family-brush);
  font-size: clamp(1.25rem, 2.1vw, 1.85rem);
  line-height: 1;
  transform: rotate(-12deg);
  box-shadow:
    0 0 0 4px var(--color-primary-foreground),
    0 0 0 5.5px var(--color-gold),
    0 16px 34px rgba(0, 0, 0, 0.5);
}

/* ---------- month rows ---------- */

:is(#ed-value, #ed-close) .edv-cal {
  display: grid;
  gap: clamp(0.8rem, 2.2vh, 1.3rem);
}

:is(#ed-value, #ed-close) .edv-row { --g: clamp(3px, 0.4vw, 5px); }

:is(#ed-value, #ed-close) .edv-row-head {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin: 0 0 0.45rem;
  font-family: var(--font-family-display);
}

:is(#ed-value, #ed-close) .edv-row-year {
  font-weight: 900;
  font-size: clamp(1.05rem, 1.6vw, 1.35rem);
  letter-spacing: 0.02em;
  color: var(--color-strong);
}

:is(#ed-value, #ed-close) .edv-row-meta {
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-muted-foreground);
}

:is(#ed-value, #ed-close) .edv-row-sum {
  margin-left: auto;
  font-weight: 900;
  font-size: clamp(1.15rem, 1.9vw, 1.6rem);
  line-height: 1;
  color: var(--color-primary);
}

:is(#ed-value, #ed-close) .edv-tiles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--g);
}

:is(#ed-value, #ed-close) .edv-tile {
  position: relative;
  display: grid;
  place-items: center;
  height: clamp(1.9rem, 4.8vh, 2.7rem);
  overflow: hidden;
  font-family: var(--font-family-display);
  font-weight: 800;
  font-size: clamp(0.56rem, 0.78vw, 0.74rem);
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted-foreground);
  background: color-mix(in srgb, var(--color-card) 85%, transparent);
  border: 1px solid var(--color-border);
  clip-path: polygon(6px 0, 100% 0, 100% 100%, 0 100%, 0 6px);
}

:is(#ed-value, #ed-close) .edv-tile.is-off {
  border-style: dashed;
  color: color-mix(in srgb, var(--color-muted-foreground) 65%, transparent);
  background:
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, 0.05) 0 3px, transparent 3px 7px),
    color-mix(in srgb, var(--color-card) 55%, transparent);
}

:is(#ed-value, #ed-close) .edv-tile-fill {
  position: absolute;
  inset: -1px;
  display: grid;
  place-items: center;
  background: var(--color-primary);
  color: var(--color-primary-foreground);
}

/* The three months 2027 adds carry a red corner. */
:is(#ed-value, #ed-close) .edv-tile.is-new .edv-tile-fill::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  border-style: solid;
  border-width: 0 9px 9px 0;
  border-color: transparent var(--color-red) transparent transparent;
}

/* A bracket under the months it names, text running on past it. */
:is(#ed-value, #ed-close) .edv-row-note {
  --col: calc((100% - 11 * var(--g)) / 12);
  --at: calc(var(--col) * var(--from) + var(--g) * var(--from));
  position: relative;
  margin: 0.3rem 0 0;
  padding: 0.55rem 0 0 var(--at);
  white-space: nowrap;
  font-family: var(--font-family-display);
  font-weight: 700;
  font-size: 0.66rem;
  line-height: 1.2;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-muted-foreground);
}

:is(#ed-value, #ed-close) .edv-row-note::before {
  content: '';
  position: absolute;
  top: 0;
  left: var(--at);
  width: calc(var(--col) * var(--span) + var(--g) * (var(--span) - 1));
  height: 6px;
  border: 1px solid var(--edv-line);
  border-top: 0;
}

:is(#ed-value, #ed-close) .edv-row-2027 .edv-row-note { color: var(--color-primary); }
:is(#ed-value, #ed-close) .edv-row-2027 .edv-row-note::before { border-color: var(--color-primary); }

/* ---------- beat cards ---------- */

:is(#ed-value, #ed-close) .edv-beat {
  display: flex;
  flex-direction: column;
  gap: clamp(0.6rem, 1.6vh, 0.95rem);
  padding: clamp(1.05rem, 2.6vh, 1.7rem) clamp(1.1rem, 2vw, 1.75rem);
  min-width: 0;
}

:is(#ed-value, #ed-close) .edv-kicker {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin: 0;
  font-family: var(--font-family-display);
  font-weight: 700;
  font-size: 0.72rem;
  line-height: 1;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-gold);
}

:is(#ed-value, #ed-close) .edv-kicker-n {
  display: inline-grid;
  place-items: center;
  min-width: 2.1rem;
  padding: 0.32rem 0.45rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  color: var(--color-primary-foreground);
  background: var(--color-primary);
  clip-path: polygon(6px 0, 100% 0, 100% 100%, 0 100%, 0 6px);
}

:is(#ed-value, #ed-close) .edv-beat-title {
  margin: 0;
  font-family: var(--font-family-display);
  font-weight: 800;
  font-size: clamp(1.3rem, min(2.3vw, 4vh), 2rem);
  line-height: 1.08;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  text-wrap: balance;
  color: var(--color-strong);
}

:is(#ed-value, #ed-close) .edv-beat-text {
  margin: 0;
  max-width: 48ch;
  font-size: clamp(0.92rem, 1.05vw, 1.02rem);
  line-height: 1.5;
  color: var(--color-foreground);
}

/* 2: chips */
:is(#ed-value, #ed-close) .edv-chips {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

:is(#ed-value, #ed-close) .edv-chip {
  padding: 0.55rem 0.95rem;
  font-family: var(--font-family-display);
  font-weight: 800;
  font-size: clamp(1rem, 1.5vw, 1.25rem);
  line-height: 1;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
  background: color-mix(in srgb, var(--color-primary) 8%, transparent);
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}

/* 3: same nine months, two bars */
:is(#ed-value, #ed-close) .edv-bars {
  display: grid;
  gap: clamp(0.7rem, 1.8vh, 1rem);
}

:is(#ed-value, #ed-close) .edv-bar-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  margin: 0 0 0.35rem;
}

:is(#ed-value, #ed-close) .edv-bar-label {
  font-family: var(--font-family-display);
  font-weight: 700;
  font-size: 0.78rem;
  line-height: 1.2;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-foreground);
}

:is(#ed-value, #ed-close) .edv-bar-sub {
  margin-left: 0.6rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--color-muted-foreground);
}

:is(#ed-value, #ed-close) .edv-bar-val {
  font-family: var(--font-family-display);
  font-weight: 900;
  font-size: clamp(1.15rem, 1.8vw, 1.5rem);
  line-height: 1;
  color: var(--color-strong);
}

:is(#ed-value, #ed-close) .is-2027 .edv-bar-val { color: var(--color-primary); }

:is(#ed-value, #ed-close) .edv-bar-track {
  position: relative;
  height: clamp(0.9rem, 2vh, 1.15rem);
  background: color-mix(in srgb, var(--color-foreground) 7%, transparent);
}

:is(#ed-value, #ed-close) .edv-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--w);
  background: color-mix(in srgb, var(--color-gold) 80%, transparent);
  transform-origin: left center;
}

:is(#ed-value, #ed-close) .is-2027 .edv-bar-fill { background: var(--color-primary); }

:is(#ed-value, #ed-close) .edv-bar-extra {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: var(--x);
  min-width: 4px;
  background: var(--color-red);
}

:is(#ed-value, #ed-close) .edv-bar-diff {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.3;
  color: var(--color-foreground);
}

:is(#ed-value, #ed-close) .edv-bar-diff-n {
  margin-right: 0.35rem;
  font-family: var(--font-family-display);
  font-weight: 900;
  font-size: 1.35rem;
  color: var(--color-red);
  white-space: nowrap;
}

/* 4: three more months */
:is(#ed-value, #ed-close) .edv-beat-punch {
  margin: 0;
  font-family: var(--font-family-display);
  font-weight: 800;
  font-size: clamp(1rem, 1.4vw, 1.2rem);
  line-height: 1.3;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--color-primary);
}

/* 5: what R300 buys, one dot per enquiry */
:is(#ed-value, #ed-close) .edv-dots-fig {
  display: grid;
  gap: 0.5rem;
  margin: 0;
}

/* Fixed dot size, as many per row as the card holds: the row count then
   reads as the month's volume, and the card stays short. */
:is(#ed-value, #ed-close) .edv-dots {
  display: grid;
  grid-template-columns: repeat(auto-fill, 14px);
  gap: 4px;
}

:is(#ed-value, #ed-close) .edv-dot {
  position: relative;
  aspect-ratio: 1;
  border-radius: 50%;
  background: color-mix(in srgb, var(--color-foreground) 26%, transparent);
}

:is(#ed-value, #ed-close) .edv-dot-lit {
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  background: var(--color-primary);
  box-shadow: 0 0 8px rgba(255, 240, 0, 0.55);
}

:is(#ed-value, #ed-close) .edv-dots-fig figcaption {
  font-size: 0.74rem;
  line-height: 1.4;
  color: var(--color-muted-foreground);
}

:is(#ed-value, #ed-close) .edv-hot-key {
  font-weight: 700;
  color: var(--color-primary);
}

/* Dashed: a projection, never mistaken for a measured result. */
:is(#ed-value, #ed-close) .edv-proj {
  display: grid;
  gap: 0.25rem;
  padding: 0.75rem 1rem;
  border: 1.5px dashed var(--edv-line);
  background: color-mix(in srgb, var(--color-gold) 5%, transparent);
}

:is(#ed-value, #ed-close) .edv-proj-label {
  justify-self: start;
  margin: 0 0 0.2rem;
  padding: 0.22rem 0.5rem;
  font-family: var(--font-family-display);
  font-weight: 800;
  font-size: 0.64rem;
  line-height: 1;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-gold);
  border: 1px solid var(--color-gold);
}

:is(#ed-value, #ed-close) .edv-proj-basis {
  margin: 0;
  font-size: 0.82rem;
  color: var(--color-muted-foreground);
}

:is(#ed-value, #ed-close) .edv-proj-result {
  margin: 0;
  font-family: var(--font-family-display);
  font-weight: 800;
  font-size: clamp(1.05rem, 1.6vw, 1.35rem);
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--color-strong);
}

/* ---------- progress strip (pinned only) ---------- */

:is(#ed-value, #ed-close) .edv-progress {
  display: none;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.6rem;
  list-style: none;
  margin: clamp(0.75rem, 2.4vh, 1.4rem) 0 0;
  padding: 0;
}

:is(#ed-value, #ed-close) .edv-progress li {
  display: grid;
  gap: 0.4rem;
}

:is(#ed-value, #ed-close) .edv-progress-bar {
  display: block;
  height: 3px;
  overflow: hidden;
  background: color-mix(in srgb, var(--color-foreground) 14%, transparent);
}

:is(#ed-value, #ed-close) .edv-progress-fill {
  display: block;
  height: 100%;
  background: var(--color-primary);
  transform-origin: left center;
}

:is(#ed-value, #ed-close) .edv-progress-label {
  font-family: var(--font-family-display);
  font-weight: 700;
  font-size: 0.66rem;
  line-height: 1;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-muted-foreground);
}

/* ---------- pinned mode (class set by animate(), never in static) ---------- */

#ed-value.edv-is-pinned .edv-pin {
  height: 100vh;
  height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-block: clamp(0.9rem, 3.2vh, 2.25rem);
}

#ed-value.edv-is-pinned .sec-head { margin-bottom: clamp(0.7rem, 2.4vh, 1.75rem); }
#ed-value.edv-is-pinned .edv-stage { align-items: start; }
#ed-value.edv-is-pinned .edv-visual { position: relative; top: auto; }
/* Top-aligned, so each card's kicker lands where the last one was. */
#ed-value.edv-is-pinned .edv-beat { grid-area: 1 / 1; align-self: start; }
#ed-value.edv-is-pinned .edv-ghost { display: block; }
#ed-value.edv-is-pinned .edv-progress { display: grid; }

/* ---------- after the pin ---------- */

:is(#ed-value, #ed-close) .edv-after {
  display: grid;
  gap: clamp(1rem, 2.6vh, 1.6rem);
  margin-top: clamp(3rem, 9vh, 6rem);
}

:is(#ed-value, #ed-close) .edv-hazard {
  height: 8px;
  background: repeating-linear-gradient(-45deg, var(--color-primary) 0 12px, var(--color-primary-foreground) 12px 24px);
}

:is(#ed-value, #ed-close) .edv-keeps-head {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.5rem;
}

:is(#ed-value, #ed-close) .edv-keeps-eyebrow {
  margin: 0;
  font-family: var(--font-family-display);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-gold);
}

:is(#ed-value, #ed-close) .edv-keeps-title {
  margin: 0;
  font-family: var(--font-family-display);
  font-weight: 900;
  font-size: clamp(1.6rem, 3vw, 2.5rem);
  line-height: 1;
  text-transform: uppercase;
  color: var(--color-strong);
}

:is(#ed-value, #ed-close) .edv-keeps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: clamp(0.7rem, 1.2vw, 1rem);
}

:is(#ed-value, #ed-close) .edv-keep {
  display: grid;
  align-content: start;
  gap: 0.45rem;
  padding: 1.1rem 1rem 1.2rem;
}

:is(#ed-value, #ed-close) .edv-keep-n {
  font-family: var(--font-family-display);
  font-weight: 900;
  font-size: 1.6rem;
  line-height: 1;
  color: var(--color-primary);
}

:is(#ed-value, #ed-close) .edv-keep-title {
  margin: 0;
  font-family: var(--font-family-display);
  font-weight: 800;
  font-size: 1.02rem;
  line-height: 1.15;
  text-transform: uppercase;
  color: var(--color-strong);
}

:is(#ed-value, #ed-close) .edv-keep-desc {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--color-muted-foreground);
}

:is(#ed-value, #ed-close) .edv-fine {
  margin: 0;
  font-size: 0.76rem;
  line-height: 1.5;
  color: var(--color-muted-foreground);
}

/* ---------- #ed-close: the 2026 receipt slip ---------- */

#ed-close .edv-close {
  display: grid;
  gap: clamp(2rem, 5vh, 3rem);
  margin-top: clamp(0.5rem, 2vh, 1.25rem);
}

/* The slip beside the 2027 card; the card takes the stacked (phone)
   arrangement of its cutout, since its column is half the width.
   .edv-close in each selector outranks the summary rules further down. */
@media (min-width: 1100px) {
  #ed-close .edv-close {
    grid-template-columns: minmax(0, 36rem) minmax(0, 1fr);
    align-items: center;
    column-gap: var(--edv-gap);
  }
  #ed-close .edv-close .edv-summary { margin-top: 0; }
  #ed-close .edv-close .edv-summary:has(.edv-summary-prod) {
    --fill: radial-gradient(34% 40% at 80% 10%, rgba(255, 240, 0, 0.11), transparent 70%), var(--color-primary-foreground);
    padding-right: clamp(1.25rem, 3vw, 2.5rem);
  }
  #ed-close .edv-close .edv-summary-prod {
    position: static;
    order: -1;
    justify-self: end;
    width: min(45%, 15rem);
    margin: -4rem -0.5rem -2rem 0;
    translate: none;
  }
  #ed-close .edv-close .edv-summary-grid { grid-template-columns: auto auto; }
  #ed-close .edv-close .edv-summary-cell.is-total { grid-column: 1 / -1; }
}

:is(#ed-value, #ed-close) .edc-printer {
  --edc-paper: color-mix(in srgb, var(--color-foreground) 94%, var(--color-gold));
  --edc-ink: var(--color-primary-foreground);
  --edc-ink-soft: color-mix(in srgb, var(--color-primary-foreground) 64%, var(--edc-paper));
  --edc-hl: color-mix(in srgb, var(--color-primary) 85%, transparent);
  --edc-tooth: 9px;
  width: 100%;
  max-width: 36rem;
}

/* The till's slot: the paper feeds out from under it. */
:is(#ed-value, #ed-close) .edc-slot {
  position: relative;
  z-index: 2;
  height: 16px;
  border-radius: 4px;
  border-top: 2px solid var(--color-gold);
  background: linear-gradient(var(--color-primary-foreground), var(--color-card));
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.55);
}

/* Clipped only along the top (under the slot), so the paper's shadow
   still shows at the sides and below. */
:is(#ed-value, #ed-close) .edc-feed {
  margin: -6px 0.75rem 0;
  clip-path: inset(0 -3rem -4rem -3rem);
}

:is(#ed-value, #ed-close) .edc-slipwrap { filter: drop-shadow(0 16px 22px rgba(0, 0, 0, 0.5)); }

/* Torn bottom edge: a row of teeth cut by a repeating conic mask. */
:is(#ed-value, #ed-close) .edc-slip {
  padding: 1.6rem clamp(1.1rem, 3vw, 1.75rem) calc(1.5rem + var(--edc-tooth));
  background: var(--edc-paper);
  color: var(--edc-ink);
  -webkit-mask: conic-gradient(from -45deg at bottom, transparent, black 1deg 89deg, transparent 90deg) 50% / calc(2 * var(--edc-tooth)) 100%;
  mask: conic-gradient(from -45deg at bottom, transparent, black 1deg 89deg, transparent 90deg) 50% / calc(2 * var(--edc-tooth)) 100%;
}

:is(#ed-value, #ed-close) .edc-slip-head {
  padding-bottom: 0.9rem;
  border-bottom: 2px dashed var(--edc-ink-soft);
  text-align: center;
}

:is(#ed-value, #ed-close) .edc-slip-client {
  margin: 0;
  font-family: var(--font-family-display);
  font-weight: 900;
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

:is(#ed-value, #ed-close) .edc-slip-sub {
  margin: 0.2rem 0 0;
  font-family: var(--font-family-display);
  font-weight: 700;
  font-size: 0.74rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--edc-ink-soft);
}

:is(#ed-value, #ed-close) .edc-lines {
  list-style: none;
  margin: 0;
  padding: 0;
}

:is(#ed-value, #ed-close) .edc-line {
  display: grid;
  grid-template-columns: 1.9rem minmax(0, 1fr) auto;
  align-items: baseline;
  column-gap: 0.75rem;
  padding: 0.7rem 0;
  border-bottom: 1px dotted var(--edc-ink-soft);
}

:is(#ed-value, #ed-close) .edc-line-n {
  font-family: var(--font-family-display);
  font-weight: 800;
  font-size: 0.8rem;
  color: var(--edc-ink-soft);
  font-variant-numeric: tabular-nums;
}

:is(#ed-value, #ed-close) .edc-line-item {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 500;
  line-height: 1.3;
}

:is(#ed-value, #ed-close) .edc-line-note {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.76rem;
  font-weight: 400;
  color: var(--edc-ink-soft);
}

:is(#ed-value, #ed-close) .edc-line-fig {
  margin: 0;
  font-family: var(--font-family-display);
  font-weight: 800;
  font-size: 1rem;
  text-transform: uppercase;
  text-align: right;
  white-space: nowrap;
}

/* Highlighter: the lower two thirds of the line, swept left to right. */
:is(#ed-value, #ed-close) .edc-line-fig mark {
  padding: 0 0.2em;
  color: inherit;
  background: linear-gradient(transparent 36%, var(--edc-hl) 36%, var(--edc-hl) 92%, transparent 92%) no-repeat 0 0 / 100% 100%;
}

:is(#ed-value, #ed-close) .edc-slip-total {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: baseline;
  column-gap: 0.75rem;
  margin: 0.9rem 0 0;
  padding-top: 0.8rem;
  border-top: 2px solid var(--edc-ink);
  font-family: var(--font-family-display);
}

:is(#ed-value, #ed-close) .edc-slip-year { font-weight: 900; font-size: 1.05rem; }

:is(#ed-value, #ed-close) .edc-slip-calc {
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--edc-ink-soft);
}

:is(#ed-value, #ed-close) .edc-slip-total strong {
  font-weight: 900;
  font-size: clamp(1.4rem, 2.6vw, 1.8rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--color-red);
}

:is(#ed-value, #ed-close) .edc-slip-foot {
  margin: 1rem 0 0;
  font-size: 0.72rem;
  line-height: 1.45;
  color: var(--edc-ink-soft);
}

@media (max-width: 599.98px) {
  :is(#ed-value, #ed-close) .edc-line { grid-template-columns: 1.6rem minmax(0, 1fr); }
  :is(#ed-value, #ed-close) .edc-line-fig { grid-column: 2; margin-top: 0.3rem; text-align: left; }
  :is(#ed-value, #ed-close) .edc-slip-total { grid-template-columns: auto minmax(0, 1fr); }
  :is(#ed-value, #ed-close) .edc-slip-total strong { grid-column: 1 / -1; margin-top: 0.3rem; }
}

/* ---------- the closing sum (page's .eq-split / .lead-* markup) ---------- */

:is(#ed-value, #ed-close) .edc-eq {
  grid-column: 1 / -1;
  position: relative;
  z-index: 1;
  margin-top: clamp(1.5rem, 6vh, 4rem);
  text-align: center;
}

/* Sized like .eq-slide .lead-total, which this section can't carry: that
   class would centre the slip and the card too. */
:is(#ed-value, #ed-close) .edc-eq .lead-total { font-size: clamp(4rem, 12vw, 9.5rem); }
:is(#ed-value, #ed-close) .edc-eq .lead-total-wrap > .lead-label { margin-top: 1.1rem; }
:is(#ed-value, #ed-close) .edc-eq :is(.lead-num, .lead-total) { white-space: nowrap; }
:is(#ed-value, #ed-close) .edc-eq .lead-sub { margin-inline: auto; }
:is(#ed-value, #ed-close) .edc-eq-n { display: inline-block; }

/* ---------- the proposal summary ---------- */

:is(#ed-value, #ed-close) .edv-summary {
  --cut: clamp(18px, 2vw, 28px);
  --bw: 2px;
  --frame: var(--color-gold);
  --fill: radial-gradient(90% 120% at 100% 0%, rgba(255, 240, 0, 0.08), transparent 60%), var(--color-primary-foreground);
  display: grid;
  gap: clamp(1rem, 2.4vh, 1.5rem);
  margin-top: clamp(1rem, 3vh, 2rem);
  padding: clamp(1.4rem, 3.5vh, 2.25rem) clamp(1.25rem, 3vw, 2.5rem);
}

/* A low yellow glow lifts the dark engine off the near-black fill. */
:is(#ed-value, #ed-close) .edv-summary:has(.edv-summary-prod) {
  --fill: radial-gradient(36% 80% at 84% 52%, rgba(255, 240, 0, 0.11), transparent 70%), var(--color-primary-foreground);
  padding-right: clamp(10rem, 27vw, 22rem);
}

/* No cutout to fill the right: the line and the figures share the row. */
@media (min-width: 1100px) {
  :is(#ed-value, #ed-close) .edv-summary:not(:has(.edv-summary-prod)) {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
    column-gap: clamp(2rem, 4vw, 4rem);
  }
  :is(#ed-value, #ed-close) .edv-summary:not(:has(.edv-summary-prod)) .edv-summary-id { align-self: center; }
  :is(#ed-value, #ed-close) .edv-summary:not(:has(.edv-summary-prod)) .edv-fine { grid-column: 1 / -1; }
}

:is(#ed-value, #ed-close) .edv-summary-prod {
  position: absolute;
  right: clamp(0.5rem, 2vw, 2rem);
  top: 50%;
  z-index: 1;
  width: clamp(9rem, 24vw, 19rem);
  height: auto;
  translate: 0 -50%;
  pointer-events: none;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.55));
}

:is(#ed-value, #ed-close) .edv-summary-id {
  display: flex;
  align-items: center;
  gap: 1rem;
}

:is(#ed-value, #ed-close) .edv-summary-logo {
  width: clamp(3.5rem, 6vw, 5rem);
  height: auto;
  flex: none;
}

:is(#ed-value, #ed-close) .edv-summary-eyebrow {
  margin: 0 0 0.3rem;
  font-family: var(--font-family-display);
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--color-gold);
}

:is(#ed-value, #ed-close) .edv-summary-line {
  margin: 0;
  max-width: 32ch;
  font-family: var(--font-family-display);
  font-weight: 800;
  font-size: clamp(1.15rem, 2vw, 1.6rem);
  line-height: 1.15;
  text-transform: uppercase;
  color: var(--color-strong);
}

:is(#ed-value, #ed-close) .edv-summary-grid {
  display: grid;
  grid-template-columns: auto auto auto;
  justify-content: start;
  align-items: end;
  gap: 1rem clamp(1.25rem, 4vw, 3.5rem);
  margin: 0;
}

:is(#ed-value, #ed-close) .edv-summary-cell dt {
  margin-bottom: 0.45rem;
  font-family: var(--font-family-display);
  font-weight: 700;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--color-muted-foreground);
}

:is(#ed-value, #ed-close) .edv-summary-cell dd {
  margin: 0;
  font-family: var(--font-family-display);
  font-weight: 900;
  font-size: clamp(1.8rem, 3.4vw, 2.8rem);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--color-strong);
}

:is(#ed-value, #ed-close) .edv-tag-total {
  --cut: 14px;
  padding: 0.5rem 1.1rem 0.6rem;
}

:is(#ed-value, #ed-close) .edv-tag-total .edv-tag-price { font-size: clamp(2.3rem, 4.6vw, 4rem); }

:is(#ed-value, #ed-close) .edv-summary-total {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---------- smaller screens ---------- */

@media (max-width: 1099.98px) {
  :is(#ed-value, #ed-close) .edv-keeps { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  :is(#ed-value, #ed-close) .edv-keep { grid-column: span 2; }
  :is(#ed-value, #ed-close) .edv-keep:nth-child(n + 4) { grid-column: span 3; }
}

@media (max-width: 899.98px) {
  :is(#ed-value, #ed-close) .edv-stage { grid-template-columns: minmax(0, 1fr); }
  :is(#ed-value, #ed-close) .edv-visual { position: static; }
  :is(#ed-value, #ed-close) .edv-summary:has(.edv-summary-prod) { padding-right: clamp(1.25rem, 3vw, 2.5rem); }
  :is(#ed-value, #ed-close) .edv-summary-prod {
    position: static;
    order: -1;
    justify-self: end;
    width: min(55%, 14rem);
    margin: -3.5rem -0.5rem -1.5rem 0;
    translate: none;
  }
  :is(#ed-value, #ed-close) .edv-summary-grid { grid-template-columns: auto auto; }
  :is(#ed-value, #ed-close) .edv-summary-cell.is-total { grid-column: 1 / -1; }
}

@media (max-width: 599.98px) {
    :is(#ed-value, #ed-close) .edv-keeps { grid-template-columns: minmax(0, 1fr); }
  :is(#ed-value, #ed-close) .edv-keep,
  :is(#ed-value, #ed-close) .edv-keep:nth-child(n + 4) { grid-column: auto; }
  :is(#ed-value, #ed-close) .edv-tile { letter-spacing: 0; font-size: 0.55rem; }
  :is(#ed-value, #ed-close) .edv-row-meta { letter-spacing: 0.06em; font-size: 0.64rem; }
      :is(#ed-value, #ed-close) .edv-bar-sub { display: block; margin: 0.2rem 0 0; }
}
