/* tweakflix base: reset plus element defaults.
   Built only from tokens.css. No raw values, no !important. */

/* ---------------------------------------------------------------
   Font. Self-hosted Inter variable, latin only.
   --------------------------------------------------------------- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/wp-content/themes/tweakflix/assets/fonts/inter-latin-wght-normal.woff2") format("woff2");
  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;
}

/* ---------------------------------------------------------------
   Reset
   --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Smooth scrolling to an in-page anchor is only correct if the target clears the sticky
     header. Without this the #how-it-works target lands underneath the band. */
  scroll-padding-block-start: var(--scroll-offset);
  tab-size: 4;
  /* iOS/Android paint a grey box over whatever is tapped; every control has its own
     :active and :focus-visible states, so the system flash only reads as a glitch. */
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100dvh;
  width: 100%;
  /* clip, NOT hidden. `overflow: hidden` makes the body a scroll container, which silently
     kills position: sticky for every descendant, including the header the --z-sticky rung is
     provisioned for. `clip` contains the same accidental overflow without creating one. */
  overflow-x: clip;
  background-color: var(--color-page);
  color: var(--color-ink);
  font-family: var(--font-sans);
  font-size: var(--text-base-size);
  line-height: var(--text-base-line);
  letter-spacing: var(--text-base-track);
  font-weight: var(--weight-regular);
  font-synthesis-weight: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv05" 1, "ss03" 1;
  text-rendering: optimizeLegibility;
}

::selection {
  background-color: var(--color-selection);
  color: var(--color-ink);
}

img, svg, video, canvas, picture {
  display: block;
  max-width: 100%;
}

img, video { height: auto; }

/* Scoped to the root element and only when the file does not state its own fill,
   so a single-ink brand mark inherits the surrounding text colour while a
   multi-colour mark (the WhatsApp, Telegram or Trustpilot glyphs, the logo)
   keeps the fills its author set. `fill` inherits, so a child path carrying its
   own fill attribute is unaffected either way. */
svg:not([fill]) { fill: currentColor; }

/* ---------------------------------------------------------------
   Headings and text
   --------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: var(--weight-semibold);
  color: var(--color-ink);
  text-wrap: balance;
}

h1 {
  font-size: var(--text-4xl-size);
  line-height: var(--text-4xl-line);
  letter-spacing: var(--text-4xl-track);
}

h2 {
  font-size: var(--text-3xl-size);
  line-height: var(--text-3xl-line);
  letter-spacing: var(--text-3xl-track);
}

h3 {
  font-size: var(--text-lg-size);
  line-height: var(--text-lg-line);
  letter-spacing: var(--text-lg-track);
}

h4 {
  font-size: var(--text-lg-size);
  line-height: var(--text-lg-line);
  letter-spacing: var(--text-lg-track);
}

h5, h6 {
  font-size: var(--text-base-size);
  line-height: var(--text-base-line);
  letter-spacing: var(--text-base-track);
}

p, li, dd, dt, figcaption, blockquote {
  text-wrap: pretty;
  overflow-wrap: break-word;
}

p { max-width: var(--measure); }

strong, b { font-weight: var(--weight-semibold); }

small {
  font-size: var(--text-sm-size);
  line-height: var(--text-sm-line);
}

code, kbd, samp, pre {
  font-family: var(--font-mono);
  font-size: var(--text-sm-size);
}

/* ---------------------------------------------------------------
   Links
   --------------------------------------------------------------- */
/* THE ELEMENT RULES BELOW ARE FOR TEXT LINKS, AND ONLY FOR TEXT LINKS.
   `a:hover` is specificity (0,1,1) and `.btn` is (0,1,0), so a bare element
   selector here QUIETLY OUTRANKS every component a link is dressed as. The
   accent then lands as the text colour of a filled accent button: measured at
   1.16:1 on "Message us on WhatsApp" across four pages, violet ink on a violet
   fill, invisible to every screenshot the review loop ever took.

   Scoping to `a:not([class])` fixes it by construction rather than by a list of
   exceptions that the next component would have to be added to. A link that
   carries a class is a component and owns its own states; a link that carries
   none is prose and takes these. Verified with tools/audit-states.mjs, which
   forces the real pseudo-class through CDP instead of inferring it. */
