/* Abuelos3000 — Estilos globales compartidos */

:root {
  --cream: #FAF6EF;
  --warm-white: #FFF9F3;
  --terracotta: #C8603A;
  --terracotta-light: #E8845E;
  --terracotta-pale: #FDF0EB;
  --sage: #7A9E7E;
  --sage-light: #A8C5AC;
  --sage-pale: #EEF5EF;
  --navy: #1D2B3A;
  --navy-light: #2C3E50;
  --gold: #D4A843;
  --gold-pale: #FDF6E3;
  --border: #E8DDD0;
  --muted: #54493D;
  --ink: #2C2416;
  --bg: #FAF6EF;
  --focus-ring: #1D2B3A;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --shadow-sm: 0 8px 24px rgba(44,36,22,.08);
  --shadow-md: 0 16px 40px rgba(44,36,22,.12);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 17px;
  line-height: 1.6;
  margin: 0;
  overflow-x: hidden;
}

.font-display { font-family: 'Lora', serif !important; }

/* Animations */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.93); }
  to   { opacity: 1; transform: scale(1); }
}
@keyframes shimmer {
  from { background-position: -200% 0; }
  to   { background-position: 200% 0; }
}

.fu  { animation: fadeUp .5s ease both; }
.fu1 { animation-delay: .06s; }
.fu2 { animation-delay: .12s; }
.fu3 { animation-delay: .18s; }
.fu4 { animation-delay: .24s; }
.fu5 { animation-delay: .30s; }
.fu6 { animation-delay: .36s; }

/* Cards */
.card {
  background: white;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.card-hover {
  transition: transform .25s ease, box-shadow .25s ease;
}
.card-hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}

/* Buttons */
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--terracotta);
  color: white;
  font-weight: 600; font-size: 16px;
  min-height: 48px;
  padding: 12px 24px;
  border-radius: 99px;
  border: none; cursor: pointer;
  transition: background .2s, transform .2s;
}
.btn-primary:hover { background: var(--terracotta-light); transform: translateY(-1px); }

.btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  background: white;
  color: var(--ink);
  font-weight: 600; font-size: 16px;
  min-height: 48px;
  padding: 12px 24px;
  border-radius: 99px;
  border: 1px solid var(--border); cursor: pointer;
  transition: border-color .2s, color .2s, transform .2s;
}
.btn-secondary:hover { border-color: var(--navy); color: var(--navy); transform: translateY(-1px); }

.btn-primary:focus-visible,
.btn-secondary:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

/* Progress bar */
.progress-bar {
  height: 6px; background: var(--border); border-radius: 99px; overflow: hidden;
}
.progress-fill {
  height: 100%; background: var(--terracotta); border-radius: 99px;
  transition: width .6s ease;
}

/* Badge */
.badge { display: inline-flex; align-items: center; font-size: 12px; font-weight: 500; padding: 3px 10px; border-radius: 99px; }
.badge-green  { background: rgba(122,158,126,.12); color: #5A7E5E; }
.badge-orange { background: rgba(200,96,58,.10);  color: #A84B2A; }
.badge-gold   { background: rgba(212,168,67,.12); color: #8A6810; }
.badge-muted  { background: rgba(107,93,79,.08);  color: var(--muted); }

/* Skeleton loader */
.skeleton {
  background: linear-gradient(90deg, var(--border) 25%, var(--cream) 50%, var(--border) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 8px;
}

/* Form fields */
.field {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  min-height: 50px;
  padding: 12px 16px;
  font-size: 16px;
  font-family: 'Nunito', sans-serif;
  color: var(--ink);
  background: white;
  outline: none;
  transition: border-color .2s;
}
.field:focus { border-color: var(--terracotta); }
.field::placeholder { color: var(--muted); opacity: .6; }

label.field-label { display: block; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 7px; }

/* Alerts */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  padding: var(--space-3) var(--space-4);
  font-size: 14px;
  line-height: 1.5;
}
.alert-success { background: var(--sage-pale); color: #365E3A; border-color: rgba(122,158,126,.35); }
.alert-info { background: #EAF1FB; color: #2F527D; border-color: rgba(91,135,197,.35); }
.alert-warning { background: var(--gold-pale); color: #7A5A16; border-color: rgba(212,168,67,.35); }
.alert-error { background: #FDEDEC; color: #8C3127; border-color: rgba(200,96,58,.35); }

/* Layout helpers */
.ds-container { max-width: 1200px; margin: 0 auto; padding: 0 var(--space-5); }
.ds-stack > * + * { margin-top: var(--space-4); }

/* Reusable sections */
.section-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-6);
}

.section-card-soft {
  background: var(--warm-white);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
}

/* Accessibility helpers */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* Reusable modal and form atoms */
.a3k-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(29, 43, 58, .7);
  backdrop-filter: blur(6px);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.a3k-modal-panel {
  background: #fff;
  border-radius: 28px;
  width: 100%;
  max-width: 440px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0, 0, 0, .25);
}

.a3k-input {
  width: 100%;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  font-family: 'Nunito', sans-serif;
  box-sizing: border-box;
  background: #fff;
  color: var(--ink);
}

.a3k-input:focus {
  border-color: var(--terracotta);
}

.a3k-pill-btn {
  border-radius: 99px;
  font-family: 'Nunito', sans-serif;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}

/* Reusable form row */
.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}
@media (max-width: 768px) {
  .form-row { grid-template-columns: 1fr; }
}

/* WhatsApp floating action button */
.a3k-wa-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  width: 54px;
  height: 54px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  text-decoration: none;
  box-shadow: 0 8px 24px rgba(37, 211, 102, .4);
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.a3k-wa-fab:hover {
  transform: scale(1.1);
}

.a3k-wa-fab-green {
  background: #25D366;
}

.a3k-wa-fab-green:hover {
  background: #1fb855;
}

.a3k-wa-fab-brand {
  width: 64px;
  height: 64px;
  bottom: 84px;
  background: linear-gradient(135deg, #C8603A, #E8845E);
  box-shadow: 0 6px 24px rgba(200, 96, 58, .45);
}

.a3k-wa-fab-icon {
  font-size: 22px;
  line-height: 1;
}

.a3k-wa-fab-icon-img {
  width: 60px;
  height: 60px;
  display: block;
}

/* Checkbox visibility */
input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  min-height: 20px;
  border: 2px solid #8D7E6E;
  border-radius: 5px;
  background: #fff;
  display: inline-grid;
  place-content: center;
  flex-shrink: 0;
  cursor: pointer;
}

input[type="checkbox"]:checked {
  background: var(--terracotta);
  border-color: var(--terracotta);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='white' d='M6.2 11.3 2.9 8l1.4-1.4 1.9 1.9 5.5-5.5L13.1 4z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px 14px;
}

input[type="checkbox"]:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Section headers */
.section-tag {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase;
  color: var(--terracotta);
}
.section-tag::before { content: ''; display: block; width: 16px; height: 2px; background: currentColor; border-radius: 2px; }

/* Senior-friendly UX defaults */
button,
a.btn-primary,
a.btn-secondary,
input,
select,
textarea {
  min-height: 44px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 3px;
}

/* Unify nav readability across pages that inject nav.js */
#a3k-header .a3k-nav-link {
  font-size: 16px;
  line-height: 1;
}

#a3k-header button,
#a3k-header a {
  min-height: 42px;
}

#a3k-header .max-w-7xl {
  align-items: center !important;
}

