/* PCMDSD.com — modern redesign (2026) */
:root {
  --bg: #f6f8fa;
  --bg-card: #ffffff;
  --text: #1d232a;
  --text-muted: #5b6672;
  --accent: #0b66c3;
  --accent-strong: #094f96;
  --border: #dce3ea;
  --code-bg: #eef1f5;
  --shadow: 0 1px 3px rgba(16, 24, 32, .07);
  --header-h: 3.5rem;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --bg-card: #161c22;
    --text: #e6e9ed;
    --text-muted: #98a2ad;
    --accent: #62a8ec;
    --accent-strong: #8fc1f2;
    --border: #2a323c;
    --code-bg: #1d242c;
    --shadow: 0 1px 3px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 1rem); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto,
    "Hiragino Kaku Gothic ProN", "Hiragino Sans", "Noto Sans JP", Meiryo, sans-serif;
  line-height: 1.8;
  font-size: 1rem;
  -webkit-font-smoothing: antialiased;
  /* sticky footer: 短いページでもフッターを最下部へ */
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
main { flex: 1 0 auto; }
.site-footer { flex-shrink: 0; }
img { max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration: none; }
a:hover, a:focus-visible { color: var(--accent-strong); text-decoration: underline; }
hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }
main, section.card, .tiles article, .note, figcaption {
  overflow-wrap: anywhere;
}

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg-card) 88%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 72rem;
  margin: 0 auto;
  padding: 0 1rem;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .25rem 1rem;
}
.brand {
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: .02em;
  color: var(--text);
}
.brand span { color: var(--accent); }
.brand:hover { text-decoration: none; }

.site-nav { display: flex; align-items: center; gap: .25rem; flex-wrap: wrap; }
.site-nav > a,
.nav-group > summary {
  display: inline-block;
  padding: .45rem .8rem;
  border-radius: .5rem;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  user-select: none;
  font-size: .95rem;
}
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary::after { content: " ▾"; font-size: .7em; color: var(--text-muted); }
.site-nav > a:hover, .nav-group > summary:hover { background: var(--code-bg); text-decoration: none; }
.nav-group { position: relative; }
.nav-group > ul {
  position: absolute;
  right: 0;
  top: calc(100% + .35rem);
  min-width: 14rem;
  margin: 0;
  padding: .4rem;
  list-style: none;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: .6rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .15);
}
.nav-group > ul a {
  display: block;
  padding: .45rem .7rem;
  border-radius: .4rem;
  color: var(--text);
}
.nav-group > ul a:hover { background: var(--code-bg); text-decoration: none; }
.nav-group .group-label {
  padding: .35rem .7rem .1rem;
  font-size: .78rem;
  color: var(--text-muted);
}

/* ---------- layout ---------- */
main {
  max-width: 72rem;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 1rem 3rem;
}
.narrow { max-width: 50rem; margin-left: auto; margin-right: auto; }

h1 { font-size: clamp(1.7rem, 4vw, 2.4rem); line-height: 1.35; margin: 0 0 .5rem; }
h2 { font-size: clamp(1.25rem, 3vw, 1.6rem); margin: 2.5rem 0 .75rem; }
h3 { font-size: 1.15rem; margin: 2rem 0 .5rem; }
.page-title { text-align: center; margin-bottom: .25rem; }
.page-lead { text-align: center; color: var(--text-muted); margin: 0 0 2rem; }

section.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: .8rem;
  box-shadow: var(--shadow);
  padding: 1.5rem 1.75rem;
  margin: 1.5rem 0;
}
section.card > h2:first-child, section.card > h3:first-child { margin-top: 0; }

/* index sitemap cards */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 1rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}
.tiles article {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: .8rem;
  box-shadow: var(--shadow);
  padding: 1.1rem 1.25rem;
}
.tiles h3 { margin: 0 0 .25rem; }
.tiles p { margin: 0 0 .5rem; color: var(--text-muted); font-size: .92rem; }
.tiles ul { margin: 0; padding-left: 1.1rem; font-size: .92rem; }

/* step rows (software pages) */
.step {
  display: grid;
  grid-template-columns: minmax(0, 18rem) minmax(0, 1fr);
  gap: 1.25rem;
  align-items: start;
  margin: 1.25rem 0;
}
.step img {
  border: 1px solid var(--border);
  border-radius: .5rem;
  background: #fff;
}
@media (max-width: 40rem) {
  .step { grid-template-columns: 1fr; }
}

/* figures (technical notes / comparison charts) */
figure { margin: 1.5rem 0; text-align: center; }
figure img {
  border: 1px solid var(--border);
  border-radius: .5rem;
  background: #fff;
}
figcaption { color: var(--text-muted); font-size: .9rem; margin-top: .4rem; }

/* version history */
table.versions { border-collapse: collapse; width: 100%; font-size: .93rem; }
table.versions th, table.versions td {
  border-bottom: 1px solid var(--border);
  padding: .4rem .6rem;
  text-align: left;
  vertical-align: top;
}
table.versions th { color: var(--text-muted); font-weight: 600; white-space: nowrap; }
table.versions td:first-child, table.versions td:nth-child(2) { white-space: nowrap; }

/* format spec tables (TechnicalNote) */
.fmt-wrap { overflow-x: auto; }
table.fmt { border-collapse: collapse; width: 100%; font-size: .9rem; line-height: 1.5; }
table.fmt caption {
  caption-side: top;
  text-align: left;
  font-weight: 700;
  font-size: 1.02rem;
  padding: .2rem 0 .55rem;
}
table.fmt th, table.fmt td {
  border: 1px solid var(--border);
  padding: .35rem .6rem;
  text-align: left;
  vertical-align: top;
}
table.fmt thead th { background: var(--code-bg); font-weight: 600; }
table.fmt td.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.fmt td.val, table.fmt td.fieldname {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .86rem;
}
table.fmt td.area {
  background: var(--code-bg);
  font-weight: 600;
  white-space: nowrap;
}

/* download buttons */
.dl-list { list-style: none; padding: 0; margin: .75rem 0; }
.dl-list li { margin: .5rem 0; }
.dl-list a {
  display: inline-block;
  padding: .55rem 1.1rem;
  border: 1px solid var(--accent);
  border-radius: .55rem;
  font-weight: 600;
}
.dl-list a:hover { background: var(--accent); color: #fff; text-decoration: none; }

pre, code { background: var(--code-bg); border-radius: .4rem; }
pre {
  padding: .9rem 1.1rem;
  overflow-x: auto;
  font-size: .88rem;
  line-height: 1.6;
  border: 1px solid var(--border);
}
.note {
  border-left: 3px solid var(--accent);
  background: var(--code-bg);
  padding: .7rem 1rem;
  border-radius: 0 .5rem .5rem 0;
  margin: 1rem 0;
}

/* ---------- footer ---------- */
.site-footer {
  width: 100%;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  padding: 1.75rem 1rem 2.25rem;
  text-align: center;
  color: var(--text-muted);
  font-size: .88rem;
  line-height: 1.9;
}

/* gallery (SpectrumAnalyzer) */
.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1rem;
  margin: 1rem 0 0;
}
.gallery figure { margin: 0; }
.gallery img {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: .5rem;
  background: #000;
}
.gallery figcaption {
  font-size: .85rem;
  color: var(--text-muted);
  margin-top: .35rem;
  line-height: 1.6;
  text-align: left;
}
