/* ── Policy pages (terms/privacy/cookie/cancellation/dmca) ──
   Built only from the theme's tokens (--paper, --ink, --rule, --theme-500,
   --font-display, --radius), so each theme and html.dark get their own
   version. Themes add their face through their skin's .policy-* rules. */
.policy-hero,
.policy-main {
  --pp-accent: var(--theme-600, var(--theme-500, #2563eb));
  --pp-wash: color-mix(in srgb, var(--theme-500, #2563eb) 11%, transparent);
  --pp-wash-strong: color-mix(in srgb, var(--theme-500, #2563eb) 18%, transparent);
  --pp-radius: var(--radius, 16px);
  --pp-ui: var(--font-ui, 'Inter', system-ui, sans-serif);
}

/* Header */
.policy-hero {
  position: relative;
  background:
    radial-gradient(60rem 22rem at 100% 0%, var(--pp-wash), transparent 70%),
    var(--paper);
  border-bottom: 1px solid var(--rule);
}
.policy-hero__grain {
  position: absolute; inset: 0; pointer-events: none;
  background: var(--noise, none); opacity: .045; mix-blend-mode: multiply;
}
.policy-hero__inner {
  position: relative;
  width: 100%; max-width: 72rem; margin: 0 auto;
  padding: clamp(2rem, 6vw, 4.25rem) 1rem clamp(1.5rem, 4vw, 2.5rem);
}
@media (min-width: 640px) { .policy-hero__inner { padding-inline: 2rem; } }
.policy-hero__head { display: flex; align-items: center; gap: clamp(.75rem, 2vw, 1.15rem); min-width: 0; }
.policy-hero__badge {
  flex: none; display: grid; place-items: center;
  width: clamp(2.6rem, 6vw, 3.4rem); height: clamp(2.6rem, 6vw, 3.4rem);
  border-radius: calc(var(--pp-radius) * .8);
  background: var(--pp-wash); color: var(--pp-accent);
  border: 1px solid color-mix(in srgb, var(--theme-500, #2563eb) 28%, transparent);
  font-size: clamp(1.05rem, 2.6vw, 1.4rem);
}
.policy-hero__title {
  min-width: 0; margin: 0;
  font-family: var(--font-display, Georgia, serif);
  font-size: clamp(1.75rem, 5.2vw, 3.4rem);
  font-weight: 600; line-height: 1.12; letter-spacing: -0.02em;
  color: var(--ink);
  overflow-wrap: break-word; hyphens: auto;
}
.policy-hero__meta {
  display: flex; flex-wrap: wrap; gap: .4rem 1.25rem;
  margin: 1.1rem 0 0; padding: 0; list-style: none;
  font-family: var(--pp-ui); font-size: .875rem; color: var(--ink-soft);
}
.policy-hero__meta li { display: inline-flex; align-items: center; gap: .45rem; }
.policy-hero__meta i { color: var(--pp-accent); font-size: .8em; }
.policy-hero__meta time { font-variant-numeric: tabular-nums; color: var(--ink-2); font-weight: 600; }

.policy-tabs { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.5rem; }
.policy-tabs__link {
  display: inline-flex; align-items: center; gap: .45rem;
  padding: .45rem .9rem; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--paper-2);
  font-family: var(--pp-ui); font-size: .8125rem; font-weight: 600; line-height: 1.3;
  color: var(--ink-2); text-decoration: none;
  transition: border-color .15s ease, color .15s ease, background-color .15s ease;
}
.policy-tabs__link i { font-size: .8em; color: var(--ink-soft); }
.policy-tabs__link:hover { border-color: var(--theme-500); color: var(--ink); }
.policy-tabs__link.is-current { background: var(--pp-wash-strong); border-color: var(--theme-500); color: var(--ink); }
.policy-tabs__link.is-current i { color: var(--pp-accent); }

/* Body: text column and a side column that holds the contents and help */
.policy-main {
  width: 100%; max-width: 72rem; margin: 0 auto;
  padding: 2rem 1rem 7rem;
}
@media (min-width: 640px) { .policy-main { padding-inline: 2rem; } }
@media (min-width: 1024px) { .policy-main { padding-block: 3.25rem 4.5rem; } }
.policy-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2.5rem; align-items: start; }
@media (min-width: 1024px) { .policy-layout { grid-template-columns: minmax(0, 1fr) 16.5rem; gap: 4rem; } }
.policy-col { min-width: 0; max-width: 46rem; }
.policy-aside { min-width: 0; }
.policy-aside__sticky { display: flex; flex-direction: column; gap: 1.25rem; }
@media (min-width: 1024px) {
  .policy-aside__sticky { position: sticky; top: 6rem; max-height: calc(100vh - 7.5rem); overflow-y: auto; scrollbar-width: thin; }
}

/* On this page */
.policy-toc {
  border: 1px solid var(--rule); border-radius: var(--pp-radius);
  background: var(--paper-2);
  font-family: var(--pp-ui);
}
.policy-toc--side { display: none; padding: 1.1rem 1rem 1rem; }
.policy-toc--inline { display: block; margin-bottom: 2rem; }
@media (min-width: 1024px) {
  .policy-toc--side { display: block; }
  .policy-toc--inline { display: none; }
}
.policy-toc__title {
  margin: 0 0 .7rem; padding-inline-start: .2rem;
  font-size: .7rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-soft);
}
.policy-toc__summary {
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding: .9rem 1.1rem; cursor: pointer; list-style: none;
  font-size: .9rem; font-weight: 600; color: var(--ink);
}
.policy-toc__summary::-webkit-details-marker { display: none; }
.policy-toc__summary > span { display: inline-flex; align-items: center; gap: .55rem; }
.policy-toc__summary i { color: var(--pp-accent); }
.policy-toc__chev { font-size: .75rem; transition: transform .2s ease; }
.policy-toc[open] .policy-toc__chev { transform: rotate(180deg); }
.policy-toc--inline .policy-toc__list { margin: 0 1.1rem 1rem; }
.policy-toc__list { list-style: none; margin: 0; padding: 0; border-inline-start: 2px solid var(--rule); }
.policy-toc__item a {
  display: block; margin-inline-start: -2px;
  padding: .38rem .75rem;
  border-inline-start: 2px solid transparent;
  font-size: .84rem; line-height: 1.4; color: var(--ink-soft); text-decoration: none;
  overflow-wrap: break-word;
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.policy-toc__item.is-sub a { padding-inline-start: 1.5rem; font-size: .8rem; }
.policy-toc__item a:hover { color: var(--ink); border-inline-start-color: var(--rule); }
.policy-toc__item a.is-active { color: var(--ink); font-weight: 600; border-inline-start-color: var(--theme-500); background: var(--pp-wash); }

/* Help card */
.policy-help {
  display: flex; gap: .85rem; align-items: flex-start;
  padding: 1.1rem 1.1rem 1.15rem;
  border: 1px solid var(--rule); border-radius: var(--pp-radius);
  background: var(--paper-2);
  font-family: var(--pp-ui);
}
.policy-help__icon {
  flex: none; display: grid; place-items: center; width: 2.25rem; height: 2.25rem;
  border-radius: 999px; background: var(--pp-wash); color: var(--pp-accent);
}
.policy-help__body { min-width: 0; }
.policy-help__title { margin: 0; font-size: .92rem; font-weight: 700; color: var(--ink); line-height: 1.35; }
.policy-help__text { margin: .3rem 0 .6rem; font-size: .82rem; line-height: 1.55; color: var(--ink-soft); }
.policy-help__link { font-size: .85rem; }

/* The store's own policy text (Admin → Pages), styled where it lands so
   nothing in the saved HTML has to change. */
.policy-prose {
  font-family: var(--pp-ui, 'Inter', system-ui, sans-serif);
  font-size: 1rem;
  line-height: 1.8;
  color: var(--ink-2);
  overflow-wrap: break-word;
}
.policy-prose > :first-child { margin-top: 0; }
.policy-prose h1,
.policy-prose h2,
.policy-prose h3,
.policy-prose h4,
.policy-prose h5,
.policy-prose h6 {
  font-family: var(--font-display, 'Fraunces', Georgia, serif);
  letter-spacing: -0.015em;
  color: var(--ink);
  margin-top: 2.25rem;
  margin-bottom: 0.7rem;
  line-height: 1.25;
  scroll-margin-top: 6.5rem;
}
.policy-prose h1 { font-size: clamp(1.6rem, 4vw, 2rem); font-weight: 700; }
.policy-prose h2 { font-size: clamp(1.3rem, 3.2vw, 1.55rem); font-weight: 600; }
/* Kept at the lowest weight so a theme's own heading marks win over them. */
.policy-prose :where(h2) { padding-top: 1.5rem; border-top: 1px solid var(--rule); }
.policy-prose > :where(h2:first-child) { padding-top: 0; border-top: 0; }
.policy-prose h3 { font-size: clamp(1.1rem, 2.6vw, 1.22rem); font-weight: 600; }
.policy-prose h4 { font-size: 1.02rem; font-weight: 600; }
.policy-prose h5,
.policy-prose h6 { font-size: .95rem; font-weight: 700; }
.policy-prose p  { margin: 0 0 1.1rem; }
.policy-prose ul,
.policy-prose ol { padding-inline-start: 1.4rem; margin: 0 0 1.25rem; }
.policy-prose ul { list-style: disc; }
.policy-prose ol { list-style: decimal; }
.policy-prose ul ul { list-style: circle; margin: .4rem 0 .2rem; }
.policy-prose li { margin-bottom: 0.45rem; padding-inline-start: .2rem; }
.policy-prose li::marker { color: var(--theme-500); }
.policy-prose ol > li::marker { font-weight: 600; font-variant-numeric: tabular-nums; }
.policy-prose a  { color: var(--pp-accent, var(--theme-600)); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; overflow-wrap: anywhere; }
.policy-prose a:hover { color: var(--theme-500); text-decoration-thickness: 2px; }
.policy-prose strong,
.policy-prose b { color: var(--ink); font-weight: 600; }
.policy-prose blockquote {
  margin: 1.5rem 0;
  padding: 1rem 1.25rem;
  border-inline-start: 3px solid var(--theme-500);
  border-radius: 0 calc(var(--pp-radius, 16px) * .6) calc(var(--pp-radius, 16px) * .6) 0;
  background: var(--pp-wash, var(--paper-2));
  color: var(--ink-2);
}
[dir="rtl"] .policy-prose blockquote { border-radius: calc(var(--pp-radius, 16px) * .6) 0 0 calc(var(--pp-radius, 16px) * .6); }
.policy-prose blockquote > :last-child { margin-bottom: 0; }
.policy-prose img { max-width: 100%; height: auto; border-radius: calc(var(--pp-radius, 16px) * .6); }
/* The store's logo and its dark twin (policy_page_logo_pair()): one shows
   in each mode, as in the header, and the dark one needs none of the light
   card a theme mounts pasted pictures on after dark. */
html:not(.dark) .policy-prose img.policy-logo-dark,
html.dark body .policy-prose img.policy-logo-light { display: none; }
html.dark body .policy-prose img.policy-logo-dark { background: none; padding: 0; box-shadow: none; }
.policy-prose figure { margin: 1.5rem 0; max-width: 100%; }
.policy-prose figcaption { margin-top: .5rem; font-size: .82rem; color: var(--ink-soft); }
/* Older saved policies can still carry a table; it scrolls in its own box
   on a phone instead of widening the page. */
.policy-prose table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; margin: 0 0 1.5rem; font-size: 0.9rem; }
.policy-prose th { text-align: start; padding: 0.6rem 1rem; font-weight: 600; color: var(--ink); background: var(--paper-2); border: 1px solid var(--rule); }
.policy-prose td { padding: 0.6rem 1rem; border: 1px solid var(--rule); color: var(--ink-2); vertical-align: top; }
.policy-prose hr { border: none; border-top: 1px solid var(--rule); margin: 2rem 0; }
.policy-prose code { font-family: 'JetBrains Mono', ui-monospace, monospace; font-size: 0.85em; background: var(--paper-2); border: 1px solid var(--rule); border-radius: 4px; padding: 0.1em 0.4em; color: var(--ink); overflow-wrap: anywhere; }
.policy-prose pre { max-width: 100%; overflow-x: auto; white-space: pre-wrap; }

/* Cards in the text column: cookie preferences on /cookie, the generated
   processor list on /privacy, the missing-agent notice on /dmca. */
.policy-preferences {
  margin-top: 3rem;
  padding: 1.4rem 1.5rem;
  border: 1px solid var(--rule);
  border-radius: var(--pp-radius, 14px);
  background: var(--paper-2);
  font-family: var(--pp-ui, 'Inter', system-ui, sans-serif);
  scroll-margin-top: 6.5rem;
}
.policy-preferences h2 {
  margin: 0 0 .4rem;
  font-family: var(--font-display, Georgia, serif);
  font-size: 1.2rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--ink);
}
.policy-preferences__state {
  margin: 0 0 1rem;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--ink-soft);
}
.policy-preferences__actions { display: flex; flex-wrap: wrap; gap: 10px; }

/* Cookie preferences: what is on, what can be changed, and the button. */
.policy-consent { margin-top: 0; margin-bottom: 2.5rem; box-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 12px 32px -18px rgba(0, 0, 0, .25); }
.policy-consent__head { display: flex; gap: 1rem; align-items: flex-start; }
.policy-consent__icon {
  flex: none; display: grid; place-items: center; width: 2.75rem; height: 2.75rem;
  border-radius: calc(var(--pp-radius) * .7);
  background: var(--pp-wash); color: var(--pp-accent); font-size: 1.05rem;
}
.policy-consent__intro { min-width: 0; }
.policy-consent__intro .policy-preferences__state { margin-bottom: 0; }
.policy-consent__rows { list-style: none; margin: 1.25rem 0; padding: 0; display: grid; gap: .65rem; }
.policy-consent__row {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .35rem .9rem; align-items: center;
  padding: .85rem 1rem;
  border: 1px solid var(--rule); border-radius: calc(var(--pp-radius) * .7);
  background: var(--paper);
}
.policy-consent__glyph {
  display: grid; place-items: center; width: 2.25rem; height: 2.25rem; border-radius: 999px;
  background: var(--paper-2); color: var(--ink-soft); font-size: .85rem;
}
.policy-consent__text { min-width: 0; }
.policy-consent__name { margin: 0; font-size: .93rem; font-weight: 600; color: var(--ink); line-height: 1.35; }
.policy-consent__desc { margin: .15rem 0 0; font-size: .8125rem; line-height: 1.5; color: var(--ink-soft); }
.policy-consent__pill {
  display: inline-flex; align-items: center; gap: .4rem; justify-self: end;
  padding: .28rem .7rem; border-radius: 999px;
  font-size: .75rem; font-weight: 700; line-height: 1.3; text-align: center;
}
.policy-consent__pill::before { content: ''; flex: none; width: .45rem; height: .45rem; border-radius: 999px; background: currentColor; }

.policy-third-parties { margin-top: 3rem; }

/* Called out on dmca.php when no designated agent has been published yet —
   the operator needs to see that, and so does anyone trying to send a notice. */
.policy-notice {
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid rgba(180, 120, 20, 0.35);
  background: rgba(180, 120, 20, 0.08);
}

/* Generated processor table on /privacy. Scrolls inside its own box on a
   phone rather than pushing the page sideways — the table is the one thing
   here that genuinely cannot reflow to 360px. */
.policy-processors { overflow-x: auto; margin-top: 8px; }

.policy-processors table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 0.8rem;
}

.policy-processors th,
.policy-processors td {
  text-align: start;
  vertical-align: top;
  padding: 9px 12px;
  border-bottom: 1px solid var(--rule);
}

.policy-processors th {
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

.policy-processors td { color: var(--ink-soft); line-height: 1.55; }
.policy-processors tbody tr:last-child td { border-bottom: 0; }
.policy-processors td:first-child { color: var(--ink); font-weight: 600; }

@media (max-width: 480px) {
  .policy-preferences { padding: 1.1rem 1rem; }
  .policy-preferences__actions > * { flex: 1 1 100%; }
  .policy-consent__head { gap: .8rem; }
  .policy-consent__icon { width: 2.4rem; height: 2.4rem; }
  .policy-consent__row { grid-template-columns: auto minmax(0, 1fr); padding: .8rem .85rem; }
  .policy-consent__pill { grid-column: 2; justify-self: start; }
}

@media (prefers-reduced-motion: reduce) {
  .policy-tabs__link, .policy-toc__item a, .policy-toc__chev { transition: none; }
}
