/* ==========================================================================
   SKILLS.LAB — Dark Research Terminal Aesthetic
   Fonts: Syne (display) + DM Sans (body) + JetBrains Mono (code)
   Palette: Deep void (#0a0a0f) + cyan glow (#00f0ff) + amber (#f59e0b)
   ========================================================================== */

:root {
  /* Core palette */
  --void: #0a0a0f;
  --void-light: #12121a;
  --surface: #16161f;
  --surface-hover: #1c1c28;
  --surface-raised: #1f1f2c;
  --border: #2a2a3a;
  --border-glow: #3a3a50;

  /* Text */
  --text: #e8e8ed;
  --text-dim: #8888a0;
  --text-faint: #55556a;

  /* Accents */
  --cyan: #00f0ff;
  --cyan-dim: #00a0aa;
  --cyan-glow: rgba(0, 240, 255, 0.15);
  --cyan-glow-strong: rgba(0, 240, 255, 0.3);
  --amber: #f59e0b;
  --amber-dim: #b87308;
  --amber-glow: rgba(245, 158, 11, 0.15);
  --rose: #f43f5e;
  --rose-glow: rgba(244, 63, 94, 0.15);

  /* Typography */
  --font-display: 'Instrument Sans', sans-serif;
  --font-body: 'Instrument Sans', sans-serif;
  --font-mono: 'Geist Mono', monospace;

  /* Spacing & shape */
  --radius: 10px;
  --radius-sm: 6px;
  --radius-lg: 16px;
  --max-width: 1040px;
  --content-width: 780px;

  /* Shadows */
  --shadow-glow: 0 0 20px rgba(0, 240, 255, 0.08), 0 0 60px rgba(0, 240, 255, 0.04);
  --shadow-card: 0 2px 8px rgba(0, 0, 0, 0.4), 0 0 1px rgba(0, 240, 255, 0.1);
  --shadow-card-hover: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 1px var(--cyan), 0 0 40px rgba(0, 240, 255, 0.06);
}

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

/* Skip link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  padding: 8px 16px;
  background: var(--cyan);
  color: var(--void);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-body);
  text-decoration: none;
  z-index: 200;
}

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

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

/* ---- Background effects ---- */
html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  font-family: var(--font-body);
  color: var(--text);
  background: var(--void);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow-x: hidden;
}

/* Film grain overlay */
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 999;
  opacity: 0.03;
  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;
}

/* Subtle grid background */
.grid-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(0, 240, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 240, 255, 0.02) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, black 20%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, black 20%, transparent 70%);
}

/* ---- Navbar ---- */
#navbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(16px) saturate(1.4);
  -webkit-backdrop-filter: blur(16px) saturate(1.4);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 28px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}

.nav-brand-icon {
  width: 10px;
  height: 10px;
  background: var(--cyan);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--cyan), 0 0 20px rgba(0, 240, 255, 0.3);
  animation: pulse-glow 3s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 8px var(--cyan), 0 0 20px rgba(0, 240, 255, 0.3); }
  50% { box-shadow: 0 0 12px var(--cyan), 0 0 30px rgba(0, 240, 255, 0.5); }
}

.nav-brand-text {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-brand-dot {
  color: var(--cyan);
}

.nav-brand:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 4px;
  border-radius: 4px;
}

.nav-links {
  display: flex;
  gap: 4px;
}

.nav-link {
  padding: 7px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  text-decoration: none;
  text-transform: uppercase;
  transition: color 0.2s, background-color 0.2s;
}

.nav-link:hover {
  color: var(--text);
  background: var(--surface);
}

.nav-link.active {
  color: var(--cyan);
  background: var(--cyan-glow);
}

.nav-link:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}

/* ---- Main ---- */
#main {
  flex: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 48px 28px;
  width: 100%;
  position: relative;
  z-index: 1;
  animation: fadeUp 0.4s ease-out;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---- Footer ---- */
#footer {
  position: relative;
  z-index: 1;
  background: var(--void);
}

.footer-line {
  width: 60px;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan), transparent);
  margin: 0 auto 20px;
  border-radius: 1px;
}

