/* Keyspace website. Set like a printed programme: paper, ink, one serif, figures with captions. */

@font-face {
  font-family: "Newsreader";
  src: url("/fonts/newsreader-latin-standard-normal.woff2") format("woff2");
  font-weight: 200 800; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Newsreader";
  src: url("/fonts/newsreader-latin-standard-italic.woff2") format("woff2");
  font-weight: 200 800; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Plex Mono";
  src: url("/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  --paper: #efebe3;
  --paper-deep: #e6e0d4;
  --ink: #161513;
  --ink-2: #57524a;
  --ink-3: #8b857b;
  --rule: #cdc6b8;
  --mount: #1b1a18;
  --right: #2f6fe0;   /* right-hand notes in the app */
  --left: #1c9e69;    /* left-hand notes */
  --serif: "Newsreader", ui-serif, "New York", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --mono: "Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --margin: clamp(16px, 3vw, 40px);
  --gap: clamp(16px, 2vw, 28px);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 17px/1.55 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: clip;
}
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
p { margin: 0; text-wrap: pretty; }
h1, h2, h3 { margin: 0; font-family: var(--serif); font-weight: 400; text-wrap: balance; }
::selection { background: var(--ink); color: var(--paper); }

.wrap { padding: 0 var(--margin); max-width: 1600px; margin: 0 auto; }
.grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); }
.mono { font-family: var(--mono); font-size: 12px; letter-spacing: 0.01em; line-height: 1.5; }
.muted { color: var(--ink-2); }
.rule { border-top: 1px solid var(--rule); }

/* Header */
.top { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border-bottom: 1px solid var(--rule); }
.top .grid { height: 58px; align-items: center; }
.wordmark { grid-column: 1 / 4; font-family: var(--serif); font-size: 23px; letter-spacing: -0.01em; text-decoration: none; }
.top nav { grid-column: 5 / 9; font-size: 14px; color: var(--ink-2); }
.top nav a { text-decoration: none; }
.top nav a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.top .meta { grid-column: 10 / 13; justify-self: end; color: var(--ink-2); }

