:root {
  --font: 'Space Grotesk', ui-sans-serif, system-ui, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif;
  --touch: 44px;
  --prose: 40rem;
  --max: 72rem;
  color-scheme: dark;
  --bg: #050a08;
  --bg-deep: #030705;
  --surface: #0c1410;
  --elevated: #121c17;
  --text: #f6f8f4;
  --muted: #a8b5a4;
  --cool: #72c266;
  --cool-dim: rgba(114, 194, 102, 0.12);
  --on-primary: #07130b;
  --line: rgba(246, 248, 244, 0.12);
  --header-bg: rgba(5, 10, 8, 0.94);
  --link: #72c266;
  --card: #0c1410;
}

[data-guide-theme='dark'] {
  color-scheme: dark;
  --bg: #050a08;
  --bg-deep: #030705;
  --surface: #0c1410;
  --elevated: #121c17;
  --text: #f6f8f4;
  --muted: #a8b5a4;
  --cool: #72c266;
  --cool-dim: rgba(114, 194, 102, 0.12);
  --on-primary: #07130b;
  --line: rgba(246, 248, 244, 0.12);
  --header-bg: rgba(5, 10, 8, 0.94);
  --link: #72c266;
  --card: #0c1410;
}

[data-guide-theme='light'] {
  color-scheme: light;
  --bg: #f6f8f4;
  --bg-deep: #ffffff;
  --surface: #eef2ed;
  --elevated: #e4ebe2;
  --text: #050a08;
  --muted: #4a5b4a;
  --cool: #3f8f4e;
  --cool-dim: rgba(63, 143, 78, 0.12);
  --on-primary: #07130b;
  --line: rgba(5, 10, 8, 0.12);
  --header-bg: rgba(246, 248, 244, 0.94);
  --link: #2d7340;
  --card: #ffffff;
}

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

html {
  scroll-behavior: smooth;
  font-size: 17px;
}

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

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

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

:focus-visible {
  outline: 2px solid var(--cool);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
}

.skip:focus {
  left: 1rem;
  top: 1rem;
  z-index: 80;
  background: var(--elevated);
  padding: 0.5rem 0.75rem;
}

.wrap {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
}

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

.header-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 4rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}

.brand:hover {
  text-decoration: none;
}

.brand img {
  width: 132px;
  height: auto;
}

[data-guide-theme='light'] .site-header {
  background-color: #3f8f4e;
  border-bottom-color: rgba(246, 248, 244, 0.2);
}

[data-guide-theme='light'] .header-nav a,
[data-guide-theme='light'] .header-nav-mobile a {
  color: #f6f8f4;
}

[data-guide-theme='light'] .theme-toggle {
  border-color: #f6f8f4;
  color: #f6f8f4;
}

[data-guide-theme='light'] .theme-toggle:hover {
  background: rgba(246, 248, 244, 0.12);
}

[data-guide-theme='light'] .header-actions .btn {
  background: #f6f8f4;
  color: #07130b;
}

[data-guide-theme='light'] .header-actions .btn:hover {
  filter: none;
  background: #eef2ed;
}

.header-nav {
  display: none;
  gap: 1.25rem;
  margin-left: 0.5rem;
}

.header-nav a {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 1 1 auto;
  min-width: 0;
  justify-content: flex-end;
}

.header-actions .search {
  flex: 1 1 10rem;
  max-width: 16rem;
  min-width: 7.5rem;
  margin: 0;
}

.header-actions .search input {
  min-height: 2.5rem;
}

[data-guide-theme='light'] .header-actions .search {
  background: rgba(246, 248, 244, 0.16);
  border-color: rgba(246, 248, 244, 0.45);
}

[data-guide-theme='light'] .header-actions .search input,
[data-guide-theme='light'] .header-actions .search svg {
  color: #f6f8f4;
}

[data-guide-theme='light'] .header-actions .search input::placeholder {
  color: rgba(246, 248, 244, 0.72);
}

