/* AlexDN — site styles.
   No frameworks, no webfonts, no JavaScript. System fonts only:
   a book serif for reading, a monospace for labels, metadata and the wordmark. */

:root {
  color-scheme: light dark;

  --paper: #faf8f3;
  --ink: #1b1a17;
  --ink-soft: #55524b;
  --rule: #d9d4c8;
  --rule-strong: #1b1a17;
  --accent: #b4461a;      /* wordmark mark, rules, focus ring, selection */
  --accent-ink: #9a3a14;  /* link text on paper, ≥ 6:1 contrast */
  --note-bg: #f1ede3;

  --font-body: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, "DejaVu Sans Mono", "Liberation Mono", monospace;

  --measure: 38rem;                                   /* ~65–70 characters of body text */
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
  --text: clamp(1.0625rem, 0.95rem + 0.45vw, 1.1875rem); /* 17px on phones → 19px on desktop */
  --small: 0.8125rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #171614;
    --ink: #ebe7df;
    --ink-soft: #b3ada1;
    --rule: #3a3732;
    --rule-strong: #ebe7df;
    --accent: #f08a52;
    --accent-ink: #f29a68;
    --note-bg: #211f1b;
  }
}

/* ---------- base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--text);
  line-height: 1.6;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  border-top: 0.375rem solid var(--accent);
}

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

a {
  color: var(--accent-ink);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
}

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

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

:focus:not(:focus-visible) {
  outline: none;
}

[id] {
  scroll-margin-top: 1.5rem;
}

.skip-link {
  position: absolute;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.5rem 0.75rem;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: var(--small);
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
  z-index: 10;
}

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

.site-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem 1.5rem;
  padding: 1.1rem var(--gutter);
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

.wordmark,
.wordmark-text {
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.wordmark {
  color: inherit;
  text-decoration: none;
}

.wordmark b,
.wordmark-text b {
  color: var(--accent);
  font-weight: inherit;
}

.wordmark-sub {
  margin-left: 0.9em;
  font-weight: 400;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--ink-soft);
}

@media (max-width: 36em) {
  .wordmark-sub {
    display: none;
  }
}

.site-nav a {
  color: inherit;
  text-decoration-color: var(--rule);
  text-underline-offset: 0.25em;
}

.site-nav a:hover {
  text-decoration-color: var(--accent);
}

.site-footer {
  margin-top: auto;
  padding: 1.5rem var(--gutter) 2.5rem;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: var(--small);
  color: var(--ink-soft);
}

.site-footer p {
  margin: 0.3rem 0;
}

/* ---------- main column ---------- */

.site-main {
  width: 100%;
  max-width: calc(var(--measure) + 2 * var(--gutter));
  margin: 0 auto;
  padding: 2.5rem var(--gutter) 4rem;
}

.site-main:focus {
  outline: none;
}

/* ---------- shared typographic pieces ---------- */

.eyebrow,
.meta,
.byline,
.article-list > h2,
.toc summary {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.meta,
.byline {
  letter-spacing: 0.03em;
  text-transform: none;
  margin: 0;
}

.tag {
  display: inline-block;
  padding: 0 0.45em;
  border: 1px solid currentColor;
  border-radius: 2px;
  font-size: 0.7rem;
  line-height: 1.6;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  vertical-align: 0.1em;
}

.tag--draft {
  color: var(--accent-ink);
}

.lede {
  font-size: 1.12em;
  line-height: 1.5;
}

/* ---------- home ---------- */

.intro h1 {
  margin: 0 0 1rem;
  font-size: clamp(2.25rem, 1.6rem + 3.2vw, 3.5rem);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -0.015em;
}

.intro .eyebrow {
  display: block;
  margin-bottom: 0.9rem;
  color: var(--accent-ink);
  font-weight: 700;
}

.intro .lede {
  margin: 0;
}

.status-note {
  margin: 1.75rem 0 0;
  padding: 0.2rem 0 0.2rem 0.9rem;
  border-left: 3px solid var(--accent);
  font-family: var(--font-mono);
  font-size: var(--small);
  line-height: 1.55;
  color: var(--ink-soft);
}

.article-list {
  margin-top: 3.5rem;
}

.article-list > h2 {
  margin: 0;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--rule-strong);
}

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

.article-item {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--rule);
}

.article-item h3 {
  margin: 0.45rem 0 0.5rem;
  font-size: clamp(1.35rem, 1.1rem + 1vw, 1.6rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.article-item h3 a {
  color: inherit;
  text-decoration-color: var(--rule);
}

.article-item h3 a:hover {
  text-decoration-color: var(--accent);
}

.article-item .summary {
  margin: 0;
  color: var(--ink-soft);
}

/* ---------- article ---------- */

.article-header h1 {
  margin: 0.6rem 0 1rem;
  font-size: clamp(1.85rem, 1.3rem + 2.4vw, 2.75rem);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.012em;
}

.article-header .lede {
  margin: 0 0 1rem;
  color: var(--ink-soft);
}

.toc {
  margin: 2rem 0 2.5rem;
  padding: 1rem 1.25rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  font-size: 0.95rem;
}

.toc summary {
  cursor: pointer;
}

.toc[open] summary {
  margin-bottom: 0.75rem;
}

.toc ol {
  margin: 0;
  padding-left: 1.25rem;
}

.toc li {
  margin: 0.25rem 0;
}

.toc a {
  color: inherit;
  text-decoration-color: var(--rule);
}

.toc a:hover {
  text-decoration-color: var(--accent);
}

.article-body h2 {
  margin: 2.6rem 0 0.75rem;
  font-size: clamp(1.4rem, 1.2rem + 0.8vw, 1.6rem);
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.article-body h3 {
  margin: 2rem 0 0.5rem;
  font-size: 1.18rem;
  line-height: 1.3;
}

.article-body p,
.article-body ul,
.article-body ol {
  margin: 0 0 1.25rem;
}

.article-body ul,
.article-body ol {
  padding-left: 1.4rem;
}

.article-body li {
  margin: 0.45rem 0;
  padding-left: 0.15rem;
}

.article-body blockquote {
  margin: 1.75rem 0;
  padding: 0.9rem 1.2rem;
  background: var(--note-bg);
  border-left: 3px solid var(--accent);
  font-size: 0.95em;
}

.article-body blockquote p:last-child {
  margin-bottom: 0;
}

.article-body hr {
  margin: 2.5rem 0;
  border: 0;
  border-top: 1px solid var(--rule);
}

.article-body code,
.article-body pre {
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.article-body pre {
  overflow-x: auto;
  padding: 1rem;
  background: var(--note-bg);
}

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

.article-footer {
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule-strong);
  font-size: 0.95rem;
  color: var(--ink-soft);
}

.article-footer p {
  margin: 0 0 0.75rem;
}

.back-link::before {
  content: "← ";
}

/* ---------- print ---------- */

@media print {
  body {
    border-top: 0;
    font-size: 11pt;
  }

  .site-header,
  .site-footer,
  .skip-link,
  .toc,
  .back-link {
    display: none;
  }

  a {
    color: inherit;
  }

  .article-body a[href^="http"]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
  }
}
