/* Legal pages: privacy + terms. Builds on app.css tokens. */
@layer screens {
  .legal {
    max-width: 720px; margin-inline: auto; padding: calc(18px + var(--safe-t)) 18px 80px;

    .legal-top { display: flex; align-items: center; justify-content: space-between; gap: 12px;
      a.home { display: flex; align-items: center; gap: 8px; text-decoration: none; font-family: var(--font-display); font-weight: 800; font-size: 1.15rem; }
      img { width: 34px; height: 34px; }
      nav { display: flex; gap: 8px; }
      nav a { text-decoration: none; font-weight: 700; font-size: .9rem; padding: 6px 12px; border: var(--bw) solid var(--line); border-radius: 999px; background: var(--paper); }
      nav a[aria-current="page"] { background: var(--sun); color: oklch(20% 0.02 280); }
    }

    .legal-hero { margin: 38px 0 6px;
      h1 { font-size: clamp(2.3rem, 9vw, 3.6rem); line-height: .98; font-weight: 800; }
      .hl { background: linear-gradient(transparent 58%, var(--sun) 58% 92%, transparent 92%); padding-inline: 4px; }
      .updated { margin-top: 12px; color: var(--ink-soft); font-weight: 600; font-size: .9rem; }
    }

    .tldr { background: var(--sun); color: oklch(20% 0.02 280); rotate: -.6deg; margin-top: 24px;
      h2 { font-size: 1.25rem; margin-bottom: 10px; }
      ul { display: grid; gap: 8px; }
      li { display: grid; grid-template-columns: 1.8em 1fr; gap: 6px; font-weight: 600; }
    }

    .toc { display: flex; flex-wrap: wrap; gap: 8px; margin: 26px 0 6px;
      a { text-decoration: none; } }

    section.card { scroll-margin-top: 16px; margin-top: 18px; container-type: inline-size;
      h2 { font-size: 1.3rem; margin-bottom: 10px; display: flex; gap: 10px; align-items: baseline; }
      h3 { margin: 16px 0 6px; font-size: 1rem; }
      p + p, p + ul, ul + p { margin-top: 10px; }
      ul.dots { list-style: none; display: grid; gap: 6px; margin-top: 8px;
        li { padding-left: 1.3em; position: relative; }
        li::before { content: "→"; position: absolute; left: 0; font-weight: 800; color: var(--door); } }
      &:nth-of-type(even) { rotate: .25deg; } &:nth-of-type(odd) { rotate: -.2deg; }
    }

    table.data { width: 100%; border-collapse: separate; border-spacing: 0; margin-top: 10px; font-size: .92rem;
      border: 2px solid var(--line); border-radius: 14px; overflow: hidden;
      th, td { text-align: left; padding: 9px 10px; vertical-align: top; border-bottom: 1.5px solid color-mix(in oklch, var(--line) 25%, transparent); }
      th { background: color-mix(in oklch, var(--sun) 55%, var(--paper)); color: oklch(20% 0.02 280); font-family: var(--font-display); }
      tr:last-child td { border-bottom: 0; }
      td:first-child { font-weight: 700; white-space: nowrap; }
    }
    @container (max-width: 520px) { table.data td:first-child { white-space: normal; } }

    .caps { text-transform: uppercase; font-size: .86rem; letter-spacing: .01em; }
    .contact { text-align: center; background: var(--ink); color: var(--cream); rotate: .5deg;
      a { color: var(--sun); font-weight: 800; } }
    .legal-foot { margin-top: 30px; text-align: center; color: var(--ink-soft); font-size: .85rem;
      a { font-weight: 700; } }
  }
}

/* cookie notice (shared by the app and legal pages) */
.cookie {
  position: fixed; z-index: 30; inset: auto 12px calc(12px + var(--safe-b)) 12px; margin-inline: auto; max-width: 480px;
  background: var(--paper); border: var(--bw) solid var(--line); border-radius: 22px; box-shadow: var(--shadow);
  padding: 14px 16px; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; align-items: center;
  transition: translate .35s cubic-bezier(.2, .9, .3, 1.25), opacity .3s;
  @starting-style { translate: 0 120%; opacity: 0; }
  .cookie-emoji { font-size: 2rem; grid-row: span 2; animation: cookie-wobble 2.4s ease-in-out infinite; }
  p { font-size: .9rem; font-weight: 600; }
  .cookie-actions { grid-column: 1 / -1; display: flex; gap: 8px; margin-top: 8px; align-items: center; flex-wrap: wrap;
    .btn { width: auto; margin: 0; padding: 9px 16px; font-size: .9rem; }
    a { font-size: .85rem; font-weight: 700; margin-left: auto; } }
  &.leaving { translate: 0 130%; opacity: 0; }
}
body:has(.bottom-nav) .cookie { bottom: calc(84px + var(--safe-b)); }
@keyframes cookie-wobble { 0%, 100% { rotate: -8deg; } 50% { rotate: 10deg; } }

