/* TURWA error + offline screen.
   TV illustration inspired by one of Stefan Devai's designs on Dribbble.
   Every rule is scoped under .tv-error so the generic class names
   (.main, .screen, .lines, .g …) cannot leak into the site. */

.tv-error {
  /* Warm sand ground. The set is drawn in oranges and browns, so the
     surrounding text has to be dark to stay legible on it — the tokens
     below are the light-background counterparts of the site palette. */
  --error-bg: #c7b29e;
  --error-ink: #12110f;
  --error-muted: #4a443c;

  position: fixed;
  inset: 0;
  z-index: 999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.5rem;
  overflow: auto;
  background: var(--error-bg);
  color: var(--error-ink);
  font-family: var(--font-sans, Arial, sans-serif);
}

/* Own stacking context: the antenna (z-index -1) and the giant 404
   digits (z-index -5) must paint above this backdrop, not behind it. */
.tv-error__stage {
  position: relative;
  z-index: 0;
  flex: none;
}

.tv-error__caption {
  max-width: 34ch;
  margin: 0;
  text-align: center;
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--error-muted);
}

.tv-error__home {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  padding: 0.75em 1.6em;
  border: 1px solid var(--error-ink);
  border-radius: 999px;
  background: transparent;
  color: var(--error-ink);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.tv-error__home:hover,
.tv-error__home:focus-visible {
  background: var(--error-ink);
  color: var(--error-bg);
}

.tv-error__home:disabled {
  opacity: 0.55;
  cursor: default;
}

/* The offline variant keeps the set but drops the 404 digits. */
.tv-error--offline .text_404 {
  display: none;
}

/* Stop the page underneath scrolling behind the overlay. */
body.is-offline {
  overflow: hidden;
}

/* On the 404 page the set sits in normal flow below the site header, so
   it must not cover the viewport the way the offline overlay does. */
.tv-error--page {
  position: static;
  z-index: auto;
  min-height: calc(100vh - 150px);
  padding-top: 0;
}

/* ---------------------------------------------------------------- */
/* TV set                                                           */
/* ---------------------------------------------------------------- */

.tv-error .main_wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30em;
  height: 30em;
}

.tv-error .main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  margin-top: 5em;
}

.tv-error .antenna {
  width: 5em;
  height: 5em;
  border-radius: 50%;
  border: 2px solid black;
  background-color: #f27405;
  margin-bottom: -6em;
  margin-left: 0em;
  z-index: -1;
}

.tv-error .antenna_shadow {
  position: absolute;
  background-color: transparent;
  width: 50px;
  height: 56px;
  margin-left: 1.68em;
  border-radius: 45%;
  transform: rotate(140deg);
  border: 4px solid transparent;
  box-shadow:
    inset 0px 16px #a85103,
    inset 0px 16px 1px 1px #a85103;
}

.tv-error .antenna::after {
  content: "";
  position: absolute;
  margin-top: -9.4em;
  margin-left: 0.4em;
  transform: rotate(-25deg);
  width: 1em;
  height: 0.5em;
  border-radius: 50%;
  background-color: #f69e50;
}

.tv-error .antenna::before {
  content: "";
  position: absolute;
  margin-top: 0.2em;
  margin-left: 1.25em;
  transform: rotate(-20deg);
  width: 1.5em;
  height: 0.8em;
  border-radius: 50%;
  background-color: #f69e50;
}

.tv-error .a1 {
  position: relative;
  top: -102%;
  left: -130%;
  width: 12em;
  height: 5.5em;
  border-radius: 50px;
  background-image: linear-gradient(
    #171717,
    #171717,
    #353535,
    #353535,
    #171717
  );
  transform: rotate(-29deg);
  clip-path: polygon(50% 0%, 49% 100%, 52% 100%);
}

.tv-error .a1d {
  position: relative;
  top: -211%;
  left: -35%;
  transform: rotate(45deg);
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  border: 2px solid black;
  background-color: #979797;
  z-index: 99;
}

.tv-error .a2 {
  position: relative;
  top: -210%;
  left: -10%;
  width: 12em;
  height: 4em;
  border-radius: 50px;
  background-color: #171717;
  background-image: linear-gradient(
    #171717,
    #171717,
    #353535,
    #353535,
    #171717
  );
  margin-right: 5em;
  clip-path: polygon(
    47% 0,
    47% 0,
    34% 34%,
    54% 25%,
    32% 100%,
    29% 96%,
    49% 32%,
    30% 38%
  );
  transform: rotate(-8deg);
}

.tv-error .a2d {
  position: relative;
  top: -294%;
  left: 94%;
  width: 0.5em;
  height: 0.5em;
  border-radius: 50%;
  border: 2px solid black;
  background-color: #979797;
  z-index: 99;
}

.tv-error .notfound_text {
  background-color: black;
  padding-left: 0.3em;
  padding-right: 0.3em;
  font-size: 0.75em;
  color: white;
  letter-spacing: 0;
  border-radius: 5px;
  z-index: 10;
}

