/* PlateauTool マニュアル — 明背景・シンプル・スマホ対応 */

:root {
  --bg: #f7f7f5;
  --surface: #ffffff;
  --text: #1c1c1c;
  --muted: #5c5c5c;
  --border: #dddcd8;
  --accent: #1d4ed8;
  --accent-soft: rgba(29, 78, 216, 0.08);
  --note-bg: #fffbeb;
  --note-border: #fcd34d;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Sans",
    "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif;
  --measure: 42rem;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: clamp(0.95rem, 2.8vw, 1.05rem);
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
}

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-thickness: 2px;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: clamp(1rem, 4vw, 1.5rem) clamp(1rem, 4vw, 2rem);
  box-shadow: var(--shadow);
}

.site-header h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.meta {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted);
}

.doc-layout {
  display: grid;
  gap: clamp(1.25rem, 3vw, 2rem);
  max-width: calc(var(--measure) + 220px + 3rem);
  margin: 0 auto;
  padding: clamp(1rem, 3vw, 2rem);
}

@media (min-width: 900px) {
  .doc-layout {
    grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
    align-items: start;
  }
}

.toc {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1rem 1rem 1.25rem;
  box-shadow: var(--shadow);
}

@media (min-width: 900px) {
  .toc {
    position: sticky;
    top: 1rem;
  }
}

.toc-title {
  margin: 0 0 0.75rem;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.toc ol {
  margin: 0;
  padding-left: 1.35rem;
  list-style-type: decimal;
  list-style-position: outside;
}

.toc li {
  margin-bottom: 0.45rem;
}

.toc ol ol {
  margin-top: 0.35rem;
  padding-left: 1rem;
  list-style-type: none;
}

.toc ol ol li {
  margin-bottom: 0.3rem;
}

.toc ol ol a {
  font-size: 0.82rem;
  color: var(--muted);
}

.toc ol ol a:hover {
  color: var(--accent);
}

.toc a {
  font-size: 0.9rem;
  color: var(--text);
  text-decoration: none;
}

.toc a:hover {
  color: var(--accent);
  text-decoration: underline;
}

main {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 3vw, 2rem);
  box-shadow: var(--shadow);
  min-width: 0;
  counter-reset: doc-chapter-index;
}

/* 大見出し（h2 番号）・中見出し（h3）・小見出し（h4）: 用語は出さず段差と余白だけで区別 */
section.doc-chapter {
  counter-increment: doc-chapter-index;
  margin: 0;
  padding: 1.35rem 0 1.85rem;
  border-bottom: 1px solid var(--border);
}

section.doc-chapter:last-of-type {
  border-bottom: none;
  padding-bottom: 0;
}

section.doc-chapter > h2 {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin: 0 0 1rem;
  padding: 0 0 0.5rem;
  font-size: clamp(1.15rem, 3vw, 1.38rem);
  font-weight: 700;
  line-height: 1.4;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: 1rem;
}

section.doc-chapter > h2::before {
  content: counter(doc-chapter-index);
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 0.4rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border-radius: 6px;
  line-height: 1;
}

section.doc-chapter:first-of-type > h2 {
  margin-top: 0;
}

section.doc-chapter > h3 {
  margin: 1.5rem 0 0.5rem;
  padding: 0 0 0 0.7rem;
  font-size: 1.04rem;
  font-weight: 700;
  color: var(--text);
  border-left: 3px solid var(--accent);
  scroll-margin-top: 1rem;
}

section.doc-chapter h4 {
  margin: 1.1rem 0 0.4rem;
  padding: 0 0 0 0.9rem;
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--muted);
  border-left: 2px solid var(--border);
  scroll-margin-top: 1rem;
}

section.doc-chapter h5 {
  margin: 0.85rem 0 0.35rem;
  font-size: 0.94rem;
  font-weight: 600;
  color: var(--text);
  scroll-margin-top: 1rem;
}

.lead {
  margin: 0 0 1rem;
  font-size: 1.02rem;
  color: var(--muted);
}

.ui-chip {
  display: inline-block;
  margin: 0 0.15rem;
  padding: 0.12em 0.5em;
  font-size: 0.88em;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid rgba(29, 78, 216, 0.2);
  border-radius: 4px;
  white-space: nowrap;
}