a {
  color: var(--color-accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
  transition: color var(--duration-hover) ease;
}

@media (hover: hover) and (pointer: fine) {
  a:not([class]):hover { color: var(--color-accent-hover); }
}

a:not([class]):active { color: var(--color-accent-active); }

/* ---------------------------------------------------------------
   Lists, rules, tables
   --------------------------------------------------------------- */
ul, ol { padding-inline-start: var(--space-5); }

ul[role="list"], ol[role="list"] {
  list-style: none;
  padding-inline-start: 0;
}

hr {
  border: 0;
  border-block-start: 1px solid var(--color-border);
  margin-block: var(--space-8);
}

table {
  border-collapse: collapse;
  width: 100%;
  font-variant-numeric: tabular-nums;
}

th {
  text-align: start;
  font-weight: var(--weight-medium);
  color: var(--color-ink-secondary);
}

th, td {
  padding-block: var(--space-3);
  padding-inline: var(--space-4);
  border-block-end: 1px solid var(--color-border-subtle);
  vertical-align: baseline;
}

/* ---------------------------------------------------------------
   Forms and controls
   --------------------------------------------------------------- */
button, input, select, textarea, optgroup {
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  background: none;
  border: 0;
}

button, [role="button"], summary, label[for], select {
  cursor: pointer;
}

button, [type="button"], [type="submit"], [type="reset"] {
  -webkit-appearance: none;
  appearance: none;
  min-height: var(--control-height);
  transition: transform var(--duration-press) var(--ease-out),
              background-color var(--duration-hover) ease,
              border-color var(--duration-hover) ease,
              color var(--duration-hover) ease;
}

button:active:not(:disabled) { transform: scale(var(--press-scale)); }

input, textarea, select {
  min-height: var(--control-height);
  padding-inline: var(--space-3);
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  background-color: var(--color-surface);
  transition: border-color var(--duration-hover) ease;
}

textarea { padding-block: var(--space-3); resize: vertical; }

::placeholder { color: var(--color-ink-tertiary); opacity: 1; }

:disabled {
  color: var(--color-ink-disabled);
  cursor: not-allowed;
}

fieldset { border: 0; padding: 0; }

legend { padding: 0; }

/* ---------------------------------------------------------------
   Focus. One treatment, everywhere. Never removed.
   --------------------------------------------------------------- */
:focus-visible {
  outline: var(--focus-width) solid var(--focus-color);
  outline-offset: var(--focus-offset);
}

:focus:not(:focus-visible) { outline: none; }

/* A ring on a filled accent control. Same width, same offset, same geometry as
   every other ring; only the ink changes, because an accent ring 2px outside an
   accent fill is 2.99:1 and reads as a printing error rather than as focus. */
.btn--primary:focus-visible,
[data-focus-ring="on-accent"]:focus-visible {
  outline-color: var(--focus-color-on-accent);
}

/* ---------------------------------------------------------------
   Structural helpers that belong to every page
   --------------------------------------------------------------- */
.u-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* THE TILE NAMING RULE — tile contract section 3, round three.

   A card names its product EXACTLY ONCE, and which element does it depends on
   the tile's fill state. An art tile and a mark tile are PICTURES, so the
   card's own heading has to say the word. A word tile IS the word, so the
   heading beside it would say it twice.

   This is the clip that takes the heading out of the picture and leaves it in
   the accessibility tree — the same technique as .u-visually-hidden, named
   separately because it means something different and must never be "cleaned
   up" into that utility: removing it re-duplicates a name, removing
   .u-visually-hidden loses one.

   THERE IS ONE DEFINITION AND IT IS HERE. It ships in two forms, and page
   lanes must copy neither of them into a page sheet:

     .u-tile-named          the explicit class, for a template that already
                            knows the state when it prints the heading (the
                            WooCommerce port resolves it in PHP).
     [data-tile-title]      the state-driven form. A card marks the heading
                            that names its product with data-tile-title and
                            nothing else; the clip applies only while that
                            heading's own parent holds a word tile.

   The second form is the one every page in this repo uses, because it never
   hard-codes which products are wordmarks today: the client's artwork flips a
   product from word to art with no markup change, and the heading has to come
   back on its own when it does. */
.u-tile-named,
:has(> .c-tile[data-state="word"], > * > .c-tile[data-state="word"]) > [data-tile-title] {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.u-skip-link {
  position: absolute;
  inset-block-start: var(--space-2);
  inset-inline-start: var(--space-2);
  z-index: var(--z-toast);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background-color: var(--color-surface);
  box-shadow: var(--shadow-md);
  color: var(--color-ink);
  font-weight: var(--weight-medium);
  text-decoration: none;
  /* Keep the shortcut clipped while the mobile browser exposes the top
     of the document during pull-to-refresh or elastic scrolling. */
  clip-path: inset(50%);
  transform: translateY(-200%);
}

.tf-keyboard-nav .u-skip-link:focus-visible {
  clip-path: none;
  transform: translateY(0);
}

.u-container {
  width: 100%;
  max-width: var(--container-max);
  margin-inline: auto;
  padding-inline: var(--gutter-inline);
}

.u-container--narrow { max-width: var(--container-narrow); }
.u-container--text { max-width: var(--container-text); }

.u-section {
  padding-block-start: var(--section-pad-top);
  padding-block-end: var(--section-pad-bottom);
}

.u-measure { max-width: var(--measure); }

.u-nums { font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------
   No display-accent primitive. Deliberately.

   .u-em, .u-em-line and .u-em--heading set an italic serif on one phrase per
   page. All three were deleted on 2026-08-25 with the family itself, and
   nothing replaced them: emphasis inside a line is <strong> at 600, or it is a
   size step, or it is not emphasis. A utility whose only job is to switch
   family cannot exist in a one-family system, so re-adding one means re-adding
   the family, and that is a decision at the token layer, not here.
   --------------------------------------------------------------- */

/* ---------------------------------------------------------------
   Depth, wash, texture and the dark panel, as primitives.
   Each one is a token composition, so a component can opt in without
   re-deriving the values and without a raw number appearing downstream.
   --------------------------------------------------------------- */

/* A surface that is genuinely above the page: elevation plus the top light
   edge, which is the half of the effect that usually gets left out. */
.u-raised {
  background-color: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--edge-light), var(--elevation-rest);
}

/* The honest hover: travel and shadow deepening as ONE event, same duration,
   same curve. Gated behind a fine pointer, and neutralised on touch by the
   (hover: none) token block rather than by a second rule here. */
.u-lift {
  transition: transform var(--duration-lift) var(--ease-lift),
              box-shadow var(--duration-lift) var(--ease-lift);
  will-change: transform;
}

@media (hover: hover) and (pointer: fine) {
  .u-lift:hover {
    transform: translateY(var(--lift-y)) scale(var(--lift-scale));
    box-shadow: var(--edge-light), var(--elevation-lift);
  }
}

.u-lift:focus-visible {
  transform: translateY(var(--lift-y));
  box-shadow: var(--edge-light), var(--elevation-lift);
}

/* One washed surface per page. Four directions, one at a time. */
.u-wash          { background-color: var(--color-wash-bed); box-shadow: var(--wash-top); }
.u-wash--bottom  { box-shadow: var(--wash-bottom); }
.u-wash--corner  { box-shadow: var(--wash-corner); }

/* Texture is painted by a pseudo-element rather than as a second background
   layer, so the surface underneath can still animate its own background and so
   the grain can carry its own blend mode and opacity without dragging the
   content into the same compositing group. */
.u-texture { position: relative; isolation: isolate; }

.u-texture::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: var(--layer-under);
  border-radius: inherit;
  background-image: var(--texture-noise);
  background-size: var(--texture-noise-size);
  mix-blend-mode: var(--texture-blend);
  opacity: var(--texture-opacity);
  pointer-events: none;
}

.u-texture--grid::before {
  background-image: var(--texture-grid);
  background-size: var(--texture-grid-size);
  mix-blend-mode: normal;
  opacity: 1;
}

/* THE dark panel. One per page. An inset object with a large radius floating on
   the light ground, never a page background and never a hero. It sets the whole
   dark ink ramp as local values, so any component dropped inside it inherits a
   legible palette instead of needing a dark variant of its own. */
.u-panel-dark {
  --color-surface: var(--panel-dark-surface-raised);
  --color-surface-raised: var(--panel-dark-surface-raised);
  /* THE RECESSED PLANES HAVE TO COME ACROSS TOO (wave 28). This block remapped
     the raised surface and the whole ink ramp and left --color-surface-sunken
     and --color-surface-tile on their light-theme values, which is fine until
     something inside the panel actually uses one. .btn--secondary does:
     --btn-bg-hover is --color-surface-sunken. So the Telegram button in the
     homepage's dark closing panel painted #F1F1F7 under ink that this same
     block had already remapped to #F7F7FB — near-white on near-white, measured
     at 1.05:1 on both :hover and :active against 15.42:1 at rest. A control
     that disappears when you point at it is worse than one that never looked
     like a control. Found by tools/audit-states.mjs, which is the whole reason
     that tool exists: no screenshot has a hover state in it.
     The panel's own base surface is one step below its raised plane, so it is
     what "sunken" means inside the panel. 16.82:1 for the panel's ink on it. */
  --color-surface-sunken: var(--panel-dark-surface);
  --color-surface-tile: var(--panel-dark-surface);
  --color-ink: var(--panel-dark-ink);
  --color-ink-secondary: var(--panel-dark-ink-secondary);
  --color-ink-tertiary: var(--panel-dark-ink-tertiary);
  --color-border: var(--panel-dark-border);
  --color-border-subtle: var(--panel-dark-border);
  --color-border-strong: var(--panel-dark-border-strong);
  --edge-light: var(--edge-light-dark);

  position: relative;
  isolation: isolate;
  margin-inline: var(--panel-dark-inset);
  border-radius: var(--panel-dark-radius);
  background-color: var(--panel-dark-surface);
  color: var(--panel-dark-ink);
  box-shadow: var(--wash-panel), var(--edge-light-dark), var(--panel-dark-shadow);
}

.u-panel-dark .u-texture::before,
.u-panel-dark.u-texture::before {
  opacity: var(--texture-opacity-dark);
  mix-blend-mode: var(--texture-blend-dark);
}

/* ---------------------------------------------------------------
   Reveal. One staggered entrance per page, on first view.

   Content is visible by DEFAULT and hidden only once script has confirmed it
   can observe and un-hide it: the .js-reveal hook is set on <html> by the page,
   so a failed script, a blocked observer or a crawler all see the finished
   page rather than an empty one. --stagger-cap is the ceiling: past the sixth
   sibling every child fires on the sixth beat.
   --------------------------------------------------------------- */
.u-reveal { --reveal-index: 0; }

.js-reveal .u-reveal {
  opacity: 0;
  transform: translateY(var(--reveal-distance));
}

.js-reveal .u-reveal.is-revealed {
  opacity: 1;
  transform: none;
  transition: opacity var(--duration-reveal-slow) var(--ease-reveal),
              transform var(--duration-reveal-slow) var(--ease-reveal);
  transition-delay: calc(var(--reveal-index) * var(--stagger-step));
}

.js-reveal .u-reveal--tight.is-revealed {
  transition-duration: var(--duration-reveal);
  transition-delay: calc(var(--reveal-index) * var(--stagger-step-tight));
}

.u-scroll-x {
  overflow-x: auto;
  overscroll-behavior-x: contain;
}

/* ---------------------------------------------------------------
   Reduced motion: keep the state change, drop the travel.
   Not a blanket duration kill.
   --------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }

  *, *::before, *::after {
    animation-duration: var(--duration-hover);
    animation-iteration-count: 1;
    transition-duration: var(--duration-hover);
    transition-property: opacity, background-color, border-color, color, box-shadow;
  }

  button:active:not(:disabled) { transform: none; }

  /* The reveal keeps its state change and loses its travel: content still
     arrives, it just arrives without moving. Never left in the hidden state. */
  .js-reveal .u-reveal { opacity: 1; transform: none; }

  .js-reveal .u-reveal.is-revealed { transition-delay: 0s; }

  /* transform is not in the reduced-motion transition-property list above, so
     the lift snaps rather than travels; the shadow still crossfades, which is
     the state information. This rule removes the travel entirely. */
  .u-lift:hover,
  .u-lift:focus-visible { transform: none; }
}
