# ==========================================================================
# MERIDIAN — Apache/LiteSpeed config for Truehost cPanel
# ==========================================================================

Options -Indexes
# HARAMBEE cinematic landing is the public homepage; MERIDIAN index.php stays reachable at /index.php
DirectoryIndex index.html index.php

# --- Force HTTPS (Cloudflare/AutoSSL terminates TLS) -----------------------
<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteCond %{HTTPS} !=on
  RewriteCond %{HTTP:X-Forwarded-Proto} !https
  RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
</IfModule>

# --- Security headers ------------------------------------------------------
<IfModule mod_headers.c>
  Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"
  Header always set X-Content-Type-Options "nosniff"
  Header always set X-Frame-Options "DENY"
  Header always set Referrer-Policy "strict-origin-when-cross-origin"
  Header always set Permissions-Policy "geolocation=(), microphone=(), camera=(), interest-cohort=()"
  # CSP: strict — self only. No third-party origins ship to any visitor (blueprint §3).
  # Report-Only during Phase 2; flip to enforced in Phase 6.
  # font-src allows the remote "Ogg Medium" display face (dcym8fthxf5uu.cloudfront.net)
  Header always set Content-Security-Policy-Report-Only "default-src 'self'; img-src 'self' data:; style-src 'self'; script-src 'self'; font-src 'self' https://dcym8fthxf5uu.cloudfront.net; connect-src 'self'; form-action 'self'; frame-ancestors 'none'; base-uri 'self'; object-src 'none'"
  Header unset X-Powered-By
</IfModule>

# --- Block dotfiles and sensitive extensions -------------------------------
<FilesMatch "(^\.|\.(md|sql|log|ini|sample)$)">
  Require all denied
</FilesMatch>

# --- Long cache for static assets, none for PHP ----------------------------
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType text/css "access plus 1 year"
  ExpiresByType application/javascript "access plus 1 year"
  ExpiresByType font/woff2 "access plus 1 year"
  ExpiresByType image/svg+xml "access plus 30 days"
</IfModule>

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