/* TFN OS site: the shared parts of all pages. The page stays quiet, so that the real screens of the boards give the
   colour. The colours come from TFN OS: the gold frame of the selected app, the violet of GAMES and the teal of UTIL.
   The board drawings use real millimetres (--mm = the px of one mm). The front page adds css/home.css. */

@font-face {
  font-family: 'Archivo';
  src: url('../fonts/archivo-display.woff2') format('woff2');
  font-weight: 620;
  font-stretch: 112%;
  font-display: swap;
}

@font-face {
  font-family: 'Atkinson Hyperlegible Next';
  src: url('../fonts/atkinson-hyperlegible-next.woff2') format('woff2');
  font-weight: 200 800;
  font-display: swap;
}

:root {
  --paper: #f2f3f5;
  --paper-2: #e8eaee;
  --raised: #ffffff;
  --ink: #14161c;
  --ink-2: #4b5162;
  --line: #d5d8df;
  --link: #3a32a3;
  --violet: #4b3fc0;
  --on-violet: #ffffff;
  --gold: #e2a018;
  --on-gold: #14161c;
  --gold-soft: #f8e6b8;
  --teal: #0b6f69;
  --warn-bg: #fdf0d5;
  --warn-ink: #5f3d00;
  --bad: #b3261e;
  --on-bad: #ffffff;
  --night: #090a10;
  --case-1: #2c2f3a;
  --case-2: #1b1d25;
  --case-edge: rgba(255, 255, 255, 0.13);
  --shadow: 0 1px 2px rgba(20, 22, 28, 0.07), 0 10px 28px rgba(20, 22, 28, 0.09);
  --font-d: 'Archivo', 'Segoe UI', system-ui, sans-serif;
  --font-b: 'Atkinson Hyperlegible Next', 'Segoe UI', system-ui, sans-serif;
  --wrap: 1200px;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --paper: #0f1116;
    --paper-2: #161920;
    --raised: #1a1d25;
    --ink: #e9ebf1;
    --ink-2: #a5abba;
    --line: #2a2e39;
    --link: #b9b3ff;
    --violet: #aaa1ff;
    --on-violet: #11131a;
    --gold: #f0b430;
    --on-gold: #14161c;
    --gold-soft: #4a3a10;
    --teal: #5fd0c5;
    --warn-bg: #3a2c0b;
    --warn-ink: #ffdc96;
    --bad: #ff8a80;
    --on-bad: #2b0a07;
    --night: #06070b;
    --case-1: #343846;
    --case-2: #23262f;
    --case-edge: rgba(255, 255, 255, 0.18);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 30px rgba(0, 0, 0, 0.3);
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --paper: #0f1116;
  --paper-2: #161920;
  --raised: #1a1d25;
  --ink: #e9ebf1;
  --ink-2: #a5abba;
  --line: #2a2e39;
  --link: #b9b3ff;
  --violet: #aaa1ff;
  --on-violet: #11131a;
  --gold: #f0b430;
  --on-gold: #14161c;
  --gold-soft: #4a3a10;
  --teal: #5fd0c5;
  --warn-bg: #3a2c0b;
  --warn-ink: #ffdc96;
  --bad: #ff8a80;
  --on-bad: #2b0a07;
  --night: #06070b;
  --case-1: #343846;
  --case-2: #23262f;
  --case-edge: rgba(255, 255, 255, 0.18);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 30px rgba(0, 0, 0, 0.3);
  color-scheme: dark;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-b);
  font-size: 1.0625rem;
  line-height: 1.58;
  overflow-x: hidden;
}

img,
video {
  max-width: 100%;
}

a {
  color: var(--link);
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
  border-radius: 4px;
}

h1,
h2,
h3 {
  font-family: var(--font-d);
  font-weight: 620;
  font-stretch: 112%;
  line-height: 1.12;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 1.4rem + 3.2vw, 3.6rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.7rem, 1.25rem + 1.9vw, 2.45rem);
}

h3 {
  font-size: 1.2rem;
  line-height: 1.25;
}

p {
  margin: 0 0 1em;
}

code {
  font-size: 0.92em;
}

