/* SuisseSenior.ch — Custom overrides beyond Tailwind CDN */

:root {
  --color-primary: #0033A0;
  --color-accent: #DA291C;
  --color-bg: #F8F9FA;
  --color-text: #1F2937;
  --font-base: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

/* Alpine.js — prevent flash of hidden content */
[x-cloak] {
  display: none !important;
}

/* Footer — readable size for seniors */
.site-footer,
.site-footer p,
.site-footer li,
.site-footer a {
  font-size: 1rem;
  line-height: 1.65;
}

body {
  font-family: var(--font-base);
  font-size: 18px;
  line-height: 1.7;
  color: var(--color-text);
  background-color: var(--color-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
  min-width: 0;
}

/* Images & media — never overflow viewport */
img,
svg,
video {
  max-width: 100%;
  height: auto;
}

main,
header,
footer {
  max-width: 100%;
}

@media (min-width: 768px) {
  body {
    font-size: 19px;
  }
}

/* Focus visible for accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 2px;
}

/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  z-index: 100;
  padding: 0.75rem 1.25rem;
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
  border-radius: 0 0 0.5rem 0.5rem;
  text-decoration: none;
}

.skip-link:focus {
  top: 0;
}

/* Site logo — official PNG on white header */
.site-logo {
  display: inline-flex;
  align-items: center;
  flex-shrink: 1;
  min-width: 0;
  max-width: min(90vw, 280px);
  text-decoration: none;
}

.site-logo img {
  max-height: 48px;
  width: auto;
  height: auto;
  display: block;
  object-fit: contain;
}

@media (min-width: 768px) {
  .site-logo {
    max-width: 300px;
  }

  .site-logo img {
    max-height: 56px;
  }
}

@media (min-width: 1024px) {
  .site-logo img {
    max-height: 64px;
  }
}

.footer-logo {
  max-width: 180px;
  width: auto;
  height: auto;
  max-height: 40px;
  display: block;
  object-fit: contain;
}

/* Header & mobile navigation */
.header-inner {
  min-width: 0;
  gap: 0.75rem;
}

.nav-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  min-height: 44px;
  flex-shrink: 0;
}

.mobile-nav-panel {
  width: 100%;
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  min-height: 44px;
}

.desktop-nav {
  flex-wrap: nowrap;
}

@media (min-width: 1024px) and (max-width: 1279px) {
  .desktop-nav {
    gap: 0.75rem !important;
    font-size: 0.875rem;
  }

  .desktop-nav .btn-primary {
    padding: 0.5rem 0.875rem;
    font-size: 0.875rem;
    min-height: 44px;
  }
}

.desktop-nav .btn-primary.min-h-0 {
  min-height: 44px;
}

/* Prose content styling */
.prose-content {
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

.prose-content h2 {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  line-height: 1.3;
}

.prose-content h3 {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--color-text);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

.prose-content p {
  margin-bottom: 1.25rem;
}

.prose-content ul,
.prose-content ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

.prose-content li {
  margin-bottom: 0.5rem;
}

.prose-content a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.prose-content a:hover {
  color: var(--color-accent);
}

.prose-content blockquote {
  border-left: 4px solid var(--color-accent);
  padding: 1rem 1.5rem;
  margin: 1.5rem 0;
  background: #fff;
  border-radius: 0 0.5rem 0.5rem 0;
  font-style: italic;
}

/* CTA buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  font-size: 1.125rem;
  font-weight: 700;
  color: #fff;
  background-color: var(--color-primary);
  border-radius: 0.75rem;
  text-decoration: none;
  transition: background-color 0.2s, transform 0.15s;
  min-height: 56px;
}

.btn-primary:hover {
  background-color: #002680;
  transform: translateY(-1px);
}

.btn-accent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  font-size: 1.125rem;
  font-weight: 700;
  color: #fff;
  background-color: var(--color-accent);
  border-radius: 0.75rem;
  text-decoration: none;
  transition: background-color 0.2s;
  min-height: 56px;
}

.btn-accent:hover {
  background-color: #b82218;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-primary);
  background-color: #fff;
  border: 2px solid var(--color-primary);
  border-radius: 0.75rem;
  text-decoration: none;
  transition: all 0.2s;
  min-height: 56px;
}

.btn-outline:hover {
  background-color: var(--color-primary);
  color: #fff;
}

/* Outline button for dark backgrounds (hero, banners) */
.btn-outline-light {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem 2rem;
  font-size: 1.125rem;
  font-weight: 600;
  color: #fff;
  background-color: transparent;
  border: 2px solid #fff;
  border-radius: 0.75rem;
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s, transform 0.15s;
  min-height: 56px;
}

.btn-outline-light:hover {
  background-color: #fff;
  color: var(--color-primary);
  transform: translateY(-1px);
}

.btn-outline-light:focus-visible {
  outline-color: #fff;
}

/* Cards */
.card {
  background: #fff;
  border-radius: 1rem;
  padding: 1.75rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 12px rgba(0, 0, 0, 0.04);
  transition: box-shadow 0.2s, transform 0.2s;
}

.card:hover {
  box-shadow: 0 4px 16px rgba(0, 51, 160, 0.12);
  transform: translateY(-2px);
}

/* FAQ accordion */
.faq-item {
  border-bottom: 1px solid #e5e7eb;
}

.faq-item:last-child {
  border-bottom: none;
}

/* Checklist */
.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem;
  background: #fff;
  border-radius: 0.75rem;
  margin-bottom: 0.75rem;
  border: 1px solid #e5e7eb;
  cursor: pointer;
  transition: background-color 0.15s;
}

.checklist-item:hover {
  background: #f0f4ff;
}

.checklist-item.checked {
  background: #ecfdf5;
  border-color: #6ee7b7;
}

.checklist-item input[type="checkbox"] {
  width: 1.5rem;
  height: 1.5rem;
  margin-top: 0.15rem;
  accent-color: var(--color-primary);
  flex-shrink: 0;
}

/* Letter template box */
.letter-template {
  background: #fff;
  border: 2px dashed #cbd5e1;
  border-radius: 0.75rem;
  padding: 1rem;
  font-family: 'Courier New', Courier, monospace;
  font-size: clamp(0.8125rem, 2.8vw, 0.95rem);
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}

@media (min-width: 640px) {
  .letter-template {
    padding: 1.5rem;
  }
}

/* Simulator */
.simulator-result {
  background: linear-gradient(135deg, var(--color-primary), #0047cc);
  color: #fff;
  border-radius: 1rem;
  padding: 1.25rem;
  text-align: center;
  max-width: 100%;
  overflow: hidden;
}

@media (min-width: 640px) {
  .simulator-result {
    padding: 1.5rem;
  }
}

@media (min-width: 768px) {
  .simulator-result {
    padding: 2rem;
  }
}

.simulator-total {
  font-size: clamp(1.75rem, 7vw, 3rem);
  line-height: 1.15;
  word-break: break-word;
}

.simulator-breakdown {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  text-align: center;
}

@media (min-width: 400px) {
  .simulator-breakdown {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* Touch-friendly range sliders */
input[type="range"] {
  width: 100%;
  min-height: 44px;
  cursor: pointer;
  accent-color: var(--color-primary);
}

/* Button groups — stack on mobile */
.hero-actions,
.tool-actions,
.btn-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

.hero-actions > a,
.hero-actions > button,
.tool-actions > a,
.tool-actions > button,
.btn-stack > a,
.btn-stack > button,
.btn-stack > .btn-primary,
.btn-stack > .btn-outline,
.btn-stack > .btn-accent,
.tool-actions > .btn-primary,
.tool-actions > .btn-outline,
.tool-actions > .btn-accent {
  width: 100%;
  max-width: 100%;
}

@media (min-width: 640px) {
  .hero-actions,
  .tool-actions,
  .btn-stack {
    flex-direction: row;
    flex-wrap: wrap;
    width: auto;
  }

  .hero-actions > a,
  .hero-actions > button,
  .tool-actions > a,
  .tool-actions > button,
  .btn-stack > a,
  .btn-stack > button,
  .btn-stack > .btn-primary,
  .btn-stack > .btn-outline,
  .btn-stack > .btn-accent,
  .tool-actions > .btn-primary,
  .tool-actions > .btn-outline,
  .tool-actions > .btn-accent {
    width: auto;
  }
}

.btn-copy-mobile {
  width: 100%;
}

@media (min-width: 640px) {
  .btn-copy-mobile {
    width: auto;
  }
}

/* Print styles for checklist PDF */
@media print {
  header, footer, .no-print, nav, .skip-link {
    display: none !important;
  }

  body {
    font-size: 12pt;
    background: #fff;
  }

  .checklist-item {
    break-inside: avoid;
    border: 1px solid #ccc;
  }

  .checklist-item.checked::after {
    content: " ✓";
    font-weight: bold;
  }
}

/* Hero gradient */
.hero-gradient {
  background: linear-gradient(135deg, #0033A0 0%, #0047cc 50%, #0033A0 100%);
}

/* Badge */
.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 9999px;
  background: #e0e7ff;
  color: var(--color-primary);
}

/* Table responsive */
.table-wrapper,
.responsive-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  margin: 1.5rem 0;
}

table.data-table {
  width: 100%;
  min-width: 520px;
  border-collapse: collapse;
  font-size: 1rem;
}

@media (max-width: 639px) {
  table.data-table {
    font-size: 0.9375rem;
  }

  table.data-table th,
  table.data-table td {
    padding: 0.625rem 0.75rem;
  }
}

table.data-table th,
table.data-table td {
  padding: 0.875rem 1rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}

table.data-table th {
  background: var(--color-primary);
  color: #fff;
  font-weight: 600;
}

table.data-table tr:nth-child(even) {
  background: #f9fafb;
}

/* Partner banner subtle */
.partner-link {
  color: var(--color-primary);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.partner-link:hover {
  color: var(--color-accent);
}

/* Footer — touch-friendly links */
.site-footer ul a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.25rem 0;
}

/* Cards — slightly tighter on small screens */
@media (max-width: 639px) {
  .card {
    padding: 1.25rem;
  }
}

/* Hero headings — prevent overflow */
.hero-title {
  overflow-wrap: break-word;
  word-break: break-word;
  hyphens: auto;
}

/* Form controls — full width on narrow viewports */
@media (max-width: 639px) {
  select,
  input[type="text"],
  input[type="email"],
  input[type="number"],
  textarea {
    font-size: 1rem;
  }

  .card .btn-primary,
  .card .btn-outline,
  aside .btn-outline {
    width: 100%;
    max-width: 100%;
  }
}

/* FAQ — touch-friendly toggle */
.faq-item button {
  min-height: 44px;
  gap: 0.75rem;
}

.faq-item button span:last-child {
  flex-shrink: 0;
}