/* Buttons: plain ink rectangles */
.btn {
  display: inline-flex; align-items: center; gap: 14px; height: 48px; padding: 0 20px;
  background: var(--ink); color: var(--paper); text-decoration: none; font-size: 15px; font-weight: 500;
  transition: background 0.15s ease;
}
.btn:hover { background: #000; }
.btn .arrow { font-family: var(--serif); font-size: 20px; line-height: 1; transition: transform 0.15s ease; }
.btn:hover .arrow { transform: translateX(3px); }
.link { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.link:hover { text-decoration-thickness: 2px; }

/* Hero */
.hero { padding-top: clamp(48px, 8vw, 120px); }
.hero h1 { font-size: clamp(54px, 10.2vw, 168px); line-height: 0.9; letter-spacing: -0.03em; max-width: 13ch; font-variation-settings: "opsz" 72; }
.hero h1 em { font-style: italic; color: var(--ink-2); }
.hero-row { margin-top: clamp(40px, 5vw, 72px); padding-top: 18px; row-gap: 24px; }
.hero-row .label { grid-column: 1 / 4; }
.hero-row .lede { grid-column: 4 / 9; font-size: clamp(18px, 1.6vw, 22px); line-height: 1.45; max-width: 34ch; }
.hero-row .act { grid-column: 9 / 13; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }

figure { margin: 0; }
.plate { margin-top: clamp(40px, 5vw, 72px); }
.plate img { width: 100%; }
figcaption { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); padding-top: 12px; font-size: 14px; color: var(--ink-2); }
figcaption .mono { grid-column: 1 / 3; color: var(--ink); }
figcaption span:last-child { grid-column: 3 / 10; }

/* Sections */
.section { padding-top: clamp(96px, 12vw, 180px); }
.head { padding-top: 16px; row-gap: 20px; }
.head .mono { grid-column: 1 / 4; }
.head h2 { grid-column: 4 / 13; font-size: clamp(34px, 4.6vw, 72px); line-height: 1.02; letter-spacing: -0.02em; }
.head h2 em { font-style: italic; }

/* Method: the four stages of help */
.stages { margin-top: clamp(48px, 6vw, 88px); border-top: 1px solid var(--ink); }
.stage { grid-column: span 3; display: flex; flex-direction: column; padding: 20px 0 0 20px; border-left: 1px solid var(--rule); }
.stage:first-child { border-left: 0; padding-left: 0; }
.stage .num { font-family: var(--serif); font-style: italic; font-size: 22px; color: var(--ink-3); }
.stage h3 { font-size: 28px; letter-spacing: -0.01em; margin-top: 4px; }
.stage p { flex: 1; margin-top: 10px; color: var(--ink-2); font-size: 15px; max-width: 32ch; }

/* The little diagram: one octave of keys and the note above it */
.diagram { position: relative; height: 170px; margin-top: 22px; background: var(--paper-deep); overflow: hidden; }
.keys { position: absolute; left: 12%; right: 12%; bottom: 0; height: 58px; display: flex; gap: 2px; }
.keys i { flex: 1; background: #fbfaf7; border-radius: 0 0 3px 3px; box-shadow: inset 0 -1px 0 var(--rule); }
.keys i.on { background: color-mix(in srgb, var(--right) 22%, #fbfaf7); }
.keys b { position: absolute; top: 0; width: 8%; height: 58%; background: var(--ink); border-radius: 0 0 2px 2px; }
.note { position: absolute; left: calc(12% + (76% / 7) * 2 + 1px); width: calc(76% / 7 - 3px); border-radius: 999px; background: var(--right); }
.note .tag { position: absolute; left: 50%; bottom: 8px; transform: translateX(-50%); color: #fff; font: 600 11px/1 var(--sans); text-align: center; }
.staff { position: absolute; left: 12%; right: 12%; top: 26px; height: 33px;
  background: repeating-linear-gradient(to bottom, var(--ink-3) 0 1px, transparent 1px 8px); opacity: 0.55; }
.staff::after { content: ""; position: absolute; left: 30%; top: 12px; width: 10px; height: 8px; border-radius: 50%; background: var(--ink); transform: rotate(-20deg); }

.path { margin-top: 36px; padding-top: 14px; color: var(--ink-2); }
.path .mono { grid-column: 1 / 4; color: var(--ink); }
.path p { grid-column: 4 / 13; font-size: 15px; }

/* Figures of the app windows, mounted like prints */
.figures { margin-top: clamp(48px, 6vw, 88px); row-gap: clamp(56px, 7vw, 110px); }
.mount { background: var(--mount); padding: clamp(20px, 4.5%, 64px); }
.mount img { border-radius: 3.3% / 5%; }
.fig-wide { grid-column: 1 / 9; }
.fig-side { grid-column: 9 / 13; align-self: end; }
.fig-side h3, .fig-note h3 { font-size: clamp(24px, 2.2vw, 32px); line-height: 1.1; letter-spacing: -0.01em; }
.fig-side p, .fig-note p { margin-top: 12px; color: var(--ink-2); font-size: 15px; max-width: 36ch; }
.fig-side .mono, .fig-note .mono { display: block; margin-bottom: 12px; }
.fig-wide.right { grid-column: 5 / 13; grid-row: 2; }
.fig-side.left { grid-column: 1 / 5; grid-row: 2; }
.fig-half { grid-column: span 6; }
.fig-note { margin-top: 18px; }

/* Repertoire index */
.index { margin-top: clamp(48px, 6vw, 88px); border-top: 1px solid var(--ink); }
.row { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); align-items: baseline; padding: 14px 0 13px; border-bottom: 1px solid var(--rule); }
.row:hover { background: var(--paper-deep); }
.row .n { grid-column: 1 / 2; font-family: var(--mono); font-size: 12px; color: var(--ink-3); padding-left: 2px; }
.row .t { grid-column: 2 / 8; font-family: var(--serif); font-size: clamp(19px, 1.7vw, 24px); line-height: 1.2; }
.row .c { grid-column: 8 / 11; font-size: 15px; color: var(--ink-2); }
.row .l { grid-column: 11 / 13; justify-self: end; font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.row.more .t { font-style: italic; color: var(--ink-2); }
.facts { margin-top: 28px; row-gap: 20px; }
.facts div { grid-column: span 3; border-top: 1px solid var(--rule); padding-top: 12px; }
.facts strong { display: block; font-family: var(--serif); font-weight: 400; font-size: 44px; line-height: 1; letter-spacing: -0.02em; }
.facts span { display: block; margin-top: 8px; font-size: 14px; color: var(--ink-2); }

/* Full-bleed photograph */
.bleed { margin-top: clamp(96px, 12vw, 180px); }
.bleed img { width: 100%; height: clamp(360px, 48vw, 760px); object-fit: cover; object-position: 18% 50%; }
.bleed figcaption { padding: 12px var(--margin) 0; max-width: 1600px; margin: 0 auto; }

/* Research: an essay with footnotes */
.essay { margin-top: clamp(40px, 5vw, 72px); row-gap: 40px; }
.essay .text { grid-column: 4 / 10; font-family: var(--serif); font-size: clamp(22px, 2vw, 28px); line-height: 1.42; font-variation-settings: "opsz" 24; }
.essay .text p + p { margin-top: 0.8em; }
.essay sup { font-family: var(--mono); font-size: 0.42em; vertical-align: super; color: var(--right); padding-left: 1px; }
.refs { grid-column: 10 / 13; margin: 0; padding: 0; list-style: none; counter-reset: ref; }
.refs li { counter-increment: ref; display: grid; grid-template-columns: 22px minmax(0, 1fr); padding: 10px 0; border-top: 1px solid var(--rule); font-size: 12.5px; line-height: 1.45; color: var(--ink-2); }
.refs li::before { content: counter(ref); font-family: var(--mono); color: var(--right); }
.refs li:last-child { border-bottom: 1px solid var(--rule); }

/* Price */
.price { padding-top: clamp(96px, 12vw, 180px); }
.price h2 { font-size: clamp(48px, 8.4vw, 136px); line-height: 0.95; letter-spacing: -0.03em; max-width: 16ch; padding-top: 16px; font-variation-settings: "opsz" 72; }
.price h2 em { font-style: italic; }
.terms { margin-top: 44px; padding-top: 16px; row-gap: 24px; }
.terms p { grid-column: span 3; font-size: 15px; color: var(--ink-2); max-width: 30ch; }
.terms .act { grid-column: 10 / 13; display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }

/* Questions */
.qa { margin-top: clamp(40px, 5vw, 72px); border-top: 1px solid var(--ink); }
.q { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); padding: 22px 0 24px; border-bottom: 1px solid var(--rule); }
.q h3 { grid-column: 1 / 6; font-size: clamp(21px, 1.8vw, 26px); line-height: 1.2; letter-spacing: -0.01em; }
.q p { grid-column: 6 / 12; color: var(--ink-2); font-size: 16px; }
.q a { color: var(--ink); }

/* Footer: the name, very large */
footer { margin-top: clamp(110px, 14vw, 200px); border-top: 1px solid var(--ink); }
.foot { padding-top: 16px; row-gap: 14px; font-size: 14px; }
.foot .col { grid-column: span 3; display: flex; flex-direction: column; gap: 4px; }
.foot a { text-decoration: none; color: var(--ink-2); }
.foot a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.giant { font-family: var(--serif); font-weight: 400; font-size: min(23vw, 370px); line-height: 1; letter-spacing: -0.045em; margin: clamp(8px, 2vw, 32px) 0 0 -0.04em; white-space: nowrap; font-variation-settings: "opsz" 72; }
.fine { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 14px 0 26px; border-top: 1px solid var(--rule); color: var(--ink-3); }

/* Text pages: privacy, terms, support */
.page { padding-top: clamp(48px, 7vw, 104px); }
.page h1 { grid-column: 1 / 11; font-size: clamp(48px, 7.4vw, 120px); line-height: 0.95; letter-spacing: -0.03em; font-variation-settings: "opsz" 72; }
.page .intro { margin-top: 36px; padding-top: 16px; row-gap: 16px; }
.page .intro .mono { grid-column: 1 / 4; }
.page .intro p { grid-column: 4 / 10; font-size: clamp(18px, 1.5vw, 21px); line-height: 1.45; }
.page .intro p.mono { grid-column: 1 / 4; font-size: 12px; line-height: 1.5; }
.doc { margin-top: clamp(48px, 6vw, 88px); }
.doc .toc { grid-column: 1 / 4; align-self: start; position: sticky; top: 90px; }
.doc .toc a { display: block; padding: 6px 0; border-top: 1px solid var(--rule); text-decoration: none; color: var(--ink-2); font-size: 14px; }
.doc .toc a:hover { color: var(--ink); }
.doc article { grid-column: 4 / 11; }
.doc h2 { font-size: clamp(26px, 2.4vw, 34px); letter-spacing: -0.01em; line-height: 1.1; margin: 64px 0 14px; padding-top: 14px; border-top: 1px solid var(--ink); }
.doc article > h2:first-child { margin-top: 0; }
.doc h3 { font-size: 22px; margin: 32px 0 8px; letter-spacing: -0.005em; }
.doc p, .doc li { color: var(--ink-2); font-size: 16.5px; }
.doc p + p { margin-top: 12px; }
.doc ul { padding-left: 20px; margin: 12px 0; display: grid; gap: 10px; }
.doc strong { color: var(--ink); font-weight: 600; }
.doc a { color: var(--ink); }
.callout { margin-bottom: 56px; padding: 22px 24px; background: var(--paper-deep); }
.callout h2 { margin: 0 0 10px; padding: 0; border: 0; font-size: 22px; }
.callout ul { margin: 0; }

@media (max-width: 1000px) {
  .top nav { display: none; }
  .top .meta { grid-column: 6 / 13; }
  .hero-row .label { grid-column: 1 / -1; }
  .hero-row .lede { grid-column: 1 / 9; }
  .hero-row .act { grid-column: 1 / -1; }
  figcaption .mono { grid-column: 1 / 4; }
  figcaption span:last-child { grid-column: 4 / 13; }
  .head .mono, .head h2 { grid-column: 1 / -1; }
  .stage { grid-column: span 6; margin-bottom: 36px; }
  .stage:nth-child(3) { border-left: 0; padding-left: 0; }
  .path .mono, .path p { grid-column: 1 / -1; }
  .fig-wide, .fig-wide.right, .fig-side, .fig-side.left, .fig-half { grid-column: 1 / -1; grid-row: auto; }
  .row .t { grid-column: 2 / 9; }
  .row .c { grid-column: 9 / 13; justify-self: end; text-align: right; }
  .row .l { display: none; }
  .facts div { grid-column: span 6; }
  .essay .text, .refs { grid-column: 1 / -1; }
  .terms p { grid-column: span 6; }
  .terms .act { grid-column: 1 / -1; }
  .q h3, .q p { grid-column: 1 / -1; }
  .q p { margin-top: 8px; }
  .foot .col { grid-column: span 6; }
  .page .intro .mono, .page .intro p, .page h1 { grid-column: 1 / -1; }
  .doc .toc { display: none; }
  .doc article { grid-column: 1 / -1; }
}

@media (max-width: 600px) {
  body { font-size: 16px; }
  .top .meta { display: none; }
  .hero-row .lede { grid-column: 1 / -1; }
  .stage { grid-column: 1 / -1; border-left: 0; padding-left: 0; }
  figcaption .mono, figcaption span:last-child { grid-column: 1 / -1; }
  .row .c { display: none; }
  .row .n { grid-column: 1 / 3; }
  .row .t { grid-column: 3 / 13; }
  .terms p { grid-column: 1 / -1; }
  .foot .col { grid-column: 1 / -1; }
}
