/* Word: Jaryo in a reader form. Loaded only on /word/ pages.
   Jaryo's black-and-white tokens, 0 radius, 1px rules, dashed 3px focus and
   44px targets; Copper #C47A3A only as the accent (link underline, current
   mark, focus, brand mark). Jaryo's five type roles (13, 14, 16, 20, 28 px)
   are kept as ratios of the 14px body and applied to a reading size of
   18-20px. Every size is rem or em, so the browser's text size is followed. */

@font-face{font-family:"Libre Baskerville";src:url('/assets/fonts/libre-baskerville-400.woff2') format('woff2');font-weight:400;font-style:normal;font-display:swap}
@font-face{font-family:"Libre Baskerville";src:url('/assets/fonts/libre-baskerville-400italic.woff2') format('woff2');font-weight:400;font-style:italic;font-display:swap}
@font-face{font-family:"Libre Baskerville";src:url('/assets/fonts/libre-baskerville-700.woff2') format('woff2');font-weight:700;font-style:normal;font-display:swap}
@font-face{font-family:"IBM Plex Sans";src:url('/assets/fonts/ibm-plex-sans-400.woff2') format('woff2');font-weight:400;font-style:normal;font-display:swap}
@font-face{font-family:"IBM Plex Sans";src:url('/assets/fonts/ibm-plex-sans-700.woff2') format('woff2');font-weight:700;font-style:normal;font-display:swap}
@font-face{font-family:"IBM Plex Mono";src:url('/assets/fonts/ibm-plex-mono-400.woff2') format('woff2');font-weight:400;font-style:normal;font-display:swap}
@font-face{font-family:"IBM Plex Mono";src:url('/assets/fonts/ibm-plex-mono-600.woff2') format('woff2');font-weight:600;font-style:normal;font-display:swap}

/* Light: Jaryo light tokens. Copper #C47A3A is 3.39:1 on white, below 4.5:1,
   so it never colours text: link text stays ink and copper is the underline. */
html:root[data-section="word"] {
  color-scheme: light;
  --paper: #ffffff;
  --surface: #f4f4f4;
  --ink: #000000;
  --ink-reading: #1f1f1f;
  --muted: #4d4d4d;
  --rule: #8a8a8a;
  --accent: #c47a3a;
  --accent-text: var(--ink);
  --on-accent: #000000;
  --focus: var(--accent);
  --code: var(--ink);
  --deep: var(--surface);
  --on-deep: var(--ink);
  --deep-muted: var(--muted);
  --deep-rule: var(--rule);
  --serif: "Libre Baskerville", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", Menlo, Consolas, monospace;
  /* Jaryo spacing s1-s8 (4, 8, 12, 16, 24, 32, 48, 64 px) in rem. */
  --w-s1: .25rem; --w-s2: .5rem; --w-s3: .75rem; --w-s4: 1rem;
  --w-s5: 1.5rem; --w-s6: 2rem; --w-s7: 3rem; --w-s8: 4rem;
  /* Reading size: 18px on phones, rising to 20px from about 1000px wide. */
  --w-body: clamp(1.125rem, 1rem + .4vw, 1.25rem);
  --w-leading: 1.7;
  /* About 64 characters of Libre Baskerville (0.513em per character). */
  --w-measure: 33em;
  --w-hit: 2.75rem;
  --w-focus: .1875rem;
}
/* Dark: Jaryo dark tokens; the same copper rule applies. */
@media (prefers-color-scheme: dark) {
  html:root[data-section="word"] {
    color-scheme: dark;
    --paper: #0c0c0c;
    --surface: #1a1a1a;
    --ink: #f0f0f0;
    --ink-reading: #d9d9d9;
    --muted: #ababab;
    --rule: #6b6b6b;
    --accent: #c47a3a;
    --on-accent: #000000;
  }
}

