:root {
  --max-width: 940px;
  --color-bg: #f4ecdd;
  --color-text: #1a1410;
  --color-muted: #6b6459;
  --color-accent: #e8822e;
  --color-accent-light: #f4a94d;
  --color-border: #e3d7c4;
  --color-hero-bg: #16112a;
  --color-hero-text: #f7efe2;
  --color-card-bg: #faf5eb;

  --hero-image: url("../static/hero.webp");
  --color-code-bg: #efe6d5;
  --color-swoosh-start: #e8822e;
  --color-swoosh-mid: #f4a94d;
  --color-swoosh-end: #e8822e;
  --card-shadow: 0 10px 30px rgba(60, 40, 20, 0.08);
  --card-shadow-sm: 0 6px 20px rgba(60, 40, 20, 0.06);
  --card-shadow-hover: 0 10px 28px rgba(60, 40, 20, 0.12);
  --hero-fade: var(--color-bg);

  --font-serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas,
    monospace;
}

:root[data-theme="dark"] {
  --color-bg: #0a0e1a;
  --color-text: #e8edf7;
  --color-muted: #97a3bd;
  --color-accent: #5b8ef0;
  --color-accent-light: #8fb4f7;
  --color-border: rgba(255, 255, 255, 0.08);
  --color-hero-bg: #060912;
  --color-hero-text: #f2f6ff;
  --color-card-bg: rgba(22, 30, 51, 0.55);

  --hero-image: url("../static/hero-dark.webp");
  --color-code-bg: rgba(255, 255, 255, 0.05);
  --color-swoosh-start: #3f6fd8;
  --color-swoosh-mid: #6f9bf5;
  --color-swoosh-end: #3f6fd8;
  --card-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --card-shadow-sm: 0 6px 20px rgba(0, 0, 0, 0.4);
  --card-shadow-hover: 0 12px 32px rgba(0, 0, 0, 0.55);
  --hero-fade: var(--color-bg);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  line-height: 1.6;
  color: var(--color-text);
  background: var(--color-bg);
  margin: 0;
  padding: 0;
}

a {
  color: var(--color-accent);
}

/* ---------- Hero ---------- */
.site-hero {
  position: relative;
  background: var(--color-hero-bg) center top / cover no-repeat;
  background-image: var(--hero-image);
  color: var(--color-hero-text);
  padding: 1.25rem 1.5rem 3rem;
  text-align: center;
  overflow: hidden;
}

.site-hero::after {
  /* smooth blend into the cream page */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 120px;
  background: linear-gradient(to bottom, transparent, var(--hero-fade));
  pointer-events: none;
}

.site-hero--full {
  min-height: 460px;
}

.site-hero--compact {
  min-height: 240px;
  padding-bottom: 2rem;
}

.site-nav {
  position: relative;
  z-index: 2;
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0 0;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  line-height: 0;
}

.site-nav ul {
  list-style: none;
  display: flex;
  gap: 1.75rem;
  text-shadow: 0px 0px 4px black;
}

.site-nav a {
  position: relative;
  color: rgba(247, 239, 226, 0.8);
  text-decoration: none;
  font-size: 1rem;
  padding-bottom: 4px;
}

.site-nav a:hover {
  color: var(--color-hero-text);
}

.site-nav a.is-active {
  color: #fff;
}

.site-nav a.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--color-accent), var(--color-accent-light));
}

.site-hero-content {
  position: relative;
  z-index: 2;
  max-width: var(--max-width);
  margin: 0 auto;
}

.site-hero--full .site-hero-content {
  padding-top: 5.5rem;
}

.site-hero--compact .site-hero-content {
  padding-top: 3rem;
}

.site-title {
  position: relative;
  display: inline-block;
  font-family: var(--font-serif);
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1;
  text-shadow: 0px 0px 4px black;
}

.site-hero--full .site-title {
  font-size: clamp(3rem, 9vw, 5.5rem);
  padding-bottom: 1.75rem;
}

.site-title-name {
  color: #f7efe2;
}

.site-title-accent {
  color: var(--color-accent);
}

