# =========================================================
# Origina Santa Fe — configuración de servidor (Apache / Hostinger)
# =========================================================

# ---------- Compresión ----------
<IfModule mod_deflate.c>
  AddOutputFilterByType DEFLATE text/html text/plain text/css text/javascript
  AddOutputFilterByType DEFLATE application/javascript application/x-javascript
  AddOutputFilterByType DEFLATE application/json image/svg+xml
</IfModule>

# ---------- Tipos MIME ----------
<IfModule mod_mime.c>
  AddType image/webp .webp
  AddType image/svg+xml .svg
  AddType text/css .css
  AddType application/javascript .js
</IfModule>

# ---------- Caché ----------
# El HTML NUNCA se cachea: así los ?v= nuevos se aplican al instante.
# Los assets se cachean fuerte porque cambian de nombre o de versión.
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType text/html "access plus 0 seconds"
  ExpiresByType text/css "access plus 1 year"
  ExpiresByType application/javascript "access plus 1 year"
  ExpiresByType image/webp "access plus 1 year"
  ExpiresByType image/svg+xml "access plus 1 year"
  ExpiresByType image/jpeg "access plus 1 year"
  ExpiresByType image/png "access plus 1 year"
</IfModule>

<IfModule mod_headers.c>
  <FilesMatch "\.(html|htm)$">
    Header set Cache-Control "no-cache, no-store, must-revalidate"
    Header set Pragma "no-cache"
  </FilesMatch>
  <FilesMatch "\.(css|js|webp|svg|jpg|jpeg|png|woff2)$">
    Header set Cache-Control "public, max-age=31536000, immutable"
  </FilesMatch>
  Header set X-Content-Type-Options "nosniff"
  Header set Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>

# ---------- URLs limpias ----------
<IfModule mod_rewrite.c>
  RewriteEngine On
  # Forzar HTTPS
  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP:X-Forwarded-Proto} !https
  RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
</IfModule>

ErrorDocument 404 /index.html
