# ---------------------------------------------------------
# Origina Pedregal — static hosting config (Apache / Hostinger)
# ---------------------------------------------------------

# --- MIME types ---
<IfModule mod_mime.c>
  AddType image/webp .webp
  AddType text/css .css
  AddType application/javascript .js
</IfModule>

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

# --- Cache policy ---
# HTML: never cached, so a deploy is visible immediately.
# CSS/JS: short cache; the ?v=YYYYMMDD query bumps on each deploy.
# Images/fonts: long cache, they are content-addressed by filename.
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType text/html "access plus 0 seconds"
  ExpiresByType text/css "access plus 1 hours"
  ExpiresByType application/javascript "access plus 1 hours"
  ExpiresByType image/webp "access plus 1 year"
  ExpiresByType image/jpeg "access plus 1 year"
  ExpiresByType image/png "access plus 1 year"
  ExpiresByType image/svg+xml "access plus 1 year"
  ExpiresByType font/woff2 "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)$">
    Header set Cache-Control "public, max-age=3600, must-revalidate"
  </FilesMatch>
  <FilesMatch "\.(webp|jpg|jpeg|png|svg|woff2)$">
    Header set Cache-Control "public, max-age=31536000, immutable"
  </FilesMatch>
  Header set X-Content-Type-Options "nosniff"
  Header always set Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>

# --- Pretty errors ---
ErrorDocument 404 /index.html
