/* =============================================================================
   AMP-STYLE BLOG THEME
   A sophisticated, tech-noir aesthetic with semantic HTML
   ============================================================================= */

/* Google Fonts Import */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&family=JetBrains+Mono:wght@400;500&family=Playfair+Display:ital,wght@0,400;0,700;1,400;1,700&display=swap');

/* Sagittaire Display - Local Fonts */
@font-face {
  font-family: 'Sagittaire Display';
  src: url('/fonts/SagittaireDisplay-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Sagittaire Display';
  src: url('/fonts/SagittaireDisplay-ExtralightItalic.woff2') format('woff2');
  font-weight: 200;
  font-style: italic;
  font-display: swap;
}

/* Berkeley Mono TX-02 - Variable Font */
@font-face {
  font-family: 'Berkeley Mono';
  src: url('/fonts/TX-02-Variable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* PolySans - Variable Font */
@font-face {
  font-family: 'PolySans';
  src: url('/fonts/PolySans-variable.woff2') format('woff2-variations');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'PolySans';
  src: url('/fonts/PolySans-SlimItalic.woff2') format('woff2');
  font-weight: 300;
  font-style: italic;
  font-display: swap;
}

/* Perfectly Nineties - Display Font */
@font-face {
  font-family: 'Perfectly Nineties';
  src: url('/fonts/PerfectlyNineties-Regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Perfectly Nineties';
  src: url('/fonts/PerfectlyNineties-Light.woff') format('woff');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

/* =============================================================================
   CSS Custom Properties
   ============================================================================= */
:root {
  /* Colors - Dark Theme (Muted Warm Slate & Amber) */
  --color-bg: #0e0d0c;
  --color-bg-alt: #080706;
  --color-bg-elevated: rgba(20, 18, 16, 0.6);
  --color-text: #c8bda8;
  --color-text-muted: #8a847c;
  --color-text-subtle: #524e48;
  --color-text-bright: #e0d4c0;
  --color-accent: #d97706;
  --color-accent-muted: rgba(217, 119, 6, 0.35);
  --color-accent-subtle: rgba(217, 119, 6, 0.15);
  --color-border: rgba(200, 189, 168, 0.1);
  --color-border-subtle: rgba(200, 189, 168, 0.05);
  --color-code-bg: #080706;
  --color-code-text: #c8bda8;

  /* Typography */
  --font-sans: 'PolySans', 'Inter', system-ui, -apple-system, sans-serif;
  --font-serif: 'Sagittaire Display', Georgia, serif;
  --font-display: 'Sagittaire Display', Georgia, serif;
  --font-mono: 'Berkeley Mono', 'JetBrains Mono', 'SF Mono', Monaco, monospace;

  /* Font Sizes */
  --text-xs: 0.6875rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 2rem;
  --text-4xl: 2.5rem;
  --text-5xl: 3.5rem;
  --text-6xl: 4.5rem;

  /* Spacing */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;
  --space-16: 4rem;
  --space-20: 5rem;
  --space-24: 6rem;

  /* Layout */
  --max-width: 52rem;
  --max-width-wide: 80rem;

  /* Transitions */
  --transition-fast: 0.2s ease;
  --transition-base: 0.3s ease;
  --transition-slow: 0.5s ease;
  --transition-slower: 0.7s ease;
}

/* =============================================================================
   Reset & Base
   ============================================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: 400;
  line-height: 1.4;
  color: var(--color-text);
  background-color: var(--color-bg);
  background-image: radial-gradient(circle, rgba(200, 189, 168, 0.05) 1px, transparent 1px);
  background-size: 24px 24px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  cursor: crosshair;
  overflow-x: hidden;
}

/* =============================================================================
   Vignette & Grain Overlays (Pure CSS)
   ============================================================================= */

/* Vignette effect */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, transparent 30%, rgba(0, 0, 0, 0.35) 100%);
  pointer-events: none;
  z-index: 9998;
}

/* TV static noise using gradient subpixel rendering trick */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.03;
  background:
    repeating-radial-gradient(#000 0 0.0001%, #fff 0 0.0002%) 50% 0 / 2500px 2500px,
    repeating-conic-gradient(#000 0 0.0001%, #fff 0 0.0002%) 60% 60% / 2500px 2500px;
  background-blend-mode: difference;
  animation: noise 0.2s infinite alternate;
}

@keyframes noise {
  100% {
    background-position:
      50% 0,
      60% 50%;
  }
}

/* =============================================================================
   Selection & Scrollbar
   ============================================================================= */
::selection {
  background: var(--color-accent-muted);
  color: #fff;
}

::-webkit-scrollbar {
  width: 3px;
}

::-webkit-scrollbar-track {
  background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-accent);
}

/* =============================================================================
   Skip Link (Accessibility)
   ============================================================================= */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  padding: var(--space-2) var(--space-4);
  background: var(--color-accent);
  color: white;
  z-index: 10000;
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.skip-link:focus {
  top: 0;
}

/* =============================================================================
   Layout Containers
   ============================================================================= */
header[role='banner'],
main,
footer[role='contentinfo'] {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--space-4);
  width: 100%;
  position: relative;
  z-index: 10;
}

header[role='banner'] {
  padding-top: var(--space-8);
  padding-bottom: var(--space-8);
  border-bottom: 1px solid var(--color-border);
}

main {
  flex: 1;
  padding-top: var(--space-16);
  padding-bottom: var(--space-24);
}

footer[role='contentinfo'] {
  padding-top: var(--space-12);
  padding-bottom: var(--space-12);
  border-top: 1px solid var(--color-border-subtle);
  background: var(--color-bg-alt);
}

footer[role='contentinfo'] p {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--color-text-subtle);
  text-align: center;
}

/* =============================================================================
   Navigation
   ============================================================================= */
nav[aria-label='Main navigation'] ul {
  display: flex;
  gap: var(--space-8);
  list-style: none;
  justify-content: center;
}

nav[aria-label='Main navigation'] a {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.4em;
  color: var(--color-text-muted);
  text-decoration: none;
  padding: var(--space-2) var(--space-4);
  position: relative;
  transition: color var(--transition-base);
}

nav[aria-label='Main navigation'] a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 0;
  height: 1px;
  background: var(--color-accent);
  transition: width var(--transition-slow);
}

