/* ============================================================
   Public secondary + legal content — shared layout & mobile
   Author: Dave Greenlaw
   Load after public-shell.css on help, support, feedback, legal pages.
   Breakpoints: 720px (tablet/narrow), 480px (phone)
============================================================ */

/* --- Narrow-page shells --- */
.legal-wrap,
.cg-wrap,
.support-wrap,
.feedback-wrap,
.help-wrap {
  box-sizing: border-box;
  width: 100%;
  color: var(--text, #1f2937);
}

.legal-wrap,
.cg-wrap,
.support-wrap,
.feedback-wrap {
  flex: 1 1 auto;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

.legal-wrap,
.cg-wrap {
  max-width: 720px;
}

.support-wrap,
.feedback-wrap {
  max-width: 640px;
}

.help-wrap {
  max-width: 1050px;
  margin: 0 auto;
  padding: 20px 20px 40px;
}

/* --- Page titles & intros --- */
.legal-wrap h1,
.cg-wrap h1,
.support-wrap h1,
.feedback-wrap h1,
.help-top h1 {
  margin: 0 0 8px;
  font-size: clamp(1.35rem, 1.2vw + 1rem, 1.625rem);
  color: var(--text, #1f2a44);
  line-height: 1.25;
}

.support-wrap h1,
.feedback-wrap h1 {
  margin-bottom: 10px;
}

.help-top h1 {
  margin: 0;
  font-size: clamp(1.4rem, 1.5vw + 1rem, 1.75rem);
}

.legal-lead,
.cg-lead,
.support-lead,
.feedback-lead,
.help-sub {
  margin: 0 0 12px;
  color: var(--text-muted, #475569);
  line-height: 1.6;
  font-size: 15px;
}

.cg-lead {
  margin-bottom: 22px;
}

.support-lead,
.feedback-lead {
  margin-bottom: 20px;
}

.help-sub {
  margin-bottom: 18px;
  line-height: 1.55;
}

.legal-meta,
.cg-meta {
  margin: 0 0 20px;
  font-size: 13px;
  color: var(--text-muted, #64748b);
  line-height: 1.5;
}

.legal-meta strong {
  color: var(--text, #334155);
  font-weight: 600;
}

/* --- Table of contents --- */
.legal-toc,
.cg-toc {
  margin: 0 0 22px;
  padding: 12px 14px;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  background: var(--surface, #fff);
}

.legal-toc h2,
.cg-toc h2 {
  margin: 0 0 8px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted, #64748b);
}

.legal-toc ol,
.cg-toc ol {
  margin: 0;
  padding-left: 18px;
  color: var(--text-muted, #475569);
  line-height: 1.7;
  font-size: 14px;
}

/* --- Content sections & cards --- */
.legal-section,
.cg-section,
.support-card,
.feedback-card,
.help-card,
.help-section {
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 12px;
  background: var(--surface, #fff);
}

.legal-section,
.cg-section,
.support-card,
.feedback-card {
  padding: 16px 18px;
  margin-bottom: 14px;
}

.support-card,
.feedback-card {
  margin-bottom: 16px;
}

.help-card {
  padding: 12px 14px;
}

.help-section {
  margin-top: 16px;
  padding: 14px 16px;
}

.legal-section h2,
.cg-section h2,
.support-card h2,
.feedback-card h2 {
  margin: 0 0 8px;
  font-size: 17px;
  color: var(--text, #1f2a44);
}

.help-card h2 {
  margin: 0 0 8px;
  font-size: 18px;
  color: var(--text, #1f2a44);
}

.help-section h2 {
  margin: 0 0 8px;
  font-size: 20px;
  color: var(--text, #1f2a44);
}

.legal-section p,
.legal-section ul,
.cg-section p,
.cg-section ul,
.support-card p,
.support-card ul,
.feedback-card p,
.feedback-card ul,
.help-card p,
.help-section p,
.help-section ul {
  margin: 0 0 10px;
  color: var(--text-muted, #475569);
  line-height: 1.55;
  font-size: 14px;
}

.help-card p {
  margin-bottom: 8px;
  line-height: 1.5;
}

.help-card ul,
.help-section ul,
.legal-section ul,
.cg-section ul,
.support-card ul,
.feedback-card ul {
  padding-left: 18px;
}

.legal-section p:last-child,
.legal-section ul:last-child,
.cg-section p:last-child,
.cg-section ul:last-child,
.support-card p:last-child,
.support-card ul:last-child,
.feedback-card p:last-child,
.feedback-card ul:last-child {
  margin-bottom: 0;
}

.legal-section a,
.legal-toc a,
.cg-toc a {
  color: var(--accent, #2a4d8f);
  font-weight: 600;
  text-decoration: none;
}

.legal-section a:hover,
.legal-toc a:hover,
.cg-toc a:hover {
  text-decoration: underline;
}

.help-wrap a {
  color: var(--accent, #2563eb);
  font-weight: 600;
  text-decoration: none;
}

.help-wrap a:hover {
  text-decoration: underline;
}

html[data-theme="dark"] .help-wrap a,
html[data-theme="soft"] .help-wrap a {
  color: #93c5fd;
}

html[data-theme="dark"] .help-wrap a:hover,
html[data-theme="soft"] .help-wrap a:hover {
  color: color-mix(in srgb, #93c5fd 80%, var(--text, #f8fafc));
}

/* --- Help grid --- */
.help-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 14px;
  margin-top: 24px;
  margin-bottom: 16px;
}

.help-card-media {
  width: 100%;
  height: 170px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--border, #e2e8f0);
  margin: 0 0 10px;
  background: var(--surface-muted, #f8fafc);
}

.help-card-wiki {
  margin: 12px 0 0;
  padding-top: 10px;
  border-top: 1px solid var(--border, #e2e8f0);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.help-card-wiki__btn {
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: color-mix(in srgb, var(--accent, #2563eb) 85%, var(--text, #222));
  background: transparent;
  border: none;
  padding: 6px 2px;
  min-height: 44px;
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dashed;
  text-underline-offset: 3px;
}

.help-card-wiki__btn:hover {
  color: var(--accent, #2563eb);
}

.help-card-cockpit-link {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted, #475569);
  text-decoration: none;
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 999px;
  padding: 4px 12px;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.help-card-cockpit-link:hover {
  color: var(--accent, #2563eb);
  border-color: color-mix(in srgb, var(--accent, #2563eb) 40%, var(--border));
  background: color-mix(in srgb, var(--accent, #2563eb) 8%, var(--surface));
}

/* --- Feedback badge --- */
.feedback-badge {
  display: inline-block;
  margin: 0 0 12px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #92400e;
  background: linear-gradient(180deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fcd34d;
}

/* --- Placeholder / back links --- */
.support-placeholder-btn,
.feedback-placeholder-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 4px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px dashed var(--border, #cbd5e1);
  background: var(--surface-muted, #f8fafc);
  color: var(--text-muted, #64748b);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: not-allowed;
  opacity: 0.85;
}

.legal-back,
.cg-back,
.support-back,
.feedback-back {
  margin-top: 20px;
  font-size: 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  align-items: center;
}

.support-back,
.feedback-back {
  margin-top: 24px;
}

.legal-back a,
.cg-back a,
.support-back a,
.feedback-back a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--accent, #2a4d8f);
  font-weight: 700;
  text-decoration: none;
}

.legal-back a:hover,
.cg-back a:hover,
.support-back a:hover,
.feedback-back a:hover {
  text-decoration: underline;
}

/* --- Public forms (support / feedback when wired) --- */
.public-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 0;
}

.public-form__field label,
.public-form__field .public-form__label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text, #1f2937);
}

.public-form__field input[type="text"],
.public-form__field input[type="email"],
.public-form__field select,
.public-form__field textarea {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--border, #cbd5e1);
  border-radius: 10px;
  background: var(--surface-muted, #f8fafc);
  color: var(--text, #0f172a);
  font: inherit;
  font-size: 16px;
  line-height: 1.45;
}

.public-form__field textarea {
  min-height: 120px;
  resize: vertical;
}

.public-form__field input:focus,
.public-form__field select:focus,
.public-form__field textarea:focus {
  outline: 2px solid color-mix(in srgb, var(--accent, #2a4d8f) 45%, transparent);
  outline-offset: 1px;
  border-color: var(--accent, #2a4d8f);
  background: var(--surface, #fff);
}

.public-form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

.public-form__actions .pill-btn,
.public-form__actions button[type="submit"] {
  min-height: 44px;
  padding-left: 18px;
  padding-right: 18px;
}

.public-form__hint {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--text-muted, #64748b);
}

/* --- Help page glass theme --- */
html[data-theme="glass"] body.help-page {
  background:
    radial-gradient(ellipse 120% 80% at 10% -10%, rgba(88, 120, 200, 0.22), transparent 55%),
    radial-gradient(ellipse 90% 70% at 95% 5%, rgba(180, 140, 220, 0.14), transparent 50%),
    linear-gradient(165deg, #0a0d14 0%, #12182a 38%, #0c101c 100%) !important;
  background-attachment: fixed;
  color: var(--text);
}

html[data-theme="glass"] .help-wrap {
  color: var(--text);
}

html[data-theme="glass"] .help-top h1,
html[data-theme="glass"] .help-card h2,
html[data-theme="glass"] .help-section h2 {
  color: var(--text);
}

html[data-theme="glass"] .help-sub,
html[data-theme="glass"] .help-card p,
html[data-theme="glass"] .help-section p,
html[data-theme="glass"] .help-card ul,
html[data-theme="glass"] .help-section ul {
  color: var(--text-muted);
}

html[data-theme="glass"] .help-card,
html[data-theme="glass"] .help-section {
  background: rgba(255, 255, 255, 0.07) !important;
  backdrop-filter: blur(14px) saturate(1.25);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
  border-color: var(--glass-edge, rgba(255, 255, 255, 0.22)) !important;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.1) inset,
    0 8px 24px rgba(0, 0, 0, 0.22);
}

html[data-theme="glass"] .help-card-media {
  border-color: var(--glass-edge, rgba(255, 255, 255, 0.22));
  background: rgba(255, 255, 255, 0.04);
}

html[data-theme="glass"] .help-wrap a {
  color: #a5d8ff;
}

html[data-theme="glass"] .help-wrap a:hover {
  color: #fff;
}

html[data-theme="glass"] .help-card-wiki__btn {
  color: #a5d8ff;
}

html[data-theme="glass"] .help-card-wiki__btn:hover {
  color: #fff;
}

html[data-theme="glass"] .help-card-cockpit-link {
  color: #cbd5e1;
  border-color: rgba(255, 255, 255, 0.16);
}

html[data-theme="glass"] .help-card-cockpit-link:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.28);
}

/* --- Mobile (≤720px) --- */
@media (max-width: 720px) {
  .legal-wrap,
  .cg-wrap,
  .support-wrap,
  .feedback-wrap,
  .help-wrap {
    padding-left: 16px;
    padding-right: 16px;
  }

  .legal-wrap,
  .cg-wrap,
  .support-wrap,
  .feedback-wrap {
    padding-top: 22px;
    padding-bottom: 40px;
  }

  .help-wrap {
    padding-top: 16px;
    padding-bottom: 32px;
  }

  .help-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .help-card-media {
    height: 150px;
  }

  .legal-section,
  .cg-section,
  .support-card,
  .feedback-card,
  .help-card,
  .help-section {
    padding-left: 14px;
    padding-right: 14px;
  }

  .legal-toc,
  .cg-toc {
    padding: 10px 12px;
  }

  .legal-section a,
  .legal-toc a,
  .cg-toc a {
    word-break: break-word;
  }
}

/* --- Phone (≤480px) --- */
@media (max-width: 480px) {
  .legal-wrap,
  .cg-wrap,
  .support-wrap,
  .feedback-wrap,
  .help-wrap {
    padding-left: 14px;
    padding-right: 14px;
  }

  .help-card-media {
    height: 130px;
  }

  .support-placeholder-btn,
  .feedback-placeholder-btn {
    width: 100%;
  }

  .public-form__actions .pill-btn,
  .public-form__actions button[type="submit"] {
    flex: 1 1 auto;
    width: 100%;
    justify-content: center;
  }
}

html[data-a11y-view="comfort"] .help-card-cockpit-link,
html[data-a11y-view="comfort"] .help-card-wiki__btn,
html[data-a11y-view="comfort"] .legal-back a,
html[data-a11y-view="comfort"] .support-back a {
  min-height: 44px;
}

html[data-a11y-view="contrast"] .legal-section,
html[data-a11y-view="contrast"] .legal-toc,
html[data-a11y-view="contrast"] .cg-section,
html[data-a11y-view="contrast"] .cg-toc,
html[data-a11y-view="contrast"] .support-card,
html[data-a11y-view="contrast"] .feedback-card,
html[data-a11y-view="contrast"] .help-card,
html[data-a11y-view="contrast"] .help-section {
  border-width: 2px;
}
