/* DRVS site — "darkroom"
   顯影 (the origin name for this technique) is the word for photographic
   development: an image that was already on the paper, brought up out of it.
   So the page is lit like a darkroom under safelight, and the whole visual
   system is built on the same thing the product is built on — graded opacity
   as information, not decoration. */

:root {
  /* darkroom air, deepest to raised */
  --dark:      #14161c;
  --dark-2:    #191c24;
  --raised:    #1e222b;
  --line:      #2b303b;
  --line-warm: #3a3129;

  /* safelight: the one light that doesn't destroy what's still latent */
  --safelight: #e8743b;
  --deep:      #b8452a;

  /* the latent, unfixed tone — cool against the warm safelight */
  --latent:    #8493a8;

  /* the emerged print */
  --paper:     #f0ebe1;
  --paper-dim: #bcb5a8;

  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Noto Sans TC", sans-serif;
  --display: "Archivo", var(--sans);

  --wrap: 76rem;
  --ease: cubic-bezier(.22, .61, .36, 1);

  /* Theme the package's own stylesheet rather than forking it — this block is
     the entire integration, and it is the same thing the Install section
     tells visitors to do. */
  --drvs-fg: var(--paper);
  --drvs-fg-dim: var(--paper-dim);
  --drvs-fg-faint: var(--latent);
  --drvs-bg: #101319;
  --drvs-surface: transparent;
  --drvs-line: var(--line);
  --drvs-accent: var(--safelight);
  --drvs-accent-contrast: #14110e;
  --drvs-notice: #6fb3a8;
  --drvs-mono: var(--mono);
  --drvs-radius: 4px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--dark);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  /* A faint warm gradient from the top-left, like a safelight in the corner
     of the room. One light source, not an ambient glow on every panel. */
  background-image:
    radial-gradient(60rem 40rem at 8% -10%, rgba(232, 116, 59, .09), transparent 60%),
    radial-gradient(50rem 40rem at 100% 0%, rgba(132, 147, 168, .05), transparent 55%);
  background-repeat: no-repeat;
}

.wrap { width: min(100% - 3rem, var(--wrap)); margin-inline: auto; }

h1, h2, h3 {
  font-family: var(--display);
  font-weight: 800;
  font-stretch: 112%;
  letter-spacing: -.02em;
  line-height: 1.05;
  margin: 0;
}

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

code, pre { font-family: var(--mono); }

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

.skip {
  position: absolute; left: -9999px;
  background: var(--safelight); color: #14110e;
  padding: .7rem 1.1rem; z-index: 60; font-weight: 600;
}
.skip:focus { left: 1rem; top: 1rem; }

.eyebrow {
  font-family: var(--mono);
  font-size: .74rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--safelight);
  margin: 0 0 1.1rem;
}

/* ── masthead ─────────────────────────────────────────────────────────── */

.masthead {
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: blur(10px);
  background: rgba(20, 22, 28, .82);
  border-bottom: 1px solid var(--line);
}
.masthead-in {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1.5rem; height: 3.9rem;
}
.wordmark {
  font-family: var(--display); font-weight: 800; font-stretch: 125%;
  font-size: 1.16rem; letter-spacing: .1em; color: var(--paper);
}
.masthead nav { display: flex; gap: 1.6rem; align-items: center; }
.masthead nav a {
  font-size: .84rem; color: var(--paper-dim); text-decoration: none;
  transition: color 180ms var(--ease);
}
.masthead nav a:hover { color: var(--paper); }
.masthead nav .ext { display: inline-flex; align-items: center; gap: .3rem; color: var(--safelight); }
.masthead nav .lang {
  font-family: var(--mono); font-size: .74rem; letter-spacing: .04em;
  border: 1px solid var(--line); border-radius: 3px;
  padding: .22rem .55rem; color: var(--paper-dim);
}
.masthead nav .lang:hover { border-color: var(--safelight); color: var(--safelight); }

.masthead nav .ext svg {
  width: .78em; height: .78em; fill: none; stroke: currentColor;
  stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}
@media (max-width: 720px) {
  .masthead nav a:not(.ext) { display: none; }
}

/* ── hero ─────────────────────────────────────────────────────────────── */