.footer-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 32px 28px;
  text-align: center;
  font-size: 13px;
  color: var(--text-faint);
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.footer-inner a {
  color: var(--cyan-dim);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-inner a:hover {
  color: var(--cyan);
}

.footer-inner a:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---- Hero ---- */
.hero {
  text-align: center;
  padding: 60px 0 56px;
  position: relative;
}

.hero::before {
  content: '';
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  width: 500px;
  height: 300px;
  background: radial-gradient(ellipse, rgba(0, 240, 255, 0.06), transparent 70%);
  pointer-events: none;
  z-index: -1;
}

.hero-label {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--cyan);
  background: var(--cyan-glow);
  border: 1px solid rgba(0, 240, 255, 0.15);
  padding: 5px 14px;
  border-radius: 20px;
  margin-bottom: 24px;
  animation: fadeUp 0.4s ease-out 0.1s both;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 16px;
  text-wrap: balance;
  background: linear-gradient(135deg, var(--text) 40%, var(--cyan) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: fadeUp 0.4s ease-out 0.15s both;
}

.hero p {
  font-size: 17px;
  color: var(--text-dim);
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.6;
  animation: fadeUp 0.4s ease-out 0.25s both;
}

/* ---- Section ---- */
.section {
  margin-bottom: 56px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
  text-wrap: balance;
}

.section-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 4px 12px;
  border-radius: 20px;
  letter-spacing: 0.04em;
}

/* ---- Card Grid ---- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 18px;
}

/* ---- Card ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
  transition: border-color 0.25s, box-shadow 0.25s, transform 0.25s;
  cursor: pointer;
  touch-action: manipulation;
}

.card::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--cyan-glow) 0%, transparent 50%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}

.card:hover {
  border-color: var(--cyan-dim);
  box-shadow: var(--shadow-card-hover);
  transform: translateY(-3px);
}

.card:hover::before {
  opacity: 1;
}

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

.card-icon {
  font-size: 36px;
  line-height: 1;
  filter: saturate(1.2);
}

.card-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.card-desc {
  font-size: 14px;
  color: var(--text-dim);
  line-height: 1.6;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
  padding-top: 4px;
}

.card-date {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
}

/* ---- Tags ---- */
.tag {
  display: inline-block;
  padding: 3px 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.03em;
  border-radius: 4px;
  background: var(--surface-raised);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

/* ---- Mode badges ---- */
.modes {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mode-badge {
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  border-radius: 4px;
  background: var(--cyan-glow);
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border: 1px solid rgba(0, 240, 255, 0.12);
}

/* ---- Breadcrumb ---- */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  margin-bottom: 28px;
  letter-spacing: 0.02em;
}

.breadcrumb a {
  color: var(--cyan-dim);
  text-decoration: none;
  transition: color 0.15s;
}

.breadcrumb a:hover {
  color: var(--cyan);
}

.breadcrumb a:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  border-radius: 2px;
}

.breadcrumb-sep {
  color: var(--border-glow);
}

/* ---- Detail page ---- */
.detail-header {
  margin-bottom: 40px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
  position: relative;
}

.detail-header::before {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 120px;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan), transparent);
}

.detail-header h1 {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
  text-wrap: balance;
  color: var(--text);
}

.detail-header p {
  font-size: 16px;
  color: var(--text-dim);
  margin-bottom: 18px;
  line-height: 1.6;
}

.detail-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.detail-skill-link {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--amber);
  text-decoration: none;
  background: var(--amber-glow);
  border: 1px solid rgba(245, 158, 11, 0.15);
  padding: 4px 12px;
  border-radius: 4px;
  font-weight: 500;
  letter-spacing: 0.02em;
  transition: background-color 0.2s, color 0.2s;
}

.detail-skill-link:hover {
  background: var(--amber);
  color: var(--void);
}

.detail-skill-link:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

/* ---- Related section ---- */
.related-section {
  margin-top: 56px;
  padding-top: 36px;
  border-top: 1px solid var(--border);
}

.related-section h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ==========================================================================
   Markdown Content Styling
   ========================================================================== */
.markdown-body {
  max-width: var(--content-width);
  font-size: 15.5px;
  line-height: 1.75;
  color: var(--text);
}

