:root {
  --radius: 22px;
  --radius-sm: 14px;
  --container: 1120px;
  --container-narrow: 760px;
  --sans: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

html {
  scroll-behavior: smooth;
  color-scheme: light;
  --bg: #f4efe6;
  --bg-gradient-top: #f8f3ea;
  --bg-gradient-bottom: #efe6d8;
  --body-glow: rgba(13, 92, 99, 0.09);
  --surface: rgba(255, 252, 247, 0.78);
  --surface-strong: #fffaf2;
  --ink: #1a2128;
  --ink-soft: #54606a;
  --line: rgba(26, 33, 40, 0.12);
  --line-subtle: rgba(26, 33, 40, 0.06);
  --accent: #0d5c63;
  --accent-deep: #07393c;
  --accent-warm: #b1682f;
  --accent-tint: rgba(13, 92, 99, 0.11);
  --accent-border: rgba(13, 92, 99, 0.2);
  --accent-code: rgba(13, 92, 99, 0.08);
  --accent-quote: rgba(13, 92, 99, 0.35);
  --header-bg: rgba(244, 239, 230, 0.78);
  --section-muted-bg: linear-gradient(180deg, rgba(255, 250, 242, 0.58), rgba(235, 227, 213, 0.48));
  --contact-panel-bg:
    linear-gradient(135deg, rgba(255, 250, 242, 0.9), rgba(235, 227, 213, 0.72)),
    radial-gradient(circle at top right, rgba(13, 92, 99, 0.08), transparent 38%);
  --about-photo-glow: linear-gradient(135deg, rgba(13, 92, 99, 0.18), rgba(177, 104, 47, 0.2));
  --button-primary-shadow: 0 10px 24px rgba(255, 250, 242, 0.18);
  --shadow: 0 18px 45px rgba(20, 29, 34, 0.12);
  --hero-filter: none;
  --toggle-hover: rgba(13, 92, 99, 0.11);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #1a1f24;
  --bg-gradient-top: #1e2429;
  --bg-gradient-bottom: #161b20;
  --body-glow: rgba(74, 155, 163, 0.12);
  --surface: rgba(36, 43, 50, 0.88);
  --surface-strong: #2a3239;
  --ink: #e8ecef;
  --ink-soft: #9aa8b3;
  --line: rgba(232, 236, 239, 0.12);
  --line-subtle: rgba(232, 236, 239, 0.06);
  --accent: #5eb8c0;
  --accent-deep: #8ed4da;
  --accent-warm: #d4956a;
  --accent-tint: rgba(94, 184, 192, 0.16);
  --accent-border: rgba(94, 184, 192, 0.35);
  --accent-code: rgba(94, 184, 192, 0.14);
  --accent-quote: rgba(94, 184, 192, 0.45);
  --header-bg: rgba(26, 31, 36, 0.88);
  --section-muted-bg: linear-gradient(180deg, rgba(36, 43, 50, 0.65), rgba(26, 31, 36, 0.55));
  --contact-panel-bg:
    linear-gradient(135deg, rgba(42, 50, 57, 0.95), rgba(26, 31, 36, 0.85)),
    radial-gradient(circle at top right, rgba(94, 184, 192, 0.1), transparent 38%);
  --about-photo-glow: linear-gradient(135deg, rgba(94, 184, 192, 0.22), rgba(212, 149, 106, 0.2));
  --button-primary-shadow: 0 10px 24px rgba(0, 0, 0, 0.25);
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
  --hero-filter: brightness(0.82);
  --toggle-hover: rgba(94, 184, 192, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top, var(--body-glow), transparent 30%),
    linear-gradient(180deg, var(--bg-gradient-top) 0%, var(--bg) 42%, var(--bg-gradient-bottom) 100%);
  color: var(--ink);
  font-family: var(--sans);
  line-height: 1.7;
  min-height: 100vh;
}

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

img {
  display: block;
  max-width: 100%;
}

.site-shell {
  min-height: 100vh;
}

.container {
  width: min(calc(100% - 2rem), var(--container));
  margin: 0 auto;
}

.container.narrow,
.narrow {
  width: min(calc(100% - 2rem), var(--container-narrow));
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(18px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
}

.site-header .container {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  align-items: center;
  padding: 1rem 0;
}

.brand {
  display: inline-block;
  font-family: var(--serif);
  font-size: 1.4rem;
  font-weight: 700;
}

.brand-note {
  margin: 0.2rem 0 0;
  max-width: 32rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}

.site-nav {
  display: flex;
  gap: 0.85rem;
  flex-wrap: wrap;
  align-items: center;
}

.site-nav a {
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
  color: var(--ink-soft);
  transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.header-end {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink-soft);
  cursor: pointer;
  flex-shrink: 0;
  transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease;
}

.theme-toggle:hover {
  background: var(--toggle-hover);
  color: var(--accent-deep);
}

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

.theme-toggle .icon-sun {
  display: none;
}

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

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

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

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  background: var(--accent-tint);
  color: var(--accent-deep);
  transform: translateY(-1px);
}

.hero {
  position: relative;
  padding: 5rem 0 4rem;
}

.hero::before {
  content: "";
  position: absolute;
  inset: 1.5rem;
  border-radius: calc(var(--radius) * 1.3);
  background-image: var(--hero-image);
  background-size: cover;
  background-position: center;
  box-shadow: var(--shadow);
  filter: var(--hero-filter);
}

.hero-inner {
  position: relative;
  min-height: 68vh;
  display: flex;
  align-items: flex-end;
  padding: 3rem 2rem;
}

.hero-copy {
  max-width: 44rem;
  color: #f7f7f2;
  animation: rise 700ms ease both;
}

.eyebrow,
.section-label {
  margin: 0 0 0.75rem;
  color: var(--accent-warm);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hero .eyebrow {
  color: #f2d0a3;
}

.hero h1,
.page-intro h1,
.article-header h1,
.section-heading h2,
.about-copy h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.05;
}

.hero h1 {
  font-size: clamp(3.2rem, 8vw, 6.4rem);
  max-width: 10ch;
}

.hero-text {
  margin: 1.25rem 0 0;
  max-width: 38rem;
  font-size: 1.18rem;
  line-height: 1.8;
}

.hero-actions,
.footer-links,
.tag-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  align-items: center;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.2rem;
  border-radius: 999px;
  font-weight: 700;
  transition: transform 180ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

.button:hover,
.text-link:hover {
  transform: translateY(-1px);
}

.button-primary {
  background: var(--surface-strong);
  color: var(--accent-deep);
  box-shadow: var(--button-primary-shadow);
}

.button-secondary {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.button-secondary-light {
  background: transparent;
  color: var(--accent-deep);
  border: 1px solid var(--accent-border);
}

.section {
  padding: 4.5rem 0;
}

.home-section-anchor {
  scroll-margin-top: 6.5rem;
}

.section-tight {
  padding-top: 0;
}

.section-muted {
  background: var(--section-muted-bg);
  border-top: 1px solid var(--line-subtle);
  border-bottom: 1px solid var(--line-subtle);
}

.about-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  align-items: start;
}

.about-copy p:last-of-type {
  margin-bottom: 0;
}

.section-richtext {
  color: var(--ink-soft);
  font-size: 1.05rem;
}

.section-richtext > *:first-child {
  margin-top: 0;
}

.section-richtext > *:last-child {
  margin-bottom: 0;
}

.section-richtext p,
.section-richtext ul {
  margin: 1rem 0 0;
}

.section-richtext ul {
  padding-left: 1.2rem;
}

.section-richtext li + li {
  margin-top: 0.5rem;
}

.section-richtext a {
  color: var(--accent);
}

.about-photo-wrap {
  position: relative;
  padding: 1.25rem;
}

.about-photo-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  background: var(--about-photo-glow);
  transform: rotate(-3deg);
}

