/* Sector Notes — dev-notes digital garden.
   Design: "drafting sheet" — warm paper, hairline structure, sharp corners.
   Inter = content voice; JetBrains Mono = structural voice (nav, labels, meta).
   Self-hosted woff2 = zero external requests. */

/* --- Fonts (self-hosted, latin subset) --- */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/inter-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/assets/fonts/inter-latin-600-normal.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/inter-latin-700-normal.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/fonts/jetbrains-mono-latin-400-normal.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/assets/fonts/jetbrains-mono-latin-700-normal.woff2") format("woff2");
}

:root {
  /* Warm paper palette */
  --bg: #f4f1ea;
  --surface: #faf8f2;
  --ink: #1d1a16;
  --muted: #6b665d;
  --faint: #a39b8c;
  --accent: #9c5b3f;        /* clay — used sparingly */
  --code-bg: #efe8da;
  --line: #ddd5c4;          /* warm hairline */

  --maxw: 720px;
  --side: 240px;
  --wrap: calc(var(--side) + var(--maxw) + 6rem);

  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", "Consolas", monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }

.skip { position: absolute; left: -9999px; }
.skip:focus {
  left: 1rem;
  top: 0.5rem;
  background: var(--accent);
  color: #fff;
  padding: 0.4rem 0.8rem;
  border-radius: 0;
  z-index: 10;
}

/* --- Header: numbered index menu --- */
.site-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem 2rem;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 1.6rem 1.5rem 1.1rem;
  border-bottom: 1px solid var(--line);
}
.brand {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
}
.brand:hover { text-decoration: none; }
.brand-dot { color: var(--accent); }

.nav {
  display: flex;
  gap: 1.6rem;
  font-family: var(--mono);
  font-size: 0.82rem;
}
.nav-item {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding-bottom: 0.2rem;
  border-bottom: 1px solid transparent;
}
.nav-item:hover { color: var(--ink); text-decoration: none; }
.nav-idx { color: var(--faint); margin-right: 0.4rem; font-weight: 400; }
.nav-item[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}
.nav-item[aria-current="page"] .nav-idx { color: var(--accent); }

/* --- Layout: sidebar + content --- */
.layout {
  display: grid;
  grid-template-columns: var(--side) minmax(0, var(--maxw));
  gap: 3.5rem;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 2.6rem 1.5rem 3.5rem;
}

.sidebar { position: sticky; top: 1.5rem; align-self: start; font-family: var(--mono); }
.side-block { margin-bottom: 2rem; }
.side-title {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--faint);
  margin: 0 0 0.7rem;
  font-weight: 400;
}
.side-list { list-style: none; margin: 0; padding: 0; font-size: 0.82rem; }
.side-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.22rem 0;
}
.side-list a { color: var(--ink); }
.side-list a:hover { color: var(--accent); text-decoration: none; }
.side-list .count { color: var(--faint); }

.content { min-width: 0; }

/* --- Typography --- */
h1 {
  font-size: 2.3rem;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.022em;
  margin: 0 0 0.7rem;
}
h2 {
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: -0.012em;
  margin: 2.4rem 0 0.9rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
}
h3 {
  font-size: 1.08rem;
  font-weight: 600;
  letter-spacing: -0.008em;
  margin: 1.7rem 0 0.4rem;
}
p { margin: 0 0 1rem; }
.muted { color: var(--muted); font-size: 0.9rem; }
.lead {
  font-size: 1.18rem;
  line-height: 1.55;
  color: var(--ink);
  letter-spacing: -0.005em;
}

.hero { margin-bottom: 3rem; }
.hero h1 { letter-spacing: -0.025em; }
.hero .muted { font-family: var(--mono); font-size: 0.82rem; }

/* Section heading on listing pages (no rule, mono-labelled feel handled by h2) */

/* --- Note list (ledger: mono date stamp | title) --- */
.note-list { list-style: none; margin: 0; padding: 0; }
.note-list li {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr);
  column-gap: 1.4rem;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}
.note-list .muted {
  grid-column: 1;
  grid-row: 1;
  font-family: var(--mono);
  font-size: 0.76rem;
  color: var(--faint);
  margin: 0;
  padding-top: 0.28rem;
  white-space: nowrap;
}
.note-link {
  grid-column: 2;
  grid-row: 1;
  font-weight: 600;
  font-size: 1.06rem;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.note-link:hover { color: var(--accent); text-decoration: none; }
.excerpt {
  grid-column: 2;
  grid-row: 2;
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: 0.94rem;
  line-height: 1.55;
}

/* --- Single note --- */
.note-head { margin-bottom: 1.8rem; }
.note-meta {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  letter-spacing: 0.02em;
}
.tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  letter-spacing: 0.03em;
  text-transform: lowercase;
  color: var(--accent);
  border: 1px solid var(--line);
  padding: 0.02rem 0.4rem;
  border-radius: 0;
}
.tag:hover { border-color: var(--accent); text-decoration: none; }
.note :is(p, ul, ol) { max-width: 68ch; }
.note ul, .note ol { padding-left: 1.3rem; }
.note li { margin: 0.3rem 0; }

/* --- Topics page --- */
.topic { scroll-margin-top: 1.5rem; }
.topic .count { color: var(--faint); font-size: 0.85rem; font-weight: 400; font-family: var(--mono); }

/* --- Related notes --- */
.related { margin-top: 3rem; padding-top: 1.4rem; border-top: 1px solid var(--line); }
.related-title {
  font-family: var(--mono);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--faint);
  font-weight: 400;
  margin: 0 0 0.6rem;
}
.related .note-list li { grid-template-columns: 6.5rem minmax(0, 1fr); }

/* --- Code --- */
:not(pre) > code {
  font-family: var(--mono);
  font-size: 0.86em;
  background: var(--code-bg);
  padding: 0.1rem 0.35rem;
  border-radius: 0;
}
pre {
  font-family: var(--mono);
  font-size: 0.84rem;
  line-height: 1.55;
  background: var(--code-bg);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 1rem 1.1rem;
  overflow-x: auto;
}
pre code { font-family: inherit; }

/* Warm Prism token palette (build-time highlight, no client JS) */
.token.comment, .token.prolog, .token.doctype, .token.cdata { color: #a39b8c; font-style: italic; }
.token.punctuation { color: #8a7f6c; }
.token.property, .token.tag, .token.boolean, .token.number, .token.constant,
.token.symbol, .token.deleted { color: #a8703a; }      /* ochre */
.token.selector, .token.attr-name, .token.string, .token.char, .token.builtin,
.token.inserted { color: #5f7355; }                    /* olive */
.token.operator, .token.entity, .token.url { color: #8a7f6c; }
.token.atrule, .token.attr-value, .token.keyword { color: var(--accent); }  /* clay */
.token.function, .token.class-name { color: #7a6234; }  /* umber */
.token.important, .token.bold { font-weight: 700; }

/* --- Footer --- */
.site-footer {
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 1.6rem 1.5rem 3.5rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.02em;
}

/* --- Responsive --- */
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; gap: 2rem; padding-top: 2rem; }
  .sidebar { position: static; order: 2; border-top: 1px solid var(--line); padding-top: 1.4rem; }
  .content { order: 1; }
  h1 { font-size: 1.95rem; }
  .nav { gap: 1.1rem; }
}
@media (max-width: 440px) {
  .note-list li { grid-template-columns: 1fr; }
  .note-list .muted { grid-row: auto; padding-top: 0; margin-bottom: 0.2rem; }
  .note-link, .excerpt { grid-column: 1; }
}
