/* MD1 product pages — the page drawn as a Markdown file.
 *
 * One unit: --line (28px). Every block is a whole number of lines, so the
 * gutter numbers sit on baselines without padding. Five type sizes:
 * 14 (meta, mono), 16 (body), 18 (lead), 40 (##), 88 (#, price).
 * Every text colour below reaches 4.5:1 on --ground (the PR carries the
 * measured table); borders reach 3:1.
 */

:root {
  --line: 28px;
  --ground: #0B0B0C;
  --panel: #141415;
  --ink: #F2F2EE;
  --ink-2: #BDBDB8;
  --dim: #86867F;      /* gutter numbers, # markers, meta — 5.37:1 */
  --rule: #636360;     /* borders and outlines — 3.26:1 */
  --lime: #C6F432;
  --minus: #FF8A7A;
  --gutter: 64px;
  --gap: 32px;
  --wrap: 1200px;
  --side: 40px;

  --sans: -apple-system, system-ui, "Inter Tight", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  /* Mono for digits and markers only: the CJK fallback lands on the text face. */
  --mono: ui-monospace, "SF Mono", Menlo, "Hiragino Sans", "Noto Sans JP", monospace;

  color-scheme: dark;
}

* { box-sizing: border-box; }

html {
  background: var(--ground);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--line) * 3);
}

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: var(--line);
  font-feature-settings: "palt";
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

:lang(en) body, body:lang(en) { font-feature-settings: normal; }

h1, h2, h3, p, ul, ol, figure, blockquote, pre { margin: 0; }
ul, ol { padding: 0; list-style: none; }

a { color: var(--ink); text-decoration-color: var(--dim); text-underline-offset: 4px; }
a:hover { color: var(--lime); text-decoration-color: var(--lime); }

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

::selection { background: var(--lime); color: var(--ground); }

.skip {
  position: absolute; left: 16px; top: -100px;
  background: var(--lime); color: var(--ground);
  padding: 0 16px; line-height: calc(var(--line) * 1.5);
  z-index: 10; font-weight: 700;
}
.skip:focus { top: 8px; }

.mono { font-family: var(--mono); }
.phrase { white-space: nowrap; }
.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

/* --- The file: rows with a gutter --------------------------------------- */

.wrap { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--side); }

.file { counter-reset: ln; }

.l {
  display: grid;
  grid-template-columns: var(--gutter) minmax(0, 1fr);
  column-gap: var(--gap);
  align-items: baseline;
}
.l + .l { margin-top: 0; }

.g {
  font-family: var(--mono);
  font-size: 14px;
  line-height: var(--line);
  color: var(--dim);
  text-align: right;
  user-select: none;
  -webkit-user-select: none;
  font-variant-numeric: tabular-nums;
}
.file .g:empty::before { counter-increment: ln; content: counter(ln); }
.blank { height: var(--line); }

/* A section opens with two unnumbered lines of space, like a page break. */
.sec { padding-top: calc(var(--line) * 3); }

.mk { color: var(--dim); font-weight: 500; font-family: var(--mono); }

/* --- Type ---------------------------------------------------------------- */

h1 {
  font-size: 88px;
  line-height: calc(var(--line) * 4);
  font-weight: 800;
  letter-spacing: 0;
}
h1 .mk { font-size: 56px; margin-right: 0.15em; }

h2 {
  font-size: 40px;
  line-height: calc(var(--line) * 2);
  font-weight: 800;
  letter-spacing: 0;
}
h2 .mk { font-size: 28px; margin-right: 0.2em; }

:lang(en) h1 { letter-spacing: -0.02em; }
:lang(en) h2 { letter-spacing: -0.01em; }

/* Hang the closing 。 of a large heading into the margin. */
.kuten { display: inline-block; margin-right: -0.45em; }
h1, h2 { hanging-punctuation: allow-end; }

h3 { font-size: 16px; line-height: var(--line); font-weight: 700; }

