@view-transition { navigation: auto; }

:root {
  --hue: 0;
  --hue-color: hsl(0 90% 60%);
  --rainbow: conic-gradient(from calc(var(--hue) * 1deg), #ff3b30, #ff9500, #ffcc00, #34c759, #00c7be, #30b0ff, #5e5ce6, #ff2d92, #ff3b30);

  --bg: #0a0a0b;
  --bg-alt: #101012;
  --panel: #17181b;
  --panel-2: #1d1e22;
  --border: #2b2c30;
  --border-strong: #3d3e44;
  --text: #ededee;
  --text-dim: #c6c7ca;
  --muted: #8b8c92;
  --danger: #f87171;

  --font-display: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 64px;
  --radius: 10px;
}

* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  margin: 0;
  line-height: 1.6;
  position: relative;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--hue-color); color: #0a0a0b; }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--panel-2); border: 3px solid var(--bg); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }
* { scrollbar-color: var(--panel-2) var(--bg); scrollbar-width: thin; }

.skip-link {
  position: fixed; top: -60px; left: 12px; z-index: 1000;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px;
  font-weight: 600; transition: top 0.2s ease;
}
.skip-link:focus { top: 12px; }

.route-progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0%; z-index: 999;
  background: var(--rainbow); box-shadow: 0 0 8px var(--hue-color);
}

.noise-overlay {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(ellipse at 20% -10%, rgba(255,255,255,0.05), transparent 40%),
    radial-gradient(ellipse at 100% 110%, rgba(255,255,255,0.03), transparent 45%);
}

.wrap { max-width: 920px; margin: 0 auto; padding: 0 var(--space-4); position: relative; z-index: 1; }
a { color: var(--text-dim); text-decoration: none; transition: color 0.2s ease; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 700; letter-spacing: -0.015em; line-height: 1.2; margin: 0 0 var(--space-3); }
h1 { font-size: clamp(1.9em, 3.5vw, 2.6em); }
h2 { font-size: 1.35em; margin-top: var(--space-6); }
code, pre, .paste-content, .form textarea { font-family: var(--font-mono); }

.mono-label {
  font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.12em;
  font-size: 0.75em; color: var(--muted);
}

/* Rainbow utilities, driven by --hue / --hue-color which app.js updates continuously */
.rainbow-text {
  background: var(--rainbow);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  font-weight: 700; font-family: var(--font-display);
}

.rainbow-link { position: relative; padding-bottom: 2px; }
.rainbow-link::after {
  content: ""; position: absolute; left: 0; bottom: -3px; height: 2px; width: 100%;
  background: var(--rainbow); border-radius: 2px;
  transform: scaleX(var(--underline-scale, 0)); transform-origin: left;
}
.rainbow-link:hover, .rainbow-link:focus-visible { color: var(--text); }

.rainbow-border { position: relative; z-index: 0; background: var(--panel); }
.rainbow-border::before {
  content: ""; position: absolute; inset: -2px; z-index: -1; border-radius: inherit;
  background: var(--rainbow);
}

:focus-visible { outline: 2px solid var(--hue-color); outline-offset: 2px; }

/* Header */
.site-header {
  border-bottom: 1px solid var(--border); padding: var(--space-4) 0; position: sticky; top: 0; z-index: 50;
  background: rgba(10, 10, 11, 0.72); backdrop-filter: blur(14px) saturate(140%); -webkit-backdrop-filter: blur(14px) saturate(140%);
}
.site-header .wrap { display: flex; align-items: center; gap: var(--space-6); }
.brand { font-size: 1.25em; }
.site-header nav { display: flex; gap: var(--space-5); flex: 1; font-size: 0.92em; }
.auth-nav { display: flex; gap: var(--space-4); align-items: center; font-size: 0.92em; }
.cta { padding: 7px 16px; border-radius: 8px; font-weight: 600; color: var(--text); border: none; }

main { padding: var(--space-7) 0 var(--space-8); min-height: 60vh; position: relative; z-index: 1; }
.lede { color: var(--muted); font-size: 1.05em; max-width: 60ch; }
.meta { color: var(--muted); font-size: 0.85em; font-family: var(--font-mono); }
.breadcrumb { margin-bottom: var(--space-2); }
.breadcrumb a { font-family: var(--font-mono); font-size: 0.85em; }

/* Hero (homepage) */
.hero { padding: var(--space-3) 0 var(--space-6); border-bottom: 1px solid var(--border); margin-bottom: var(--space-6); }
.hero h1 { margin-top: var(--space-2); }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); margin-top: var(--space-6); }
.stat-tile { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-4); background: var(--panel); }
.stat-num { font-family: var(--font-mono); font-size: 1.7em; font-weight: 600; color: var(--text); display: block; }
.stat-label { font-size: 0.78em; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; }