.tv-error .tv {
  width: 17em;
  height: 9em;
  margin-top: 3em;
  border-radius: 15px;
  background-color: #d36604;
  display: flex;
  justify-content: center;
  border: 2px solid #1d0e01;
  box-shadow: inset 0.2em 0.2em #e69635;
}

.tv-error .tv::after {
  content: "";
  position: absolute;
  width: 17em;
  height: 9em;
  border-radius: 15px;
  background:
    repeating-radial-gradient(#d36604 0 0.0001%, #00000070 0 0.0002%) 50% 0/2500px
      2500px,
    repeating-conic-gradient(#d36604 0 0.0001%, #00000070 0 0.0002%) 60% 60%/2500px
      2500px;
  background-blend-mode: difference;
  opacity: 0.09;
}

.tv-error .curve_svg {
  position: absolute;
  margin-top: 0.25em;
  margin-left: -0.25em;
  height: 12px;
  width: 12px;
}

.tv-error .display_div {
  display: flex;
  align-items: center;
  align-self: center;
  justify-content: center;
  border-radius: 15px;
  box-shadow: 3.5px 3.5px 0px #e69635;
}

.tv-error .screen_out {
  width: auto;
  height: auto;
  border-radius: 10px;
}

.tv-error .screen_out1 {
  width: 11em;
  height: 7.75em;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

.tv-error .screen {
  width: 13em;
  height: 7.85em;
  border: 2px solid #1d0e01;
  background:
    repeating-radial-gradient(#000 0 0.0001%, #ffffff 0 0.0002%) 50% 0/2500px
      2500px,
    repeating-conic-gradient(#000 0 0.0001%, #ffffff 0 0.0002%) 60% 60%/2500px
      2500px;
  background-blend-mode: difference;
  animation: tv-error-static 0.2s infinite alternate;
  border-radius: 10px;
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #252525;
  letter-spacing: 0.15em;
  text-align: center;
}

.tv-error .screenM {
  width: 13em;
  height: 7.85em;
  position: relative;
  background: linear-gradient(
    to right,
    #002fc6 0%,
    #002bb2 14.2857142857%,
    #3a3a3a 14.2857142857%,
    #303030 28.5714285714%,
    #ff0afe 28.5714285714%,
    #f500f4 42.8571428571%,
    #6c6c6c 42.8571428571%,
    #626262 57.1428571429%,
    #0affd9 57.1428571429%,
    #00f5ce 71.4285714286%,
    #3a3a3a 71.4285714286%,
    #303030 85.7142857143%,
    white 85.7142857143%,
    #fafafa 100%
  );
  border-radius: 10px;
  border: 2px solid black;
  z-index: 99;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #252525;
  letter-spacing: 0.15em;
  text-align: center;
  overflow: hidden;
}

.tv-error .screenM::before,
.tv-error .screenM::after {
  content: "";
  position: absolute;
  left: 0;
  z-index: 1;
  width: 100%;
}

.tv-error .screenM::before {
  top: 0;
  height: 68.4782608696%;
  background: linear-gradient(
    to right,
    white 0%,
    #fafafa 14.2857142857%,
    #ffe60a 14.2857142857%,
    #f5dc00 28.5714285714%,
    #0affd9 28.5714285714%,
    #00f5ce 42.8571428571%,
    #10ea00 42.8571428571%,
    #0ed600 57.1428571429%,
    #ff0afe 57.1428571429%,
    #f500f4 71.4285714286%,
    #ed0014 71.4285714286%,
    #d90012 85.7142857143%,
    #002fc6 85.7142857143%,
    #002bb2 100%
  );
}

.tv-error .screenM::after {
  bottom: 0;
  height: 21.7391304348%;
  background: linear-gradient(
    to right,
    #006c6b 0%,
    #005857 16.6666666667%,
    white 16.6666666667%,
    #fafafa 33.3333333333%,
    #001b75 33.3333333333%,
    #001761 50%,
    #6c6c6c 50%,
    #626262 66.6666666667%,
    #929292 66.6666666667%,
    #888888 83.3333333333%,
    #3a3a3a 83.3333333333%,
    #303030 100%
  );
}

@keyframes tv-error-static {
  100% {
    background-position:
      50% 0,
      60% 50%;
  }
}

.tv-error .lines {
  display: flex;
  column-gap: 0.1em;
  align-self: flex-end;
}

.tv-error .line1,
.tv-error .line3 {
  width: 2px;
  height: 0.5em;
  background-color: black;
  border-radius: 25px 25px 0px 0px;
  margin-top: 0.5em;
}

.tv-error .line2 {
  flex-grow: 1;
  width: 2px;
  height: 1em;
  background-color: black;
  border-radius: 25px 25px 0px 0px;
}

.tv-error .buttons_div {
  width: 4.25em;
  align-self: center;
  height: 8em;
  background-color: #e69635;
  border: 2px solid #1d0e01;
  padding: 0.6em;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  row-gap: 0.75em;
  box-shadow: 3px 3px 0px #e69635;
}

.tv-error .b1,
.tv-error .b2 {
  width: 1.65em;
  height: 1.65em;
  border-radius: 50%;
  background-color: #7f5934;
  border: 2px solid black;
  box-shadow:
    inset 2px 2px 1px #b49577,
    -2px 0px #513721,
    -2px 0px 0px 1px black;
}

.tv-error .b1::before {
  content: "";
  position: absolute;
  margin-top: 1em;
  margin-left: 0.5em;
  transform: rotate(47deg);
  border-radius: 5px;
  width: 0.1em;
  height: 0.4em;
  background-color: #000000;
}

.tv-error .b1::after {
  content: "";
  position: absolute;
  margin-top: 0.9em;
  margin-left: 0.8em;
  transform: rotate(47deg);
  border-radius: 5px;
  width: 0.1em;
  height: 0.55em;
  background-color: #000000;
}

.tv-error .b1 div {
  position: absolute;
  margin-top: -0.1em;
  margin-left: 0.65em;
  transform: rotate(45deg);
  width: 0.15em;
  height: 1.5em;
  background-color: #000000;
}

.tv-error .b2::before {
  content: "";
  position: absolute;
  margin-top: 1.05em;
  margin-left: 0.8em;
  transform: rotate(-45deg);
  border-radius: 5px;
  width: 0.15em;
  height: 0.4em;
  background-color: #000000;
}

.tv-error .b2::after {
  content: "";
  position: absolute;
  margin-top: -0.1em;
  margin-left: 0.65em;
  transform: rotate(-45deg);
  width: 0.15em;
  height: 1.5em;
  background-color: #000000;
}

.tv-error .speakers {
  display: flex;
  flex-direction: column;
  row-gap: 0.5em;
}

.tv-error .speakers .g1 {
  display: flex;
  column-gap: 0.25em;
}

.tv-error .speakers .g11,
.tv-error .speakers .g12,
.tv-error .speakers .g13 {
  width: 0.65em;
  height: 0.65em;
  border-radius: 50%;
  background-color: #7f5934;
  border: 2px solid black;
  box-shadow: inset 1.25px 1.25px 1px #b49577;
}

.tv-error .speakers .g {
  width: auto;
  height: 2px;
  background-color: #171717;
}

.tv-error .bottom {
  width: 100%;
  height: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  column-gap: 8.7em;
}

.tv-error .base1,
.tv-error .base2 {
  height: 1em;
  width: 2em;
  border: 2px solid #171717;
  background-color: #4d4d4d;
  margin-top: -0.15em;
  z-index: -1;
}

.tv-error .base3 {
  position: absolute;
  height: 0.15em;
  width: 17.5em;
  background-color: #171717;
  margin-top: 0.8em;
}

.tv-error .text_404 {
  position: absolute;
  display: flex;
  flex-direction: row;
  column-gap: 6em;
  z-index: -5;
  margin-bottom: 2em;
  align-items: center;
  justify-content: center;
  opacity: 0.5;
  color: #795d39;
}

.tv-error .text_4041,
.tv-error .text_4042,
.tv-error .text_4043 {
  transform: scaleY(24.5) scaleX(9);
}

@media only screen and (max-width: 495px) {
  .tv-error .text_404 {
    column-gap: 6em;
  }
}

@media only screen and (max-width: 395px) {
  .tv-error .text_404 {
    column-gap: 4em;
  }

  .tv-error .text_4041,
  .tv-error .text_4042,
  .tv-error .text_4043 {
    transform: scaleY(25) scaleX(8);
  }
}

@media (max-width: 275px), (max-height: 520px) {
  .tv-error .main {
    position: relative;
  }
}

/* The animated static screen is expensive to render and reads as noise
   on small screens, so below 1025px the design swaps in the colour-bar
   test card instead. */
@media only screen and (max-width: 1024px) {
  .tv-error .screenM {
    display: flex;
  }

  .tv-error .screen {
    display: none;
  }
}

@media only screen and (min-width: 1025px) {
  .tv-error .screen {
    display: flex;
  }

  .tv-error .screenM {
    display: none;
  }
}

/* The static flicker runs at 5Hz. Hold it still for anyone who asked
   for reduced motion. */
@media (prefers-reduced-motion: reduce) {
  .tv-error .screen {
    animation: none;
  }
}

/* The set is drawn at a fixed 30em, so scale the whole thing down
   rather than letting it overflow narrow viewports. */
@media only screen and (max-width: 540px) {
  .tv-error .main_wrapper {
    transform: scale(0.72);
  }

  .tv-error__stage {
    height: 22em;
  }
}

/* The offline set always shows snow, at every width. Dead static reads
   as "no signal"; the colour-bar test card reads as "wrong page", so
   that one stays with the 404. Doubled class beats the width queries
   above on specificity, so order here does not matter. */
.tv-error.tv-error--offline .screen {
  display: flex;
}

.tv-error.tv-error--offline .screenM {
  display: none;
}
