/* Theme Variables */
:root {
  color-scheme: light dark;
  --bg: #f8f9fa;
  --surface: #ffffff;
  --text: #24292e;
  --heading: #0f1419;
  --muted: #57606a;
  --border: #e1e4e8;
  --link: #0969da;
  --link-hover: #044289;
  --shadow: rgba(0, 0, 0, 0.05);
}

/* Dark mode: follows the visitor's system setting by default */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --surface: #111116;
    --text: #d2d2d7;
    --heading: #f5f5f7;
    --muted: #a1a1a6;
    --border: rgba(255, 255, 255, 0.12);
    --link: #a5b4fc;
    --link-hover: #ffffff;
    --shadow: rgba(0, 0, 0, 0.6);
  }
}

/* Manual override:  or  */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --surface: #111116;
  --text: #d2d2d7;
  --heading: #f5f5f7;
  --muted: #a1a1a6;
  --border: rgba(255, 255, 255, 0.12);
  --link: #a5b4fc;
  --link-hover: #ffffff;
  --shadow: rgba(0, 0, 0, 0.6);
}

:root[data-theme="light"] {
  color-scheme: light;
}

/* Reset & Base Styles */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.7;
  color: var(--text);
  background-color: var(--bg);
  padding: 20px;
}

/* Navigation */
nav {
  max-width: 760px;
  margin: 0 auto 24px auto;
}

nav a {
  color: var(--link);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

nav a:hover {
  text-decoration: underline;
  color: var(--link-hover);
}

/* Article Container */
.article-container {
  max-width: 760px;
  margin: 0 auto;
  background: var(--surface);
  padding: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 12px var(--shadow);
}

/* Header Section */
.article-header {
  border-bottom: 1px solid var(--border);
  padding-bottom: 24px;
  margin-bottom: 32px;
}

.article-date {
  font-size: 0.875rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.article-header h1 {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1.25;
  color: var(--heading);
  margin-bottom: 12px;
}

.article-subtitle {
  font-size: 1.2rem;
  color: var(--muted);
  font-weight: 400;
  line-height: 1.4;
}

/* Article Content Body */
.article-content p {
  font-size: 1.1rem;
  color: var(--text);
  margin-bottom: 20px;
  line-height: 1.8;
}

.article-content h2 {
  font-size: 1.5rem;
  margin-top: 36px;
  margin-bottom: 16px;
  color: var(--heading);
}

.article-content blockquote {
  border-left: 4px solid var(--link);
  padding-left: 16px;
  margin: 24px 0;
  font-style: italic;
  color: var(--muted);
}

.article-content blockquote.instagram-media {
  border: 0;
  color: inherit;
  font-style: normal;
  margin: 24px auto;
  max-width: 658px !important;
  min-width: 0 !important;
  padding: 0;
  width: 100% !important;
}

.article-content blockquote.instagram-media iframe {
  display: block;
  max-width: 100% !important;
  min-width: 0 !important;
  width: 100% !important;
}

.article-content > iframe.instagram-media {
  display: block;
  margin: 24px auto;
  max-width: 658px !important;
  min-width: 0 !important;
  width: 100% !important;
}

.article-content ul {
  margin: 0 0 20px 24px;
}

.article-content li {
  font-size: 1.1rem;
  color: var(--text);
  line-height: 1.8;
  margin-bottom: 12px;
}

.article-content .note {
  padding: 16px 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  color: var(--muted);
}

/* All article images safety rule (prevents unhandled images from overflowing) */
.article-content img,
.article-hero img,
.article-figure img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Hero Image */
.article-hero {
  margin: 0 0 32px 0;
  width: 100%;
}

.article-hero img {
  width: 100%;
  border-radius: 8px;
}

.article-figure img {
  display: block;
  width: 100%;
  height: auto;
}

.article-hero figcaption {
  margin-top: 8px;
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
}

/* Base Article Figures */
.article-figure {
  margin: 32px auto;
  max-width: 100%;
}

.article-figure img {
  width: 100%;
  max-height: 480px; /* Limits height so large vertical images don't cover the screen */
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}

.article-figure figcaption {
  margin-top: 10px;
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--muted);
}

.image-credit {
  display: block;
  margin-top: 2px;
  font-size: 0.8rem;
  opacity: 0.85;
}

.image-credit a {
  color: inherit;
  text-decoration: underline;
}

/* Site Footer */
.site-footer {
  max-width: 760px;
  margin: 40px auto 0 auto;
  padding: 24px 0;
  text-align: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  padding: 7px 16px;
  border-radius: 9999px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 0.3s ease;
}

.footer-links a:hover,
.footer-links a:focus-visible {
  color: var(--heading);
}

.site-footer p {
  margin: 0;
  font-size: 0.75rem;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 500;
  opacity: 0.6;
}

/* Responsive Design */
@media (max-width: 600px) {
  body {
    padding: 12px;
  }

  .article-container {
    padding: 20px;
  }

  .article-header h1 {
    font-size: 1.75rem;
  }

  .article-subtitle {
    font-size: 1rem;
  }

  .article-figure {
    margin: 24px 0;
  }

  .article-figure img {
    max-height: 320px; /* Constrains height further on mobile devices */
  }
}
