@font-face {
  font-family: Geist;
  src: url('../fonts/geist.woff2') format('woff2');
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: Outfit;
  src: url('../fonts/outfit.woff2') format('woff2');
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f8fafc;
  --surface: #fff;
  --ink: #0f172a;
  --muted: #475569;
  --line: #cbd5e1;
  --accent: #0284c7;
  --accent-strong: #0369a1;
  --tint: #e0f2fe;
  --width: 1160px;
  font-family: Geist, Arial, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --paper: #030705;
  --surface: #09140d;
  --ink: #f0f6f2;
  --muted: #a3b1a8;
  --line: #ffffff24;
  --accent: #5ee9a2;
  --accent-strong: #5ee9a2;
  --tint: #062417;
}

*,
*::before,
*::after { box-sizing: border-box; }

html { min-width: 320px; scroll-behavior: smooth; }
body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(ellipse 62% 34rem at 50% 0, color-mix(in srgb, var(--tint) 72%, transparent), transparent 100%),
    var(--paper);
  font-size: 1rem;
  line-height: 1.65;
}

a { color: var(--accent-strong); text-underline-offset: 4px; }
a:hover { text-decoration-thickness: 2px; }
button, a { -webkit-tap-highlight-color: transparent; }
::selection { color: var(--ink); background: var(--tint); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }

h1, h2, h3, h4 {
  margin: 0;
  color: var(--ink);
  font-family: Outfit, Geist, sans-serif;
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: -.03em;
}
p { margin: 0; color: var(--muted); }
img { display: block; max-width: 100%; }

.site-shell { display: flex; min-height: 100vh; flex-direction: column; }
.site-width { width: min(var(--width), calc(100% - 48px)); margin-inline: auto; }
#site-content { flex: 1; }
.skip-link {
  position: fixed;
  z-index: 20;
  top: 10px;
  left: 12px;
  padding: 10px 14px;
  transform: translateY(-160%);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
}
.skip-link:focus { transform: translateY(0); }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  position: sticky;
  z-index: 10;
  top: 0;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--paper) 94%, transparent);
  backdrop-filter: blur(14px);
}
.site-header__inner {
  display: flex;
  min-height: 76px;
  align-items: center;
  gap: 30px;
}
.brand {
  display: inline-flex;
  min-height: 44px;
  flex: none;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-family: Outfit, sans-serif;
  font-size: 1.2rem;
  font-weight: 650;
  text-decoration: none;
}
.brand img { width: 34px; height: 38px; object-fit: contain; }
.site-nav { display: flex; align-items: center; gap: clamp(16px, 3vw, 32px); margin-left: auto; }
.site-nav a, .site-footer__links a {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  color: var(--muted);
  font-size: .92rem;
  text-decoration: none;
}
.site-nav a:hover, .site-footer__links a:hover { color: var(--accent-strong); }
.theme-toggle {
  display: grid;
  width: 44px;
  height: 44px;
  flex: none;
  place-items: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: var(--surface);
  cursor: pointer;
}
.theme-toggle svg { width: 19px; height: 19px; }
.theme-sun, .theme-rays, .theme-moon { stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.theme-sun { fill: none; }
.theme-rays { opacity: 1; }
.theme-moon { display: none; fill: none; }
:root[data-theme='dark'] .theme-sun, :root[data-theme='dark'] .theme-rays { display: none; }
:root[data-theme='dark'] .theme-moon { display: block; }

.journal-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding-block: clamp(64px, 10vw, 124px) clamp(50px, 8vw, 90px);
  text-align: center;
}
.journal-hero__mark { display: grid; width: 76px; height: 82px; place-items: center; }
.journal-hero__mark img { width: 72px; height: 79px; object-fit: contain; }
.journal-hero > div { width: min(100%, 760px); }
.journal-hero h1, .archive-heading h1 {
  max-width: 13ch;
  font-size: clamp(2.7rem, 6vw, 5rem);
  letter-spacing: -.045em;
}
.journal-hero h1 { margin-inline: auto; }
.journal-hero p, .archive-heading p { max-width: 52ch; margin-top: 18px; font-size: 1.06rem; }
.journal-hero p { margin-inline: auto; }

