/* site/styles.css
 *
 * One stylesheet, no fonts to download, no scripts, no images. Everything that
 * looks like a picture on this site is drawn here out of boxes and one inline
 * SVG path, and every one of them is captioned as a drawing.
 *
 * Chosen so the page is readable on a phone on hospital wifi: system fonts, a
 * single accent colour, prose at a measure narrow enough to read, and figures
 * that fold into one column when there is no room for two.
 */

:root {
  --ink: #1b1a17;
  --ink-soft: #4b4842;
  --paper: #fbf9f5;
  --paper-edge: #f4f0e8;
  --card: #ffffff;
  --rule: #ddd6c8;
  --rule-soft: #e8e2d6;
  --accent: #8a4b1f;
  --accent-soft: #f3e3d5;
  --accent-line: #c98a55;
  --measure: 34rem;
  --shell: 64rem;
  --serif: ui-serif, Georgia, "Iowan Old Style", "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 0.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #ece7de;
    --ink-soft: #b6afa3;
    --paper: #171614;
    --paper-edge: #1e1c19;
    --card: #232019;
    --rule: #3b3833;
    --rule-soft: #302d28;
    --accent: #e2a173;
    --accent-soft: #3a2a1d;
    --accent-line: #9a663c;
  }
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.0625rem;
  line-height: 1.6;
}

/* ── Skeleton ───────────────────────────────────────────────────────────── */

main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
}

main.shell {
  max-width: var(--shell);
  padding: 0 1.25rem 0;
}

/* Inside the wide shell, prose still reads at a narrow measure. */
.shell .wrap {
  max-width: var(--measure);
}

.shell > section {
  padding: 3.25rem 0;
  border-top: 1px solid var(--rule-soft);
}

.shell > section:first-child {
  border-top: 0;
}

/* The tinted bands are what stop the page reading as one column of prose.
 * They run edge to edge, so they are drawn with a box-shadow spread rather
 * than a width the shell would have to give up. */
.shell > section.band {
  background: var(--paper-edge);
  box-shadow: 0 0 0 100vmax var(--paper-edge);
  clip-path: inset(0 -100vmax);
  border-top-color: transparent;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--paper);
  padding: 0.6rem 1rem;
  border-radius: 0 0 var(--radius) 0;
  text-decoration: none;
  z-index: 5;
}

.skip:focus {
  left: 0;
}

/* ── The bars at the top and bottom ─────────────────────────────────────── */

.bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  align-items: baseline;
  justify-content: space-between;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 1.25rem;
}

header.bar {
  border-bottom: 1px solid var(--rule-soft);
}

footer.bar {
  border-top: 1px solid var(--rule);
  margin-top: 0;
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

footer.bar p {
  margin: 0;
}

.bar nav {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem 1.25rem;
}

.wordmark {
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  color: var(--ink);
  font-size: 1.0625rem;
}

.nav-cta {
  font-family: var(--sans);
  font-size: 0.9375rem;
  border: 1px solid var(--accent);
  border-radius: 0.35rem;
  padding: 0.3rem 0.7rem;
  text-decoration: none;
}

.nav-cta:hover {
  background: var(--accent-soft);
}

/* ── Type ───────────────────────────────────────────────────────────────── */

h1,
h2,
h3 {
  line-height: 1.2;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 6.4vw, 3.1rem);
  margin: 0 0 1rem;
  letter-spacing: -0.02em;
}

h2 {
  font-size: clamp(1.4rem, 4.2vw, 1.85rem);
  margin: 0 0 0.9rem;
  letter-spacing: -0.012em;
}

h3 {
  font-family: var(--sans);
  font-size: 1rem;
  letter-spacing: 0.005em;
  margin: 0 0 0.35rem;
}

p {
  margin: 0 0 1rem;
}

.eyebrow {
  font-family: var(--sans);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 0.6rem;
}

.lead {
  font-size: clamp(1.1rem, 2.6vw, 1.3rem);
  color: var(--ink);
  max-width: 30rem;
}

.under-cta,
.note {
  color: var(--ink-soft);
  font-size: 0.9375rem;
  max-width: var(--measure);
}

a {
  color: var(--accent);
  text-underline-offset: 0.15em;
}

a:focus-visible,
.cta:focus-visible,
.skip:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ── The hero ───────────────────────────────────────────────────────────── */

.shell > section.hero {
  padding: 3.5rem 0 3rem;
}

.hero-copy {
  max-width: 38rem;
}

.hero .figure {
  margin-top: 2.5rem;
}

.closer {
  text-align: left;
}

.closer .actions {
  margin-top: 1.25rem;
}

/* ── The one button shape ───────────────────────────────────────────────── */