.hero { padding: 6.5rem 0 3.5rem; }

.hero h1 {
  font-size: clamp(2.6rem, 7.2vw, 5.4rem);
  max-width: 16ch;
  margin-bottom: 1.8rem;
}
/* The one place the safelight touches the type: the clause that states the
   thesis. Everything else in the hero stays paper-white. */
.hero h1 em {
  font-style: normal;
  color: var(--safelight);
}

.lede {
  font-size: clamp(1.02rem, 1.6vw, 1.19rem);
  color: var(--paper-dim);
  max-width: 58ch;
  margin: 0 0 2.6rem;
}
.lede em { font-style: normal; color: var(--paper); font-weight: 600; }

.facts {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 2.4rem;
  border-top: 1px solid var(--line); padding-top: 1.5rem;
}
.facts li {
  font-family: var(--mono); font-size: .78rem;
  color: var(--latent); letter-spacing: .04em;
}
.facts span {
  display: block; font-family: var(--display); font-weight: 700;
  font-size: 1.75rem; font-stretch: 112%; color: var(--paper);
  letter-spacing: -.01em; line-height: 1;  margin-bottom: .3rem;
}

/* ── section furniture ────────────────────────────────────────────────── */

.section-head { max-width: 62ch; margin-bottom: 2.6rem; }
.section-head h2 { font-size: clamp(1.7rem, 3.4vw, 2.5rem); margin-bottom: 1rem; }
.section-head p { color: var(--paper-dim); margin: 0; }
.section-head code {
  font-size: .86em; color: var(--safelight);
  background: rgba(232, 116, 59, .09); padding: .1em .4em; border-radius: 3px;
}

/* ── demo ─────────────────────────────────────────────────────────────── */

.demo { padding: 4rem 0 5.5rem; }

.try {
  display: flex; flex-wrap: wrap; gap: .5rem; align-items: center;
  margin-bottom: 1.1rem;
}
.try-label {
  font-family: var(--mono); font-size: .72rem; letter-spacing: .16em;
  text-transform: uppercase; color: var(--latent); margin-right: .3rem;
}
.chip {
  font: inherit; font-size: .85rem; cursor: pointer;
  background: transparent; color: var(--paper-dim);
  border: 1px solid var(--line); border-radius: 999px;
  padding: .38rem .85rem;
  transition: border-color 180ms var(--ease), color 180ms var(--ease);
}
.chip i {
  font-style: normal; font-family: var(--mono);
  font-size: .72rem; color: var(--latent); margin-left: .35rem;
}
.chip:hover { border-color: var(--safelight); color: var(--paper); }
.chip:hover i { color: var(--safelight); }

.panel-slot { margin-bottom: 2rem; }

.semantic-row { margin-top: .75rem; }
.semantic-toggle {
  font: inherit; font-family: var(--mono); font-size: .74rem;
  cursor: pointer; background: transparent; color: var(--latent);
  border: 1px dashed var(--line); border-radius: 4px;
  padding: .5rem .85rem;
  transition: border-color 180ms var(--ease), color 180ms var(--ease);
}
.semantic-toggle:hover:not(:disabled) { border-color: var(--safelight); color: var(--paper-dim); }
.semantic-toggle[aria-pressed="true"] {
  border-style: solid; border-color: var(--line-warm); color: var(--safelight);
}
.semantic-toggle:disabled { cursor: progress; opacity: .6; }

.noscript-note {
  border-left: 2px solid var(--safelight);
  padding: .2rem 0 .2rem 1rem; color: var(--paper-dim);
  font-size: .92rem; max-width: 62ch;
}

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

.doc {
  display: grid;
  grid-template-columns: 12rem 1fr;
  gap: 0 1.6rem;
  align-items: baseline;
  padding: 1.05rem .6rem;
  border-bottom: 1px solid var(--line);
  text-decoration: none; color: inherit;
}
/* A masked row is unreachable, not just faint — the pointer-events rule in the
   package handles interaction; this keeps the cursor honest about it. */
.doc:not(.drvs-hidden):hover { background: rgba(232, 116, 59, .045); }

