---
import { site } from '../lib/site.js';

const {
  title,
  description = site.description,
  canonical,
  image,
  structuredData,
} = Astro.props;

const pageTitle = title || site.name;
const ogUrl = canonical || Astro.url.toString();
const year = new Date().getFullYear();
---
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>{pageTitle}</title>
  <meta name="description" content={description} />
  {canonical && <link rel="canonical" href={canonical} />}

  <link rel="icon" href="/favicon.ico" sizes="any" />
  <link rel="icon" type="image/svg+xml" href="/favicon.svg" />
  <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
  <link rel="apple-touch-icon" href="/favicon.png" />

  <meta property="og:type" content="website" />
  <meta property="og:site_name" content={site.name} />
  <meta property="og:title" content={pageTitle} />
  <meta property="og:description" content={description} />
  {image && <meta property="og:image" content={image} />}
  <meta property="og:url" content={ogUrl} />

  <meta name="twitter:card" content="summary_large_image" />
  <meta name="twitter:title" content={pageTitle} />
  <meta name="twitter:description" content={description} />
  {image && <meta name="twitter:image" content={image} />}

  {structuredData && (
    <script type="application/ld+json" set:html={structuredData} />
  )}

  <link rel="alternate" type="application/rss+xml" title={`${site.name} RSS`} href="/rss.xml" />

  <link rel="preconnect" href="https://fonts.googleapis.com" />
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
  <link href="https://fonts.googleapis.com/css2?family=Bungee+Shade&family=Rubik+Glitch&display=swap" rel="stylesheet" />

  <style is:global>
    * { margin: 0; padding: 0; box-sizing: border-box; }
    html { background: #ff00aa; }
    body {
      font-family: "Comic Sans MS", "Chalkboard SE", cursive, sans-serif;
      font-size: 17px;
      line-height: 1.55;
      color: #000;
      background:
        repeating-linear-gradient(45deg, #ff0080 0 14px, #ffd500 14px 28px, #00d4ff 28px 42px, #8a2be2 42px 56px);
      background-attachment: fixed;
      min-height: 100vh;
      padding: 14px;
    }

    .page-wrap {
      max-width: 900px;
      margin: 0 auto;
      background: #fff;
      border: 6px ridge #ffd500;
      outline: 4px solid #ff0080;
      outline-offset: -10px;
      padding: 0;
      box-shadow: 8px 8px 0 #000;
    }

    @keyframes rainbow {
      0%   { color: #ff0080; }
      25%  { color: #ffd500; }
      50%  { color: #00d4ff; }
      75%  { color: #8a2be2; }
      100% { color: #ff0080; }
    }
    @keyframes blinker { 50% { opacity: 0.2; } }
    @keyframes wiggle { 0%,100% { transform: rotate(-1.5deg); } 50% { transform: rotate(1.5deg); } }

    .hot-banner {
      background: #000;
      color: #ffd500;
      padding: 6px 0;
      overflow: hidden;
      white-space: nowrap;
      font-family: "Impact", "Arial Black", sans-serif;
      font-size: 18px;
      letter-spacing: 2px;
      border-bottom: 3px solid #ff0080;
    }
    .hot-banner span {
      display: inline-block;
      padding-left: 100%;
      animation: mqr 24s linear infinite;
    }
    @keyframes mqr { 0% { transform: translateX(0); } 100% { transform: translateX(-100%); } }

    header.vmv-head {
      text-align: center;
      padding: 22px 14px 14px;
      background:
        radial-gradient(circle at 20% 30%, rgba(255,0,128,0.25), transparent 40%),
        radial-gradient(circle at 85% 70%, rgba(0,212,255,0.25), transparent 45%),
        #fff;
      border-bottom: 4px dashed #ff0080;
    }
    .brand-row {
      display: inline-flex;
      align-items: center;
      gap: 12px;
    }
    .brand-row img {
      width: 56px; height: 56px;
      border-radius: 10px;
      border: 4px ridge #ffd500;
      box-shadow: 4px 4px 0 #000;
    }
    .brand-name {
      font-family: "Bungee Shade", "Impact", sans-serif;
      font-size: 48px;
      line-height: 1;
      animation: rainbow 3s infinite;
      text-shadow: 3px 3px 0 #000;
      letter-spacing: 1px;
    }
    .tagline {
      display: inline-block;
      margin-top: 10px;
      padding: 4px 12px;
      background: #ffd500;
      color: #000;
      border: 2px dashed #ff0080;
      font-family: "Impact", "Arial Black", sans-serif;
      transform: rotate(-2deg);
    }
    .tagline::before { content: "★ "; color: #ff0080; }
    .tagline::after  { content: " ★"; color: #ff0080; }

    nav.vmv-nav {
      margin-top: 14px;
    }
    nav.vmv-nav a {
      display: inline-block;
      margin: 4px;
      padding: 4px 12px;
      background: #00d4ff;
      color: #000;
      text-decoration: none;
      border: 3px outset #ffd500;
      font-weight: bold;
      text-transform: uppercase;
    }
    nav.vmv-nav a:hover {
      background: #ff0080;
      color: #fff;
      border-style: inset;
    }

    main { padding: 18px 22px; background: #fff; }

    .hot-strip {
      background: #ff0080;
      color: #fff;
      padding: 4px 10px;
      margin-bottom: 14px;
      font-family: "Impact", sans-serif;
      font-size: 15px;
      letter-spacing: 2px;
      text-align: center;
      animation: blinker 1.4s infinite;
      border: 2px dashed #ffd500;
    }

    .post {
      background: #fff7e0;
      border: 3px double #ff0080;
      padding: 14px 16px;
      margin-bottom: 16px;
      position: relative;
    }
    .post::before {
      content: "HOT!!";
      position: absolute;
      top: -12px; left: 10px;
      background: #ff0080;
      color: #fff;
      font-family: "Impact", sans-serif;
      padding: 2px 8px;
      border: 2px solid #000;
      transform: rotate(-6deg);
      animation: wiggle 1.2s infinite;
    }
    .post-title {
      font-family: "Impact", "Arial Black", sans-serif;
      font-size: 24px;
      line-height: 1.15;
      text-transform: uppercase;
      letter-spacing: 1px;
      margin-bottom: 6px;
    }
    .post-title a {
      color: #8a2be2;
      text-decoration: none;
      text-shadow: 2px 2px 0 #ffd500;
    }
    .post-title a:hover { color: #ff0080; text-decoration: underline wavy; }
    .post-meta {
      color: #666;
      font-size: 13px;
      margin-bottom: 8px;
      font-style: italic;
    }
    .post-meta::before { content: "📺 "; }
    .post-excerpt { color: #222; }

    .tag {
      display: inline-block;
      background: #ffd500;
      color: #000;
      padding: 1px 8px;
      margin-right: 4px;
      font-size: 13px;
      font-weight: bold;
      border: 2px solid #000;
      text-transform: uppercase;
      transform: rotate(-1deg);
    }
    .tag a { color: inherit; text-decoration: none; }

    .post-content {
      background: #fff;
      border: 4px ridge #00d4ff;
      padding: 20px 24px;
      line-height: 1.7;
    }
    .post-content h1 {
      font-family: "Impact", sans-serif;
      font-size: 32px;
      line-height: 1.1;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: #8a2be2;
      text-shadow: 3px 3px 0 #ffd500, 6px 6px 0 #ff0080;
      margin-bottom: 10px;
    }
    .post-content h2 {
      font-family: "Impact", sans-serif;
      font-size: 22px;
      color: #ff0080;
      margin-top: 24px;
      border-bottom: 3px dotted #ffd500;
    }
    .post-content h3 {
      font-size: 18px;
      color: #00a0cc;
      margin-top: 16px;
    }
    .post-content p { margin-bottom: 12px; }
    .post-content a {
      color: #ff0080;
      font-weight: bold;
      text-decoration: underline;
    }
    .post-content a:visited { color: #8a2be2; }
    .post-content img {
      max-width: 100%;
      height: auto;
      border: 4px groove #ffd500;
      box-shadow: 4px 4px 0 #000;
      margin: 12px 0;
    }
    .post-content blockquote {
      background: #ffd500;
      border-left: 8px solid #ff0080;
      padding: 8px 14px;
      margin: 12px 0;
      font-style: italic;
      transform: rotate(-0.4deg);
    }
    .post-content code {
      background: #000;
      color: #00ff00;
      padding: 1px 6px;
      font-family: "Courier New", monospace;
    }
    .post-content pre {
      background: #000;
      color: #00ff00;
      padding: 12px;
      border: 3px ridge #ffd500;
      overflow-x: auto;
    }

    .video-container { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; margin: 14px 0; border: 4px ridge #ffd500; }
    .video-container iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }

    .back-link {
      display: inline-block;
      margin-bottom: 12px;
      padding: 3px 10px;
      background: #00d4ff;
      color: #000;
      text-decoration: none;
      border: 3px outset #ffd500;
      font-weight: bold;
    }
    .back-link::before { content: "<< "; }

    .pagination {
      margin-top: 20px;
      padding-top: 14px;
      border-top: 4px dashed #ff0080;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 8px;
    }
    .pagination-link {
      display: inline-block;
      padding: 6px 14px;
      background: #ffd500;
      color: #000;
      text-decoration: none;
      border: 3px outset #ff0080;
      font-family: "Impact", sans-serif;
      text-transform: uppercase;
    }
    .pagination-link:hover { background: #ff0080; color: #fff; border-style: inset; }
    .pagination-info { color: #555; font-size: 13px; }

    .related-posts {
      margin-top: 28px;
      padding-top: 14px;
      border-top: 4px double #8a2be2;
    }
    .related-posts h3 {
      font-family: "Impact", sans-serif;
      font-size: 22px;
      text-transform: uppercase;
      color: #ff0080;
      text-shadow: 2px 2px 0 #ffd500;
      margin-bottom: 12px;
      text-align: center;
    }
    .related-posts h3::before { content: "🌟 "; }
    .related-posts h3::after { content: " 🌟"; }
    .related-posts-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
      gap: 10px;
    }
    .related-post-card {
      background: #fff7e0;
      border: 3px double #00d4ff;
      padding: 10px 12px;
    }
    .related-post-link { text-decoration: none; color: inherit; }
    .related-post-link h4 {
      font-family: "Impact", sans-serif;
      font-size: 16px;
      text-transform: uppercase;
      color: #8a2be2;
      margin-bottom: 6px;
    }
    .related-post-excerpt { font-size: 13px; color: #333; }
    .related-post-date { font-size: 11px; color: #888; font-style: italic; }

    footer {
      margin-top: 0;
      padding: 14px 18px;
      background: #000;
      color: #ffd500;
      font-family: "Impact", sans-serif;
      text-align: center;
      font-size: 14px;
      letter-spacing: 2px;
      border-top: 4px ridge #ff0080;
    }
    footer::before { content: "★ ✦ ★ "; color: #ff0080; }
    footer::after  { content: " ★ ✦ ★"; color: #ff0080; }

    @media (max-width: 600px) {
      .brand-name { font-size: 34px; }
      .post-title { font-size: 20px; }
      .post-content h1 { font-size: 24px; }
      .related-posts-grid { grid-template-columns: 1fr; }
    }
  </style>
</head>
<body>
  <div class="page-wrap">
    <div class="hot-banner">
      <span>🔥 VIRAL NOW!! 🔥 ISHOWSPEED BROKE THE INTERNET 🔥 MRBEAST CHALLENGES 🔥 CHARLI D'AMELIO 🔥 WHO'S FAMOUS TODAY?! 🔥 FRESH VIRAL TEA STRAIGHT TO YOUR SCREEN 🔥 &nbsp;</span>
    </div>

    <header class="vmv-head">
      <a href="/" style="text-decoration: none;">
        <div class="brand-row">
          <img src="/favicon.png" alt="" width="56" height="56" />
          <span class="brand-name">{site.name}</span>
        </div>
      </a>
      <div class="tagline">{site.description}</div>
      <nav class="vmv-nav">
        <a href="/">Home</a>
        <a href="/about/">About</a>
        <a href="/rss.xml">RSS</a>
      </nav>
    </header>

    <main>
      <div class="hot-strip">★★★ TODAY'S VIRAL VICTIMS ★★★</div>
      <slot />
    </main>

    <footer>
      &copy; {year} {site.name} &nbsp;—&nbsp; BEST VIEWED IN NETSCAPE NAVIGATOR 4.0
    </footer>
  </div>
</body>
</html>
