Files
hype404-static/src/layouts/Layout.astro

691 lines
19 KiB
Plaintext
Raw Normal View History

---
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/png" sizes="32x32" href="/favicon-32x32.png" />
<link rel="apple-touch-icon" href="/favicon-32x32.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=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600;9..144,700;9..144,800;9..144,900&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet" />
<style is:global>
:root {
--bg: #0d0c0a;
--bg-elev: #16140f;
--bg-card: #1a1714;
--bg-soft: #221e1a;
--ink: #ebe2cd;
--ink-soft: #b6ad97;
--ink-muted: #7a7363;
--line: #2c2722;
--line-strong: #3a342d;
--accent: #b8e25a;
--accent-soft: rgba(184, 226, 90, 0.14);
--magenta: #f43f8c;
--magenta-soft: rgba(244, 63, 140, 0.18);
--link: #7cd1ff;
--link-hover: #a9e0ff;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html {
background: var(--bg);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-rendering: optimizeLegibility;
}
body {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
font-size: 17px;
line-height: 1.65;
color: var(--ink);
background:
radial-gradient(circle at 12% -8%, rgba(184, 226, 90, 0.06) 0%, transparent 40%),
radial-gradient(circle at 92% 6%, rgba(244, 63, 140, 0.06) 0%, transparent 42%),
var(--bg);
min-height: 100vh;
}
.container {
max-width: 1180px;
margin: 0 auto;
padding: 0 28px;
}
/* ========== Site header ========== */
header.hero {
padding: 36px 0 28px;
border-bottom: 1px solid var(--line);
margin-bottom: 48px;
}
.hero-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 24px;
flex-wrap: wrap;
}
.brand-link { text-decoration: none; color: inherit; display: inline-block; }
.ascii-brand {
font-family: 'Fraunces', 'Times New Roman', serif;
font-weight: 800;
font-size: 40px;
letter-spacing: -0.02em;
color: var(--ink);
line-height: 1;
font-variation-settings: 'opsz' 144;
}
.ascii-brand .cursor {
color: var(--accent);
font-weight: 800;
}
.tagline {
color: var(--ink-soft);
font-family: 'Fraunces', serif;
font-style: italic;
font-size: 16px;
margin-top: 6px;
max-width: 560px;
font-variation-settings: 'opsz' 14;
}
nav.nav {
display: flex;
gap: 26px;
font-size: 13px;
font-weight: 500;
text-transform: uppercase;
letter-spacing: 0.08em;
}
nav.nav a {
color: var(--ink-soft);
text-decoration: none;
transition: color 0.15s;
}
nav.nav a:hover { color: var(--accent); }
main { padding: 0 0 64px; }
/* ========== Reveal animation for cards ========== */
[data-reveal] {
opacity: 0;
transform: translateY(12px);
transition: opacity 0.6s ease, transform 0.6s ease;
}
[data-reveal].is-visible {
opacity: 1;
transform: translateY(0);
}
/* ========== Tag banner (tag listing pages) ========== */
.tag-banner {
font-family: 'Fraunces', serif;
font-weight: 600;
font-size: 24px;
color: var(--ink);
margin-bottom: 28px;
padding-bottom: 16px;
border-bottom: 1px solid var(--line);
font-variation-settings: 'opsz' 36;
}
.tag-banner em {
font-style: italic;
color: var(--accent);
}
/* ========== Hero card (top story on home) ========== */
.post-hero {
margin-bottom: 44px;
border-radius: 14px;
overflow: hidden;
background: var(--bg-card);
border: 1px solid var(--line);
transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.post-hero:hover {
transform: translateY(-2px);
border-color: var(--line-strong);
box-shadow: 0 18px 48px -22px rgba(244, 63, 140, 0.22);
}
.post-hero-link {
display: grid;
grid-template-columns: 1.1fr 1fr;
text-decoration: none;
color: inherit;
}
.post-hero-img {
overflow: hidden;
background: var(--bg-soft);
min-height: 280px;
}
.post-hero-img img {
width: 100%;
height: 100%;
object-fit: cover;
display: block;
transition: transform 0.6s ease;
}
.post-hero:hover .post-hero-img img { transform: scale(1.04); }
.post-hero-body {
padding: 36px 36px;
display: flex;
flex-direction: column;
justify-content: center;
}
.post-hero-flag {
color: var(--magenta);
font-size: 11px;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.16em;
margin-bottom: 12px;
}
.post-hero-title {
font-family: 'Fraunces', serif;
font-weight: 700;
font-size: clamp(26px, 3.5vw, 36px);
line-height: 1.12;
letter-spacing: -0.02em;
color: var(--ink);
margin-bottom: 14px;
font-variation-settings: 'opsz' 144;
}
.post-hero:hover .post-hero-title { color: var(--accent); }
.post-hero-excerpt {
color: var(--ink-soft);
font-size: 16px;
line-height: 1.6;
margin-bottom: 18px;
}
.post-hero-meta {
display: flex;
flex-wrap: wrap;
gap: 10px;
align-items: center;
color: var(--ink-muted);
font-size: 13px;
letter-spacing: 0.02em;
}
.post-hero-tag {
display: inline-block;
padding: 2px 10px;
border: 1px solid var(--line-strong);
border-radius: 999px;
color: var(--ink-soft);
font-size: 12px;
}
.post-hero-tag a { color: inherit; text-decoration: none; }
/* ========== Row cards (rest of feed) ========== */
.post-row {
background: var(--bg-card);
border: 1px solid var(--line);
border-radius: 12px;
margin-bottom: 16px;
overflow: hidden;
transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.post-row:hover {
transform: translateY(-2px);
border-color: var(--line-strong);
box-shadow: 0 14px 36px -18px rgba(184, 226, 90, 0.18);
}
.post-row-link {
display: grid;
grid-template-columns: 220px 1fr;
text-decoration: none;
color: inherit;
}
.post-row-img {
overflow: hidden;
background: var(--bg-soft);
min-height: 100%;
}
.post-row-img img {
width: 100%;
height: 100%;
min-height: 160px;
object-fit: cover;
display: block;
transition: transform 0.5s ease;
}
.post-row:hover .post-row-img img { transform: scale(1.04); }
.post-row-body {
padding: 22px 26px;
display: flex;
flex-direction: column;
justify-content: center;
}
/* When no cover, body spans the full row */
.post-row-link:has(.post-row-body:only-child) {
grid-template-columns: 1fr;
}
.post-row-title {
font-family: 'Fraunces', serif;
font-weight: 600;
font-size: 22px;
line-height: 1.22;
letter-spacing: -0.015em;
color: var(--ink);
margin-bottom: 8px;
font-variation-settings: 'opsz' 80;
transition: color 0.15s;
}
.post-row:hover .post-row-title { color: var(--accent); }
.post-row-excerpt {
color: var(--ink-soft);
font-size: 15px;
line-height: 1.55;
margin-bottom: 12px;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
.post-row-meta {
display: flex;
flex-wrap: wrap;
gap: 8px;
align-items: center;
color: var(--ink-muted);
font-size: 12px;
letter-spacing: 0.02em;
}
.post-row-tag {
display: inline-block;
padding: 1px 9px;
background: var(--bg-soft);
border: 1px solid var(--line);
border-radius: 999px;
color: var(--ink-soft);
font-size: 11px;
font-weight: 500;
}
.post-row-tag a { color: inherit; text-decoration: none; }
.post-empty {
color: var(--ink-muted);
text-align: center;
padding: 80px 0;
font-size: 15px;
}
/* ========== Legacy .post / .tag (used by some pages) ========== */
.post {
background: var(--bg-card);
border: 1px solid var(--line);
border-radius: 12px;
padding: 26px 30px;
margin-bottom: 16px;
}
.post-title {
font-family: 'Fraunces', serif;
font-weight: 600;
font-size: 24px;
line-height: 1.22;
letter-spacing: -0.015em;
margin-bottom: 8px;
font-variation-settings: 'opsz' 80;
}
.post-title a { color: var(--ink); text-decoration: none; }
.post-title a:hover { color: var(--accent); }
.post-meta {
color: var(--ink-muted);
font-size: 13px;
margin-bottom: 12px;
display: flex;
flex-wrap: wrap;
gap: 8px;
align-items: center;
}
.post-excerpt {
color: var(--ink-soft);
font-size: 15px;
line-height: 1.6;
}
.tag {
display: inline-block;
background: var(--bg-soft);
color: var(--ink-soft);
padding: 2px 10px;
border-radius: 999px;
border: 1px solid var(--line);
font-size: 12px;
font-weight: 500;
}
.tag a { color: inherit; text-decoration: none; }
.tag:hover { background: var(--accent-soft); color: var(--accent); }
/* ========== Article (post detail) ========== */
.post-content {
max-width: 720px;
margin: 0 auto;
padding: 0;
background: transparent;
border: none;
font-size: 18px;
line-height: 1.78;
color: var(--ink);
}
.post-content h1 {
font-family: 'Fraunces', serif;
font-weight: 700;
font-size: clamp(32px, 5vw, 48px);
line-height: 1.1;
letter-spacing: -0.02em;
color: var(--ink);
margin-bottom: 18px;
font-variation-settings: 'opsz' 144;
}
.post-content h2 {
font-family: 'Fraunces', serif;
font-weight: 600;
font-size: 28px;
line-height: 1.25;
letter-spacing: -0.015em;
color: var(--ink);
margin: 44px 0 14px;
font-variation-settings: 'opsz' 80;
}
.post-content h3 {
font-family: 'Fraunces', serif;
font-weight: 600;
font-size: 22px;
line-height: 1.3;
color: var(--ink);
margin: 32px 0 10px;
font-variation-settings: 'opsz' 36;
}
.post-content p {
margin-bottom: 22px;
color: var(--ink);
}
.post-content > p:first-of-type::first-letter {
font-family: 'Fraunces', serif;
font-weight: 800;
font-size: 64px;
float: left;
line-height: 0.92;
padding: 6px 12px 0 0;
color: var(--magenta);
font-variation-settings: 'opsz' 144;
}
.post-content a {
color: var(--link);
text-decoration: underline;
text-decoration-thickness: 1px;
text-underline-offset: 3px;
transition: color 0.15s;
}
.post-content a:hover { color: var(--link-hover); }
.post-content img {
max-width: 100%;
height: auto;
border-radius: 10px;
margin: 28px 0;
box-shadow: 0 18px 48px -20px rgba(0, 0, 0, 0.6);
}
.post-content blockquote {
border-left: 3px solid var(--magenta);
margin: 28px 0;
padding: 4px 0 4px 24px;
font-family: 'Fraunces', serif;
font-style: italic;
font-size: 21px;
line-height: 1.55;
color: var(--ink-soft);
font-variation-settings: 'opsz' 36;
}
.post-content code {
background: var(--bg-soft);
color: var(--accent);
padding: 1px 7px;
border-radius: 4px;
font-family: 'JetBrains Mono', 'SF Mono', monospace;
font-size: 0.88em;
}
.post-content pre {
background: #050505;
color: #d4ce99;
padding: 18px 20px;
border: 1px solid var(--line);
border-radius: 10px;
overflow-x: auto;
margin: 24px 0;
font-family: 'JetBrains Mono', 'SF Mono', monospace;
font-size: 14px;
line-height: 1.65;
}
.post-content pre code {
background: transparent;
color: inherit;
padding: 0;
}
.post-content ul, .post-content ol {
margin: 18px 0 22px 28px;
}
.post-content li { margin-bottom: 8px; }
.post-content hr {
border: none;
border-top: 1px solid var(--line);
margin: 40px 0;
}
.back-link {
display: inline-block;
color: var(--ink-muted);
text-decoration: none;
margin-bottom: 24px;
font-size: 13px;
font-weight: 500;
letter-spacing: 0.06em;
text-transform: uppercase;
transition: color 0.15s;
}
.back-link:hover { color: var(--accent); }
/* ========== Pagination ========== */
.pagination {
max-width: 1180px;
margin: 48px auto 0;
padding-top: 24px;
border-top: 1px solid var(--line);
display: flex;
justify-content: space-between;
align-items: center;
gap: 16px;
}
.pagination-link {
display: inline-block;
padding: 8px 18px;
background: var(--bg-card);
border: 1px solid var(--line);
border-radius: 999px;
color: var(--ink);
text-decoration: none;
font-size: 14px;
font-weight: 500;
transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.pagination-link:hover {
background: var(--accent);
border-color: var(--accent);
color: #0d0c0a;
}
.pagination-info {
color: var(--ink-muted);
font-size: 13px;
}
/* ========== Related posts ========== */
.related-posts {
max-width: 1180px;
margin: 64px auto 0;
padding-top: 36px;
border-top: 1px solid var(--line);
}
.related-posts h3 {
font-family: 'Fraunces', serif;
font-weight: 600;
font-size: 22px;
letter-spacing: -0.01em;
color: var(--ink);
margin-bottom: 22px;
font-variation-settings: 'opsz' 36;
}
.related-posts-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
gap: 16px;
}
.related-post-card {
background: var(--bg-card);
border: 1px solid var(--line);
border-radius: 10px;
padding: 20px;
transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}
.related-post-card:hover {
transform: translateY(-2px);
box-shadow: 0 12px 32px -18px rgba(184, 226, 90, 0.16);
border-color: var(--line-strong);
}
.related-post-link { text-decoration: none; color: inherit; display: block; }
.related-post-link h4 {
font-family: 'Fraunces', serif;
font-weight: 600;
font-size: 18px;
line-height: 1.25;
color: var(--ink);
margin-bottom: 8px;
font-variation-settings: 'opsz' 36;
}
.related-post-excerpt {
color: var(--ink-soft);
font-size: 14px;
line-height: 1.55;
margin-bottom: 10px;
}
.related-post-date {
color: var(--ink-muted);
font-size: 12px;
letter-spacing: 0.02em;
}
/* ========== Footer ========== */
footer {
max-width: 1180px;
margin: 80px auto 0;
padding: 28px 28px 36px;
border-top: 1px solid var(--line);
color: var(--ink-muted);
font-size: 13px;
display: flex;
justify-content: space-between;
align-items: center;
gap: 16px;
flex-wrap: wrap;
}
footer .footer-brand {
font-family: 'Fraunces', serif;
font-weight: 700;
color: var(--ink-soft);
letter-spacing: -0.01em;
}
footer .footer-brand .accent { color: var(--accent); }
/* ========== Mobile ========== */
@media (max-width: 820px) {
.post-hero-link {
grid-template-columns: 1fr;
}
.post-hero-img { min-height: 220px; max-height: 260px; }
.post-hero-body { padding: 24px 22px; }
}
@media (max-width: 700px) {
.container { padding: 0 18px; }
header.hero { padding: 24px 0 20px; margin-bottom: 32px; }
.ascii-brand { font-size: 30px; }
.tagline { font-size: 14px; }
.post-row-link { grid-template-columns: 110px 1fr; }
.post-row-img img { min-height: 110px; }
.post-row-body { padding: 16px 18px; }
.post-row-title { font-size: 17px; }
.post-row-excerpt { font-size: 13px; -webkit-line-clamp: 2; }
.post-content { font-size: 17px; }
.post-content > p:first-of-type::first-letter { font-size: 52px; }
.related-posts-grid { grid-template-columns: 1fr; }
}
</style>
</head>
<body>
<div class="container">
<header class="hero">
<div class="hero-row">
<div>
<a href="/" class="brand-link">
<span class="ascii-brand">hype<span class="cursor">404</span></span>
</a>
<div class="tagline">{site.description}</div>
</div>
<nav class="nav">
<a href="/">Home</a>
<a href="/about/">About</a>
<a href="/rss.xml">RSS</a>
</nav>
</div>
</header>
<main>
<slot />
</main>
<footer>
<div class="footer-brand">hype<span class="accent">404</span></div>
<div>(c) {year} {site.name}</div>
</footer>
</div>
</body>
</html>