/* ╔════════════════════════════════════════════════════════════════╗
   ║ Insider mode + modal + production polish                       ║
   ║ - State-based content toggles (body.is-insider)                ║
   ║ - Sign-in modal + auth UI                                      ║
   ║ - Mobile polish (filter bar, page hero, compare table)         ║
   ║ - Focus rings, scroll padding, print styles                    ║
   ╚════════════════════════════════════════════════════════════════╝ */

/* ── 1. State-based reveals ─────────────────────────────────────── */
/* .insider-only — shown only when signed in. .free-only — hidden when signed in. */
.insider-only { display: none; }
html.is-insider .insider-only,
body.is-insider .insider-only { display: block; }
html.is-insider .insider-only.is-inline,
body.is-insider .insider-only.is-inline { display: inline; }
html.is-insider .insider-only.is-flex,
body.is-insider .insider-only.is-flex { display: flex; }
html.is-insider .insider-only.is-grid,
body.is-insider .insider-only.is-grid { display: grid; }
html.is-insider .free-only,
body.is-insider .free-only { display: none !important; }

/* Hide ALL insider-targeted CTAs and decorations when signed in */
html.is-insider .unlock-card,
body.is-insider .unlock-card,
html.is-insider .cheat__lock,
body.is-insider .cheat__lock,
html.is-insider .lock-preview > .lock-cta,
body.is-insider .lock-preview > .lock-cta,
html.is-insider .bestof__cta,
body.is-insider .bestof__cta,
html.is-insider .insider-pill,
body.is-insider .insider-pill,
html.is-insider .insider-pill--accent,
body.is-insider .insider-pill--accent,
html.is-insider [data-insider-cta],
body.is-insider [data-insider-cta] { display: none !important; }

/* Hide section-h "Unlock all →" / "Insider unlocks all →" / "Cast my votes" overflow links */
html.is-insider a.section-h__more[data-locks],
body.is-insider a.section-h__more[data-locks] { display: none !important; }

html.is-insider .lock-preview > .lock-content,
body.is-insider .lock-preview > .lock-content {
  max-height: none !important;
  overflow: visible !important;
  -webkit-mask-image: none !important;
  mask-image: none !important;
  pointer-events: auto !important;
}
html.is-insider .lock-preview > .lock-content > *,
body.is-insider .lock-preview > .lock-content > * { opacity: 1 !important; }

html.is-insider .cheat__list-locked,
body.is-insider .cheat__list-locked,
html.is-insider .cheat__list-locked--strong,
body.is-insider .cheat__list-locked--strong { filter: none !important; }

html.is-insider .cheat__list::after,
body.is-insider .cheat__list::after,
.cheat__list.is-unlocked::after { display: none !important; }

/* Re-enable any disabled filter UI when insider */
html.is-insider .filter-bar[aria-hidden="true"],
body.is-insider .filter-bar[aria-hidden="true"] {
  pointer-events: auto !important;
  opacity: 1 !important;
}

/* Inline “★ Insider” pill becomes “✓ Unlocked” when signed in */
body.is-insider .insider-pill--accent { display: none !important; }
body.is-insider .insider-pill { display: none !important; }
body.is-insider .insider-pill--accent > * { display: none !important; }

/* "Become an Insider" CTAs become "Already a member" subtle text */
body.is-insider a.btn[href$="insider.html"]:not(.btn--link),
body.is-insider a.btn[href*="#pricing"]:not(.btn--link) {
  /* leave them — the insider page becomes the "Account" page in nav */
}

/* ── 2. Sign-in modal ───────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(14, 35, 48, 0.62);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 220ms ease;
}
.modal.is-open {
  display: flex;
  opacity: 1;
}
.modal__panel {
  background: var(--paper);
  border-radius: var(--r-3);
  width: 100%;
  max-width: 480px;
  padding: clamp(28px, 4vw, 40px);
  position: relative;
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.32), 0 8px 16px rgba(0, 0, 0, 0.18);
  transform: translateY(16px) scale(0.97);
  transition: transform 280ms cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 90vh;
  overflow-y: auto;
}
.modal.is-open .modal__panel { transform: translateY(0) scale(1); }
.modal__close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 18px;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background 160ms ease, border-color 160ms ease;
}
.modal__close:hover { background: var(--paper-2); border-color: var(--ink); }
.modal__eyebrow {
  font-family: var(--ff-mono);
  font-size: var(--fs-12);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-deep);
  margin-bottom: 8px;
}
.modal h2 {
  font-size: var(--fs-30);
  line-height: 1.1;
  margin-bottom: 8px;
  font-family: var(--ff-display);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.modal p {
  color: var(--muted);
  font-size: var(--fs-14);
  line-height: 1.5;
  margin-bottom: 20px;
}
.modal__form { display: flex; flex-direction: column; gap: 14px; }
.modal__form label {
  font-family: var(--ff-mono);
  font-size: var(--fs-12);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.modal__form input[type="email"],
.modal__form input[type="password"],
.modal__form input[type="text"] {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-2);
  background: var(--paper);
  font-family: var(--ff-sans);
  font-size: var(--fs-16);
  color: var(--ink);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.modal__form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(224, 122, 60, 0.18);
}
.modal__form .btn { width: 100%; justify-content: center; padding: 14px 18px; }
.modal__divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  font-family: var(--ff-mono);
  font-size: var(--fs-12);
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.modal__divider::before, .modal__divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}
.modal__alt { font-size: var(--fs-14); color: var(--ink-2); text-align: center; }
.modal__alt a { color: var(--accent-deep); font-weight: 600; }
.modal__trust {
  display: flex; flex-wrap: wrap; gap: 12px;
  justify-content: center;
  margin-top: 16px;
  font-family: var(--ff-mono);
  font-size: var(--fs-12);
  color: var(--muted);
}
.modal__trust span { display: inline-flex; align-items: center; gap: 4px; }

/* Plan picker inside modal */
.modal__plans { display: flex; flex-direction: column; gap: 10px; margin: 4px 0 16px; }
.modal__plan {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-2);
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}
.modal__plan:hover { border-color: var(--ink); }
.modal__plan input { margin: 0; }
.modal__plan.is-selected { border-color: var(--accent); background: rgba(224, 122, 60, 0.06); }
.modal__plan strong { font-family: var(--ff-display); font-size: var(--fs-18); font-weight: 700; color: var(--ink); }
.modal__plan small { font-family: var(--ff-mono); font-size: var(--fs-12); color: var(--muted); }
.modal__plan-badge {
  background: var(--accent);
  color: #fff;
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  margin-left: 6px;
}

