/* ===========================================================
   peck.sg
   Everything derives from the tokens in section 1.
   =========================================================== */

/* 1. TOKENS ------------------------------------------------- */
:root {
  --paper:  #f6f4ef;   /* warm bone — easier on the eye than white */
  --ink:    #141310;
  --muted:  #6f6a60;
  --accent: #1f3fd8;   /* one colour, used sparingly */
  --wash:   #edeae2;   /* hover fill */
  --rule:   #ddd8cd;

  --serif: "Fraunces", Georgia, serif;
  --mono:  "IBM Plex Mono", ui-monospace, Menlo, monospace;

  --gutter: 4.5rem;    /* the number + category column */
}


/* 2. RESET -------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }


/* 3. PAGE --------------------------------------------------- */
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);

  /* opsz is Fraunces' optical-size axis. Low = sturdy text cut.
     High (100+) is the thin display cut — that's what made the
     first draft hard to read. */
  font-variation-settings: "opsz" 20;

  font-size: 1.125rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.masthead, main, footer {
  max-width: 44rem;
  margin: 0 auto;
  padding-inline: clamp(1.5rem, 5vw, 2.5rem);
}


/* 4. WORDMARK ------------------------------------------------ */
.masthead {
  padding-top: clamp(2rem, 5vw, 3rem);

  /* Wordmark, hairline, lab name on one baseline. A lone wordmark on
     a wide page has nothing to sit against — the rule and the second
     label give it something to hold. */
  display: flex;
  align-items: center;
  gap: 0.9rem;
  flex-wrap: wrap;
}

/* The divider is an empty element sized in CSS, not a character —
   so its height and colour are yours to control. */
.masthead .rule {
  width: 1px;
  height: 1.15rem;
  background: var(--rule);
  flex-shrink: 0;
}

.lab-name {
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
}

.wordmark {
  font-size: 1.5rem;
  font-weight: 600;
  font-variation-settings: "opsz" 40, "WONK" 1;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-decoration: none;   /* the logo is not a link visually */
}

.wordmark .dot { color: var(--accent); }
.wordmark .tld { color: var(--muted); font-weight: 400; }


/* 5. HERO ---------------------------------------------------- */
.hero { margin-top: clamp(3.5rem, 11vw, 6rem); }

h1 {
  font-size: clamp(1.95rem, 5.4vw, 3rem);
  font-weight: 500;

  /* WONK bends certain letterforms deliberately off-true — the
     type equivalent of the hand-drawn icons. */
  font-variation-settings: "opsz" 40, "WONK" 1;

  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}

h1 em {
  font-style: italic;
  color: var(--accent);
}

.standfirst {
  font-size: 1.125rem;
  color: var(--muted);
  max-width: 32rem;
  margin: 1.5rem 0 0;
}


/* 6. SECTIONS ------------------------------------------------ */
section + section {
  margin-top: clamp(3.5rem, 9vw, 5.5rem);
  padding-top: clamp(2.5rem, 6vw, 3.5rem);
  border-top: 1px solid var(--rule);
}

/* One icon per section, as a landmark. Repeating icons down every
   row turns them into a column of noise — they work best when
   they're occasional. */
h2 {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  margin: 0 0 0.85rem;
}

.section-intro {
  color: var(--muted);
  font-size: 1rem;
  max-width: 30rem;
  margin: 0 0 2.5rem;
}


/* 7. NOTES ---------------------------------------------------
   Icon, number and category stack in a fixed left gutter. The
   repeated gutter width is the page's structural idea — the
   colophon below reuses it. */
.note-list { list-style: none; margin: 0; padding: 0; }

.note {
  display: grid;
  grid-template-columns: var(--gutter) 1fr;
  gap: 0 1.75rem;

  padding: 1.6rem 1rem;
  margin-inline: -1rem;   /* lets the hover fill bleed past the text */
  border-radius: 3px;
  transition: background-color 0.15s ease;
}

.note:hover { background: var(--wash); }
.note + .note { border-top: 1px solid var(--rule); }

.section-icon {
  width: 19px;
  height: 19px;
  color: var(--accent);
  flex-shrink: 0;
}

.note-meta { display: block; padding-top: 0.4rem; }

.note-id, .note-cat {
  display: block;
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--muted);
  line-height: 1.5;
}

.note-cat {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  opacity: 0.75;
}

.note h3 {
  font-size: 1.375rem;
  font-weight: 600;
  font-variation-settings: "opsz" 24, "WONK" 1;
  line-height: 1.25;
  letter-spacing: -0.015em;
  margin: 0 0 0.35rem;
}

