/* =============================================================
   Antiphon — design system
   Palette: Warm Sand · Type: Bitter + IBM Plex Sans
   Direction: Paper Layers · Edges: Pill & feather
   ============================================================= */

/* ---------- 1. Tokens ---------- */

:root {
  --bg:        #FAF6EF;
  --surface:   #FFFDF8;
  --tint:      #F3EDE1;
  --zebra:     #F6F1E7;
  --chip:      #EFE3CE;
  --text:      #2E261A;
  --muted:     #6B5F4B;
  --accent:    #8C6A3F;
  --accent-h:  #75572F;
  --accent2:   #D9C29A;

  /* Accent fails as body-size text on tint, on the gradient and on accent2,
     so links carry their own deepened tone. Headings keep the accent. */
  --heading:   #8C6A3F;
  --link:      #6B5024;
  --on-accent: #FFFFFF;

  --rule:  rgba(140, 106, 63, .34);
  --edge:  rgba(46, 38, 26, .11);
  --sheet-shadow: 0 2px 12px rgba(46, 38, 26, .05);
  --lift-shadow:  0 10px 26px -14px rgba(46, 38, 26, .30);

  --space-1: 4px;  --space-2: 8px;  --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 64px;

  --pad:   clamp(16px, 4vw, 32px);
  --col:   42rem;
  --shell: 1140px;

  --r-card: 20px;
  --r-pill: 999px;
  --r-sm:   12px;

  --font-head: 'Bitter', Georgia, 'Times New Roman', serif;
  --font-body: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="dark"] {
  --bg:        #1B1712;
  --surface:   #251F17;
  --tint:      #2E261C;
  --zebra:     #221C15;
  --chip:      #332A1F;
  --text:      #F0EAE0;
  --muted:     #C0B29C;
  --accent:    #8F6B3C;
  --accent-h:  #7A5B31;
  --accent2:   #C6A572;

  /* Both accent tones fall under 4.5:1 on this ground, so headings and links
     move to accent2 in dark. On-accent text stays white in BOTH modes. */
  --heading:   #C6A572;
  --link:      #C6A572;
  --on-accent: #FFFFFF;

  --rule:  rgba(198, 165, 114, .36);
  --edge:  rgba(240, 234, 224, .13);
  --sheet-shadow: 0 2px 12px rgba(0, 0, 0, .32);
  --lift-shadow:  0 10px 26px -14px rgba(0, 0, 0, .55);
}

/* ---------- 2. Base ---------- */

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.125rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-family: var(--font-head);
  line-height: 1.22;
  letter-spacing: -0.005em;
}

/* margin-block only — a shorthand here would zero margin-inline and break
   the centred reading column. */
h1 { font-size: clamp(2rem, 1.35rem + 2.7vw, 3rem);      font-weight: 800; margin-block: 0 var(--space-5); }
h2 { font-size: clamp(1.45rem, 1.2rem + 1.05vw, 1.9rem); font-weight: 600; margin-block: var(--space-7) var(--space-4); color: var(--heading); }
h3 { font-size: 1.2rem; font-weight: 600; margin-block: var(--space-5) var(--space-3); }
p  { margin-block: 0 var(--space-4); }

.anp-skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--surface); color: var(--text);
  padding: var(--space-3) var(--space-4); border-radius: 0 0 var(--r-sm) 0; z-index: 60;
}
.anp-skip:focus { left: 0; }

/* ---------- 3. Header (sticky blur) ---------- */

.anp-bar {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--edge);
}
@supports (backdrop-filter: blur(14px)) or (-webkit-backdrop-filter: blur(14px)) {
  .anp-bar { -webkit-backdrop-filter: blur(14px) saturate(140%); backdrop-filter: blur(14px) saturate(140%); }
}
@supports not (background: color-mix(in srgb, red 50%, transparent)) {
  .anp-bar { background: var(--bg); }
}

.anp-bar__inner {
  max-width: var(--shell); margin-inline: auto;
  padding: var(--space-3) var(--pad);
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
}

.anp-brand {
  display: flex; align-items: center; gap: var(--space-3);
  text-decoration: none; color: var(--text); min-width: 0;
}
.anp-brand__mark { flex: none; display: inline-grid; place-items: center; }
.anp-mark__back  { fill: var(--accent2); }
.anp-mark__front { fill: var(--accent); }
.anp-mark__bars rect { fill: var(--on-accent); }

