/*
Theme Name: UK.WTF
Theme URI: https://uk.wtf
Description: One-page theme for uk.wtf. Each visit shows one of seven designs at random: the original, KING DOM, ENGLAND, THATCHER'S BRITAIN, PRIME MINISTERS, MAN UNITED or UNION FLAG. Two lines of vector type, always the same width, filling the browser window.
Version: 2.3.0
Requires at least: 6.0
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: ukwtf
*/

:root {
  --uk-bg: #ffffff;
  --uk-ink: #000000;
  --uk-side: #a4a4a4;   /* sides of the 3D letters */
  /* Width of the lettering: the whole window, unless that would be too tall. */
  --uk-w: min(
    100vw - 2 * var(--uk-pad),
    (100vh - 2 * var(--uk-pad) - var(--uk-foot)) / var(--uk-ratio)
  );
  --uk-pad: clamp(10px, 2.2vmin, 32px);
  --uk-foot: 80px; /* room kept clear for the © CL!CK footer */
  /* Combined height of both lines plus the gap, as a fraction of their width. */
  --uk-ratio: 0.20612;
}

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

html, body { margin: 0; padding: 0; height: 100%; }

body {
  background: var(--uk-bg);
  color: var(--uk-ink);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

.uk-page {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

.uk-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--uk-pad);
  padding-bottom: calc(var(--uk-pad) + var(--uk-foot) / 2);
  padding-top: calc(var(--uk-pad) + var(--uk-foot) / 2);
}

@supports (height: 100svh) {
  :root {
    --uk-w: min(
      100vw - 2 * var(--uk-pad),
      (100svh - 2 * var(--uk-pad) - var(--uk-foot)) / var(--uk-ratio)
    );
  }
}

.uk-type {
  margin: 0;
  width: var(--uk-w);
  display: flex;
  flex-direction: column;
  gap: calc(0.02 * var(--uk-w));
}

.uk-line {
  display: block;
  width: 100%;
  height: auto;
  fill: currentColor;
  overflow: visible;
  /* Shadow the letters cast on the page: a tight contact shadow and a soft wide one. */
  filter:
    drop-shadow(calc(0.002 * var(--uk-w)) calc(0.003 * var(--uk-w)) calc(0.003 * var(--uk-w)) rgba(0, 0, 0, 0.12))
    drop-shadow(calc(0.008 * var(--uk-w)) calc(0.012 * var(--uk-w)) calc(0.018 * var(--uk-w)) rgba(0, 0, 0, 0.08));
}
.uk-side { fill: var(--uk-side); }
.uk-face { fill: currentColor; }

/* © CL!CK footer: same graphic and position as the other CL!CK sites. */
.uk-foot {
  position: fixed;
  right: clamp(16px, 3vw, 40px);
  bottom: clamp(12px, 2.5vh, 28px);
  z-index: 30;
  line-height: 1;
  color: var(--uk-ink);
  pointer-events: none;
}
.uk-foot svg { height: 12px; width: auto; display: block; }

.screen-reader-text {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(1px, 1px, 1px, 1px);
  white-space: nowrap;
}

/* ==================================================================
   Seven designs, one chosen at random on each visit (see index.php).
   The <html> element carries uk-v-original, uk-v-kingdom, uk-v-england,
   uk-v-thatcher, uk-v-slot, uk-v-manc or uk-v-flag; each design's styles below
   only apply to that design.
   ================================================================== */

/* ---------- KING DOM (from 1.5.0) ---------- */
/* ------------------------------------------------------------------
   Animation: UNITED dissolves letter by letter, KINGDOM slides to the
   centre, then splits into KING  DOM. Plays once on load; tap or click
   to play again. Distances are in the lettering's own units, so the
   movement scales with the window.
   ------------------------------------------------------------------ */
:root {
  --uk-hold: 1.4s;        /* pause before anything moves */
  --uk-dissolve: 1.1s;    /* each letter of UNITED */
  --uk-stagger: 0.14s;    /* gap between letters starting to dissolve */
  --uk-slide-at: 3.1s;    /* KINGDOM starts sliding */
  --uk-slide: 1.7s;
  --uk-split-at: 5.0s;    /* KING and DOM start to part */
  --uk-split: 1.2s;
}

