/* Markappoly site. Inherits the app's Instruction Manual system (DESIGN.md):
   chassis bar, paper sheets, graphite ink, hairlines, 4px corners. The site's
   own diagram callouts are graphite, so orange stays what it is in the app:
   real change marks (inside the screenshots) and the one Download button. */
:root {
  --chassis: #e9e7e2;
  --paper: #f7f6f3;
  --ink: #2a2a28;
  --muted: #62605a;
  --hair: rgba(42, 42, 40, 0.14);
  --panel: rgba(42, 42, 40, 0.05);
  --leader: rgba(42, 42, 40, 0.5);
  --signal: #c94a0a;
  --signal-ink: #a83f08;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --mono: "SF Mono", ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;
  --radius: 4px;
  --gutter: clamp(20px, 4vw, 56px);
  --max: 1400px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 72px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
::selection { background: rgba(232, 89, 12, 0.18); }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: underline; text-decoration-color: rgba(42, 42, 40, 0.38); text-underline-offset: 0.2em; }
a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; border-radius: 2px; }
code { font: 0.88em var(--mono); background: var(--panel); padding: 0.1em 0.35em; border-radius: var(--radius); }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.02em; text-wrap: balance; }

/* Chassis bar */
.bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  height: 56px; padding: 0 var(--gutter);
  background: rgba(233, 231, 226, 0.94);
  border-bottom: 1px solid var(--hair);
  backdrop-filter: saturate(1.2) blur(12px);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; text-decoration: none; margin-right: auto; }
.bar nav { display: flex; align-items: center; gap: 22px; font-size: 14px; }
.bar nav a { text-decoration: none; color: var(--muted); }
.bar nav a:hover { color: var(--ink); }
.bar nav a.gh { color: var(--ink); border: 1px solid var(--hair); background: var(--paper); border-radius: var(--radius); padding: 5px 12px; }

/* Sheets */
.sheet {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(56px, 8vw, 112px) var(--gutter);
  border-bottom: 1px solid var(--hair);
}
.title-block {
  font-size: 13px; font-weight: 600; letter-spacing: 0.06em;
  font-variant-caps: all-small-caps; color: var(--muted);
}
h1 { font-size: clamp(40px, 4vw, 56px); line-height: 1.04; letter-spacing: -0.03em; }
h2 { font-size: clamp(28px, 3vw, 40px); line-height: 1.12; margin-bottom: 18px; }
h3 { font-size: 20px; margin-bottom: 8px; }
.lede { font-size: clamp(18px, 1.6vw, 21px); line-height: 1.45; color: var(--muted); margin: 16px 0 0; max-width: 34em; }
.meta { font-size: 14px; color: var(--muted); margin: 12px 0 0; }
.aside { font-size: 15px; color: var(--muted); }

/* Primary action */
.cta { display: flex; align-items: center; flex-wrap: wrap; gap: 14px 18px; margin-top: 24px; }
.btn {
  display: inline-block; background: var(--signal); color: #fff;
  font-weight: 600; font-size: 17px; text-decoration: none;
  padding: 13px 22px; border-radius: var(--radius); white-space: nowrap;
  transition: background-color 0.15s ease;
}
.btn:hover { background: #b3420a; }
.cta-alt { margin: 0; font-size: 14px; line-height: 1.5; color: var(--muted); }
.cta-alt a { color: var(--ink); }

/* Overview: intro and parts on the left, the exploded figure on the right */
.overview {
  display: grid;
  grid-template-columns: minmax(300px, 420px) 1fr;
  grid-template-areas: "intro fig" "parts fig";
  grid-template-rows: auto 1fr;
  column-gap: clamp(40px, 5vw, 80px);
  align-items: start;
  padding-top: clamp(32px, 4vw, 56px);
  padding-bottom: clamp(48px, 6vw, 88px);
}
.overview .intro { grid-area: intro; }
.overview .parts { grid-area: parts; margin-top: 26px; }
.overview .hero-fig { grid-area: fig; margin: 44px 44px 0 52px; }

/* Numbered parts list (the legend) */
.parts { list-style: none; margin: 22px 0 0; padding: 0; border-top: 1px solid var(--ink); }
.parts li {
  display: grid; grid-template-columns: 34px 1fr; column-gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--hair);
  outline-offset: -2px;
}
.parts b { font-size: 18px; font-weight: 600; line-height: 1.3; }
.parts span { grid-column: 2; font-size: 14px; color: var(--muted); margin-top: 1px; }
.parts.compact b { font-size: 16px; }
.n {
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink); color: var(--paper);
  font: 600 13px/1 var(--sans); font-style: normal; margin-top: 1px;
}

