/* ============================================================
   AP1 TRACKER · HIGH-CRAFT WORKBENCH (v3)
   High-Craft · Tactile · Dense · Architectural Workbench
   Obsidian Zinc · Electric Cobalt Accent · Tabular Monospace
   ============================================================ */

/* ----- FONTS (Self-hosted, 100% offline, zero CDN) ----- */
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/Inter-Regular.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/Inter-SemiBold.woff2') format('woff2');
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('../fonts/Inter-Bold.woff2') format('woff2');
}

/* ----- DESIGN TOKENS ----- */
:root {
  --bg: #09090b;             /* Pure Obsidian / Zinc 950 */
  --surface: #121215;        /* Primary Workbench Surface */
  --surface-raised: #18181d; /* Elevated Cards / Menus */
  --surface-hover: #1e1e24;  /* Hover state */
  --surface-inset: #0d0d10;  /* Inset wells */

  --border: #23232a;         /* Crisp 1px hairline */
  --border-subtle: #191920;  /* Sub-hairline separator */
  --border-strong: #383842;  /* Focused / Active border */

  --ink: #f4f4f5;            /* Zinc 100 high-contrast text */
  --ink-secondary: #a1a1aa;  /* Zinc 400 secondary */
  --ink-muted: #71717a;      /* Zinc 500 metadata */
  --ink-dim: #52525b;        /* Zinc 600 labels */

  --accent: #3b82f6;         /* Electric Cobalt */
  --accent-muted: rgba(59, 130, 246, 0.12);
  --accent-glow: rgba(59, 130, 246, 0.25);

  --success: #10b981;        /* Emerald */
  --success-muted: rgba(16, 185, 129, 0.12);

  --warning: #f59e0b;        /* Amber */
  --warning-muted: rgba(245, 158, 11, 0.12);

  --danger: #ef4444;         /* Crimson */
  --danger-muted: rgba(239, 68, 68, 0.12);

  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Monaco, Consolas, monospace;
}

/* ----- GLOBAL RESET & BASE ----- */
*, *::before, *::after {
  box-sizing: border-box;
}

html {
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg);
  color: var(--ink);
  min-height: 100vh;
  margin: 0;
  padding: 0;
  overscroll-behavior-y: none;
}

/* Tabular numbers for clean alignment */
.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* ----- TACTILE KEYCAP COMPONENT ----- */
.kbd-cap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  padding: 2.5px 6px;
  border-radius: 4px;
  background: #191920;
  border: 1px solid #2e2e3a;
  color: #d4d4d8;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
  user-select: none;
  white-space: nowrap;
}

/* ----- HAIRLINE PROGRESS SYSTEM ----- */
.hairline-track {
  width: 100%;
  height: 2px;
  background: #23232a;
  border-radius: 1px;
  overflow: hidden;
  position: relative;
}
.hairline-fill {
  height: 100%;
  background: var(--accent);
  transition: width 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}
.hairline-fill.success {
  background: var(--success);
}
.hairline-fill.warning {
  background: var(--warning);
}

/* ----- ACCORDION & TOPIC CARDS ----- */
.topic-body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.25s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease;
  opacity: 0;
  overflow: hidden;
}
.topic-body.open {
  grid-template-rows: 1fr;
  opacity: 1;
  border-top: 1px solid var(--border-subtle);
}
.topic-content {
  min-height: 0;
}

/* Topic Card Hover & Selection */
.topic-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.15s ease, background-color 0.15s ease;
}
.topic-card:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

/* ----- CHECKBOX SYSTEM ----- */
.checkbox-wrapper input:checked + div,
input.topic-check:checked + div {
  background-color: var(--accent);
  border-color: var(--accent);
}
.checkbox-wrapper input:checked + div svg,
input.topic-check:checked + div svg {
  transform: scale(1);
}

/* ----- STREAK HEATMAP (80 DAYS) ----- */
.streak-cell {
  transition: transform 0.15s ease, background-color 0.15s ease;
}
.streak-cell:hover {
  transform: scale(1.25);
  z-index: 10;
  outline: 1px solid var(--accent);
}

/* ----- SCROLLBAR (Minimal & Dark) ----- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background: #272730;
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: #3f3f4e;
}

/* ----- UTILITIES ----- */
.force-hide {
  opacity: 0 !important;
  pointer-events: none !important;
  visibility: hidden !important;
}

.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Dynamic Lucide SVGs */
svg.lucide {
  display: inline-block;
  vertical-align: -0.125em;
  width: 1.15em;
  height: 1.15em;
  stroke-width: 2px;
}

/* Print Styles */
@media print {
  body {
    background-color: white;
    color: black;
  }
  .no-print {
    display: none !important;
  }
  .topic-card {
    border: 1px solid #ccc;
    break-inside: avoid;
    margin-bottom: 8px;
    color: black;
    background: white;
  }
  .topic-body {
    display: block !important;
    opacity: 1 !important;
  }
}
