/*
  Deal Network Design System  —  v0.7.0 (30.09.2026: owner palette, Figtree, no dark mode; shared components in components.css)
  -------------------------------------------------------------------------
  SINGLE source of truth for every frontend component in the network:
  offer cards, intelligence widgets, leaderboards, content, forms.

  v0.6.0 (27.09.2026, vibecode audit workstream G — craft consolidation):
  added --ds-text-xs/sm/md/lg/xl (a real fixed type scale — the audit
  measured 21-34 distinct, mostly-compounding-em font-sizes per page),
  --ds-hover-lift (one lift distance — 4 different translateY values were
  in use across 22 files) and --ds-shadow-lift (the "hover/elevated" shadow
  step, so plugins stop inventing their own hover-shadow recipe). Nothing
  else in this file changed; every plugin's own --xxx-radius/--xxx-shadow
  variables were repointed at the existing --ds-r-xx and --ds-shadow tokens in
  their own files (see reports/vibecode_audit_20260927/done_G.md) rather
  than here, so this stays additive-only.

  v0.5.0 (26.09.2026, UX fix workstream B): added the --ds-accent / --ds-cta-*
  / --ds-neutral-* token block (aliases over --ds-money-*, see :root below) —
  ONE accent colour reserved for CTAs + discount figures, everything else
  neutral. Nothing else changed; existing consumers are unaffected.

  Distilled DNA:
    - Offer cards      <- Skyscanner / RetailMeNot / Honey
    - Intelligence     <- Hopper buy-wait / Google Flights price history /
                          financial dashboards (Stripe, Bloomberg)

  PRINCIPLES (apply to ALL families):
    1. Color scarcity   — green = money/savings ONLY. Everything else neutral.
    2. Semantic color   — green = action, dark = status/trust, amber = urgency.
    3. Label every number with its unit. Forecast dimmer than confirmed.
    4. Flat, lean, boring on purpose. Hierarchy via size + weight, not chrome.

  MARKUP CONTRACT
    Wrap any component in a `.ds` element. Compose from these primitives:
      ds-card (--hero)         ds-val (--best)        ds-badge
      ds-btn (--go / --block)  ds-code                ds-chip (--ship / --urgent)
      ds-stat                  ds-signal (--buy / --wait / --watch)
      ds-spark / ds-spark__bar (--fc)                 ds-section
      ds-logo (--lg)  — brand-mark tile, monogram now / <img> later, same box
    Layout helpers: ds-feed, ds-stack, ds-row-top, ds-row-act, ds-row-meta,
                    ds-stats-3, ds-cta-row
  -------------------------------------------------------------------------
*/

/* NB (superseded): fonts are now self-hosted Figtree (css/fonts.css). Old note: Plus Jakarta Sans + JetBrains Mono were loaded via wp_enqueue_style('ds-fonts') in
   deal-design-system.php (a real <link> with display=swap + preconnect) — NOT a render-blocking @import. */

