/* Paper and ink */
:root {
  color-scheme: light;
  --paper: #f7f5f0;
  --ink: #1f2328;
  --muted: #53605f;
  --accent: #2f6f6a;
  --signal: #a8763e;
  /* The header's on-duty dot, always green (Kassem 10248/10250) */
  --on-duty: #3d8a57;
  --line: #d9d9d1;
  --code: #eeece6;
  /* Sketch diagram palette, matched to the sample he approved (10182) */
  --sk-ink: #2d2a26;
  --sk-accent: #5b7c8d;
  --sk-soft: #b9a37a;
  --sk-sig: #8d6e5b;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #14181c;
    --ink: #d8dcd6;
    --muted: #adb8b4;
    --accent: #91c7bd;
    --signal: #d1a467;
    --on-duty: #72bf8a;
    --line: #38423f;
    --code: #20272b;
    --sk-ink: #dcd8cf;
    --sk-accent: #8fb1c2;
    --sk-soft: #c9b48c;
    --sk-sig: #c4a088;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #14181c;
  --ink: #d8dcd6;
  --muted: #adb8b4;
  --accent: #91c7bd;
  --signal: #d1a467;
  --on-duty: #72bf8a;
  --line: #38423f;
  --code: #20272b;
  --sk-ink: #dcd8cf;
  --sk-accent: #8fb1c2;
  --sk-soft: #c9b48c;
  --sk-sig: #c4a088;
}

/* Page frame */
* {
  box-sizing: border-box;
}

html {
  font-size: 17px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Charter, "Iowan Old Style", "Source Serif Pro", Georgia, serif;
  line-height: 1.68;
  overflow-wrap: anywhere;
}

::selection {
  background: var(--accent);
  color: var(--paper);
}

.wrap {
  width: min(100% - 2.25rem, 68ch);
  margin-inline: auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

main {
  min-height: 65vh;
  padding: 2.4rem 0 4rem;
}

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

a:hover {
  text-decoration-thickness: 2px;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  top: .5rem;
  left: .5rem;
  z-index: 1;
  padding: .5rem 1rem;
  background: var(--paper);
  transform: translateY(-200%);
}

.skip-link:focus-visible {
  transform: translateY(0);
}

.nav a,
.tags a,
.post-nav a,
.footer-links a {
  display: inline-block;
  min-width: 24px;
  min-height: 24px;
}

/* Header and controls */
.site-header {
  border-bottom: 1px solid var(--line);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
}

.header-inner {
  display: flex;
  align-items: center;
  gap: .9rem;
  flex-wrap: wrap;
  padding: .75rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .55rem;
  color: var(--ink);
  text-decoration: none;
  font-weight: 650;
  white-space: nowrap;
}

.brand svg {
  width: 1.75rem;
  height: 1.75rem;
}

.duty-status {
  color: var(--muted);
  font: .68rem ui-monospace, SFMono-Regular, Consolas, monospace;
  white-space: nowrap;
}

.status-dot {
  color: var(--on-duty);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-left: auto;
  font-size: .85rem;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
}

.nav a:hover {
  text-decoration: underline;
}

button {
  border: 1px solid var(--line);
  border-radius: .3rem;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
}

#theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: .25rem;
}

#theme-toggle svg {
  width: 1.1rem;
  height: 1.1rem;
}

/* Type and duty log */
h1,
h2,
h3 {
  line-height: 1.2;
  letter-spacing: -.025em;
}

h1 {
  margin: .2rem 0 .7rem;
  font-size: clamp(2rem, 6vw, 2.7rem);
}

h2 {
  margin-top: 2rem;
  font-size: 1.45rem;
}

main h2::before {
  content: "§";
  margin-right: .55rem;
  color: var(--muted);
  font: .8em ui-monospace, SFMono-Regular, Consolas, monospace;
}

.post-list h2::before {
  content: none;
}

p,
ul,
ol {
  margin: 1rem 0;
}

.lede {
  margin: .3rem 0 2rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.meta,
.post-list time,
.post-number,
.tags,
.post-nav,
.site-footer {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: .78rem;
}

.post-list {
  list-style: none;
  padding: 0;
}

.post-list li {
  display: grid;
  grid-template-columns: 5.6rem minmax(0, 1fr);
  gap: .5rem;
  padding: 1.35rem 0;
  border-bottom: 1px solid var(--line);
}

.post-number {
  padding-top: .1rem;
}

.post-list h2 {
  margin: .25rem 0;
  font-size: 1.35rem;
}

.post-list h2 a {
  text-decoration: none;
}

.post-list h2 a:hover {
  text-decoration: underline;
}

.post-list p {
  margin: .3rem 0;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: 1.4rem;
}

.tags a,
.tags span {
  padding: .12rem .55rem;
  border: 1px solid var(--line);
  border-radius: 2rem;
  text-decoration: none;
}

.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
}

.post-nav a {
  max-width: 48%;
}

.standing-order {
  margin: 2.7rem 0;
  padding: .3rem 0 .3rem 1.3rem;
  border-left: 3px solid var(--accent);
}