.anp-brand__name {
  font-family: var(--font-head); font-weight: 800;
  font-size: clamp(.98rem, .82rem + .7vw, 1.22rem);
  letter-spacing: -0.01em; line-height: 1.15;
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.anp-bar__actions { display: flex; align-items: center; gap: var(--space-2); flex: none; }

/* Icon-only buttons: fixed box, grid-centred. The svg reset must never carry
   max-width, or iOS Safari clamps these icons to zero width. */
.anp-icobtn {
  display: inline-grid; place-items: center;
  width: 42px; height: 42px; flex: none;
  border-radius: var(--r-pill); color: var(--text);
  border: 1px solid var(--edge); background: var(--surface);
  transition: background-color .18s ease, border-color .18s ease;
}
.anp-icobtn:hover { background: var(--tint); }

.anp-toggle__moon { display: none; }
[data-theme="dark"] .anp-toggle__sun  { display: none; }
[data-theme="dark"] .anp-toggle__moon { display: block; }

.anp-burger__box { display: grid; gap: 5px; width: 18px; }
.anp-burger__line { display: block; height: 2px; background: currentColor; border-radius: 2px; transition: transform .22s ease; }
.anp-burger[aria-expanded="true"] .anp-burger__line:first-child { transform: translateY(3.5px) rotate(45deg); }
.anp-burger[aria-expanded="true"] .anp-burger__line:last-child  { transform: translateY(-3.5px) rotate(-45deg); }

/* Desktop language dropdown. Scoped to the bar so no responsive rule can
   reach the in-sheet list, which uses a separate class family entirely. */
.anp-bar__actions .anp-lang { display: none; position: relative; }

.anp-lang__btn {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: 42px; padding: 0 var(--space-4);
  border: 1px solid var(--edge); border-radius: var(--r-pill);
  background: var(--surface); color: var(--text); font-size: .95rem;
}
.anp-lang__btn:hover { background: var(--tint); }
.anp-lang__btn[aria-expanded="true"] .anp-lang__chev { transform: rotate(180deg); }
.anp-lang__chev { transition: transform .2s ease; }

.anp-lang__menu {
  position: absolute; right: 0; top: calc(100% + 8px); min-width: 210px;
  background: var(--surface); border: 1px solid var(--edge);
  border-radius: var(--r-card); box-shadow: var(--lift-shadow);
  padding: var(--space-2); z-index: 31;
}
.anp-lang__list { margin: 0; padding: 0; list-style: none; }
.anp-lang__list li { margin: 0; }
.anp-lang__list a {
  display: flex; align-items: center; gap: var(--space-3);
  min-height: 42px; padding: 0 var(--space-3);
  border-radius: var(--r-sm); text-decoration: none; color: var(--text); font-size: .95rem;
}
.anp-lang__list a:hover { background: var(--tint); }

/* TranslatePress nests .trp-language-switcher-container INSIDE each <li>.
   Padding on both wrapper and anchor doubles every row, so the wrapper is
   neutralised and the tap target lives only on the anchor. */
.anp-lang__list .trp-language-switcher-container,
.anp-sheetnav__list .trp-language-switcher-container {
  display: block; padding: 0; margin: 0; min-height: 0; border: 0;
}
.anp-lang__list img,
.anp-sheetnav__list img { flex: none; width: 18px; height: auto; }

@media (min-width: 768px) {
  .anp-bar__actions .anp-lang { display: block; }
  /* The drawer holds only the language list and the two policy links, both
     already reachable at this width — so the burger is redundant furniture. */
  .anp-burger { display: none; }
}

/* ---------- 4. Drawer ---------- */

/* Scrim and panel are root siblings, above both the cookie notice (25) and
   the header (30), and the panel outranks the scrim so a tap on a sheet link
   navigates instead of closing. */
.anp-scrim {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(28, 22, 14, .46); border: 0;
  opacity: 0; transition: opacity .26s ease;
}
.anp-scrim.is-open { opacity: 1; }

.anp-sheet {
  position: fixed; z-index: 41;
  top: 0; right: 0; bottom: 0; width: min(88vw, 340px);
  background: var(--surface); border-left: 1px solid var(--edge);
  box-shadow: -18px 0 40px -28px rgba(28, 22, 14, .6);
  padding: var(--space-4) var(--space-5) var(--space-6);
  overflow-y: auto; overscroll-behavior: contain;
  transform: translateX(100%); transition: transform .28s ease;
}
.anp-sheet.is-open { transform: none; }

.anp-sheet__top { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); }
.anp-sheet__title {
  font-family: var(--font-head); font-weight: 600; font-size: 1.05rem;
  min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.anp-sheet .anp-sheet__label {
  font-size: .76rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--muted); margin-block: var(--space-5) var(--space-2);
}
.anp-sheetnav__list, .anp-sheet__links { margin: 0; padding: 0; list-style: none; }
.anp-sheetnav__list li, .anp-sheet__links li { margin: 0; }
.anp-sheetnav__list a, .anp-sheet__links a {
  display: flex; align-items: center; gap: var(--space-3);
  min-height: 46px; padding: 0 var(--space-3);
  border-radius: var(--r-sm); text-decoration: none; color: var(--text);
}
.anp-sheetnav__list a:hover, .anp-sheet__links a:hover { background: var(--tint); }

