/* The comparison pages only (the page of nine apps and the free SnoreLab and Sleep Cycle alternatives), loaded after
   site.css. Every rule starts with .compare (their <main>), so nothing here reaches the header, the footer or another
   page. On a phone the table of nine apps shows three columns (app, free recording, ads); a switch turns it into one
   card per app with every row. A table of features (Moonap next to one app) has three columns and fits a phone as it
   is. Only Moonap's own cells carry a check mark: a mark in another app's cell would be a claim of its own. */
.compare .compare-lead { max-width: 760px; }
.compare .by { font-size: 14px; font-weight: 700; color: var(--muted); margin-top: 14px; }
.compare .more { color: var(--text-2); max-width: 65ch; margin-top: 22px; }
.compare .more + .more { margin-top: 12px; }
.compare .compare-lede { color: var(--muted); font-size: 15px; margin-top: 10px; max-width: 70ch; }

.compare .compare-table { margin-top: 22px; }
.compare table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 1.4; }
.compare th, .compare td { text-align: left; vertical-align: top; padding: 12px; border-bottom: 1px solid var(--line); }
.compare thead td { border-bottom-width: 2px; }
.compare thead th { font-size: 13px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); border-bottom: 2px solid var(--line); }
.compare tbody th { font-weight: 800; color: var(--moonlight); white-space: nowrap; }
.compare td { color: var(--text-2); }
.compare tr.us th, .compare tr.us td { background: var(--night-raised); color: var(--moonlight); font-weight: 800; border-bottom-color: transparent; }
.compare tr.us th { color: var(--lilac); font-size: 17px; border-radius: 14px 0 0 14px; }
.compare tr.us td:last-child { border-radius: 0 14px 14px 0; }
.compare td.ns { color: var(--muted); }
/* A table of features marks Moonap's column as the table of apps marks its row. */
.compare thead th.us { color: var(--lilac); background: var(--night-raised); border-bottom-color: transparent; border-radius: 14px 14px 0 0; }
.compare td.us { background: var(--night-raised); color: var(--moonlight); font-weight: 800; border-bottom-color: transparent; }
.compare tbody tr:last-child td.us { border-radius: 0 0 14px 14px; }
/* A table of features: two equal app columns, and quieter row names so Moonap's column leads. */
.compare table:has(thead th.us) { table-layout: fixed; }
.compare table:has(thead th.us) :is(th, td):first-child { width: 26%; }
.compare table:has(thead th.us) tbody th { font-weight: 700; color: var(--text-2); }
/* A cell's verdict, then its detail on a quieter line. */
.compare td .d { display: block; margin-top: 2px; font-size: 14px; font-weight: 600; color: var(--text-2); }
.compare :is(tr.us td, td.us) strong { font-weight: 900; }
/* The marks are decoration: the empty alternative text keeps screen readers from reading "check mark". */
.compare :is(tr.us td, td.us)::before { content: "✓ "; content: "✓ " / ""; color: var(--mint); font-weight: 900; }
/* The switch exists on a phone only; on a wide screen its checkbox is out of the page, so it takes no focus. */
.compare .compare-toggle, .compare .compare-switch { display: none; }
.compare .compare-read { display: grid; gap: 6px; margin-top: 18px; padding-left: 20px; list-style: disc; color: var(--muted); font-size: 15px; max-width: 80ch; }
.compare .compare-read b { color: var(--text-2); }

.compare .compare-gets { display: grid; gap: 16px; margin-top: 22px; max-width: 760px; }
.compare .compare-gets li { position: relative; padding-left: 32px; color: var(--text-2); }
.compare .compare-gets li::before { content: "✓"; content: "✓" / ""; position: absolute; left: 2px; top: 0; color: var(--mint); font-weight: 900; font-size: 19px; }
.compare .compare-gets b { display: block; color: var(--moonlight); font-weight: 900; font-size: 18px; }
@media (min-width: 861px) { .compare .compare-gets { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px 48px; max-width: none; } }
.compare .compare-list { margin-top: 14px; }