.uk-v-kingdom .uk-anim .uk-u,
.uk-v-kingdom .uk-anim .uk-kingdom,
.uk-v-kingdom .uk-anim .uk-king,
.uk-v-kingdom .uk-anim .uk-dom {
  transform-box: view-box;
  will-change: transform, opacity;
}

.uk-v-kingdom .uk-play .uk-u {
  animation: uk-dissolve var(--uk-dissolve) ease-in calc(var(--uk-hold) + var(--i) * var(--uk-stagger)) both;
}
.uk-v-kingdom .uk-play .uk-kingdom {
  animation: uk-slide var(--uk-slide) cubic-bezier(.65, 0, .35, 1) var(--uk-slide-at) both;
}
.uk-v-kingdom .uk-play .uk-king {
  animation: uk-split-left var(--uk-split) cubic-bezier(.3, 0, .2, 1) var(--uk-split-at) both;
}
.uk-v-kingdom .uk-play .uk-dom {
  animation: uk-split-right var(--uk-split) cubic-bezier(.3, 0, .2, 1) var(--uk-split-at) both;
}

@keyframes uk-dissolve {
  0%   { opacity: 1; filter: blur(0); transform: translateY(0); }
  100% { opacity: 0; filter: blur(60px); transform: translateY(-120px); }
}
@keyframes uk-slide {
  from { transform: translateX(0); }
  to   { transform: translateX(var(--slide)); }
}
@keyframes uk-split-left {
  from { transform: translateX(0); }
  to   { transform: translateX(var(--split)); }
}
@keyframes uk-split-right {
  from { transform: translateX(0); }
  to   { transform: translateX(calc(-1 * var(--split))); }
}

.uk-v-kingdom .uk-stage { cursor: pointer; }

/* People who ask their device for less motion get the final KING DOM straight away. */
@media (prefers-reduced-motion: reduce) {
  .uk-v-kingdom .uk-play .uk-u,
  .uk-v-kingdom .uk-play .uk-kingdom,
  .uk-v-kingdom .uk-play .uk-king,
  .uk-v-kingdom .uk-play .uk-dom {
    animation-duration: 1ms !important;
    animation-delay: 0s !important;
  }
}

/* ---------- ENGLAND (from 1.6.2) ---------- */
/* ------------------------------------------------------------------
   Animation: KINGDOM sinks into its line in disarray; UNITED flies
   apart leaving only its E; the rest of ENGLAND fades in, grubby and
   dishevelled. Plays once on load; tap or click to play again.
   ------------------------------------------------------------------ */
:root {
  --uk-hold: 1.4s;      /* pause before anything moves */
  --uk-fly-at: 5.0s;    /* UNITED breaks apart */
  --uk-fly: 1.6s;
  --uk-grub-at: 6.6s;   /* ENGLAND starts to appear */
  --uk-grub: 1.8s;      /* each grubby letter */
  --uk-grub-gap: 0.32s; /* between grubby letters */
  --uk-grubby-ink: #1f1c19;
  --uk-shrink-at: 10.6s; /* ENGLAND starts shrinking, once all its letters are in */
  --uk-shrink: 4.8s;
  --uk-shrink-to: 0.5;
}

.uk-v-england .uk-anim .uk-sink,
.uk-v-england .uk-anim .uk-fly,
.uk-v-england .uk-anim .uk-grub {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  will-change: transform, opacity;
}
.uk-v-england .uk-anim .uk-fly { transform-origin: 50% 50%; }