:root{
  /* money / action (green) — AA contrast on white */
  --ds-money-ink:#17643A;          /* G700: green text on white (figures, links) */
  --ds-money-solid:#1F7A46;        /* G600: THE action colour */
  --ds-money-solid-hover:#17643A;
  --ds-money-fill:#F0F8F3;         /* G50 wash */
  --ds-money-bright:#5FB07D;      /* G400: decorative only */

  /* status / trust (dark charcoal) */
  --ds-status-ink:#16201B;
  --ds-status-fill:#E8EDEA;

  /* urgency (amber) — AA contrast on white */
  --ds-urgent-ink:#B8560B;
  --ds-urgent-fill:#FDF1E3;

  /* neutrals */
  --ds-ink:#16201B;        /* primary text          */
  --ds-muted:#56635B;      /* secondary text (AA)    */
  --ds-faint:#56635B;      /* hints: same as muted (owner palette has no lighter text colour) */
  --ds-line:#D9E0DC;       /* hairline               */
  --ds-surface:#FFFFFF;    /* card background        */
  --ds-surface-2:#F3F6F4;  /* tiles / code wells     */
  --ds-page:#F3F6F4;       /* page background        */

  /* typography */
  --ds-font:"Figtree",system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  --ds-mono:var(--ds-font);   /* no mono family in the owner palette */

  /* radius */
  --ds-r-sm:8px;
  --ds-r-btn:10px;
  --ds-r-chip:6px;
  --ds-r:12px;
  --ds-r-lg:12px;
  --ds-r-pill:6px;            /* chips are 6px in the approved design */

  /* elevation — resting step + one elevated/hover step (27.09.2026: two
     near-duplicate shadow recipes were found live across the network,
     e.g. rgba(22,32,27,.06)/.03 vs this rgba(22,32,27,...) pair doing the
     same "soft card elevation" job — plugins now alias onto these two
     instead of inventing their own). */
  --ds-shadow:none;
  --ds-shadow-lift:0 1px 3px rgba(22,32,27,.14),0 0 0 1px rgba(22,32,27,.04);   /* the one shadow: best offer card */

  /* type scale — a fixed rem/px step table. 27.09.2026: several plugins
     sized components as a bare em fraction of whatever they happened to
     sit inside (0.8em, 0.65em, 0.9em, ...), which compounds into
     fractional pixels nobody chose (13.6px, 20.8px, ...) once nested.
     Point those rules at these instead. */
  --ds-text-xs:12px;
  --ds-text-sm:13px;
  --ds-text-md:14px;
  --ds-text-lg:16px;
  --ds-text-xl:20px;

  /* one hover-lift distance for every card/button hover across the
     network (27.09.2026 — 4 different translateY values were measured
     doing the same "this is interactive" job). */
  --ds-hover-lift:0px;

  --ds-t:160ms ease;

  /* --- owner palette additions (design/tokens.json, 30.09.2026) --- */
  --ds-subtle:#E8EDEA;       /* zebra rows, input fill, monogram tile */
  --ds-g50:#F0F8F3; --ds-g100:#E2F1E7; --ds-g200:#C4E3D0;
  --ds-g600:#1F7A46; --ds-g700:#17643A; --ds-g900:#0E3D25;
  --ds-lime:#54B435;         /* header band only */
  /* footer: light by owner decision 30.09.2026. To flip to the deep green footer change ONLY these three. */
  --ds-footer-bg:#F3F6F4; --ds-footer-ink:#16201B; --ds-footer-line:#D9E0DC;


  /* --- accent & CTA reservation (26.09.2026 UX fix workstream B) ---------
     ONE accent colour is reserved network-wide for exactly two things:
       1. primary CTA buttons/links ("Näita koodi", "Mine poodi", etc.)
       2. discount / price figures (the actual % or amount shown to the user)
     Nothing else should use it. The 26.09.2026 review found every plugin
     reaching for its own idea of "the important colour" — teal here, navy
     there, orange in similar-brands — so nothing on the page actually stood
     out. These are ALIASES over the existing --ds-money-* values (nothing
     changes visually on this pass); the point is a stable, intention-
     revealing name for every other plugin to converge on. See
     reports/ux_review_20260926/tokens_B.md for the full adoption list and
     which existing hex/var each consumer should replace. */
  --ds-accent:var(--ds-money-solid);
  --ds-accent-hover:var(--ds-money-solid-hover);
  --ds-accent-ink:var(--ds-money-ink);
  --ds-accent-fill:var(--ds-money-fill);
  --ds-accent-bright:var(--ds-money-bright);   /* accent on a dark surface (hero cards) */

  --ds-cta-bg:var(--ds-accent);
  --ds-cta-bg-hover:var(--ds-accent-hover);
  --ds-cta-text:#FFFFFF;

  /* Everything that is NOT a CTA or a discount figure — toggles, chips,
     badges, calendar/heatmap chrome, secondary buttons, meta text, icons —
     uses a neutral surface/ink instead of borrowing the accent. */
  --ds-neutral-ink:var(--ds-ink);
  --ds-neutral-muted:var(--ds-muted);
  --ds-neutral-surface:var(--ds-surface-2);
  --ds-neutral-border:var(--ds-line);
}



