/* pageweave/resources — "The Index"
   Sibling of pageweave.dev's dark editorial: same paper/ink/iris DNA,
   catalog voice. Grotesk-led display, IBM Plex Mono for paths & meta. */

:root {
  --paper: #121118;
  --paper-2: #191820;
  --paper-3: #211f29;
  --ink: #edecef;
  --ink-dim: #b4b1be;
  --ink-faint: #6e6b7a;
  --iris: #a79bf5;
  --iris-soft: #c9c1fa;
  --hairline: rgba(237, 236, 239, 0.09);
  --sans: "Schibsted Grotesk", ui-sans-serif, system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, monospace;
}

html { background: var(--paper); }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

main { flex: 1; }
a { color: inherit; }
::selection { background: rgba(167, 155, 245, 0.28); }
:focus-visible { outline: 2px solid var(--iris); outline-offset: 2px; border-radius: 2px; }

.wrap { max-width: 1060px; margin-inline: auto; padding-inline: clamp(1.25rem, 4vw, 2.5rem); }
.mono { font-family: var(--mono); }

/* ── top bar ─────────────────────────────────────────── */
.bar {
  border-bottom: 1px solid var(--hairline);
  background: rgba(18, 17, 24, 0.88);
  backdrop-filter: blur(6px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.bar-in {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 3.25rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.02em;
}
.bar-brand { text-decoration: none; color: var(--ink); white-space: nowrap; }
.bar-brand .bar-dim { color: var(--ink-faint); }
.bar-sep { color: var(--iris); padding-inline: 0.05rem; }
.bar-nav { display: flex; gap: 1.5rem; }
.bar-nav a { color: var(--ink-dim); text-decoration: none; transition: color 0.15s ease; }
.bar-nav a:hover { color: var(--iris-soft); }

/* ── hero ────────────────────────────────────────────── */
.intro { padding-block: clamp(3.5rem, 9vw, 6.5rem) clamp(2.5rem, 6vw, 4rem); max-width: 46rem; }
.kicker {
  font-family: var(--mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--iris);
}
.display {
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.04;
  font-size: clamp(2.1rem, 5.5vw, 3.4rem);
  margin-top: 0.9rem;
  text-wrap: balance;
}
.lead {
  color: var(--ink-dim);
  font-size: 1.0625rem;
  line-height: 1.65;
  margin-top: 1.1rem;
  max-width: 38rem;
}
.lead code {
  font-family: var(--mono);
  font-size: 0.85em;
  color: var(--iris-soft);
  background: var(--paper-2);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

/* ── sections ────────────────────────────────────────── */
.sec { border-top: 1px solid var(--hairline); padding-block: 2.25rem 3rem; }
.sec-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.sec-title { font-size: 1.375rem; font-weight: 600; letter-spacing: -0.02em; }
.sec-meta {
  font-family: var(--mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--ink-faint);
}

/* ── skills ledger ───────────────────────────────────── */
.row {
  display: grid;
  grid-template-columns: 3.25rem 1fr auto;
  gap: 0.25rem 1.25rem;
  align-items: start;
  padding-block: 1.15rem;
  border-bottom: 1px solid var(--hairline);
}
.row:last-of-type { border-bottom: none; }
.row-main { min-width: 0; }
.row-i {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-faint);
  padding-top: 0.3rem;
  font-variant-numeric: tabular-nums;
}
.row-line { display: flex; align-items: baseline; gap: 0.75rem; min-width: 0; }
.row-name {
  font-weight: 600;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--ink);
  transition: color 0.15s ease;
}
.row-name:hover { color: var(--iris-soft); }
.dots {
  flex: 1;
  border-bottom: 1px dotted rgba(237, 236, 239, 0.22);
  transform: translateY(-0.28em);
  min-width: 1.5rem;
}
.row-md {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-dim);
  text-decoration: none;
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
  white-space: nowrap;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.row-md:hover { color: var(--iris-soft); border-color: rgba(167, 155, 245, 0.5); }
.row-desc {
  color: var(--ink-dim);
  font-size: 0.9rem;
  line-height: 1.55;
  max-width: 40rem;
  margin-top: 0.35rem;
}
.chip {
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--ink-dim);
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  white-space: nowrap;
  justify-self: end;
  margin-top: 0.15rem;
}

/* ── references tree ─────────────────────────────────── */
.tree-group + .tree-group { margin-top: 1.75rem; }
.tree-skill { font-family: var(--mono); font-size: 0.75rem; color: var(--ink-faint); margin-bottom: 0.6rem; }
.tree { list-style: none; padding: 0; margin: 0; }
.tree li { display: flex; align-items: baseline; gap: 0.75rem; padding-block: 0.45rem; border-bottom: 1px solid var(--hairline); }
.tree li:last-child { border-bottom: none; }
.tree-name { font-family: var(--mono); font-size: 0.8125rem; color: var(--ink-dim); }
.tree .row-md { border: none; padding: 0; }

/* ── format spec ─────────────────────────────────────── */
.spec-grid {
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--paper-2);
  overflow: hidden;
  font-family: var(--mono);
  font-size: 0.8125rem;
}
.spec-line {
  display: grid;
  grid-template-columns: minmax(14rem, auto) 1fr;
  gap: 1.25rem;
  padding: 0.9rem 1.1rem;
}
.spec-line + .spec-line { border-top: 1px solid var(--hairline); }
.spec-k { color: var(--iris-soft); white-space: nowrap; }
.spec-v { color: var(--ink-dim); line-height: 1.55; }
.spec-v code { color: var(--ink); font-size: 0.95em; }

