/* 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;
}

/* Links are underlined by hand: one drawn stroke (underline.svg, from brand/draw.py), stretched to
   the link's width. clone gives each line of a wrapped link its own stroke. */
a { color: var(--ink); text-decoration: none; padding-bottom: 0.14em; background: url(images/underline.svg) 0 100% / 100% 0.4em no-repeat; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
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, .button, .sk { background-image: none; }
.brand { display: flex; align-items: baseline; gap: 10px; font-size: 34px; font-weight: 900; text-decoration: none; }
/* The word stands on the nib, as in brand/freehand-wordmark.svg. On the baseline an image sits on its
   bottom edge; the nib's tip is a little above that, and the hand writes a little below its line, so
   the mark drops by both. */
.brand img { position: relative; top: 0.1em; }
.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; }

.today { font: 14px/1.6 var(--mono); color: var(--ink-2); max-width: 46ch; }
.today b { color: var(--ink); font-weight: 600; }
.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); } }
/* Real screens from a Supernote, the one place the page shows a screen rather than a drawing. */
.ask-real { grid-column: 1 / -1; margin: 8px 0 0; display: flex; flex-direction: column; gap: 12px; }
.ask-real ol { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 18px; }
.ask-real li { display: flex; flex-direction: column; gap: 10px; }
/* A real Supernote screen inside a drawn device: shell.svg is the frame, with a 3:4 hole the
   screenshot shows through. Its numbers come from brand/draw.py's shell(): 340 by 444, the screen
   at 24,24, 292 wide. */
.shell { position: relative; display: block; aspect-ratio: 340 / 444; }
.shell img { position: absolute; left: 7.06%; top: 5.41%; width: 85.88%; height: 87.69%; }
.shell::after { content: ""; position: absolute; inset: 0; background: url(images/shell.svg) 0 0 / 100% 100% no-repeat; pointer-events: none; }
.ask-real span, .ask-real figcaption { font-family: var(--mono); font-size: 13px; color: var(--ink-2); }
@media (max-width: 820px) { .ask-real ol { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; } }
@media (min-width: 821px) and (max-width: 1100px) { .ask-real ol { grid-template-columns: repeat(3, 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; }

/* ---- 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); }

/* ---- the easter egg ---- */
/* A real photo of Ask Agent at the very end, small and a little crooked, like a snapshot left on the
   desk. In grey like everything else here: e-ink has no colour. */
.nib { display: flex; justify-content: center; padding-block: 8px 40px; }
.nib figure { margin: 0; width: min(240px, 60vw); display: flex; flex-direction: column; gap: 10px; transform: rotate(-3deg); }
.nib img { width: 100%; height: auto; border: 2px solid var(--ink); border-radius: var(--drawn); }
.nib figcaption { font-size: 18px; text-align: center; color: var(--ink-2); }
