/* Air Market - the legal documents (#/legal/terms, #/legal/privacy) and the
   cookie consent slab. Paired with assets/js/legal.js and assets/js/consent.js.

   Loaded after links.css and BEFORE the seven store-v9-*.css sheets, so the
   mobile layer keeps its "loaded last" contract. Every rule here is a new
   .legal-* or .cookie-* class that no other sheet defines, so source order
   against the design sheets above never decides anything; this file's own
   narrow-viewport rules live in the media query at the bottom.

   Colours come from the same --text-*/--hair-* variables store.css uses rather
   than the raw Air_DS tokens, so the legal pages track the store's surface if
   it is ever re-themed. */

/* ------------------------------- documents ------------------------------- */

/* Measure, not width. The store's 1100px .page is a grid width, sized for rows
   of cards; a paragraph set that wide is unreadable, so the legal pages narrow
   to roughly 90 characters a line and keep .page's own gutters. */
.legal {
  max-width: 860px;
  padding-bottom: 80px;
}

.legal-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 28px;
  padding: 4px;
  border-radius: var(--radius-full);
  background: var(--color-action-secondary);
  width: fit-content;
}
.legal-tab {
  padding: 7px 18px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 600;
  color: var(--text-2);
  cursor: pointer;
  white-space: nowrap;
}
.legal-tab.on {
  background: var(--color-surface-default);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.legal-h1 {
  font-size: 38px;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.legal-updated {
  font-size: 13px;
  color: var(--text-3);
  margin-bottom: 30px;
}

.legal-p {
  font-size: 15.5px;
  line-height: 1.72;
  color: var(--text-2);
  margin-bottom: 16px;
}
.legal-p.lead {
  font-size: 16.5px;
}
.legal-p b { color: var(--text); font-weight: 600; }
.legal-p a,
.legal-list a,
.legal-foot a { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }

.legal-h2 {
  font-size: 22px;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text);
  margin: 44px 0 14px;
}
.legal-h3 {
  font-size: 16px;
  font-weight: 650;
  color: var(--text);
  margin: 28px 0 10px;
}

.legal-list {
  margin: 0 0 16px;
  padding-left: 22px;
  list-style: disc;
}
.legal-list li {
  font-size: 15.5px;
  line-height: 1.72;
  color: var(--text-2);
  margin-bottom: 9px;
}
.legal-list li b { color: var(--text); font-weight: 600; }

/* Storage-key names in section 8. The store has no other inline-code surface,
   so the rule is here rather than in components.css. */
.legal code {
  font-family: var(--font-mono), ui-monospace, monospace;
  font-size: 0.86em;
  padding: 1px 5px;
  border-radius: var(--radius-xs);
  background: var(--color-action-secondary);
  color: var(--text);
}

/* The section anchors are jump targets inside .content, which is the scroll
   container. Without this the heading lands flush against the top edge. */
.legal-section { scroll-margin-top: 20px; }

.legal-toc {
  margin: 32px 0 8px;
  padding: 20px 24px;
  border: 1px solid var(--hair-2);
  border-radius: var(--radius-lg);
  background: var(--color-surface-sunken);
}
.legal-toc h2 {
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  margin-bottom: 12px;
}
.legal-toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  columns: 2;
  column-gap: 32px;
}
.legal-toc li { break-inside: avoid; margin-bottom: 7px; }
.legal-toc button {
  font: inherit;
  font-size: 14px;
  line-height: 1.5;
  text-align: left;
  color: var(--link);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.legal-toc button:hover { text-decoration: underline; text-underline-offset: 3px; }

.legal-foot {
  margin-top: 52px;
  padding-top: 22px;
  border-top: 1px solid var(--hair-2);
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--text-3);
}
.legal-inline-btn {
  font: inherit;
  color: var(--link);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ----------------------------- the footer row -----------------------------
   store.css already styles .foot-legal and its links. This adds the grouping
   for the three legal links and makes the Cookie Preferences <button> read as
   the link its two neighbours are - it is a button because it opens the slab
   rather than navigating, and that is an implementation detail no reader
   should be able to see. */

.foot-links {
  display: flex;
  align-items: baseline;
  gap: 8px 20px;
  flex-wrap: wrap;
}
.foot-links a { cursor: pointer; }
.foot-links button {
  font: inherit;
  font-size: inherit;
  color: var(--text-2);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.foot-links a:hover,
.foot-links button:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ------------------------------ consent slab ------------------------------
   Fixed to the viewport, not to .content: the store's scroll container is the
   main element, and a slab positioned inside it would scroll away with the
   page. z-index sits above the v3 top bar (40) and below the sign-in dialog,
   which is modal and must not be covered by this. */

.cookie-slab {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 20px;
  z-index: 60;
  display: flex;
  justify-content: center;
  pointer-events: none;   /* the empty sides stay click-through */
}

.cookie-card {
  pointer-events: auto;
  width: 100%;
  max-width: 520px;
  padding: 18px 20px 16px;
  border: 1px solid var(--hair-2);
  border-radius: var(--radius-lg);
  background: var(--color-surface-floating);
  box-shadow: var(--shadow-lg);
}
.cookie-card:focus-visible {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 2px;
}

.cookie-head {
  font-size: 16px;
  font-weight: 650;
  color: var(--text);
  margin-bottom: 6px;
}
.cookie-body {
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--text-2);
}

.cookie-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}
.cookie-actions.between { justify-content: space-between; }