.actions {
  margin: 1.75rem 0 0.75rem;
}

.cta {
  display: inline-block;
  background: var(--accent);
  color: var(--paper);
  text-decoration: none;
  font-family: var(--sans);
  font-size: 1.0625rem;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: 0.4rem;
}

.cta.small {
  font-size: 0.9375rem;
  padding: 0.5rem 1rem;
}

.cta:hover {
  filter: brightness(1.12);
}

/* ── Steps, ways, formats ───────────────────────────────────────────────── */

.steps,
.ways {
  list-style: none;
  padding: 0;
  margin: 1.75rem 0 0;
  display: grid;
  gap: 1.25rem;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
}

.steps {
  counter-reset: step;
}

.steps > li {
  counter-increment: step;
  border-top: 2px solid var(--accent-line);
  padding-top: 0.9rem;
}

.steps > li::before {
  content: counter(step);
  display: block;
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 0.4rem;
}

.ways > li {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 1.1rem 1.15rem 0.4rem;
}

.steps p,
.ways p {
  font-size: 0.9375rem;
  color: var(--ink-soft);
}

.ways > li p:last-child {
  margin-bottom: 1rem;
}

.formats {
  margin-top: 1.75rem;
  font-size: 0.9375rem;
  color: var(--ink-soft);
}

.fmt {
  display: inline-block;
  font-family: var(--sans);
  font-size: 0.8125rem;
  letter-spacing: 0.03em;
  border: 1px solid var(--rule);
  border-radius: 0.3rem;
  padding: 0.2rem 0.55rem;
  margin-right: 0.4rem;
  color: var(--ink);
}

.formats-note {
  white-space: nowrap;
}

/* ── Pricing page lists (kept: pricing.html uses them) ──────────────────── */

.amounts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  list-style: none;
  padding: 0;
  margin: 1.25rem 0;
}

.amounts li {
  border: 1px solid var(--rule);
  background: var(--paper-edge);
  border-radius: 0.4rem;
  padding: 0.5rem 1rem;
  font-variant-numeric: tabular-nums;
}

.trades,
.plain {
  padding-left: 1.15rem;
  margin: 1rem 0;
}

.trades li,
.plain li {
  margin-bottom: 0.85rem;
}

/* The pricing page is one column of prose, but it shares the site's left
 * rail: the shell keeps the text under the wordmark instead of centring it
 * away from the header. */
main.reading {
  max-width: var(--shell);
  padding-bottom: 1rem;
}

main.reading > section {
  max-width: var(--measure);
  padding: 2.5rem 0;
  border-top: 1px solid var(--rule-soft);
}

main.reading > section.hero {
  padding-top: 3.25rem;
  border-top: 0;
}

main.reading h2 {
  margin-top: 0;
}

main.reading h3 {
  margin-top: 2rem;
  font-size: 1.0625rem;
  font-family: var(--serif);
  font-weight: 700;
}

/* ── Figures ────────────────────────────────────────────────────────────── */

.figure {
  margin: 2rem 0 0;
  max-width: 42rem;
}

.figure.wide {
  max-width: none;
}

/* The licence URI travels with the quoted text. It is written out rather than
 * linked because tests/site/robots.test.ts requires every absolute URL on the
 * site to name the site's own host or the reader's — an off-site href would
 * escape the rename this repository's leetnote.in token exists for. A URI
 * in plain sight satisfies CC BY 4.0 §3(a)(1)(D) and stays copyable. */
.uri {
  overflow-wrap: anywhere;
}

/* Captions are set in the sans face, small: they are labels on a drawing, and
 * a reader scanning the page should not mistake one for another paragraph. */
figcaption {
  font-family: var(--sans);
  color: var(--ink-soft);
  font-size: 0.8125rem;
  line-height: 1.5;
  margin-top: 0.75rem;
  max-width: 36rem;
}

figcaption cite {
  font-style: italic;
}

/* The shell the drawings sit in: one card, one border, never a chrome that
 * could be mistaken for a window of the real application. */
.ui {
  background: var(--card);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font-family: var(--sans);
  overflow: hidden;
}

/* Real paper, set as a paper sets it: serif, justified, small. */
.pg-h {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 0.875rem;
  margin: 0 0 0.5rem;
  color: var(--ink);
}

.pg-t {
  font-family: var(--serif);
  font-size: 0.8125rem;
  line-height: 1.5;
  text-align: justify;
  hyphens: auto;
  margin: 0 0 0.55rem;
  color: var(--ink);
}

.pg-t:last-child {
  margin-bottom: 0;
}