/* ---------- 5. Reading column ----------
   The gutter lives on the container and the children only claim a width, so
   a component's own padding can never lose the page gutter. Column is set in
   rem: at a shared `ch` value a heading is wider than a paragraph. */

.anp-main { display: block; }

.anp-entry {
  padding-inline: var(--pad);
  padding-block: var(--space-6) var(--space-8);
}
.anp-entry > * { max-width: var(--col); margin-inline: auto; }

/* The gate is the one exempt block: a full card with its own wider,
   still-centred max-width. */
.anp-entry > .anp-gate { max-width: 58rem; }

.anp-entry a:not([class]) {
  color: var(--link);
  text-decoration: none;
  background-image: linear-gradient(currentColor, currentColor);
  background-size: 0% 2px; background-repeat: no-repeat; background-position: 0 100%;
  transition: background-size .24s ease;
  padding-bottom: 2px;
}
.anp-entry a:not([class]):hover,
.anp-entry a:not([class]):focus-visible { background-size: 100% 2px; }

/* (0,2,0) so the element-scoped paragraph rule above cannot win. */
.anp-entry .anp-kicker {
  font-size: .8rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--muted); margin-block: 0 var(--space-4);
}

/* Lead paragraph is scoped to the heading, never :first-of-type — the kicker
   above the gate is also a <p> and would steal it. */
.anp-entry h1 + p { font-size: 1.2rem; color: var(--text); }

.anp-entry h2 {
  border-block-start: 2px solid var(--rule);
  padding-block-start: var(--space-4);
}

.anp-entry .wp-block-list {
  margin-block: 0 var(--space-5);
  padding-inline-start: 1.35em;
  list-style: disc;
}
.anp-entry .wp-block-list li { margin-block: 0 var(--space-2); }
.anp-entry .wp-block-list li::marker { color: var(--accent); }

.anp-quote {
  margin-block: var(--space-6);
  padding: var(--space-5) var(--space-5) var(--space-5) var(--space-6);
  background: var(--tint); border-radius: var(--r-card);
  border-inline-start: 3px solid var(--accent);
  position: relative;
}
.anp-quote p {
  margin-block: 0;
  font-family: var(--font-head); font-size: 1.18rem; font-weight: 600; line-height: 1.45;
}
.anp-quote cite { color: var(--muted); font-size: .9rem; }

.anp-btn, .anp-entry .anp-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 48px; padding: 0 var(--space-6);
  border-radius: var(--r-pill);
  background: var(--accent); color: var(--on-accent);
  text-decoration: none; background-image: none;
  font-weight: 500; letter-spacing: .01em;
  transition: background-color .2s ease, transform .2s ease;
}
.anp-btn:hover { background: var(--accent-h); background-image: none; }

/* ---------- 6. Age gate (boarding pass) ---------- */

.anp-gate { margin-block: 0 var(--space-7); }

.anp-gate__ticket {
  display: grid; grid-template-columns: 1fr;
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: var(--r-card);
  box-shadow: var(--sheet-shadow);
  overflow: clip;
}

.anp-gate__main { padding: var(--space-6) var(--space-5); }

.anp-gate .anp-gate__over {
  font-size: .76rem; text-transform: uppercase; letter-spacing: .12em;
  color: var(--muted); margin-block: 0 var(--space-3);
}
.anp-gate .anp-gate__q {
  font-family: var(--font-head); font-weight: 600;
  font-size: clamp(1.3rem, 1.05rem + 1.1vw, 1.75rem);
  line-height: 1.25; margin-block: 0 var(--space-5); color: var(--text);
}
.anp-gate .anp-gate__more {
  display: inline-block; margin-block: var(--space-4) 0;
  font-size: .95rem; color: var(--link); text-decoration: underline;
  text-underline-offset: 3px;
}

.anp-gate__btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 var(--space-6);
  border-radius: var(--r-pill);
  background: var(--accent); color: var(--on-accent);
  text-decoration: none; background-image: none;
  font-size: 1.02rem; font-weight: 500;
  transition: background-color .2s ease;
}
.anp-gate__btn:hover { background: var(--accent-h); }

