/* freehand.sh: black ink on white paper, drawn by hand (brand/README.md). */

@font-face { font-family: 'Sav Hand'; src: url(fonts/SavHand-Regular.woff2) format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Sav Hand'; src: url(fonts/SavHand-Bold.woff2) format('woff2'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Sav Hand'; src: url(fonts/SavHand-Black.woff2) format('woff2'); font-weight: 900; font-display: swap; }

:root {
  --ink: #0a0a0a;
  --ink-2: #4a4a48;
  --paper: #ffffff;
  --rule: #d8d8d4;
  /* The font is Sav's handwriting, added when the site is deployed (it's not in the repo).
     Without it, the page falls back to a system hand. */
  --hand: 'Sav Hand', 'Bradley Hand', 'Segoe Print', cursive;
  --mono: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  /* Corners a little off, like a box drawn by hand. */
  --drawn: 14px 6px 16px 5px / 6px 15px 5px 14px;
  --gutter: clamp(16px, 5vw, 64px);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--hand);
  font-size: clamp(19px, 1.6vw, 22px);
  line-height: 1.35;
}

a { color: var(--ink); text-underline-offset: 0.2em; }
a:hover { color: var(--ink-2); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 4px; }

h1, h2 { margin: 0; font-weight: 900; line-height: 1; }
h2 { font-size: clamp(32px, 3.4vw, 48px); }
p { margin: 0; }

.wrap { width: min(1280px, 100%); margin-inline: auto; padding-inline: var(--gutter); }
main > section { padding-block: clamp(32px, 5vw, 56px); }

.sk { border: 2px solid var(--ink); border-radius: var(--drawn); }
/* Named for screen readers; the picture below already says it. */
.hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---- nav ---- */
.nav {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 28px;
  padding-block: 24px 16px;
  border-bottom: 2px solid var(--ink);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 34px; font-weight: 900; text-decoration: none; }
.nav nav { display: flex; flex-wrap: wrap; gap: 8px 24px; }

/* ---- hero ---- */
.hero { display: flex; flex-wrap: wrap; align-items: center; gap: 40px 56px; }
.hero-words { flex: 1 1 420px; display: flex; flex-direction: column; gap: 22px; }
h1 { font-size: clamp(44px, 6.4vw, 96px); line-height: 0.95; }
h1 span { display: inline-block; white-space: nowrap; }   /* two lines, each kept whole */
.lede { font-size: clamp(22px, 2vw, 27px); max-width: 32ch; }
.device { flex: 0 1 380px; width: 100%; max-width: 380px; height: auto; margin-inline: auto; }

.doors { display: flex; flex-wrap: wrap; gap: 14px; }
.button { display: inline-block; padding: 12px 22px; font-size: clamp(20px, 5vw, 24px); text-decoration: none; }
.button:hover { background: #f0f0ec; color: var(--ink); }
.button.ink { background: var(--ink); color: var(--paper); }
.button.ink:hover { background: var(--ink-2); color: var(--paper); }

/* ---- the loop ---- */
#loop { display: flex; flex-direction: column; gap: 20px; }
.diagram { width: 100%; height: auto; }

/* ---- ask from the page ---- */
.ask { display: grid; grid-template-columns: minmax(0, 400px) minmax(0, 1fr); gap: 28px 56px; align-items: center; }
.ask-words { display: flex; flex-direction: column; gap: 14px; }
.ask-words h2 { font-size: clamp(36px, 4vw, 56px); }
.ask-words .small { font-size: 0.85em; color: var(--ink-2); }
.ask-device { width: 100%; height: auto; }
@media (max-width: 820px) { .ask { grid-template-columns: minmax(0, 1fr); } }

/* ---- three things ---- */
.three { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 28px 40px; }
.three > div { display: flex; flex-direction: column; gap: 10px; }
.three h2 { font-size: clamp(30px, 2.8vw, 38px); }

/* ---- start local ---- */
.start { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 1fr); gap: 28px 44px; align-items: start; }
.start > div { display: flex; flex-direction: column; gap: 14px; }
@media (max-width: 820px) { .start { grid-template-columns: minmax(0, 1fr); } }
.terminal {
  margin: 0; padding: 22px 26px;
  white-space: pre-wrap; overflow-wrap: anywhere;   /* the install link wraps rather than hiding off the edge */
  background: var(--ink); color: var(--paper);
  font: 15px/2 var(--mono);
}
.terminal .prompt { color: #8a8a86; user-select: none; }
.terminal .aside { color: #8a8a86; }

/* ---- extend ---- */
.extend { display: flex; flex-direction: column; gap: 16px; }
.extend-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.seams { display: flex; flex-wrap: wrap; gap: 14px; margin: 0; padding: 0; list-style: none; }
.seams a { display: inline-block; padding: 8px 16px; text-decoration: none; }
.seams a.first { border-width: 3px; }
.seams a:hover { background: #f0f0ec; }

/* ---- footer ---- */
.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  margin-top: 24px; padding-block: 18px 40px;
  border-top: 2px solid var(--ink);
}
.foot a { font: 14px var(--mono); color: var(--ink-2); }