.journal { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 48px 28px; padding-bottom: 88px; }
.featured-post {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr);
  align-items: center;
  gap: clamp(28px, 6vw, 76px);
  padding-block: 26px 54px;
  border-top: 2px solid var(--accent);
}
.featured-post__media, .post-card__media {
  display: grid;
  overflow: hidden;
  aspect-ratio: 1.55;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--tint);
}
.featured-post__media img, .post-card__media > img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.featured-post__media:hover img, .post-card__media:hover > img { transform: scale(1.025); }
.image-placeholder { display: grid; width: 100%; height: 100%; place-items: center; background: radial-gradient(ellipse at 50% 40%, color-mix(in srgb, var(--accent) 14%, var(--surface)), var(--tint)); }
.image-placeholder img { width: 64px; height: 70px; opacity: .9; }
.featured-post__copy { max-width: 510px; }
.post-category {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  margin-bottom: 12px;
  color: var(--accent-strong);
  font-size: .82rem;
  font-weight: 650;
  text-decoration: none;
}
.featured-post h2 { font-size: clamp(2rem, 3.4vw, 3rem); }
.featured-post h2 a, .post-card h2 a { color: var(--ink); text-decoration: none; }
.featured-post h2 a:hover, .post-card h2 a:hover { color: var(--accent-strong); }
.featured-post__copy > p { margin-top: 15px; }
.post-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; margin-top: 17px; color: var(--muted); font-size: .82rem; }
.text-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  color: var(--accent-strong);
  font-size: .92rem;
  font-weight: 620;
  text-decoration: none;
}
.text-link span { transition: transform .18s ease; }
.text-link:hover span { transform: translateX(3px); }
.post-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 48px 28px;
  padding-bottom: 88px;
}
.post-grid .post-card { min-width: 0; }
.post-card__media { margin-bottom: 18px; aspect-ratio: 1.55; }
.post-card__media .image-placeholder img { width: 50px; height: 55px; }
.post-card__copy h2 { font-size: clamp(1.35rem, 2vw, 1.75rem); }
.post-card__copy > p { margin-top: 10px; font-size: .92rem; }
.post-card .post-category { margin-bottom: 7px; }
.post-card .post-meta { margin-top: 13px; }
.empty-state { display: grid; grid-column: 1 / -1; justify-items: center; padding: 70px 24px 100px; text-align: center; }
.empty-state img { margin-bottom: 17px; }
.empty-state h2 { font-size: 1.8rem; }
.empty-state p { margin-top: 8px; }

.archive-heading { padding-block: 64px 42px; }
.back-link {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  margin-bottom: 20px;
  color: var(--accent-strong);
  font-size: .9rem;
  font-weight: 600;
  text-decoration: none;
}
.author-avatar { width: 64px; height: 64px; margin-bottom: 18px; border: 1px solid var(--line); border-radius: 50%; object-fit: cover; }
.empty-copy { grid-column: 1 / -1; }

.pagination {
  display: flex;
  grid-column: 1 / -1;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding-top: 26px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: .9rem;
}
.pagination a { display: inline-flex; min-height: 44px; align-items: center; font-weight: 600; text-decoration: none; }

.article-shell { width: min(100% - 48px, 820px); margin: 0 auto; padding-block: 50px 96px; }
.article-header { width: min(100%, 720px); margin-inline: auto; }
.article-header .back-link { margin-bottom: 30px; }
.article-header .post-category { display: flex; width: fit-content; margin-bottom: 10px; }
.article-header h1 { max-width: 17ch; font-size: clamp(2.55rem, 6vw, 4.6rem); letter-spacing: -.045em; }
.article-excerpt { margin-top: 18px; font-size: 1.14rem; line-height: 1.6; }
.post-meta--article { margin-top: 22px; }
.article-feature-image { margin: 42px 0 0; }
.article-feature-image img { width: 100%; max-height: 560px; border: 1px solid var(--line); border-radius: 16px; object-fit: cover; }
.article-feature-image figcaption { margin-top: 10px; color: var(--muted); font-size: .82rem; text-align: center; }
.article-content { width: min(100%, 680px); margin: 48px auto 0; color: var(--ink); font-size: 1.06rem; line-height: 1.85; overflow-wrap: anywhere; }
.article-content > * + * { margin-top: 1.4em; }
.article-content h2, .article-content h3, .article-content h4 { margin-top: 2.1em; line-height: 1.2; }
.article-content h2 { font-size: clamp(1.8rem, 4vw, 2.4rem); }
.article-content h3 { font-size: 1.55rem; }
.article-content h4 { font-size: 1.2rem; }
.article-content p, .article-content li { color: var(--ink); }
.article-content ul, .article-content ol { padding-left: 1.35em; }
.article-content li + li { margin-top: .45em; }
.article-content blockquote { margin-inline: 0; padding: 8px 0 8px 22px; border-left: 2px solid var(--accent); color: var(--muted); }
.article-content blockquote p { color: inherit; }
.article-content hr { width: 100%; border: 0; border-top: 1px solid var(--line); }
.article-content img { height: auto; margin-inline: auto; border-radius: 12px; }
.article-content figcaption { color: var(--muted); font-size: .84rem; text-align: center; }
.article-content pre { overflow-x: auto; padding: 18px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--surface); font-size: .88rem; line-height: 1.6; }
.article-content code { padding: .15em .35em; border-radius: 4px; background: var(--tint); font-size: .9em; }
.article-content pre code { padding: 0; background: transparent; }
.article-content table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.article-content th, .article-content td { padding: 10px 12px; border: 1px solid var(--line); text-align: left; }
.article-content th { background: var(--tint); }
.article-content iframe { max-width: 100%; }
.article-content .kg-embed-card, .article-content .kg-video-card { width: 100%; }
.article-content .kg-width-wide { width: min(960px, calc(100vw - 48px)); max-width: none; margin-left: 50%; transform: translateX(-50%); }
.article-content .kg-width-full { width: 100vw; max-width: none; margin-left: 50%; transform: translateX(-50%); }
.article-content .kg-gallery-container { width: 100%; }
.article-content .kg-gallery-row { display: flex; gap: 8px; }
.article-content .kg-gallery-image img { width: 100%; height: 100%; object-fit: cover; }
.article-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; width: min(100%, 680px); margin: 42px auto 0; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: .86rem; }
.article-tags a { display: inline-flex; min-height: 36px; align-items: center; padding: 0 11px; border: 1px solid var(--line); border-radius: 999px; text-decoration: none; }