.fig { margin: 0; }
.shot {
  position: relative;
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  background: var(--chassis);
}
.shot img { border-radius: var(--radius); }
.fig figcaption {
  display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap;
  margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--hair);
}
.tag { font-size: clamp(20px, 2vw, 26px); font-weight: 600; letter-spacing: -0.01em; }

/* Diagram callouts: a graphite dot outside the shot, a leader to the part,
   and a small point where it lands. */
.co { position: absolute; pointer-events: none; }
.co i {
  position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--ink); color: var(--paper); font: 600 14px/1 var(--sans); font-style: normal;
  box-shadow: 0 0 0 3px var(--paper);
  pointer-events: auto; cursor: default;
  transition: transform 0.25s var(--ease), opacity 0.2s;
}
.co::before { content: ""; position: absolute; background: var(--leader); transition: background-color 0.2s; }
.co::after {
  content: ""; position: absolute; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%;
  background: var(--ink); box-shadow: 0 0 0 2px var(--paper);
}
.co.left { left: -40px; top: var(--y); width: calc(var(--x) + 40px); }
.co.left i { left: 0; top: 0; }
.co.left::before { left: 13px; right: 0; top: -0.5px; height: 1px; }
.co.left::after { left: 100%; top: 0; }
.co.right { left: var(--x); right: -40px; top: var(--y); }
.co.right i { left: 100%; top: 0; }
.co.right::before { left: 0; right: 13px; top: -0.5px; height: 1px; }
.co.right::after { left: 0; top: 0; }
.co.top { left: var(--x); top: -40px; height: calc(var(--y) + 40px); }
.co.top i { left: 0; top: 0; }
.co.top::before { top: 13px; bottom: 0; left: -0.5px; width: 1px; }
.co.top::after { left: 0; top: 100%; }

/* Signature interaction: a part and its callout light each other, on hover
   or keyboard focus. Everything else in that diagram steps back. */
.diagram:has([data-n]:is(:hover, :focus-visible)) .co i { opacity: 0.3; }
.diagram:has([data-n]:is(:hover, :focus-visible)) .parts li { color: var(--muted); }
.diagram:is(
  :has(li[data-n="1"]:is(:hover, :focus-visible)), :has(.co[data-n="1"] i:hover)
) :is(.co[data-n="1"] i) { opacity: 1; transform: scale(1.2); }
.diagram:is(
  :has(li[data-n="2"]:is(:hover, :focus-visible)), :has(.co[data-n="2"] i:hover)
) :is(.co[data-n="2"] i) { opacity: 1; transform: scale(1.2); }
.diagram:is(
  :has(li[data-n="3"]:is(:hover, :focus-visible)), :has(.co[data-n="3"] i:hover)
) :is(.co[data-n="3"] i) { opacity: 1; transform: scale(1.2); }
.diagram:is(
  :has(li[data-n="4"]:is(:hover, :focus-visible)), :has(.co[data-n="4"] i:hover)
) :is(.co[data-n="4"] i) { opacity: 1; transform: scale(1.2); }
.diagram:is(:has(li[data-n="1"]:is(:hover, :focus-visible)), :has(.co[data-n="1"] i:hover)) .co[data-n="1"]::before,
.diagram:is(:has(li[data-n="2"]:is(:hover, :focus-visible)), :has(.co[data-n="2"] i:hover)) .co[data-n="2"]::before,
.diagram:is(:has(li[data-n="3"]:is(:hover, :focus-visible)), :has(.co[data-n="3"] i:hover)) .co[data-n="3"]::before,
.diagram:is(:has(li[data-n="4"]:is(:hover, :focus-visible)), :has(.co[data-n="4"] i:hover)) .co[data-n="4"]::before { background: var(--ink); }
.diagram:has(.co[data-n="1"] i:hover) li[data-n="1"],
.diagram:has(.co[data-n="2"] i:hover) li[data-n="2"],
.diagram:has(.co[data-n="3"] i:hover) li[data-n="3"],
.diagram:has(.co[data-n="4"] i:hover) li[data-n="4"],
.diagram .parts li:is(:hover, :focus-visible) { color: var(--ink); }
.diagram:has(.co[data-n="1"] i:hover) li[data-n="1"] b,
.diagram:has(.co[data-n="2"] i:hover) li[data-n="2"] b,
.diagram:has(.co[data-n="3"] i:hover) li[data-n="3"] b,
.diagram:has(.co[data-n="4"] i:hover) li[data-n="4"] b,
.diagram .parts li:is(:hover, :focus-visible) b { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.22em; }
@media (prefers-reduced-motion: reduce) { .co i { transition: none; } }