/* h-32px clears the WCAG 2.5.8 minimum target size. The three simple actions
   share the row equally; .auto opts the Confirm button out of that so it sizes
   to its own label in the choices panel. */
.cookie-btn {
  flex: 1;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  border-radius: var(--radius-full);
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  border: 1px solid transparent;
}
.cookie-btn.auto { flex: 0 0 auto; }
.cookie-btn.primary {
  background: var(--color-action-primary);
  color: var(--color-text-inverse);
}
.cookie-btn.primary:hover { background: var(--color-action-primary-hover); }
.cookie-btn.ghost {
  background: var(--color-surface-default);
  border-color: var(--color-border-strong);
  color: var(--text);
}
.cookie-btn.ghost:hover { background: var(--color-action-secondary); }

.cookie-link {
  display: inline-block;
  margin-top: 10px;
  font-size: 11.5px;
  color: var(--text-3);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.cookie-back {
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-2);
  background: none;
  border: 0;
  padding: 4px 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.cookie-cats { margin-top: 10px; }
.cookie-cat {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0;
}
.cookie-cat + .cookie-cat { border-top: 1px solid var(--hair-2); }
.cookie-cat-label {
  font-size: 12.5px;
  font-weight: 650;
  color: var(--text);
}
.cookie-cat-desc {
  margin-top: 2px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-3);
}
.cookie-always {
  flex: 0 0 auto;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  background: var(--color-action-secondary);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
}

.cookie-switch {
  flex: 0 0 auto;
  width: 40px;
  height: 24px;
  padding: 2px;
  border: 0;
  border-radius: var(--radius-full);
  background: var(--color-neutral-300);
  cursor: pointer;
  transition: background 0.14s ease;
}
.cookie-switch .knob {
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-surface-default);
  box-shadow: var(--shadow-sm);
  transition: transform 0.14s ease;
}
.cookie-switch[aria-checked="true"] { background: var(--color-brand-600); }
.cookie-switch[aria-checked="true"] .knob { transform: translateX(16px); }
.cookie-switch:focus-visible {
  outline: 2px solid var(--color-border-focus);
  outline-offset: 2px;
}

/* ------------------------------- narrow ---------------------------------- */

@media (max-width: 720px) {
  .legal-h1 { font-size: 30px; }
  .legal-h2 { font-size: 19px; margin-top: 36px; }
  .legal-toc ol { columns: 1; }
  .legal-tabs { width: 100%; }
  .legal-tab { flex: 1; text-align: center; }

  /* store-v9-taps.css grows the tap target of `.foot-legal a` to 44px and
     cancels the growth with a matching negative margin. Cookie Preferences is
     a <button> and is not caught by that selector, so it gets the identical
     treatment here rather than sitting between two links with twice its
     hit area. */
  .foot-links button {
    padding-block: 15px;
    margin-block: -15px;
  }

  .cookie-slab { left: 10px; right: 10px; bottom: 10px; }
  /* Three pill buttons do not fit across a phone. Accept takes the first row on
     its own; Decline and Customize share the second. */
  .cookie-actions { flex-wrap: wrap; }
  .cookie-btn.primary:not(.auto) { flex: 1 0 100%; }
  /* 32px clears WCAG 2.5.8, but this store's own mobile bar (tools/mobile-qa.mjs
     AC6) is 44px, and the consent slab is on every first visit - the single
     biggest contributor to that count. Real height on the buttons (the slab is
     an overlay, so nothing reflows around it); the two underlined text controls
     grow their hit area with the padding/negative-margin idiom from
     store-v9-taps.css instead, so the slab's rhythm is unchanged. */
  .cookie-btn { height: 44px; }
  .cookie-link,
  .cookie-back {
    padding-block: 14px;
    margin-block: -14px;
  }
}
