/* ==========================================================================
   Legal pages — terms.html, privacy.html, refunds.html, shipping.html, warranty.html
   Dark hero (title, tabs to the other policies, meta) → white reading area with a sticky
   numbered rail (built by legal.js from the <h2>s, like the setup guide's step rail).

   Writing a policy: inside [data-legal-doc], one <section class="legal-sec"> per topic,
   starting with an <h2>. Under it use normal <p>, <ul>/<ol>, <h3>, <a>, <strong>, <table>.
   Numbers (01, 02…) and the rail are automatic. Delete the .legal-ph placeholder once the
   real text is in.

   Shopify: policies live in Settings → Policies and render at /policies/<handle>. They have
   no template of their own, so either (a) put the text in normal Pages using a
   page.legal template built from this markup (full design), or (b) keep Shopify policies and
   style .shopify-policy__container with these rules (legal.js works on any h2 list).
   ========================================================================== */

html { scroll-behavior: smooth; }   /* rail links glide to their section */
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

/* ---------- hero ---------- */

.legal-hero {
  padding: 64px var(--gutter) 72px;
  background: var(--c-ink);
  color: #fff;
  overflow: hidden;
  position: relative;
}

/* faint LED dot grid, fading out to the left — the product's screen as texture */
.legal-hero::before {
  content: "";
  position: absolute;
  inset: 0 0 0 40%;
  background-image: radial-gradient(circle, rgba(212, 255, 0, 0.16) 1.2px, transparent 1.6px);
  background-size: 14px 14px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 70%);
  mask-image: linear-gradient(90deg, transparent, #000 70%);
  pointer-events: none;
}

.legal-hero__inner { position: relative; max-width: 1160px; margin: 0 auto; }

.legal-tabs {
  display: flex;
  gap: 8px;
  margin: 0 0 56px;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
}

.legal-tabs::-webkit-scrollbar { display: none; }

.legal-tabs a {
  display: block;
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.65);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  transition: color 0.2s, box-shadow 0.2s, background-color 0.2s;
}

.legal-tabs a:hover { color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.4); }
.legal-tabs a[aria-current="page"] { background: var(--c-accent); color: var(--c-accent-ink); box-shadow: none; }

.legal-hero .eyebrow { color: var(--c-accent); }
.legal-hero .display { font-size: clamp(56px, 8.5vw, 128px); line-height: 0.88; }

.legal-hero__lead {
  max-width: 52ch;
  margin: 24px 0 0;
  font-size: 17px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.7);
}

.legal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 40px;
  margin: 40px 0 0;
  padding: 24px 0 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.legal-meta div { display: grid; gap: 6px; }

.legal-meta dt {
  font: 700 11px/1 var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
}

.legal-meta dd { margin: 0; font-size: 15px; font-weight: 600; }

/* ---------- body: rail + document ---------- */

.legal-body {
  display: grid;
  grid-template-columns: 240px minmax(0, 720px);
  justify-content: space-between;
  gap: 64px;
  max-width: calc(1160px + var(--gutter) * 2);   /* content lines up with the hero's 1160px column */
  margin: 0 auto;
  padding: 0 var(--gutter) 120px;
}

/* rail (contents built by legal.js) */
.legal-rail { position: sticky; top: calc(var(--header-h) + 24px); align-self: start; padding-top: 72px; }

.legal-rail__title {
  margin: 0 0 18px;
  font: 700 11px/1 var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(10, 10, 10, 0.45);
}

.legal-rail ol { position: relative; margin: 0; padding: 0; list-style: none; }

/* track + volt fill behind the numbers */
.legal-rail ol::before,
.legal-rail ol::after {
  content: "";
  position: absolute;
  top: 14px;
  bottom: 14px;
  left: 13px;
  width: 2px;
  background: rgba(10, 10, 10, 0.08);
}

.legal-rail ol::after {
  bottom: auto;
  height: calc((100% - 28px) * var(--progress, 0));
  background: var(--c-ink);
  transition: height 0.4s var(--ease);
}

.legal-rail a {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 5px 0;
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.3;
  text-decoration: none;
  color: rgba(10, 10, 10, 0.5);
  transition: color 0.2s;
}

.legal-rail a:hover { color: var(--c-ink); }

