@font-face {
  font-family: "Unbounded";
  src: url("/fonts/unbounded.woff2") format("woff2");
  font-weight: 200 900;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/plex-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/plex-500.woff2") format("woff2");
  font-weight: 500;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/plex-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

/* The Clacky colorway: orange case, charcoal keycaps, cream legends. */
:root {
  --orange: #ff9e45;
  --coral: #ee5a3c;
  --case: #e2532f;
  --cap: #2b2b31;
  --cap-top: #3d3d45;
  --cap-skirt: #17171b;
  --legend: #fff0e0;
  --ink: #26262b;
  --hero-ink: #1c1c20;  /* 5:1 even on the coral end of the gradient */
  --muted: #615a55;
  --paper: #ffffff;
  --line: #ece6e1;
  --stem-brown: #8b5a3c;
  --stem-blue: #2f6bff;
  --stem-cream: #eadbbd;

  --display: "Unbounded", ui-rounded, system-ui, sans-serif;
  --text: "IBM Plex Sans", system-ui, sans-serif;
  --u: 2.7rem; /* one key unit */
  --gutter: clamp(1.25rem, 4vw, 3.5rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--text);
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
}
a { color: inherit; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 3px; border-radius: 4px; }
.hero :focus-visible { outline-color: var(--legend); }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Hero ---------- */

.hero {
  background: linear-gradient(150deg, var(--orange) 0%, var(--coral) 100%);
  color: var(--hero-ink);
  padding: 1.25rem clamp(1.25rem, 4vw, 3.5rem) clamp(3rem, 7vw, 5.5rem);
}
.bar {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 72rem; margin: 0 auto;
}
.brand {
  display: inline-flex; align-items: center; gap: .6rem;
  font-family: var(--display); font-weight: 700; font-size: 1.25rem;
  text-decoration: none;
}
.brand img { border-radius: 9px; }
.bar-links { display: flex; gap: 1.5rem; font-weight: 500; }
.bar-links a { text-decoration: none; }
.bar-links a:hover { text-decoration: underline; text-underline-offset: 4px; }

.hero-grid {
  max-width: 72rem; margin: clamp(2.5rem, 6vw, 5rem) auto 0;
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  gap: clamp(2rem, 5vw, 4.5rem); align-items: center;
}
h1 {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(2.6rem, 6.2vw, 4.9rem);
  line-height: 1.02; letter-spacing: -0.03em;
  margin: 0 0 1.25rem; max-width: 11ch;
}
.lede { font-size: 1.25rem; line-height: 1.55; max-width: 34rem; margin: 0 0 2rem; }
.fine { font-size: .95rem; margin: 1.25rem 0 0; max-width: 30rem; }

/* Buttons are keycaps too: they travel when pressed. */
.actions { display: flex; flex-wrap: wrap; gap: 1rem; }
.cap {
  display: inline-block; text-decoration: none;
  font-family: var(--display); font-weight: 600; font-size: 1rem;
  padding: .95rem 1.4rem; border-radius: 12px;
  transition: transform 60ms ease-out, box-shadow 60ms ease-out;
}
.cap:active { transform: translateY(3px); }
.cap-dark { background: var(--cap); color: var(--legend); box-shadow: 0 5px 0 var(--cap-skirt); }
.cap-dark:active { box-shadow: 0 2px 0 var(--cap-skirt); }
.cap-light { background: var(--legend); color: var(--cap); box-shadow: 0 5px 0 #d9b89a; }
.cap-light:active { box-shadow: 0 2px 0 #d9b89a; }
.cap-orange { background: #c43c1d; color: #fff; box-shadow: 0 5px 0 #8f2a13; }  /* 5.2:1 */
.cap-orange:active { box-shadow: 0 2px 0 #8f2a13; }

/* ---------- The playable keyboard ---------- */

.board { display: grid; justify-items: center; gap: 1.1rem; }
.case {
  padding: calc(var(--u) * .32);
  border-radius: 18px;
  background: linear-gradient(170deg, #ec6a43, var(--case));
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .25), inset 0 -3px 0 rgba(0, 0, 0, .12),
              0 24px 40px -18px rgba(120, 30, 10, .55);
  display: grid; gap: calc(var(--u) * .1);
  touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.row { display: flex; gap: calc(var(--u) * .1); }
.indent-1 { padding-left: calc(var(--u) * .3); }
.indent-2 { padding-left: calc(var(--u) * .8); }
.indent-3 { padding-left: calc(var(--u) * 2.3); }

.key {
  width: var(--u); height: var(--u);
  border: 0; padding: 0; margin: 0 0 4px;
  border-radius: calc(var(--u) * .16);
  background: linear-gradient(180deg, var(--cap-top), var(--cap));
  box-shadow: 0 4px 0 var(--cap-skirt), inset 0 1px 0 rgba(255, 255, 255, .09);
  color: var(--legend);
  font-family: var(--display); font-weight: 500; font-size: calc(var(--u) * .3);
  cursor: pointer;
  transition: transform 35ms ease-out, box-shadow 35ms ease-out;
}
.key.wide { width: calc(var(--u) * 1.5); }
.key.space { width: calc(var(--u) * 5.2); }
.key.accent {
  background: linear-gradient(180deg, #fff6ec, #f3dfc8);
  box-shadow: 0 4px 0 #cdb08f, inset 0 1px 0 #fff;
  color: var(--cap);
}
.key.down, .key:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--cap-skirt), inset 0 1px 0 rgba(255, 255, 255, .06);
}
.key.accent.down, .key.accent:active { box-shadow: 0 1px 0 #cdb08f, inset 0 1px 0 #fff; }

.switches { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; }
.switch {
  display: inline-flex; align-items: center; gap: .5rem;
  font: 500 .95rem var(--text); color: var(--hero-ink);
  background: rgba(255, 255, 255, .28);
  border: 1.5px solid transparent; border-radius: 999px;
  padding: .45rem .9rem .45rem .55rem; cursor: pointer;
}
.switch:hover { background: rgba(255, 255, 255, .42); }
.switch[aria-checked="true"] { background: var(--legend); border-color: var(--cap); }
.stem {
  width: .95rem; height: .95rem; border-radius: 3px;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .2);
  /* the cross-shaped stem of a switch */
  clip-path: polygon(35% 0, 65% 0, 65% 35%, 100% 35%, 100% 65%, 65% 65%, 65% 100%, 35% 100%, 35% 65%, 0 65%, 0 35%, 35% 35%);
}
.stem-brown { background: var(--stem-brown); }
.stem-blue { background: var(--stem-blue); }
.stem-cream { background: var(--stem-cream); }
.hint { margin: 0; font-size: .95rem; text-align: center; min-height: 1.6em; }

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

/* Same left edge as the hero: 72rem of content inside the gutters. */
main section {
  max-width: calc(72rem + 2 * var(--gutter)); margin: 0 auto;
  padding: clamp(3.5rem, 8vw, 6rem) var(--gutter) 0;
}
h2 {
  font-family: var(--display); font-weight: 700;
  font-size: clamp(1.6rem, 3.2vw, 2.3rem); line-height: 1.15; letter-spacing: -0.02em;
  margin: 0 0 1rem; max-width: 22ch;
}
h3 { font-size: 1.15rem; font-weight: 600; line-height: 1.35; margin: 0 0 .4rem; }
.section-lede { color: var(--muted); margin: 0 0 2rem; max-width: 38rem; }

.feature-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr));
  gap: 2.25rem 3.5rem; margin-top: 2.5rem;
}
.feature-grid p { margin: 0; color: var(--muted); max-width: 34rem; }

table { width: 100%; max-width: 46rem; border-collapse: collapse; margin-bottom: 2.25rem; }
th, td { text-align: left; padding: .8rem .75rem; border-bottom: 1px solid var(--line); }
thead th { font-family: var(--display); font-weight: 600; font-size: 1rem; }
tbody th, tfoot th { font-weight: 500; }
td { width: 7.5rem; white-space: nowrap; }
tfoot th, tfoot td { font-weight: 600; border-bottom: 0; }

.faq { padding-bottom: clamp(3.5rem, 8vw, 6rem); }
details { max-width: 46rem; border-bottom: 1px solid var(--line); }
summary {
  cursor: pointer; padding: 1.1rem 0; font-weight: 600; list-style: none;
  display: flex; justify-content: space-between; gap: 1rem;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-family: var(--display); font-weight: 500; }
details[open] summary::after { content: "−"; }
details p { margin: 0 0 1.25rem; color: var(--muted); }

.foot {
  background: var(--cap); color: #cfc8c2;
  padding: 2.5rem clamp(1.25rem, 4vw, 3.5rem);
  font-size: .95rem;
}
.foot p { max-width: 72rem; margin: 0 auto .6rem; }
.foot a { color: var(--legend); }
.foot-links { display: flex; gap: 1.5rem; padding-top: .6rem; }

/* ---------- Text pages (privacy, terms) ---------- */

.doc { max-width: 44rem; margin: 0 auto; padding: 3rem clamp(1.25rem, 4vw, 2rem) 5rem; }
.doc h1 { font-size: clamp(2rem, 5vw, 3rem); max-width: none; }
.doc h2 { font-size: 1.35rem; margin-top: 2.5rem; }
.doc p, .doc li { color: var(--muted); }
.doc .updated { font-size: .95rem; }
.doc-bar { background: linear-gradient(150deg, var(--orange), var(--coral)); padding: 1.25rem clamp(1.25rem, 4vw, 3.5rem); }

/* ---------- Small screens ---------- */

@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; }
  .board { justify-self: stretch; }
  :root { --u: min(2.9rem, calc((100vw - 2 * var(--gutter)) / 13.2)); }
}
@media (max-width: 560px) {
  .bar-links { display: none; }
  .lede { font-size: 1.1rem; }
  td { width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  .key, .cap { transition: none; }
}