/* =========================================
   Responsive hardening (mobile/tablet)
   ========================================= */
img,
svg,
video,
canvas,
iframe {
  max-width: 100%;
}

iframe {
  width: 100%;
}

main,
section,
article,
aside,
header,
footer,
div {
  min-width: 0;
}

.card,
.checkout-card,
.cart-card,
.panel,
#detail-box,
#modal-box {
  max-width: 100%;
}

#toast,
[id*="toast"] {
  max-width: calc(100vw - 24px);
  white-space: normal !important;
  text-align: center;
}

table {
  width: 100%;
}

@media (max-width: 1024px) {
  .text-xs {
    font-size: 13px !important;
    line-height: 1.45;
  }
}

@media (max-width: 768px) {
  body {
    font-size: 16px;
  }

  .btn-primary,
  .btn-secondary,
  button,
  a.btn-primary,
  a.btn-secondary {
    min-height: 46px;
    padding-left: 16px;
    padding-right: 16px;
  }

  .field {
    min-height: 48px;
    font-size: 16px;
  }

  .card,
  .checkout-card,
  .cart-card {
    border-radius: 14px;
  }

  #a3k-header .a3k-nav-link {
    font-size: 15px;
  }
}

@media (max-width: 640px) {
  html,
  body {
    overflow-x: hidden;
  }

  .ds-container {
    padding-left: 14px;
    padding-right: 14px;
  }

  /* Prevent common fixed-width modal/footer controls from overflowing on courses/pages */
  #detail-box,
  #checkout-overlay > div,
  #modal-box,
  #success-popup > div,
  #register-popup > div,
  #account-created-popup > div {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Safer grids on narrow phones */
  [style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }

  [style*="min-width:200px"] {
    min-width: 0 !important;
  }
}

/* Final normalization pass for legacy page-specific cards */
.course-card,
.guide-card,
.checkout-card,
.cart-card,
.t-card,
.pcard,
.resource-box {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

@media (max-width: 768px) {
  body {
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Accessibility layer for senior-friendly reading */
:root { --a3k-font-scale: 1; }
html { font-size: calc(100% * var(--a3k-font-scale)); }

.a3k-a11y-toolbar {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 9998;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.a3k-a11y-btn {
  border: 1px solid var(--border);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  min-height: 44px;
  padding: 10px 14px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,.12);
}
.a3k-a11y-btn.active {
  background: var(--terracotta-pale);
  border-color: var(--terracotta);
  color: var(--terracotta);
}

html.a3k-reading-mode body {
  line-height: 1.75;
  letter-spacing: 0.01em;
}
html.a3k-reading-mode p,
html.a3k-reading-mode li,
html.a3k-reading-mode label,
html.a3k-reading-mode input,
html.a3k-reading-mode textarea,
html.a3k-reading-mode select,
html.a3k-reading-mode .text-sm,
html.a3k-reading-mode .text-xs {
  font-size: 1.02em !important;
}
html.a3k-reading-mode .card,
html.a3k-reading-mode .checkout-card,
html.a3k-reading-mode .cart-card,
html.a3k-reading-mode .field {
  border-width: 1.5px;
}

@media (max-width: 640px) {
  .a3k-a11y-toolbar {
    right: 10px;
    left: auto;
    bottom: 10px;
    max-width: calc(100vw - 20px);
  }
}

.field-help {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

@media (max-width: 768px) {
  .btn-primary, .btn-secondary, button, a.btn-primary, a.btn-secondary {
    min-height: 50px;
  }
}