/* ── article pages ───────────────────────────────────── */
.art { padding-block: 2.5rem 4rem; width: 100%; max-width: 53rem; }
.crumbs {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-faint);
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: baseline;
}
.crumbs a { color: var(--ink-dim); text-decoration: none; transition: color 0.15s ease; }
.crumbs a:hover { color: var(--iris-soft); }
.crumb-cur { color: var(--ink); }
.art-title { font-size: clamp(1.9rem, 4.5vw, 2.75rem); margin-top: 1.4rem; }
.art-desc { margin-top: 0.9rem; }
.meta {
  margin-top: 1.1rem;
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--ink-faint);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.6rem;
  align-items: baseline;
}
.meta a {
  color: var(--ink-dim);
  text-decoration: underline;
  text-decoration-color: rgba(167, 155, 245, 0.4);
  text-underline-offset: 3px;
}
.meta a:hover { color: var(--iris-soft); text-decoration-color: var(--iris-soft); }
.art .prose-r { margin-top: 2.5rem; }
.refs { margin-top: 3rem; border-top: 1px solid var(--hairline); padding-top: 1.75rem; }
.refs .sec-title { margin-bottom: 1rem; }
.backlink { margin-top: 3rem; font-family: var(--mono); font-size: 0.75rem; }
.backlink a { color: var(--ink-dim); text-decoration: none; }
.backlink a:hover { color: var(--iris-soft); }

/* ── prose (markdownify output) ──────────────────────── */
.prose-r { font-size: 0.975rem; line-height: 1.75; color: var(--ink-dim); }
.prose-r > :first-child { margin-top: 0; }
.prose-r h1, .prose-r h2, .prose-r h3, .prose-r h4 {
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin: 2.25rem 0 0.75rem;
}
.prose-r h1 { font-size: 1.5rem; }
.prose-r h2 { font-size: 1.25rem; }
.prose-r h3 { font-size: 1.05rem; }
.prose-r p, .prose-r ul, .prose-r ol { margin-block: 0.9rem; }
.prose-r strong, .prose-r em { color: var(--ink); }
.prose-r strong { font-weight: 600; }
.prose-r a {
  color: var(--iris-soft);
  text-decoration: underline;
  text-decoration-color: rgba(167, 155, 245, 0.4);
  text-underline-offset: 3px;
}
.prose-r a:hover { text-decoration-color: var(--iris-soft); }
.prose-r code {
  font-family: var(--mono);
  font-size: 0.82em;
  color: var(--iris-soft);
  background: var(--paper-2);
  border: 1px solid var(--hairline);
  border-radius: 4px;
  padding: 0.12em 0.4em;
}
.prose-r pre {
  background: var(--paper-2);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 1.1rem 1.25rem;
  overflow-x: auto;
  margin-block: 1.25rem;
  line-height: 1.6;
}
.prose-r pre code { background: none; border: none; padding: 0; color: var(--ink-dim); font-size: 0.8125rem; }
.prose-r ul { list-style: none; padding-left: 0; }
.prose-r ul li { padding-left: 1.25rem; position: relative; margin-block: 0.35rem; }
.prose-r ul li::before { content: "—"; position: absolute; left: 0; color: var(--ink-faint); }
.prose-r ol { padding-left: 1.5rem; }
.prose-r ol li { margin-block: 0.35rem; }
.prose-r ol li::marker { color: var(--ink-faint); font-family: var(--mono); font-size: 0.85em; }
.prose-r blockquote { border-left: 2px solid var(--iris); padding-left: 1.1rem; margin-block: 1.25rem; }
.prose-r hr { border: none; border-top: 1px solid var(--hairline); margin-block: 2rem; }
.prose-r table { width: 100%; border-collapse: collapse; font-size: 0.875rem; margin-block: 1.25rem; }
.prose-r th, .prose-r td { border-bottom: 1px solid var(--hairline); text-align: left; padding: 0.5rem 0.75rem 0.5rem 0; }
.prose-r th {
  font-family: var(--mono);
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--ink-faint);
  font-weight: 500;
}
.prose-r img { max-width: 100%; border-radius: 10px; border: 1px solid var(--hairline); }

/* ── footer ──────────────────────────────────────────── */
.foot { border-top: 1px solid var(--hairline); margin-top: 4rem; }
.foot-in {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 2rem;
  align-items: center;
  justify-content: space-between;
  padding-block: 1.4rem;
  font-family: var(--mono);
  font-size: 0.6875rem;
  color: var(--ink-faint);
}
.foot a { color: var(--ink-dim); text-decoration: none; }
.foot a:hover { color: var(--iris-soft); }

/* ── small screens ───────────────────────────────────── */
@media (max-width: 640px) {
  .row { grid-template-columns: 2.25rem 1fr; }
  .chip { grid-column: 2; justify-self: start; margin-top: 0.35rem; }
  .bar-nav a[data-optional] { display: none; }
  .spec-line { grid-template-columns: 1fr; gap: 0.3rem; }
  .spec-k { white-space: normal; word-break: break-all; }
}
