/**
 * Upcomer redesign ("v2") — shared design tokens and primitives.
 *
 * Source: the designer's handoff for /no/gambling/trygge-norske-casino/
 * (Handoff_TryggeNorskeCasino, Nov 2026: css/tokens.css + css/base.css).
 * Ported with two changes so it can live next to the gamurs theme:
 *
 *   1. Every token is namespaced `--upc-*` and every shared class `.upc-*`.
 *      The handoff's `--bg`, `--line`, `--accent`, `.tag`, `.chev`, `.prose`
 *      are generic enough to collide with gamurs or plugin CSS.
 *      Mapping: .ui-panel → .upc-panel, .ui-rank → .upc-rank,
 *      .t-card → .upc-t-card, .sec-title → .upc-sec-title, .chev → .upc-chev.
 *   2. Dark mode keys on `body.theme-dark` (the gamurs theme setter), not on
 *      `html[data-theme="dark"]`. Norwegian and Chilean pages are pinned light
 *      (see Element Visibility in CLAUDE.md), so dark only matters on English.
 *
 * The palette below is the designer's. Block stylesheets that use these tokens
 * must not hardcode colours of their own: change a value here and every
 * redesigned block follows.
 *
 * Loaded wherever a redesigned block renders (upcomer_upc_enqueue_styles() in
 * inc/upc.php), in the block editor, and on every Full Width Blocks page
 * (the core-text typography in blocks-canvas.css reads the same tokens).
 */

:root {
	/* ---- Type ---- */
	--upc-font-title: "Barlow Condensed", "Arial Narrow", sans-serif; /* headlines, card titles, figures */
	--upc-font-text: "Inter", "Helvetica Neue", system-ui, sans-serif; /* body copy, labels, buttons */

	/* ---- Brand gold: highlights, bars, rings ---- */
	--upc-accent: #a58c52;
	--upc-accent-text: #7a6638;            /* the same gold, deeper: small text on light surfaces (AA) */
	--upc-accent-soft: rgb(165 140 82 / .14);
	--upc-on-accent: #17130a;
	--upc-gold-light: #dbbe76;             /* gold type on the near-black panels (banner, sticky bar) */

	/* ---- Affiliate call to action: emerald with white text ----
	   The designer's #15964e is 3.9:1 against white: AA for the 19px bold main
	   CTA (large text) only. Smaller CTAs (the sticky bar, "Prøv … i dag" at
	   16px) use --upc-cta-sm, which is the designer's own hover shade (4.8:1). */
	--upc-cta: #15964e;
	--upc-cta-hover: #12843f;
	--upc-cta-sm: #12843f;
	--upc-cta-sm-hover: #0f7236;
	--upc-on-cta: #ffffff;

	/* ---- Surfaces ---- */
	--upc-bg: #ffffff;
	--upc-surface: #f5f5f3;                /* cards, panels */
	--upc-surface-2: #ededea;              /* rows inside panels */
	--upc-surface-3: #e6e5e1;              /* table heads, image placeholders */
	--upc-ink-panel: #141416;              /* Upcomer near-black: banner, sticky bar */

	/* ---- Lines ---- */
	--upc-line: #e3e2de;
	--upc-line-strong: #cfcdc7;
	--upc-card-edge: #c4c2bb;              /* toplist card borders */
	--upc-card-edge-hover: #a9a69e;

	/* ---- Text ---- */
	--upc-fg-strong: #22252b;
	--upc-fg: #3a3d44;
	--upc-fg-muted: #5b5e65;
	--upc-fg-caption: #6b6e75;

	/* ---- Status ---- */
	--upc-pos-bg: #f0f6f2;
	--upc-pos-line: #cde2d4;
	--upc-pos-fg: #11744a;

	/* ---- Shape: rounded, flat (no drop shadows) ---- */
	--upc-radius-card: 10px;
	--upc-radius-panel: 12px;
	--upc-radius-img: 8px;
	--upc-radius-pill: 999px;
	--upc-ease: cubic-bezier(.2, .7, .2, 1);

	/* ---- Layout ---- */
	--upc-reading: 760px;                  /* long-form text column */
	--upc-header-h: 64px;                  /* gamurs sticky header; inc/upc.php's script measures the real one */
	--upc-gap: 20px;                       /* between sections on a guide page */
}

@media (min-width: 768px) {
	:root {
		--upc-gap: 28px;
	}
}

