/* ==========================================================================
   Design tokens — IPTV Espana
   --------------------------------------------------------------------------
   DIRECTION: "Editorial Broadcast".

   The category is uniformly dark-neon — every competitor, plus Netflix,
   Movistar+ and DAZN. We go the other way: a warm paper ground, enormous
   uppercase serif headlines, mono production-slate labels, and exactly one
   hot signal colour. The only saturated pixels on the page are the channel
   logos and the EPG, so the content reads like plates in a magazine.

   Inverted bands (--c-ink ground) break the scroll into chapters rather than
   a single column of cards.

   Type:
     Instrument Serif  display, uppercase, optical ls -0.03em
     Figtree           body — a humanist sans with more warmth than Inter
     JetBrains Mono    slate labels, prices, channel counts

   All three are SELF-HOSTED. Loading them from fonts.googleapis.com would
   send every Spanish visitor's IP to Google without consent; latin-ext is
   split out so it only downloads when a glyph actually needs it.
   ========================================================================== */

/* ---- Instrument Serif — display ---------------------------------------- */
@font-face {
	font-family: 'Instrument Serif';
	src: url('../fonts/instrumentserif-400-normal-latin.woff2') format('woff2');
	font-weight: 400; font-style: normal; font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
	               U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
	               U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
	font-family: 'Instrument Serif';
	src: url('../fonts/instrumentserif-400-normal-latin-ext.woff2') format('woff2');
	font-weight: 400; font-style: normal; font-display: swap;
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
	               U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF,
	               U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
	font-family: 'Instrument Serif';
	src: url('../fonts/instrumentserif-400-italic-latin.woff2') format('woff2');
	font-weight: 400; font-style: italic; font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
	               U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
	               U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
	font-family: 'Instrument Serif';
	src: url('../fonts/instrumentserif-400-italic-latin-ext.woff2') format('woff2');
	font-weight: 400; font-style: italic; font-display: swap;
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
	               U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF,
	               U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---- Metrics-matched fallback for the display face ---------------------- */
/*
 * Measured, not guessed: at the same size, Instrument Serif sets the string
 * "Todo el deporte en directo, sin cortes" at 1454px where Iowan Old Style
 * needs 68.0%, Palatino 69.7%, Georgia 69.3% and Times New Roman 72.6% to
 * match it. It is dramatically narrower than any system serif.
 *
 * Without this, a long headline wraps to FOUR lines in the fallback and reflows
 * to three when the real face arrives. Measured on /deportes-iptv-espana/ that
 * was an H1 going 281px -> 210px and CLS 0.079 — most of the way to failing the
 * 0.1 threshold, on a money page.
 *
 * size-adjust makes the fallback occupy the same space, so the swap is
 * invisible. Preferred over font-display:optional, which would fix the shift by
 * sometimes never showing the real face at all.
 */
@font-face {
	font-family: 'Instrument Serif Fallback';
	src: local('Iowan Old Style'), local('Palatino Linotype'), local('Palatino'),
	     local('Georgia'), local('Times New Roman'), local('Times');
	size-adjust: 69%;
	ascent-override: 105%;
	descent-override: 28%;
	line-gap-override: 0%;
	font-display: swap;
}

/* ---- Figtree — body (variable 300–900) --------------------------------- */
@font-face {
	font-family: 'Figtree';
	src: url('../fonts/figtree-var-normal-latin.woff2') format('woff2');
	font-weight: 300 900; font-style: normal; font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
	               U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
	               U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
	font-family: 'Figtree';
	src: url('../fonts/figtree-var-normal-latin-ext.woff2') format('woff2');
	font-weight: 300 900; font-style: normal; font-display: swap;
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
	               U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF,
	               U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---- JetBrains Mono — slate labels (variable) -------------------------- */
@font-face {
	font-family: 'JetBrains Mono';
	src: url('../fonts/jetbrainsmono-var-normal-latin.woff2') format('woff2');
	font-weight: 100 800; font-style: normal; font-display: swap;
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
	               U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122,
	               U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
	font-family: 'JetBrains Mono';
	src: url('../fonts/jetbrainsmono-var-normal-latin-ext.woff2') format('woff2');
	font-weight: 100 800; font-style: normal; font-display: swap;
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
	               U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF,
	               U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
	/* ---- Surface — warm paper, never pure white ------------------------- */
	--c-bg:          #F1EFEA;
	--c-surface:     #FBFAF7;   /* raised cards sit LIGHTER than the ground */
	--c-surface-2:   #E7E4DC;   /* recessed wells sit darker */
	--c-border:      rgb(20 20 18 / 0.13);
	--c-border-str:  rgb(20 20 18 / 0.28);
	/* The hero's tile grid. Deliberately weaker than --c-border: this line is
	   drawn hundreds of times across the full width, and at border strength
	   the graph paper competes with the headline sitting on top of it. */
	--c-tile-line:   rgb(20 20 18 / 0.065);

	/* ---- Text ---------------------------------------------------------- */
	--c-text:        #141412;   /* 16.05:1 on paper */
	--c-text-muted:  #5C5A54;   /*  6.00:1 on paper */
	/* Was #8A877F at 3.12:1 — it failed AA everywhere it was used: slate
	   labels, stat captions, breadcrumbs, footer headings, card meta. One
	   token, seventeen failures. #6E6B63 is the lightest value that still
	   clears 4.5:1 against BOTH the paper ground and the lighter card
	   surface, so nothing downstream needs touching. */
	--c-text-faint:  #6E6B63;   /*  4.63:1 on paper */

	/* ---- Accent (single, hot) ------------------------------------------ */
	/* Was #FF4A1F. White on it measured 3.36:1 — every primary button and
	   badge failed AA. Two ways out: dark text on the bright orange (5.49:1,
	   measured) or a deeper orange that carries white. The first was tried and
	   reads muddy — dark red on orange is perceptually mushy however well it
	   scores. #DC350B is the LIGHTEST orange that clears 4.5:1 with white, so
	   it gives up the least saturation to get there. */
	--c-accent:      #DC350B;   /*  4.61:1 with white text */
	/* Used as TEXT on the dark ground (live-row timestamps, ink-band links),
	   so it has to clear 4.5:1 there, not just look brighter than the accent.
	   #F04216 measured 4.53 on the tinted live row — passing but with no
	   margin; #FF6B45 gives 6.13. */
	--c-accent-hi:   #FF6B45;
	--c-accent-lo:   #C42A05;   /*  4.97:1 — accent used AS TEXT on paper */

	--c-accent-ink:  #FFFFFF;   /*  4.61:1 on --c-accent */
	--c-accent-wash: rgb(220 53 11 / 0.10);

	/* ---- Inverted band — the "chapter break" ---------------------------- */
	--c-ink:         #141412;
	--c-ink-2:       #22211E;
	--c-ink-text:    #F1EFEA;
	--c-ink-muted:   #A8A59C;
	--c-ink-border:  rgb(241 239 234 / 0.15);

	/* ---- Status -------------------------------------------------------- */
	--c-ok:          #177043;   /*  5.32:1 — #1B7F4B measured 4.37, just under AA */
	--c-err:         #C32F1E;

	/* ---- Type ---------------------------------------------------------- */
	--font-display: 'Instrument Serif', 'Instrument Serif Fallback',
	                'Iowan Old Style', 'Palatino Linotype', Palatino,
	                Georgia, 'Times New Roman', serif;
	--font-sans:    'Figtree', ui-sans-serif, system-ui, -apple-system,
	                'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
	--font-mono:    'JetBrains Mono', ui-monospace, SFMono-Regular, 'SF Mono',
	                Menlo, Consolas, monospace;

	/* Fluid scale — min at 360px, max at 1400px */
	--t-xs:   clamp(0.75rem, 0.72rem + 0.15vw, 0.8125rem);
	--t-sm:   clamp(0.875rem, 0.85rem + 0.12vw, 0.9375rem);
	--t-base: clamp(1rem, 0.96rem + 0.18vw, 1.0625rem);
	--t-lg:   clamp(1.125rem, 1.05rem + 0.35vw, 1.3125rem);
	--t-xl:   clamp(1.375rem, 1.2rem + 0.75vw, 1.75rem);
	--t-2xl:  clamp(1.75rem, 1.45rem + 1.3vw, 2.5rem);
	--t-3xl:  clamp(2.25rem, 1.7rem + 2.4vw, 3.75rem);
	--t-4xl:  clamp(2.75rem, 1.9rem + 3.6vw, 5rem);

	/* Display — the reference runs an uncapped 4.63vw; this tracks it from
	   360px to 1440px and then STOPS, so it can't run away on a 27" monitor. */
	--t-display: clamp(2.5rem, 1.93rem + 2.52vw, 5.25rem);

	/* Uppercase serif at display size needs negative tracking to close the
	   gaps that capitals leave; lowercase body text does not. */
	--ls-display: -0.03em;
	--ls-label:   0.14em;

	--lh-tight:  1.06;
	--lh-snug:   1.25;
	--lh-normal: 1.65;
	--measure:   65ch;

	/* ---- Space (4px base) ---------------------------------------------- */
	--s-1: 0.25rem;  --s-2: 0.5rem;   --s-3: 0.75rem;  --s-4: 1rem;
	--s-5: 1.5rem;   --s-6: 2rem;     --s-7: 3rem;     --s-8: 4rem;
	--s-9: 6rem;     --s-10: 8rem;

	--section-y: clamp(3.5rem, 2rem + 7vw, 7.5rem);
	--gutter:    clamp(1rem, 0.5rem + 2.5vw, 2.5rem);
	--maxw:      1240px;
	--maxw-text: 46rem;

	/* ---- Radius — editorial work is squarer than product UI ------------- */
	--r-sm: 3px;  --r-md: 5px;  --r-lg: 8px;  --r-xl: 12px;  --r-full: 999px;

	/* ---- Elevation — warm-tinted, never a neutral grey drop ------------- */
	--e-1: 0 1px 2px rgb(40 34 24 / 0.07);
	--e-2: 0 10px 28px -12px rgb(40 34 24 / 0.20);
	--e-3: 0 28px 64px -20px rgb(40 34 24 / 0.28);
	--e-inset: inset 0 1px 0 rgb(255 255 255 / 0.7);

	/* ---- Motion -------------------------------------------------------- */
	--ease:      cubic-bezier(0.16, 1, 0.3, 1);
	--ease-out:  cubic-bezier(0.33, 1, 0.68, 1);
	--d-fast:    140ms;
	--d-base:    260ms;
	--d-slow:    460ms;

	/* transitions.dev — texts reveal (18-texts-reveal.md).
	   --stagger-stagger is the skill's "large stagger" step (80ms), not its
	   40ms default: .reveal staggers whole blocks, not two lines of copy. */
	--stagger-dur:      500ms;
	--stagger-distance: 12px;
	--stagger-stagger:  80ms;
	--stagger-blur:     3px;
	--stagger-ease:     cubic-bezier(0.22, 1, 0.36, 1);

	--z-nav: 100;  --z-drawer: 200;  --z-modal: 300;

	color-scheme: light;
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation-duration: 0.01ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}
