/* styles.css
 * PropertyTaxMath.org Stylesheet
 *
 * Using TailwindCSS CDN in HTML files for utility classes.
 * This file contains custom styles that extend Tailwind.
 */

/* ===== CSS Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  line-height: 1.6;
  color: #0f172a; /* slate-900 */
  background-color: #f8fafc; /* slate-50 */
  margin: 0;
  padding: 0;
}

/* ===== Skip Link ===== */
.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;
}

.sr-only.focus\:not-sr-only:focus {
  position: fixed;
  top: 0;
  left: 0;
  width: auto;
  height: auto;
  padding: 1rem;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: normal;
  background: #2563eb;
  color: white;
  z-index: 9999;
}

/* ===== Layout ===== */
.two-column-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

@media (min-width: 1024px) {
  .two-column-layout {
    grid-template-columns: 2fr 1fr;
  }
}

.main-column {
  min-width: 0;
}

.sidebar {
  position: sticky;
  top: 5rem;
  align-self: start;
}

/* ===== Main Content ===== */

/* ===== Footer ===== */
/* Note: Footer styling now handled by Tailwind classes in HTML */
/* These are fallback styles for footers without Tailwind classes */
footer.legacy-footer {
  background: #1e293b; /* slate-800 */
  color: #f1f5f9; /* slate-100 */
  padding: 2rem 1rem 1.5rem 1rem;
  margin-top: 4rem;
  text-align: center;
}

footer.legacy-footer p {
  max-width: 1280px;
  margin: 0 auto;
  font-size: 0.875rem;
  color: #94a3b8; /* slate-400 */
}

/* ===== Component Cards ===== */
.component-card {
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.component-card h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #0f172a;
  margin: 0 0 1rem 0;
}

/* ===== Form Inputs ===== */
/* Scoped to component areas to avoid conflicting with Tailwind-styled inputs */
.component-card input[type="number"],
.component-card input[type="text"],
.component-card select,
.input-group input[type="number"],
.input-group input[type="text"],
.input-group select {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid #cbd5e1; /* slate-300 */
  border-radius: 0.375rem;
  font-size: 1rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.component-card input[type="number"]:focus,
.component-card input[type="text"]:focus,
.component-card select:focus,
.input-group input[type="number"]:focus,
.input-group input[type="text"]:focus,
.input-group select:focus {
  outline: none;
  border-color: #2563eb; /* blue-600 */
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.2);
}

input[type="range"] {
  width: 100%;
  height: 0.5rem;
  border-radius: 0.25rem;
  background: #e2e8f0; /* slate-200 */
  cursor: pointer;
  /* Add padding to increase touch target area */
  padding: 0.75rem 0;
  margin: -0.75rem 0;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 2.75rem; /* 44px minimum for touch targets (WCAG) */
  height: 2.75rem;
  border-radius: 50%;
  background: #2563eb; /* blue-600 */
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

input[type="range"]::-moz-range-thumb {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: #2563eb;
  cursor: pointer;
  border: none;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.15);
}

input[type="range"]:focus {
  outline: none;
}

input[type="range"]:focus::-webkit-slider-thumb {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
}

input[type="range"]:focus::-moz-range-thumb {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
}

/* Scoped label styles to avoid conflicting with Tailwind */
.component-card label,
.input-group label {
  display: block;
  font-weight: 500;
  color: #475569; /* slate-600 */
  margin-bottom: 0.25rem;
}

.input-group {
  margin-bottom: 1rem;
}

/* ===== Buttons ===== */
.btn-primary {
  display: inline-block;
  background: #2563eb; /* blue-600 */
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-weight: 500;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover {
  background: #1d4ed8; /* blue-700 */
}

.btn-primary:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.3);
}

.btn-secondary {
  display: inline-block;
  background: white;
  color: #475569; /* slate-600 */
  padding: 0.5rem 1rem;
  border-radius: 0.375rem;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid #cbd5e1; /* slate-300 */
  cursor: pointer;
  transition: background 0.15s;
}

.btn-secondary:hover {
  background: #f8fafc; /* slate-50 */
}

.btn-secondary:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(71, 85, 105, 0.2);
}

/* ===== Result Panels ===== */
.result-panel {
  background: #f1f5f9; /* slate-100 */
  border-radius: 0.375rem;
  padding: 1rem;
  margin-top: 1rem;
}

.result-panel .label {
  font-weight: 500;
  color: #475569;
}

.result-panel .value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
}

/* ===== Corridor Visualization ===== */
.ratio-bar-container {
  position: relative;
  padding: 2rem 0;
}

.ratio-bar {
  position: relative;
  height: 2rem;
  background: #e2e8f0; /* slate-200 */
  border-radius: 0.25rem;
  overflow: visible;
}

.corridor-band {
  position: absolute;
  height: 100%;
  background: linear-gradient(90deg,
    rgba(34, 197, 94, 0.2) 0%,
    rgba(34, 197, 94, 0.4) 50%,
    rgba(34, 197, 94, 0.2) 100%
  );
  border-radius: 0.25rem;
  transition: left 0.2s, width 0.2s;
}