.about-photo {
  position: relative;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  aspect-ratio: 4 / 5;
  object-fit: cover;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.post-stack {
  display: grid;
  gap: 1.2rem;
}

.post-card,
.not-found-card {
  padding: 1.5rem 1.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.contact-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(260px, 0.9fr);
  gap: 1.5rem;
  padding: 2rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--contact-panel-bg);
  box-shadow: var(--shadow);
}

.contact-panel h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(1.9rem, 3vw, 2.8rem);
  line-height: 1.1;
}

.contact-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.9rem;
}

.post-card h2,
.post-card h3 {
  margin: 0.25rem 0 0.5rem;
  font-family: var(--serif);
  font-size: clamp(1.5rem, 2vw, 2rem);
}

.post-card a:hover,
.section-richtext a:hover,
.article-body a:hover,
.text-link {
  color: var(--accent);
}

.post-meta,
.lede,
.article-body figcaption {
  color: var(--ink-soft);
}

.tag {
  display: inline-flex;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  background: var(--accent-code);
  color: var(--accent-deep);
  font-size: 0.88rem;
}

.page-intro {
  padding-bottom: 1.25rem;
}

.page-intro h1,
.article-header h1 {
  font-size: clamp(2.4rem, 5vw, 4.25rem);
}

.article-shell {
  padding-top: 3rem;
}

.article-header {
  margin-bottom: 2rem;
}

.article-body {
  font-size: 1.08rem;
}

.article-body > *:first-child {
  margin-top: 0;
}

.article-body h2,
.article-body h3,
.article-body h4 {
  margin-top: 2.2rem;
  margin-bottom: 0.8rem;
  font-family: var(--serif);
  line-height: 1.15;
}

.article-body blockquote {
  margin: 1.5rem 0;
  padding: 0.2rem 0 0.2rem 1.25rem;
  border-left: 3px solid var(--accent-quote);
  color: var(--ink-soft);
  font-style: italic;
}

.article-body pre,
.article-body table,
.article-body img {
  max-width: 100%;
}

.article-body pre {
  overflow-x: auto;
}

.article-body img {
  margin: 1.6rem auto;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
}

.article-body code {
  font-size: 0.92em;
}

.article-body :not(pre) > code {
  padding: 0.1rem 0.35rem;
  border-radius: 0.35rem;
  background: var(--accent-code);
}

.site-footer {
  padding: 2rem 0 2.5rem;
}

.footer-grid,
.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.footer-grid {
  padding: 1.5rem 0 1rem;
  border-top: 1px solid var(--line);
}

.footer-title {
  margin: 0;
  font-weight: 700;
}

.footer-copy,
.footer-bottom {
  color: var(--ink-soft);
}

.footer-bottom {
  padding-top: 0.5rem;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  .theme-toggle:hover,
  .site-nav a:hover,
  .site-nav a[aria-current="page"] {
    transform: none;
  }
}

@media (max-width: 880px) {
  .site-header .container,
  .section-heading,
  .footer-grid,
  .footer-bottom,
  .about-grid,
  .contact-panel {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: flex-start;
  }

  .hero::before {
    inset: 0.8rem;
  }

  .hero-inner {
    min-height: 58vh;
    padding: 2rem 1.5rem;
  }
}

@media (max-width: 640px) {
  .hero {
    padding-top: 3rem;
  }

  .hero::before {
    inset: 0.4rem;
    border-radius: var(--radius);
  }

  .hero-inner {
    min-height: 52vh;
    padding: 1.6rem 1.1rem;
  }

  .section {
    padding: 3.4rem 0;
  }

  .post-card,
  .not-found-card {
    padding: 1.25rem;
  }
}