.site-title-swoosh {
  position: absolute;
  left: 8%;
  right: 8%;
  bottom: 0.2rem;
  width: 84%;
  height: 1.6rem;
}

.site-tagline {
  margin-top: 1.25rem;
  font-family: var(--font-mono);
  font-size: clamp(0.9rem, 2.4vw, 1.35rem);
  letter-spacing: 0.12em;
  color: rgba(247, 239, 226, 0.92);
}

.site-title--compact {
  text-decoration: none;
  font-size: clamp(1.8rem, 5vw, 2.6rem);
}

/* ---------- Main container ---------- */
main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* ---------- Featured Post ---------- */
.featured-post {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 1.75rem;
  margin: -2.5rem 0 3rem;
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  box-shadow: var(--card-shadow);
}

.featured-thumb {
  width: 300px;
  height: 200px;
  object-fit: cover;
  border-radius: 12px;
  flex-shrink: 0;
  margin-right: 2.5rem;
}

.featured-post-content {
  flex: 1;
}

.featured-post h2 {
  font-family: var(--font-serif);
  font-weight: 800;
  font-size: 2rem;
  line-height: 1.15;
  margin: 0.25rem 0 0.75rem;
}

.featured-post h2 a {
  color: var(--color-text);
  text-decoration: none;
}

.featured-post h2 a:hover {
  color: var(--color-accent);
}

/* ---------- Section title ---------- */
.section-title {
  font-family: var(--font-serif);
  font-weight: 800;
  font-size: 1.9rem;
  color: var(--color-text);
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  position: relative;
  display: inline-block;
}

.section-title::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 90%;
  height: 4px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--color-accent), var(--color-accent-light) 70%, transparent);
}

/* ---------- Post cards ---------- */
.post-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

.post-card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 16px;
  padding: 1.5rem;
  box-shadow: var(--card-shadow-sm);
  display: flex;
  gap: 1.75rem;
  align-items: center;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.post-card:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-2px);
}

.post-card-content {
  flex: 1;
}

.post-thumb {
  width: 200px;
  height: 130px;
  object-fit: cover;
  border-radius: 10px;
  display: block;
  flex-shrink: 0;
}

.post-card h3 {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 1.4rem;
  line-height: 1.2;
  margin: 0.25rem 0 0.5rem;
}

.post-card h3 a {
  color: var(--color-text);
  text-decoration: none;
}

.post-card h3 a:hover {
  color: var(--color-accent);
}

/* ---------- Shared post meta ---------- */
.post-date {
  display: block;
  color: var(--color-accent);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
}

.post-tag {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-accent);
  background: var(--color-code-bg);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
}

.post-excerpt {
  color: var(--color-muted);
  font-size: 1rem;
  line-height: 1.55;
  margin-top: 0.35rem;
}

/* ---------- Content cards (about / post) ---------- */
.content-card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 2.5rem;
  margin: -2.5rem 0 3rem;
  position: relative;
  z-index: 3;
  box-shadow: var(--card-shadow);
}

.content-card h1 {
  font-family: var(--font-serif);
  font-weight: 800;
  font-size: 2.4rem;
  line-height: 1.15;
  margin-bottom: 0.75rem;
}

.content-card h2,
.content-card h3 {
  font-family: var(--font-serif);
  font-weight: 700;
}

.content-card h2 {
  font-size: 1.6rem;
  margin: 2rem 0 1rem;
}

.content-card h3 {
  font-size: 1rem;
  margin: 1rem 0 0.5rem;
}

.content-card p {
  margin-bottom: 1rem;
}

.post-body ul {
  padding-left: 2rem;
  margin-bottom: 1rem;
}

.post-body blockquote {
  margin: 1.5em 0;
  padding: 0.8em 1.4em;
  border-left: 4px solid var(--color-accent);
  background-color: var(--color-code-bg);
  color: var(--color-text);
  font-style: italic;
  line-height: 1.6;
  border-radius: 0 10px 10px 0;
}

.post-body blockquote p {
  margin: 0.5em 0;
}

/* Attribution / citation */
.post-body blockquote cite {
  display: block;
  margin-top: 0.5em;
  font-style: normal;
  font-size: 0.9em;
  color: var(--color-muted);
  text-align: right;
}

