/* The whole page is the typewriter: paper on top, platen and keyboard below,
   finished sheets (the apps) laid out on the machine body. */
:root {
  --machine: #A9CFC1;
  --paper: #F8F9F4;
  --ink: #1B1F1E;
  --ink-soft: #4B5352;
  --ribbon: #B8221A;
  --ribbon-deep: #8E1A14;
  --well: #1F2526;
  --keycap: #2B3233;
  --chrome: #C9D1CF;
  --pale: #F1F3EE;
  --pale-soft: #AEB9B6;
  --focus: #F2C94C;

  --type: "Courier Prime", "Courier New", Courier, monospace;
  --display: "Special Elite", "Courier New", monospace;
  --label: "Barlow Condensed", "Arial Narrow", sans-serif;
  --pencil: "Reenie Beanie", "Bradley Hand", cursive;
}

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

html { scroll-behavior: smooth; background: var(--well); }

body {
  margin: 0;
  background: var(--machine);
  color: var(--ink);
  font-family: var(--type);
  font-size: 17px;
  line-height: 1.55;
}

h1, h2, h3, p, dl, dd, figure, blockquote { margin: 0; }

a { color: var(--ribbon-deep); }
a:hover { color: var(--ribbon); }
a:focus-visible { outline: 3px solid var(--ribbon); outline-offset: 3px; }
button:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.wrap {
  max-width: 1180px;
  margin-inline: auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

.label {
  font-family: var(--label);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.muted { color: var(--ink-soft); }

.skip {
  position: absolute;
  left: 16px;
  top: -60px;
  padding: 10px 14px;
  background: var(--paper);
  color: var(--ink);
}
.skip:focus { top: 12px; }

/* Header */
.site-header {
  padding-block: 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
}
.brand { display: flex; align-items: center; gap: 5px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.brand-key {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 3px solid #E9EEEA;
  background: var(--keycap);
  color: var(--pale);
  font-family: var(--label);
  font-weight: 600;
  font-size: 19px;
}
.brand-word { font-family: var(--display); font-size: 27px; margin-left: 7px; }
.site-nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0 24px; font-size: 18px; letter-spacing: 0.06em; }
.site-nav a { color: var(--ink); min-height: 44px; display: flex; align-items: center; }

/* The sheet of paper */
.sheet {
  max-width: 1040px;
  margin-inline: auto;
  padding: clamp(24px, 5vw, 60px) clamp(18px, 5vw, 60px) 34px;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  gap: clamp(30px, 5vw, 52px);
}
.sheet-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 24px; font-size: 15px; }

.tagline {
  font-family: var(--display);
  font-weight: 400;
  font-size: clamp(33px, 5.2vw, 64px);
  line-height: 1.2;
  display: flex;
  flex-direction: column;
  gap: 0.08em;
}
.tagline-line { display: flex; flex-wrap: wrap; column-gap: 0.5em; }
.tagline-red { color: var(--ribbon); }
.tagline-word { display: inline-block; white-space: nowrap; }
.tagline-letter { display: inline-block; }

.review { display: flex; flex-direction: column; gap: 14px; max-width: 820px; }
.review blockquote { display: flex; flex-direction: column; gap: 10px; }
.review-lead { font-style: italic; font-size: 19px; }
.review-line { font-size: clamp(22px, 3.1vw, 33px); line-height: 1.4; font-weight: 700; }
.review-pencil {
  font-family: var(--pencil);
  font-size: clamp(42px, 6vw, 62px);
  line-height: 1;
  color: var(--ribbon);
  transform: rotate(-2deg);
  transform-origin: left center;
  margin-top: 6px;
}
.review figcaption { font-size: 15px; color: var(--ink-soft); }

.blurst { position: relative; display: inline-block; color: var(--ribbon); padding-inline: 0.12em; }
.blurst svg {
  position: absolute;
  left: -7%;
  top: -12%;
  width: 114%;
  height: 124%;
  overflow: visible;
  pointer-events: none;
}
.blurst path { fill: none; stroke: var(--ribbon); stroke-width: 2.5; stroke-linecap: round; }

/* The line being typed. The carriage moves, so the typing point stays still. */
.live { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.live .label { font-size: 15px; }
.stream {
  display: flex;
  justify-content: flex-end;
  overflow: hidden;
  white-space: pre;
  font-size: 22px;
  line-height: 1.5;
  padding-right: 30%;
  min-width: 0;
  min-height: 1.5em;
}
#stream { flex: none; }
#stream b { color: var(--ribbon); }
.caret { flex: none; width: 0.6em; height: 1.15em; margin-top: 0.12em; background: var(--ribbon); }

/* Platen */
.platen { position: relative; display: flex; align-items: center; gap: 6px; margin-top: -6px; }
.knob {
  flex: none;
  width: clamp(26px, 5vw, 56px);
  height: clamp(44px, 6vw, 72px);
  border-radius: 12px;
  background: repeating-linear-gradient(90deg, #23292A 0 4px, var(--ink-soft) 4px 6px);
}
.roller {
  flex: 1;
  min-width: 0;
  height: clamp(34px, 4.6vw, 54px);
  border-radius: 8px;
  background: #23292A;
  box-shadow: inset 0 7px 0 #3A4243;
}

/* Keyboard well */
.machine {
  margin-top: -6px;
  padding: 28px clamp(12px, 3vw, 44px) 32px;
  background: var(--well);
  color: var(--pale);
  border-radius: 0 0 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.stats { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px 28px; }
@media (min-width: 640px) { .stats { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stats > div { min-width: 0; }
.stats dt { font-size: 15px; color: var(--pale-soft); }
.machine .stats dd { font-size: 23px; font-variant-numeric: tabular-nums; }
.stats sup { font-size: 0.62em; line-height: 0; }

.keys { --key-gap: clamp(3px, 0.8vw, 10px); display: flex; flex-direction: column; gap: clamp(4px, 0.9vw, 10px); }
.key-row { display: flex; justify-content: center; gap: var(--key-gap); }
.key {
  /* One size for every row: a tenth of the top row, which has ten keys. */
  flex: none;
  width: min(56px, calc((100% - 9 * var(--key-gap)) / 10));
  aspect-ratio: 1;
  padding: 0;
  border-radius: 50%;
  border: clamp(2px, 0.35vw, 4px) solid var(--chrome);
  background: var(--keycap);
  color: var(--pale);
  font-family: var(--label);
  font-weight: 600;
  font-size: clamp(14px, 2.2vw, 23px);
  cursor: pointer;
  touch-action: manipulation;
}
.key.is-down { background: var(--ribbon); transform: translateY(4px); }
.key-space {
  width: min(62%, 460px);
  height: 44px;
  aspect-ratio: auto;
  border-radius: 22px;
  border-width: 3px;
  margin-top: 4px;
}
.machine-hint { text-align: center; font-size: 15px; color: var(--chrome); }

/* Apps */
.apps {
  padding-block: clamp(48px, 7vw, 84px) clamp(40px, 6vw, 64px);
  display: flex;
  flex-direction: column;
  gap: 28px;
  scroll-margin-top: 12px;
}
.apps-next { padding-top: 0; }
.apps-head { display: flex; flex-direction: column; gap: 6px; }
.apps h2 { font-family: var(--display); font-weight: 400; font-size: clamp(32px, 4.6vw, 50px); line-height: 1.15; }
.apps-head p { max-width: 60ch; }
.app-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; }
@media (min-width: 640px) { .app-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1120px) { .app-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 900px) { .app-grid-three { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 640px) and (max-width: 899px) {
  .app-grid-three { grid-template-columns: minmax(0, 1fr); }
}
.app {
  padding: 26px;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.app h3 { font-family: var(--display); font-weight: 400; font-size: 30px; line-height: 1.15; }
.app p { flex: 1; }
.app a { font-weight: 700; min-height: 44px; display: flex; align-items: center; }
.app-status { color: var(--ribbon); }
.app-blank { background: transparent; border: 2px dashed var(--ink); }

/* Footer */
.site-footer { background: var(--well); color: var(--pale); }
.footer-inner { padding-block: 36px; display: flex; flex-direction: column; gap: 24px; }
.footer-line { font-size: 15px; color: var(--chrome); }

/* A small page for missing addresses */
.lost { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; padding-block: 32px; }
.lost .sheet { width: 100%; }
.lost h1 { font-family: var(--display); font-weight: 400; font-size: clamp(33px, 5.2vw, 64px); line-height: 1.2; }

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