.feature-list {
  display: grid;
  gap: 0.65rem;
  margin: 1rem 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 640px) {
  .feature-list--cols {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.feature-list li {
  margin: 0;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.015);
}

.feature-list strong {
  display: block;
  margin-bottom: 0.25rem;
  font-size: 0.95rem;
}

.steps {
  margin: 0.75rem 0;
  padding: 0;
  list-style: none;
  counter-reset: step-counter;
}

.steps > li {
  position: relative;
  margin: 0 0 0.85rem;
  padding: 0 0 0 2.5rem;
  counter-increment: step-counter;
}

.steps > li::before {
  content: counter(step-counter);
  position: absolute;
  left: 0;
  top: 0.1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.65rem;
  height: 1.65rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  background: var(--accent);
  border-radius: 50%;
  line-height: 1;
}

.steps ul,
.steps ol {
  margin-top: 0.45rem;
}

.sub-steps {
  margin: 0.5rem 0;
  padding-left: 1.25rem;
}

.manual-figure--placeholder .manual-figure__img-wrap {
  background: #eef0f4;
  padding: 2rem 1rem;
}

.figure-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 10rem;
  margin: 0;
  padding: 1.5rem;
  border: 2px dashed #b8c0cc;
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

.figure-placeholder__label {
  font-weight: 700;
  color: var(--text);
}

.figure-placeholder__hint {
  max-width: 28rem;
  font-size: 0.85rem;
  line-height: 1.5;
}

.manual-figure--placeholder .figure-zoom-trigger {
  cursor: default;
  pointer-events: none;
}

.manual-figure--placeholder .figure-zoom-hint {
  display: none;
}

.data-type-table td:first-child {
  font-weight: 600;
  white-space: nowrap;
}

p {
  margin: 0.65rem 0;
}

.toolbar-scope {
  margin: 0 0 0.65rem;
  font-size: 0.92rem;
  color: var(--muted);
}

ul,
ol {
  margin: 0.5rem 0;
  padding-left: 1.35rem;
}

li {
  margin: 0.35rem 0;
}

.note {
  margin: 1rem 0;
  padding: 0.85rem 1rem;
  background: var(--note-bg);
  border: 1px solid var(--note-border);
  border-radius: var(--radius);
  font-size: 0.92rem;
}

.note strong {
  font-weight: 700;
}

.table-wrap {
  margin: 1rem 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  border: 1px solid var(--border);
  padding: 0.55rem 0.65rem;
  text-align: left;
  vertical-align: top;
}

th {
  background: var(--accent-soft);
  font-weight: 600;
}

tbody tr:nth-child(even) {
  background: rgba(0, 0, 0, 0.02);
}

details.section-details {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: rgba(0, 0, 0, 0.015);
}

details.section-details summary {
  cursor: pointer;
  font-weight: 600;
}

.placeholder {
  margin: 0.75rem 0;
  padding: 1rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.9rem;
  text-align: center;
}

/* マニュアル用の図（ツールバーは実 UI が暗背景のためそのまま掲載） */
.manual-figure {
  margin: 1.25rem 0;
}

.manual-figure--toolbar {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.manual-figure__img-wrap {
  margin: 0;
  padding: 0.75rem;
  background: #0c0c0e;
  text-align: center;
}

.figure-zoom-trigger {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: zoom-in;
  border-radius: 4px;
  line-height: 0;
}

.figure-zoom-trigger:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.manual-figure__img-wrap img {
  display: inline-block;
  max-width: 100%;
  height: auto;
  vertical-align: middle;
}

.figure-zoom-hint {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.82rem;
  font-weight: 400;
  color: var(--muted);
}

/* 図の拡大表示（ネイティブ dialog） */
.figure-dialog {
  max-width: calc(100vw - 2rem);
  max-height: calc(100vh - 2rem);
  margin: auto;
  padding: 0;
  border: none;
  border-radius: var(--radius);
  background: #0c0c0e;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}

.figure-dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
  cursor: pointer;
}

.figure-dialog-inner {
  position: relative;
  padding: 2.25rem 0.75rem 0.75rem;
  max-width: 96vw;
  max-height: 92vh;
  overflow: auto;
}

.figure-dialog-inner img {
  display: block;
  max-width: min(2456px, 92vw);
  width: auto;
  height: auto;
  max-height: min(1502px, 85vh);
  margin: 0 auto;
  object-fit: contain;
}

.figure-dialog-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 1;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.figure-dialog-close:hover {
  background: rgba(0, 0, 0, 0.75);
}

.figure-dialog-close:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.manual-figure--toolbar figcaption {
  margin: 0;
  padding: 0.65rem 0.9rem 0.75rem;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--muted);
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.manual-figure--toolbar figcaption strong {
  color: var(--text);
  margin-right: 0.35rem;
}

.site-footer {
  margin-top: 2rem;
  padding: 1.5rem clamp(1rem, 4vw, 2rem) 2rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
  border-top: 1px solid var(--border);
}

kbd {
  padding: 0.1em 0.45em;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #f0f0ee;
  font-size: 0.88em;
}

@media print {
  .toc {
    display: none;
  }

  .doc-layout {
    grid-template-columns: 1fr;
  }

  main {
    box-shadow: none;
    border: none;
  }

  a {
    color: var(--text);
    text-decoration: none;
  }

  .figure-dialog {
    display: none !important;
  }

  .figure-zoom-hint {
    display: none;
  }
}