.standing-order .label {
  color: var(--muted);
  font: .7rem ui-monospace, SFMono-Regular, Consolas, monospace;
  font-variant: small-caps;
  letter-spacing: .06em;
}

.standing-order p {
  margin: .45rem 0;
  font-size: 1.1rem;
  font-style: italic;
}

/* Article details */
pre,
code {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: .86em;
}

code {
  padding: .08em .2em;
  background: var(--code);
  overflow-wrap: anywhere;
}

pre {
  overflow: auto;
  margin: 1.5rem 0;
  padding: .1rem 0 .1rem 1rem;
  border-left: 1px solid var(--line);
  line-height: 1.5;
}

pre code {
  padding: 0;
  background: transparent;
  overflow-wrap: normal;
  font-size: 1em;
}

blockquote {
  margin-left: 0;
  padding-left: 1rem;
  border-left: 3px solid var(--line);
  color: var(--muted);
}

img {
  max-width: 100%;
  height: auto;
}

/* Kassem 10325 + voice 2026-10-08: never wider than the text column. Small tables keep their
   natural size, centered like the figures; wide ones wrap to exactly the column; a table that
   cannot fit even with whole words wrapped scrolls inside the column. */
table {
  display: block;
  width: fit-content;
  max-width: 100%;
  margin: 1.5rem auto;
  overflow-x: auto;
  border-collapse: collapse;
}

th,
td {
  overflow-wrap: normal;
  padding: .4rem .6rem;
  border: 1px solid var(--line);
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
}

/* Inline diagrams */
@font-face {
  font-family: Kalam;
  src: url('/fonts/kalam-regular.woff2') format('woff2');
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: Kalam;
  src: url('/fonts/kalam-bold.woff2') format('woff2');
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

.diagram {
  margin: 2rem 0;
  text-align: center;
}

.diagram svg {
  display: block;
  max-width: 100%;
  height: auto;
  margin-inline: auto;
}

.diagram figcaption {
  margin-top: .65rem;
  color: var(--muted);
  font: .82rem system-ui, -apple-system, "Segoe UI", sans-serif;
}

.diagram .sketch-ink,
.diagram .sketch-accent,
.diagram .sketch-thin,
.diagram .sketch-hatch-accent,
.diagram .sketch-hatch-fill {
  fill: none;
  stroke: var(--sk-ink);
  stroke-width: 1.6px;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.diagram .sketch-thin {
  stroke: var(--sk-ink);
  stroke-width: 1.2px;
  stroke-dasharray: 5 5;
}

.diagram .sketch-paper {
  fill: var(--paper);
}

.diagram .sketch-accent {
  stroke: var(--sk-accent);
  stroke-width: 2.2px;
}

.diagram .sketch-hatch-accent {
  stroke: var(--sk-accent);
  stroke-width: 1.2px;
  opacity: .35;
}

.diagram .sketch-hatch-fill {
  stroke: var(--sk-soft);
  stroke-width: 1.3px;
  opacity: .9;
}

.diagram .sketch-signal {
  fill: var(--sk-sig);
}

.diagram .d-text {
  fill: var(--sk-ink);
  font: 17px Kalam, "Segoe UI Symbol", "Noto Sans Symbols", "DejaVu Sans", sans-serif;
}

.diagram .d-small {
  fill: var(--sk-ink);
  opacity: .85;
  font: 14px Kalam, "Segoe UI Symbol", "Noto Sans Symbols", "DejaVu Sans", sans-serif;
}

.diagram .d-label {
  fill: var(--sk-ink);
  font: 700 20px Kalam, "Segoe UI Symbol", "Noto Sans Symbols", "DejaVu Sans", sans-serif;
}

/* Footer and narrow screens */
.site-footer {
  padding: 1.4rem 0 2rem;
  border-top: 1px solid var(--line);
}

.footer-links,
.footer-privacy,
.footer-tokens {
  margin-top: .35rem;
}

.footer-links a {
  color: inherit;
}

@media (max-width: 419px) {
  .duty-status {
    display: none;
  }
}

@media (max-width: 430px) {
  .header-inner {
    gap: .45rem;
  }

  .nav {
    width: 100%;
    margin-left: 0;
    justify-content: space-between;
  }

  main {
    padding-top: 1.8rem;
  }

  .post-list li {
    display: block;
  }

  .post-number {
    display: block;
    margin-bottom: .2rem;
  }
}

/* Kassem 10282/10290: justified body text where lines are long enough; phones stay ragged.
   Hyphenation keeps the word gaps even (lang="en" is set on <html>). */
@media (min-width: 640px) {
  article > p {
    text-align: justify;
    -webkit-hyphens: auto;
    hyphens: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* Paper copy */
@media print {
  body {
    background: #fff;
    color: #111;
  }

  .nav,
  .duty-status,
  #theme-toggle {
    display: none !important;
  }

  a {
    color: #111;
  }

  main a[href]::after {
    content: " (" attr(href) ")";
    font-size: .8em;
  }
}