.icon-btn,
.theme-toggle {
  width: var(--touch);
  height: var(--touch);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}

.theme-toggle {
  border-radius: 50%;
}

.theme-toggle #icon-moon {
  display: none;
}

[data-guide-theme='light'] .theme-toggle #icon-sun {
  display: none;
}

[data-guide-theme='light'] .theme-toggle #icon-moon {
  display: block;
}

.icon-btn:hover,
.theme-toggle:hover {
  background: var(--elevated);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--touch);
  padding: 0 1.1rem;
  background: var(--cool);
  color: var(--on-primary);
  font-weight: 650;
  font-size: 0.92rem;
  border: 0;
  border-radius: 1rem;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  text-decoration: none;
  filter: brightness(1.05);
}

.btn .ext {
  margin-left: 0.35rem;
  font-size: 0.85em;
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2.5rem;
  padding: 2rem 0 4rem;
}

@media (min-width: 900px) {
  .header-nav {
    display: flex;
  }

  .layout {
    grid-template-columns: 13.5rem minmax(0, 1fr);
    align-items: start;
    gap: 3rem;
  }
}

.rail {
  position: relative;
}

@media (min-width: 900px) {
  .rail {
    position: sticky;
    top: 5.25rem;
  }
}

.rail-title {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
  margin: 0 0 0.4rem;
}

.rail-tag {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.45;
}

.rail-kicker {
  font-size: 0.72rem;
  font-weight: 650;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.65rem;
}

.rail hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0 0 0.85rem;
}

.cat-nav {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

@media (max-width: 899px) {
  .cat-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 50px;
    row-gap: 8px;
  }

  .cat-nav a {
    margin: 0;
  }
}

.toc {
  list-style: disc;
  margin: 0;
  padding: 0 0 0 1.15rem;
  color: var(--muted);
}

.cat-nav a {
  display: flex;
  align-items: center;
  min-height: var(--touch);
  padding: 0.2rem 0.7rem;
  margin: 0 -0.7rem;
  color: var(--text);
  font-size: 0.95rem;
  border-radius: 12px;
}

.toc a {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}

.toc li + li {
  margin-top: 0.55rem;
}

.cat-nav a:hover {
  text-decoration: none;
  background: var(--elevated);
}

.toc a:hover {
  color: var(--text);
  text-decoration: none;
}

.cat-nav a.is-active {
  background: var(--elevated);
}

.toc a.is-active {
  color: var(--text);
  font-weight: 650;
}

.lede {
  color: var(--muted);
  max-width: 36rem;
  margin: 0.35rem 0 1.5rem;
  font-size: 1.05rem;
}