.wrap {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.measure {
  max-width: 64ch;
}

/* the hidden attribute wins over a display of a class (the test bar of the install page has display: flex) */
[hidden] {
  display: none !important;
}

.skip {
  position: absolute;
  left: -9999px;
}

.skip:focus {
  left: 16px;
  top: 12px;
  z-index: 10;
  background: var(--raised);
  padding: 8px 12px;
}

/* the top bar: the same on each page. On a phone it keeps the brand, two links and the two buttons in one line. */
.top {
  position: sticky;
  top: 0;
  z-index: 5;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}

.top .wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 60px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-d);
  font-weight: 620;
  font-stretch: 112%;
  font-size: 1.12rem;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.brand svg {
  width: 34px;
  height: 14px;
  flex: none;
}

.nav {
  display: flex;
  gap: 2px;
  margin-left: auto;
}

.nav a {
  color: var(--ink-2);
  text-decoration: none;
  padding: 8px 10px;
  border-radius: 8px;
  white-space: nowrap;
}

.nav a:hover,
.nav a[aria-current='page'] {
  color: var(--ink);
  background: var(--paper-2);
}

.gh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  min-width: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.9rem;
  flex: none;
}

.gh-btn:hover {
  background: var(--paper-2);
}

.theme-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  border-radius: 999px;
  height: 36px;
  min-width: 36px;
  padding: 0 10px;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  flex: none;
}

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 22px;
  border-radius: 10px;
  border: 1.5px solid var(--ink);
  color: var(--ink);
  background: transparent;
  font: 700 1.02rem/1 var(--font-b);
  text-decoration: none;
  cursor: pointer;
}

.btn:hover {
  background: color-mix(in srgb, var(--ink) 6%, transparent);
}

.btn-primary {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--on-gold);
}

.btn-primary:hover {
  background: color-mix(in srgb, var(--gold) 88%, var(--ink));
}

.btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-danger {
  background: var(--bad);
  border-color: var(--bad);
  color: var(--on-bad);
}

/* the board drawings: the sizes in mm, from the screen size and the pixel pitch; the cases are close, not exact */
.dev {
  --mm: 2.4px;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.dev-body {
  position: relative;
  width: calc(var(--bw) * var(--mm));
  height: calc(var(--bh) * var(--mm));
  border-radius: calc(var(--br) * var(--mm));
  background: linear-gradient(160deg, var(--case-1), var(--case-2));
  box-shadow: inset 0 0 0 1px var(--case-edge), var(--shadow);
}

.dev-screen {
  position: absolute;
  left: calc(var(--sx) * var(--mm));
  top: calc(var(--sy) * var(--mm));
  width: calc(var(--sw) * var(--mm));
  height: calc(var(--sh) * var(--mm));
  border-radius: calc(var(--sr) * var(--mm));
  overflow: hidden;
  background: #000;
  box-shadow: 0 0 0 calc(0.5 * var(--mm)) #05060c;
}

.dev-screen img,
.dev-screen video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: opacity 0.7s ease;
}

.dev-screen img.off {
  opacity: 0;
}

.dev-lcd349 {
  --bw: 101;
  --bh: 33;
  --br: 3;
  --sw: 85.1;
  --sh: 22.9;
  --sx: 6.4;
  --sy: 5.05;
  --sr: 0.6;
}

.dev-lcd349 .dev-body::after {
  content: '';
  position: absolute;
  right: calc(-0.8 * var(--mm));
  top: calc(13.5 * var(--mm));
  width: calc(1.6 * var(--mm));
  height: calc(6 * var(--mm));
  border-radius: calc(0.6 * var(--mm));
  background: #9aa0b5;
}

.dev-cores3 {
  --bw: 54;
  --bh: 54;
  --br: 7;
  --sw: 40.9;
  --sh: 30.7;
  --sx: 6.55;
  --sy: 6.2;
  --sr: 1;
}

.dev-cores3 .dev-body::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(9 * var(--mm));
  height: 1px;
  background: var(--case-edge);
}

.dev-am18 {
  --bw: 44;
  --bh: 37;
  --br: 5;
  --sw: 35.4;
  --sh: 29.1;
  --sx: 4.3;
  --sy: 3.95;
  --sr: 2.2;
}

.dev-am175 {
  --bw: 50;
  --bh: 50;
  --br: 25;
  --sw: 44.45;
  --sh: 44.45;
  --sx: 2.78;
  --sy: 2.78;
  --sr: 22.3;
}

