/* ==========================================================================
   Abliterlitics — Forensic Noir Theme
   Deep navy + teal accent. CSS-only. No framework.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Variables
   -------------------------------------------------------------------------- */
:root {
  /* Deep navy-black base with warm undertone */
  --bg-primary: #0a0e17;
  --bg-secondary: #111827;
  --bg-tertiary: #1a2235;
  --bg-surface: #151d2e;

  /* Borders with subtle warmth */
  --border-primary: #2a3548;
  --border-secondary: #1e293b;

  /* Text — high contrast */
  --text-primary: #e8edf5;
  --text-secondary: #94a3b8;
  --text-tertiary: #64748b;

  /* Signature accent — teal (WCAG AA ~4.5:1 on --bg-primary) */
  --accent-primary: #22e6b8;
  --accent-secondary: #0ea5e9;

  /* Semantic accents */
  --accent-green: #34d399;
  --accent-orange: #fbbf24;
  --accent-red: #f87171;
  --accent-purple: #a78bfa;

  /* Typography */
  --font-heading: "Syne", "Arial Black", "Trebuchet MS", sans-serif;
  --font-body: "DM Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "Cascadia Code", "SF Mono", Consolas, monospace;

  /* Layout */
  --max-width: 860px;
  --nav-height: 56px;

  /* Animation */
  --animation-duration: 0.4s;
  --stagger-delay: 0.1s;
}

/* --------------------------------------------------------------------------
   Reset
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(34, 230, 184, 0.04) 0%, transparent 50%);
}

/* Noise grain overlay — barely visible texture for depth */
body::after {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 256px 256px;
}

/* --------------------------------------------------------------------------
   Links
   -------------------------------------------------------------------------- */
a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  text-decoration: underline;
  color: var(--text-primary);
}

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

/* --------------------------------------------------------------------------
   Images
   -------------------------------------------------------------------------- */
img, svg {
  max-width: 100%;
  height: auto;
}

/* --------------------------------------------------------------------------
   Typography
   -------------------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-heading);
  line-height: 1.25;
  margin-top: 2em;
  margin-bottom: 0.5em;
  color: var(--text-primary);
  font-weight: 700;
}

h1 { font-size: 1.65rem; letter-spacing: -0.02em; }
h2 { font-size: 1.25rem; letter-spacing: -0.01em; }
h3 { font-size: 1.05rem; }
h4 { font-size: 0.95rem; }

h2 {
  border-bottom: 1px solid var(--border-primary);
  padding-bottom: 0.4em;
}

p {
  margin-bottom: 0.85em;
}

code {
  font-family: var(--font-mono);
  font-size: 0.85em;
  background: var(--bg-tertiary);
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

pre {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 4px;
  padding: 1em;
  overflow-x: auto;
  margin: 1em 0;
  font-size: 0.8rem;
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
  border: none;
}

blockquote {
  border-left: 3px solid var(--accent-primary);
  padding: 0.5em 1em;
  margin: 1em 0;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border-radius: 0 4px 4px 0;
}

blockquote p:last-child {
  margin-bottom: 0;
}

hr {
  border: none;
  border-top: 1px solid var(--border-primary);
  margin: 2.5em 0;
}

ul, ol {
  padding-left: 1.4em;
  margin-bottom: 0.85em;
}

li {
  margin-bottom: 0.2em;
}

/* --------------------------------------------------------------------------
   Container
   -------------------------------------------------------------------------- */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
.site-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-primary);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-height);
}

.nav-logo {
  color: var(--text-primary);
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.nav-logo:hover {
  color: var(--accent-primary);
  text-decoration: none;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 1.75rem;
  align-items: center;
  padding: 0;
  margin: 0;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-decoration: none;
  position: relative;
}

.nav-links a::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 50%;
  width: 0;
  height: 1px;
  background: var(--accent-primary);
  transition: width 0.2s ease, left 0.2s ease;
}

.nav-links a:hover::after {
  width: 100%;
  left: 0;
}

.nav-links a:hover {
  color: var(--text-primary);
  text-decoration: none;
}

.nav-links li.active a {
  color: var(--text-primary);
  font-weight: 500;
}