nav[aria-label='Main navigation'] a:hover,
nav[aria-label='Main navigation'] a:focus {
  color: var(--color-text-bright);
}

nav[aria-label='Main navigation'] a:hover::after,
nav[aria-label='Main navigation'] a:focus::after {
  width: 100%;
}

nav[aria-label='Main navigation'] a[aria-current='page'] {
  color: var(--color-text-bright);
}

nav[aria-label='Main navigation'] a[aria-current='page']::after {
  width: 100%;
  background: var(--color-accent-muted);
}

/* =============================================================================
   Typography - Headings
   ============================================================================= */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: var(--font-serif);
  font-weight: 700;
  line-height: 1.1;
  color: var(--color-text-bright);
  margin-top: var(--space-16);
  margin-bottom: var(--space-6);
}

h1 {
  font-family: var(--font-display);
  font-size: clamp(var(--text-4xl), 8vw, var(--text-6xl));
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-top: 0;
}

/* Amp-style mixed italic/regular h1 - first line automatically italic */
h1::first-line {
  font-weight: 200;
  font-style: italic;
}

/* Manual override - wrap text in <em> for italic */
h1 em,
h1 i {
  font-family: var(--font-display);
  font-weight: 200;
  font-style: italic;
  display: block;
}

h2 {
  font-size: var(--text-3xl);
  margin-top: var(--space-20);
  position: relative;
}

/* Section counter for h2 elements in content */
article .content {
  counter-reset: section;
}

