/* leafspellingdictionary.space
 *
 * Palette taken from the leaf itself rather than from a UI kit: the ground is
 * the glaucous bloom that sits on a cabbage or a eucalyptus leaf, the text is
 * chlorophyll rather than black, the correct spelling is anthocyanin, the
 * pigment that reddens a leaf underside, and the heard spelling is carotenoid.
 * Those last two colours mean one thing each and never swap.
 *
 * The structural device is a midrib: a hairline with veins branching off it at
 * an angle, drawn in CSS, carrying whatever the page branches into. Categories
 * on the home page, words on a category page, spellings on a word page.
 */

:root {
  --paper: #edefe6;
  --panel: #f6f7f0;
  --band: #e5e9dc;
  --ink: #1d2a21;
  --ink-2: #55635a;
  --rule: #c6cebd;
  --bloom: #93a692;
  --plum: #5b2033;
  --amber: #8a5a0c;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
    Constantia, Georgia, serif;
  --sans: Optima, "Gill Sans MT", "Gill Sans", "Trebuchet MS", "Segoe UI",
    system-ui, sans-serif;
  --mono: "Cascadia Mono", Consolas, "SF Mono", Menlo, "DejaVu Sans Mono",
    ui-monospace, monospace;

  --gutter: clamp(1.15rem, 4vw, 3rem);
  --rail-w: 14rem;
  --step: clamp(2.6rem, 6vw, 4.5rem);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #151a15;
    --panel: #1b211b;
    --band: #1a201a;
    --ink: #dfe5d8;
    --ink-2: #97a496;
    --rule: #313a30;
    --bloom: #5f7060;
    --plum: #e3a3b2;
    --amber: #d5a349;
  }
}

*, *::before, *::after { 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.02rem;
  line-height: 1.62;
  text-rendering: optimizeLegibility;
}

.wrap {
  max-width: 72rem;
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

a {
  color: var(--plum);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, var(--plum) 35%, transparent);
}

a:hover { text-decoration-color: currentColor; }

a:focus-visible {
  outline: 2px solid var(--plum);
  outline-offset: 3px;
  border-radius: 1px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--panel);
  color: var(--ink);
  padding: 0.7rem 1.1rem;
  font-family: var(--sans);
  z-index: 5;
}

.skip:focus { left: 0.6rem; top: 0.6rem; }

/* ----------------------------------------------------------------- masthead */

.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--panel);
}

.masthead-in {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem 1.5rem;
  padding-top: 1.05rem;
  padding-bottom: 1rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover span {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
}

.blade { color: var(--plum); flex: none; }

.nav { display: flex; gap: 1.6rem; }

.nav a, .foot-nav a {
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--ink-2);
  text-decoration: none;
}

.nav a:hover, .foot-nav a:hover {
  color: var(--plum);
  text-decoration: underline;
  text-underline-offset: 0.35em;
}

/* -------------------------------------------------------------- page layout */

main { display: block; padding-bottom: 1rem; }

.sheet {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.4rem 0;
  padding-top: var(--step);
  padding-bottom: calc(var(--step) * 0.34);
}

.sheet.band {
  background: var(--band);
  border-top: 1px solid var(--rule);
  margin-top: calc(var(--step) * 0.5);
  padding-bottom: var(--step);
}

main > .sheet:last-child { padding-bottom: var(--step); }

@media (min-width: 60rem) {
  .sheet {
    grid-template-columns: var(--rail-w) minmax(0, 42rem);
    column-gap: 3.5rem;
    align-items: start;
  }
}

/* The sound-class note is a margin annotation on a wide screen and a footnote
   on a narrow one, so below the breakpoint it moves under the entry. */
@media (max-width: 59.99rem) {
  .sheet.note-after { display: flex; flex-direction: column; }
  .sheet.note-after .body { order: 1; }
  .sheet.note-after .rail { order: 2; }
}

.rail { min-width: 0; }
.body { min-width: 0; }

.eyebrow {
  margin: 0 0 0.2rem;
  font-family: var(--sans);
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-2);
  line-height: 1.7;
}

.eyebrow a { color: var(--ink-2); text-decoration-color: var(--rule); }
.eyebrow a:hover { color: var(--plum); }

