<?php
require_once __DIR__ . '/includes/config.php';
$pageTitle   = 'Links — dispelled.ca';
$currentPage = 'links';

$sections = [
  'Tech News' => [
    ['Slashdot',     'https://slashdot.org',             'News for nerds, stuff that matters.'],
    ['Ars Technica', 'https://arstechnica.com',          'In-depth tech journalism.'],
    ['Hacker News',  'https://news.ycombinator.com',     'Y Combinator\'s community link aggregator.'],
    ['The Register', 'https://www.theregister.com',      'Biting the hand that feeds IT.'],
    ['Phoronix',     'https://www.phoronix.com',         'Linux hardware, drivers, and benchmarks.'],
  ],
  'Security' => [
    ['Krebs on Security', 'https://krebsonsecurity.com', 'Cybersecurity news from Brian Krebs.'],
    ['EFF',               'https://www.eff.org',         'Defending digital rights and privacy.'],
    ['CISA',              'https://www.cisa.gov',        'US cybersecurity advisories.'],
    ['Shodan',            'https://www.shodan.io',       'Search engine for internet-connected devices.'],
  ],
  'Linux & Open Source' => [
    ['kernel.org', 'https://www.kernel.org',        'Linux kernel source and releases.'],
    ['Debian',     'https://www.debian.org',         'The universal operating system.'],
    ['FreeBSD',    'https://www.freebsd.org',        'A powerful and reliable BSD-based OS.'],
    ['OpenBSD',    'https://www.openbsd.org',        'Security-focused free and open-source operating system.'],
    ['Arch Wiki',  'https://wiki.archlinux.org',     'The best Linux documentation on the web.'],
    ['FSF',        'https://www.fsf.org',            'Free Software Foundation.'],
  ],
  'Communities' => [
    ['r/linux',       'https://www.reddit.com/r/linux/',       'Linux discussion.'],
    ['r/netsec',      'https://www.reddit.com/r/netsec/',      'Network security.'],
    ['r/programming', 'https://www.reddit.com/r/programming/', 'Programming news and discussion.'],
    ['r/sysadmin',    'https://www.reddit.com/r/sysadmin/',    'The home of sysadmins.'],
    ['r/opensource',  'https://www.reddit.com/r/opensource/',  'Open source software.'],
  ],
  'Friends' => [
    ['Animeday.ca', 'https://animeday.ca', 'Anime community.'],
    ['Sellco.ca',   'https://sellco.ca',   ''],
  ],
];

require_once __DIR__ . '/includes/header.php';
?>

<h1 class="page-title">Links</h1>

<?php foreach ($sections as $category => $links): ?>
<div class="links-section">
  <h2 class="section-subtitle"><?= htmlspecialchars($category) ?></h2>
  <div class="links-grid">
    <?php foreach ($links as [$label, $url, $desc]): ?>
    <a href="<?= htmlspecialchars($url) ?>" target="_blank" rel="noreferrer" class="link-card">
      <p class="link-label"><?= htmlspecialchars($label) ?> <span class="link-ext">↗</span></p>
      <?php if ($desc): ?>
        <p class="link-desc"><?= htmlspecialchars($desc) ?></p>
      <?php endif ?>
    </a>
    <?php endforeach ?>
  </div>
</div>
<?php endforeach ?>

<?php require_once __DIR__ . '/includes/footer.php'; ?>