article .content h2::before {
  counter-increment: section;
  content: 'SEC_0' counter(section);
  position: absolute;
  left: -3rem;
  top: 0.5rem;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 400;
  letter-spacing: 0.3em;
  color: var(--color-accent-muted);
  writing-mode: vertical-lr;
  transform: rotate(180deg);
  display: none;
}

@media (min-width: 1024px) {
  article .content h2::before {
    display: block;
  }
}

h3 {
  font-size: var(--text-2xl);
}

h4 {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.4em;
  color: var(--color-accent);
}

/* =============================================================================
   Links
   ============================================================================= */
a {
  color: var(--color-text-bright);
  text-decoration: underline;
  text-decoration-color: var(--color-accent-subtle);
  text-underline-offset: 4px;
  transition: all var(--transition-base);
}

a:hover,
a:focus {
  color: var(--color-accent);
  text-decoration-color: var(--color-accent);
}

/* =============================================================================
   Article
   ============================================================================= */
article {
  position: relative;
}

article > header {
  margin-bottom: var(--space-16);
  padding-bottom: var(--space-10);
  border-bottom: 1px solid var(--color-border-subtle);
}

article > header h1 {
  margin-bottom: var(--space-4);
  background: linear-gradient(180deg, var(--color-text-bright) 0%, rgba(255, 255, 255, 0.6) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Article date */
article time {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.5em;
  color: var(--color-text-subtle);
  display: block;
  margin-bottom: var(--space-4);
}

/* Decorative dot before date */
article > header time::before {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border: 1px solid var(--color-accent-muted);
  transform: rotate(45deg);
  margin-right: var(--space-3);
  vertical-align: middle;
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 0.5;
  }
  50% {
    opacity: 1;
  }
}

/* =============================================================================
   Content - Prose Styling
   ============================================================================= */
.content {
  max-width: 100%;
  position: relative;
}

.content p,
.content ul,
.content ol,
.content blockquote,
.content pre,
.content table {
  margin-bottom: var(--space-6);
}

/* First paragraph - Lead style */
.content > p:first-of-type {
  font-family: var(--font-serif);
  font-size: var(--text-2xl);
  font-style: italic;
  line-height: 1.5;
  color: var(--color-text-bright);
  border-left: 4px solid var(--color-accent-muted);
  padding-left: var(--space-8);
  padding-top: var(--space-4);
  padding-bottom: var(--space-4);
  margin-bottom: var(--space-12);
}

/* Drop cap for second paragraph (first content paragraph after lead) */
.content > p:nth-of-type(2)::first-letter {
  font-family: var(--font-serif);
  font-size: 4em;
  float: left;
  line-height: 0.8;
  margin-right: var(--space-3);
  margin-top: 0.1em;
  color: var(--color-accent);
}

.content ul,
.content ol {
  padding-left: var(--space-8);
}

.content li {
  margin-bottom: var(--space-2);
  position: relative;
}

.content ul > li::marker {
  color: var(--color-accent-muted);
}

.content ol > li::marker {
  color: var(--color-accent);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
}

/* =============================================================================
   Blockquotes
   ============================================================================= */
.content blockquote {
  border-left: 2px solid var(--color-accent-muted);
  padding: var(--space-4) 0 var(--space-4) var(--space-6);
  margin: var(--space-6) 0;
  background: transparent;
  font-family: var(--font-sans);
  font-weight: 300;
  font-style: italic;
  font-size: var(--text-base);
  line-height: 1.5;
  letter-spacing: -0.01em;
  color: var(--color-text-bright);
  position: relative;
}

.content blockquote p:last-child {
  margin-bottom: 0;
}

/* =============================================================================
   Code Blocks
   ============================================================================= */
code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--color-accent);
  padding: 0.15em 0.4em;
  border-radius: 2px;
}

pre {
  background-color: var(--color-code-bg);
  border: 1px solid var(--color-border);
  overflow-x: auto;
  position: relative;
}