/* how it works */
@layer screens {
  .how {
    .section-title { font-size: 1.9rem; font-weight: 800; margin: 40px 0 4px; scroll-margin-top: 16px; }
    .intro { color: var(--ink-soft); font-weight: 600; margin-top: 6px; }
    .steps-list { display: grid; gap: 16px; margin-top: 16px; counter-reset: none; }
    .step { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; align-items: start; position: relative; margin-top: 0;
      &:nth-child(odd) { rotate: -.5deg; } &:nth-child(even) { rotate: .6deg; }
      .step-n { position: absolute; top: -12px; left: -8px; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center;
        background: var(--door); color: var(--door-ink); font-family: var(--font-display); font-weight: 800; border: var(--bw) solid var(--line); }
      .step-emoji { font-size: 2rem; width: 58px; height: 58px; display: grid; place-items: center; border-radius: 16px; background: var(--sun); border: var(--bw) solid var(--line); }
      h3 { margin: 2px 0 4px; font-size: 1.15rem; }
    }
    .perm { container-type: inline-size;
      h2 { justify-content: space-between; flex-wrap: wrap; }
      dl { display: grid; grid-template-columns: 9.5em 1fr; gap: 10px 14px; margin-top: 6px; }
      dt { font-weight: 800; font-family: var(--font-display); }
      dd { margin: 0; }
      details { margin-top: 14px; border-top: 2px dashed color-mix(in oklch, var(--line) 35%, transparent); padding-top: 12px; }
      summary { cursor: pointer; font-weight: 800; list-style: none; display: inline-flex; align-items: center; gap: 8px;
        padding: 8px 14px; border: var(--bw) solid var(--line); border-radius: 999px; background: var(--sun); color: oklch(20% 0.02 280); }
      summary::-webkit-details-marker { display: none; }
      summary::after { content: "↓"; transition: rotate .2s; }
      details[open] summary::after { rotate: 180deg; }
      details::details-content { transition: content-visibility .3s allow-discrete, opacity .3s; opacity: 0; }
      details[open]::details-content { opacity: 1; }
      .fix { list-style: decimal; padding-left: 1.3em; display: grid; gap: 6px; }
    }
    @container (max-width: 480px) { .perm dl { grid-template-columns: 1fr; gap: 2px; } .perm dd { margin-bottom: 8px; } }
    .need { font-family: var(--font-body); font-size: .75rem; font-weight: 800; padding: 3px 10px; border-radius: 999px; border: 2px solid var(--line); }
    .need.must { background: var(--door); color: var(--door-ink); }
    .need.nice { background: var(--mint); color: oklch(20% 0.02 280); }
    .perm-status { display: grid; gap: 8px; margin-top: 10px;
      li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 14px; border: 2px solid var(--line); border-radius: 14px; font-weight: 700; }
      b { font-size: .9rem; padding: 3px 10px; border-radius: 999px; border: 2px solid var(--line); }
      b.ok { background: var(--mint); color: oklch(20% 0.02 280); }
      b.bad { background: var(--door); color: var(--door-ink); a { color: inherit; } }
      b.meh { background: var(--paper); }
    }
  }
}
@media (max-width: 440px) {
  .legal .legal-top { gap: 8px;
    a.home { font-size: 1.02rem; gap: 6px; } img { width: 30px; height: 30px; }
    nav { gap: 5px; } nav a { font-size: .8rem; padding: 5px 10px; } }
}