/* ── 3. Nav: sign-in link + account state ───────────────────────── */
.nav__signin {
  font-family: var(--ff-sans);
  font-size: var(--fs-14);
  font-weight: 500;
  color: var(--ink-2);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: var(--r-2);
  cursor: pointer;
  background: transparent;
  border: none;
  transition: color 120ms ease, background 120ms ease;
}
.nav__signin:hover { color: var(--ink); background: var(--paper-2); }
body.is-insider .nav__signin { display: none; }

.nav__account {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 6px 12px;
  border-radius: var(--r-pill);
  background: var(--paper-2);
  border: 1px solid var(--line);
  font-family: var(--ff-sans);
  font-size: var(--fs-14);
  font-weight: 500;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}
.nav__account:hover { border-color: var(--ink); }
.nav__account .nav__avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--accent), var(--sound));
  color: var(--paper);
  display: grid;
  place-items: center;
  font-family: var(--ff-display);
  font-size: var(--fs-12);
  font-weight: 700;
}
body.is-insider .nav__account { display: inline-flex; }
body.is-insider .nav__cta-btn { display: none; }

/* When insider, swap the "Subscribe" CTA in nav for "Insider" badge */
body.is-insider .nav__cta .insider-pill { display: inline-flex; }

/* ── 4. Insider welcome banner ──────────────────────────────────── */
.insider-welcome {
  display: none;
  background: linear-gradient(110deg, var(--ink) 0%, #0a1a24 100%);
  color: var(--paper);
  border-radius: var(--r-2);
  padding: 16px 22px;
  margin-bottom: var(--s-6);
  align-items: center;
  gap: var(--s-3);
  font-family: var(--ff-display);
  font-size: var(--fs-16);
  position: relative;
  overflow: hidden;
}
.insider-welcome::before {
  content: "";
  position: absolute;
  right: -20%; top: -50%;
  width: 50%; aspect-ratio: 1/1;
  background: radial-gradient(circle, rgba(224, 122, 60, 0.22) 0%, transparent 65%);
  pointer-events: none;
}
.insider-welcome > * { position: relative; z-index: 2; }
.insider-welcome__pill {
  background: var(--accent);
  color: #fff;
  font-family: var(--ff-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-weight: 500;
}
.insider-welcome strong { color: var(--paper); font-weight: 700; }
.insider-welcome a {
  color: var(--paper);
  font-family: var(--ff-mono);
  font-size: var(--fs-13);
  margin-left: auto;
  text-decoration: underline;
}
body.is-insider .insider-welcome { display: flex; }
@media (max-width: 700px) {
  .insider-welcome { flex-direction: column; align-items: flex-start; }
  .insider-welcome a { margin-left: 0; }
}

/* ── 5. Mobile polish ───────────────────────────────────────────── */
@media (max-width: 700px) {
  /* Util strip stays scrollable but tighter */
  .util-strip__inner { gap: 14px; font-size: 11px; }

  /* Page heros — tighter bottom padding so content gets to the screen */
  .page-hero { padding-block: var(--s-6) var(--s-6); }
  .page-hero h1 { font-size: clamp(1.875rem, 8vw, 2.5rem); }
  .page-hero .lead { font-size: var(--fs-16); }
  .page-hero__cta { flex-direction: column; align-items: stretch; }
  .page-hero__cta .btn { width: 100%; justify-content: center; }

  /* Hero on homepage */
  .hero { padding-top: var(--s-4); padding-bottom: var(--s-6); }
  .hero__cta .field--inline { width: 100%; }

  /* Section padding */
  .section { padding-block: var(--s-8); }
  .section--tight { padding-block: var(--s-6); }

  /* Wrap pad */
  .wrap { padding-inline: 16px; }
  :root { --gutter: 16px; }

  /* Section header stacks */
  .section-h { flex-direction: column; align-items: flex-start; gap: 8px; }
  .section-h__more { font-size: var(--fs-13); }

  /* Cards: tighter padding */
  .card__body { padding: 14px; }
  .card__title { font-size: var(--fs-18); }

  /* Featured cards drop to smaller titles */
  .picks__feature .card__title,
  .news__feature .card__title { font-size: var(--fs-22); }

  /* Card row collapses on mobile */
  .card--row { flex-direction: column; }
  .card--row > .img,
  .card--row > [class*="img"] {
    width: 100% !important;
    aspect-ratio: 16/9;
    flex-shrink: 1 !important;
  }

  /* News-row / event-row stays compact */
  .news-row, .event-row { grid-template-columns: 70px 1fr; gap: 10px; padding: 10px; }
  .event-row__title, .news-row__title { font-size: var(--fs-15); }

  /* Eat-row tighter */
  .eat-row { padding: 10px 12px; }

  /* Cheat sheet stack */
  .cheat__list { padding: 16px 18px; }
  .cheat__list li { font-size: var(--fs-15); padding: 10px 0 10px 18px; }
  .cheat__visual { min-height: 240px; }

  /* Insider tier compare table on mobile — wrap in scroll */
  .compare {
    display: block;
    overflow-x: auto;
    white-space: nowrap;
    font-size: var(--fs-13);
  }
  .compare th, .compare td { padding: 10px 12px; }

  /* Best of LI bestof block padding tighter */
  .bestof { padding: 20px 18px; }
  .bestof h2 { font-size: var(--fs-30); }
  .bestof__lead { font-size: var(--fs-15); }

  /* Cat-card stacks */
  .cat-card { padding: 14px; }
  .cat-card__name { font-size: var(--fs-16); }

  /* Hide social rail caption — saves space */
  .social__head { flex-direction: column; align-items: flex-start; }

  /* Nav padding */
  .nav__inner { padding-block: 10px; gap: 8px; }
  .nav__cta { gap: 4px; }
  .nav__cta-btn { padding: 8px 12px !important; font-size: var(--fs-13) !important; }
  .nav__signin { display: none; }

  /* Footer compress */
  .foot { padding-block: var(--s-8) var(--s-5); }
  .foot__legal { flex-direction: column; gap: 6px; text-align: center; }

  /* Newsletter block */
  .nl-block { padding: 24px 20px !important; }
  .nl-block h2 { font-size: var(--fs-24); }

  /* Modal: full-screen-ish on mobile */
  .modal { padding: 0; align-items: flex-end; }
  .modal__panel {
    border-radius: var(--r-3) var(--r-3) 0 0;
    max-width: 100%;
    max-height: 92vh;
    padding: 28px 20px;
  }

  /* Towns directory */
  .az-group { padding: 16px 0; }
  .az-group__letter { font-size: var(--fs-48); }

  /* Town hub strip */
  .town-hub-strip { flex-direction: column; align-items: flex-start; }
}

/* ── 6. Production polish ───────────────────────────────────────── */
html { scroll-padding-top: 0; overflow-x: hidden; }
body { overflow-x: hidden; min-height: 100vh; }

:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r-1);
}