/* Terminal-style header for code blocks */
pre::before {
  content: '';
  display: block;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--color-border-subtle);
  padding: var(--space-2) var(--space-4);
  margin-bottom: var(--space-4);
}

pre::after {
  content: attr(data-language);
  position: absolute;
  top: var(--space-2);
  right: var(--space-4);
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--color-text-subtle);
}

pre code {
  display: block;
  padding: var(--space-4) var(--space-6);
  background: none;
  color: var(--color-code-text);
  font-size: var(--text-sm);
  line-height: 1.2;
}

/* Terminal dots */
pre::before {
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.1) 3px, transparent 3px);
  background-size: 12px 12px;
  background-position: 8px center;
  background-repeat: no-repeat;
  padding-left: 50px;
}

/* =============================================================================
   Tags
   ============================================================================= */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  list-style: none;
  margin-top: var(--space-4);
}

.tags li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.tags li::before {
  content: '';
  width: 6px;
  height: 6px;
  border: 1px solid var(--color-border);
  transition: all var(--transition-slow);
}

.tags li:hover::before {
  border-color: var(--color-accent);
  transform: rotate(45deg);
}

.tags a {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--color-text-subtle);
  text-decoration: none;
  padding: var(--space-2) var(--space-3);
  border: 1px solid transparent;
  transition: all var(--transition-base);
}

.tags a:hover,
.tags a:focus {
  color: var(--color-accent);
  border-color: var(--color-border);
  background: rgba(255, 255, 255, 0.02);
}

/* =============================================================================
   Images
   ============================================================================= */
img {
  max-width: 100%;
  height: auto;
  filter: brightness(0.9) contrast(1.05) grayscale(0.1);
  border: 1px solid var(--color-border);
  transition: filter var(--transition-slow);
}

img:hover {
  filter: brightness(1) contrast(1) grayscale(0);
}

figure {
  margin: var(--space-12) 0;
}

figcaption {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--color-text-subtle);
  margin-top: var(--space-4);
  text-align: center;
}

/* =============================================================================
   Tables
   ============================================================================= */
table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--color-border);
  font-size: var(--text-sm);
}

th,
td {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border-subtle);
  text-align: left;
}

th {
  background-color: rgba(255, 255, 255, 0.02);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--color-text-muted);
}

tr:hover {
  background-color: rgba(255, 255, 255, 0.01);
}

/* =============================================================================
   Article List (Index Page)
   ============================================================================= */
section[aria-label='Article list'] article {
  padding: var(--space-10) 0;
  border-bottom: 1px solid var(--color-border-subtle);
  position: relative;
}

section[aria-label='Article list'] article::before {
  content: '';
  position: absolute;
  left: 0;
  bottom: -1px;
  width: 0;
  height: 1px;
  background: var(--color-accent);
  transition: width var(--transition-slower);
}

section[aria-label='Article list'] article:hover::before {
  width: 100%;
}

section[aria-label='Article list'] article:last-child {
  border-bottom: none;
}

section[aria-label='Article list'] article:last-child::before {
  display: none;
}

section[aria-label='Article list'] h3 {
  margin-top: 0;
  margin-bottom: var(--space-2);
  font-size: var(--text-2xl);
}

section[aria-label='Article list'] h3 a {
  text-decoration: none;
  color: var(--color-text-bright);
  transition: color var(--transition-base);
}

section[aria-label='Article list'] h3 a:hover {
  color: var(--color-accent);
}

section[aria-label='Article list'] time {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.3em;
  color: var(--color-text-subtle);
  display: block;
  margin-bottom: var(--space-3);
}

section[aria-label='Article list'] p {
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  line-height: 1.6;
}

/* =============================================================================
   Tag Cloud
   ============================================================================= */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  list-style: none;
  justify-content: center;
}

.tag-cloud li {
  display: flex;
  align-items: center;
}