.nav-links li.active a::after {
  width: 100%;
  left: 0;
}

.nav-external::after {
  content: " \2197";
  font-size: 0.75em;
}

.nav-toggle-checkbox {
  display: none;
}

.nav-toggle-label {
  display: none;
  cursor: pointer;
  padding: 0.5rem;
}

.nav-toggle-icon,
.nav-toggle-icon::before,
.nav-toggle-icon::after {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all 0.25s ease;
}

.nav-toggle-icon {
  position: relative;
}

.nav-toggle-icon::before,
.nav-toggle-icon::after {
  content: "";
  position: absolute;
  left: 0;
}

.nav-toggle-icon::before { top: -7px; }
.nav-toggle-icon::after { top: 7px; }

/* --------------------------------------------------------------------------
   Main
   -------------------------------------------------------------------------- */
main {
  flex: 1;
  padding: 2.5rem 0 4rem;
}

.content {
  max-width: 100%;
}

/* --------------------------------------------------------------------------
   Hero (Homepage)
   -------------------------------------------------------------------------- */
.hero {
  padding: 4rem 0 2.5rem;
}

.hero h1 {
  font-size: 1.75rem;
  margin-top: 0;
  margin-bottom: 0.4rem;
  letter-spacing: -0.03em;
}

.hero-brand {
  color: var(--text-primary);
}

.hero-tagline {
  display: block;
  font-size: 0.55em;
  font-weight: 400;
  color: var(--accent-primary);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 0.15em;
}

.hero-accent-bar {
  display: block;
  width: 48px;
  height: 3px;
  background: var(--accent-primary);
  border-radius: 2px;
  margin: 0.75rem 0 1rem;
}

.hero p {
  color: var(--text-secondary);
  max-width: 600px;
  margin-bottom: 0.75rem;
  font-size: 0.95rem;
}

.hero-links {
  display: flex;
  gap: 0.75rem;
  font-size: 0.85rem;
  margin-bottom: 0;
  margin-top: 1rem;
}

.hero-links a {
  display: inline-block;
  padding: 0.4rem 1rem;
  border: 1px solid var(--border-primary);
  border-radius: 999px;
  color: var(--text-primary);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s ease;
  text-decoration: none;
}

.hero-links a:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  text-decoration: none;
}

/* --------------------------------------------------------------------------
   Home Sections
   -------------------------------------------------------------------------- */
.section-label {
  display: block;
  font-family: var(--font-heading);
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-primary);
  margin-bottom: 0.6rem;
}

.home-latest {
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-secondary);
  margin-bottom: 2rem;
}

.home-latest h2 {
  border-bottom: none;
  padding-bottom: 0;
  margin-top: 0;
  font-size: 1.2rem;
}

.home-latest h2 a {
  color: var(--text-primary);
}

.home-latest h2 a:hover {
  color: var(--accent-primary);
}

.home-latest > p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 0.4rem;
}

.latest-meta {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.home-section {
  margin-top: 2.5rem;
}

/* --------------------------------------------------------------------------
   Model List (Homepage)
   -------------------------------------------------------------------------- */
.model-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border-primary);
}

.model-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.65rem 0;
  border-bottom: 1px solid var(--border-secondary);
  text-decoration: none;
  color: var(--text-primary);
  gap: 1rem;
  transition: color 0.2s ease;
}

.model-row:hover {
  text-decoration: none;
  color: var(--accent-primary);
}

.model-name {
  font-size: 0.9rem;
  font-weight: 500;
}

.model-meta {
  display: flex;
  gap: 0.75rem;
  align-items: baseline;
  flex-shrink: 0;
}

.model-params {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--text-tertiary);
}

.model-best {
  font-size: 0.75rem;
  color: var(--accent-green);
  font-weight: 500;
}

/* --------------------------------------------------------------------------
   Methods List
   -------------------------------------------------------------------------- */
.methods-list {
  list-style: none;
  padding: 0;
}

.methods-list li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-secondary);
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.methods-list li:last-child {
  border-bottom: none;
}

.methods-list li strong {
  color: var(--text-primary);
  font-size: 0.8rem;
}

/* --------------------------------------------------------------------------
   Section Pages
   -------------------------------------------------------------------------- */
