/* ============================================================
   SignalLedger — Main Stylesheet
   Supplements Tailwind CSS with custom component styles.
   Colour palette, typography, and component patterns defined here.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&display=swap');

/* ── CSS Custom Properties ─────────────────────────────── */
:root {
  --color-bg:           #FFFFFF;
  --color-bg-alt:       #F8FAFC;
  --color-bg-soft:      #F1F5F9;
  --color-heading:      #0F172A;
  --color-body:         #334155;
  --color-muted:        #64748B;
  --color-accent:       #14B8A6;
  --color-accent-hover: #0D9488;
  --color-border:       #E2E8F0;
  --color-blue:         #2563EB;
  --color-green:        #10B981;
  --color-red:          #DC2626;

  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --shadow-card:       0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-card-hover: 0 6px 20px rgba(0,0,0,0.08), 0 2px 6px rgba(0,0,0,0.05);
  --shadow-dropdown:   0 12px 36px rgba(0,0,0,0.1), 0 3px 10px rgba(0,0,0,0.06);

  --radius:     0.75rem;
  --radius-sm:  0.5rem;
  --transition: 0.18s ease;
}

/* ── Reset & Base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  color: var(--color-body);
  background-color: var(--color-bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img { max-width: 100%; height: auto; display: block; }

/* ── Typography ────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  color: var(--color-heading);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

h1 { font-size: clamp(1.875rem, 4.5vw, 3rem);   font-weight: 800; }
h2 { font-size: clamp(1.5rem,   3.5vw, 2.25rem); font-weight: 700; }
h3 { font-size: clamp(1.125rem, 2.5vw, 1.5rem);  font-weight: 700; }
h4 { font-size: 1.125rem; font-weight: 600; }

p { color: var(--color-body); line-height: 1.75; }

a {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--transition);
}
a:hover { color: var(--color-accent-hover); }

/* ── Container ─────────────────────────────────────────── */
.container-xl {
  max-width: 1280px;
  margin-inline: auto;
  padding-inline: 1.25rem;
}
@media (min-width: 640px)  { .container-xl { padding-inline: 1.75rem; } }
@media (min-width: 1024px) { .container-xl { padding-inline: 2.5rem;  } }

/* ── Section Helpers ───────────────────────────────────── */
.section-pad { padding-block: 4rem; }
@media (min-width: 768px)  { .section-pad { padding-block: 5.5rem; } }
@media (min-width: 1024px) { .section-pad { padding-block: 6.5rem; } }

.section-alt  { background-color: var(--color-bg-alt);  }
.section-soft { background-color: var(--color-bg-soft); }

.section-label {
  display: inline-block;
  padding: 0.25rem 0.875rem;
  background-color: rgba(20, 184, 166, 0.1);
  color: var(--color-accent);
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.section-heading {
  font-size: clamp(1.625rem, 3vw, 2.25rem);
  font-weight: 800;
  color: var(--color-heading);
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 0.875rem;
}

.section-subheading {
  font-size: 1.0625rem;
  color: var(--color-muted);
  line-height: 1.7;
  max-width: 580px;
}

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6875rem 1.375rem;
  border-radius: var(--radius-sm);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  border: 1.5px solid transparent;
  text-decoration: none;
  transition: background-color var(--transition), border-color var(--transition),
              color var(--transition), box-shadow var(--transition), transform var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--color-accent);
  color: #fff;
  border-color: var(--color-accent);
}
.btn-primary:hover {
  background-color: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(20, 184, 166, 0.32);
}

.btn-secondary {
  background-color: var(--color-bg);
  color: var(--color-body);
  border-color: var(--color-border);
}
.btn-secondary:hover {
  background-color: var(--color-bg-alt);
  border-color: #CBD5E1;
  color: var(--color-heading);
  transform: translateY(-1px);
}

.btn-outline-accent {
  background-color: transparent;
  color: var(--color-accent);
  border-color: var(--color-accent);
}
.btn-outline-accent:hover {
  background-color: var(--color-accent);
  color: #fff;
}