.tag-cloud a {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--color-text-muted);
  text-decoration: none;
  padding: var(--space-3) var(--space-6);
  border: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  backdrop-filter: blur(8px);
  transition: all var(--transition-base);
}

.tag-cloud a:hover,
.tag-cloud a:focus {
  color: var(--color-text-bright);
  border-color: var(--color-accent-muted);
  background: rgba(224, 123, 76, 0.08);
}

.tag-count {
  color: var(--color-text-subtle);
  margin-left: var(--space-2);
}

/* =============================================================================
   Related Articles Navigation
   ============================================================================= */
article > footer {
  margin-top: var(--space-20);
  padding-top: var(--space-12);
  border-top: 1px solid var(--color-border);
}

nav[aria-label='Related articles'] {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-6);
}

nav[aria-label='Related articles'] a {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--color-text-muted);
  text-decoration: none;
  padding: var(--space-4) var(--space-6);
  border: 1px solid var(--color-border);
  transition: all var(--transition-base);
  max-width: 45%;
}

nav[aria-label='Related articles'] a:hover,
nav[aria-label='Related articles'] a:focus {
  color: var(--color-text-bright);
  border-color: var(--color-accent-muted);
  background: rgba(255, 255, 255, 0.02);
}

nav[aria-label='Related articles'] a[rel='prev']::before {
  content: '<< ';
  color: var(--color-accent);
}

nav[aria-label='Related articles'] a[rel='next']::after {
  content: ' >>';
  color: var(--color-accent);
}

/* =============================================================================
   Archive Page
   ============================================================================= */
section[aria-labelledby^='archive-'] {
  margin-bottom: var(--space-12);
}

section[aria-labelledby^='archive-'] h2 {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--color-border-subtle);
}

section[aria-labelledby^='archive-'] ul {
  list-style: none;
}

section[aria-labelledby^='archive-'] li {
  padding: var(--space-3) 0;
  display: flex;
  align-items: baseline;
  gap: var(--space-4);
  border-bottom: 1px solid var(--color-border-subtle);
}

section[aria-labelledby^='archive-'] li:last-child {
  border-bottom: none;
}

section[aria-labelledby^='archive-'] time {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-subtle);
  min-width: 5rem;
}

section[aria-labelledby^='archive-'] a {
  color: var(--color-text);
  text-decoration: none;
}

section[aria-labelledby^='archive-'] a:hover {
  color: var(--color-accent);
}

/* =============================================================================
   Horizontal Rule
   ============================================================================= */
hr {
  border: none;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--color-border), transparent);
  margin: var(--space-16) 0;
}

/* =============================================================================
   Strong & Emphasis
   ============================================================================= */
strong {
  color: var(--color-text-bright);
  font-weight: 600;
}

em {
  font-style: italic;
  color: var(--color-text-bright);
}

/* =============================================================================
   Animations
   ============================================================================= */
