:root {
  --bg: #0b0f10;
  --bg-grid-a: rgba(57, 255, 136, 0.025);
  --bg-grid-b: rgba(57, 255, 136, 0.018);
  --surface: #11181b;
  --surface-2: #162125;
  --text: #e6e6e6;
  --muted: #8b949e;
  --accent: #39ff88;
  --accent-warn: #f5b642;
  --danger: #ff4d4d;
  --border: #253238;
  --shadow: rgba(0, 0, 0, 0.3);
  --header-bg: rgba(11, 15, 16, 0.92);
  --terminal-bg: linear-gradient(180deg, rgba(22, 33, 37, 0.94), rgba(17, 24, 27, 0.96));
  --image-bg: #050708;
}

:root[data-theme="light"] {
  --bg: #f4f7f5;
  --bg-grid-a: rgba(26, 92, 57, 0.08);
  --bg-grid-b: rgba(26, 92, 57, 0.05);
  --surface: #ffffff;
  --surface-2: #eef4f1;
  --text: #17211d;
  --muted: #5e6b65;
  --accent: #118a4a;
  --accent-warn: #a96d00;
  --danger: #c73838;
  --border: #cbd8d2;
  --shadow: rgba(39, 57, 49, 0.16);
  --header-bg: rgba(244, 247, 245, 0.92);
  --terminal-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(238, 244, 241, 0.96));
  --image-bg: #e8efeb;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  background:
    linear-gradient(var(--bg-grid-a) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid-b) 1px, transparent 1px),
    var(--bg);
  background-size: 28px 28px;
}

a {
  color: inherit;
  text-decoration-color: rgba(57, 255, 136, 0.45);
  text-underline-offset: 0.18em;
}

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

.container {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.narrow {
  width: min(820px, calc(100% - 32px));
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -48px;
  z-index: 20;
  padding: 10px 12px;
  background: var(--accent);
  color: #041007;
}

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

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

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 66px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  text-decoration: none;
}

.brand-mark,
.eyebrow,
.card-kicker,
code,
pre {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

.brand-mark {
  color: var(--accent);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--muted);
  font-size: 14px;
}

.site-nav a {
  text-decoration: none;
}

.nav-toggle {
  display: none;
}

.nav-toggle,
.theme-toggle {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 6px;
}

.nav-toggle {
  padding: 9px 12px;
}

.theme-toggle {
  position: relative;
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  padding: 0;
  cursor: pointer;
}

.theme-icon {
  position: absolute;
  font-size: 20px;
  line-height: 1;
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.theme-icon-sun {
  opacity: 1;
}

.theme-icon-moon {
  opacity: 0;
  transform: rotate(-20deg) scale(0.7);
}

:root[data-theme="light"] .theme-icon-sun {
  opacity: 0;
  transform: rotate(20deg) scale(0.7);
}

:root[data-theme="light"] .theme-icon-moon {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.hero,
.page-hero {
  padding: 56px 0 28px;
}

.hero {
  position: relative;
  min-height: min(680px, calc(100vh - 66px));
  display: flex;
  align-items: center;
  overflow: hidden;
  background:
    linear-gradient(90deg, var(--bg) 0%, rgba(11, 15, 16, 0.96) 36%, rgba(11, 15, 16, 0.62) 70%, rgba(11, 15, 16, 0.76) 100%),
    url("/assets/img/homelabporn-hero.png") right center / min(56vw, 760px) auto no-repeat;
}

:root[data-theme="light"] .hero {
  background:
    linear-gradient(90deg, var(--bg) 0%, rgba(244, 247, 245, 0.95) 38%, rgba(244, 247, 245, 0.72) 72%, rgba(244, 247, 245, 0.86) 100%),
    url("/assets/img/homelabporn-hero.png") right center / min(56vw, 760px) auto no-repeat;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 720px);
  align-items: center;
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--accent);
  font-size: 13px;
}

h1,
h2,
h3,
p {
  overflow-wrap: break-word;
}

h1 {
  margin: 0;
  font-size: clamp(34px, 7vw, 82px);
  line-height: 0.96;
  letter-spacing: 0;
}

.hero h1 {
  max-width: 100%;
  overflow-wrap: normal;
  white-space: nowrap;
}

h2 {
  margin: 0;
  font-size: clamp(28px, 4vw, 44px);
  line-height: 1.05;
  letter-spacing: 0;
}

h3 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.hero-lead {
  color: var(--text);
  font-size: clamp(20px, 3vw, 28px);
  line-height: 1.28;
}