.legal-rail b {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  flex: none;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 1.5px rgba(10, 10, 10, 0.16);
  font: 700 10px/1 var(--font-mono);
  transition: background-color 0.25s, color 0.25s, box-shadow 0.25s;
}

.legal-rail a.is-done b { background: var(--c-ink); color: #fff; box-shadow: none; }
.legal-rail a.is-active { color: var(--c-ink); }
.legal-rail a.is-active b { background: var(--c-accent); color: var(--c-accent-ink); box-shadow: inset 0 0 0 1.5px var(--c-ink); }

.legal-rail__top {
  display: inline-flex;
  margin-top: 22px;
  font-size: 13px;
  color: rgba(10, 10, 10, 0.5);
  text-decoration: none;
}

.legal-rail__top:hover { color: var(--c-ink); }

/* ---------- document ---------- */

.legal-doc { counter-reset: legal-sec; padding-top: 72px; }

/* "The short version" card */
.legal-summary {
  margin: 0 0 24px;
  padding: 28px 32px;
  border-radius: 20px;
  background: var(--c-ink);
  color: #fff;
}

.legal-summary__title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 16px;
  font: 700 11px/1 var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--c-accent);
}

.legal-summary__title::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-accent);
  box-shadow: 0 0 10px var(--c-accent);
}

.legal-summary ul { display: grid; gap: 12px; margin: 0; padding: 0; list-style: none; }

.legal-summary li {
  position: relative;
  padding-left: 24px;
  font-size: 15px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.85);
}

.legal-summary li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.45em;
  width: 10px;
  height: 6px;
  border-left: 2px solid var(--c-accent);
  border-bottom: 2px solid var(--c-accent);
  transform: rotate(-45deg);
}

/* a numbered section */
.legal-sec {
  counter-increment: legal-sec;
  scroll-margin-top: calc(var(--header-h) + 24px);
  padding: 48px 0;
  border-bottom: 1px solid rgba(10, 10, 10, 0.08);
}

.legal-sec:last-of-type { border-bottom: 0; }

.legal-sec h2 {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin: 0 0 20px;
  font-family: var(--font-display);
  font-size: clamp(30px, 3.2vw, 42px);
  font-weight: 400;
  line-height: 1;
  text-transform: uppercase;
}

.legal-sec h2::before {
  content: counter(legal-sec, decimal-leading-zero);
  flex: none;
  padding: 5px 8px;
  border-radius: 6px;
  background: var(--c-accent);
  color: var(--c-accent-ink);
  font: 700 12px/1 var(--font-mono);
  transform: translateY(-0.35em);
}

