:root {
  --bg: #f8f7f3;
  --surface: #ffffff;
  --surface-soft: #f1efe9;
  --text: #181818;
  --muted-text: #5f6368;
  --border: #ddd8cf;
  --accent: #2457a6;
  --accent-soft: rgba(36, 87, 166, 0.1);
  --code-bg: #eeebe3;
  --code-text: #7a3f00;
  --pre-bg: #20242a;
  --pre-text: #f6f8fa;
  --shadow: 0 18px 50px rgba(31, 31, 31, 0.08);
  --max-width: 1080px;
  --content-width: 820px;
}

[data-theme="dark"] {
  --bg: #101112;
  --surface: #151719;
  --surface-soft: #1c1f22;
  --text: #f2efe7;
  --muted-text: #b8b1a6;
  --border: #2a2d31;
  --accent: #8ab4ff;
  --accent-soft: rgba(138, 180, 255, 0.12);
  --code-bg: #1c1f22;
  --code-text: #ffd89a;
  --pre-bg: #0b0c0d;
  --pre-text: #f2efe7;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.68;
}

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

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

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 100;
  padding: 8px 12px;
  background: var(--text);
  color: var(--bg);
  border-radius: 999px;
}

.skip-link:focus {
  top: 16px;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  backdrop-filter: blur(14px);
}

.navbar,
.content-shell,
.site-footer {
  width: min(var(--max-width), calc(100% - 40px));
  margin: 0 auto;
}

.navbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
}

.brand-mark {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 0.9rem;
  font-weight: 700;
}

.brand-text {
  white-space: nowrap;
}

.nav-links {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted-text);
  font-size: 0.94rem;
  font-weight: 500;
}

.nav-links a,
.theme-toggle {
  padding: 6px 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.theme-toggle {
  position: relative;
  width: 58px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted-text);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background 160ms ease, border-color 160ms ease;
}

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

.theme-toggle-icon {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  font-size: 0.9rem;
  line-height: 1;
}

.theme-toggle-knob {
  position: absolute;
  left: 4px;
  top: 4px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--text);
  transition: transform 160ms ease;
}

[data-theme="dark"] .theme-toggle-knob {
  transform: translateX(28px);
}

.content-shell {
  padding: 38px 0 72px;
}

.hero {
  max-width: 900px;
  margin: 42px auto 52px;
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  gap: clamp(30px, 6vw, 56px);
  align-items: center;
}

.profile-photo {
  width: clamp(180px, 22vw, 240px);
  height: clamp(180px, 22vw, 240px);
  overflow: hidden;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow);
  color: var(--accent);
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 3.4rem;
  font-weight: 700;
}

.profile-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.eyebrow,
.post-date,
.post-meta {
  margin: 0 0 10px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--text);
  font-family: "Source Serif 4", Georgia, serif;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.12;
}

h1 {
  margin-bottom: 14px;
  font-size: clamp(2.8rem, 7vw, 4.6rem);
}

h2 {
  margin-bottom: 16px;
  font-size: clamp(1.7rem, 4vw, 2.25rem);
}

h3 {
  margin-bottom: 10px;
  font-size: 1.35rem;
}

.lead {
  max-width: 560px;
  margin-bottom: 24px;
  color: var(--muted-text);
  font-size: clamp(1.02rem, 2vw, 1.18rem);
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 7px 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
}

.button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.about-section,
.home-section,
.page-header,
.page-content,
.post {
  max-width: var(--content-width);
  margin-left: auto;
  margin-right: auto;
}

.about-section {
  margin-bottom: 48px;
}

.about-section p {
  color: var(--muted-text);
  line-height: 1.75;
}

.home-section {
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.section-heading h2 {
  margin-bottom: 0;
}

.section-heading a,
.back-link,
.post-back a,
.post-content a {
  color: var(--accent);
  font-weight: 600;
}

.muted,
.empty-message {
  color: var(--muted-text);
}

.contact-list {
  display: grid;
  gap: 14px;
  max-width: 680px;
}

.contact-card,
.post-card {
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.contact-card {
  display: grid;
  gap: 6px;
  padding: 18px 20px;
}

.contact-card:hover,
.post-card:hover {
  border-color: var(--accent);
  background: var(--surface-soft);
}

.contact-label {
  color: var(--muted-text);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.contact-card a {
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

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

.page-header {
  padding-bottom: 28px;
}

.page-header h1,
.post-header h1 {
  font-size: clamp(2.5rem, 6vw, 4.2rem);
}

.page-content {
  padding-top: 10px;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.blog-grid {
  padding-top: 10px;
}

.post-card {
  min-height: 220px;
}

.post-card-link {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  padding: 22px;
}

.post-card h2,
.post-card h3 {
  margin-bottom: 12px;
}

.post-card p {
  color: var(--muted-text);
}

.post-card .post-meta {
  color: var(--accent);
}

.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
  padding-top: 18px;
}

.tag-list span {
  padding: 3px 9px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted-text);
  font-size: 0.78rem;
}

.post-header {
  padding-bottom: 30px;
  border-bottom: 1px solid var(--border);
}

.back-link {
  display: inline-block;
  margin-bottom: 26px;
  font-size: 0.92rem;
}

.post-summary {
  margin-top: 20px;
  color: var(--muted-text);
  font-size: 1.06rem;
}

.post-content {
  padding-top: 34px;
  color: var(--text);
  font-size: 1.04rem;
}

.post-content h2,
.post-content h3 {
  margin-top: 2em;
  margin-bottom: 0.55em;
}

.post-content p,
.post-content ul,
.post-content ol,
.post-content figure,
.post-content blockquote,
.post-content pre {
  margin-bottom: 1.25em;
}

.post-content img {
  max-width: 100%;
  height: auto;
  border-radius: 12px;
}

.post-content figure {
  margin-left: 0;
  margin-right: 0;
}

.post-content figcaption {
  margin-top: 8px;
  color: var(--muted-text);
  font-size: 0.92rem;
  text-align: center;
}

.post-content code {
  padding: 0.12em 0.28em;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--code-bg);
  color: var(--code-text);
  font-size: 0.92em;
}

.post-content pre {
  overflow-x: auto;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--pre-bg);
  color: var(--pre-text);
}

.post-content pre code {
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
}

.post-content blockquote {
  margin-left: 0;
  padding-left: 18px;
  border-left: 3px solid var(--accent);
  color: var(--muted-text);
}

.post-back {
  margin-top: 44px;
}

.site-footer {
  padding: 30px 0 42px;
  border-top: 1px solid var(--border);
  color: var(--muted-text);
  font-size: 0.9rem;
}

@media (min-width: 980px) {
  .post-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .blog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .navbar {
    min-height: auto;
    align-items: flex-start;
    padding: 14px 0;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 26px;
    margin-top: 34px;
    margin-bottom: 44px;
    text-align: center;
  }

  .profile-photo {
    width: 164px;
    height: 164px;
    margin: 0 auto;
  }

  .button-row,
  .nav-links {
    justify-content: center;
  }

  .section-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }
}

@media (max-width: 520px) {
  .navbar,
  .content-shell,
  .site-footer {
    width: min(var(--max-width), calc(100% - 28px));
  }

  .navbar {
    flex-direction: column;
    gap: 8px;
  }

  .nav-links {
    gap: 12px;
  }

  .content-shell {
    padding-top: 28px;
  }

  h1 {
    font-size: 2.55rem;
  }

  .post-grid,
  .blog-grid {
    grid-template-columns: 1fr;
  }
}
