@import url('https://fonts.googleapis.com/css2?family=Barlow+Semi+Condensed:wght@600;700&family=DM+Sans:wght@400;500;600;700&display=swap');

:root {
  color-scheme: light;
  --ink: #18211a;
  --muted: #4f5b50;
  --paper: #f3f4ed;
  --white: #ffffff;
  --dark: #18221c;
  --lime: #c1ee54;
  --green: #355822;
  --line: #b5c0ae;
  --pale: #e6ecd9;
  --body: 'DM Sans', Arial, sans-serif;
  --display: 'Barlow Semi Condensed', 'Arial Narrow', Arial, sans-serif;
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.6;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 1rem; }
body { margin: 0; background: var(--paper); color: var(--ink); }
a { color: var(--green); text-decoration-thickness: 1px; text-underline-offset: .22em; }
a, button, summary {
  min-height: 44px;
  min-width: 44px;
  font-size: max(1rem, 16px);
}
a { display: inline-flex; align-items: center; padding: .35rem 0; overflow-wrap: anywhere; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 4px; }
summary { cursor: pointer; display: list-item; padding: .65rem .9rem; font-weight: 600; }
summary:hover { background: var(--pale); }
summary::marker { color: var(--green); }
p { margin: .65rem 0 1.2rem; max-width: 68ch; }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.1; text-wrap: balance; }
h1 { font-size: clamp(2.25rem, 4.5vw, 3.8rem); letter-spacing: -.025em; max-width: 21ch; margin: .5rem 0 1.1rem; }
h2 { font-size: clamp(1.7rem, 2.6vw, 2.25rem); letter-spacing: -.012em; max-width: 28ch; margin: 0 0 1.25rem; }
h3 { font-size: 1.4rem; }
ul, ol { padding-left: 1.35rem; }
li { margin: .4rem 0; }
img { display: block; width: 100%; height: auto; object-fit: cover; font-size: 1rem; }
fieldset { min-inline-size: 0; }
textarea, input { font: inherit; }
textarea {
  display: block;
  width: 100%;
  min-height: 110px;
  padding: .6rem .75rem;
  margin-top: .35rem;
  border: 1px solid #78836e;
  border-radius: 0;
  background: var(--white);
  color: var(--ink);
  line-height: 1.6;
  resize: vertical;
}
textarea:focus { outline: 3px solid var(--green); outline-offset: 2px; }
label { font-weight: 500; }
figure { margin: 1.5rem 0; }
figcaption { max-width: 68ch; font-size: 1rem; color: var(--muted); padding: .8rem 0 0; line-height: 1.5; }
figcaption::before { content: '↳ '; color: var(--green); }
details { border: 1px solid var(--line); }
details[open] > summary { border-bottom: 1px solid var(--line); }
details > p, details > ul { margin: 1rem 1.1rem; }

#skip { position: absolute; left: 1rem; top: -8rem; z-index: 10; background: var(--lime); color: var(--ink); padding: .7rem 1rem; }
#skip:focus { top: 1rem; }
#masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  max-width: 1520px;
  margin: auto;
  padding: 1.1rem 2rem 1.25rem;
  border-bottom: 1px solid var(--line);
}
#masthead > a:first-child { display: grid; color: var(--ink); text-decoration: none; line-height: 1.35; padding-left: 1rem; border-left: 5px solid var(--green); }
#masthead strong { font-family: var(--display); font-size: 1.6rem; font-weight: 600; }
#masthead span { font-size: 1rem; color: var(--muted); }
#masthead > a:last-child { font-weight: 600; }
#book { display: grid; grid-template-columns: 245px minmax(0, 1fr); gap: 2.8rem; max-width: 1456px; padding: 2.5rem 2rem 4rem; margin: auto; align-items: start; }
#chapters { min-width: 0; position: sticky; top: 1.4rem; }
#chapter-index { color: var(--paper); background: var(--dark); border: 0; border-top: 5px solid var(--lime); }
#chapter-index > summary { padding: 1rem .9rem; font-family: var(--display); font-size: 1.35rem; line-height: 1.2; }
#chapter-index > summary::marker { color: var(--lime); }
#chapter-index > summary:hover { background: #2b382b; }
#chapter-index[open] > summary { border-bottom-color: #52604b; }
#chapter-index ol { list-style: none; margin: .5rem 0; padding: 0 .5rem .5rem; }
#chapter-index li { margin: 0; }
#chapter-index a { display: flex; width: 100%; padding: .65rem .65rem .65rem 1rem; min-height: 48px; color: var(--paper); text-decoration: none; font-size: 1rem; line-height: 1.3; border-left: 3px solid transparent; }
#chapter-index a:hover { background: #2b382b; }
#chapter-index a[aria-current='page'] { color: var(--lime); border-left-color: var(--lime); background: #2b382b; }
#chapter-index a:focus-visible, #chapter-index summary:focus-visible { outline-color: var(--lime); outline-offset: -4px; }
#chapters > p { color: var(--muted); font-size: 1rem; padding: 0 .85rem; margin-top: 1.1rem; }
#reading { min-width: 0; }
#opening { background: var(--dark); color: var(--paper); padding: 2.3rem 2.4rem 1.8rem; position: relative; border-left: 6px solid var(--lime); }
#opening > p:first-child { color: var(--lime); margin: 0 0 .4rem; font-weight: 600; font-size: 1rem; }
#opening > p:last-of-type { max-width: 59ch; font-size: 1.1rem; margin-bottom: 1.4rem; }
#section-menu { border: 1px solid #5c6b51; max-width: 37rem; }
#section-menu > summary { color: var(--lime); font-size: 1rem; }
#section-menu > summary::marker { color: var(--lime); }
#section-menu > summary:hover { background: #2b382b; }
#section-menu[open] > summary { border-bottom-color: #5c6b51; }
#section-menu ul { list-style: none; padding: .3rem .9rem; margin: 0; }
#section-menu a { color: var(--paper); padding: .5rem 0; font-size: 1rem; line-height: 1.4; }
#section-menu a:focus-visible, #section-menu summary:focus-visible { outline-color: var(--lime); }
article > section { margin-top: 2.8rem; padding-top: 1.5rem; border-top: 2px solid var(--line); }
article > section:first-child { border-top: 0; padding-top: 0; margin-top: 2.2rem; }
section:target { scroll-margin-top: 1.5rem; }
section:target > h2 { text-decoration: underline; text-decoration-color: var(--green); text-underline-offset: .18em; }

