/* Bagmutskiy — refund / cancellation policy
   Operational 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;
}

html:has(body.bagmutskiy-terms) {
  overflow-x: visible;
}

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

body.bagmutskiy-terms footer,
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", "Graphik Compact", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 1.0625rem;
  line-height: 1.55;
  padding: 2rem 0 5.5rem;
  overflow-wrap: break-word;
}

.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 {
  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-docs-inline {
  margin-top: 0.85rem;
  max-width: 36rem;
}

.doc-updated {
  margin-top: 1rem;
  padding: 0.75rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.95rem;
  max-width: 36rem;
}

.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-doc p + p,
.terms-doc p + ul,
.terms-doc ul + p,
.terms-doc p + ol,
.terms-doc ol + p,
.terms-doc .facts + p,
.terms-doc .matrix + p,
.terms-doc .bound + p,
.terms-doc .who-paid + p,
.terms-doc .counts + p,
.terms .example + .example {
  margin-top: 0.85rem;
}

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

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

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

.facts dd {
  font-weight: 600;
}

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

.terms-muted {
  margin-top: 0.7rem;
}

.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);
}

.bound {
  margin-top: 1.1rem;
  padding: 0.8rem 0;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  font-weight: 600;
  font-size: 1.05rem;
}

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

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

.plain {
  list-style: disc;
}

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

.matrix > div {
  display: grid;
  gap: 0.35rem;
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
}

.matrix dt {
  font-weight: 600;
  font-size: 1.05rem;
}

.matrix dd {
  color: var(--ink);
}

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

.who-paid > div {
  display: grid;
  gap: 0.3rem;
  padding: 0.85rem 0 0.85rem 0.9rem;
  border-bottom: 1px solid var(--line);
  border-left: 2px solid var(--line);
}

.who-paid dt {
  font-weight: 600;
}

.who-paid dd {
  color: var(--ink);
}

.counts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.4rem 2rem;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
}

.counts h3 {
  margin-top: 0;
  overflow-wrap: anywhere;
}

.counts ul {
  margin-top: 0.45rem;
}

.double-count {
  margin-top: 1.1rem;
  font-weight: 600;
}

.examples {
  display: grid;
  gap: 1.15rem;
  margin-top: 0.2rem;
}

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

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

.example-kicker {
  color: var(--muted);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.example h3 {
  margin: 0 0 0.45rem;
  font-size: 1.02rem;
}

.calc {
  margin-top: 0.55rem;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.calc p {
  margin-top: 0.2rem;
}

.calc-result {
  font-weight: 600;
}

.source-link {
  margin-top: 0.85rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.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;
    margin: 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);
  }

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

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

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

  .contact-links {
    display: none;
  }

  body.bagmutskiy-terms .elementor-location-popup,
  body.bagmutskiy-terms .dialog-widget-content,
  body.bagmutskiy-terms .elementor-sticky--active,
  body.bagmutskiy-terms .wpsr-fm-chat-wrapper,
  body.bagmutskiy-terms a:has(img[alt="chat"]),
  body.bagmutskiy-terms img[alt="chat"] {
    display: none !important;
  }
}

@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 {
    grid-template-columns: minmax(0, 1fr);
    gap: 0.15rem;
  }

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