@import url("https://fonts.googleapis.com/css2?family=Lato:wght@400;500;600;700&display=swap");

:root {
  --bg: #f6f6f3;
  --panel: #ffffff;
  --text: #131313;
  --muted: #5f5f5f;
  --border: #dfdfdf;
  --accent: #111111;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

html {
  background-color: #f6f6f3;
}

body {
  min-height: 100vh;
  font-family: "Lato", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background-color: var(--bg);
  background: radial-gradient(circle at top, #fbfbf8 0%, var(--bg) 55%);
  line-height: 1.55;
}

html.dark-mode {
  background-color: #0d1117;
}

body.dark-mode {
  --bg: #0d1117;
  --panel: #121923;
  --text: #eef2f8;
  --muted: #a8b4c8;
  --border: #2f3948;
  --accent: #ffffff;
  background:
    radial-gradient(circle at top, rgba(25, 34, 48, 0.78) 0%, rgba(13, 17, 23, 0.9) 55%);
}

a {
  color: inherit;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.2rem 2rem;
  border-bottom: 1px solid rgba(20, 20, 20, 0.08);
  backdrop-filter: blur(8px);
  background: rgba(246, 246, 243, 0.9);
}

.site-header,
main {
  position: relative;
  z-index: 1;
}

body.dark-mode .site-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(13, 17, 23, 0.88);
}

.brand {
  font-size: 1.05rem;
  font-weight: 600;
  text-decoration: none;
  letter-spacing: 0.01em;
}

.brand-logo {
  display: block;
  height: 1.6rem;
  width: auto;
}

.top-nav {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-link {
  border: 0;
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  font: inherit;
  color: var(--text);
  padding: 0.35rem 0.4rem;
  font-weight: 500;
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--accent);
}

.nav-ball-link {
  padding: 0.2rem 0.35rem;
}

.nav-ball-toggle {
  appearance: none;
}

.nav-ball {
  display: block;
  height: 1.15em;
  width: auto;
}

.nav-mail-link {
  padding: 0.2rem 0.35rem;
}

.nav-mail-icon {
  display: block;
  height: 1.5rem;
  width: auto;
}

.dropdown {
  position: relative;
}

.dropdown-toggle::after {
  content: "▾";
  font-size: 0.72rem;
  margin-left: 0.35rem;
  vertical-align: middle;
}

.dropdown-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 0.45rem);
  min-width: 10rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.08);
  display: none;
  padding: 0.4rem;
}

.dropdown.open .dropdown-menu {
  display: block;
}

.dropdown-menu a {
  display: block;
  text-decoration: none;
  padding: 0.5rem 0.65rem;
  border-radius: 6px;
  font-size: 0.93rem;
}

.dropdown-menu a:hover,
.dropdown-menu a:focus-visible {
  background: #f1f1f1;
}

.home-main {
  max-width: 72rem;
  margin: 0 auto;
  padding: 8rem 2rem 5rem;
}

.hero {
  max-width: 44rem;
}

.hero h1 {
  font-size: clamp(2.8rem, 7vw, 5rem);
  line-height: 1;
  margin: 0 0 0.75rem;
  letter-spacing: -0.03em;
}