/* ---------- night / now / qr / admin ---------- */
@layer screens {
  .legal {
    .night-status { text-align: center;
      h2 { justify-content: center; font-size: 1.6rem; margin: 6px 0; }
      &.ok { background: color-mix(in oklch, var(--mint) 25%, var(--paper)); }
      &.overdue { background: color-mix(in oklch, var(--door) 22%, var(--paper)); }
      .ns-badge { display: inline-block; font-weight: 800; padding: 4px 12px; border: 2px solid var(--line); border-radius: 999px; background: var(--paper); }
      .ns-warn { font-weight: 700; color: var(--door); margin-top: 8px; } }
    .now-tools { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 18px 0 4px; .btn { margin: 0; } }
    .now-list { display: grid; gap: 12px; margin-top: 10px; }
    .now-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; margin: 0;
      b { display: block; font-family: var(--font-display); font-size: 1.1rem; } small { color: var(--ink-soft); font-weight: 600; }
      .crowd { font-weight: 800; padding: 4px 10px; border: 2px solid var(--line); border-radius: 999px; background: var(--sun); color: oklch(20% 0.02 280); white-space: nowrap; } }
    .empty-now { text-align: center; .big-emoji { font-size: 2.4rem; } }
    .field { display: grid; gap: 6px; font-weight: 700; margin-top: 10px; }
    .field input, .field select, .field-inline { padding: 11px 14px; border: var(--bw) solid var(--line); border-radius: 14px; background: var(--cream); color: var(--ink); font: inherit; }
    .field-inline { flex: 1; min-width: 0; }
    .qr-spots { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; small { color: var(--ink-soft); } }
    details summary { cursor: pointer; font-weight: 700; margin-top: 10px; }
    .tent { margin: 10px auto 0; max-width: 360px; text-align: center; background: var(--cream); color: var(--ink); border: 4px solid var(--line); border-radius: 26px;
      padding: 22px 20px; box-shadow: var(--shadow);
      .tent-top { display: flex; align-items: center; justify-content: center; gap: 8px; font-family: var(--font-display); font-size: 1.2rem; img { width: 34px; } }
      .tent-h { font-family: var(--font-display); font-weight: 800; font-size: 2.1rem; line-height: 1; margin-top: 12px;
        span { background: linear-gradient(transparent 56%, var(--sun) 56% 92%, transparent 92%); } }
      .tent-qr { width: 78%; margin: 16px auto 8px; border: 4px solid var(--line); border-radius: 18px; background: #fff; padding: 6px; }
      .tent-spot { font-weight: 800; font-size: 1.1rem; }
      .tent-sub { font-size: .85rem; font-weight: 600; color: #4a4a55; margin-top: 4px; }
      .tent-url { margin-top: 10px; font-weight: 800; } }
    code { font-size: .78rem; word-break: break-all; }
    .tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin-top: 8px;
      div { border: 2px solid var(--line); border-radius: 14px; padding: 10px; background: var(--paper); }
      b { display: block; font-family: var(--font-display); font-size: 1.6rem; } small { color: var(--ink-soft); font-weight: 700; } }
    .bar { display: grid; grid-template-columns: 9em 1fr 3em; align-items: center; gap: 8px; margin-top: 6px; font-size: .88rem; font-weight: 700;
      i { height: 14px; width: var(--w); background: var(--door); border-radius: 7px; border: 2px solid var(--line); } b { text-align: right; } }
    .rep { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1.5px dashed color-mix(in oklch, var(--line) 30%, transparent);
      img, .noimg { width: 56px; height: 70px; object-fit: cover; border-radius: 10px; border: 2px solid var(--line); display: grid; place-items: center; font-size: 1.5rem; }
      small { display: block; color: var(--ink-soft); font-weight: 600; } .btn { margin: 0; } }
  }
}
@media print {
  body { background: #fff !important; }
  .legal > *:not(.qr-out), .qr-out > *:not(.tent), .cookie, #toasts, .update-pill { display: none !important; }
  .legal .qr-out { border: 0; box-shadow: none; rotate: 0deg; padding: 0; }
  .legal .tent { box-shadow: none; max-width: 4.5in; margin: .4in auto; }
}

/* how it works: features */
@layer screens {
  .how {
    .feat-groups { display: grid; gap: 16px; margin-top: 14px; }
    .feat-group { margin-top: 0; container-type: inline-size;
      h3 { margin: 0 0 10px; font-size: 1.15rem; } }
    .feat-list { display: grid; grid-template-columns: 1fr; gap: 12px; }
    @container (min-width: 560px) { .feat-list { grid-template-columns: 1fr 1fr; } }
    .feat { display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: start;
      b { display: block; font-family: var(--font-display); font-size: 1rem; }
      p { margin: 2px 0 0; font-size: .92rem; color: var(--ink-soft); } }
    .feat-emoji { width: 40px; height: 40px; display: grid; place-items: center; font-size: 1.3rem; border-radius: 12px;
      background: var(--sun); border: 2px solid var(--line); }
    .feat-group:nth-child(odd) .feat-emoji { background: color-mix(in oklch, var(--mint) 70%, var(--paper)); }
  }
}