.compare .compare-how { display: grid; gap: 10px; margin-top: 18px; padding-left: 20px; list-style: disc; color: var(--text-2); max-width: 65ch; }
.compare .compare-how b { color: var(--moonlight); }

/* Moonap's other pages under the closing store buttons: links tall enough to tap. */
.compare .more-pages { margin-top: 28px; color: var(--text-2); }
.compare .more-pages p { font-weight: 800; }
.compare .more-pages ul { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 22px; margin-top: 4px; }
.compare .more-pages a { display: inline-flex; align-items: center; min-height: 44px; }
/* How the page was compared, its sources and the medical line, after the closing store buttons. */
.compare .compare-after .medical { margin: 22px 0 0; text-align: left; }
.compare .sources { text-align: left; max-width: 760px; margin-top: 28px; border-top: 1px solid var(--line); }
.compare .sources summary { cursor: pointer; font-weight: 800; padding: 14px 0; color: var(--text-2); }
.compare .sources ul { display: grid; gap: 8px; padding: 0 0 12px 20px; list-style: disc; color: var(--muted); font-size: 15px; }
.compare .sources b { color: var(--text-2); }

@media (max-width: 860px) {
  .compare .compare-toggle { display: block; position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
  .compare .compare-switch { display: inline-flex; align-items: center; min-height: 44px; margin-top: 14px; font-weight: 800; color: var(--brand-text); text-decoration: underline; cursor: pointer; }
  .compare .compare-switch .compare-hide, .compare .compare-toggle:checked + .compare-switch .compare-show { display: none; }
  .compare .compare-toggle:checked + .compare-switch .compare-hide { display: inline; }
  .compare .compare-toggle:focus-visible + .compare-switch { outline: 3px solid var(--lilac); outline-offset: 3px; }
  .compare .compare-toggle ~ .compare-table { margin-top: 8px; }
  .compare table { font-size: 14px; table-layout: fixed; }
  .compare th, .compare td { padding: 10px 8px; }
  .compare td { overflow-wrap: anywhere; }
  .compare :is(th, td):first-child { width: 31%; padding-right: 4px; }
  .compare thead th { letter-spacing: 0; text-transform: none; }
  .compare tbody th { white-space: normal; }
  .compare .compare-toggle:not(:checked) ~ .compare-table :is(th, td):is(:nth-child(2), :nth-child(n+5)) { display: none; }
  .compare .compare-toggle:not(:checked) ~ .compare-table tr.us td:nth-child(4) { border-radius: 0 14px 14px 0; }

  /* The switch on: one card per app, every row with its label. */
  .compare .compare-toggle:checked ~ .compare-table :is(table, thead, tbody, tr, th, td) { display: block; width: auto; }
  .compare .compare-toggle:checked ~ .compare-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .compare .compare-toggle:checked ~ .compare-table tbody { display: grid; gap: 14px; }
  .compare .compare-toggle:checked ~ .compare-table tr { background: var(--night-card); border-radius: 16px; padding: 14px 16px 6px; }
  .compare .compare-toggle:checked ~ .compare-table tr.us { background: var(--night-raised); }
  .compare .compare-toggle:checked ~ .compare-table tr.us :is(th, td) { background: none; border-radius: 0; }
  .compare .compare-toggle:checked ~ .compare-table tbody th { font-size: 19px; border: 0; padding: 0 0 6px; }
  .compare .compare-toggle:checked ~ .compare-table td { border: 0; border-top: 1px solid var(--line); padding: 9px 0; }
  .compare .compare-toggle:checked ~ .compare-table td::before { content: attr(data-l); display: block; font-size: 13px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px; }
  /* The label takes Moonap's check mark's place, so the mark moves beside the value. */
  .compare .compare-toggle:checked ~ .compare-table tr.us td { position: relative; padding-left: 22px; }
  .compare .compare-toggle:checked ~ .compare-table tr.us td::after { content: "✓"; content: "✓" / ""; position: absolute; left: 0; top: 29px; color: var(--mint); font-weight: 900; }
}
