:root {
  color-scheme: dark;
  --bg: #101920;
  --bar: #131e26;
  --surface: #1b2933;
  --line: #31434f;
  --media-line: #41535f;
  --text: #f2f4f5;
  --muted: #b6c3ca;
  --accent: #b0dbef;
  --accent-ink: #12242e;
  --accent-hover: #dbf1fc;
  --gutter: clamp(18px, 4.2vw, 70px);
  --header: 72px;
  --page-title: clamp(36px, 4.2vw, 58px);
  --section-title: clamp(23px, 2.45vw, 33px);
  --font: system-ui, -apple-system, "Hiragino Sans", "Yu Gothic", "Noto Sans CJK JP", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.8 var(--font); }
h1, h2, h3, p, figure, dl, dd { margin: 0; }
h1, h2, h3 { text-wrap: balance; }
p, figcaption { text-wrap: pretty; }
a { color: inherit; text-underline-offset: .25em; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
img { display: block; max-width: 100%; height: auto; }
[id] { scroll-margin-top: calc(var(--header) + 20px); }
.shell { width: min(1220px, 100% - 2 * var(--gutter)); margin-inline: auto; }

.skip-link {
  position: fixed;
  z-index: 5;
  top: 10px;
  left: 10px;
  padding: 8px 14px;
  background: var(--accent);
  color: var(--accent-ink);
  transform: translateY(calc(-100% - 14px));
}
.skip-link:focus { transform: translateY(0); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.site-header {
  position: sticky;
  top: 0;
  z-index: 4;
  background: var(--bar);
  border-bottom: 1px solid var(--line);
}
.masthead, .masthead nav { display: flex; align-items: center; }
.masthead { min-height: var(--header); justify-content: space-between; gap: 14px; }
.masthead nav { gap: clamp(12px, 2.8vw, 34px); }
.masthead a { text-decoration: none; }
.site-brand {
  color: var(--text);
  font-size: clamp(19px, 2vw, 24px);
  font-weight: 750;
  letter-spacing: -.045em;
  line-height: 1.2;
}
.site-logo { width: clamp(152px, 18vw, 213px); flex-shrink: 0; }
.site-nav-link { color: var(--muted); font-size: 14px; white-space: nowrap; }
.site-nav-link:hover, .site-nav-link[aria-current="page"] { color: var(--text); text-decoration: underline; }

.open, .play-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 14px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  text-decoration: none;
}
.open:hover, .play-link:hover { background: var(--accent-hover); }
.play-link { white-space: nowrap; }
.play-link svg, .arrow-link svg {
  flex: 0 0 auto;
  width: 1em;
  height: 1em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
  margin-top: clamp(38px, 5vw, 65px);
  padding-block: 20px 28px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}
.site-footer a:hover { color: var(--text); }
.site-footer p { margin: 0; font: inherit; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 6px 18px; }
.footer-home { font-weight: 700; text-decoration: none; }
.shot {
  overflow: hidden;
  border: 1px solid var(--media-line);
  border-radius: 8px;
  background: var(--bar);
}
.shot img { width: 100%; }
.shot figcaption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px 10px;
  min-height: 43px;
  padding: 5px 13px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.arrow-link { display: inline-flex; align-items: center; gap: 3px; color: var(--accent); font-weight: 600; }
.arrow-link:hover { color: var(--accent-hover); }
.shot .arrow-link { padding-block: 5px; white-space: nowrap; }

@media (max-width: 760px) {
  :root { --header: 60px; }
}

@media (max-width: 560px) {
  .masthead nav { gap: 12px; }
  .site-nav-link--secondary { display: none; }
}

@media (max-width: 470px) {
  .masthead .star-nav-detail { display: none; }
  .play-link { padding-inline: 8px; font-size: 13px; }
  .shot figcaption { padding-inline: 9px; font-size: 12px; }
}

@media (min-width: 375px) and (max-width: 470px) {
  .masthead .site-nav-home { display: inline; font-size: 12px; }
  .masthead .site-logo { width: clamp(117px, 33vw, 147px); }
}

@media (max-width: 374px) {
  .masthead .site-logo { width: clamp(112px, 40vw, 145px); }
}

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

.worked-example h2 { scroll-margin-top: calc(var(--header) + 16px); }
.worked-example .worked-frames {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 22rem));
  align-items: start;
  gap: 1.5rem;
  margin-block: 1.5rem;
}
.worked-frames figure { margin: 0; }
.worked-frames a { display: block; }
.worked-frames img { display: block; width: 100%; height: auto; border-radius: 8px; }
.worked-frames figcaption, .worked-example .example-source {
  margin-top: .5rem;
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.65;
}
@media (max-width: 600px) {
  .worked-example .worked-frames { grid-template-columns: minmax(0, 22rem); gap: 1rem; }
}
.worked-example summary { cursor: pointer; padding-block: .65rem; font-weight: 600; }
.worked-example > p + p { margin-top: .8em; }

