<?php
// ============================================================
//  member/calendar.php — Calendar with SA public holidays
// ============================================================
//
//  Month-view calendar showing:
//    - South African public holidays
//    - Weekends (tinted)
//
//  No task layer on member side (for now).
// ============================================================

$page_title = 'Calendar';
require __DIR__ . '/_guard.php';
require_once __DIR__ . '/../includes/calendar.php';

$year  = (int)($_GET['y'] ?? date('Y'));
$month = (int)($_GET['m'] ?? date('n'));
if ($year < 2000 || $year > 2100) $year = (int)date('Y');
if ($month < 1 || $month > 12)    $month = (int)date('n');
?>

<style>
<?= calendar_css() ?>
</style>

<section class="section"><div class="container">

<div style="display:flex;justify-content:space-between;align-items:center;margin-bottom:1rem;flex-wrap:wrap;gap:1rem;">
    <h1 style="margin:0;">Calendar</h1>
    <p style="margin:0;color:var(--ink-muted);font-size:.85rem;">
        South African public holidays
    </p>
</div>

<?= calendar_render($year, $month, [], ['base_url' => 'calendar.php']) ?>

<div style="margin-top:1rem;padding:.75rem 1rem;background:var(--surface-alt);border-radius:6px;font-size:.78rem;color:var(--ink-muted);display:flex;gap:1rem;flex-wrap:wrap;align-items:center;">
    <span style="display:inline-flex;align-items:center;gap:.4rem;">
        <span style="display:inline-block;width:14px;height:14px;border-radius:3px;background:#fed7aa;"></span>
        SA public holiday
    </span>
    <span style="display:inline-flex;align-items:center;gap:.4rem;">
        <span style="display:inline-block;width:14px;height:14px;border-radius:3px;background:#f9f7f1;border:1px solid #e5e7eb;"></span>
        Weekend
    </span>
</div>

</div></section>

<?php require __DIR__ . '/_footer.php'; ?>