.marker {
  position: absolute;
  top: -0.5rem;
  width: 0.25rem;
  height: 3rem;
  background: #0f172a;
  transform: translateX(-50%);
  transition: left 0.2s, background 0.2s;
}

.marker::after {
  content: '';
  position: absolute;
  top: -0.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: inherit;
}

.marker.inside {
  background: #22c55e; /* green-500 */
}

.marker.outside {
  background: #ef4444; /* red-500 */
}

.marker.edge {
  background: #eab308; /* yellow-500 */
}

.bar-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: #64748b; /* slate-500 */
}

/* ===== Status Indicators ===== */
.status-panel {
  background: #f8fafc;
  border-radius: 0.375rem;
  padding: 1rem;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.status-indicator.inside {
  color: #16a34a; /* green-600 */
}

.status-indicator.outside {
  color: #dc2626; /* red-600 */
}

.status-indicator.edge {
  color: #ca8a04; /* yellow-600 */
}

/* ===== Risk Meter ===== */
.risk-meter {
  margin-top: 1rem;
}

.meter-bar {
  height: 0.5rem;
  background: #e2e8f0;
  border-radius: 0.25rem;
  overflow: hidden;
  margin: 0.5rem 0;
}

.meter-fill {
  height: 100%;
  background: #22c55e;
  transition: width 0.3s, background 0.3s;
}

.meter-fill.high {
  background: #ef4444;
}

/* ===== Timeline ===== */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

@media (min-width: 768px) {
  .timeline {
    flex-direction: row;
    align-items: flex-start;
  }
}

.timeline-step {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.step-icon {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: #2563eb;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  flex-shrink: 0;
}

.step-icon.pulse {
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.4);
  }
  50% {
    box-shadow: 0 0 0 0.5rem rgba(37, 99, 235, 0);
  }
}

.timeline-arrow {
  display: none;
  font-size: 1.5rem;
  color: #94a3b8;
}

@media (min-width: 768px) {
  .timeline-arrow {
    display: block;
  }
}

/* ===== Scenario Cards ===== */
.scenarios-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) {
  .scenarios-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.scenario-card {
  background: white;
  border: 2px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 1rem;
}

.scenario-card.scenario-inside {
  border-color: #22c55e;
}

.scenario-card.scenario-outside {
  border-color: #ef4444;
}

.scenario-card.scenario-edge {
  border-color: #eab308;
}

.corridor-status {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.5rem;
}

.scenario-inside .corridor-status {
  color: #16a34a;
}

.scenario-outside .corridor-status {
  color: #dc2626;
}

.scenario-edge .corridor-status {
  color: #ca8a04;
}

/* ===== Comparison Grid ===== */
.comparison-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 768px) {
  .comparison-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.comparison-column {
  background: white;
  border-radius: 0.5rem;
  padding: 1.5rem;
  border: 1px solid #e2e8f0;
}

.comparison-column h4 {
  margin: 0 0 1rem 0;
  color: #0f172a;
}

.comparison-column ul {
  margin: 0;
  padding-left: 1.25rem;
}

.comparison-column li {
  margin-bottom: 0.5rem;
}

/* ===== Blockquote ===== */
blockquote.key-quote {
  background: #f1f5f9;
  border-left: 4px solid #2563eb;
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  font-style: italic;
  color: #475569;
}

/* ===== Glossary ===== */
.glossary-list {
  margin: 0;
  padding: 0;
}

.term-group {
  margin-bottom: 2rem;
}

.glossary-list dt {
  font-weight: 600;
  color: #0f172a;
  margin-bottom: 0.25rem;
}

.glossary-list dd {
  margin: 0 0 1rem 0;
  color: #475569;
}

#alpha-nav {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

#alpha-nav a {
  display: inline-block;
  width: 2rem;
  height: 2rem;
  border-radius: 0.25rem;
  background: #e2e8f0;
  color: #0f172a;
  text-decoration: none;
  text-align: center;
  line-height: 2rem;
  font-weight: 500;
}

#alpha-nav a:hover {
  background: #2563eb;
  color: white;
}

/* ===== Topic Cards ===== */
.topic-cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .topic-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