/* --- wrapper reset: survive theme + Tailwind preflight ------------------ */
.ds,.ds *{box-sizing:border-box;}
.ds{font-family:var(--ds-font);color:var(--ds-ink);line-height:1.5;-webkit-font-smoothing:antialiased;}
.ds a{color:inherit;text-decoration:none;}
/* UI link reset — card / button / CTA links across the deal network are NEVER underlined (blog body links keep theirs for accessibility). !important beats the theme's .entry-content a underline. */
.dhp a,.bof-wrapper a,.lof-wrapper a,.clo-wrapper a,a[class*="-cta"],a[class*="-btn"],a[class*="-deal"],a[class*="-card"],a[class*="-pill"],a[class*="brand-link"],a[class*="-activate-offer"],a[class*="-chip"]{text-decoration:none!important;}
.ds p{margin:0;}

/* --- card -------------------------------------------------------------- */
.ds-card{
  background:var(--ds-surface);
  border:1px solid var(--ds-line);
  border-radius:var(--ds-r-lg);
  box-shadow:var(--ds-shadow);
  padding:14px 16px;
}
.ds-card--hero{border:2px solid var(--ds-money-solid);}

/* --- layout helpers ---------------------------------------------------- */
.ds-feed{display:flex;flex-direction:column;gap:10px;}
.ds-stack{display:flex;flex-direction:column;gap:9px;}
.ds-row-top{display:flex;justify-content:space-between;align-items:baseline;gap:12px;}
.ds-row-act{display:flex;gap:8px;align-items:stretch;}
.ds-row-meta{display:flex;justify-content:space-between;align-items:center;gap:10px;font-size:12px;color:var(--ds-faint);}
.ds-stats-3{display:grid;grid-template-columns:repeat(3,1fr);gap:10px;}

/* --- section label ----------------------------------------------------- */
.ds-section{font-size:13px;font-weight:700;color:var(--ds-muted);letter-spacing:.02em;margin:0 0 8px;}

/* --- discount anchor value (the headline number) ----------------------- */
.ds-val{font-size:21px;font-weight:800;color:var(--ds-ink);white-space:nowrap;font-variant-numeric:tabular-nums;}
.ds-val--best{color:var(--ds-money-ink);}     /* color scarcity: best deal only */

/* --- brand name -------------------------------------------------------- */
.ds-brand{font-size:15px;font-weight:700;color:var(--ds-ink);}

/* --- supporting copy --------------------------------------------------- */
.ds-desc{font-size:13px;color:var(--ds-muted);}

/* --- badge (money) ----------------------------------------------------- */
.ds-badge{display:inline-block;font-size:11px;font-weight:700;padding:2px 8px;border-radius:var(--ds-r-sm);background:var(--ds-money-fill);color:var(--ds-money-ink);}

/* --- chips ------------------------------------------------------------- */
.ds-chip{display:inline-block;font-size:12px;font-weight:600;padding:3px 9px;border-radius:var(--ds-r-sm);}
.ds-chip--ship{background:var(--ds-status-fill);color:var(--ds-status-ink);}
.ds-chip--urgent{background:var(--ds-urgent-fill);color:var(--ds-urgent-ink);}
.ds-chip i{vertical-align:-2px;margin-right:4px;}

/* --- code well (masked until reveal) ----------------------------------- */
.ds-code{display:inline-flex;align-items:center;font-family:var(--ds-mono);font-size:14px;font-weight:700;letter-spacing:2px;color:var(--ds-muted);background:var(--ds-surface-2);border-radius:var(--ds-r-sm);padding:9px 12px;}

/* --- buttons ----------------------------------------------------------- */
/* Rule 1: no border+radius (browser clips); fake the border with inset shadow.
   Rule 2: inline-block for text buttons (inline-flex clips descenders). */