.post-body blockquote cite::before {
  content: "— ";
}

.post-body hr {
  margin: 1rem 12rem;
}

/* ---------- Post page ---------- */
.post header {
  margin-bottom: 1rem;
}

.post-hero {
  margin-bottom: 1.5rem;
}

.post-hero img {
  width: 100%;
  height: auto;
  object-fit: cover;
  border-radius: 12px;
  display: block;
}

.post-body a {
  color: var(--color-accent);
}

.post-body pre {
  background: var(--color-code-bg);
  border: 1px solid var(--color-border);
  padding: 1rem;
  border-radius: 10px;
  overflow-x: auto;
  margin: 1rem 0;
  font-family: var(--font-mono);
}

.post-body code {
  background: var(--color-code-bg);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.9em;
}

.post-body pre code {
  background: none;
  padding: 0;
}

/* ---------- About ---------- */
.about {
  text-align: center;
}

.about-bust {
  margin-bottom: 1rem;
}

.about-bust img {
  width: 160px;
  height: 160px;
  object-fit: cover;
  border-radius: 50%;
  display: inline-block;
  border: 4px solid var(--color-accent-light);
}

.about-role {
  color: var(--color-muted);
  margin-bottom: 1rem;
}

.about-links {
  margin-bottom: 2rem;
}

.about-links a {
  color: var(--color-accent);
  text-decoration: none;
  margin: 0 0.5rem;
  font-weight: 500;
}

.about-links a:hover {
  text-decoration: underline;
}

.about .post-body {
  text-align: left;
}

/* ---------- Footer ---------- */
.site-footer {
  max-width: var(--max-width);
  margin: 3rem auto 0;
  padding: 1.5rem;
  color: var(--color-muted);
  font-size: 0.9rem;
  text-align: center;
}

.footer-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.footer-rule {
  height: 1px;
  width: min(220px, 30vw);
  background: linear-gradient(90deg, transparent, var(--color-border), transparent);
}

.footer-ornament {
  flex-shrink: 0;
}

/* ---------- Themed SVG ornaments ---------- */
.logo-stroke {
  stroke: var(--color-accent-light);
}

.logo-bar {
  fill: var(--color-accent);
}

.sw-stop-a {
  stop-color: var(--color-swoosh-start);
}

.sw-stop-b {
  stop-color: var(--color-swoosh-mid);
}

.ornament-rays {
  stroke: var(--color-accent);
}

.ornament-core {
  fill: var(--color-accent-light);
  stroke: var(--color-accent);
}

/* ---------- Theme toggle ---------- */
.theme-toggle {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-left: 1.5rem;
  padding: 0;
  border: 1px solid rgba(247, 239, 226, 0.25);
  border-radius: 50%;
  background: rgba(247, 239, 226, 0.08);
  color: var(--color-hero-text);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.theme-toggle:hover {
  background: rgba(247, 239, 226, 0.18);
  border-color: rgba(247, 239, 226, 0.45);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--color-accent-light);
  outline-offset: 2px;
}

.theme-icon {
  display: block;
}

/* Show moon in light mode (click to go dark), sun in dark mode. */
.theme-icon--sun {
  display: none;
}

.theme-icon--moon {
  display: block;
}

:root[data-theme="dark"] .theme-icon--sun {
  display: block;
}

:root[data-theme="dark"] .theme-icon--moon {
  display: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .site-hero {
    padding: 1rem 1rem 2.5rem;
  }

  .site-nav {
    padding: 0.25rem 0 0;
  }

  .site-hero--full {
    min-height: 380px;
  }

  .site-hero--full .site-hero-content {
    padding-top: 3rem;
  }

  .featured-post,
  .post-card {
    flex-direction: column;
    text-align: center;
    align-items: stretch;
  }

  .featured-thumb {
    width: 100%;
    height: auto;
    margin-right: 0;
    margin-bottom: 1.5rem;
  }

  .post-thumb {
    width: 100%;
    height: 180px;
  }

  .featured-post h2 {
    font-size: 1.6rem;
  }

  .content-card {
    padding: 1.75rem;
  }

  main {
    padding: 0 1rem;
  }
}