.section-header {
  margin-bottom: 1.5rem;
}

.section-header h1 {
  margin-top: 0;
}

.section-description {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* --------------------------------------------------------------------------
   Model Grid
   -------------------------------------------------------------------------- */
.model-family {
  margin-bottom: 2rem;
}

.model-family-heading {
  font-size: 1.1rem;
  border-bottom: none;
  padding-bottom: 0;
  margin-top: 0;
  margin-bottom: 0.75rem;
  color: var(--accent-primary);
}

.model-grid {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border-primary);
}

.model-card {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-secondary);
  text-decoration: none;
  color: var(--text-primary);
  gap: 1rem;
  transition: color 0.2s ease;
}

.model-card:hover {
  text-decoration: none;
  color: var(--accent-primary);
}

.model-card h2, .model-card h3 {
  margin-top: 0;
  border-bottom: none;
  padding-bottom: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.model-card-left {
  flex: 1;
  min-width: 0;
}

.model-card-right {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  flex-shrink: 0;
}

.model-techniques-count {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
}

.model-arch {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin-bottom: 0.15rem;
}

.model-params {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  margin-bottom: 0.35rem;
}

.model-best {
  font-size: 0.8rem;
  color: var(--accent-green);
}

.model-desc {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   Table of Contents
   -------------------------------------------------------------------------- */
.toc-details {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-left: 3px solid var(--accent-primary);
  border-radius: 4px;
  padding: 0.85rem 1rem;
  margin-bottom: 2rem;
}

.toc-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 0.15rem 0;
}

.toc-details ul {
  list-style: none;
  padding-left: 0;
  margin-top: 0.5rem;
  margin-bottom: 0;
}

.toc-details ul ul {
  padding-left: 1rem;
  margin-top: 0.15rem;
}

.toc-details li {
  margin-bottom: 0.15rem;
}

.toc-details a {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

.toc-details a:hover {
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   Content — Tables
   -------------------------------------------------------------------------- */
.content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1em 0;
  font-size: 0.8rem;
  table-layout: auto;
}

.content table::-webkit-scrollbar {
  height: 5px;
}

.content table::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

.content table::-webkit-scrollbar-thumb {
  background: var(--border-primary);
  border-radius: 3px;
}

.content thead {
  background: var(--bg-tertiary);
  border-left: 3px solid var(--accent-primary);
}

.content th {
  padding: 0.5rem 0.6rem;
  text-align: left;
  font-weight: 600;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border-primary);
  white-space: nowrap;
}

.content td {
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border-secondary);
}

.content tbody tr:hover {
  background: var(--bg-secondary);
}

/* --------------------------------------------------------------------------
   Content — Images & Figures
   -------------------------------------------------------------------------- */
.content img {
  display: block;
  margin: 1.5rem auto;
  max-width: 100%;
  border-radius: 3px;
}

.content strong {
  color: var(--text-primary);
  font-weight: 600;
}

.content small {
  color: var(--text-tertiary);
  font-size: 0.8rem;
}

.content-figure {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 6px;
  padding: 1rem;
  margin: 1.5rem auto;
  max-width: 100%;
}

.content-figure img {
  margin: 0;
  border-radius: 3px;
  background: #fff;
}

.content-figure figcaption {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  text-align: center;
  margin-top: 0.5rem;
}

/* --------------------------------------------------------------------------
   Breadcrumbs
   -------------------------------------------------------------------------- */
.breadcrumbs {
  margin-bottom: 0.75rem;
}

.breadcrumbs ol {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  padding: 0;
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-tertiary);
}

.breadcrumbs li {
  display: flex;
  align-items: center;
}

.breadcrumbs li + li::before {
  content: "/";
  margin: 0 0.35rem;
  color: var(--text-tertiary);
}

.breadcrumbs a {
  color: var(--text-secondary);
  text-decoration: none;
}

.breadcrumbs a:hover {
  color: var(--accent-primary);
  text-decoration: underline;
}

.breadcrumbs [aria-current="page"] {
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   Article Meta
   -------------------------------------------------------------------------- */
.article-meta {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-primary);
}

