/* The theme: the tokens, the base document, and the prose. Linked by the page
 * and by every markdown document the content origin renders, so a rendered
 * drop is the same paper, the same ink, and the same light/dark switch as the
 * app. Served at /style.css from the app origin; the path is part of the
 * contract (files/docs/drops-v1-contract.md, "Rendered markdown"). */

:root {
  color-scheme: light dark;

  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas,
    'Liberation Mono', monospace;

  --paper: #f6f3ee;
  --surface: #fffdf9;
  --ink: #1b1714;
  --ink-muted: #6d645a;
  --ink-faint: #7d7365;
  --line: #e6dfd4;
  --line-strong: #d2c9bb;
  --hover: #efeae2;
  --accent: #b5451a;
  --accent-strong: #9a3a14;
  --accent-ink: #fff9f4;
  --accent-soft: #f7e6db;
  --warn: #a4700f;
  --danger: #a32f21;
  --ok: #2c6a4a;
  --hatch: rgba(27, 23, 20, 0.045);
  --wash: rgba(181, 69, 26, 0.07);
  --shadow: 0 1px 2px rgba(27, 23, 20, 0.05), 0 8px 24px rgba(27, 23, 20, 0.04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #131110;
    --surface: #1a1716;
    --ink: #efe9e1;
    --ink-muted: #a79c8f;
    --ink-faint: #8f8578;
    --line: #2b2725;
    --line-strong: #3d3835;
    --hover: #221e1c;
    --accent: #f08a4b;
    --accent-strong: #f7a06a;
    --accent-ink: #1a1008;
    --accent-soft: #2a1d14;
    --warn: #d9a441;
    --danger: #e8705c;
    --ok: #6cc194;
    --hatch: rgba(239, 233, 225, 0.05);
    --wash: rgba(240, 138, 75, 0.09);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 10px 28px rgba(0, 0, 0, 0.28);
  }
}

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

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(58rem 28rem at 12% -12%, var(--wash), transparent 70%);
}

:where(a, button, input, [tabindex]):focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 6px;
}

/* A rendered markdown drop. The same column the page uses, set for reading. */

.markdown {
  position: relative;
  z-index: 1;
  width: min(46rem, 100% - 2.5rem);
  margin-inline: auto;
  padding-block: clamp(2rem, 6vh, 3.5rem) 6rem;
  font-size: 1.0625rem;
  line-height: 1.65;
}

.markdown > :first-child {
  margin-top: 0;
}

.markdown h1,
.markdown h2,
.markdown h3,
.markdown h4,
.markdown h5,
.markdown h6 {
  margin: 2.25rem 0 0.75rem;
  font-weight: 620;
  line-height: 1.2;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

.markdown h1 {
  font-size: 1.9rem;
  letter-spacing: -0.02em;
}

.markdown h2 {
  font-size: 1.4rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--line);
}

.markdown h3 {
  font-size: 1.15rem;
}

.markdown h4,
.markdown h5,
.markdown h6 {
  font-size: 1rem;
  color: var(--ink-muted);
}

.markdown p,
.markdown ul,
.markdown ol,
.markdown dl {
  margin: 0 0 1.1rem;
}

.markdown ul,
.markdown ol {
  padding-left: 1.35rem;
}

.markdown li {
  margin-bottom: 0.35rem;
}

.markdown li > ul,
.markdown li > ol {
  margin: 0.35rem 0 0;
}

.markdown a {
  color: var(--accent);
  text-decoration-color: color-mix(in srgb, var(--accent) 40%, transparent);
  text-underline-offset: 0.15em;
}

.markdown a:hover {
  color: var(--accent-strong);
  text-decoration-color: currentcolor;
}

.markdown strong {
  font-weight: 640;
}

.markdown code {
  padding: 0.12em 0.36em;
  border-radius: 5px;
  background: var(--hatch);
  font-family: var(--mono);
  font-size: 0.875em;
}

.markdown pre {
  margin: 0 0 1.25rem;
  padding: 0.9rem 1.1rem;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  line-height: 1.5;
}

.markdown pre code {
  padding: 0;
  border-radius: 0;
  background: none;
  font-size: 0.85rem;
}

.markdown blockquote {
  margin: 0 0 1.25rem;
  padding: 0.1rem 0 0.1rem 1rem;
  border-left: 3px solid var(--accent-soft);
  color: var(--ink-muted);
}

.markdown blockquote > :last-child {
  margin-bottom: 0;
}

.markdown hr {
  margin: 2rem 0;
  border: 0;
  border-top: 1px solid var(--line);
}

.markdown img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
}

.markdown table {
  display: block;
  width: max-content;
  max-width: 100%;
  margin: 0 0 1.25rem;
  overflow-x: auto;
  border-collapse: collapse;
  font-size: 0.95rem;
}

.markdown th,
.markdown td {
  padding: 0.45rem 0.8rem;
  border: 1px solid var(--line);
  text-align: left;
}

.markdown th {
  background: var(--hatch);
  font-weight: 620;
}

.markdown input[type='checkbox'] {
  margin-right: 0.4rem;
  accent-color: var(--accent);
}