.doc-id {
  font-family: var(--mono); font-size: .74rem;
  color: var(--latent); letter-spacing: .02em;
}
.doc-body { min-width: 0; }
.doc-title {
  font-size: 1.03rem; font-weight: 500; color: var(--paper);
  display: block; margin-bottom: .18rem;
}
.doc-sum {
  font-size: .87rem; color: var(--paper-dim); margin: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

@media (max-width: 640px) {
  .doc { grid-template-columns: 1fr; gap: .3rem; }
}

.corpus-foot {
  margin: 1.4rem 0 0; font-size: .86rem; color: var(--latent); max-width: 62ch;
}

/* ── the step wedge (signature) ───────────────────────────────────────── */

.wedge-section {
  padding: 5.5rem 0;
  background: var(--dark-2);
  border-block: 1px solid var(--line);
}

.wedge {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.step { background: var(--dark-2); padding: 0 0 1.3rem; }

/* The patch is the wedge itself: a calibrated density strip in safelight
   amber, each block at the exact opacity that tier renders at. */
.patch {
  height: 5.5rem;
  background: var(--safelight);
  opacity: var(--o);
  margin-bottom: 1.1rem;
}
.step.masked .patch { background: var(--latent); }

.step b {
  display: inline-block;
  font-family: var(--display); font-weight: 800; font-stretch: 112%;
  font-size: 1.5rem; line-height: 1; color: var(--paper);
  padding: 0 1rem;
}
.step .val {
  font-family: var(--mono); font-size: .74rem; color: var(--latent);
}
.step p {
  margin: .7rem 0 0; padding: 0 1rem;
  font-size: .85rem; line-height: 1.5; color: var(--paper-dim);
}

@media (max-width: 860px) {
  .wedge { grid-template-columns: repeat(2, 1fr); }
  .step:last-child { grid-column: 1 / -1; }
  .patch { height: 3.5rem; }
}
@media (max-width: 460px) {
  .wedge { grid-template-columns: 1fr; }
  .step:last-child { grid-column: auto; }
}

.wedge-note {
  margin: 1.8rem 0 0; max-width: 64ch;
  font-size: .88rem; color: var(--latent);
}
.wedge-note em { font-style: normal; color: var(--paper-dim); }
.wedge-note code { font-size: .9em; color: var(--safelight); }

/* ── channels ─────────────────────────────────────────────────────────── */

.channels { padding: 5.5rem 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}
.card {
  background: var(--dark);
  padding: 1.7rem 1.5rem 1.5rem;
  transition: background 200ms var(--ease);
}
.card:hover { background: var(--raised); }
.card h3 {
  font-size: 1.1rem; font-weight: 700; margin-bottom: .6rem;
  color: var(--paper);
}
.card p { margin: 0 0 1.1rem; font-size: .9rem; color: var(--paper-dim); }
.card code {
  display: block; font-size: .76rem; color: var(--latent);
  padding-top: .8rem; border-top: 1px dashed var(--line);
}
.card.accent { background: #1a1712; }
.card.accent:hover { background: #211c15; }
.card.accent h3 { color: var(--safelight); }
.card.accent code { color: var(--deep); border-top-color: var(--line-warm); }
.card.quiet { opacity: .68; }

/* ── principles ───────────────────────────────────────────────────────── */

.principles {
  padding: 5.5rem 0;
  background: var(--dark-2);
  border-block: 1px solid var(--line);
}
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: 2.5rem; }
.pair h3 {
  font-size: 1rem; font-weight: 700; margin-bottom: .8rem;
  font-stretch: 100%; letter-spacing: 0;
}
.pair p { margin: 0; color: var(--paper-dim); font-size: .95rem; }
.pair em { font-style: italic; color: var(--paper); }
.do { border-left: 2px solid var(--safelight); padding-left: 1.4rem; }
.dont { border-left: 2px solid var(--line); padding-left: 1.4rem; }
.do h3 { color: var(--safelight); }
.dont h3 { color: var(--latent); }
@media (max-width: 760px) { .pair { grid-template-columns: 1fr; gap: 1.8rem; } }

/* ── install ──────────────────────────────────────────────────────────── */

.install { padding: 5.5rem 0 6rem; }

.cols {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
  gap: 2.2rem;
  margin-bottom: 3.5rem;
}
.col h3 {
  display: flex; align-items: center; gap: .7rem;
  font-size: 1.02rem; font-weight: 700; font-stretch: 100%;
  letter-spacing: 0; margin-bottom: .7rem;
}
/* Numbered because these steps genuinely are a sequence — you cannot mount
   the UI before an index exists. */
.num {
  font-family: var(--mono); font-size: .72rem; font-weight: 500;
  color: var(--safelight); border: 1px solid var(--line-warm);
  width: 1.6rem; height: 1.6rem; border-radius: 50%;
  display: grid; place-items: center; flex: none;
}
.col > p { font-size: .9rem; color: var(--paper-dim); margin: 0 0 1rem; }

pre {
  margin: 0; padding: 1.1rem 1.2rem; overflow-x: auto;
  background: #101319; border: 1px solid var(--line);
  border-radius: 5px; font-size: .8rem; line-height: 1.65;
  color: var(--paper-dim);
}
pre .k { color: var(--safelight); }
pre .s { color: #8fb8a8; }
pre .c { color: var(--latent); font-style: italic; }
pre .v { color: #c2a878; }
pre .p { color: var(--paper); }

.honest {
  border: 1px solid var(--line-warm);
  background: #1a1712;
  padding: 1.8rem 1.9rem;
  margin-bottom: 2.5rem;
}
.honest h3 {
  font-size: 1.02rem; font-weight: 700; font-stretch: 100%;
  letter-spacing: 0; color: var(--safelight); margin-bottom: .8rem;
}
.honest p { margin: 0 0 .9rem; font-size: .92rem; color: var(--paper-dim); max-width: 68ch; }
.honest p:last-child { margin-bottom: 0; }
.honest code { color: var(--safelight); font-size: .9em; }

.cta-row { display: flex; flex-wrap: wrap; gap: .7rem; }
.btn {
  font-size: .88rem; text-decoration: none; cursor: pointer;
  padding: .72rem 1.3rem; border: 1px solid var(--line);
  color: var(--paper-dim); border-radius: 4px;
  transition: border-color 180ms var(--ease), color 180ms var(--ease);
}
.btn:hover { border-color: var(--safelight); color: var(--paper); }
.btn.primary {
  background: var(--safelight); border-color: var(--safelight); color: #14110e;
  font-weight: 600;
}
.btn.primary:hover { background: #f08850; border-color: #f08850; color: #14110e; }

/* ── document pages (/demo/{id}/) ─────────────────────────────────────── */

.doc-page { padding: 3.5rem 0 5rem; }
.doc-page .wrap { max-width: 50rem; }

.back {
  display: inline-flex; align-items: center; gap: .45rem;
  font-family: var(--mono); font-size: .76rem; letter-spacing: .04em;
  color: var(--latent); text-decoration: none; margin-bottom: 2.6rem;
  transition: color 180ms var(--ease);
}
.back:hover { color: var(--safelight); }
.back svg {
  width: .9em; height: .9em; fill: none; stroke: currentColor;
  stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round;
}

.art-head { border-bottom: 1px solid var(--line); padding-bottom: 1.8rem; margin-bottom: 2.4rem; }
.art-id {
  font-family: var(--mono); font-size: .74rem; letter-spacing: .06em;
  color: var(--safelight); margin: 0 0 .9rem;
}
.art-head h1 {
  font-size: clamp(1.85rem, 4.4vw, 2.9rem);
  margin-bottom: .9rem; line-height: 1.15;
}
.art-meta {
  margin: 0; font-family: var(--mono); font-size: .74rem;
  color: var(--latent); letter-spacing: .03em;
}

/* The corpus is Chinese prose; give it the line-height and measure CJK
   actually needs rather than the Latin body defaults used elsewhere. */
.art-body { font-size: 1.04rem; line-height: 1.95; }
.art-body p { margin: 0 0 1.5rem; color: var(--paper-dim); }
.art-body h2 {
  font-size: 1.16rem; font-weight: 700; font-stretch: 100%;
  letter-spacing: 0; color: var(--paper);
  margin: 2.6rem 0 1rem; padding-left: .85rem;
  border-left: 2px solid var(--safelight);
  line-height: 1.4;
}

/* ── extracted-record panel ───────────────────────────────────────────── */

.extracted {
  margin-top: 4rem; padding: 1.9rem;
  border: 1px solid var(--line); background: var(--dark-2);
}
.extracted h2 {
  font-size: 1.02rem; font-weight: 700; font-stretch: 100%;
  letter-spacing: 0; margin-bottom: .7rem;
}
.extracted-intro {
  margin: 0 0 1.6rem; font-size: .87rem; color: var(--paper-dim); max-width: 60ch;
}
.extracted-intro code { font-size: .9em; color: var(--safelight); }

.fields { margin: 0; }
.field {
  display: grid; grid-template-columns: 11rem 1fr; gap: 0 1.4rem;
  padding: .85rem 0; border-top: 1px solid var(--line);
  align-items: baseline;
}
.field dt {
  font-family: var(--mono); font-size: .76rem; color: var(--paper);
  display: flex; flex-direction: column; gap: .35rem; align-items: flex-start;
}
.field dd {
  margin: 0; font-size: .89rem; color: var(--paper-dim);
  line-height: 1.7; min-width: 0; overflow-wrap: anywhere;
}
.field dd em { color: var(--latent); font-style: italic; }

/* Provenance badge. Author-declared and system-inferred must never be
   mistakable for one another at a glance — that confusion is the exact thing
   the source tags exist to prevent. */
.src {
  font-family: var(--mono); font-size: .6rem; letter-spacing: .08em;
  text-transform: uppercase; padding: .18rem .45rem; border-radius: 2px;
  white-space: nowrap; font-weight: 500;
}
.src-author { color: var(--safelight); border: 1px solid var(--line-warm); background: rgba(232,116,59,.07); }
.src-system { color: var(--latent); border: 1px dashed var(--line); }

.chip-val {
  font-family: var(--mono); font-size: .78rem; color: var(--paper);
  background: rgba(240, 235, 225, .05); border: 1px solid var(--line);
  padding: .12rem .45rem; border-radius: 3px; display: inline-block;
  margin: 0 .18rem .3rem 0;
}

@media (max-width: 620px) {
  .field { grid-template-columns: 1fr; gap: .5rem; }
  .field dt { flex-direction: row; align-items: center; gap: .6rem; }
}

/* ── curated relations ────────────────────────────────────────────────── */

.related { margin-top: 2.4rem; }
.related h2 {
  font-size: 1.02rem; font-weight: 700; font-stretch: 100%;
  letter-spacing: 0; margin-bottom: .7rem;
}
.related-intro {
  margin: 0 0 1.2rem; font-size: .87rem; color: var(--paper-dim); max-width: 62ch;
}
.related ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.related li { border-bottom: 1px solid var(--line); }
.rel {
  display: grid; grid-template-columns: 13rem 1fr; gap: 0 1.4rem;
  padding: 1rem .5rem; text-decoration: none; color: inherit;
  align-items: baseline;
  transition: background 180ms var(--ease);
}
.rel:hover { background: rgba(232, 116, 59, .045); }
.rel-id { font-family: var(--mono); font-size: .74rem; color: var(--latent); }
.rel-title { font-size: .98rem; color: var(--paper); }
@media (max-width: 620px) {
  .rel { grid-template-columns: 1fr; gap: .25rem; }
}

/* ── footer ───────────────────────────────────────────────────────────── */

footer { border-top: 1px solid var(--line); padding: 3rem 0 4rem; }
.foot-in {
  display: flex; justify-content: space-between;
  gap: 2rem; flex-wrap: wrap; align-items: flex-start;
}
.foot-mark {
  font-family: var(--display); font-weight: 800; font-stretch: 125%;
  letter-spacing: .1em; margin: 0 0 .5rem; font-size: 1rem;
}
.foot-note { margin: 0; font-size: .84rem; color: var(--latent); max-width: 44ch; }
.foot-links { display: flex; gap: 1.5rem; flex-wrap: wrap; font-size: .84rem; }
.foot-links a { color: var(--paper-dim); text-decoration: none; }
.foot-links a:hover { color: var(--safelight); }
.foot-links span { color: var(--latent); font-family: var(--mono); font-size: .78rem; }