.topic-card {
  display: block;
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 1.5rem;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.topic-card:hover {
  border-color: #2563eb;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.topic-card h3 {
  margin: 0 0 0.5rem 0;
  color: #2563eb;
}

.topic-card p {
  margin: 0;
  color: #64748b;
  font-size: 0.875rem;
}

/* ===== Map Container ===== */
.map-container {
  margin-bottom: 2rem;
}

.map-wrapper {
  position: relative;
  padding-bottom: 56.25%; /* 16:9 aspect ratio */
  height: 0;
  overflow: hidden;
  border-radius: 0.5rem;
  background: #e2e8f0;
}

.map-wrapper iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.map-legend {
  display: flex;
  gap: 1rem;
  margin-top: 0.75rem;
  font-size: 0.875rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.swatch {
  width: 1rem;
  height: 1rem;
  border-radius: 0.25rem;
}

.swatch.adp-yes {
  background: #22c55e;
}

.swatch.adp-no {
  background: #ef4444;
}

/* ===== Teaser Card ===== */
.teaser-card {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 0.5rem;
  padding: 1.5rem;
}

.teaser-card h4 {
  margin: 0 0 1rem 0;
}

.learn-more {
  display: inline-block;
  margin-top: 1rem;
  color: #2563eb;
  font-weight: 500;
}

/* ===== Source Stack ===== */
.source-stack h4 {
  margin: 0 0 0.75rem 0;
  font-size: 1rem;
}

.source-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.source-list li {
  margin-bottom: 0.5rem;
}

.source-list a {
  color: #2563eb;
  text-decoration: none;
}

.source-list a:hover {
  text-decoration: underline;
}

.source-type {
  font-size: 0.75rem;
  color: #64748b;
  margin-left: 0.5rem;
}

/* ===== Intro Text ===== */
.intro {
  font-size: 1.125rem;
  color: #475569;
  margin-bottom: 2rem;
}

/* ===== Responsive Typography ===== */
/* Scoped to .prose or .content areas to avoid conflicting with Tailwind */
.prose h1, .content h1 {
  font-size: 2rem;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 1rem 0;
}

@media (min-width: 768px) {
  .prose h1, .content h1 {
    font-size: 2.5rem;
  }
}

.prose h2, .content h2 {
  font-size: 1.5rem;
  font-weight: 600;
  color: #0f172a;
  margin: 2rem 0 1rem 0;
}

.prose h3, .content h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: #0f172a;
  margin: 1.5rem 0 0.75rem 0;
}

/* ===== Hero Section ===== */
#math-proof-hero {
  background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
  color: white;
  padding: 4rem 1rem;
  text-align: center;
}

#math-proof-hero h2 {
  color: white;
  font-size: 1.75rem;
  max-width: 800px;
  margin: 0 auto 1.5rem;
}

@media (min-width: 768px) {
  #math-proof-hero h2 {
    font-size: 2.25rem;
  }
}

.proof-box {
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  border-radius: 0.5rem;
  padding: 1.5rem;
  display: inline-block;
}

.proof-box p {
  margin: 0.5rem 0;
}

.proof-box .formula {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: ui-monospace, monospace;
}

/* ===== Focus Visible ===== */
*:focus-visible {
  outline: 2px solid #2563eb;
  outline-offset: 2px;
}

/* ===== Component Shared Styles ===== */
.component-description {
  color: #64748b;
  margin-bottom: 1.5rem;
  font-size: 0.9375rem;
}

.input-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .input-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.input-help {
  display: block;
  font-size: 0.75rem;
  color: #94a3b8;
  margin-top: 0.25rem;
}

.input-error {
  border-color: #ef4444 !important;
}

.input-error-message {
  display: block;
  font-size: 0.75rem;
  color: #ef4444;
  margin-top: 0.25rem;
}

.result-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.result-label {
  font-weight: 500;
  color: #475569;
}

.result-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: #0f172a;
}

.result-updated {
  animation: resultPulse 0.3s ease;
}

@keyframes resultPulse {
  0% { background-color: rgba(34, 197, 94, 0.2); }
  100% { background-color: transparent; }
}

.formula-display {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #e2e8f0;
}

.formula-text {
  font-size: 0.875rem;
  color: #64748b;
  font-family: ui-monospace, monospace;
}

/* ===== Site Navigation ===== */
.site-header {
  background: linear-gradient(135deg, #1a365d 0%, #2c5282 50%, #1a365d 100%);
  border-top: 4px solid #b7791f;
}

/* Desktop nav - hide on mobile, show on desktop */
.desktop-nav,
.desktop-search {
  display: none !important;
}

@media (min-width: 1024px) {
  .desktop-nav {
    display: flex !important;
  }
  .desktop-search {
    display: block !important;
  }
}

.site-nav-item {
  white-space: nowrap;
}

.site-nav-dropdown {
  transform: translateY(-4px);
  transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;
}

.group:hover .site-nav-dropdown {
  transform: translateY(0);
}

/* Mobile menu animation */
#mobile-menu {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}

#mobile-menu:not(.hidden) {
  max-height: 100vh;
}

/* Nav item hover effects */
.site-nav-item svg {
  transition: transform 0.15s ease;
}

.site-nav-item:hover svg {
  transform: scale(1.1);
}

/* Active indicator */
.site-nav-item[aria-current="page"] {
  position: relative;
}

.site-nav-item[aria-current="page"]::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: #d69e2e;
  border-radius: 50%;
}

/* ===== Utility Classes ===== */
/* Note: Most utilities now provided by Tailwind CDN */
/* Only keep custom utilities not in Tailwind */