/* Stub: perforation drawn as a dashed rule, with the two bg-coloured cutouts
   that make it read as a torn ticket. */
.anp-gate__stub {
  position: relative;
  display: grid; place-items: center;
  padding: var(--space-5);
  background: var(--tint);
  border-block-start: 2px dashed var(--rule);
  background-size: 200% 100%;
}
.anp-gate__stub::before,
.anp-gate__stub::after {
  content: ""; position: absolute; top: -11px;
  width: 20px; height: 20px; border-radius: var(--r-pill);
  background: var(--bg);
}
.anp-gate__stub::before { left: -10px; }
.anp-gate__stub::after  { right: -10px; }

.anp-gate__stamp {
  font-family: var(--font-head); font-weight: 800; font-size: 1.5rem;
  color: var(--accent);
  border: 2px dashed var(--accent);
  border-radius: var(--r-sm);
  padding: var(--space-2) var(--space-4);
  transform: rotate(-6deg);
}

@media (min-width: 768px) {
  .anp-gate__ticket { grid-template-columns: 1fr 220px; }
  .anp-gate__main { padding: var(--space-7) var(--space-7); }
  .anp-gate__stub {
    border-block-start: 0;
    border-inline-start: 2px dashed var(--rule);
  }
  .anp-gate__stub::before,
  .anp-gate__stub::after { top: auto; left: -11px; right: auto; }
  .anp-gate__stub::before { top: -10px; }
  .anp-gate__stub::after  { bottom: -10px; }
}

/* ---------- 7. Illustration ---------- */

.anp-illus-wrap { margin-block: var(--space-6); }
.anp-illus { width: 100%; height: auto; border-radius: var(--r-card); }
.anp-illus__bg    { fill: var(--tint); }
.anp-illus__sheet { fill: var(--surface); stroke: var(--edge); stroke-width: 1; }
.anp-illus__sheet--back { fill: var(--chip); stroke: none; }
.anp-illus__bar   { fill: var(--accent); }
.anp-illus__bar--alt { fill: var(--accent2); }
.anp-illus__edge path   { stroke: var(--muted); stroke-width: 2; }
.anp-illus__edge circle { fill: var(--accent); }

/* ---------- 8. Comparison table ---------- */

.anp-table-wrap {
  margin-block: 0 var(--space-6);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--edge);
  border-radius: var(--r-card);
  background: var(--surface);
}
.anp-table { width: 100%; min-width: 30rem; font-size: .97rem; }
.anp-table__cap {
  caption-side: top; text-align: left;
  padding: var(--space-4) var(--space-4) var(--space-2);
  color: var(--muted); font-size: .86rem;
}
.anp-table th, .anp-table td {
  padding: var(--space-3) var(--space-4);
  text-align: left; vertical-align: top;
  border-block-start: 1px solid var(--edge);
}
.anp-table thead th {
  font-family: var(--font-body); font-size: .78rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em; color: var(--muted);
  border-block-start: 0;
}
.anp-table tbody th { font-weight: 600; color: var(--text); }
.anp-table tbody tr:nth-child(odd) { background: var(--zebra); }

/* ---------- 9. FAQ ----------
   The answer stays in normal flow. A <details> height animation fails closed
   inside ::details-content, so only opacity moves. */

.anp-faq { margin-block: 0 var(--space-6); display: grid; gap: var(--space-3); }
.anp-faq__item {
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: var(--r-card);
  box-shadow: var(--sheet-shadow);
  padding: var(--space-4) var(--space-5);
}
.anp-faq .anp-faq__q {
  cursor: pointer; list-style: none;
  font-family: var(--font-head); font-weight: 600; font-size: 1.04rem;
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3);
  min-height: 32px;
}
.anp-faq__q::-webkit-details-marker { display: none; }
.anp-faq__q::after {
  content: "+"; flex: none;
  font-family: var(--font-body); font-size: 1.3rem; line-height: 1;
  color: var(--accent); transition: transform .2s ease;
}
.anp-faq__item[open] .anp-faq__q::after { transform: rotate(45deg); }
.anp-faq__a { padding-block-start: var(--space-3); }
.anp-faq__a p { margin-block: 0; color: var(--muted); }
.anp-faq__item[open] .anp-faq__a { animation: anp-fade .24s ease both; }
@keyframes anp-fade { from { opacity: 0; } to { opacity: 1; } }

/* ---------- 10. Chip marquee ----------
   The box is the reading column and clips its own scroll. It must never
   become a full-width row while the text sits in a narrow column. */

