<?php
/**
 * Front controller forwarder.
 *
 * The document root for this domain is the project root rather than /public,
 * so requests are handed to Laravel's real front controller inside /public.
 * Restored 2026-09-22 after the original was destroyed in the intrusion.
 */

$uri = urldecode(parse_url($_SERVER['REQUEST_URI'] ?? '/', PHP_URL_PATH) ?? '/');

// Serve a real file out of /public directly (css, js, images) when one exists.
$asset = __DIR__ . '/public' . $uri;
if ($uri !== '/' && is_file($asset)) {
    $types = [
        'css' => 'text/css', 'js' => 'application/javascript', 'svg' => 'image/svg+xml',
        'png' => 'image/png', 'jpg' => 'image/jpeg', 'jpeg' => 'image/jpeg',
        'gif' => 'image/gif', 'webp' => 'image/webp', 'ico' => 'image/x-icon',
        'woff' => 'font/woff', 'woff2' => 'font/woff2', 'ttf' => 'font/ttf',
        'pdf' => 'application/pdf', 'map' => 'application/json',
    ];
    $ext = strtolower(pathinfo($asset, PATHINFO_EXTENSION));
    if (isset($types[$ext])) {
        header('Content-Type: ' . $types[$ext]);
        header('Content-Length: ' . filesize($asset));
        readfile($asset);
        exit;
    }
}

require __DIR__ . '/public/index.php';