.dev-watcher {
  --bw: 46;
  --bh: 46;
  --br: 11;
  --sw: 36.8;
  --sh: 36.8;
  --sx: 4.6;
  --sy: 4.6;
  --sr: 18.4;
}

.dev-watcher .dev-body::after {
  content: '';
  position: absolute;
  right: calc(-2.2 * var(--mm));
  top: calc(3 * var(--mm));
  width: calc(3 * var(--mm));
  height: calc(9 * var(--mm));
  border-radius: calc(1.2 * var(--mm));
  background: repeating-linear-gradient(180deg, #8b90a6 0 calc(0.6 * var(--mm)), #5d6178 0 calc(1.2 * var(--mm)));
}

.dev-tab5 {
  --bw: 128;
  --bh: 83;
  --br: 8;
  --sw: 110.7;
  --sh: 62.3;
  --sx: 8.65;
  --sy: 10.35;
  --sr: 1;
}

.dev figcaption {
  margin-top: 12px;
  text-align: center;
  font-size: 0.86rem;
  line-height: 1.3;
  color: var(--ink-2);
}

.dev figcaption b {
  display: block;
  color: var(--ink);
  font-size: 0.95rem;
}

/* the first part of a page (how.html and the public front page) */
.hero {
  padding: clamp(36px, 6vw, 80px) 0 clamp(28px, 4vw, 48px);
}

.hero-title {
  font-size: clamp(2.4rem, 1.4rem + 4.4vw, 4.4rem);
  line-height: 1;
  letter-spacing: -0.025em;
  margin: 0 0 18px;
}

.hero-lede {
  font-family: var(--font-d);
  font-stretch: 112%;
  font-weight: 620;
  font-size: clamp(1.25rem, 1rem + 1vw, 1.6rem);
  line-height: 1.25;
  max-width: 34ch;
  margin-bottom: 14px;
}

.hero-sub {
  color: var(--ink-2);
  max-width: 58ch;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 24px 0 0;
}

/* sections */
.section {
  padding: clamp(56px, 8vw, 96px) 0;
}

.section-alt {
  background: var(--paper-2);
}

.section-head {
  margin-bottom: clamp(24px, 3.5vw, 40px);
}

.section-head p {
  color: var(--ink-2);
  font-size: 1.1rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.tags li {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--raised);
  border: 1px solid var(--line);
}

/* a short list of names with one line each (the public front page) */
.picks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 18px 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.picks li {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  color: var(--ink-2);
}

.picks b {
  display: block;
  font-family: var(--font-d);
  font-stretch: 112%;
  font-weight: 620;
  color: var(--ink);
}

/* steps in order (the install, the start of a board) */
.steps {
  counter-reset: step;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 22px;
  padding: 0;
  margin: 0 0 30px;
  list-style: none;
}

.steps li {
  counter-increment: step;
  padding-top: 12px;
  border-top: 2px solid var(--ink);
}

.steps li::before {
  content: counter(step);
  display: block;
  font-family: var(--font-d);
  font-stretch: 112%;
  font-weight: 620;
  font-size: 1.9rem;
  line-height: 1;
  margin-bottom: 8px;
  color: var(--ink);
}

.specs {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 0 0 16px;
}

.specs dt {
  font-weight: 700;
}

.specs dd {
  margin: 0;
}

.note {
  padding: 14px 18px;
  border-radius: 10px;
  background: var(--warn-bg);
  color: var(--warn-ink);
}

/* FAQ */
.faq details {
  border-bottom: 1px solid var(--line);
  padding: 14px 0;
}

.faq summary {
  font-weight: 700;
  font-size: 1.06rem;
  cursor: pointer;
}

.faq details p {
  margin: 10px 0 0;
  color: var(--ink-2);
}

/* the footer */
.foot {
  padding: 40px 0 56px;
  border-top: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 0.9rem;
}

.foot p {
  max-width: 80ch;
}

@media (max-width: 900px) {
  .steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .nav a.hide-s,
  .gh-btn .hide-s {
    display: none;
  }

  .top .wrap {
    gap: 6px;
  }

  .nav a {
    padding: 8px 7px;
  }

  .brand {
    font-size: 1.02rem;
  }
}

@media (max-width: 640px) {
  .steps {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 380px) {
  .brand svg {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .dev-screen img {
    transition: none;
  }
}
