@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Space+Mono:wght@400;700&display=swap');

:root {
  --font-dm: 'DM Sans';
  --font-mono: 'Space Mono';
}

:root {
  --quartz: #eceef1;
  --quartz-deep: #e2e6ec;
  --surface: #ffffff;
  --ink: #2a2e35;
  --ink-soft: #4b515b;
  --muted: #767d89;
  --slate: #46607c;
  --slate-deep: #36495f;
  --slate-tint: #eaf0f6;
  --line: #d7dbe1;
  --line-soft: #e6e9ee;
  --mono-bg: #e4e8ee;
  --radius: 12px;
  --shadow: 0 1px 0 var(--line), 0 14px 32px -28px rgba(42, 46, 53, 0.55);
  --container: 1180px;
  --jumpbar-h: 54px;
  font-family: var(--font-dm), system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--quartz);
  color: var(--ink);
  font-family: var(--font-dm), system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: var(--font-mono), ui-monospace, monospace;
  font-variant-ligatures: none;
}

a {
  color: var(--slate);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--ink);
  color: var(--surface);
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  z-index: 60;
}
.skip-link:focus {
  left: 0;
}

/* ---------------- Directory masthead + sticky jump-bar ---------------- */
.dir-masthead {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.dir-masthead__bar {
  max-width: var(--container);
  margin: 0 auto;
  padding: 18px 28px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.dir-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  text-decoration: none;
  color: var(--ink);
}

.dir-wordmark__mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 9px;
  background: var(--slate);
  color: var(--surface);
  font-family: var(--font-mono), monospace;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.04em;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.dir-wordmark__text {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}
.dir-wordmark__name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
.dir-wordmark__sub {
  font-family: var(--font-mono), monospace;
  font-size: 10.5px;
  letter-spacing: 0.26em;
  color: var(--muted);
  margin-top: 3px;
}

.dir-masthead__tag {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
  text-align: right;
  max-width: 320px;
}

.dir-jumpbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(248, 249, 251, 0.92);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line);
}

.dir-jumpbar {
  display: flex;
  justify-content: flex-start;
  gap: 4px;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 22px;
  overflow-x: auto;
  scrollbar-width: none;
  height: var(--jumpbar-h);
  align-items: stretch;
}
.dir-jumpbar::-webkit-scrollbar {
  display: none;
}

.dir-jumptab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  text-decoration: none;
  color: var(--ink-soft);
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.dir-jumptab:hover {
  color: var(--slate-deep);
  border-bottom-color: var(--slate);
  background: var(--slate-tint);
}
.dir-jumptab__idx {
  font-family: var(--font-mono), monospace;
  font-size: 11px;
  color: var(--slate);
}
.dir-jumptab__name {
  font-size: 14px;
  font-weight: 500;
}
.dir-jumptab--home .dir-jumptab__name {
  font-weight: 700;
}

/* ---------------- Home: lead band ---------------- */
.dir-main {
  max-width: var(--container);
  margin: 0 auto;
  padding: 28px 28px 12px;
}

.dir-lead {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  color: var(--surface);
  background-image: linear-gradient(155deg, rgba(54, 73, 95, 0.92), rgba(70, 96, 124, 0.78)),
    url("/images/quartzvillage-lead.jpg");
  background-size: cover;
  background-position: center;
  box-shadow: 0 22px 48px -34px rgba(42, 46, 53, 0.8);
}

.dir-lead__inner {
  max-width: 720px;
  padding: 46px 44px 40px;
}
.dir-lead__eyebrow {
  font-family: var(--font-mono), monospace;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.82);
  margin: 0 0 14px;
}
.dir-lead h1 {
  margin: 0;
  font-size: 40px;
  line-height: 1.12;
  letter-spacing: -0.02em;
  font-weight: 700;
  max-width: 16ch;
}
.dir-lead__sub {
  margin: 18px 0 0;
  font-size: 16.5px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.9);
  max-width: 56ch;
}
.dir-lead__meta {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 0;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.85);
}
.dir-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
}

/* ---------------- Home: category index ---------------- */
.dir-index {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 24px;
}

.dir-cat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  scroll-margin-top: calc(var(--jumpbar-h) + 16px);
  overflow: hidden;
}

.dir-cat__head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 18px;
  padding: 22px 26px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, #fbfcfd, var(--surface));
}
.dir-cat__code {
  font-family: var(--font-mono), monospace;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--surface);
  background: var(--slate);
  padding: 6px 10px;
  border-radius: 7px;
  margin-top: 3px;
}
.dir-cat__title h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.01em;
  font-weight: 700;
}
.dir-cat__title p {
  margin: 5px 0 0;
  font-size: 14.5px;
  color: var(--muted);
  max-width: 64ch;
}
.dir-cat__count {
  font-size: 12px;
  color: var(--ink-soft);
  background: var(--mono-bg);
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
  margin-top: 4px;
}