html[data-section="word"] body { background: var(--paper); color: var(--ink); font-family: var(--sans); font-size: 1rem; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html[data-section="word"] main { display: block; padding-bottom: var(--w-s8); }

/* Shared frame text in rem on Word pages, so it follows the browser text size. */
html[data-section="word"] .studio-header .brand { font-size: 1rem; }
html[data-section="word"] .project-header .main-nav a { font-size: .8125rem; }
html[data-section="word"] .studio-header .studio-menu > summary,
html[data-section="word"] .studio-menu > nav a { font-size: .9375rem; }
html[data-section="word"] .site-footer.project-footer.studio-footer .footer-bottom,
html[data-section="word"] .site-footer.project-footer.studio-footer > nav { font-size: .875rem; }
/* Current section: ink text, bold, one copper mark. On /word/ itself (aria-current="page")
   the header and footer links already carry the shared copper bar (site.css ::after), so
   no underline is added there. On an essay (aria-current="location") and in the phone
   menu, which have no bar, the shared underline is drawn in copper. */
html[data-section="word"] :is(.studio-desktop-nav, .studio-menu nav, .studio-footer nav) a[aria-current] { color: var(--ink); font-weight: 600; }
html[data-section="word"] :is(.studio-desktop-nav, .studio-footer nav) a[aria-current="location"],
html[data-section="word"] .studio-menu nav a[aria-current] {
  text-decoration: underline; text-decoration-color: var(--accent);
  text-decoration-thickness: .1875rem; text-underline-offset: .375rem;
}
/* The owner's disclaimer, first in the footer: reading face, readable size and colour. */
html[data-section="word"] .studio-footer .word-human-made {
  max-width: var(--w-measure); margin: 0 0 var(--w-s4);
  font-family: var(--serif); font-size: 1rem; line-height: 1.6; color: var(--ink-reading);
}
/* Jaryo focus: 3px dashed, offset 3px outside the element. */
html[data-section="word"] :is(a, button, summary, [tabindex]:not(main)):focus-visible {
  outline: var(--w-focus) dashed var(--focus); outline-offset: var(--w-focus); border-radius: 0;
}

/* The reading column. */
html[data-section="word"] .word-page {
  box-sizing: border-box; width: min(100% - 2rem, var(--w-measure)); margin-inline: auto;
  font-family: var(--serif); font-size: var(--w-body); line-height: var(--w-leading);
  color: var(--ink-reading); font-kerning: normal; overflow-wrap: break-word;
}
html[data-section="word"] .word-page a {
  display: inline; min-height: 0; max-width: none; color: var(--accent-text);
  text-decoration: underline; text-decoration-color: var(--accent);
  text-decoration-thickness: .1em; text-underline-offset: .2em; text-decoration-skip-ink: auto;
}
html[data-section="word"] .word-page a:hover { text-decoration-thickness: .18em; }

/* Headings: Jaryo titles are IBM Plex Sans bold with -0.01em tracking. */
html[data-section="word"] .word-page :is(h1, h2, h3, h4) {
  font-family: var(--sans); font-weight: 700; letter-spacing: -.01em; color: var(--ink); text-wrap: balance;
}
/* display 28/14 */
html[data-section="word"] .word-page h1 { font-size: 2em; line-height: 1.15; margin: 0 0 var(--w-s4); }
/* Jaryo steps a section title down a quarter on narrow screens (32 to 24). */
@media (max-width: 30em) { html[data-section="word"] .word-page h1 { font-size: 1.5em; } }

/* Jaryo meta role: mono, semibold, uppercase, 0.06em tracking; ui 13/14. */
html[data-section="word"] .word-meta {
  margin: 0; font-family: var(--mono); font-weight: 600; font-size: .9286em; line-height: 1.5;
  letter-spacing: .06em; text-transform: uppercase; color: var(--muted);
}

/* Index. */
html[data-section="word"] .word-intro { padding-block: var(--w-s7) var(--w-s5); border-bottom: 1px solid var(--ink); }
html[data-section="word"] .word-intro h1 { margin-bottom: var(--w-s2); }
html[data-section="word"] .word-lede { margin: 0; font-size: 1.1429em; line-height: 1.5; color: var(--ink-reading); }
html[data-section="word"] .word-empty { margin: 0; padding-block: var(--w-s6); color: var(--muted); }
html[data-section="word"] .word-list { list-style: none; margin: 0; padding: 0; }
html[data-section="word"] .word-list > li { padding-block: var(--w-s5); border-bottom: 1px solid var(--rule); }
/* title 20/14 */
html[data-section="word"] .word-entry h2 { margin: 0 0 var(--w-s2); font-size: 1.4286em; line-height: 1.25; }
html[data-section="word"] .word-entry h2 a { display: inline-block; min-height: var(--w-hit); padding-block: .2em; color: var(--ink); text-decoration-color: transparent; }
html[data-section="word"] .word-entry h2 a:hover { text-decoration-color: var(--accent); }
html[data-section="word"] .word-summary { margin: var(--w-s2) 0 0; }
html[data-section="word"] .word-feed { margin: var(--w-s5) 0 0; font-family: var(--sans); font-size: .9286em; }
html[data-section="word"] .word-feed a { display: inline-flex; align-items: center; min-height: var(--w-hit); }

/* Essay. */
html[data-section="word"] .word-essay-head { padding-block: var(--w-s5); margin-bottom: var(--w-s6); border-bottom: 1px solid var(--ink); }
html[data-section="word"] .word-essay-head h1 { margin-top: var(--w-s4); }
html[data-section="word"] .word-page a.word-back {
  display: inline-flex; align-items: center; gap: .4em; min-height: var(--w-hit);
  font-family: var(--sans); font-size: .9286em; line-height: 1.4; color: var(--ink);
}
html[data-section="word"] .word-essay-foot { margin-top: var(--w-s7); padding-top: var(--w-s5); border-top: 1px solid var(--ink); }
html[data-section="word"] .word-pager {
  display: grid; grid-template-columns: minmax(0, 1fr);
  gap: var(--w-s4); margin-bottom: var(--w-s4); font-family: var(--sans);
}
html[data-section="word"] .word-page .word-pager a {
  display: flex; flex-direction: column; gap: var(--w-s1); min-height: var(--w-hit); padding: var(--w-s4);
  border: 1px solid var(--rule); border-radius: 0; color: var(--ink); text-decoration: none;
}
html[data-section="word"] .word-pager a:hover { border-color: var(--ink); }
html[data-section="word"] .word-pager-label { font-family: var(--mono); font-weight: 600; font-size: .9286em; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
html[data-section="word"] .word-pager-title { font-weight: 700; line-height: 1.3; }
html[data-section="word"] .word-pager a:hover .word-pager-title { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: .1em; text-underline-offset: .2em; }
@media (min-width: 30.0625em) {
  html[data-section="word"] .word-pager { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  html[data-section="word"] .word-pager a.word-pager-next { grid-column: 2; text-align: right; }
}

/* Essay text. */
html[data-section="word"] .word-prose p { margin: 0 0 1.25em; text-wrap: pretty; }
/* title 20/14 and name 16/14 */
html[data-section="word"] .word-prose h2 { font-size: 1.4286em; line-height: 1.25; margin: 1.75em 0 .6em; }
html[data-section="word"] .word-prose h3 { font-size: 1.1429em; line-height: 1.3; margin: 1.75em 0 .5em; }
html[data-section="word"] .word-prose :is(h4, h5, h6) { font-family: var(--sans); font-weight: 700; font-size: 1em; line-height: 1.4; color: var(--ink); margin: 1.5em 0 .5em; }
html[data-section="word"] .word-prose :is(strong, b) { font-weight: 700; color: var(--ink); }
html[data-section="word"] .word-prose :is(ul, ol) { margin: 0 0 1.25em; padding-left: 1.5em; }
html[data-section="word"] .word-prose li { margin-bottom: .5em; padding-left: .25em; }
html[data-section="word"] .word-prose li > :is(ul, ol) { margin: .5em 0 0; }
html[data-section="word"] .word-prose li > p { margin-bottom: .5em; }
html[data-section="word"] .word-prose li::marker { color: var(--muted); }
html[data-section="word"] .word-prose blockquote {
  margin: 1.75em 0; padding: 0 0 0 1.25em; border-left: .1875rem solid var(--ink);
  font-style: italic; color: var(--ink-reading);
}
html[data-section="word"] .word-prose blockquote > :last-child { margin-bottom: 0; }
html[data-section="word"] .word-prose hr { width: 40%; margin: 2.5em auto; border: 0; border-top: 1px solid var(--rule); }
html[data-section="word"] .word-prose code {
  font-family: var(--mono); font-weight: 400; font-size: .875em; padding: .1em .3em;
  background: var(--surface); color: var(--ink); border-radius: 0; overflow-wrap: anywhere;
}
/* Code blocks stay in black and white and scroll inside the column. */
html[data-section="word"] .word-prose pre {
  box-sizing: border-box; max-width: 100%; margin: 0 0 1.25em; padding: var(--w-s4); overflow-x: auto;
  background: var(--surface) !important; color: var(--ink) !important;
  border: 1px solid var(--rule); border-radius: 0; font-size: .8125em; line-height: 1.6;
}
html[data-section="word"] .word-prose pre code { padding: 0; background: none; font-size: inherit; overflow-wrap: normal; }
html[data-section="word"] .word-prose pre span { color: inherit !important; }
/* Media and tables never widen the column. */
html[data-section="word"] .word-prose :is(img, video, svg, iframe, canvas) { display: block; max-width: 100%; height: auto; margin: 1.75em auto; }
html[data-section="word"] .word-prose figure { margin: 1.75em 0; }
html[data-section="word"] .word-prose figure > :is(img, video, svg) { margin-block: 0; }
html[data-section="word"] .word-prose figcaption { margin-top: var(--w-s2); font-family: var(--sans); font-size: .9286em; line-height: 1.5; color: var(--muted); }
html[data-section="word"] .word-prose table {
  display: block; max-width: 100%; overflow-x: auto; margin: 0 0 1.25em; border-collapse: collapse;
  font-family: var(--sans); font-size: .9286em; line-height: 1.5;
}
html[data-section="word"] .word-prose :is(th, td) { padding: .5em .75em; border: 1px solid var(--rule); text-align: left; vertical-align: top; }
html[data-section="word"] .word-prose th { color: var(--ink); }
/* Footnotes. */
html[data-section="word"] .word-prose sup { font-size: .75em; line-height: 0; vertical-align: super; }
html[data-section="word"] .word-prose sup a { padding-inline: .1em; text-decoration-thickness: .08em; }
html[data-section="word"] .word-prose .footnotes { margin-top: var(--w-s7); padding-top: var(--w-s4); border-top: 1px solid var(--rule); font-size: .9286em; line-height: 1.6; }
html[data-section="word"] .word-prose .footnotes ol { padding-left: 1.25em; }
html[data-section="word"] .word-prose .footnotes p { margin-bottom: .5em; }
@media (max-width: 30em) { html[data-section="word"] .word-prose :is(p, li) { hyphens: auto; } }

@media (prefers-reduced-motion: no-preference) {
  html[data-section="word"] .word-page a { transition: text-decoration-thickness 180ms ease-out, text-decoration-color 180ms ease-out; }
}
@media (prefers-reduced-motion: reduce) {
  html[data-section="word"] * { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}

/* Print: black on white, no navigation, link addresses written out. */
@media print {
  html:root[data-section="word"] {
    color-scheme: light;
    --paper: #fff; --surface: #fff; --ink: #000; --ink-reading: #000; --muted: #333; --rule: #555;
    --accent: #000; --accent-text: #000; --on-accent: #fff; --focus: #000;
  }
  html[data-section="word"] body { background: #fff; color: #000; }
  html[data-section="word"] main { padding: 0; }
  html[data-section="word"] .word-page { width: auto; max-width: var(--w-measure); margin: 0; font-size: 1rem; line-height: 1.55; }
  html[data-section="word"] :is(.word-back, .word-pager, .word-feed) { display: none !important; }
  html[data-section="word"] .word-essay-foot { border: 0; }
  html[data-section="word"] .word-prose a[href^="http"]::after { content: " (" attr(href) ")"; font-size: .85em; overflow-wrap: anywhere; }
  html[data-section="word"] .word-page :is(h1, h2, h3, h4) { break-after: avoid; }
  html[data-section="word"] .word-prose :is(p, li) { orphans: 3; widows: 3; }
  html[data-section="word"] .word-prose :is(pre, blockquote, figure, img, table) { break-inside: avoid; }
  html[data-section="word"] .word-prose pre { white-space: pre-wrap; overflow: visible; }
}

/* Windows High Contrast and other forced palettes: system colours own every mark.
   Last, so a forced palette also wins when printing. */
@media (forced-colors: active) {
  html:root[data-section="word"] {
    forced-color-adjust: auto;
    --paper: Canvas; --surface: Canvas; --ink: CanvasText; --ink-reading: CanvasText; --muted: CanvasText;
    --rule: CanvasText; --accent: LinkText; --accent-text: LinkText; --on-accent: Canvas; --focus: Highlight;
  }
  /* The shared print sheet sets the palette on body; system colours win here too. */
  html[data-section="word"] body[data-section] {
    background: Canvas; color: CanvasText;
    --paper: Canvas; --surface: Canvas; --ink: CanvasText; --ink-reading: CanvasText; --muted: CanvasText;
    --rule: CanvasText; --accent: LinkText; --accent-text: LinkText; --on-accent: Canvas; --focus: Highlight;
  }
  html[data-section="word"] .word-page a { color: LinkText; text-decoration-color: currentColor; }
  html[data-section="word"] :is(.studio-desktop-nav, .studio-menu nav, .studio-footer nav) a[aria-current] { color: LinkText; text-decoration-color: currentColor; }
  html[data-section="word"] .word-prose :is(pre, code, blockquote) { border-color: CanvasText; }
  html[data-section="word"] :is(a, button, summary, [tabindex]:not(main)):focus-visible { outline-color: Highlight; }
}