.markdown-body h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 800;
  margin: 48px 0 18px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
  letter-spacing: -0.01em;
  text-wrap: balance;
  scroll-margin-top: 80px;
  color: var(--text);
  position: relative;
}

.markdown-body h1::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 80px;
  height: 2px;
  background: linear-gradient(90deg, var(--cyan), transparent);
}

.markdown-body h2 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  margin: 36px 0 14px;
  letter-spacing: -0.005em;
  text-wrap: balance;
  scroll-margin-top: 80px;
  color: var(--text);
}

.markdown-body h3 {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  margin: 28px 0 10px;
  scroll-margin-top: 80px;
  color: var(--text);
}

.markdown-body h4 {
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 700;
  margin: 24px 0 8px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.markdown-body p {
  margin-bottom: 16px;
}

.markdown-body ul,
.markdown-body ol {
  margin-bottom: 16px;
  padding-left: 24px;
}

.markdown-body li {
  margin-bottom: 4px;
}

.markdown-body li::marker {
  color: var(--cyan-dim);
}

.markdown-body li ul,
.markdown-body li ol {
  margin-top: 4px;
  margin-bottom: 4px;
}

.markdown-body strong {
  font-weight: 700;
  color: var(--text);
}

.markdown-body a {
  color: var(--cyan);
  text-decoration: none;
  border-bottom: 1px solid rgba(0, 240, 255, 0.2);
  transition: border-color 0.2s;
}

.markdown-body a:hover {
  border-bottom-color: var(--cyan);
}

.markdown-body a:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  border-radius: 2px;
}

.markdown-body blockquote {
  border-left: 3px solid var(--cyan);
  padding: 14px 20px;
  margin: 20px 0;
  background: var(--cyan-glow);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text);
}

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

.markdown-body code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 4px;
  color: var(--cyan);
}

.markdown-body pre {
  background: var(--void-light);
  border: 1px solid var(--border);
  padding: 20px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 20px 0;
}

.markdown-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  color: var(--text);
}

/* Tables */
.markdown-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: 13px;
}

.markdown-body th {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  text-align: left;
  padding: 10px 14px;
  background: var(--surface);
  color: var(--cyan);
  border: 1px solid var(--border);
}

.markdown-body td {
  padding: 10px 14px;
  border: 1px solid var(--border);
  color: var(--text-dim);
}

.markdown-body tbody tr:nth-child(even) {
  background: rgba(22, 22, 31, 0.5);
}

.markdown-body tbody tr:hover {
  background: var(--cyan-glow);
}

.markdown-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 36px 0;
  position: relative;
}

.markdown-body hr::after {
  content: '';
  position: absolute;
  top: -1px;
  left: 0;
  width: 40px;
  height: 2px;
  background: var(--cyan);
}

.markdown-body img {
  max-width: 100%;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.markdown-body input[type="checkbox"] {
  margin-right: 8px;
  accent-color: var(--cyan);
}

/* ---- Loading ---- */
.loading {
  text-align: center;
  padding: 80px 0;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.04em;
}

.loading-spinner {
  display: inline-block;
  width: 28px;
  height: 28px;
  border: 2px solid var(--border);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin-bottom: 16px;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.15);
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 80px 0;
  color: var(--text-dim);
}

.empty-state-icon {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.empty-state a {
  color: var(--cyan);
  text-decoration: none;
  border-bottom: 1px solid rgba(0, 240, 255, 0.3);
}

.empty-state a:hover {
  border-bottom-color: var(--cyan);
}

/* ---- Responsive ---- */
@media (max-width: 640px) {
  .hero h1 { font-size: 32px; }
  .hero p { font-size: 15px; }
  .card-grid { grid-template-columns: 1fr; }
  .detail-header h1 { font-size: 24px; }
  .nav-inner { padding: 0 16px; }
  #main { padding: 28px 16px; }
  .markdown-body table { font-size: 11px; }
  .markdown-body th,
  .markdown-body td { padding: 6px 8px; }
  .nav-brand-text { font-size: 15px; }
}

/* ---- Scrollbar ---- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--void);
}

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

::-webkit-scrollbar-thumb:hover {
  background: var(--text-faint);
}

/* ---- Selection ---- */
::selection {
  background: var(--cyan-glow-strong);
  color: var(--text);
}