.dir-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.dir-entry + .dir-entry {
  border-top: 1px solid var(--line-soft);
}

.dir-entry__link,
.dir-entry__static {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  align-items: start;
  gap: 18px;
  padding: 18px 26px;
  text-decoration: none;
  color: inherit;
}
.dir-entry__link {
  transition: background 0.14s ease;
}
.dir-entry__link:hover {
  background: var(--slate-tint);
}

.dir-entry__code {
  font-family: var(--font-mono), monospace;
  font-size: 12.5px;
  color: var(--slate);
  padding-top: 2px;
}
.dir-entry__main {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.dir-entry__title {
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--ink);
}
.dir-entry__link:hover .dir-entry__title {
  color: var(--slate-deep);
}
.dir-entry__blurb {
  font-size: 14px;
  color: var(--muted);
  max-width: 70ch;
}
.dir-entry__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 3px;
}
.dir-chip {
  font-family: var(--font-mono), monospace;
  font-size: 11px;
  letter-spacing: 0.01em;
  color: var(--ink-soft);
  background: var(--quartz-deep);
  border: 1px solid var(--line);
  padding: 3px 9px;
  border-radius: 6px;
}
.dir-entry__tail {
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--slate);
  padding-top: 4px;
}
.dir-entry__static .dir-entry__tail {
  color: var(--muted);
}

/* ---------------- Home: method band ---------------- */
.dir-method {
  margin: 22px 0 8px;
  background: var(--ink);
  color: #e9ecf1;
  border-radius: var(--radius);
  padding: 26px 28px 22px;
}
.dir-method__code {
  font-size: 11.5px;
  letter-spacing: 0.18em;
  color: #aeb8c6;
}
.dir-method ul {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}
.dir-method li {
  position: relative;
  padding-left: 20px;
  font-size: 14.5px;
  color: #d8dde4;
}
.dir-method li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--slate);
}
.dir-method__sig {
  margin: 18px 0 0;
  font-size: 12.5px;
  color: #9aa4b2;
}

/* ---------------- Footer ---------------- */
.dir-foot {
  border-top: 1px solid var(--line);
  background: var(--surface);
  margin-top: 30px;
}
.dir-foot__inner {
  max-width: var(--container);
  margin: 0 auto;
  padding: 26px 28px 34px;
}
.dir-foot__mark {
  margin: 0;
  font-weight: 700;
  font-size: 16px;
}
.dir-foot__line {
  margin: 6px 0 0;
  font-size: 13.5px;
  color: var(--muted);
  max-width: 70ch;
}
.dir-foot__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 16px;
}
.dir-foot__nav a {
  font-family: var(--font-mono), monospace;
  font-size: 12.5px;
  color: var(--ink-soft);
  text-decoration: none;
}
.dir-foot__nav a:hover {
  color: var(--slate-deep);
}

/* ---------------- Article: directory entry ---------------- */
.entry-shell {
  max-width: 840px;
  margin: 0 auto;
  padding: 30px 28px 16px;
}

.entry {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 34px 40px 38px;
}