.lead { font-size: 18px; line-height: var(--line); color: var(--ink-2); max-width: 36em; }
.body { color: var(--ink-2); max-width: 38em; }
.meta { font-size: 14px; color: var(--dim); }
.meta code, .body code { font-family: var(--mono); font-size: 14px; color: var(--ink); }


/* --- Header -------------------------------------------------------------- */

.top {
  position: sticky; top: 0; z-index: 5;
  background: var(--ground);
  border-bottom: 1px solid var(--rule);
}
.top .wrap {
  display: flex; align-items: center; justify-content: space-between;
  gap: 24px; height: calc(var(--line) * 2.5);
}
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; }
.brand img { width: 32px; height: 32px; display: block; border: 1px solid var(--rule); border-radius: 7px; }
.brand .path { font-family: var(--mono); font-size: 14px; color: var(--dim); }
.brand .path b { color: var(--ink); font-weight: 500; }
.nav { position: relative; display: flex; gap: 24px; font-family: var(--mono); font-size: 14px; }
.nav a { text-decoration: none; color: var(--ink-2); }
.nav a .mk { margin-right: 0.4em; }
.nav a:hover { color: var(--lime); }
/* The section being read (assets/js/chapters.js sets aria-current). */
.nav a[aria-current="true"] { color: var(--lime); }
.top .right { display: flex; align-items: center; gap: 16px; }
.lang { font-size: 14px; color: var(--ink-2); text-decoration: none; }

/* --- Buttons ------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 44px; padding: 0 20px;
  background: var(--lime); color: var(--ground);
  border-radius: 999px; text-decoration: none;
  font-weight: 700; font-size: 16px; line-height: var(--line);
  border: 2px solid var(--lime);
}
.btn:hover { background: var(--ground); color: var(--lime); }
.btn.small { min-height: 40px; padding: 0 16px; font-size: 14px; }

.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; min-height: calc(var(--line) * 2); }

/* Reserved placeholder styles; unused slots stay hidden in HTML comments. */
.slot {
  border: 2px dashed var(--rule);
  color: var(--dim);
  font-family: var(--mono); font-size: 14px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  padding: 0 16px;
}
.l:has(> .slot) { align-items: start; }
.slot.badge { min-width: 156px; white-space: nowrap; height: calc(var(--line) * 2); border-radius: 10px; }

/* --- Hero demo ----------------------------------------------------------- */

.demo {
  border: 1px solid var(--rule);
  border-radius: 12px;
  background: var(--panel);
  overflow: hidden;
}
.demo-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  height: calc(var(--line) * 1.5);
  padding: 0 16px;
  border-bottom: 1px solid var(--rule);
  font-family: var(--mono); font-size: 14px; color: var(--dim);
}
.demo-bar b { color: var(--ink); font-weight: 500; }
.tag {
  font-family: var(--sans); font-size: 14px; font-weight: 700;
  color: var(--ground); background: var(--dim);
  padding: 0 8px; border-radius: 4px; line-height: 20px;
}
.demo-doc { padding: calc(var(--line) * 0.5) 16px calc(var(--line) * 0.5) 0; }
.demo-doc .l { --gutter: 40px; --gap: 20px; }
.demo-doc .g { transition: color 0.2s; }
.demo-doc .g.on { color: var(--lime); }
.demo-doc .r-h1 { font-size: 18px; font-weight: 800; }
.demo-doc .r-h2 { font-size: 16px; font-weight: 800; }
.demo-doc .r-p { color: var(--ink-2); }
.demo-doc .r-li { color: var(--ink-2); padding-left: 1.1em; position: relative; }
.demo-doc .r-li::before { content: "•"; position: absolute; left: 0; color: var(--dim); }
.demo-doc .r-li.sub { padding-left: 2.2em; }
.demo-doc .r-li.sub::before { left: 1.1em; content: "◦"; }
.demo-doc .line-on .r-li { color: var(--ink); }

