/* Bagmutskiy — payment & booking terms
   Utility document inside the live site chrome. */

.bagmutskiy-terms .entry-header,
.bagmutskiy-terms-main .entry-header {
  display: none;
}

body.bagmutskiy-terms,
body.bagmutskiy-terms #page,
body.bagmutskiy-terms #content,
body.bagmutskiy-terms #primary,
body.bagmutskiy-terms .site-main,
body.bagmutskiy-terms .ast-container {
  background: #f4f2ee;
}

/* Site Customizer sets `body, html { overflow-x: hidden }`. That makes both
   a scroll containment, so `position: sticky` on the TOC never engages.
   Override only this page; clip header/footer if they overflow instead. */
html:has(body.bagmutskiy-terms) {
  overflow-x: visible;
}

body.bagmutskiy-terms {
  overflow-x: visible;
}

body.bagmutskiy-terms header,
body.bagmutskiy-terms footer,
body.bagmutskiy-terms #masthead,
body.bagmutskiy-terms #colophon {
  overflow-x: clip;
}

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

.bagmutskiy-terms #primary,
.bagmutskiy-terms-main {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.terms {
  --paper: #f4f2ee;
  --paper-2: #ece9e3;
  --ink: #1a1916;
  --muted: #5c5a55;
  --line: #d9d4cb;
  --accent: #1a3a32;
  --header-offset: 7.5rem;
  --measure: 40rem;
  background: var(--paper);
  color: var(--ink);
  font-family: "Graphik Compact", "Source Sans 3", system-ui, -apple-system, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.55;
  padding: 2rem 0 5.5rem;
}

.terms :where(h1, h2, h3, p, ul, ol, dl, pre) {
  margin: 0;
}

.terms a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.terms a:hover {
  color: #12291f;
}

.terms a:focus-visible,
.terms button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.terms-layout {
  display: grid;
  grid-template-columns: 12.5rem minmax(0, var(--measure));
  grid-template-areas:
    "toc hero"
    "toc summary"
    "toc rest";
  column-gap: 3.25rem;
  row-gap: 0.35rem;
  max-width: 62rem;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.terms-toc { grid-area: toc; }
.terms-hero { grid-area: hero; }
.terms-summary { grid-area: summary; }
.terms-doc { grid-area: rest; }

.terms-toc {
  position: sticky;
  top: calc(var(--header-offset) + 12px);
  align-self: start;
  z-index: 2;
  font-size: 0.875rem;
  line-height: 1.4;
}

.terms-toc-label {
  margin: 0 0 0.6rem;
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.terms-toc ol {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 1px solid var(--line);
}

.terms-toc a {
  display: block;
  padding: 0.28rem 0 0.28rem 0.85rem;
  color: var(--muted);
  text-decoration: none;
  box-shadow: inset 2px 0 0 transparent;
}

.terms-toc a:hover,
.terms-toc a[aria-current="true"] {
  color: var(--ink);
  box-shadow: inset 2px 0 0 var(--ink);
}

.terms-hero h1 {
  font-size: clamp(1.7rem, 3vw, 2.15rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.terms-lead {
  margin-top: 0.75rem;
  max-width: 36rem;
  color: var(--muted);
  font-size: 1.0625rem;
}

.terms-summary {
  margin-top: 1.6rem;
}

.terms-section {
  margin-top: 2.4rem;
  padding-top: 0.2rem;
}

.terms-section[id],
.terms-summary,
.terms #contact {
  scroll-margin-top: calc(var(--header-offset) + 12px + 0.75rem);
}

.terms h1,
.terms h2,
.terms h3 {
  color: var(--ink);
}

.terms h2 {
  font-size: 1.2rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin-bottom: 0.85rem;
}

.terms h3 {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 1.25rem 0 0.45rem;
}

.terms p + p,
.terms p + ul,
.terms ul + p,
.terms .split + h3,
.terms .facts + p {
  margin-top: 0.85rem;
}

.facts {
  display: grid;
  border-top: 1px solid var(--line);
}

.facts > div {
  display: grid;
  grid-template-columns: 12.5rem minmax(0, 1fr);
  gap: 0.75rem 1.25rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--line);
}

.facts dt {
  color: var(--muted);
  font-weight: 400;
}

.facts dd {
  font-weight: 600;
}

.facts-compact > div {
  grid-template-columns: 9.25rem minmax(0, 1fr);
}

.terms-note,
.terms-muted {
  color: var(--muted);
  font-size: 0.95rem;
}

.steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.85rem;
}

.terms ol.steps,
.bagmutskiy-terms .terms ol.steps,
.terms ol.steps > li,
.bagmutskiy-terms .terms ol.steps > li {
  list-style: none;
  list-style-type: none;
  padding-left: 0;
  margin-left: 0;
}

.terms ol.steps > li::marker,
.terms ol.steps > li::before {
  content: none;
}

.steps li {
  display: grid;
  grid-template-columns: 1.7rem minmax(0, 1fr);
  gap: 0.7rem;
  align-items: start;
}

.step-n {
  width: 1.7rem;
  height: 1.7rem;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.callout {
  margin-top: 1.1rem;
  padding: 0.85rem 1rem;
  background: var(--paper-2);
  border-left: 3px solid var(--ink);
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.4rem 2rem;
}

.split h3 {
  margin-top: 0;
}

.terms ul {
  padding-left: 1.1rem;
}

.terms li + li {
  margin-top: 0.35rem;
}

.plain {
  list-style: disc;
}

.rules {
  display: grid;
  gap: 0.65rem;
}

.rule {
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--line);
}

.rule:first-child {
  border-top: 1px solid var(--line);
}

.lead-answer {
  font-weight: 600;
}

.rule-when {
  font-weight: 600;
  font-size: 1.05rem;
  margin-bottom: 0.25rem;
}

.rule-then {
  color: var(--ink);
}

.requisites {
  margin-top: 0.6rem;
  padding: 1rem 1rem 1.1rem;
  background: #fffdf9;
  border: 1px solid var(--line);
}

.requisites-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.copy-btn {
  appearance: none;
  border: 1px solid var(--ink);
  background: #fffdf9;
  color: var(--ink);
  font: inherit;
  font-size: 0.9rem;
  padding: 0.55rem 0.9rem;
  cursor: pointer;
  min-height: 44px;
}

.copy-btn:hover {
  background: var(--ink);
  color: #fffdf9;
}

.copy-btn:active {
  transform: translateY(1px);
}

.copy-btn.is-copied {
  background: var(--ink);
  color: #fffdf9;
}

.copy-status {
  font-size: 0.85rem;
  color: var(--muted);
}

.requisites-text {
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.docs {
  list-style: none;
  padding: 0;
  border-top: 1px solid var(--line);
}

.docs li {
  display: grid;
  gap: 0.15rem;
  padding: 0.8rem 0;
  border-bottom: 1px solid var(--line);
  margin: 0;
}

.docs a {
  font-weight: 600;
  text-decoration: none;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.docs a:hover {
  text-decoration: underline;
}

.docs span {
  color: var(--muted);
  font-size: 0.95rem;
}

.terms-contact {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.25rem;
  margin-top: 0.7rem;
}

.contact-links a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.text-link {
  font-weight: 600;
}

@media (max-width: 900px) {
  .terms-layout {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "hero"
      "summary"
      "toc"
      "rest";
    max-width: 42rem;
    row-gap: 1.1rem;
  }

  .terms-toc {
    position: sticky;
    top: var(--header-offset);
    z-index: 6;
    background: var(--paper);
    padding: 0.3rem 1.25rem 0.45rem;
    margin: 0 -1.25rem;
  }

  .terms-toc::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 100%;
    height: 3px;
    background: var(--paper);
  }

  .terms-toc-label {
    display: none;
  }

  .terms-toc ol {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    overflow-x: auto;
    border-left: 0;
    padding: 0;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .terms-toc ol::-webkit-scrollbar {
    display: none;
  }

  .terms-section[id],
  .terms-summary,
  .terms #contact {
    scroll-margin-top: calc(var(--header-offset) + 4.25rem);
  }

  .terms .terms-toc li,
  .terms .terms-toc li + li {
    flex: 0 0 auto;
    margin: 0;
  }

  .terms-toc a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0.45rem 0.85rem;
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: none;
    white-space: nowrap;
    font-size: 0.875rem;
  }

  .terms-toc a:hover,
  .terms-toc a[aria-current="true"] {
    box-shadow: none;
    background: var(--ink);
    color: #fffdf9;
    border-color: var(--ink);
  }

  .split {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  .copy-btn:active {
    transform: none;
  }

  html {
    scroll-behavior: auto;
  }
}

@media print {
  .terms-toc {
    position: static;
    display: none;
  }

  .terms {
    padding: 0;
    overflow: visible;
    background: #fff;
  }

  .copy-btn,
  .copy-status {
    display: none;
  }
}

@media (max-width: 720px) {
  .terms {
    --header-offset: 6.5rem;
    font-size: 1rem;
    padding: 1.4rem 0 calc(4.5rem + env(safe-area-inset-bottom, 0px));
  }

  .facts > div,
  .facts-compact > div {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.15rem;
  }

  .split {
    grid-template-columns: minmax(0, 1fr);
  }

  .requisites {
    padding: 0.85rem;
  }
}