.entry-head {
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 22px;
}
.entry-rail {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.entry-rail__code {
  color: var(--surface);
  background: var(--slate);
  padding: 4px 9px;
  border-radius: 6px;
  letter-spacing: 0.08em;
}
.entry-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--line);
}
.entry-head h1 {
  margin: 0;
  font-size: 33px;
  line-height: 1.16;
  letter-spacing: -0.02em;
  font-weight: 700;
}
.entry-stamp {
  display: flex;
  flex-wrap: wrap;
  gap: 26px;
  margin: 20px 0 0;
}
.entry-stamp div {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.entry-stamp dt {
  font-size: 10.5px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.entry-stamp dd {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.entry-fields {
  display: grid;
  gap: 14px;
  margin: 24px 0 28px;
}
.entry-field {
  border: 1px solid var(--line);
  border-left: 3px solid var(--slate);
  border-radius: 10px;
  background: #fafbfc;
  padding: 16px 20px;
}
.entry-field__label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--slate-deep);
  margin-bottom: 8px;
}
.entry-field--summary p {
  margin: 0;
  font-size: 16.5px;
  line-height: 1.6;
  color: var(--ink-soft);
}
.entry-field__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

/* ---------------- Injected article content ---------------- */
.entry-content {
  font-size: 16.5px;
  line-height: 1.72;
  color: var(--ink-soft);
}
.entry-content > *:first-child {
  margin-top: 0;
}
.entry-content h2 {
  margin: 34px 0 12px;
  font-size: 22px;
  line-height: 1.25;
  letter-spacing: -0.01em;
  color: var(--ink);
  font-weight: 700;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}
.entry-content h3 {
  margin: 24px 0 8px;
  font-size: 18px;
  color: var(--ink);
  font-weight: 700;
}
.entry-content p {
  margin: 0 0 16px;
}
.entry-content a {
  color: var(--slate-deep);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: rgba(70, 96, 124, 0.45);
}
.entry-content a:hover {
  text-decoration-color: var(--slate);
}
.entry-content ul,
.entry-content ol {
  margin: 0 0 18px;
  padding-left: 0;
  list-style: none;
}
.entry-content ul li {
  position: relative;
  padding-left: 24px;
  margin-bottom: 9px;
}
.entry-content ul li::before {
  content: "";
  position: absolute;
  left: 4px;
  top: 10px;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: var(--slate);
}
.entry-content ol {
  counter-reset: step;
  padding-left: 0;
}
.entry-content ol li {
  position: relative;
  padding-left: 30px;
  margin-bottom: 9px;
  counter-increment: step;
}
.entry-content ol li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 2px;
  font-family: var(--font-mono), monospace;
  font-size: 12px;
  color: var(--slate);
}
.entry-content blockquote {
  margin: 22px 0;
  padding: 16px 22px;
  background: var(--slate-tint);
  border-left: 4px solid var(--slate);
  border-radius: 0 10px 10px 0;
  color: var(--slate-deep);
  font-size: 17px;
  font-style: italic;
}
.entry-content blockquote p {
  margin: 0;
}
.entry-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 22px 0;
  font-size: 14.5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.entry-content thead th {
  background: var(--ink);
  color: #f1f3f6;
  text-align: left;
  font-weight: 600;
  padding: 11px 14px;
  font-size: 13px;
  letter-spacing: 0.01em;
}
.entry-content tbody td {
  padding: 11px 14px;
  border-top: 1px solid var(--line-soft);
  vertical-align: top;
  color: var(--ink-soft);
}
.entry-content tbody tr:nth-child(even) {
  background: #f7f9fb;
}

/* ---------------- Article: FAQ + sources + foot ---------------- */
.entry-faq {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}
.entry-faq h2,
.entry-sources h2 {
  font-size: 20px;
  margin: 0 0 14px;
  letter-spacing: -0.01em;
}
.entry-faq details {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px 18px;
  margin-bottom: 10px;
  background: var(--surface);
}
.entry-faq summary {
  cursor: pointer;
  font-weight: 600;
  padding: 12px 0;
  list-style: none;
  position: relative;
  padding-right: 28px;
  color: var(--ink);
}
.entry-faq summary::-webkit-details-marker {
  display: none;
}
.entry-faq summary::after {
  content: "+";
  position: absolute;
  right: 2px;
  top: 11px;
  font-family: var(--font-mono), monospace;
  color: var(--slate);
  font-size: 18px;
  line-height: 1;
}
.entry-faq details[open] summary::after {
  /* CSS-drawn minus bar, no dash character */
  content: "";
  width: 12px;
  height: 2px;
  top: 20px;
  right: 2px;
  background: var(--slate);
}
.entry-faq details p {
  margin: 0 0 14px;
  color: var(--ink-soft);
  font-size: 15px;
}

.entry-sources {
  margin-top: 30px;
  padding: 20px 22px;
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.entry-sources p {
  margin: 0;
  font-size: 14.5px;
  color: var(--muted);
}

.entry-foot {
  margin-top: 26px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.entry-back {
  font-family: var(--font-mono), monospace;
  font-size: 13px;
  text-decoration: none;
  color: var(--slate-deep);
  border: 1px solid var(--line);
  padding: 9px 16px;
  border-radius: 8px;
  background: var(--surface);
  transition: background 0.14s ease, border-color 0.14s ease;
}
.entry-back:hover {
  background: var(--slate-tint);
  border-color: var(--slate);
}
.entry-back--cat {
  color: var(--ink-soft);
}

/* ---------------- Responsive ---------------- */
@media (max-width: 880px) {
  .dir-masthead__bar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .dir-masthead__tag {
    text-align: left;
  }
  .dir-lead__inner {
    padding: 34px 26px 30px;
  }
  .dir-lead h1 {
    font-size: 30px;
  }
  .dir-cat__head {
    grid-template-columns: auto 1fr;
  }
  .dir-cat__count {
    grid-column: 1 / -1;
    justify-self: start;
  }
  .dir-entry__link,
  .dir-entry__static {
    grid-template-columns: 56px 1fr;
  }
  .dir-entry__tail {
    display: none;
  }
  .entry {
    padding: 24px 22px 28px;
  }
  .entry-head h1 {
    font-size: 27px;
  }
  .entry-content {
    font-size: 16px;
  }
  .entry-content table {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
  }
}
