/* ============================================================================
   Awesome Beef — static site stylesheet
   Nerdy-inspired, dark-only, mobile-first. No build step, no dependencies.
   ========================================================================== */

/* ---------------------------------------------------------------------------
   Design tokens (derived from the nerdy theme's `.dark` palette)
   --------------------------------------------------------------------------- */
:root {
  --background: oklch(0.145 0 0);
  --foreground: oklch(0.985 0 0);
  --muted: oklch(0.269 0 0);
  --muted-foreground: oklch(0.708 0 0);
  --border: rgb(255 255 255 / 10%);
  --border-strong: rgb(255 255 255 / 16%);
  --card: oklch(0.205 0 0);
  --card-foreground: oklch(0.985 0 0);
  --surface: oklch(0.155 0.045 265.08);
  --surface-muted: oklch(0.205 0.045 265.08);
  --surface-elevated: oklch(0.23 0.04 265.08);

  --accent-cyan: oklch(0.865 0.127 207.078);
  --accent-purple: oklch(0.827 0.119 306.383);
  --accent-emerald: oklch(0.845 0.143 164.978);
  --accent-amber: oklch(0.905 0.182 98.111);

  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;

  --radius: 0.75rem;
  --radius-lg: 1rem;
  --max-width: 80rem;

  --shadow-card: 0 20px 40px rgb(0 0 0 / 25%);
  --shadow-glow: 0 0 10px rgb(34 211 238 / 55%);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 6rem;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--background);
  color: var(--foreground);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a {
  color: inherit;
}

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

::selection {
  background: rgb(34 211 238 / 25%);
  color: #fff;
}

/* Slim, themed scrollbar (matches the nerdy aesthetic) */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: oklch(0.446 0.043 257.281);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: oklch(0.554 0.046 257.417);
}

/* ---------------------------------------------------------------------------
   Page surface: grid + ambient gradients + top glow (the nerdy background)
   --------------------------------------------------------------------------- */
.page-surface {
  position: relative;
  isolation: isolate;
  min-height: 100vh;
  overflow-x: clip;
  background-color: var(--surface);
  background-image:
    linear-gradient(to right, rgb(51 65 85 / 20%) 1px, transparent 1px),
    linear-gradient(to bottom, rgb(51 65 85 / 20%) 1px, transparent 1px);
  background-size: 40px 40px;
}

.ambient-bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 50% 0%, rgb(34 211 238 / 16%), transparent 28rem),
    radial-gradient(circle at 78% 12%, rgb(99 102 241 / 16%), transparent 30rem),
    radial-gradient(circle at 16% 22%, rgb(217 70 239 / 10%), transparent 24rem);
}

.top-glow {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: -1;
  width: 100%;
  max-width: 56rem;
  height: 16rem;
  transform: translateX(-50%);
  background: rgb(34 211 238 / 10%);
  filter: blur(110px);
  pointer-events: none;
}

/* ---------------------------------------------------------------------------
   Skip link (accessibility)
   --------------------------------------------------------------------------- */
.skip-link {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  border: 1px solid rgb(34 211 238 / 50%);
  border-radius: 0.5rem;
  background: var(--background);
  color: var(--foreground);
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 10px 20px rgb(0 0 0 / 40%);
  transform: translateY(-200%);
  transition: transform 150ms ease;
}
.skip-link:focus {
  transform: translateY(0);
}

/* ---------------------------------------------------------------------------
   Mobile top bar
   --------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  background: rgb(2 6 23 / 80%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.site-title {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--foreground);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 2.5rem;
  height: 2.5rem;
  padding: 0.5rem;
  border: 1px solid var(--border-strong);
  border-radius: 0.5rem;
  background: transparent;
  cursor: pointer;
}
.nav-toggle-bar {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: var(--foreground);
  transition: transform 150ms ease, opacity 150ms ease;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ---------------------------------------------------------------------------
   Layout: single column on mobile, two columns on desktop
   --------------------------------------------------------------------------- */