/* Feature sheets */
.split {
  display: grid; grid-template-columns: minmax(280px, 400px) 1fr;
  gap: clamp(32px, 6vw, 96px); align-items: start;
}
.split.flip { grid-template-columns: 1fr minmax(280px, 400px); }
.split.flip .copy { order: 2; }
.split .copy p { margin: 0 0 16px; max-width: 34em; }
.split .copy .aside { margin-top: 18px; }
.split .fig { margin: 44px 44px 0; }
.trio .cols { display: grid; grid-template-columns: repeat(2, 1fr); gap: clamp(24px, 4vw, 56px); margin-top: 12px; }
.trio .cols > div { border-top: 1px solid var(--ink); padding-top: 18px; }
/* Data files get the full row so the table in its figure stays readable. */
.trio .cols > .data-row {
  grid-column: 1 / -1;
  display: grid; grid-template-columns: minmax(260px, 380px) 1fr;
  gap: clamp(24px, 4vw, 56px); align-items: start;
}
.trio .cols > .data-row .fig { margin-top: 0; }
.trio p { margin: 0 0 12px; }
.trio .fig { margin-top: 18px; }
pre {
  margin: 0 0 12px; padding: 14px 16px; overflow-x: auto;
  background: var(--panel); border: 1px solid var(--hair); border-radius: var(--radius);
  font: 13.5px/1.6 var(--mono);
}
pre code { background: none; padding: 0; font-size: inherit; }

/* Download sheet */
.download h2 { margin-bottom: 0; }
.dl { width: 100%; border-collapse: collapse; margin-top: 32px; font-size: 16px; }
.dl th, .dl td { text-align: left; padding: 14px 16px 14px 0; border-bottom: 1px solid var(--hair); vertical-align: baseline; }
.dl thead th { font-size: 13px; font-weight: 600; letter-spacing: 0.06em; font-variant-caps: all-small-caps; color: var(--muted); border-bottom: 1px solid var(--ink); }
.dl tbody th { font-weight: 600; }
.dl td:last-child { color: var(--muted); }
.dl tr[data-current] th::after {
  content: "Your system"; margin-left: 10px; padding: 3px 8px; border-radius: var(--radius);
  font-size: 12px; font-weight: 600; color: var(--signal-ink); box-shadow: inset 0 0 0 1px rgba(201, 74, 10, 0.6);
}

/* Footer */
.foot {
  max-width: var(--max); margin: 0 auto; padding: 22px var(--gutter) 40px;
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  font-size: 14px; color: var(--muted);
}

/* Narrow screens: one column; the figure follows the download button, and
   callouts sit on the shot without leaders. */
@media (max-width: 960px) {
  .overview, .split, .split.flip { grid-template-columns: 1fr; }
  .overview { grid-template-areas: "intro" "fig" "parts"; grid-template-rows: auto; }
  .overview .hero-fig, .split .fig { margin: 28px 0 0; }
  .split.flip .copy { order: 0; }
  .co.left, .co.right, .co.top { left: var(--mx, var(--x)); top: var(--my, var(--y)); right: auto; width: 0; height: 0; }
  .co::before, .co::after { display: none; }
  .co i { left: 0 !important; top: 0 !important; width: 20px; height: 20px; margin: -10px 0 0 -10px; font-size: 11px; }
  .co.right i { margin-left: 4px; }
  .trio .cols, .trio .cols > .data-row { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .bar nav a:not(.gh):not([href="#download"]) { display: none; }
  .dl thead { display: none; }
  .dl tr { display: grid; grid-template-columns: 1fr; padding: 12px 0; border-bottom: 1px solid var(--hair); }
  .dl th, .dl td { border: 0; padding: 2px 0; }
}