.hero p.hero-subtitle {
  margin: 0 0 2rem;
  color: var(--text);
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.hero p.hero-subtitle-main {
  font-size: 1.15rem;
}

.hero p.hero-subsection-title {
  margin: 1.25rem 0 0.45rem;
}

.hero p {
  color: #2a2a2a;
  margin: 0 0 1.1rem;
  font-size: 1.05rem;
}

.hero p a {
  text-decoration: none;
}

body.dark-mode .hero p {
  color: #d6deea;
}

.blog-main {
  max-width: 74rem;
  margin: 0 auto;
  padding: 4.2rem 2rem 5rem;
}

.blog-main h1 {
  font-size: clamp(2rem, 5vw, 3.3rem);
  letter-spacing: -0.02em;
  margin: 0 0 1.5rem;
}

.blog-intro {
  max-width: 48rem;
  color: var(--muted);
  margin-bottom: 2rem;
}

.pinned-posts {
  max-width: 52rem;
  margin-bottom: 2.2rem;
}

.pinned-main h2 {
  margin: 0.8rem 0 0.25rem;
  line-height: 1.2;
  font-size: clamp(1.45rem, 2.8vw, 2.1rem);
}
.pinned-main h2 a {
  text-decoration: none;
}

.pinned-meta {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.pinned-image {
  display: block;
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
  overflow: hidden;
}

.pinned-image-main {
  aspect-ratio: 16 / 9;
}

.pinned-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pinned-bg-codex {
  background: radial-gradient(circle at 30% 25%, #d5defd 0%, #7a8ff5 42%, #4a3ec7 100%);
}

.all-posts-heading {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--muted);
}

.post-table {
  width: 100%;
  border-collapse: collapse;
  border-top: 1px solid var(--border);
}

.post-row {
  border-bottom: 1px solid var(--border);
}

.post-table td {
  padding: 1.1rem 0.55rem;
  vertical-align: top;
}

.post-date {
  width: 10rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.post-category {
  width: 9.5rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.post-title a {
  text-decoration: none;
  font-weight: 600;
}

.post-title p {
  margin: 0.33rem 0 0;
  color: #404040;
  font-size: 0.95rem;
}

body.dark-mode .post-title p {
  color: #cfd8e7;
}

.article-page {
  max-width: 86rem;
  margin: 0 auto;
  padding: 4rem 2rem 5rem;
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(16rem, 1fr);
  gap: 2.6rem;
  align-items: start;
}

.article-content h1 {
  margin: 0 0 0.4rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-size: clamp(2rem, 4vw, 3.4rem);
}

.article-meta {
  margin: 0 0 1.8rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.article-content p {
  margin: 0 0 1rem;
  max-width: 70ch;
}

.article-content.article-content-wide {
  max-width: 76ch;
}

.article-hero-image {
  width: 100%;
  max-width: 46rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  margin: 0.4rem 0 1.6rem;
}

.article-content h2 {
  margin: 2.2rem 0 0.8rem;
  font-size: 1.35rem;
}

.article-content h3 {
  margin: 1.4rem 0 0.55rem;
  font-size: 1.06rem;
}

.article-content ul {
  margin: 0 0 1rem 1.25rem;
  max-width: 70ch;
}

.article-content li {
  margin-bottom: 0.4rem;
}

.article-content pre {
  margin: 0 0 1rem;
  padding: 0.8rem 0.95rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(120, 134, 160, 0.08);
  overflow-x: auto;
}

body.dark-mode .article-content pre {
  background: rgba(26, 35, 48, 0.8);
}

.article-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 0.92em;
}

.article-content sup a {
  text-decoration: none;
}

.footnotes {
  position: relative;
  border-left: 1px solid var(--border);
  padding-left: 1.2rem;
}

.footnotes h3 {
  margin: 0 0 1rem;
  font-size: 0.98rem;
  letter-spacing: 0.01em;
}

.footnote-list {
  list-style: decimal;
  padding-left: 1rem;
  margin: 0;
  color: #383838;
  font-size: 0.9rem;
}

body.dark-mode .footnote-list {
  color: #cfd8e7;
}

.footnote-list li {
  margin: 0 0 0.9rem;
}

.footnote-list.is-positioned {
  position: relative;
  min-height: 0;
}

.footnote-list.is-positioned li {
  position: absolute;
  left: 0;
  width: 100%;
  margin: 0;
}

.page-frame {
  max-width: 62rem;
  margin: 0 auto;
  padding: 5rem 2rem 4rem;
}

.page-frame h1 {
  margin: 0 0 0.8rem;
  font-size: clamp(2rem, 4vw, 3rem);
}

.page-frame p {
  color: #2b2b2b;
}

body.dark-mode .page-frame p {
  color: #d6deea;
}

@media (max-width: 920px) {
  .article-layout {
    grid-template-columns: 1fr;
    gap: 2rem;
  }

  .footnotes {
    position: static;
    border-left: 0;
    border-top: 1px solid var(--border);
    padding-left: 0;
    padding-top: 1rem;
  }

  .footnote-list.is-positioned li {
    position: static;
    width: auto;
    margin: 0 0 0.9rem;
  }
}

@media (max-width: 640px) {
  .site-header {
    padding: 1rem 1rem;
  }

  .top-nav {
    gap: 0.6rem;
  }

  .nav-link {
    padding: 0.2rem;
    font-size: 0.95rem;
  }

  .home-main,
  .blog-main,
  .article-page,
  .page-frame {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .post-date,
  .post-category {
    display: none;
  }
}