[data-comparison-pairs] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; background: var(--white); border-top: 5px solid var(--green); }
[data-comparison-pairs] > section { min-width: 0; padding: 1.5rem 1.5rem 1.3rem; border: 1px solid var(--line); border-top: 0; }
[data-comparison-pairs] > section + section { border-left: 0; }
[data-compare] h3 { font-family: var(--display); font-size: 1.5rem; line-height: 1.25; font-weight: 600; margin: 0 0 .75rem; text-wrap: wrap; }
[data-comparison-answer] { margin: 0; font-size: 1rem; }
[data-compare] p { margin: .5rem 0 .9rem; }
[data-comparison-answer] > :last-child { margin-bottom: 0; }
[data-compare] a { display: flex; margin-top: .35rem; }
[data-routes] { margin: 0; }
[data-routes] > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.2rem; padding: .9rem 0; border-bottom: 1px solid var(--line); }
[data-routes] dt { font-family: var(--display); font-size: 1.5rem; line-height: 1.3; }
[data-routes] a { font-size: 1.25rem; font-weight: 600; }
[data-routes] dd { margin: 0; color: var(--muted); font-size: 1rem; }
[data-checks], [data-write] { padding: 1.3rem 1.25rem; margin: 1.5rem 0 1rem; border: 1px solid var(--line); background: var(--white); border-bottom: 4px solid var(--green); }
legend { padding: .25rem .6rem; margin-left: -.6rem; background: var(--paper); font-family: var(--display); font-size: 1.4rem; line-height: 1.3; font-weight: 600; max-width: 100%; }
legend > h3 { font: inherit; margin: 0; text-wrap: wrap; }
[data-checks] label { display: flex; align-items: flex-start; gap: .8rem; min-height: 48px; padding: .6rem 0; font-size: 1rem; font-weight: 400; cursor: pointer; border-bottom: 1px solid #e2e7db; }
[data-checks] label:last-child { border-bottom: 0; }
[data-checks] input { flex: 0 0 44px; width: 44px; height: 44px; min-width: 44px; min-height: 44px; margin: 0; accent-color: var(--green); }
[data-checks] input:checked + span { color: var(--green); }
[data-write] > div { margin-bottom: 1.2rem; }
[data-write] > div:last-child { margin-bottom: 0; }
[data-write] label { display: block; font-size: 1rem; }
[data-write] + p { font-size: 1rem; color: var(--muted); }
[data-pair] { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
[data-pair] fieldset { height: fit-content; }
[data-pair] > p { grid-row: 2; margin: .2rem 0 0; font-size: 1rem; }
[data-pair] fieldset:nth-of-type(2) { grid-column: 2; grid-row: 1; }
[data-photo] { max-width: 39rem; }
[data-photo] img { background: var(--pale); border: 1px solid var(--line); color: var(--ink); }
[data-photo] figcaption { border-bottom: 1px solid var(--line); padding-bottom: .8rem; }
[data-source] { background: var(--pale); max-width: 68ch; margin: 1.25rem 0 0; border: 1px solid #9aab87; }
[data-source] > summary { padding: .8rem 1rem; }
[data-source] > ul:empty { display: none; }
[data-source] li { margin: .2rem 0; }
[data-source] a { font-weight: 500; }
[data-questions] dl { margin: 0; border-top: 5px solid var(--green); }
[data-questions] dl > div { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.1fr); gap: 1.5rem; padding: 1.5rem 1.2rem; border-bottom: 1px solid var(--line); background: var(--white); }
[data-questions] dt { font-family: var(--display); font-size: 1.5rem; line-height: 1.3; font-weight: 600; }
[data-questions] dd { margin: 0; }
[data-questions] p { margin: 0; font-size: 1rem; }
#turn-page { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 3rem; padding-top: 1rem; border-top: 2px solid var(--green); }
#turn-page a { padding: .8rem 1rem; border: 1px solid var(--green); line-height: 1.4; font-size: 1rem; font-weight: 600; }
#turn-page a:last-child { color: var(--ink); background: var(--lime); }
footer { color: var(--paper); background: var(--dark); padding: 2rem max(1.25rem, calc((100vw - 1384px) / 2)); border-top: 5px solid var(--lime); }
footer p { font-size: 1rem; max-width: 66ch; margin-top: 0; }
footer nav { display: flex; gap: .5rem 1.8rem; flex-wrap: wrap; }
footer a { color: var(--lime); padding: .6rem 0; font-size: 1rem; }
footer a:focus-visible { outline-color: var(--lime); }

@media (min-width: 90rem) {
  #book { gap: 3.5rem; grid-template-columns: 265px minmax(0, 1fr); }
}
@media (max-width: 63.99rem) {
  #book { display: block; max-width: 52rem; padding: 1.3rem 1.4rem 3rem; }
  #chapters { position: static; margin-bottom: 1.5rem; }
  #chapters > p { display: none; }
  #chapter-index nav { padding: .2rem 0; }
  #chapter-index a { min-height: 48px; }
  #opening { padding: 1.7rem 1.7rem 1.5rem; }
  #masthead { padding: 1rem 1.4rem; }
  h1 { font-size: clamp(2.3rem, 6vw, 3.3rem); }
}
@media (max-width: 40rem) {
  :root { font-size: 17px; }
  #masthead { padding: .85rem 1rem; gap: .65rem; }
  #masthead > a:first-child { padding-left: .65rem; }
  #masthead strong { font-size: 1.35rem; }
  #masthead span { font-size: 1rem; }
  #masthead > a:last-child { font-size: 1rem; }
  #book { padding: 1rem 1rem 2.5rem; }
  #chapters { margin-bottom: 1rem; }
  #chapter-index > summary { font-size: 1.2rem; padding: .85rem .8rem; }
  #opening { padding: 1.4rem 1.15rem 1.15rem; border-left-width: 4px; }
  #opening > p:last-of-type { font-size: 1rem; }
  h1 { font-size: 2.35rem; }
  article > section { margin-top: 2.2rem; padding-top: 1.3rem; }
  [data-comparison-pairs] { grid-template-columns: minmax(0, 1fr); }
  [data-comparison-pairs] > section { padding: 1.2rem 1.15rem; }
  [data-comparison-pairs] > section + section { border-left: 1px solid var(--line); }
  [data-compare] h3 { font-size: 1.4rem; }
  [data-routes] > div { grid-template-columns: minmax(0, 1fr); gap: .2rem; }
  [data-routes] dt, [data-routes] a { font-size: 1.3rem; }
  [data-routes] a { width: 100%; }
  [data-pair] { display: block; }
  [data-checks], [data-write] { padding: .85rem .9rem 1rem; }
  [data-checks] label { gap: .65rem; }
  [data-questions] dl > div { display: block; padding: 1.2rem 1rem; }
  [data-questions] dt { margin-bottom: .7rem; font-size: 1.4rem; }
  [data-source] > p, [data-source] > ul { margin: .9rem; }
  [data-source] > ul { padding-left: 1.15rem; }
  #turn-page { display: grid; grid-template-columns: minmax(0, 1fr); }
  #turn-page a { width: 100%; }
  footer { padding: 1.5rem 1rem; }
  footer nav { display: grid; grid-template-columns: minmax(0, 1fr); gap: .2rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation: none !important; transition: none !important; }
}
@media print {
  :root { font-family: Arial, sans-serif; font-size: 12pt; }
  body { background: white; color: black; }
  #skip, #chapters, #section-menu, #turn-page, footer nav, [data-photo] { display: none; }
  #masthead { padding: 0 0 .7rem; }
  #masthead > a:last-child { display: none; }
  #book { display: block; padding: 1rem 0; }
  #opening { padding: 0 0 1rem; border-left: 0; background: white; color: black; }
  #opening > p:first-child { color: black; }
  h1 { font-size: 28pt; }
  h2 { font-size: 20pt; }
  fieldset, [data-comparison-pairs] > section, [data-questions] dl > div { break-inside: avoid; background: white; }
  textarea { min-height: 100px; border-color: black; }
  [data-write] > div { break-inside: avoid; }
  [data-checks] label { min-height: 32px; }
  [data-write] + p { display: none; }
  details { border-color: black; }
  footer { padding: 1rem 0 0; margin-top: 1rem; color: black; background: white; border-top: 1px solid black; }
  a { color: black; }
}