@keyframes reveal {
  from {
    opacity: 0;
    transform: translateY(20px);
    filter: blur(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
    filter: blur(0);
  }
}

article {
  animation: reveal 1.2s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* =============================================================================
   Responsive - Tablet
   ============================================================================= */
@media (max-width: 768px) {
  :root {
    --space-16: 3rem;
    --space-20: 4rem;
    --space-24: 5rem;
  }

  header[role='banner'],
  main,
  footer[role='contentinfo'] {
    padding-left: var(--space-6);
    padding-right: var(--space-6);
  }

  .content table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  nav[aria-label='Related articles'] a {
    max-width: 100%;
  }
}

/* =============================================================================
   Responsive - Mobile
   ============================================================================= */
@media (max-width: 600px) {
  :root {
    --text-base: 0.9375rem;
    --text-6xl: 2.5rem;
    --text-5xl: 2rem;
    --text-4xl: 1.75rem;
    --text-3xl: 1.5rem;
    --text-2xl: 1.25rem;
    --space-8: 1.5rem;
    --space-10: 2rem;
    --space-12: 2.5rem;
  }

  header[role='banner'],
  main,
  footer[role='contentinfo'] {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  nav[aria-label='Main navigation'] ul {
    gap: var(--space-4);
    flex-wrap: wrap;
    justify-content: center;
  }

  nav[aria-label='Main navigation'] a {
    letter-spacing: 0.2em;
    padding: var(--space-3) var(--space-4);
  }

  article > header {
    margin-bottom: var(--space-10);
  }

  .content > p:first-of-type {
    font-size: var(--text-xl);
    padding-left: var(--space-6);
  }

  .tags a {
    padding: var(--space-3) var(--space-4);
    font-size: 10px;
  }

  pre {
    margin-left: calc(-1 * var(--space-4));
    margin-right: calc(-1 * var(--space-4));
    border-left: none;
    border-right: none;
  }

  .content ul,
  .content ol {
    padding-left: var(--space-6);
  }

  .content img {
    margin-left: calc(-1 * var(--space-4));
    margin-right: calc(-1 * var(--space-4));
    max-width: calc(100% + var(--space-4) * 2);
    border-left: none;
    border-right: none;
  }
}

/* =============================================================================
   Responsive - Small Mobile
   ============================================================================= */
@media (max-width: 400px) {
  :root {
    --text-base: 0.875rem;
    --text-6xl: 2rem;
    --text-5xl: 1.75rem;
    --text-4xl: 1.5rem;
  }

  h1 {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: auto;
  }

  nav[aria-label='Main navigation'] ul {
    flex-direction: column;
    align-items: center;
    gap: var(--space-2);
  }

  nav[aria-label='Main navigation'] a {
    display: block;
    text-align: center;
    width: 100%;
  }
}

/* =============================================================================
   Print Styles
   ============================================================================= */
@media print {
  body::before,
  body::after {
    display: none;
  }

  nav,
  .skip-link {
    display: none;
  }

  body {
    font-size: 12pt;
    line-height: 1.5;
    color: #000;
    background: #fff;
    cursor: auto;
  }

  a {
    text-decoration: none;
    color: inherit;
  }

  a[href^='http']::after {
    content: ' (' attr(href) ')';
    font-size: 0.8em;
  }

  pre {
    border: 1px solid #ccc;
    background: #f5f5f5;
  }

  pre code {
    color: #333;
  }
}

/* =============================================================================
   Syntax Highlighting (Highlight.js Compatible - Warm Balanced Palette)
   ============================================================================= */
.hljs {
  background: var(--color-code-bg);
  color: #c8bda8;
}

.hljs-keyword,
.hljs-selector-tag,
.hljs-built_in {
  color: #cc8888;
}

.hljs-name,
.hljs-tag {
  color: #cc8888;
}

.hljs-string,
.hljs-addition {
  color: #a8c090;
}

.hljs-title,
.hljs-section {
  color: #e0d4c0;
}

.hljs-attribute,
.hljs-literal,
.hljs-template-tag,
.hljs-template-variable,
.hljs-type {
  color: #d4a656;
}

.hljs-comment,
.hljs-quote,
.hljs-deletion,
.hljs-meta {
  color: #605a52;
}

.hljs-number,
.hljs-regexp,
.hljs-bullet,
.hljs-link {
  color: #c9a86c;
}

.hljs-variable,
.hljs-template-variable {
  color: #c8bda8;
}

.hljs-attr,
.hljs-selector-id,
.hljs-selector-class,
.hljs-selector-attr,
.hljs-selector-pseudo {
  color: #88aabb;
}

.hljs-symbol,
.hljs-class .hljs-title,
.hljs-title.class_ {
  color: #e0d4c0;
}

.hljs-function,
.hljs-title.function_ {
  color: #88aabb;
}

.hljs-params {
  color: #c8bda8;
}

.hljs-emphasis {
  font-style: italic;
}

.hljs-strong {
  font-weight: bold;
}

.hljs-property {
  color: #b8a0c8;
}