body.theme-dark {
	--upc-accent-text: #a58c52;            /* readable as-is on dark surfaces */
	--upc-accent-soft: rgb(165 140 82 / .16);
	--upc-on-accent: #141005;
	--upc-ink-panel: #1c1c20;

	--upc-bg: #09090a;
	--upc-surface: #131315;
	--upc-surface-2: #18181b;
	--upc-surface-3: #202024;
	--upc-line: #26262b;
	--upc-line-strong: #34343a;
	--upc-card-edge: #3d3d44;
	--upc-card-edge-hover: #55555d;

	--upc-fg-strong: #f2f2ef;
	--upc-fg: #d2d3cf;
	--upc-fg-muted: #a9a9ad;
	--upc-fg-caption: #8d8d92;

	--upc-pos-bg: #0f1f16;
	--upc-pos-line: #1e3a29;
	--upc-pos-fg: #5fc48f;
}

/* ======================================================================
 * Block frame
 *
 * Every redesigned block's root is `<section class="upcomer-block upc …">`.
 * The section spans the canvas and pads its content in to the gamurs nav's
 * content edge (--nav-edge-*, computed on .upcomer-blocks-canvas from the
 * top-nav tokens), so blocks, core text and the header line up at every width.
 *
 * Spacing between sections is margin, not padding, so neighbours collapse to
 * the designer's single gap (20px phone, 28px from 768px) instead of adding up.
 *
 * Every other selector here and in the redesigned blocks starts with the
 * frame, `.upcomer-block.upc`: see "Article firewall" below for why.
 * ====================================================================== */
.upcomer-block.upc {
	box-sizing: border-box;
	margin-block: var(--upc-gap);
	padding-block: 0;
	padding-inline: var(--nav-edge-left, 16px) var(--nav-edge-right, 16px);
	color: var(--upc-fg);
	font-family: var(--upc-font-text);
	/* The handoff's -webkit-font-smoothing: antialiased is site-wide, on body:
	   upcomer_print_font_smoothing() in inc/upc.php, not here */
}

/* ----------------------------------------------------------------------
 * Article firewall (2026-11-19)
 *
 * Inside a post the gamurs article-content stylesheet styles h2–h6, p, li,
 * details and table cells by tag at (0,1,1)–(0,1,2), and links at (0,2,3),
 * and overrode every block rule written as a single class: in
 * /how-to-wake-snorlax-in-pokemon-red-blue-yellow/ a step card's h3 became
 * Barlow Condensed 700 on a 41px line and its p Roboto 18px/32px, so the ring
 * sat 9.5px above the title. 55 of 101 measured elements across the eight
 * redesigned blocks differed from the Full Width canvas, where no such
 * wrapper exists (.upcomer-blocks-canvas) — which is why it never showed.
 *
 * Two things hold it off:
 *  1. Every rule in this file and in the redesigned blocks is written under
 *     the frame, `.upcomer-block.upc …` (0,3,0), never as a bare class.
 *  2. The tags gamurs reaches are reset here to the frame's own text, at
 *     (0,2,0): above gamurs, below every block rule. An element no block rule
 *     styles (a plain li, a details, an h4 in the offer facts) then inherits
 *     Inter and --upc-fg as it does on the canvas, instead of Roboto 18px/32px.
 *
 * Links are the gap: gamurs' link selector is (0,2,3), above this reset, so a
 * link keeps its article colour and underline unless a block rule names it.
 * Every link in the eight blocks has one; give a new one its own too.
 * -------------------------------------------------------------------- */
.upcomer-block.upc :where(h1, h2, h3, h4, h5, h6, p, li, dt, dd, details, summary, th, td) {
	font: inherit;
	letter-spacing: inherit;
	color: inherit;
	text-transform: inherit;
	text-decoration: none;
	text-indent: 0;
}
.upcomer-block.upc :where(h1, h2, h3, h4, h5, h6) { padding: 0; }

/* Local resets: the gamurs and plugin globals reach in otherwise */
.upcomer-block.upc :where(*, *::before, *::after) { box-sizing: border-box; }
.upcomer-block.upc :where(h1, h2, h3, h4, h5, h6, p, ul, ol, dl, dd, figure, blockquote) { margin: 0; }
.upcomer-block.upc :where(ul[role="list"], ol[role="list"]) { list-style: none; padding: 0; }
.upcomer-block.upc :where(img) { display: block; max-width: 100%; height: auto; }
.upcomer-block.upc :where(a) { color: inherit; text-decoration: none; }
.upcomer-block.upc :where(button) { font: inherit; color: inherit; cursor: pointer; }
.upcomer-block.upc :where(svg) { flex: none; }