.error-page { display: grid; min-height: 55vh; justify-items: center; align-content: center; padding-block: 60px; text-align: center; }
.error-page img { margin-bottom: 12px; }
.error-code { color: var(--accent-strong); font-size: .9rem; font-weight: 650; }
.error-page h1 { margin-top: 5px; font-size: clamp(2.2rem, 6vw, 4rem); }
.button-link { display: inline-flex; min-height: 48px; align-items: center; justify-content: center; margin-top: 24px; padding: 0 19px; border: 1px solid var(--ink); border-radius: 10px; color: var(--paper); background: var(--ink); font-weight: 620; text-decoration: none; }
.button-link:hover { color: var(--paper); background: var(--accent-strong); border-color: var(--accent-strong); }

.site-footer { border-top: 1px solid var(--line); background: color-mix(in srgb, var(--paper) 82%, var(--tint)); }
.site-footer__inner { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 7px 28px; padding-block: 24px; }
.brand--footer { font-size: 1rem; }
.brand--footer img { width: 27px; height: 30px; }
.site-footer p { font-size: .86rem; }
.site-footer__links { display: flex; align-items: center; gap: 18px; }
.site-footer__links a { min-height: 38px; font-size: .84rem; }
.site-footer small { grid-column: 1 / -1; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: .76rem; }

@media (max-width: 800px) {
  .journal-hero { gap: 16px; }
  .journal-hero__mark, .journal-hero__mark img { width: 60px; height: 66px; }
  .journal { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 38px 22px; }
  .featured-post { grid-template-columns: 1fr; gap: 23px; }
  .featured-post__copy { max-width: 680px; }
  .post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 38px 22px; }
  .site-footer__inner { grid-template-columns: 1fr auto; }
  .site-footer p { grid-column: 1 / -1; grid-row: 2; }
  .site-footer__links { grid-column: 2; grid-row: 1; }
}

@media (max-width: 560px) {
  .site-width { width: min(var(--width), calc(100% - 40px)); }
  .site-header__inner { min-height: 66px; gap: 12px; }
  .brand { gap: 7px; font-size: 1.05rem; }
  .brand img { width: 29px; height: 33px; }
  .site-nav { gap: 10px; }
  .site-nav a { font-size: .78rem; }
  .theme-toggle { width: 40px; height: 40px; }
  .journal-hero { gap: 12px; padding-block: 55px 42px; }
  .journal-hero__mark, .journal-hero__mark img { width: 54px; height: 60px; }
  .journal-hero h1, .archive-heading h1 { font-size: clamp(2.4rem, 11vw, 3.35rem); }
  .journal-hero p, .archive-heading p { margin-top: 12px; font-size: .98rem; }
  .journal { padding-bottom: 58px; }
  .journal { grid-template-columns: 1fr; gap: 32px; }
  .featured-post { gap: 18px; padding-bottom: 40px; }
  .featured-post h2 { font-size: 2rem; }
  .post-grid { grid-template-columns: 1fr; gap: 32px; padding-bottom: 58px; }
  .post-card__media { margin-bottom: 13px; }
  .post-card__copy h2 { font-size: 1.55rem; }
  .archive-heading { padding-block: 44px 28px; }
  .article-shell { width: calc(100% - 40px); padding-block: 32px 66px; }
  .article-header .back-link { margin-bottom: 22px; }
  .article-header h1 { font-size: clamp(2.45rem, 11vw, 3.4rem); }
  .article-excerpt { font-size: 1rem; }
  .article-feature-image { margin-top: 30px; }
  .article-feature-image img { border-radius: 11px; }
  .article-content { margin-top: 34px; font-size: 1rem; line-height: 1.8; }
  .article-content table { display: block; overflow-x: auto; white-space: nowrap; }
  .site-footer__inner { gap: 6px 14px; padding-block: 20px; }
  .site-footer__links { gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