.ds-btn{
  display:inline-block;
  font:inherit;font-weight:700;font-size:14px;line-height:1.2;text-align:center;
  padding:12px 16px;min-height:44px;
  border:none;border-radius:var(--ds-r-sm);
  background:transparent;color:var(--ds-ink);
  box-shadow:inset 0 0 0 1px var(--ds-line);
  cursor:pointer;transition:box-shadow var(--ds-t),background var(--ds-t);
}
.ds-btn i{vertical-align:-2px;margin-left:5px;}
.ds-btn:hover{box-shadow:inset 0 0 0 1px var(--ds-muted);}
.ds-btn:focus-visible{outline:2px solid var(--ds-money-solid);outline-offset:2px;}
.ds-btn--go{background:var(--ds-money-solid);color:#fff;box-shadow:none;}
.ds-btn--go:hover{background:var(--ds-money-solid-hover);box-shadow:none;}
.ds-btn--block{display:block;width:100%;}

/* --- stat tile (intelligence) ------------------------------------------ */
.ds-stat{background:var(--ds-surface-2);border-radius:var(--ds-r);padding:10px 12px;}
.ds-stat__label{font-size:12px;color:var(--ds-muted);margin:0 0 3px;}
.ds-stat__num{font-size:22px;font-weight:800;color:var(--ds-ink);margin:0;font-variant-numeric:tabular-nums;}

/* --- signal / verdict pill (the intelligence anchor) ------------------- */
.ds-signal{display:inline-flex;align-items:center;gap:6px;font-size:13px;font-weight:700;padding:5px 11px;border-radius:var(--ds-r-sm);white-space:nowrap;}
.ds-signal--buy{background:var(--ds-money-fill);color:var(--ds-money-ink);}
.ds-signal--wait{background:var(--ds-urgent-fill);color:var(--ds-urgent-ink);}
.ds-signal--watch{background:var(--ds-status-fill);color:var(--ds-status-ink);}
.ds-signal i{font-size:15px;}

/* --- sparkline (confirmed vs forecast) --------------------------------- */
.ds-spark{display:flex;align-items:flex-end;gap:5px;height:62px;}
.ds-spark__bar{flex:1;background:var(--ds-faint);border-radius:2px 2px 0 0;min-height:3px;}
.ds-spark__bar--fc{opacity:.3;}            /* forecast: dimmer than confirmed */

/* --- mobile ------------------------------------------------------------ */
@media (max-width:480px){
  .ds-cta-row{flex-direction:column;}
  .ds-cta-row .ds-btn{width:100%;}
  .ds-stats-3{grid-template-columns:repeat(3,1fr);gap:8px;}
}

/* --- reduced motion ---------------------------------------------------- */
@media (prefers-reduced-motion:reduce){
  .ds-btn{transition:none;}
}

/* === Compliance === */
/* Belt-and-suspenders: suppress LLM buy/wait advice prose. PRIMARY fix is server-side
   (BHI sanitize_signal_text() returns '' so these never render); this CSS is backup in
   case that field ever returns. Targets every buy_signal_text/reason render class. */
.bhi-urgency-text,.bhi-signal-text,.bhi-pred-text,.bhi-pred-reason,.bhi-pi-prediction,.bhi-highlight-text{display:none!important;}
/* Neutralise the buy/wait signal COLOUR-CODING (amber=wait, green=buy implied a directive).
   One neutral treatment for every state; the reframed data LABEL carries the meaning. */
.bhi-signal-icon,.bhi-urgency-icon{background:var(--ds-surface-2,#f5f7f9)!important;}
.bhi-signal-label,.bhi-urgency-label{color:var(--ds-ink,#1a2332)!important;}
.bhi-signal-xl,.bhi-signal-m,.bhi-signal-s,.bhi-urgency-alert{border-color:var(--ds-line,#e6e9ef)!important;}
.bhi-signal-s.bhi-signal-buy_now,.bhi-signal-s.bhi-signal-good_time,.bhi-signal-s.bhi-signal-wait,.bhi-signal-s.bhi-signal-uncertain{background:var(--ds-surface-2,#f5f7f9)!important;color:var(--ds-ink,#1a2332)!important;}
/* bhi-script.js injects a colour-coded buy-signal DOT (green=buy / amber=wait, inline-styled) into
   every brand link site-wide (.brand-link[data-brand]) — a buy/wait directive. Remove it + the
   injected mini-trend on brand links; the directory shows reliability + discount as data instead. */
.bhi-signal-dot{display:none!important;}
.brand-link .bhi-mini-trend,.sb-brand-item .bhi-mini-trend{display:none!important;}

/* === Mobile QA fixes (28.06.2026) === */
/* BHI 4-up stat grid: long pattern/trend words ("ebakorrapärane") were forcing cells past min-content
   → grid overflowed + clipped the right column. minmax(0,1fr) lets cells shrink; word-break wraps. */
@media (max-width:600px){
  .bhi-stats-row{grid-template-columns:repeat(2,minmax(0,1fr))!important;}
  .bhi-stats-row .bhi-stat-box{min-width:0!important;}
  .bhi-stats-row .bhi-stat-number{overflow-wrap:anywhere!important;word-break:break-word!important;}
}
/* Flatten the historic-trends-viewer off-brand ORANGE gradient "next likely" card to the flat design system. */
.historic-trends-viewer-component .htv-next-likely-card-mobile{background:var(--ds-money-fill,#E6F7F1)!important;color:var(--ds-ink,#1a2332)!important;}
.historic-trends-viewer-component .htv-next-likely-card-mobile .card-title,.historic-trends-viewer-component .htv-next-likely-card-mobile .htv-card-title{color:var(--ds-money-ink,#0F766E)!important;}
.historic-trends-viewer-component .htv-orange-card-button{background:var(--ds-money-solid,#0F766E)!important;color:#fff!important;}
/* History toggle ("Peida aegunud") was an oversized dark full-width pill on mobile; restore a compact, right-aligned, light button. */
.bhi-history-toggle-wrapper{text-align:right!important;}
.bhi-history-toggle{display:inline-flex!important;width:auto!important;max-width:max-content!important;padding:9px 16px!important;font-size:.85rem!important;font-weight:600!important;background:var(--ds-surface-2,#f5f7f9)!important;color:var(--ds-muted,#5c6a7f)!important;border:1px solid var(--ds-line,#e6e9ef)!important;border-radius:var(--ds-r-pill,999px)!important;box-shadow:none!important;min-height:0!important;}
.bhi-history-toggle[aria-expanded="true"]{background:var(--ds-money-fill,#E6F7F1)!important;color:var(--ds-money-ink,#0F766E)!important;border-color:var(--ds-money-solid,#0F766E)!important;}
/* CREDIBILITY: the BHI "✅ Kehtib kuni [date]" chip stamps a hardcoded DEFAULT expiry (≈ today+18mo,
   e.g. 26.12.2027) on EVERY offer incl. expired ones — a fake green "valid until ✓" that contradicts the
   card's real status. Suppress it; the offer card shows the true active/expired state + real expiry.
   (Deeper fix: the chip should read each offer's real expiry, not a default — flagged for a BHI data pass.) */
.bhi-chip--pro,.bhi-mini-trend--chips{display:none!important;}

/* === Mobile QA round 2 (28.06.2026) === */
/* BOF filter pills were set to overflow-x:visible on mobile → the last pill ("Pakkumised") clipped at the
   viewport edge instead of scrolling. Restore horizontal scroll. */
.bof-filter-pills{overflow-x:auto!important;}
/* Confirmed/verified date ("Kinnitatud 09.03.2026") is white-space:nowrap, so beside the wide
   "PARIM PAKKUMINE" badge it overflowed + clipped the year. Allow it to wrap. */
.bof-verified{white-space:normal!important;overflow:visible!important;text-overflow:clip!important;}
/* Affiliate disclosure — small, muted footer line */
.ds-disclosure{max-width:760px;margin:6px auto 18px;padding:0 16px;text-align:center;font-size:11px;line-height:1.5;color:var(--ds-faint,#8a94a6);}

/* === CWV Phase 3 (2026-07-15): image CLS fix === */
/* Reserve space for generator brand hero/discount images (fixed 750x379) to kill the
   unsized-lazy-image layout shift (#content grew +383px at ~2s on brand pages — see
   cwv_audit/20260715/execution/phase3/image_fix_verify.md). Scoped by filename substring
   so blog images (pexels-*) and the site logo (sooduskoodlogo*) are unaffected — verified
   neither ever contains "header" or "discount" in its filename.
   NOTE: selector uses "-header" WITHOUT a trailing dot (not "-header.") because WordPress's
   Media Library de-dup can rename a regenerated header image to "{slug}-header-2.jpg",
   "{slug}-header-3.jpg", etc. — confirmed live on /about-you/. A trailing-dot selector
   would silently miss those. */
figure.wp-block-image img[src*="-header"],
figure.wp-block-image img[src*="-discount"] {
    aspect-ratio: 750 / 379;
    height: auto;
}

/* === Phase 1b (2026-08-19): the .ds-logo primitive ===================== */
/* Brand-mark tile. Markup contract (fixed, do not change elsewhere):
     <span class="ds-logo" data-initial="Z" style="--brand-hue:214;--ds-logo-size:40px"></span>
     <span class="ds-logo" data-initial="Z" style="--brand-hue:214;--ds-logo-size:40px">
       <img src="…" width="40" height="40" alt="" loading="lazy" decoding="async"></span>
   CLS-critical: the tile is sized ENTIRELY from --ds-logo-size, before any image
   loads, so a monogram-only tile and a tile that later gains an <img> occupy
   byte-identical space — no network round-trip is on the critical layout path.
   flex:0 0 (not min-width) because this sits inside ds-row-* flex rows; a
   flex-basis can't be squeezed by a flex-shrink:1 sibling the way min-width
   can be by an over-eager flex layout. Explicit box-sizing/margin/padding on
   the tile and its children (rather than relying on the `.ds,.ds *` wrapper
   reset above) because this primitive also renders inside plugin-owned
   wrappers (.bof-wrapper, .lof-wrapper, …) that are not themselves `.ds`. */
.ds-logo{
  box-sizing:border-box;
  position:relative;
  display:inline-grid;
  place-items:center;
  flex:0 0 var(--ds-logo-size,40px);
  width:var(--ds-logo-size,40px);
  height:var(--ds-logo-size,40px);
  margin:0;padding:0;
  border-radius:var(--ds-r-sm);
  overflow:hidden;
  background:hsl(var(--brand-hue,200) 45% 94%);
  box-shadow:inset 0 0 0 1px hsl(var(--brand-hue,200) 30% 88%);
}
/* Monogram via ::before, not a child element — it needs no DOM node to sit
   underneath an <img> added later, it just gets painted over. */
.ds-logo::before{
  box-sizing:border-box;
  content:attr(data-initial);
  font-family:var(--ds-font);
  font-weight:600;
  font-size:calc(var(--ds-logo-size,40px) * 0.4);
  line-height:1;
  /* 26%, not 32%: lightness 32% failed WCAG AA on 72 of 360 hues (worst 3.97:1
     at hue 60 — the yellow/green band, where HSL lightness maps to much higher
     luminance than it does for blues). Measured across all 360 hues live on EE
     2026-08-19. At 26% the worst case is 5.50:1, so every possible brand hue
     clears AA with margin. Saturation deliberately unchanged so the palette
     still reads the same, just a shade deeper. */
  color:hsl(var(--brand-hue,200) 55% 26%);
}
/* Logo image: fills the tile and paints above the monogram. White backing
   because real logos are square marks with transparency (a coloured
   monogram bleeding through a transparent PNG looks broken). Deliberately
   no upscaling filter — Phase 0 measured a third of real logos under 64px;
   image-rendering:auto lets a small logo look soft rather than artefacted. */
.ds-logo img{
  box-sizing:border-box;
  position:absolute;
  inset:0;
  width:100%;
  height:100%;
  margin:0;padding:0;
  border:0;
  object-fit:contain;
  background:#fff;
  image-rendering:auto;
}
/* --- size modifier: brand-page header --- */
.ds-logo-lg{--ds-logo-size:56px;}


