/* ============================================================
   styles/public.css — TuftingMaker
   Estilos compartidos para TODAS las páginas públicas.
   Importar en cada HTML:  <link rel="stylesheet" href="/styles/public.css">
   ============================================================ */

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  --clay:       #B5491E;
  --clay-dk:    #8C3515;
  --clay-soft:  #E8C5B2;
  --clay-pale:  #F8EDE7;
  --cream:      #FAF6F1;
  --cream-2:    #F3EDE5;
  --sand:       #EDE4D8;
  --sand-2:     #D9CCBF;
  --ink:        #1C1410;
  --ink-2:      #3D2E27;
  --ink-3:      #7A6058;
  --ink-4:      #A89680;
  --white:      #FFFFFF;
  --success:    #2D6A4A;
  --success-bg: #EAF3DE;
  --error:      #A8282A;

  --r:     12px;
  --r-lg:  20px;
  --r-xl:  28px;
  --sh:    0 4px 32px rgba(28, 20, 16, .10);
  --sh-lg: 0 16px 64px rgba(28, 20, 16, .18);
  --sh-xl: 0 24px 80px rgba(28, 20, 16, .22);

  --font-display: 'Playfair Display', Georgia, serif;
  --font-body:    'DM Sans', ui-sans-serif, system-ui, sans-serif;
  --font-mono:    'Geist Mono', ui-monospace, monospace;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink);
  line-height: 1.6;
  overflow-y: scroll;
  -webkit-font-smoothing: antialiased;
}

/* ── Navbar ────────────────────────────────────────────────── */
.pub-nav {
  position: sticky;
  top: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 48px;
  height: 64px;
  background: rgba(250, 246, 241, .92);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, box-shadow .3s;
}

.pub-nav.scrolled {
  border-bottom-color: var(--sand-2);
  box-shadow: 0 2px 20px rgba(28, 20, 16, .07);
}

.pub-nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}

.pub-nav-logo-text {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -.3px;
}

.pub-nav-logo-text span {
  color: var(--ink-3);
  font-weight: 400;
}

.pub-nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
  list-style: none;
  flex-shrink: 0;
}

.pub-nav-links a {
  text-decoration: none;
  color: var(--ink-2);
  font-size: 14px;
  font-weight: 500;
  transition: color .2s;
  white-space: nowrap;
}

.pub-nav-links a:hover,
.pub-nav-links a.active {
  color: var(--clay);
}

.pub-nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ── Botones (público) ─────────────────────────────────────── */
.pub-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 22px;
  border-radius: 50px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  text-decoration: none;
  transition: all .2s;
  white-space: nowrap;
  letter-spacing: -.1px;
}

.pub-btn:active { transform: scale(.97); }

/* El outline por defecto del navegador (computado, existe) no es perceptible
   contra la forma de píldora + fondo de color de estos botones -- verificado
   visualmente con Playwright (Tab a "Comenzar gratis": sin anillo visible pese
   a que getComputedStyle sí reporta un outline). .pub-btn-white se usa dentro
   de secciones oscuras (CtaFinal, etc.) -- necesita el outline claro, no el
   oscuro que sirve para el resto de variantes sobre fondo claro. */
.pub-btn:focus-visible {
  outline: 2px solid var(--clay);
  outline-offset: 2px;
}
.pub-btn-white:focus-visible {
  outline-color: var(--white);
}

.pub-btn-ghost {
  background: transparent;
  color: var(--ink-2);
}

.pub-btn-ghost:hover {
  background: var(--sand);
  color: var(--ink);
}

.pub-btn-primary {
  background: var(--clay);
  color: var(--white);
  box-shadow: 0 2px 12px rgba(181, 73, 30, .35);
}

.pub-btn-primary:hover {
  background: var(--clay-dk);
  box-shadow: 0 4px 20px rgba(181, 73, 30, .45);
  transform: translateY(-1px);
}

.pub-btn-primary:active { transform: translateY(0); }

.pub-btn-outline {
  background: transparent;
  color: var(--clay);
  border: 1.5px solid var(--clay);
}

.pub-btn-outline:hover {
  background: var(--clay);
  color: var(--white);
}

.pub-btn-white {
  background: var(--white);
  color: var(--clay);
  box-shadow: 0 4px 20px rgba(0, 0, 0, .12);
}

.pub-btn-white:hover {
  background: var(--cream);
  box-shadow: 0 8px 32px rgba(0, 0, 0, .18);
  transform: translateY(-1px);
}

.pub-btn-lg {
  padding: 14px 32px;
  font-size: 15px;
}

/* ── Kicker (etiqueta sobre títulos) ───────────────────────── */
.pub-kicker {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--clay);
  margin-bottom: 14px;
}

/* ── Badges ────────────────────────────────────────────────── */
.pub-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink-2);
  background: var(--white);
  border: 1px solid var(--sand);
  border-radius: 50px;
  padding: 6px 14px;
}

/* ── Section helpers ───────────────────────────────────────── */
.pub-section-title {
  font-family: var(--font-display);
  font-size: clamp(30px, 4.5vw, 50px);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -1px;
  color: var(--ink);
  margin-bottom: 14px;
}