/* The selection. `mark` defaults to a yellow nobody chose. */
mark.sel {
  background: var(--accent-soft);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--accent-soft);
  border-bottom: 2px solid var(--accent);
}

/* Corner brackets: the affordance on a detected figure, table or equation. */
.cnr {
  position: absolute;
  width: 0.5rem;
  height: 0.5rem;
  border: 2px solid var(--accent);
}

.cnr.tl { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.cnr.tr { top: -1px; right: -1px; border-left: 0; border-bottom: 0; }
.cnr.bl { bottom: -1px; left: -1px; border-right: 0; border-top: 0; }
.cnr.br { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

/* ── Drawing 1: the reader ──────────────────────────────────────────────── */

.ui-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid var(--rule-soft);
  background: var(--paper-edge);
  font-size: 0.75rem;
  color: var(--ink-soft);
}

.ui-back {
  color: var(--accent);
}

.ui-tool {
  border: 1px solid var(--rule);
  border-radius: 0.3rem;
  padding: 0.15rem 0.5rem;
}

.ui-zoom {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.ui-step,
.ui-fit {
  border: 1px solid var(--rule);
  border-radius: 0.25rem;
  padding: 0.05rem 0.4rem;
  line-height: 1.5;
}

.ui-pct {
  border-bottom: 1px solid var(--accent-line);
  padding: 0 0.2rem;
  font-variant-numeric: tabular-nums;
}

.ui-body {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 1rem;
  padding: 0.9rem;
  align-items: start;
}

.ui-paper {
  grid-column: 1;
  grid-row: 1;
}

.pg {
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  border-radius: 0.25rem;
  padding: 0.9rem 0.95rem;
}

/* The dashed tie from the selected sentence to the pinned quote. It is laid
 * into the grid gap on purpose — same row, same column as the page, pushed
 * out by exactly the gap — so it cannot drift as the columns resize. */
.ui-tie {
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
  align-self: start;
  width: 1.9rem;
  height: 5rem;
  margin: 4.6rem -1.45rem 0 0;
  color: var(--accent-line);
  pointer-events: none;
}

.ui-tie svg {
  width: 100%;
  height: 100%;
  display: block;
}

.ui-thread {
  grid-column: 2;
  grid-row: 1;
  border-left: 2px solid var(--accent);
  padding-left: 0.75rem;
  min-width: 0;
}

.ui-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.6rem;
}

.pill,
.tog {
  font-size: 0.6875rem;
  border: 1px solid var(--rule);
  border-radius: 0.9rem;
  color: var(--ink-soft);
  background: var(--paper);
  white-space: nowrap;
}

.pill {
  padding: 0.12rem 0.5rem;
}

.tog {
  display: inline-flex;
  padding: 0.1rem;
  gap: 0.1rem;
}

.tog span {
  padding: 0.02rem 0.4rem;
  border-radius: 0.8rem;
}

.tog .on {
  background: var(--accent);
  color: var(--paper);
}

.ui-quote {
  font-family: var(--serif);
  font-size: 0.8125rem;
  line-height: 1.4;
  background: var(--accent-soft);
  border-radius: 0.3rem;
  padding: 0.4rem 0.5rem;
  margin: 0 0 0.5rem;
  color: var(--ink);
}

.ui-ask {
  font-size: 0.75rem;
  margin: 0 0 0.5rem;
  background: var(--paper-edge);
  border: 1px solid var(--rule-soft);
  border-radius: 0.3rem;
  padding: 0.3rem 0.45rem;
  color: var(--ink);
}

/* Where the answer lands, and the reason the drawing exists: the answer sits
 * beside the sentence, not in another window. The text in it is the product's
 * own output, pasted back unedited — see the ANSWER SLOT comment in
 * site/index.html before touching a word of it. The block is sized for the 60
 * to 90 words a brief answer at selection scope runs to, so replacing the
 * text does not reflow the section around it. */
.ui-answer {
  font-family: var(--serif);
  font-size: 0.8125rem;
  line-height: 1.55;
  color: var(--ink);
  margin: 0 0 0.7rem;
  padding: 0.15rem 0.1rem 0;
  min-height: 8.5rem;
}

.ui-answer.is-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: var(--sans);
  font-size: 0.75rem;
  font-style: italic;
  color: var(--ink-soft);
  border: 1px dashed var(--rule);
  border-radius: 0.3rem;
  padding: 0.5rem 0.9rem;
  background: var(--paper);
}

.ui-composer {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  border-top: 1px solid var(--rule-soft);
  padding-top: 0.55rem;
}