.hero-copy p:not(.eyebrow):not(.hero-lead),
.split-intro p,
.submit-band p {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
}

.button.primary {
  border-color: rgba(57, 255, 136, 0.7);
  background: var(--accent);
  color: #041007;
}

.terminal-preview,
.terminal-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--terminal-bg);
  box-shadow: 0 20px 80px var(--shadow);
}

.window-bar {
  display: flex;
  gap: 8px;
  padding: 14px;
  border-bottom: 1px solid var(--border);
}

.window-bar span {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--danger);
}

.window-bar span:nth-child(2) {
  background: var(--accent-warn);
}

.window-bar span:nth-child(3) {
  background: var(--accent);
}

pre {
  margin: 0;
  padding: 24px;
  white-space: pre-wrap;
  color: var(--accent);
  font-size: 15px;
  line-height: 1.8;
}

.section {
  padding: 44px 0;
}

.split-intro,
.submit-band {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  gap: 28px;
  align-items: start;
}

.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.post-grid,
.category-grid,
.submit-layout {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 16px;
}

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

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

.post-card,
.category-card,
.prose {
  padding: 22px;
}

.post-card {
  display: flex;
  min-height: 330px;
  flex-direction: column;
  gap: 14px;
}

.post-card p,
.category-card span,
.prose p,
.prose li,
.empty {
  color: var(--muted);
  line-height: 1.65;
}

.card-kicker {
  color: var(--accent-warn);
  font-size: 12px;
}

.metric-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.metric-row span {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 8px;
}

.metric-row.large {
  margin: 22px 0 12px;
  font-size: 14px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.tag {
  color: var(--accent);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 12px;
}

.read-link {
  margin-top: auto;
  font-weight: 700;
}

.source-note {
  color: var(--muted);
  font-size: 13px;
}

.category-card {
  display: grid;
  gap: 10px;
  text-decoration: none;
}

.category-card strong {
  font-size: 24px;
}

.submit-band {
  align-items: center;
  padding: 28px;
  border: 1px solid rgba(57, 255, 136, 0.3);
  border-radius: 8px;
  background: rgba(57, 255, 136, 0.06);
}

.submit-band .button {
  justify-self: end;
}

.page-hero {
  border-bottom: 1px solid var(--border);
}

.page-hero a {
  color: var(--accent);
}

.prose {
  font-size: 17px;
}

.prose h1 {
  font-size: clamp(32px, 5vw, 50px);
  margin-bottom: 22px;
}

.prose h2 {
  margin-top: 28px;
  font-size: 26px;
}

.prose h2:first-child {
  margin-top: 0;
}

.notice {
  border-left: 3px solid var(--accent-warn);
  padding-left: 14px;
}

.post-media {
  margin: 0 0 24px;
}

.post-media a {
  display: block;
}

.post-media img {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(76vh, 760px);
  object-fit: scale-down;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--image-bg);
}

.source-box {
  border-left: 3px solid var(--accent);
  padding: 10px 0 10px 14px;
  background: rgba(57, 255, 136, 0.04);
}

.site-footer {
  margin-top: 36px;
  border-top: 1px solid var(--border);
  color: var(--muted);
}

.footer-grid {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 28px 0;
}

.footer-grid p {
  max-width: 650px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-content: start;
}

@media (max-width: 900px) {
  .hero-grid,
  .split-intro,
  .submit-band,
  .submit-layout {
    grid-template-columns: 1fr;
  }

  .submit-band .button {
    justify-self: start;
  }

  .hero {
    min-height: auto;
    background:
      linear-gradient(180deg, rgba(11, 15, 16, 0.82) 0%, var(--bg) 72%),
      url("/assets/img/homelabporn-hero.png") center top / cover no-repeat;
  }

  :root[data-theme="light"] .hero {
    background:
      linear-gradient(180deg, rgba(244, 247, 245, 0.84) 0%, var(--bg) 72%),
      url("/assets/img/homelabporn-hero.png") center top / cover no-repeat;
  }
}

@media (max-width: 720px) {
  .header-inner {
    flex-wrap: wrap;
    padding: 12px 0;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .theme-toggle {
    margin-left: auto;
  }

  .site-nav {
    display: none;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
  }

  .site-nav.is-open {
    display: flex;
  }

  .site-nav a {
    padding: 12px 0;
    border-top: 1px solid var(--border);
  }

  .hero,
  .page-hero {
    padding: 44px 0 28px;
  }

  .hero h1 {
    white-space: normal;
  }

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

  .post-card {
    min-height: 0;
  }

  .footer-grid {
    flex-direction: column;
  }
}
