/* Kids TV Guard, by Bornbytes. The same night sky the TV shows, so the site and the TV feel like one thing. */

@font-face {
  font-family: "Fraunces";
  src: url("fonts/fraunces.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson";
  src: url("fonts/atkinson-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson";
  src: url("fonts/atkinson-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

:root {
  --sky-top: #24306a;
  --sky: #1c2654;
  --tile: #2e3d7c;
  --cloud: #f2f4fb;
  --haze: #a9b3dd;
  --moon: #f5d27a;
  --hill-far: #161e48;
  --hill-near: #0f1536;

  --display: "Fraunces", Georgia, serif;
  --body: "Atkinson", system-ui, sans-serif;
  --measure: 62ch;
}

* { box-sizing: border-box; }

html { background: var(--hill-near); }

body {
  margin: 0;
  color: var(--cloud);
  font: 400 1.125rem/1.6 var(--body);
  background: linear-gradient(var(--sky-top), var(--sky) 60rem) var(--sky);
  -webkit-font-smoothing: antialiased;
}

/* Stars: two fields that fade in turn, so the sky twinkles without a script. */
.stars, .stars::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1.5px 1.5px at 12% 18%, #fff9 50%, transparent 51%),
    radial-gradient(1px 1px at 27% 62%, #fff8 50%, transparent 51%),
    radial-gradient(2px 2px at 41% 9%, #fffa 50%, transparent 51%),
    radial-gradient(1px 1px at 55% 41%, #fff7 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 68% 23%, #fff9 50%, transparent 51%),
    radial-gradient(1px 1px at 79% 57%, #fff8 50%, transparent 51%),
    radial-gradient(2px 2px at 91% 14%, #fffa 50%, transparent 51%),
    radial-gradient(1px 1px at 6% 47%, #fff7 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 35% 33%, #fff8 50%, transparent 51%),
    radial-gradient(1px 1px at 86% 36%, #fff7 50%, transparent 51%);
  background-size: 420px 300px;
}
.stars::after {
  content: "";
  background-position: 210px 150px;
  animation: twinkle 5s ease-in-out infinite alternate;
}
@keyframes twinkle { from { opacity: 0.2; } to { opacity: 1; } }

a { color: var(--moon); text-underline-offset: 0.2em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--moon); outline-offset: 3px; border-radius: 6px; }

h1, h2, h3 {
  font-family: var(--display);
  font-variation-settings: "SOFT" 100, "WONK" 1;
  font-weight: 600;
  line-height: 1.08;
  margin: 0;
  text-wrap: balance;
}
h1 { font-size: clamp(2.5rem, 6.2vw, 4.75rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.9rem, 3.6vw, 2.75rem); letter-spacing: -0.01em; }
h3 { font-size: 1.375rem; font-variation-settings: "SOFT" 100, "WONK" 0; }
p { margin: 0; }

.wrap { width: min(72rem, 100% - 3rem); margin-inline: auto; }

/* Header ----------------------------------------------------------------------------------- */

.site-head {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding-block: 1.5rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--cloud);
  text-decoration: none;
  font: 600 1.25rem var(--display);
  font-variation-settings: "SOFT" 100;
}
.brand svg { width: 2rem; height: 2rem; }
.site-head nav { display: flex; gap: 1.5rem; }
.site-head nav a { color: var(--haze); text-decoration: none; }
.site-head nav a:hover { color: var(--cloud); }

/* Hero: a picture-book page. The headline sits in the sky, the TV stands on the hills. ------- */

.hero { position: relative; overflow: hidden; padding-bottom: 0; }
.hero-copy { position: relative; z-index: 1; text-align: center; padding-top: 2.5rem; }
.hero-copy h1 { max-width: 15ch; margin-inline: auto; }
.lede { max-width: 46ch; margin: 1.25rem auto 0; color: var(--haze); font-size: 1.25rem; }
.actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem 1.75rem; margin-top: 2rem; align-items: center; }

.pill {
  display: inline-block;
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  background: var(--moon);
  color: var(--sky);
  font-weight: 700;
  text-decoration: none;
}
.pill[aria-disabled="true"] { background: var(--tile); color: var(--cloud); cursor: default; }

/* The TV sits in the normal flow, so it can never cover the text above it; the hills sit behind its feet. */
.scene { position: relative; margin-top: 2.5rem; padding-bottom: clamp(3rem, 7vw, 6rem); }
.hills { position: absolute; inset: auto 0 0 0; width: 100%; height: 55%; }

.tv {
  position: relative;
  z-index: 1;
  width: min(42rem, 86vw);
  margin-inline: auto;
}
.tv-bezel {
  aspect-ratio: 16 / 9;
  padding: 0.6rem;
  border-radius: 1rem;
  background: #0b1030;
  box-shadow: 0 0 0 1px #ffffff14, 0 1.5rem 3rem #0006;
}
.tv-stand { width: 34%; height: 0.7rem; margin: 0 auto; border-radius: 0 0 0.6rem 0.6rem; background: #0b1030; }

/* The TV's own warning screen, at a sixth of its size. */
.screen {
  position: relative;
  height: 100%;
  border-radius: 0.5rem;
  overflow: hidden;
  background: linear-gradient(var(--sky-top), var(--sky));
  display: grid;
  place-items: center;
  text-align: center;
}
.screen > div { display: grid; justify-items: center; gap: 0.35rem; transition: opacity 0.6s ease; }
.screen .ring { width: 30%; }
.screen .ring text { font: 600 26px var(--body); fill: var(--cloud); }
.screen strong { font: 600 clamp(1rem, 2.6vw, 1.5rem) var(--display); font-variation-settings: "SOFT" 100; }
.screen span { color: var(--haze); font-size: clamp(0.7rem, 1.5vw, 0.9rem); }
.screen .got-it { margin-top: 0.3rem; padding: 0.25rem 1.2rem; border-radius: 0.5rem; background: var(--moon); color: var(--sky); font-weight: 700; font-size: clamp(0.65rem, 1.4vw, 0.85rem); }
.screen .asleep { position: absolute; inset: 0; place-content: center; opacity: 0; }
.screen .asleep svg { width: 34%; }
.screen.sleeping .warning { opacity: 0; }
.screen.sleeping .asleep { opacity: 1; }

/* Sections ------------------------------------------------------------------------------------ */

section { padding-block: clamp(3.5rem, 7vw, 5.5rem); }
.ground { background: var(--hill-near); }
.ground > section:first-child { padding-top: clamp(2.5rem, 5vw, 4rem); }
.section-lede { max-width: var(--measure); margin-top: 1rem; color: var(--haze); }

/* The steps really are a sequence, so they are numbered. */
.steps { list-style: none; padding: 0; margin: 3rem 0 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 2.5rem; counter-reset: step; }
.steps li { counter-increment: step; }
.steps li::before {
  content: counter(step);
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  margin-bottom: 1.25rem;
  border-radius: 50%;
  background: var(--moon);
  color: var(--sky);
  font: 600 1.5rem var(--display);
}
.steps p { margin-top: 0.5rem; color: var(--haze); }

/* What you can do, shown as the Telegram chat it really is. */
.chat { display: grid; gap: 3.5rem; margin-top: 3.5rem; }
.exchange { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 22rem); gap: 1.5rem 4rem; align-items: center; }
.bubbles { display: grid; gap: 0.6rem; max-width: 34rem; }
.bubble { width: fit-content; max-width: 100%; padding: 0.7rem 1rem; border-radius: 1.1rem; line-height: 1.45; }
.bubble.from-you { justify-self: end; background: var(--moon); color: var(--sky); border-bottom-right-radius: 0.3rem; font-weight: 700; }
.bubble.from-tv { background: var(--tile); border-bottom-left-radius: 0.3rem; white-space: pre-line; }
.buttons { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.buttons span { padding: 0.45rem 0.9rem; border-radius: 0.7rem; border: 1px solid #ffffff2e; color: var(--cloud); font-size: 0.95rem; }
.exchange h3 + p { margin-top: 0.5rem; color: var(--haze); }

.keep { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 2rem 3rem; margin-top: 2.5rem; }
.keep h3 { font-size: 1.2rem; }
.keep p { margin-top: 0.4rem; color: var(--haze); }

.faq { max-width: 48rem; margin-top: 2.5rem; }
.faq details { border-top: 1px solid #ffffff1f; padding-block: 1.1rem; }
.faq details:last-child { border-bottom: 1px solid #ffffff1f; }
.faq summary { cursor: pointer; font-weight: 700; font-size: 1.15rem; list-style-position: outside; }
.faq details p { margin-top: 0.75rem; color: var(--haze); max-width: var(--measure); }

.site-foot { padding-block: 3rem; color: var(--haze); font-size: 1rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem; }

/* Privacy policy and other long reading ----------------------------------------------------- */

.doc { max-width: 44rem; padding-block: 2rem 5rem; }
.doc h1 { font-size: clamp(2.2rem, 5vw, 3.4rem); }
.doc .updated { margin-top: 0.75rem; color: var(--haze); }
.doc h2 { font-size: 1.6rem; margin-top: 2.75rem; }
.doc p, .doc ul { margin-top: 1rem; }
.doc li + li { margin-top: 0.4rem; }
.doc table { width: 100%; margin-top: 1rem; border-collapse: collapse; font-size: 1rem; }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 0.6rem 0.75rem 0.6rem 0; border-bottom: 1px solid #ffffff1f; }
.doc th { color: var(--haze); font-weight: 700; }

.brand, .site-head nav a { white-space: nowrap; }

@media (max-width: 760px) {
  .exchange { grid-template-columns: 1fr; }
  .site-head { gap: 1rem; }
  .brand { font-size: 1.05rem; }
  .site-head nav { gap: 1rem; font-size: 0.95rem; }
  /* The table reads as a list of cards on a phone: data first, then why and where. */
  .doc thead { display: none; }
  .doc tr { display: block; padding-block: 0.9rem; border-bottom: 1px solid #ffffff1f; }
  .doc td { display: block; border: 0; padding: 0.15rem 0; }
  .doc td:first-child { font-weight: 700; }
  .doc td:not(:first-child) { color: var(--haze); }
}

@media (prefers-reduced-motion: reduce) {
  .stars::after { animation: none; opacity: 0.6; }
  .screen > div { transition: none; }
}