/* Read by screen readers, not shown */
.upcomer-block.upc .upc-vh {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* ======================================================================
 * Shared primitives
 * ====================================================================== */

/* Panel: rounded light-grey surface with a hairline edge */
.upcomer-block.upc .upc-panel {
	background: var(--upc-surface);
	border: 1px solid var(--upc-line);
	border-radius: var(--upc-radius-panel);
}

/* Section heading (h2 tier): Barlow Condensed 700, 32px / 26px on phones */
.upcomer-block.upc .upc-sec-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}
.upcomer-block.upc .upc-sec-title {
	font: 700 32px/1.15 var(--upc-font-title);
	letter-spacing: .005em;
	color: var(--upc-fg-strong);
	text-wrap: balance;
	scroll-margin-top: calc(var(--upc-header-h) + 66px);
}
@media (max-width: 767px) {
	.upcomer-block.upc .upc-sec-title { font-size: 26px; text-wrap: pretty; } /* fill the line on phones */
}

/* Card title (h3/h4 inside cards and panels): Inter 600 16px */
.upcomer-block.upc .upc-t-card {
	font: 600 16px/1.35 var(--upc-font-text);
	letter-spacing: -.01em;
	color: var(--upc-fg-strong);
	text-wrap: pretty;
}

/* Gold number ring (steps) */
.upcomer-block.upc .upc-rank {
	flex: none;
	width: 24px;
	height: 24px;
	display: grid;
	place-items: center;
	border: 1px solid color-mix(in srgb, var(--upc-accent) 60%, transparent);
	border-radius: 50%;
	background: var(--upc-accent-soft);
	color: var(--upc-accent-text);
	font: 500 12px var(--upc-font-text);
}

/* Chevron (FAQ). Icons stand on their own: no ring or disc behind them,
   anywhere in the redesign (2026-11-13). */
.upcomer-block.upc .upc-chev {
	flex: none;
	display: grid;
	place-items: center;
	width: 30px;
	height: 30px;
	color: var(--upc-fg-caption);
	transition: color .2s;
}
.upcomer-block.upc .upc-chev:hover { color: var(--upc-accent-text); }

/* Pros and cons marks, the same everywhere: green check, grey minus (never
   red: a downside is something to weigh, not a warning). The 20px box keeps
   the text column aligned; the icon is bare. */
.upcomer-block.upc .upc-mark {
	flex: none;
	display: grid;
	place-items: center;
	width: 20px;
	height: 20px;
	margin-top: 1px;
}
.upcomer-block.upc .upc-mark--pos { color: var(--upc-pos-fg); }
.upcomer-block.upc .upc-mark--neg { color: var(--upc-fg-muted); }

/* Perk tags (toplist cards): quiet pill with a bare grey icon, two at most */
.upcomer-block.upc .upc-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.upcomer-block.upc .upc-tag {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 11px 5px 9px;
	border: 1px solid var(--upc-line-strong);
	border-radius: var(--upc-radius-pill);
	background: var(--upc-paper, var(--upc-bg));
	font: 700 11.5px/16px var(--upc-font-text);
	letter-spacing: .05em;
	text-transform: uppercase;
	color: var(--upc-fg-strong);
	white-space: nowrap;
}
.upcomer-block.upc .upc-tag svg {
	flex: none;
	width: 13px;
	height: 13px;
	color: var(--upc-fg-muted);
}

/* Offer box: a white panel cut into figure cells by 1px rules (the grid gap
   shows the line colour behind). Sizes itself by its own width (the named
   container): two cells a row when narrow, an odd last cell becomes a one-line
   footer row; all cells in one row from 540px. Cells use --upc-paper.

   The figures are typed by writers ("100 %", "$100.000 CLP", "300 (10kr/
   spinn)"), so the type fits itself to the text: each cell is a size
   container of its own, PHP prints the big text's width in em on the cell
   (--upc-fig-w, see upcomer_upc_fig_width_em()), and the font size is the
   design's size or what fits the cell's content box, whichever is smaller,
   never under 14px. The <b> is a wrapping flex row of the number and its
   <small>: a short unit is counted in the width and stays on the line, a
   longer note is not and drops under the number when the cell is narrow.
   Past 14px (`upc-fig--long`, no number in front) the value wraps inside.
   The design sizes were written against the box width (10cqi / 5.4cqi);
   a cell's content width C relates to the box's B as B ≈ 2C + 57px (two
   cells, 14px padding) and B ≈ 4C + 147px (four cells, 18px padding), so
   they become 20cqi + 6px and 21.6cqi + 8px of the cell. */
