/* House manual — editorial paper surfaces, shared Atelier light/dark tokens. */
.house-manual {
  --hm-paper: var(--atelier-paper, var(--paper, #fbfaf6));
  --hm-ink: var(--atelier-ink, var(--ink, #20231f));
  --hm-muted: var(--atelier-soft, var(--muted, #686b62));
  --hm-line: var(--atelier-line, var(--line, #d8d4c9));
  --hm-accent: var(--atelier-olive, var(--moss, #566454));

  box-sizing: border-box;
  width: 100%;
  min-width: 0;
  color: var(--hm-ink);
  background: var(--hm-paper);
  font-family: var(--font-ui, "Inter", system-ui, sans-serif);
  overflow-wrap: anywhere;
}

/* The public document is intentionally narrower than the application shell. */
main.house-manual {
  width: min(100%, 880px);
  margin-inline: auto;
  padding: 34px 0 64px;
}

/* In the existing detail modal, use all of its available content width. */
#detailContent .house-manual {
  width: 100%;
  max-width: none;
  margin: 0;
}

.house-manual :is(h1, h2, h3, h4) {
  margin: 0;
  color: var(--hm-ink);
  font-family: var(--font-display, "Cormorant Garamond", Georgia, serif);
  font-weight: 400;
  overflow-wrap: anywhere;
}

.house-manual h1 {
  font-size: clamp(36px, 6vw, 54px);
  line-height: 1.02;
  letter-spacing: -.025em;
}

.house-manual h2 {
  font-size: clamp(25px, 4vw, 32px);
  line-height: 1.12;
}

.house-manual h3,
.house-manual h4 {
  font-size: 23px;
  line-height: 1.2;
}

.hm-section {
  min-width: 0;
  padding: 22px 0;
  border-top: 1px solid var(--hm-line);
}

.hm-section:first-child {
  border-top: 0;
}

.hm-item {
  min-width: 0;
  padding: 14px 0;
  border-bottom: 1px solid var(--hm-line);
  color: var(--hm-ink);
  overflow-wrap: anywhere;
}

.hm-item:last-child {
  border-bottom: 0;
}

.hm-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  min-width: 0;
  min-height: 44px;
}

.hm-row > :first-child:is(input[type="checkbox"], [type="checkbox"]) {
  flex: 0 0 18px;
  width: 18px;
  height: 18px;
  margin: 12px 0 0;
  accent-color: var(--hm-accent);
}

.hm-row > :not(input[type="checkbox"]) {
  min-width: 0;
  overflow-wrap: anywhere;
}

.hm-row > label:has(> input[type="checkbox"]) {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 44px;
  min-height: 44px;
  min-width: 44px;
}

.hm-private {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid var(--hm-line);
  border-radius: 999px;
  color: var(--hm-muted);
  font: 500 11px/1.3 var(--font-ui, "Inter", system-ui, sans-serif);
  letter-spacing: .035em;
  vertical-align: middle;
}

.hm-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 10px;
  min-width: 0;
  margin-top: 14px;
}

.hm-actions :is(button, a[href], [role="button"]) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 44px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--hm-line);
  border-radius: var(--radius-control, 6px);
  background: var(--hm-paper);
  color: var(--hm-ink);
  font: 500 13px/1.35 var(--font-ui, "Inter", system-ui, sans-serif);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.hm-actions .primary-btn {
  background: var(--hm-accent);
  color: var(--hm-paper);
  border: 1px solid var(--hm-accent);
  border-radius: 22px;
  font-size: 11px;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.hm-actions .text-button {
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--hm-accent);
}

.hm-actions :is(button, a[href], [role="button"]):hover {
  border-color: var(--hm-accent);
}

.hm-actions :is(button, a[href], [role="button"]):focus-visible,
.house-manual :is(input, textarea, select, button, a[href], [tabindex]):focus-visible {
  outline: 2px solid var(--hm-accent);
  outline-offset: 2px;
  box-shadow: none;
}

.hm-missing,
.hm-error {
  min-width: 0;
  margin: 18px 0;
  padding: 14px 16px;
  border: 1px solid var(--hm-line);
  color: var(--hm-muted);
  font: 400 14px/1.55 var(--font-ui, "Inter", system-ui, sans-serif);
  overflow-wrap: anywhere;
}

.hm-error {
  border-color: color-mix(in srgb, var(--oxblood, #713b35) 45%, var(--hm-line));
  color: var(--oxblood, #713b35);
}

.hm-media {
  display: block;
  box-sizing: border-box;
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: min(70vh, 560px);
  margin: 14px 0;
  border: 1px solid var(--hm-line);
  object-fit: contain;
}

.house-manual video.hm-media {
  width: 100%;
}

@media (max-width: 767px) {
  main.house-manual {
    width: 100%;
    padding: 24px 20px 48px;
  }

  .house-manual h1 {
    font-size: clamp(34px, 11vw, 46px);
  }

  .hm-section {
    padding-block: 18px;
  }

  .hm-item {
    padding-block: 12px;
  }

  .hm-actions {
    gap: 4px 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .house-manual *,
  .house-manual *::before,
  .house-manual *::after {
    scroll-behavior: auto;
    transition-duration: .01ms;
    animation-duration: .01ms;
  }
}