.dot { color: var(--rule); padding: 0 0.45rem; }

/* ------------------------------------------------------------------ heading */

h1, h2, h3 { font-family: var(--serif); font-weight: 400; }

h1 {
  margin: 0 0 0.9rem;
  font-size: clamp(1.85rem, 4.4vw, 2.7rem);
  line-height: 1.14;
  letter-spacing: -0.012em;
}

h1.word {
  font-size: clamp(2.9rem, 9vw, 4.6rem);
  line-height: 0.94;
  letter-spacing: -0.028em;
  color: var(--plum);
  margin-bottom: 0;
}

h1.ask { color: var(--ink); max-width: 24ch; }

.hero-h {
  margin: 0.5rem 0 2.2rem;
  font-size: clamp(2.1rem, 5.4vw, 3.5rem);
  line-height: 1.06;
  letter-spacing: -0.024em;
  max-width: 17ch;
}

h2 {
  margin: 0 0 0.3rem;
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
}

h3 {
  margin: 0 0 0.3rem;
  font-size: 1.32rem;
  line-height: 1.25;
  letter-spacing: -0.012em;
}

h2 a, h3 a { color: var(--plum); text-decoration-color: var(--rule); }

p { margin: 0 0 1.05rem; max-width: 38rem; }

.lede {
  font-size: clamp(1.1rem, 2vw, 1.24rem);
  line-height: 1.48;
  color: var(--ink);
}

.answer {
  font-size: clamp(1.15rem, 2.2vw, 1.34rem);
  line-height: 1.42;
  letter-spacing: -0.008em;
}

.why, .meaning { color: var(--ink-2); }
.prose p { color: var(--ink-2); }
.prose p:first-child { color: var(--ink); }

/* ----------------------------------------------------------------- specimen */

.hero { padding-top: clamp(2.4rem, 7vw, 5rem); }

.hero .spec { max-width: 34rem; }

.hero-lede {
  margin-top: 1.9rem;
  font-size: clamp(1.02rem, 1.7vw, 1.14rem);
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 36rem;
}

.spec { border-top: 1px solid var(--rule); margin: 0 0 1.3rem; }

.spec-row {
  display: grid;
  grid-template-columns: 5.2rem minmax(0, 1fr);
  column-gap: 1rem;
  align-items: baseline;
  padding: 0.62rem 0 0.72rem;
  border-bottom: 1px solid var(--rule);
}

.spec-key {
  font-family: var(--sans);
  font-size: 0.63rem;
  letter-spacing: 0.19em;
  text-transform: uppercase;
  color: var(--ink-2);
}

.spec-val { min-width: 0; overflow-wrap: anywhere; }

.spec-val.heard {
  font-family: var(--mono);
  font-size: clamp(1.15rem, 2.6vw, 1.5rem);
  color: var(--amber);
  letter-spacing: -0.01em;
}

.spec-val.right {
  font-family: var(--serif);
  font-size: clamp(1.35rem, 3.2vw, 1.9rem);
  color: var(--plum);
  letter-spacing: -0.018em;
}

.spec-val.said {
  font-family: var(--sans);
  font-size: 0.92rem;
  letter-spacing: 0.09em;
  color: var(--ink);
}

.spec-val.letters {
  font-family: var(--sans);
  font-size: 0.74rem;
  color: var(--ink-2);
}

.spec-val.letters span { padding-right: 0.34em; }

.spec-val.latin {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.95rem;
  color: var(--ink-2);
  line-height: 1.4;
}

/* The letters the two spellings share, stepped back so the letters that
   differ are the only ones at full strength. */
.spec-val .q { opacity: 0.42; }

@media (prefers-color-scheme: dark) {
  .spec-val .q { opacity: 0.52; }
}
.spec-val b { font-weight: inherit; }

/* Stacked variant for the annotation rail: label on its own line. */
.spec.stack { border-top: 0; }
.spec.stack .spec-row {
  grid-template-columns: minmax(0, 1fr);
  row-gap: 0.2rem;
  padding: 0.75rem 0 0.85rem;
}
.spec.stack .spec-row:first-child { padding-top: 0; }

/* ------------------------------------------------------------------- midrib */