.note p {
  color: var(--muted);
  font-size: 1rem;
  margin: 0;
}


/* 8. LINKS ---------------------------------------------------
   Thick accent underline set well below the baseline. Three
   properties, and it's why links here look deliberate. */
a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 2px;
  text-underline-offset: 0.26em;
  text-decoration-skip-ink: auto;
  transition: text-decoration-thickness 0.12s ease, color 0.12s ease;
}

a:hover { color: var(--accent); text-decoration-thickness: 4px; }

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
  border-radius: 2px;
}


/* 9. COLOPHON ------------------------------------------------ */
.colophon dl {
  display: grid;
  grid-template-columns: var(--gutter) 1fr;   /* same gutter as notes */
  gap: 0.6rem 1.75rem;
  margin: 0;
  font-size: 1rem;
}

.colophon dt {
  font-family: var(--mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  padding-top: 0.3rem;
}

.colophon dd { margin: 0; }


/* 10. FOOTER -------------------------------------------------- */
footer {
  margin-top: clamp(3.5rem, 9vw, 5.5rem);
  padding-block: 2rem 4rem;
  border-top: 1px solid var(--rule);
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

footer p { margin: 0; }


/* 11. SMALL SCREENS ------------------------------------------
    Below 34rem the gutter squeezes the titles, so the meta row
    goes horizontal above the note instead. */
@media (max-width: 34rem) {
  .note { grid-template-columns: 1fr; gap: 0; }

  .note-meta {
    display: flex;
    align-items: baseline;
    gap: 0.7rem;
    margin-bottom: 0.5rem;
    padding-top: 0;
  }

  .colophon dl { grid-template-columns: 1fr; gap: 0; }
  .colophon dt { margin-top: 1.1rem; }
  .colophon dt:first-of-type { margin-top: 0; }
}


/* 12. MOTION -------------------------------------------------- */
body { animation: rise 0.5s ease-out both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(0.5rem); }
  to   { opacity: 1; transform: none; }
}

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


/* ===========================================================
   13. NOTE PAGES
   Used by ln000.html and every note after it.
   =========================================================== */

.backlink {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-decoration: none;
  margin-top: clamp(2rem, 5vw, 3rem);
}

.backlink:hover { color: var(--accent); }

/* The note's own header: number and category above, title below. */
.note-head {
  margin-top: 1.25rem;
  padding-bottom: clamp(1.5rem, 3.5vw, 2rem);
  border-bottom: 1px solid var(--rule);
}

.note-head .meta {
  display: flex;
  gap: 1.25rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0 0 0.7rem;
}

.note-head h1 {
  font-size: clamp(1.75rem, 4.6vw, 2.5rem);
  font-weight: 500;
  font-variation-settings: "opsz" 40, "WONK" 1;
  line-height: 1.18;
  letter-spacing: -0.02em;
  margin: 0;
  text-wrap: balance;
}

/* Body copy. Narrower than the page for comfortable reading. */
.prose {
  margin-top: clamp(1.75rem, 4vw, 2.25rem);
  max-width: 34rem;
  line-height: 1.5;      /* tighter than the 1.6 used elsewhere */
}

.prose p { margin: 0 0 0.9rem; }
.prose p:last-child { margin-bottom: 0; }

/* The contents list. Numbers in the same gutter as the home page —
   repeating one measurement across pages is what makes a site feel
   like one thing. */
.toc { margin-top: clamp(3rem, 7vw, 4rem); }

.toc h2 { margin-bottom: 1.5rem; }

.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc li {
  display: grid;
  grid-template-columns: var(--gutter) 1fr;
  gap: 0 1.75rem;
  padding: 0.9rem 1rem;
  margin-inline: -1rem;
  border-radius: 3px;
  transition: background-color 0.15s ease;
}

.toc li:hover { background: var(--wash); }
.toc li + li { border-top: 1px solid var(--rule); }

.toc .num {
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--muted);
  padding-top: 0.4rem;
}

.toc .title { font-size: 1.125rem; }

.toc .pending {
  color: var(--muted);
  font-style: italic;
}

@media (max-width: 34rem) {
  .toc li { grid-template-columns: 1fr; gap: 0; }
  .toc .num { padding-top: 0; margin-bottom: 0.25rem; }
}

/* The accented dot, reused wherever peck.sg appears as text. */
.note h3 .dot,
.note-head h1 .dot,
.toc .dot { color: var(--accent); }