.upcomer-block.upc .upc-offerbox {
	min-width: 0;
	container: upc-offerbox / inline-size;
	border: 1px solid var(--upc-line);
	border-radius: 10px;
	background: var(--upc-line);
	overflow: hidden;
}
.upcomer-block.upc .upc-figs {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 1px;
	height: 100%;
}
.upcomer-block.upc .upc-fig:last-child:nth-child(odd), .upcomer-block.upc .upc-fig--plain { grid-column: 1 / -1; }
.upcomer-block.upc .upc-fig {
	--fig-pad: 14px;
	margin: 0;
	min-width: 0;
	container-type: inline-size;
	display: grid;
	align-content: center;
	gap: 7px;
	padding: 13px var(--fig-pad) 14px;
	background: var(--upc-paper, var(--upc-bg));
}
.upcomer-block.upc .upc-fig span {
	font: 500 10.5px/1.2 var(--upc-font-text);
	letter-spacing: .07em;
	text-transform: uppercase;
	color: var(--upc-fg-caption);
	overflow-wrap: anywhere; /* a long typed title wraps rather than clips */
}
.upcomer-block.upc .upc-fig abbr { text-decoration: none; }
.upcomer-block.upc .upc-fig b {
	/* 100cqi is the cell's content width (container units exclude padding). The
	   design's 10cqi of the box is 20cqi + 6px of a two-up cell, see above. */
	--fig-fit: calc(100cqi / var(--upc-fig-w, 3)); /* the size at which the text spans the cell */
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	column-gap: 3px;
	row-gap: 2px;
	font: 700 clamp(14px, min(clamp(26px, 20cqi + 6px, 32px), var(--fig-fit)), 32px)/1 var(--upc-font-title);
	color: var(--upc-fg-strong);
	white-space: nowrap;
}
.upcomer-block.upc .upc-fig small { font-size: .48em; font-weight: 600; line-height: 1.2; color: var(--upc-fg-muted); white-space: nowrap; } /* .48em since 2026-11-19 (was the handoff's .56em); upcomer_upc_fig_width_em() assumes it */
.upcomer-block.upc .upc-fig--long b { white-space: normal; line-height: 1.05; overflow-wrap: anywhere; }
.upcomer-block.upc .upc-fig--plain b { font-size: 20px; line-height: 1.2; white-space: normal; }
.upcomer-block.upc .upc-fig:last-child:nth-child(odd):not(.upc-fig--plain) {
	grid-auto-flow: column;
	justify-content: space-between;
	align-items: center;
	padding-block: 11px;
}
.upcomer-block.upc .upc-fig:last-child:nth-child(odd):not(.upc-fig--plain) b { font-size: clamp(14px, min(22px, var(--fig-fit) / 2), 22px); } /* the value shares the row with its label */
@container upc-offerbox (min-width: 540px) {
	.upcomer-block.upc .upc-figs { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
	.upcomer-block.upc .upc-fig:last-child:nth-child(odd) { grid-column: auto; }
	.upcomer-block.upc .upc-fig, .upcomer-block.upc .upc-fig:last-child:nth-child(odd):not(.upc-fig--plain) {
		--fig-pad: 18px;
		grid-auto-flow: row;
		justify-content: stretch;
		align-items: initial;
		padding: 16px var(--fig-pad);
	}
	.upcomer-block.upc .upc-fig b, .upcomer-block.upc .upc-fig:last-child:nth-child(odd):not(.upc-fig--plain) b { font-size: clamp(14px, min(clamp(28px, 21.6cqi + 8px, 36px), var(--fig-fit)), 36px); } /* the design's 5.4cqi of the box, in cell terms */
	.upcomer-block.upc .upc-fig--plain b { font-size: 20px; }
}

/* Respect readers who turn off animation */
@media (prefers-reduced-motion: reduce) {
	.upcomer-block.upc *, .upcomer-block.upc *::before, .upcomer-block.upc *::after {
		transition-duration: .01ms !important;
		animation-duration: .01ms !important;
		scroll-behavior: auto !important;
	}
}
