:root {
  --color-bg: #ffffff;
  --color-bg-alt: #f5f6f8;
  --color-text: #1f2328;
  --color-text-muted: #5b6270;
  --color-border: #d9dce1;
  --color-primary: #2b4a7a;
  --color-primary-hover: #223a61;
  --color-accent: #edf1f7;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Hiragino Kaku Gothic ProN",
    "Hiragino Sans", Meiryo, sans-serif;
  --max-width: 880px;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-family);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.8;
  font-size: 16px;
}

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

h1, h2, h3 {
  line-height: 1.5;
  font-weight: 700;
}

h1 {
  font-size: 2rem;
  margin: 0 0 24px;
}

h2 {
  font-size: 1.5rem;
  margin: 0 0 24px;
}

h3 {
  font-size: 1.1rem;
  margin: 0 0 8px;
}

p {
  margin: 0 0 16px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--color-primary);
  color: #fff;
  padding: 8px 16px;
  z-index: 1000;
}

.skip-link:focus {
  left: 8px;
  top: 8px;
}

/* Hero */

.hero {
  background: var(--color-bg-alt);
  border-bottom: 1px solid var(--color-border);
  padding: 64px 0 48px;
  text-align: center;
}

.eyebrow {
  color: var(--color-text-muted);
  font-size: 0.9rem;
  margin-bottom: 12px;
}

.hero-lead {
  color: var(--color-text-muted);
  max-width: 620px;
  margin: 0 auto 32px;
}

/* Buttons */

.btn {
  display: inline-block;
  font-size: 1rem;
  font-family: inherit;
  padding: 14px 32px;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  text-align: center;
}

.btn:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--color-primary-hover);
}

.btn-secondary {
  background: #fff;
  color: var(--color-primary);
  border-color: var(--color-primary);
}

.btn-secondary:hover {
  background: var(--color-accent);
}

.btn-tertiary {
  background: transparent;
  color: var(--color-text-muted);
  border-color: var(--color-border);
}

.btn-outline {
  background: #fff;
  color: var(--color-text);
  border-color: var(--color-border);
  padding: 10px 16px;
  font-size: 0.95rem;
}

.btn-outline:hover:not(:disabled) {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-outline:disabled {
  opacity: 0.5;
  cursor: default;
}

.cta-note {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin-top: 12px;
}

/* Sections */

.section {
  padding: 56px 0;
}

.section-alt {
  background: var(--color-bg-alt);
}

.section-final-cta {
  text-align: center;
  border-top: 1px solid var(--color-border);
}

/* Flow lists */

.flow-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 420px;
}

.flow-list li {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 14px 18px;
  position: relative;
}

.section-alt .flow-list li {
  background: #fff;
}

.flow-list li:not(:last-child) {
  margin-bottom: 28px;
}

.flow-list li:not(:last-child)::after {
  content: "↓";
  position: absolute;
  left: 18px;
  bottom: -26px;
  color: var(--color-text-muted);
}

.flow-list-compact {
  max-width: none;
}

.flow-list-compact li:not(:last-child) {
  margin-bottom: 22px;
}

.flow-list-compact li:not(:last-child)::after {
  bottom: -20px;
}

.mock-disclaimer {
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

/* Before / After */

.beforeafter {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  align-items: start;
}

.ba-col {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 24px;
}

.file-card {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.file-name {
  font-weight: 600;
  margin: 0;
}

.file-meta {
  color: var(--color-text-muted);
  font-size: 0.85rem;
  margin: 4px 0 0;
}

.page-table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 0.95rem;
}

.page-table th,
.page-table td {
  text-align: left;
  padding: 8px 4px;
  border-bottom: 1px solid var(--color-border);
  font-weight: 400;
}

.page-table th {
  color: var(--color-text-muted);
  white-space: nowrap;
  padding-right: 12px;
}

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

.ba-split-list {
  list-style: none;
  margin: 0 0 20px;
  padding: 0;
}

.ba-split-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.95rem;
}

.ba-split-list .pages {
  color: var(--color-text-muted);
  white-space: nowrap;
}

.ba-result-label {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 8px;
}

.filename-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.9rem;
}

.filename-list li {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 4px;
  padding: 8px 12px;
  margin-bottom: 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
}

/* Demo */

.demo-panel {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 32px;
  margin: 24px 0 32px;
  min-height: 220px;
}

.demo-intro {
  text-align: center;
  padding: 40px 0;
}

.demo-stage {
  position: relative;
}

.demo-step {
  display: none;
}

.demo-step.is-active {
  display: block;
  animation: fade-in 0.3s ease;
}

.demo-step-label {
  color: var(--color-text-muted);
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  margin-bottom: 12px;
}

.mock-button {
  display: inline-block;
  background: var(--color-primary);
  color: #fff;
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 0.95rem;
  margin: 8px 0;
  transition: opacity 0.2s ease;
}

.mock-button.is-pressed {
  opacity: 0.6;
}

.demo-processing {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--color-text-muted);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex: none;
}

.demo-candidates {
  list-style: none;
  margin: 0;
  padding: 0;
}

.demo-candidates li {
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.3s ease, transform 0.3s ease;
  padding: 10px 14px;
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  margin-bottom: 8px;
}

.demo-candidates li.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.demo-done {
  text-align: center;
  padding: 24px 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: none;
  }
  .demo-step.is-active,
  .demo-candidates li {
    animation: none;
    transition: none;
  }
}

/* How to use */

.howto-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(3, 1fr);
}

.howto-list li {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 20px;
}

.howto-list p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}

/* Plain list */

.plain-list {
  padding-left: 1.4em;
  color: var(--color-text-muted);
}

.plain-list li {
  margin-bottom: 8px;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 24px 0;
  color: var(--color-text-muted);
  font-size: 0.8rem;
}

/* Modal (Fake Door) */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 24, 30, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  background: #fff;
  border-radius: 10px;
  padding: 32px;
  max-width: 480px;
  width: 100%;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 6px 10px;
}

.modal-close:hover {
  color: var(--color-text);
}

.format-question {
  border-top: 1px solid var(--color-border);
  margin-top: 20px;
  padding-top: 20px;
}

.format-question-title {
  font-size: 0.95rem;
  margin-bottom: 12px;
}

.optional-tag {
  color: var(--color-text-muted);
  font-size: 0.8rem;
  margin-left: 6px;
}

.format-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.format-thanks {
  color: var(--color-primary);
  font-size: 0.9rem;
}

.modal .btn-secondary {
  margin-top: 8px;
}

/* Responsive */

@media (max-width: 768px) {
  h1 {
    font-size: 1.6rem;
  }

  .hero {
    padding: 48px 0 36px;
  }

  .beforeafter {
    grid-template-columns: 1fr;
  }

  .howto-list {
    grid-template-columns: 1fr;
  }

  .demo-panel {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 16px;
  }

  .btn {
    width: 100%;
  }

  .format-options {
    flex-direction: column;
  }

  .format-options .btn {
    width: 100%;
  }
}