.word {
  font-style: normal;
  color: var(--ink);
  border-bottom: 2px solid var(--lime);
  padding: 0 2px;
  outline: none;
  cursor: text;
  caret-color: var(--lime);
  min-width: 1em; display: inline-block; line-height: 24px;
}
.word:focus-visible, .word:focus { background: rgba(198, 244, 50, 0.16); outline: none; }
.word.sel { background: var(--lime); color: var(--ground); }

.strip {
  border-top: 1px solid var(--rule);
  padding: calc(var(--line) * 0.5) 16px;
  font-family: var(--mono); font-size: 14px;
  background: var(--ground);
  min-height: calc(var(--line) * 5);
}
.strip .cmd { color: var(--dim); }
.strip .hh { color: var(--dim); }
.strip .del { color: var(--minus); }
.strip .add { color: var(--lime); }
.strip .none { color: var(--ink-2); font-family: var(--sans); }
.strip .row { white-space: pre-wrap; word-break: break-all; }
.strip .count { display: flex; justify-content: space-between; gap: 16px; color: var(--dim); }
.strip .count b { color: var(--lime); font-weight: 700; }
.demo-foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 16px;
  padding: calc(var(--line) * 0.5) 16px;
  border-top: 1px solid var(--rule);
  font-size: 14px; color: var(--dim);
}
.demo-foot button {
  font: inherit; color: var(--ink); background: transparent;
  border: 1px solid var(--rule); border-radius: 999px;
  min-height: var(--line); padding: 0 12px; cursor: pointer;
}
.demo-foot button:hover { border-color: var(--lime); color: var(--lime); }

.fade-in { animation: fadein 0.24s ease-out; }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }

/* --- Diff comparison ----------------------------------------------------- */

.versus {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--line) var(--gap);
}
.panel { display: flex; flex-direction: column; }
.panel h3 { color: var(--ink); }
.panel .meta { min-height: var(--line); }
.panel pre {
  margin-top: calc(var(--line) * 0.5);
  border: 1px solid var(--rule);
  border-radius: 8px;
  background: var(--panel);
  padding: calc(var(--line) * 0.5) 16px;
  font-family: var(--mono);
  font-size: 14px;
  line-height: var(--line);
  overflow-x: auto;
  color: var(--ink-2);
  flex: 1;
  tab-size: 4;
}
.panel pre.good { border-color: var(--lime); }
.panel pre span { display: block; white-space: pre-wrap; overflow-wrap: anywhere; padding-left: 1ch; text-indent: -1ch; }
.panel pre .hh { color: var(--dim); }
.panel pre .del { color: var(--minus); }
.panel pre .add { color: var(--lime); }
.panel pre .fh { color: var(--ink); }
.tally {
  margin-top: calc(var(--line) * 0.5);
  font-size: 40px; line-height: calc(var(--line) * 2); font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.tally small { font-size: 16px; font-weight: 500; margin-left: 8px; color: var(--ink-2); }
.tally.bad { color: var(--ink-2); }
.tally.good { color: var(--lime); }

/* --- Lists: checks, refusals, contents ----------------------------------- */

.checks li, .contents li { display: grid; grid-template-columns: var(--gutter) minmax(0, 1fr); column-gap: var(--gap); align-items: baseline; }
.check-mk { font-family: var(--mono); color: var(--lime); margin-right: 0.6em; font-size: 14px; }
.checks strong { color: var(--ink); font-weight: 700; }
.checks .body, .contents .body { display: block; }
.contents p { padding-left: 1.2em; text-indent: -1.2em; }
.contents .mk { display: inline-block; width: 1.2em; text-indent: 0; }

.refusals {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--line) var(--gap);
}
.refusal {
  border: 1px solid var(--rule);
  border-radius: 12px;
  padding: calc(var(--line) * 0.5) 20px;
  display: flex; flex-direction: column; gap: calc(var(--line) * 0.5);
  min-height: calc(var(--line) * 9);
}
.refusal .what { font-family: var(--mono); font-size: 14px; color: var(--dim); }
.refusal h3 { font-size: 16px; }
.refusal blockquote {
  border-left: 2px solid var(--lime);
  padding-left: 14px;
  color: var(--ink);
}
.refusal blockquote.plain { border-left-color: var(--rule); color: var(--ink-2); }
.refusal .who { font-size: 14px; color: var(--dim); }