.btn-lg  { padding: 0.9375rem 2rem; font-size: 1.0625rem; border-radius: 0.625rem; }
.btn-sm  { padding: 0.5rem 1rem;    font-size: 0.8125rem; }

/* ── Cards ─────────────────────────────────────────────── */
.card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition), transform var(--transition), border-color var(--transition);
}
.card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-3px);
  border-color: #CBD5E1;
}

.card-accent-top { border-top: 3px solid var(--color-accent); }

/* ── Pill Labels ───────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.225rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  white-space: nowrap;
  line-height: 1.4;
}
.tag-ai           { background: #ECFDF5; color: #065F46; }
.tag-automation   { background: #EFF6FF; color: #1E40AF; }
.tag-transparency { background: #FFF7ED; color: #9A3412; }
.tag-beginner     { background: #F0FDF4; color: #166534; }
.tag-fees         { background: #FFF1F2; color: #9F1239; }
.tag-fees-unclear { background: #FEF3C7; color: #92400E; }
.tag-comparison   { background: #F5F3FF; color: #5B21B6; }
.tag-app          { background: #E0E7FF; color: #3730A3; }
.tag-brand        { background: #F3E8FF; color: #6B21A8; }
.tag-marketing    { background: #FCE7F3; color: #9D174D; }
.tag-trading      { background: #E0F2FE; color: #075985; }
.tag-caution      { background: #FEF2F2; color: #991B1B; }
.tag-editorial    { background: #F1F5F9; color: #475569; }

/* ── Review Cards ──────────────────────────────────────── */
.review-card {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.625rem;
  box-shadow: var(--shadow-card);
  transition: box-shadow var(--transition), transform var(--transition);
  display: flex;
  flex-direction: column;
}
.review-card:hover {
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-3px);
}

.review-card--featured {
  border-top: 3px solid var(--color-accent);
}
.review-card__badge {
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.3rem 0.625rem;
  background: #ECFDF5;
  color: #065F46;
  border-radius: 9999px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.review-search-wrap {
  position: relative;
  width: 100%;
  max-width: 28rem;
}
.review-search-wrap svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  color: #94A3B8;
}
#review-search {
  width: 100%;
  padding: 0.625rem 0.875rem 0.625rem 2.5rem;
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  font-size: 0.9375rem;
  color: var(--color-heading);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#review-search:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.12);
}
.filter-btn {
  padding: 0.4rem 0.9rem;
  border-radius: 9999px;
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1.5px solid var(--color-border);
  background: #fff;
  color: #334155;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.filter-btn:hover {
  border-color: #99F6E4;
  color: #0D9488;
}
.filter-btn.is-active {
  background: #14B8A6;
  border-color: #14B8A6;
  color: #fff;
}
#review-sort {
  min-width: 12rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  border: 1px solid var(--color-border);
  border-radius: 0.5rem;
  color: #334155;
  background: #fff;
  cursor: pointer;
}
#review-sort:focus {
  outline: none;
  border-color: var(--color-accent);
}
.reviews-faq details {
  border: 1px solid var(--color-border);
  border-radius: 0.75rem;
  margin-bottom: 0.5rem;
  background: #fff;
  padding: 0.875rem 1.25rem;
}
.reviews-faq details summary {
  font-weight: 600;
  color: #0F172A;
  cursor: pointer;
  list-style: none;
  font-size: 0.9375rem;
}
.reviews-faq details summary::-webkit-details-marker { display: none; }
.reviews-faq details[open] summary {
  margin-bottom: 0.5rem;
  color: #14B8A6;
}
.reviews-faq details p {
  font-size: 0.875rem;
  color: #475569;
  line-height: 1.7;
  margin: 0;
}

/* ── Disclaimer / Info Blocks ──────────────────────────── */
.disclaimer-block {
  background-color: #FEF2F2;
  border: 1px solid #FCA5A5;
  border-left: 4px solid var(--color-red);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}