h1 {
  font-size: clamp(1.8rem, 3.2vw, 2.6rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 0 0.5rem;
}

.search {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 22rem;
  margin: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 0 0.9rem;
  border-radius: 999px;
  overflow: hidden;
}

.search input {
  flex: 1;
  min-height: var(--touch);
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  outline: none;
}

.search svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.feed {
  display: grid;
  gap: 2.5rem;
}

@media (min-width: 900px) {
  .feed {
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem 1.75rem;
  }

  .post-card--hero {
    grid-column: 1 / -1;
  }
}

.post-card {
  color: inherit;
  text-decoration: none;
}

.post-card:hover {
  text-decoration: none;
}

.post-card:hover .post-card-title {
  color: var(--link);
}

.cover {
  width: 100%;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
  border-radius: 12px;
  background: var(--elevated);
  margin-bottom: 0.9rem;
}

.article-hero {
  padding-top: 2rem;
}

.article-hero .cover {
  margin-bottom: 0;
}

.article-hero + .layout {
  padding-top: 0.9rem;
}

[data-guide-theme='light'] .cover {
  border: 1px solid var(--line);
}

.post-card--hero .cover {
  aspect-ratio: 2 / 1;
}

.meta {
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.4rem;
}

.post-card-title {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.4rem;
  color: var(--text);
}

.excerpt {
  margin: 0;
  color: var(--muted);
  font-size: 0.98rem;
}

.empty {
  color: var(--muted);
  margin: 0;
}

.article-head .cover {
  margin: 0 0 1.25rem;
}

.article-head .meta {
  text-transform: none;
  letter-spacing: 0.02em;
  font-weight: 550;
}

.byline {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0.75rem 0 0;
}

.byline strong {
  color: var(--text);
  font-weight: 650;
}

.role {
  margin: 0.15rem 0 1.5rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.prose {
  max-width: var(--prose);
}

.prose h2 {
  font-size: 1.25rem;
  margin: 2rem 0 0.6rem;
  letter-spacing: -0.02em;
  scroll-margin-top: 5.5rem;
}

.prose h3 {
  font-size: 1.05rem;
  font-weight: 650;
  margin: 1.35rem 0 0.45rem;
  scroll-margin-top: 5.5rem;
}

.prose p {
  margin: 0 0 1rem;
}

.prose img {
  width: 100%;
  height: auto;
  border-radius: 12px;
  margin: 0.35rem 0 1.15rem;
  background: var(--elevated);
}

.related {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  max-width: var(--prose);
}

.related h2 {
  font-size: 1rem;
  margin: 0 0 0.75rem;
}

.related-card {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.75rem 0;
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}

.related-card:hover {
  text-decoration: none;
}

.related-card .post-card-title {
  font-size: 1.05rem;
}

.site-footer {
  background: var(--bg-deep);
  border-top: 1px solid var(--line);
  padding: 2.5rem 0 1.5rem;
}

.promo-grid {
  display: grid;
  gap: 0.85rem;
  margin-bottom: 2.5rem;
}

@media (min-width: 800px) {
  .promo-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.promo {
  background: var(--surface);
  padding: 1.15rem 1.15rem 1rem;
  display: flex;
  flex-direction: column;
  min-height: 8.25rem;
  color: inherit;
  text-decoration: none;
  border-radius: 12px;
}

.promo:hover {
  text-decoration: none;
  background: var(--elevated);
}

.promo h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}

.promo p {
  margin: 0 0 0.9rem;
  color: var(--muted);
  font-size: 0.9rem;
  flex: 1;
}

.promo-go {
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--link);
}

.foot-mid {
  display: grid;
  gap: 1.5rem;
  padding: 1.5rem 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

@media (min-width: 800px) {
  .foot-mid {
    grid-template-columns: auto 1fr;
    align-items: start;
  }

  .foot-cols {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
  }
}

@media (max-width: 799px) {
  .foot-cols {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
  }

  .foot-cols > div {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 1rem;
  }

  .foot-cols h4 {
    grid-column: 1 / -1;
  }
}

.foot-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  justify-self: start;
  color: var(--text);
}

.foot-brand:hover {
  text-decoration: none;
}

.foot-brand img {
  width: 86px;
  height: 86px;
  display: block;
  object-fit: contain;
}

.foot-cols h4 {
  margin: 0 0 0.6rem;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.foot-cols a {
  display: block;
  color: var(--text);
  font-size: 0.92rem;
  padding: 0.2rem 0;
  min-height: 2rem;
}

.foot-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
  justify-content: space-between;
  padding-top: 1.15rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.foot-legal {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
}

.social {
  display: flex;
  gap: 0.35rem;
}

.social a {
  width: 2.5rem;
  height: 2.5rem;
  display: grid;
  place-items: center;
  color: var(--muted);
}

.social a:hover {
  color: var(--text);
}

.search-hit[hidden],
#search-empty[hidden] {
  display: none !important;
}

.header-nav-mobile {
  display: none;
}

@media (max-width: 899px) {
  .header-nav-mobile {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 1rem;
    padding: 0 0 0.85rem;
  }

  .header-nav-mobile a {
    color: var(--text);
    font-size: 0.9rem;
  }
}
