/* layout.css — top nav, page shell, footer, responsive */

.topnav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0.85rem 1.75rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border-soft);
}
@supports (backdrop-filter: blur(6px)) {
  .topnav {
    background: color-mix(in srgb, var(--bg) 86%, transparent);
    backdrop-filter: saturate(160%) blur(8px);
    -webkit-backdrop-filter: saturate(160%) blur(8px);
  }
}

.topnav .brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--fg-strong);
}
.topnav .brand:hover { text-decoration: none; }
.topnav .brand svg { display: block; }

.topnav .nav-links {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}

.topnav .nav-link {
  padding: 0.45rem 0.85rem;
  border-radius: var(--r-md);
  font-size: 0.9rem;
  color: var(--fg-muted);
  font-weight: 500;
}
.topnav .nav-link:hover { background: var(--bg-elev); color: var(--fg); text-decoration: none; }
.topnav .nav-link.active { background: var(--accent-soft); color: var(--fg-strong); }

.topnav .nav-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.topnav .gh-link {
  color: var(--fg-muted);
  font-size: 0.85rem;
  padding: 0.35rem;
}
.topnav .gh-link:hover { color: var(--fg); text-decoration: none; }

main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem 1.75rem 3rem;
}

footer {
  border-top: 1px solid var(--border-soft);
  padding: 2rem 1.5rem 3rem;
  text-align: center;
  color: var(--fg-muted);
  font-size: 0.82rem;
}
footer a { color: var(--fg-muted); border-bottom: 1px solid transparent; }
footer a:hover { color: var(--fg); border-bottom-color: var(--fg); text-decoration: none; }

/* Page section spacing */
.section {
  margin-bottom: 3.5rem;
}
.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border-soft);
}
.section-header .section-title {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}
.section-header h2 {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--fg-strong);
  letter-spacing: -0.015em;
  line-height: 1.15;
}
.section-header .section-sub {
  color: var(--fg-muted);
  font-size: 0.92rem;
  line-height: 1.45;
  text-align: right;
  flex: 0 1 auto;
}

/* Loading + empty states */
.state {
  padding: 3rem 1rem;
  text-align: center;
  color: var(--fg-muted);
  font-size: 0.95rem;
}
.state .state-icon {
  font-size: 1.6rem;
  color: var(--fg-faint);
  display: block;
  margin-bottom: 0.5rem;
}

/* Generic grid helpers */
.grid {
  display: grid;
  gap: 1.25rem;
}
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 980px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
  .topnav { padding: 0.6rem 1rem; gap: 0.5rem; flex-wrap: wrap; }
  .topnav .nav-link { padding: 0.35rem 0.55rem; font-size: 0.82rem; }
  main { padding: 1rem; }
  .hide-mobile { display: none !important; }
}
/* Phone-sized viewports — once we drop below ~480px the brand wordmark
   and the 4-link nav can't share a single row.  Hide the wordmark and
   GitHub link so the four primary destinations still fit on one line,
   and let the link strip shrink-to-fit. */
@media (max-width: 480px) {
  .topnav { padding: 0.55rem 0.65rem; gap: 0.35rem; flex-wrap: nowrap; }
  .topnav .brand span { display: none; }
  .topnav .nav-links { flex: 1 1 auto; min-width: 0; justify-content: flex-end; }
  .topnav .nav-link { padding: 0.3rem 0.45rem; font-size: 0.78rem; }
  .topnav .nav-right { display: none; }
  main { padding: 0.85rem 0.75rem 2rem; }
}