/* Letters of ENGLAND are hidden until their turn. */
.uk-v-england .uk-grub { opacity: 0; }
.uk-v-england .uk-grub .uk-face { fill: var(--uk-grubby-ink); }
.uk-v-england .uk-grub .uk-side { fill: #8d877e; }

.uk-v-england .uk-play .uk-sink {
  animation: uk-sink var(--dur) cubic-bezier(.5, 0, .9, .6) calc(var(--uk-hold) + var(--delay)) both;
}
.uk-v-england .uk-play .uk-fly {
  animation: uk-fly var(--uk-fly) cubic-bezier(.2, .6, .3, 1) calc(var(--uk-fly-at) + var(--i) * 0.05s) both;
}
.uk-v-england .uk-play .uk-grub {
  animation: uk-grub-in var(--uk-grub) ease-out calc(var(--uk-grub-at) + var(--i) * var(--uk-grub-gap)) both;
}

/* Wobble, lean, then slip down through the line. */
.uk-v-england .uk-anim .uk-england { transform-box: fill-box; transform-origin: 50% 100%; will-change: transform; }
.uk-v-england .uk-play .uk-england {
  animation: uk-shrink var(--uk-shrink) cubic-bezier(.45, 0, .2, 1) var(--uk-shrink-at) both;
}
@keyframes uk-shrink {
  from { transform: scale(1); }
  to   { transform: scale(var(--uk-shrink-to)); }
}

@keyframes uk-sink {
  0%   { transform: translate(0, 0) rotate(0); }
  18%  { transform: translate(calc(var(--dx) * 0.4), -20px) rotate(calc(var(--r) * 0.6)); }
  100% { transform: translate(var(--dx), 1100px) rotate(var(--r)); }
}
@keyframes uk-fly {
  0%   { transform: translate(0, 0) rotate(0); opacity: 1; }
  70%  { opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(var(--r)); opacity: 0; }
}
@keyframes uk-grub-in {
  0%   { opacity: 0; filter: blur(50px); transform: translate(var(--jx), calc(var(--jy) - 80px)) rotate(calc(var(--r) * 4)); }
  100% { opacity: 1; filter: blur(0);    transform: translate(var(--jx), var(--jy)) rotate(var(--r)); }
}

.uk-v-england .uk-stage { cursor: pointer; }

/* People who ask their device for less motion get the final ENGLAND straight away. */
@media (prefers-reduced-motion: reduce) {
  .uk-v-england .uk-play .uk-sink, .uk-v-england .uk-play .uk-fly, .uk-v-england .uk-play .uk-grub, .uk-v-england .uk-play .uk-england {
    animation-duration: 1ms !important;
    animation-delay: 0s !important;
  }
}

/* ---------- THATCHER'S BRITAIN (from 1.8.1) ----------
   UNITED KINGDOM melts into THATCHER'S BRITAIN, which sinks behind
   WHAT THE FUCK and comes out underneath as NATIONAL DECAY; the two
   lines then settle into the centre. */
:root.uk-v-thatcher {
  /* Leave room for the third row in short, wide windows. */
  --uk-ratio: 0.20745;
}
.uk-v-thatcher {
  --uk-hold: 1.4s;      /* pause before anything moves */
  --uk-morph: 2.8s;     /* UNITED KINGDOM melting into THATCHER'S BRITAIN */
  --uk-sink-at: 7.2s;   /* THATCHER'S BRITAIN starts to sink (holds about 3s once formed) */
  --uk-sink: 2.2s;
  --uk-rise-at: 9.6s;   /* NATIONAL DECAY slides out underneath */
  --uk-rise: 2.6s;
}
.uk-v-thatcher .uk-type { gap: 0; }
.uk-v-thatcher .uk-anim .uk-tb-sink,
.uk-v-thatcher .uk-anim .uk-ud,
.uk-v-thatcher .uk-anim .uk-from,
.uk-v-thatcher .uk-anim .uk-to { transform-box: view-box; will-change: transform, opacity; }
.uk-v-thatcher .uk-to { opacity: 0; }

.uk-v-thatcher .uk-play .uk-morph {
  animation: uk-goo var(--uk-morph) linear var(--uk-hold) both;
}
.uk-v-thatcher .uk-play .uk-from {
  animation: uk-melt-out var(--uk-morph) linear var(--uk-hold) both;
}
.uk-v-thatcher .uk-play .uk-to {
  animation: uk-melt-in var(--uk-morph) linear var(--uk-hold) both;
}
.uk-v-thatcher .uk-play .uk-tb-sink {
  animation: uk-tb-sink var(--uk-sink) cubic-bezier(.55, 0, .85, .4) var(--uk-sink-at) both;
}
.uk-v-thatcher .uk-play .uk-ud {
  animation: uk-ud-rise var(--uk-rise) cubic-bezier(.15, .6, .3, 1) var(--uk-rise-at) both;
}
.uk-v-thatcher .uk-play.uk-solo {
  animation: uk-recentre var(--uk-rise) cubic-bezier(.45, 0, .2, 1) var(--uk-rise-at) both;
}

/* The liquid look: only while the words are blurred into each other. */
@keyframes uk-goo {
  0%    { filter: none; }
  1%    { filter: url(#uk-goo); }
  99%   { filter: url(#uk-goo); }
  100%  { filter: none; }
}
@keyframes uk-melt-out {
    0.0% { opacity: 1.000; filter: blur(0.0px); }
    5.0% { opacity: 0.980; filter: blur(1.7px); }
   10.0% { opacity: 0.959; filter: blur(3.6px); }
   15.0% { opacity: 0.937; filter: blur(5.6px); }
   20.0% { opacity: 0.915; filter: blur(8.0px); }
   25.0% { opacity: 0.891; filter: blur(10.7px); }
   30.0% { opacity: 0.867; filter: blur(13.7px); }
   35.0% { opacity: 0.842; filter: blur(17.2px); }
   40.0% { opacity: 0.815; filter: blur(21.3px); }
   45.0% { opacity: 0.787; filter: blur(26.2px); }
   50.0% { opacity: 0.758; filter: blur(32.0px); }
   55.0% { opacity: 0.727; filter: blur(39.1px); }
   60.0% { opacity: 0.693; filter: blur(48.0px); }
   65.0% { opacity: 0.657; filter: blur(59.4px); }
   70.0% { opacity: 0.618; filter: blur(74.7px); }
   75.0% { opacity: 0.574; filter: blur(96.0px); }
   80.0% { opacity: 0.525; filter: blur(128.0px); }
   85.0% { opacity: 0.468; filter: blur(181.3px); }
   90.0% { opacity: 0.398; filter: blur(288.0px); }
   95.0% { opacity: 0.302; filter: blur(400.0px); }
  100.0% { opacity: 0.000; filter: blur(400.0px); }
}
@keyframes uk-melt-in {
    0.0% { opacity: 0.000; filter: blur(400.0px); }
    5.0% { opacity: 0.302; filter: blur(400.0px); }
   10.0% { opacity: 0.398; filter: blur(288.0px); }
   15.0% { opacity: 0.468; filter: blur(181.3px); }
   20.0% { opacity: 0.525; filter: blur(128.0px); }
   25.0% { opacity: 0.574; filter: blur(96.0px); }
   30.0% { opacity: 0.618; filter: blur(74.7px); }
   35.0% { opacity: 0.657; filter: blur(59.4px); }
   40.0% { opacity: 0.693; filter: blur(48.0px); }
   45.0% { opacity: 0.727; filter: blur(39.1px); }
   50.0% { opacity: 0.758; filter: blur(32.0px); }
   55.0% { opacity: 0.787; filter: blur(26.2px); }
   60.0% { opacity: 0.815; filter: blur(21.3px); }
   65.0% { opacity: 0.842; filter: blur(17.2px); }
   70.0% { opacity: 0.867; filter: blur(13.7px); }
   75.0% { opacity: 0.891; filter: blur(10.7px); }
   80.0% { opacity: 0.915; filter: blur(8.0px); }
   85.0% { opacity: 0.937; filter: blur(5.6px); }
   90.0% { opacity: 0.959; filter: blur(3.6px); }
   95.0% { opacity: 0.980; filter: blur(1.7px); }
  100.0% { opacity: 1.000; filter: blur(0.0px); }
}
@keyframes uk-tb-sink {
  from { transform: translateY(0); }
  to   { transform: translateY(var(--sink)); }
}
@keyframes uk-ud-rise {
  from { transform: translateY(calc(-1 * var(--rise))); }
  to   { transform: translateY(0); }
}
@keyframes uk-recentre {
  from { transform: translateY(0); }
  to   { transform: translateY(calc(-1 * var(--lift))); }
}
.uk-v-thatcher .uk-stage { cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
  .uk-v-thatcher .uk-play .uk-morph, .uk-v-thatcher .uk-play .uk-from, .uk-v-thatcher .uk-play .uk-to,
  .uk-v-thatcher .uk-play .uk-tb-sink, .uk-v-thatcher .uk-play .uk-ud, .uk-v-thatcher .uk-play.uk-solo {
    animation-duration: 1ms !important;
    animation-delay: 0s !important;
  }
}

/* ---------- PRIME MINISTERS (slot machine, from 1.9.2) ----------
   The names spin in a reel above WHAT THE FUCK (see assets/slot.js for timings). */
:root.uk-v-slot {
  --uk-ratio: 0.2749;   /* reel window (tall enough for LIZ TRUSS) + gap + WHAT THE FUCK */
}
.uk-v-slot .uk-type { gap: 0; }
.uk-v-slot .uk-stage { cursor: pointer; }

/* ---------- MAN UNITED (from 2.0.1) ----------
   UNITED slides right along the line; KINGDOM slides left behind it and
   comes out the other side as MAN. The pair then settles into the centre. */
:root.uk-v-manc {
  --uk-ratio: 0.24266;  /* room for MAN UNITED, which ends up taller than UNITED KINGDOM */
}
.uk-v-manc {
  --uk-hold: 1.4s;    /* pause before anything moves */
  --uk-swap: 3.6s;    /* the words passing each other */
}
.uk-v-manc .uk-type { gap: 0; }
.uk-v-manc .uk-anim .uk-united-go,
.uk-v-manc .uk-anim .uk-kingdom-go,
.uk-v-manc .uk-anim .uk-left-go {
  transform-box: view-box;
  transform-origin: 0 0;
  will-change: transform, opacity;
}
.uk-v-manc .uk-side-b { opacity: 0; }

.uk-v-manc .uk-play .uk-united-go {
  animation: uk-over var(--uk-swap) var(--uk-hold) both;
}
.uk-v-manc .uk-play .uk-kingdom-go,
.uk-v-manc .uk-play .uk-left-go {
  animation: uk-under var(--uk-swap) cubic-bezier(.6, 0, .4, 1) var(--uk-hold) both;
}
.uk-v-manc .uk-play .uk-side-a { animation: uk-gone-sides var(--uk-swap) linear var(--uk-hold) both; }
.uk-v-manc .uk-play .uk-side-b { animation: uk-arrive-sides var(--uk-swap) linear var(--uk-hold) both; }
.uk-v-manc .uk-play.uk-solo {
  animation: uk-settle var(--uk-swap) cubic-bezier(.6, 0, .4, 1) var(--uk-hold) both;
}

/* UNITED slides along the line in front, growing to its final size. */
@keyframes uk-over {
  0%   { transform: translate(var(--x0), var(--y)) scale(var(--s0)); animation-timing-function: cubic-bezier(.5, 0, .7, .6); }
  50%  { transform: translate(calc((var(--x0) + var(--x1)) / 2), calc(var(--y) - var(--lift))) scale(calc((var(--s0) + var(--s1)) / 2)); animation-timing-function: cubic-bezier(.3, .4, .5, 1); }
  100% { transform: translate(var(--x1), var(--y)) scale(var(--s1)); }
}
/* KINGDOM (and then MAN) slide left along the line, underneath. */
@keyframes uk-under {
  from { transform: translate(var(--x0), var(--y)) scale(var(--s0)); }
  to   { transform: translate(var(--x1), var(--y)) scale(var(--s1)); }
}
/* KINGDOM disappears into the right-hand side of UNITED; MAN comes out of the left-hand side.
   (Done with masks in parts/lines-manc.php that move with UNITED.) */
@keyframes uk-gone-sides   { 0%, 30% { opacity: 1; } 70%, 100% { opacity: 0; } }
@keyframes uk-arrive-sides { 0%, 30% { opacity: 0; } 70%, 100% { opacity: 1; } }
@keyframes uk-settle {
  from { transform: translateY(0); }
  to   { transform: translateY(var(--shift)); }
}
.uk-v-manc .uk-stage { cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
  .uk-v-manc .uk-play .uk-united-go, .uk-v-manc .uk-play .uk-kingdom-go, .uk-v-manc .uk-play .uk-left-go,
  .uk-v-manc .uk-play .uk-side-a, .uk-v-manc .uk-play .uk-side-b, .uk-v-manc .uk-play.uk-solo {
    animation-duration: 1ms !important;
    animation-delay: 0s !important;
  }
}

/* ---------- UNION FLAG (from 2.2.0) ----------
   The Union Flag fades up behind the lettering, then slowly fades, shrinks
   and gets grubbier as it turns into the St George's Cross.
   All timings are parts of one 14-second run (--uk-flag). */
.uk-v-flag { --uk-flag: 14s; }
.uk-v-flag .uk-page { position: relative; z-index: 1; }
.uk-v-flag .uk-stage { cursor: pointer; }
.uk-flagwrap {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transform-origin: 50% 50%;
  will-change: opacity, transform;
}
/* The flag keeps its 3:5 shape. Landscape screens: it fills the window (edges cropped).
   Upright phones: a full-screen flag would show only the red upright, so it becomes a wide
   band across the middle (up to 1.7 times the screen width) and stays recognisable. */
.uk-flag {
  display: block;
  flex: none;
  width: max(100vw, min(100vh * 5 / 3, 170vw));
  height: auto;
  aspect-ratio: 5 / 3;
  will-change: filter;
}
.uk-fl-dirt { opacity: 0; }

/* 0.6s hold · fades up to 3.6s · holds to 5s · then turns into St George's Cross by 14s */
.uk-flagwrap.uk-play { animation: uk-flag-life var(--uk-flag) linear both; }
.uk-flagwrap.uk-play .uk-flag { animation: uk-flag-tone var(--uk-flag) linear both; }
.uk-flagwrap.uk-play .uk-fl-blue,
.uk-flagwrap.uk-play .uk-fl-saltire { animation: uk-flag-union-goes var(--uk-flag) linear both; }
.uk-flagwrap.uk-play .uk-fl-dirt { animation: uk-flag-dirt var(--uk-flag) linear both; }

@keyframes uk-flag-life {
  0%, 4.3%  { opacity: 0;    transform: scale(1);   animation-timing-function: ease-in-out; }
  25.7%     { opacity: 0.68; transform: scale(1); }
  35.7%     { opacity: 0.68; transform: scale(1);   animation-timing-function: cubic-bezier(.45, 0, .35, 1); }
  100%      { opacity: 0.62; transform: scale(0.5); }
}
@keyframes uk-flag-union-goes {
  0%, 40%   { opacity: 1; animation-timing-function: ease-in-out; }
  88%, 100% { opacity: 0; }
}
@keyframes uk-flag-dirt {
  0%, 35.7% { opacity: 0; animation-timing-function: ease-in; }
  100%      { opacity: 1; }
}
@keyframes uk-flag-tone {
  0%, 35.7% { filter: sepia(0) saturate(1) brightness(1) contrast(1); animation-timing-function: ease-in; }
  100%      { filter: sepia(0.6) saturate(0.6) brightness(0.8) contrast(0.95); }
}

@media (prefers-reduced-motion: reduce) {
  .uk-flagwrap.uk-play, .uk-flagwrap.uk-play .uk-flag, .uk-flagwrap.uk-play .uk-fl-blue,
  .uk-flagwrap.uk-play .uk-fl-saltire, .uk-flagwrap.uk-play .uk-fl-dirt {
    animation-duration: 1ms !important;
    animation-delay: 0s !important;
  }
}