.receipt-steps {
  counter-reset: receipt-step;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
  gap: 1rem 1.75rem;
  margin: 1.4rem 0;
  padding: 0;
}
.receipt-steps li {
  counter-increment: receipt-step;
  padding-block: .75rem;
  border-top: 1px solid var(--line);
}
.receipt-steps h3, .case-aside h3 { font-size: 1.08rem; line-height: 1.5; }
.receipt-steps h3::before { content: counter(receipt-step) ". "; }
.receipt-steps li > a { display: block; width: fit-content; margin-top: .8rem; }
.receipt-steps img { max-width: min(100%, 24rem); border-radius: 5px; }
.case-comparison {
  width: 100%;
  max-width: 42rem;
  border-collapse: collapse;
  margin-block: 1rem;
  font-variant-numeric: tabular-nums;
}
.case-comparison caption { text-align: left; padding-bottom: .35rem; color: var(--muted); font-size: .875rem; }
.case-comparison th, .case-comparison td {
  padding: .55rem .5rem;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: middle;
  line-height: 1.5;
}
.case-comparison th:first-child { text-align: left; padding-left: 0; }
.case-comparison thead th { color: var(--muted); font-size: .875rem; }
.case-comparison tbody th { font-size: .9rem; font-weight: 500; }
.case-comparison small { font-size: .8rem; font-weight: 400; }
.case-facts { max-width: 44rem; margin-block: 1rem; }
.case-facts > div {
  display: grid;
  grid-template-columns: 6rem minmax(0, 1fr);
  gap: .75rem;
  padding-block: .6rem;
  border-top: 1px solid var(--line);
}
.case-facts > div:last-child { border-bottom: 1px solid var(--line); }
.case-facts dt { color: var(--muted); }
.case-facts dd { line-height: 1.6; }
.case-aside { max-width: 45rem; margin-block: 1rem; padding: .8rem 1rem; border-left: 3px solid var(--accent); background: var(--surface); }
.case-links { display: flex; flex-wrap: wrap; gap: 0 1.25rem; margin-top: .35rem; }
.case-links a { display: inline-flex; align-items: center; min-height: 44px; color: var(--accent); }
.rush-counts {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: .6rem;
  max-width: 36rem;
  margin-block: 1rem;
  padding-block: .75rem;
  border-block: 1px solid var(--line);
}
.rush-counts figcaption { font-size: .875rem; color: var(--muted); margin-bottom: .35rem; }
.rush-counts a { display: flex; align-items: center; min-height: 44px; }
.rush-counts img { width: auto; max-height: 45px; border-radius: 3px; }
@media (max-width: 460px) {
  .rush-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rush-counts figure:last-child { grid-column: 1 / -1; display: flex; gap: .8rem; align-items: center; }
  .rush-counts figure:last-child figcaption { margin: 0; }
  .case-comparison td { font-size: .9rem; }
  .case-comparison th, .case-comparison td { padding-inline: .25rem; }
  .case-facts > div { grid-template-columns: 5rem minmax(0, 1fr); }
}