.veins { list-style: none; margin: 0; padding: 0 0 0 2.4rem; position: relative; }

.veins::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45rem;
  bottom: 0;
  width: 1px;
  background: linear-gradient(180deg, var(--rule) 0 76%, transparent 100%);
}

.veins > li { position: relative; padding-bottom: 2.5rem; }
.veins > li:last-child { padding-bottom: 0; }

.veins > li::before {
  content: "";
  position: absolute;
  left: -2.4rem;
  top: 0.86em;
  width: 1.75rem;
  height: 1px;
  background: var(--bloom);
  transform-origin: 0 50%;
  transform: rotate(-23deg);
  transition: width 0.2s ease, background-color 0.2s ease;
}

.veins > li:hover::before,
.veins > li:focus-within::before {
  width: 2.15rem;
  background: var(--plum);
}

.veins > li > :last-child { margin-bottom: 0; }

/* --------------------------------------------------------------- list items */

.cat-blurb { color: var(--ink-2); margin-bottom: 0.55rem; }

.name-row { margin-bottom: 0.5rem; }

.name-row a {
  font-family: var(--serif);
  font-size: 1.12rem;
  margin-right: 1.15rem;
  white-space: nowrap;
}

.count {
  font-family: var(--sans);
  font-size: 0.66rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 0;
}

.say {
  font-family: var(--sans);
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--ink-2);
}

.say-line { margin-bottom: 0.35rem; color: var(--ink-2); }

ul.tight { list-style: none; margin: 0; padding: 0; }

ul.tight li {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--rule);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.2rem 0.8rem;
}

ul.tight li:last-child { border-bottom: 0; }
ul.tight a { font-size: 1.08rem; }
ul.tight .count { margin-left: auto; }

.rend {
  display: grid;
  grid-template-columns: minmax(0, 10rem) minmax(0, 1fr);
  column-gap: 1.4rem;
  row-gap: 0.15rem;
  align-items: baseline;
  text-decoration: none;
}

.rend-word {
  font-family: var(--mono);
  font-size: 1.1rem;
  color: var(--amber);
  overflow-wrap: anywhere;
}

.rend-note { font-size: 0.98rem; color: var(--ink-2); }

.rend:hover .rend-word {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
}

.rend:hover .rend-note { color: var(--ink); }

@media (max-width: 34rem) {
  .rend { grid-template-columns: minmax(0, 1fr); }
}

.sib-line { margin-bottom: 1.2rem; }

.sib-line a, .map-row a {
  font-family: var(--mono);
  color: var(--amber);
  text-decoration-color: color-mix(in srgb, var(--amber) 35%, transparent);
  margin-right: 1.05rem;
  white-space: nowrap;
}

.sib-line a { font-size: 0.95rem; line-height: 2; }
.map-row a { font-size: 0.82rem; line-height: 2.1; }
.map-row { margin-bottom: 1.4rem; }
.map h3 { margin-top: 1.2rem; }

.after { color: var(--ink-2); font-size: 0.96rem; margin-top: 1.6rem; }

.class-note {
  margin: 0;
  font-family: var(--sans);
  font-size: 0.84rem;
  line-height: 1.6;
  color: var(--ink-2);
  max-width: 30rem;
}

.class-note .tag { display: block; margin-bottom: 0.5rem; }

@media (max-width: 59.99rem) {
  .class-note {
    margin-top: 1.9rem;
    padding-top: 1.1rem;
    border-top: 1px solid var(--rule);
  }
}

.tag {
  display: inline-block;
  width: fit-content;
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--ink-2);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.1em 0.45em;
  margin-right: 0.6rem;
  white-space: nowrap;
}

/* ------------------------------------------------------------------- footer */

.foot {
  border-top: 1px solid var(--rule);
  background: var(--panel);
  margin-top: var(--step);
}

.foot-in {
  padding-top: 1.8rem;
  padding-bottom: 2.4rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 2rem;
  justify-content: space-between;
  align-items: baseline;
}

.foot-note {
  margin: 0;
  max-width: 30rem;
  font-size: 0.9rem;
  color: var(--ink-2);
}

.foot-nav { display: flex; flex-wrap: wrap; gap: 1.3rem; }

/* ------------------------------------------------------------------ motion */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}