a:focus-visible, button:focus-visible {
  outline-offset: 3px;
}

input:focus-visible, textarea:focus-visible {
  outline: 0;
  /* Use box-shadow ring instead so layout doesn't shift */
}

/* Tap targets */
@media (max-width: 700px) {
  button, .btn, a.btn, .filter-pill, .town-chip { min-height: 44px; }
  .nav__search, .nav__menu { width: 44px; height: 44px; }
}

/* Selection */
::selection { background: var(--accent); color: var(--paper); }

/* Print */
@media print {
  .nav, .util-strip, .foot, .sticky-cta, .back-to-top, .modal, .unlock-card, .nl-block, .insider-welcome, .filter-bar { display: none !important; }
  body { background: white; color: black; }
  .img__photo { print-color-adjust: exact; -webkit-print-color-adjust: exact; }
  .section, .section--tight { padding-block: 16pt; page-break-inside: avoid; }
  h1, h2, h3 { page-break-after: avoid; }
}

/* ── 7. Sign-in trigger button (in nav) ─────────────────────────── */
.signin-trigger {
  background: none;
  border: 0;
  font: inherit;
  cursor: pointer;
}

/* ── 8. Vote button on best-of (insider only) ───────────────────── */
.vote-btn {
  display: none;
  align-items: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  border: 1px solid var(--accent);
  border-radius: var(--r-pill);
  font-family: var(--ff-mono);
  font-size: var(--fs-12);
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 6px 12px;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 80ms ease;
}
.vote-btn:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.vote-btn:active { transform: scale(0.96); }
.vote-btn.is-voted { background: var(--positive); border-color: var(--positive); }
body.is-insider .vote-btn { display: inline-flex; }