/* Category cards */
.category-list { display: grid; gap: var(--space-3); }
.category-card {
  display: flex; align-items: center; gap: var(--space-4); background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--space-4) var(--space-5); color: var(--text); position: relative; overflow: hidden;
  transition: border-color 0.25s ease, transform 0.25s ease;
}
.category-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--rainbow); opacity: 0; transition: opacity 0.25s ease;
}
.category-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.category-card:hover::before { opacity: 1; }
.category-index {
  font-family: var(--font-mono); color: var(--muted); font-size: 0.85em; border: 1px solid var(--border);
  border-radius: 999px; width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.category-card .category-body { flex: 1; min-width: 0; }
.category-card h2 { margin: 0 0 4px; font-size: 1.1em; }
.category-card p { margin: 0 0 8px; color: var(--muted); }
.category-arrow { font-family: var(--font-mono); color: var(--muted); transform: translateX(0); transition: transform 0.25s ease, color 0.25s ease; }
.category-card:hover .category-arrow { transform: translateX(4px); color: var(--text); }

/* Thread / paste tables */
table.thread-list { width: 100%; border-collapse: collapse; margin: var(--space-5) 0; }
table.thread-list td { border-bottom: 1px solid var(--border); padding: var(--space-3) var(--space-2); vertical-align: top; }
table.thread-list tr { transition: background 0.15s ease; }
table.thread-list tr:hover { background: var(--panel); }
table.thread-list td.num { text-align: right; white-space: nowrap; color: var(--muted); font-family: var(--font-mono); font-size: 0.9em; }
.pager { display: flex; justify-content: space-between; margin: var(--space-5) 0; font-size: 0.9em; font-family: var(--font-mono); }

/* Forms */
.form { display: flex; flex-direction: column; gap: var(--space-4); max-width: 640px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.9em; color: var(--muted); }
.form input[type=text], .form input[type=password], .form textarea, .form select {
  background: var(--panel-2); border: 1px solid var(--border); color: var(--text);
  padding: 10px 12px; border-radius: 8px; font: inherit; transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form input:focus, .form textarea:focus, .form select:focus { border-color: var(--border-strong); box-shadow: 0 0 0 3px rgba(255,255,255,0.04); }
.form button, .inline-form button {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border-strong);
  padding: 10px 16px; border-radius: 8px; font-weight: 600; cursor: pointer;
  transition: box-shadow 0.15s ease;
  align-self: flex-start; font-family: var(--font-body);
}
.inline-form { display: inline-flex; gap: var(--space-2); align-items: center; }
.checkbox { flex-direction: row !important; align-items: center; }

/* Flash messages */
.flash { padding: var(--space-3) var(--space-4); border-radius: 8px; margin-bottom: var(--space-5); border: 1px solid var(--border); }
.flash-error { background: #241414; color: var(--danger); border-color: #4a2323; }
.flash-success { background: #14241a; color: #7ee0a8; border-color: #23472f; }
.flash-info { background: #141b24; color: #7fb8e0; border-color: #233647; }

/* Posts / pastes */
.post { border: 1px solid var(--border); border-radius: var(--radius); padding: var(--space-4); margin-bottom: var(--space-3); background: var(--panel); }
.post-author { font-weight: 600; margin-bottom: var(--space-2); font-family: var(--font-display); }
.post-body img { max-width: 100%; border-radius: 8px; }
.post-body pre, .paste-content {
  background: var(--bg-alt); border: 1px solid var(--border); border-radius: 8px;
  padding: var(--space-4); overflow-x: auto;
}
.badge { background: var(--panel-2); border: 1px solid var(--border); color: var(--muted); font-family: var(--font-mono); font-size: 0.7em; padding: 2px 8px; border-radius: 999px; text-transform: uppercase; letter-spacing: 0.05em; }
.badge-danger { background: #241414; color: var(--danger); border-color: #4a2323; }

.empty-state { border: 1px dashed var(--border); border-radius: var(--radius); padding: var(--space-6); text-align: center; color: var(--muted); font-family: var(--font-mono); }

.site-footer { border-top: 1px solid var(--border); color: var(--muted); padding: var(--space-5) 0; font-size: 0.85em; position: relative; z-index: 1; }

@media (max-width: 640px) {
  .stat-row { grid-template-columns: repeat(2, 1fr); }
  .site-header nav { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
  html { scroll-behavior: auto; }
}