.ui-field {
  flex: 1 1 auto;
  min-width: 0;
  border: 1px solid var(--rule);
  border-radius: 0.3rem;
  padding: 0.28rem 0.45rem;
  font-size: 0.75rem;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ui-send {
  background: var(--accent);
  color: var(--paper);
  border-radius: 0.3rem;
  padding: 0.28rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ── Drawing 2: the equation and its rubble ─────────────────────────────── */

.ui-eq {
  padding: 1.1rem 1rem 0.9rem;
}

.eq-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.85rem;
}

.eq-block {
  position: relative;
  flex: 1 1 14rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: var(--paper);
  padding: 0.85rem 0.9rem;
  border-radius: 0.2rem;
}

/* The equation, set by hand out of boxes: a fraction stacked, a sum with its
 * limits above and below it. Which is exactly the arrangement a PDF's text
 * layer throws away — the point the drawing underneath it is making. */
.eq-math {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-family: var(--serif);
  font-size: 1.0625rem;
  color: var(--ink);
  line-height: 1;
}

.eq-var {
  font-style: italic;
  font-size: 1.2rem;
}

.eq-sub {
  align-self: flex-end;
  font-size: 0.6875rem;
  font-style: italic;
  margin: 0 0.1rem 0.1rem -0.25rem;
}

.eq-rel,
.eq-rest {
  font-style: italic;
}

.frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.9375rem;
  font-style: italic;
}

.frac .num {
  border-bottom: 1px solid currentColor;
  padding: 0 0.2rem 0.05rem;
}

.frac .den {
  padding: 0.05rem 0.2rem 0;
}

.bigop {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.bigop .op {
  font-size: 1.5rem;
}

.bigop .lim {
  font-size: 0.625rem;
  font-style: italic;
}

.intg {
  font-size: 1.6rem;
  font-style: italic;
}

.eq-no {
  font-family: var(--serif);
  color: var(--ink-soft);
  font-size: 0.9375rem;
}

.eq-btn {
  background: var(--accent);
  color: var(--paper);
  border-radius: 0.3rem;
  padding: 0.35rem 0.7rem;
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}

.eq-bottom {
  margin-top: 1rem;
  border-top: 1px dashed var(--rule);
  padding-top: 0.8rem;
}

.eq-label {
  display: block;
  font-size: 0.6875rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.35rem;
}

.eq-rubble {
  display: block;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.875rem;
  color: var(--ink-soft);
  word-spacing: 0.25em;
  overflow-wrap: anywhere;
}

/* ── Drawing 3: one thread, two sittings ────────────────────────────────── */

.ui-days {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem;
  background: var(--card);
}

.day {
  flex: 1 1 0;
  min-width: 0;
}

.day-lab {
  display: block;
  font-size: 0.6875rem;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  margin-bottom: 0.45rem;
}

/* Too narrow a column to justify: it would hyphenate the quoted sentence into
 * rivers. Left-ranged here, justified only in the page card above. */
.mini .pg-t {
  text-align: left;
  hyphens: manual;
}

.mini {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  background: var(--paper);
  border: 1px solid var(--rule-soft);
  border-radius: 0.3rem;
  padding: 0.7rem 0.65rem;
}

.dot {
  align-self: flex-start;
  margin-top: 0.2rem;
  font-size: 0.6875rem;
  background: var(--accent-soft);
  color: var(--ink);
  border-left: 2px solid var(--accent);
  border-radius: 0 0.25rem 0.25rem 0;
  padding: 0.1rem 0.45rem;
}

.day-arrow {
  color: var(--accent);
  font-size: 1.1rem;
  flex: 0 0 auto;
}

/* ── Narrow ─────────────────────────────────────────────────────────────── */

@media (max-width: 46rem) {
  .ui-body {
    grid-template-columns: 1fr;
    gap: 0.85rem;
  }

  .ui-paper,
  .ui-thread {
    grid-column: 1;
  }

  .ui-paper { grid-row: 1; }
  .ui-thread { grid-row: 2; }

  /* The tie is a drawing of a sideways relationship; stacked, it would point
   * at nothing, so it goes rather than lies. */
  .ui-tie {
    display: none;
  }

  .ui-thread {
    border-left: 0;
    border-top: 2px solid var(--accent);
    padding-left: 0;
    padding-top: 0.75rem;
  }
}

@media (max-width: 34rem) {
  .shell > section {
    padding: 2.5rem 0;
  }

  .shell > section.hero {
    padding: 2.5rem 0 2.25rem;
  }

  .pg-t {
    text-align: left;
  }

  .ui-days {
    flex-direction: column;
    align-items: stretch;
  }

  .day-arrow {
    transform: rotate(90deg);
    align-self: center;
  }

  .eq-block {
    flex-wrap: wrap;
  }

  .cta {
    display: block;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}