/* typography for the real policy text */
.legal-sec h3 { margin: 28px 0 10px; font-size: 17px; font-weight: 700; line-height: 1.35; }
.legal-sec p,
.legal-sec li { font-size: 16px; line-height: 1.7; color: rgba(10, 10, 10, 0.78); }
.legal-sec p { margin: 0 0 16px; }
.legal-sec ul,
.legal-sec ol { margin: 0 0 16px; padding-left: 22px; }
.legal-sec li { margin-bottom: 6px; }
.legal-sec li::marker { color: rgba(10, 10, 10, 0.4); }
.legal-sec strong { color: var(--c-ink); }
.legal-sec a { color: var(--c-ink); text-decoration-color: var(--c-accent); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.legal-sec a:hover { background: var(--c-accent); }

.legal-sec table { width: 100%; margin: 8px 0 20px; border-collapse: collapse; font-size: 15px; }
.legal-sec th,
.legal-sec td { padding: 12px 14px; border-bottom: 1px solid rgba(10, 10, 10, 0.1); text-align: left; vertical-align: top; }
.legal-sec th { font: 700 11px/1.3 var(--font-mono); letter-spacing: 0.08em; text-transform: uppercase; color: rgba(10, 10, 10, 0.55); }

/* an aside / key point inside a section */
.legal-note {
  margin: 0 0 16px;
  padding: 16px 20px;
  border-left: 3px solid var(--c-accent);
  border-radius: 0 12px 12px 0;
  background: #f5f5f2;
  font-size: 15px;
  line-height: 1.6;
}

/* ---------- placeholder until the real text arrives ---------- */

.legal-ph { display: grid; gap: 10px; padding: 4px 0 8px; }

.legal-ph span {
  display: block;
  width: var(--w, 100%);
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #efefec 0%, #f7f7f5 40%, #efefec 80%) 0 0 / 200% 100%;
  animation: legal-shimmer 1.8s linear infinite;
}

.legal-ph::after {
  content: "Text coming soon";
  justify-self: start;
  margin-top: 6px;
  padding: 5px 9px;
  border-radius: 6px;
  background: rgba(10, 10, 10, 0.05);
  font: 700 10px/1 var(--font-mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(10, 10, 10, 0.45);
}

.legal-summary .legal-ph span { background: rgba(255, 255, 255, 0.1); animation: none; }
.legal-summary .legal-ph::after { background: rgba(255, 255, 255, 0.08); color: rgba(255, 255, 255, 0.5); }

@keyframes legal-shimmer { to { background-position: -200% 0; } }

/* ---------- questions card ---------- */

.legal-help {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-top: 32px;
  padding: 28px 32px;
  border-radius: 20px;
  background: #f5f5f2;
}

.legal-help div { flex: 1; }

.legal-help strong {
  display: block;
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 400;
  line-height: 1;
  text-transform: uppercase;
}

.legal-help p { margin: 6px 0 0; font-size: 15px; color: rgba(10, 10, 10, 0.6); }

.legal-help a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 14px 22px;
  border-radius: 999px;
  background: var(--c-ink);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s;
}

.legal-help a:hover { background: var(--c-accent); color: var(--c-accent-ink); }
.legal-help svg { width: 16px; height: 16px; transition: transform 0.25s var(--ease); }
.legal-help a:hover svg { transform: translateX(3px); }

/* ---------- tablet / phone: rail becomes a sticky strip of numbered chips ---------- */

@media (max-width: 989px) {
  .legal-body { display: block; padding-bottom: 80px; }

  .legal-rail {
    top: var(--header-h);
    z-index: 5;
    margin: 0 calc(var(--gutter) * -1);
    padding: 0;
    background: rgba(255, 255, 255, 0.94);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(10, 10, 10, 0.08);
  }

  .legal-rail .legal-rail__title,
  .legal-rail .legal-rail__top { display: none; }

  .legal-rail ol {
    display: flex;
    gap: 6px;
    padding: 10px var(--gutter);
    overflow-x: auto;
    scrollbar-width: none;
  }

  .legal-rail ol::-webkit-scrollbar { display: none; }

  /* progress becomes a thin bar along the bottom of the strip */
  .legal-rail ol::before { display: none; }
  .legal-rail ol::after { top: auto; bottom: 0; left: 0; width: calc(100% * var(--progress, 0)); height: 2px; background: var(--c-ink); }

  .legal-rail a {
    padding: 6px 12px 6px 6px;
    border-radius: 999px;
    white-space: nowrap;
    box-shadow: inset 0 0 0 1px rgba(10, 10, 10, 0.1);
  }

  .legal-rail a.is-active { box-shadow: inset 0 0 0 1.5px var(--c-ink); }
  .legal-rail b { width: 24px; height: 24px; }

  .legal-doc { padding-top: 40px; }
  .legal-sec { scroll-margin-top: calc(var(--header-h) + 72px); }
}

@media (max-width: 600px) {
  .legal-hero { padding: 40px var(--gutter) 48px; }
  .legal-tabs { margin: 0 calc(var(--gutter) * -1) 40px; padding: 0 var(--gutter); }
  .legal-summary,
  .legal-help { padding: 24px 22px; }
  .legal-help { flex-direction: column; align-items: flex-start; }
  .legal-sec { padding: 36px 0; }
  .legal-sec h2 { flex-direction: column; gap: 12px; }
  .legal-sec h2::before { transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .legal-ph span { animation: none; }
}

/* ---------- print: just the text ---------- */

@media print {
  .announcement, .site-header, .menu-drawer, .cart-drawer, .footer,
  .legal-tabs, .legal-rail, .legal-help, .legal-hero::before { display: none !important; }
  .legal-hero { padding: 0 0 24px; background: none; color: #000; }
  .legal-hero__lead, .legal-meta dt { color: #444; }
  .legal-body { display: block; padding: 0; }
  .legal-summary { background: none; color: #000; border: 1px solid #ccc; }
  .legal-summary li { color: #000; }
  .legal-sec { break-inside: avoid-page; padding: 20px 0; }
  .legal-sec h2::before { background: none; border: 1px solid #000; }
}