.layout {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

@media (min-width: 1024px) {
  .layout {
    flex-direction: row;
    align-items: flex-start;
    gap: 2rem;
    padding: 2rem 1.5rem;
  }
  .site-header {
    display: none;
  }
}

/* ---------------------------------------------------------------------------
   Sidebar / TOC (off-canvas drawer on mobile, sticky column on desktop)
   --------------------------------------------------------------------------- */
.sidebar {
  flex: 0 0 16rem;
  width: 16rem;
  max-width: calc(100vw - 3rem);
}

/* Mobile: fixed off-canvas drawer */
@media (max-width: 1023px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 60;
    width: 17rem;
    max-width: 85vw;
    padding: 1rem;
    background: var(--background);
    border-right: 1px solid var(--border);
    transform: translateX(-100%);
    transition: transform 250ms ease;
    overflow-y: auto;
  }
  .sidebar.is-open {
    transform: translateX(0);
    box-shadow: 20px 0 40px rgb(0 0 0 / 50%);
  }
}

.sidebar-card {
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: rgb(30 41 59 / 40%);
  padding: 1rem;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

@media (min-width: 1024px) {
  .sidebar {
    position: sticky;
    top: 2rem;
    isolation: isolate;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    transform: translate3d(0, 0, 0);
  }
  .sidebar-card {
    padding: 1.25rem;
  }
}

.sidebar-brand {
  padding-bottom: 0.75rem;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.sidebar-title {
  font-family: var(--font-mono);
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.2;
}

.sidebar-description {
  margin: 0.75rem 0 0;
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

.toc-heading {
  margin: 0 0 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--muted-foreground);
}

/* TOC list */
.toc {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-sublist {
  list-style: none;
  margin: 0;
  padding: 0;
}

.toc-item {
  margin: 0;
}

.toc-row {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  border-radius: 0.5rem;
}

.toc-title {
  flex: 1 1 auto;
  min-width: 0;
  padding: 0.3rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  text-decoration: none;
  border-radius: 0.5rem;
  transition: background-color 150ms ease, color 150ms ease;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.toc-title:hover {
  background: rgb(30 41 59 / 70%);
  color: var(--foreground);
}

/* Depth indentation */
.toc-sublist .toc-title {
  padding-left: 1.25rem;
}
.toc-sublist .toc-sublist .toc-title {
  padding-left: 2.25rem;
}
.toc-sublist .toc-sublist .toc-sublist .toc-title {
  padding-left: 3.25rem;
}

/* Active (scroll-spy) state */
.toc-title.is-active {
  color: var(--foreground);
  font-weight: 700;
  background: rgb(34 211 238 / 12%);
}

/* Collapse toggle (chevron) */
.toc-toggle {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  border: none;
  border-radius: 0.25rem;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 0.625rem;
  cursor: pointer;
  transition: transform 150ms ease, color 150ms ease;
}
.toc-toggle:hover {
  color: var(--accent-cyan);
}
.toc-toggle .chevron {
  display: inline-block;
  transition: transform 150ms ease;
}
.toc-toggle[aria-expanded="false"] .chevron {
  transform: rotate(-90deg);
}

/* Placeholder for items without children so titles stay aligned */
.toc-toggle--ghost {
  visibility: hidden;
}

/* Collapsed sublist */
.toc-sublist.is-collapsed {
  display: none;
}

/* ---------------------------------------------------------------------------
   Main content
   --------------------------------------------------------------------------- */
.content {
  flex: 1 1 auto;
  min-width: 0;
}

.page-header {
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border-strong);
}

.page-title {
  margin: 0 0 0.75rem;
  font-family: var(--font-mono);
  font-size: clamp(1.75rem, 5vw, 2.5rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.page-description {
  max-width: 40rem;
  margin: 0 0 1rem;
  font-size: 0.9375rem;
  color: var(--muted-foreground);
}

.page-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}

.page-meta a {
  color: var(--accent-cyan);
  text-decoration: none;
}
.page-meta a:hover {
  text-decoration: underline;
}

.badge-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.6rem;
  border: 1px solid rgb(34 211 238 / 30%);
  border-radius: 999px;
  background: rgb(34 211 238 / 10%);
  color: var(--accent-cyan);
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  text-decoration: none;
}
.badge-chip:hover {
  background: rgb(34 211 238 / 18%);
}

/* ---------------------------------------------------------------------------
   Category sections & headings
   --------------------------------------------------------------------------- */
.category {
  margin-bottom: 3rem;
}

.section-title {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin: 0 0 1rem;
  font-family: var(--font-mono);
  font-weight: 700;
  line-height: 1.25;
  scroll-margin-top: 6rem;
}

.section-title .marker {
  font-weight: 700;
  color: rgb(103 232 249 / 70%);
}

/* << Title >> bracket treatment for top-level sections */
.section-title .bracket {
  color: rgb(253 224 71 / 80%);
  font-weight: 700;
}

.category.depth-0 > .section-title {
  font-size: 1.375rem;
}
.category.depth-1 > .section-title {
  font-size: 1.125rem;
}
.category.depth-2 > .section-title {
  font-size: 1rem;
}

.category-description {
  margin: -0.5rem 0 1rem;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-style: italic;
  color: var(--muted-foreground);
}

/* ---------------------------------------------------------------------------
   Cards
   --------------------------------------------------------------------------- */
.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

@media (min-width: 640px) {
  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 1rem 1.125rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: rgb(30 41 59 / 50%);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-card);
  transition: transform 200ms ease, border-color 200ms ease,
    background-color 200ms ease;
}
.card:hover {
  transform: translateY(-2px);
  background: rgb(30 41 59 / 70%);
}

/* Rotating accent borders so the grid stays visually varied (nerdy palette) */
.card.accent-0:hover {
  border-color: rgb(34 211 238 / 50%);
}
.card.accent-1:hover {
  border-color: rgb(217 70 239 / 50%);
}
.card.accent-2:hover {
  border-color: rgb(74 222 128 / 50%);
}
.card.accent-3:hover {
  border-color: rgb(253 224 71 / 50%);
}

.card-title {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
}

.card-title a {
  color: var(--foreground);
  text-decoration: none;
  transition: color 150ms ease;
}
.card-title a:hover {
  color: var(--accent-cyan);
}
.card-title a::after {
  content: " ↗";
  font-size: 0.75rem;
  color: var(--muted-foreground);
}

.card-description {
  margin: 0;
  font-size: 0.875rem;
  color: var(--muted-foreground);
}

/* Divider between card body and footer */
.card-divider {
  height: 1px;
  margin: 0.25rem 0;
  background: var(--border);
}

/* Card footer: repo link (left) + tags (right) */
.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: auto;
}

.card-repo {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  text-decoration: none;
  transition: color 150ms ease;
}
.card-repo:hover {
  color: var(--accent-cyan);
}
.card-repo .github-icon {
  width: 0.9rem;
  height: 0.9rem;
  flex: 0 0 auto;
  fill: currentColor;
}
.card-repo-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Tags */
.tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.375rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.tag {
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--border-strong);
  border-radius: 0.375rem;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
  background: rgb(2 6 23 / 40%);
}

.deprecated {
  align-self: flex-start;
  padding: 0.1rem 0.5rem;
  border: 1px solid rgb(253 224 71 / 35%);
  border-radius: 0.375rem;
  font-family: var(--font-mono);
  font-size: 0.625rem;
  color: var(--accent-amber);
  background: rgb(253 224 71 / 10%);
}

/* Notes (sub-links on a card) */
.notes {
  list-style: none;
  margin: 0;
  padding: 0.5rem 0 0;
  border-top: 1px solid var(--border);
}
.notes li {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
}
.notes a {
  color: var(--accent-purple);
  text-decoration: none;
}
.notes a:hover {
  text-decoration: underline;
}
.notes .note-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--muted-foreground);
}

/* Footer */
.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted-foreground);
}
.site-footer a {
  color: var(--accent-cyan);
  text-decoration: none;
}
.site-footer a:hover {
  text-decoration: underline;
}

/* ---------------------------------------------------------------------------
   Reduced motion
   --------------------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .card:hover {
    transform: none;
  }
}