.disclaimer-block p { color: #7F1D1D; }

.info-block {
  background-color: #ECFDF5;
  border: 1px solid #A7F3D0;
  border-left: 4px solid var(--color-green);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

.note-block {
  background-color: var(--color-bg-alt);
  border: 1px solid #BFDBFE;
  border-left: 4px solid var(--color-blue);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
}

/* ── Interactive Slider Tool ───────────────────────────── */
.slider-wrap { margin-bottom: 2rem; }

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.875rem;
}
.slider-header-label {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-heading);
}
.slider-value-badge {
  display: inline-block;
  padding: 0.2rem 0.75rem;
  background-color: var(--color-accent);
  color: #fff;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 700;
  min-width: 110px;
  text-align: center;
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  background: var(--color-bg-soft);
  border-radius: 9999px;
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--color-accent), 0 2px 8px rgba(0,0,0,0.18);
  cursor: pointer;
  transition: transform var(--transition), box-shadow var(--transition);
}
input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 0 0 4px rgba(20,184,166,0.25), 0 2px 8px rgba(0,0,0,0.2);
}
input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-accent);
  border: 3px solid #fff;
  box-shadow: 0 0 0 2px var(--color-accent);
  cursor: pointer;
}

.slider-scale {
  display: flex;
  justify-content: space-between;
  margin-top: 0.375rem;
}
.slider-scale span {
  font-size: 0.6875rem;
  color: var(--color-muted);
  font-weight: 500;
}

.tool-result-panel {
  background: linear-gradient(145deg, #F0FDFA 0%, #F8FAFC 100%);
  border: 1.5px solid rgba(20, 184, 166, 0.28);
  border-radius: var(--radius);
  padding: 2rem;
  min-height: 240px;
  transition: opacity 0.25s ease;
}

/* ── Navigation ────────────────────────────────────────── */
.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-body);
  transition: color var(--transition), background-color var(--transition);
  background: none;
  border: none;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  font-family: var(--font-sans);
}
.nav-link:hover { color: var(--color-accent); background-color: var(--color-bg-alt); }
.nav-link.active { color: var(--color-accent); }

.dropdown-parent { position: relative; }

.dropdown-menu {
  position: absolute;
  top: calc(100% + 0.625rem);
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  min-width: 260px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-dropdown);
  padding: 0.5rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, transform 0.18s ease, visibility 0.18s;
  z-index: 200;
}
.dropdown-parent:hover .dropdown-menu,
.dropdown-parent.open   .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

.dropdown-menu a {
  display: block;
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.8125rem;
  color: var(--color-body);
  transition: background-color var(--transition), color var(--transition);
}
.dropdown-menu a:hover {
  background-color: var(--color-bg-alt);
  color: var(--color-accent);
}

.dropdown-group-label {
  display: block;
  padding: 0.5rem 0.75rem 0.25rem;
  font-size: 0.625rem;
  font-weight: 700;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.375rem;
}
.dropdown-group-label:first-child { margin-top: 0; }

/* ── Mobile Menu ───────────────────────────────────────── */
#mobile-menu {
  border-top: 1px solid var(--color-border);
  background: #fff;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.32s ease;
}
#mobile-menu.open { max-height: 680px; }

.mobile-nav-link {
  display: block;
  padding: 0.8125rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-body);
  border-bottom: 1px solid var(--color-border);
  text-decoration: none;
  transition: color var(--transition), background-color var(--transition);
}
.mobile-nav-link:hover { color: var(--color-accent); background-color: var(--color-bg-alt); }

.mobile-dropdown-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.8125rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 500;
  color: var(--color-body);
  background: none;
  border: none;
  border-bottom: 1px solid var(--color-border);
  cursor: pointer;
  font-family: var(--font-sans);
}
.mobile-dropdown-btn .chevron {
  transition: transform 0.2s ease;
  flex-shrink: 0;
}
.mobile-dropdown-btn.open .chevron { transform: rotate(180deg); }

.mobile-dropdown-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
  background: var(--color-bg-alt);
}
.mobile-dropdown-content.open { max-height: 500px; }

.mobile-dropdown-content a {
  display: block;
  padding: 0.6875rem 1.75rem;
  font-size: 0.875rem;
  color: var(--color-body);
  border-bottom: 1px solid var(--color-border);
  text-decoration: none;
  transition: color var(--transition);
}
.mobile-dropdown-content a:last-child { border-bottom: none; }
.mobile-dropdown-content a:hover { color: var(--color-accent); }