/* --- Price --------------------------------------------------------------- */

.price {
  font-size: 88px; line-height: calc(var(--line) * 4); font-weight: 800;
  font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
}
.price.pending { font-size: 40px; line-height: calc(var(--line) * 2); }

/* --- Footer -------------------------------------------------------------- */

.foot { border-top: 1px solid var(--rule); margin-top: calc(var(--line) * 4); }
.foot .wrap {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center;
  gap: 8px 24px; padding-top: var(--line); padding-bottom: var(--line);
  font-size: 14px; color: var(--dim);
}
.foot nav { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.foot a { color: var(--ink-2); }

/* --- Narrow -------------------------------------------------------------- */

@media (max-width: 960px) {
  /* The section nav drops to its own scrolling row instead of disappearing,
     so a phone reader still sees where they are and can jump. */
  .top .wrap { flex-wrap: wrap; height: auto; row-gap: 0; }
  .brand, .top .right { min-height: calc(var(--line) * 2); }
  .nav {
    order: 3; width: 100%;
    height: calc(var(--line) * 1.5); align-items: center;
    overflow-x: auto; scrollbar-width: none;
    border-top: 1px solid var(--rule);
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; }
  .refusals { grid-template-columns: minmax(0, 1fr); }
  .refusal { min-height: 0; }
  .versus { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 640px) {
  :root { --side: 16px; --gutter: 24px; --gap: 12px; }
  h1 { font-size: 48px; line-height: calc(var(--line) * 2); }
  h1 .mk { font-size: 32px; }
  h2 { font-size: 28px; line-height: calc(var(--line) * 2); }
  h2 .mk { font-size: 20px; }
  .price { font-size: 56px; line-height: calc(var(--line) * 3); }
  .brand .path { display: none; }
  .top .wrap { gap: 0 12px; }
  .lang { font-size: 14px; }
  .demo-doc .l { --gutter: 24px; --gap: 10px; }
  .demo-doc { padding-right: 12px; }
  .strip, .demo-bar, .demo-foot { padding-left: 12px; padding-right: 12px; }
  .panel pre { padding-left: 12px; padding-right: 12px; font-size: 14px; }
  .tally { font-size: 28px; }
}

/* --- Motion -------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* Actual MD1 recording: starts only when the reader presses Play. */
.recording { margin: 0; min-width: 0; }
.recording video { display: block; width: 100%; height: auto; border: 1px solid var(--rule); border-radius: 8px; }
.recording figcaption { margin-top: var(--line); }

/* First view: what MD1 is, beside the real window (owner, 2026-11-02).
 * Static on purpose — no reveal, no motion. */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr);
  gap: calc(var(--line) * 1) var(--gap);
  align-items: start;
}
.hero-copy { display: flex; flex-direction: column; gap: calc(var(--line) * 0.5); }
.hero .lead { max-width: none; }
.shot {
  margin: 0;
  border: 1px solid var(--rule);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.shot-bar {
  position: relative;
  display: flex; align-items: center; gap: 7px;
  height: 28px; padding: 0 12px;
  background: #ECECEC; border-bottom: 1px solid #D6D6D6;
}
.shot-bar i { width: 11px; height: 11px; border-radius: 50%; background: #FF5F57; }
.shot-bar i + i { background: #FEBC2E; }
.shot-bar i + i + i { background: #28C840; }
.shot-bar span {
  position: absolute; left: 0; right: 0; text-align: center;
  font-size: 12px; color: #6B6B6B; pointer-events: none;
}
.shot img { display: block; width: 100%; height: auto; }
.shot figcaption {
  padding: 6px 12px; background: var(--panel); border-top: 1px solid var(--rule);
  font-size: 13px; color: var(--dim);
}
@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; }
}