.anp-chips {
  margin-block: 0 var(--space-6);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}
.anp-chips__track {
  display: flex; gap: var(--space-3); width: max-content;
  animation: anp-slide 34s linear infinite;
}
.anp-chips:hover .anp-chips__track { animation-play-state: paused; }
.anp-chip {
  flex: none;
  background: var(--chip); color: var(--text);
  border-radius: var(--r-pill);
  padding: var(--space-2) var(--space-4);
  font-size: .93rem; white-space: nowrap;
}
@keyframes anp-slide { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- 11. Reveal ----------
   Scroll-driven where supported; an IntersectionObserver carries the rest.
   Nothing is parked at opacity 0 unless JS is running and has a failsafe. */

@supports (animation-timeline: view()) {
  .anp-entry > h2,
  .anp-entry > p,
  .anp-entry > figure,
  .anp-entry > blockquote,
  .anp-entry > ul,
  .anp-entry > .anp-faq,
  .anp-entry > .anp-chips,
  .anp-entry > .anp-table-wrap {
    animation: anp-rise linear both;
    animation-timeline: view();
    animation-range: entry 0% entry 42%;
  }
  .anp-entry > .anp-gate { animation: none; }
}
@keyframes anp-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

@supports not (animation-timeline: view()) {
  .anp-js .anp-reveal { opacity: 0; transform: translateY(12px); transition: opacity .5s ease, transform .5s ease; }
  .anp-js .anp-reveal.is-open { opacity: 1; transform: none; }
}

/* ---------- 12. Footer ---------- */

.anp-foot {
  border-block-start: 1px solid var(--edge);
  background: var(--surface);
  padding-block: var(--space-6);
}
.anp-foot__inner {
  max-width: var(--shell); margin-inline: auto; padding-inline: var(--pad);
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--space-4);
}
.anp-foot .anp-foot__copy { margin-block: 0; color: var(--muted); font-size: .93rem; }
.anp-foot__list { display: flex; flex-wrap: wrap; gap: var(--space-5); margin: 0; padding: 0; list-style: none; }
.anp-foot__list li { margin: 0; }
.anp-foot__list a { color: var(--muted); font-size: .93rem; text-decoration: none; }
.anp-foot__list a:hover { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 13. Cookie notice ---------- */

.anp-cookie {
  position: fixed; z-index: 25;
  left: var(--space-4); right: var(--space-4);
  bottom: calc(var(--space-4) + env(safe-area-inset-bottom, 0px));
  max-width: 30rem;
  background: var(--surface);
  border: 1px solid var(--edge);
  border-radius: var(--r-card);
  box-shadow: var(--lift-shadow);
  padding: var(--space-4) var(--space-5);
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-4);
  transform: translateY(12px); opacity: 0;
  transition: opacity .3s ease, transform .3s ease;
}
.anp-cookie.is-open { transform: none; opacity: 1; }
.anp-cookie .anp-cookie__text { margin-block: 0; font-size: .9rem; color: var(--muted); flex: 1 1 16rem; }
.anp-cookie__text a { color: var(--link); text-underline-offset: 3px; }
.anp-cookie__ok {
  min-height: 44px; padding: 0 var(--space-5);
  border-radius: var(--r-pill);
  background: var(--accent); color: var(--on-accent);
  font-size: .95rem; font-weight: 500; flex: none;
  transition: background-color .2s ease;
}
.anp-cookie__ok:hover { background: var(--accent-h); }

/* ---------- 14. 404 ---------- */

.anp-entry--404 { padding-block: var(--space-8); text-align: center; }
.anp-404 .anp-404__num {
  font-family: var(--font-head); font-weight: 800;
  font-size: clamp(4.5rem, 3rem + 12vw, 9rem); line-height: 1;
  color: var(--accent2); margin-block: 0 var(--space-3);
}
.anp-404 .anp-404__line { color: var(--muted); margin-block: 0 var(--space-6); }

/* ---------- 15. Motion ---------- */

@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
  .anp-entry h1, .anp-entry h2 { scroll-margin-top: 92px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .anp-chips__track { animation: none; transform: none; }
  .anp-js .anp-reveal { opacity: 1; transform: none; }
  .anp-entry > * { animation: none !important; opacity: 1 !important; transform: none !important; }
}

/* Legacy guard: an earlier build of this theme family shipped a collapsed
   returning-visitor strip. New installs never contain it; a site upgraded
   over an older copy keeps the markup in its saved page content. */
.anp-gate__compact { display: none !important; }