/* ── CTA final (fondo oscuro) ──────────────────────────────── */
.pub-final-cta {
  background: var(--ink);
  color: var(--white);
  text-align: center;
  padding: 80px 24px;
}

.pub-final-cta h2 {
  font-family: var(--font-display);
  font-size: clamp(26px, 4vw, 40px);
  font-weight: 700;
  margin-bottom: 10px;
  line-height: 1.2;
}

.pub-final-cta h2 em {
  font-style: italic;
  color: var(--clay-soft);
}

.pub-final-cta p {
  font-size: 15px;
  color: rgba(255, 255, 255, .5);
  margin-bottom: 32px;
}

/* ── Footer ────────────────────────────────────────────────── */
.pub-footer {
  background: var(--ink-2);
  color: rgba(255, 255, 255, .55);
  text-align: center;
  padding: 32px 24px;
}

.pub-footer-inner {
  max-width: 680px;
  margin: 0 auto;
}

.pub-footer-links {
  display: flex;
  justify-content: center;
  gap: 24px;
  list-style: none;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.pub-footer-links a {
  font-size: 13px;
  color: rgba(255, 255, 255, .55);
  text-decoration: none;
  transition: color .2s;
}

.pub-footer-links a:hover {
  color: rgba(255, 255, 255, .7);
}

.pub-footer-copy {
  font-size: 12px;
}

/* ── Footer (legal — separada) ─────────────────────────────── */
.pub-footer-legal {
  border-top: 1px solid var(--sand);
  padding: 32px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  font-family: var(--font-body);
}

.pub-footer-legal span {
  font-size: 13px;
  color: rgba(255, 255, 255, .55);
}

.pub-footer-legal a {
  font-size: 13px;
  color: rgba(255, 255, 255, .55);
  text-decoration: none;
  transition: color .2s;
}

.pub-footer-legal a:hover {
  color: var(--clay);
}

/* ── Reveal animation ──────────────────────────────────────── */
.pub-reveal {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity .5s, transform .5s;
}

.pub-reveal.visible {
  opacity: 1;
  transform: none;
}

/* ── Responsive ────────────────────────────────────────────── */
/* 1024px, no 640px: con 5 links + logo + acciones, el nav real necesita
   ~994px de ancho (medido con Playwright) — a 768px/960px ya desborda
   horizontalmente aunque "se vea" bien en un vistazo rápido. No hay menú
   hamburguesa en este componente; ocultar los links es el mismo patrón
   que ya existía para mobile, solo que activado antes de que desborde. */
@media (max-width: 1024px) {
  .pub-nav { padding: 0 20px; }
  .pub-nav-links { display: none; }
}

/* Con los links ya ocultos, logo + "Iniciar sesión" + "Comenzar gratis"
   siguen sin caber en un celular angosto (375-390px, medido: ~70-84px de
   desborde horizontal real). "Iniciar sesión" ya está duplicado en el
   Footer (FOOTER_LINKS incluye /#login), así que ocultarlo acá no le
   quita acceso al usuario. Selector scoped a .pub-nav-actions: .pub-btn-ghost
   también se usa en 404.astro ("Ver precios") y no debe verse afectado. */
@media (max-width: 480px) {
  .pub-nav-actions .pub-btn-ghost { display: none; }
}

/* ── Lightbox animations ───────────────────────────────────── */
@keyframes lb-fade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes lb-pop {
  from { transform: scale(0.96) translateY(10px); opacity: 0; }
  to   { transform: scale(1)    translateY(0);    opacity: 1; }
}

.lb-content {
  animation: lb-pop 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ── Skeleton loaders ──────────────────────────────────────── */
@keyframes sk-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .4; }
}

/* Spinner del grid (cargar más) */
@keyframes pub-spin {
  to { transform: rotate(360deg); }
}

.pub-spinner-ring {
  width: 20px;
  height: 20px;
  border: 2px solid var(--sand-2);
  border-top-color: var(--clay);
  border-radius: 50%;
  animation: pub-spin .7s linear infinite;
  margin: 0 auto;
}

/* ── prefers-reduced-motion (PRODUCT.md §Accessibility) ──────
   Reset universal en vez de listar cada animación/transición del site a
   mano (hero de entrada, pulso de badges, scroll-reveal, lightbox, etc.)
   -- consistente con lo que se compromete en PRODUCT.md ("desactivar
   animaciones decorativas, mantener transiciones funcionales"). El
   spinner de carga es la excepción explícita: es feedback de estado, no
   decoración -- congelarlo se ve como que la página se colgó, que es peor
   para el mismo usuario que esta regla protege.

   Límite conocido y aceptado: los skeleton loaders de la galería de
   comunidad usan `sk-pulse` vía `style=` inline (community.public.js /
   community.shared.js), no por clase — este reset también los congela.
   Es un costo menor (el skeleton se sigue viendo, solo sin el shimmer) y
   no se resuelve acá con un selector de atributo frágil; si se detecta
   que molesta en la práctica, se revisa con esa evidencia. */
@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;
  }
  .pub-spinner-ring {
    animation-duration: .7s !important;
    animation-iteration-count: infinite !important;
  }
}