.article-meta small {
  color: var(--text-tertiary);
}

/* --------------------------------------------------------------------------
   Page List
   -------------------------------------------------------------------------- */
.page-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--border-primary);
}

.page-list-item {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--border-secondary);
}

.page-list-item h2 {
  border-bottom: none;
  padding-bottom: 0;
  margin-top: 0;
  font-size: 1rem;
  font-weight: 700;
}

.page-list-item p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border-primary);
  padding: 1.5rem 0;
  margin-top: auto;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.footer-section p {
  font-size: 0.8rem;
  color: var(--text-tertiary);
  margin-bottom: 0;
}

.footer-links {
  list-style: none;
  display: flex;
  gap: 1.25rem;
  padding: 0;
  margin: 0;
}

.footer-links a {
  color: var(--text-tertiary);
  font-size: 0.8rem;
}

.footer-links a:hover {
  color: var(--accent-primary);
}

.footer-nav {
  display: flex;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.footer-nav a {
  color: var(--text-tertiary);
  font-size: 0.8rem;
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-nav a:hover {
  color: var(--accent-primary);
}

.footer-brand {
  color: var(--text-primary);
}

.footer-tagline {
  color: var(--text-tertiary);
}

/* --------------------------------------------------------------------------
   Skip Link
   -------------------------------------------------------------------------- */
.skip-link {
  position: absolute;
  top: -100%;
  left: 1rem;
  background: var(--accent-primary);
  color: var(--bg-primary);
  padding: 0.5rem 1rem;
  z-index: 200;
  border-radius: 0 0 4px 4px;
  font-weight: 600;
  font-size: 0.875rem;
  text-decoration: none;
}

.skip-link:focus {
  top: 0;
  color: var(--bg-primary);
}

/* --------------------------------------------------------------------------
   Animations
   -------------------------------------------------------------------------- */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Homepage */
.hero {
  animation: fadeInUp var(--animation-duration) ease-out both;
}

.home-latest {
  animation: fadeInUp var(--animation-duration) ease-out calc(var(--stagger-delay) * 1) both;
}

.home-section {
  animation: fadeInUp var(--animation-duration) ease-out calc(var(--stagger-delay) * 2) both;
}

/* List pages */
.section-header {
  animation: fadeInUp var(--animation-duration) ease-out both;
}

.model-grid,
.page-list {
  animation: fadeInUp var(--animation-duration) ease-out calc(var(--stagger-delay) * 1) both;
}

/* Single pages */
.breadcrumbs {
  animation: fadeInUp var(--animation-duration) ease-out both;
}

.content {
  animation: fadeInUp var(--animation-duration) ease-out calc(var(--stagger-delay) * 1) both;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }
}

/* --------------------------------------------------------------------------
   Responsive (768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .nav-toggle-label {
    display: block;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-primary);
    flex-direction: column;
    padding: 0.75rem 1.5rem;
    gap: 0.5rem;
  }

  .nav-toggle-checkbox:checked ~ .nav-links {
    display: flex;
  }

  /* Hamburger X animation */
  .nav-toggle-checkbox:checked ~ .nav-toggle-label .nav-toggle-icon {
    background: transparent;
  }

  .nav-toggle-checkbox:checked ~ .nav-toggle-label .nav-toggle-icon::before {
    top: 0;
    transform: rotate(45deg);
  }

  .nav-toggle-checkbox:checked ~ .nav-toggle-label .nav-toggle-icon::after {
    top: 0;
    transform: rotate(-45deg);
  }

  .hero {
    padding: 2.5rem 0 2rem;
  }

  .hero h1 {
    font-size: 1.3rem;
  }

  .hero p {
    font-size: 0.875rem;
  }

  .hero-links {
    flex-wrap: wrap;
  }

  .model-row {
    flex-direction: column;
    gap: 0.25rem;
  }

  .model-meta {
    flex-shrink: initial;
  }

  .model-card {
    flex-direction: column;
    gap: 0.25rem;
  }

  h1 { font-size: 1.3rem; }
  h2 { font-size: 1.1rem; }

  .footer-content {
    flex-direction: column;
    text-align: center;
  }

  .content-figure {
    overflow-x: auto;
  }
}