/* ── Hero ──────────────────────────────────────────────── */
.hero-section {
  background: linear-gradient(150deg, #F0FDFA 0%, #FFFFFF 40%, #F8FAFC 100%);
  position: relative;
  overflow: hidden;
}
.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 60% 60% at 80% 20%, rgba(20,184,166,0.07) 0%, transparent 65%),
              radial-gradient(ellipse 40% 40% at 10% 80%, rgba(37,99,235,0.04) 0%, transparent 60%);
  pointer-events: none;
}

/* ── Trust Strip ───────────────────────────────────────── */
.trust-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--color-body);
}

/* ── Article / Prose ───────────────────────────────────── */
.prose-article h2 {
  font-size: clamp(1.25rem, 2.5vw, 1.625rem);
  font-weight: 700;
  color: var(--color-heading);
  margin-top: 2.75rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.625rem;
  border-bottom: 1px solid var(--color-border);
}
.prose-article h3 {
  font-size: 1.1875rem;
  font-weight: 600;
  color: var(--color-heading);
  margin-top: 2rem;
  margin-bottom: 0.5rem;
}
.prose-article p   { color: var(--color-body); line-height: 1.8; margin-bottom: 1.25rem; }
.prose-article ul,
.prose-article ol  { padding-left: 1.5rem; margin-bottom: 1.25rem; color: var(--color-body); }
.prose-article li  { margin-bottom: 0.5rem; line-height: 1.7; }
.prose-article strong { color: var(--color-heading); }
.prose-article a   { color: var(--color-accent); text-decoration: underline; text-decoration-color: rgba(20,184,166,0.4); }
.prose-article a:hover { text-decoration-color: var(--color-accent); }

/* ── Table of Contents ─────────────────────────────────── */
.toc {
  background: var(--color-bg-alt);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.375rem 1.625rem;
}
.toc-title {
  font-size: 0.8125rem;
  font-weight: 700;
  color: var(--color-heading);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.875rem;
}
.toc ul   { list-style: none; padding: 0; }
.toc li   { padding: 0.25rem 0; }
.toc a    { font-size: 0.875rem; color: var(--color-body); }
.toc a:hover { color: var(--color-accent); }

/* ── Breadcrumb ────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.375rem;
  font-size: 0.8125rem;
  color: var(--color-muted);
  padding: 0.875rem 0;
}
.breadcrumb a { color: var(--color-muted); }
.breadcrumb a:hover { color: var(--color-accent); }
.breadcrumb-sep { opacity: 0.5; }

/* ── Footer ────────────────────────────────────────────── */
#site-footer { border-top: 1px solid var(--color-border); }
.footer-disclaimer { font-size: 0.8125rem; color: var(--color-muted); line-height: 1.65; }

/* ── Text Gradient ─────────────────────────────────────── */
.text-gradient {
  background: linear-gradient(135deg, var(--color-accent) 0%, #2563EB 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Animations ────────────────────────────────────────── */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0);    }
}
.anim-fade-up { animation: fadeInUp 0.5s ease both; }
.anim-delay-1 { animation-delay: 0.1s; }
.anim-delay-2 { animation-delay: 0.2s; }
.anim-delay-3 { animation-delay: 0.3s; }
.anim-delay-4 { animation-delay: 0.4s; }

/* ── Scaffold Placeholder ──────────────────────────────── */
.scaffold-notice {
  background: linear-gradient(135deg, #FFF7ED 0%, #FEF9F0 100%);
  border: 1.5px dashed #FCD34D;
  border-radius: var(--radius);
  padding: 2rem 2.5rem;
  text-align: center;
}

/* ── Accessibility ─────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 3px;
  border-radius: 3px;
}
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

/* ── Print ─────────────────────────────────────────────── */
@media print {
  #site-header, #mobile-menu, .no-print { display: none !important; }
  body { color: #000; background: #fff; }
  a    { color: #000; text-decoration: underline; }
  .card, .review-card { box-shadow: none; border: 1px solid #ccc; }
  .section-pad { padding-block: 2rem; }
}
