/* ==========================================================================
   Claude Code Resources - stripe.dev inspired design
   ========================================================================== */

/* CSS Custom Properties */
:root {
  /* Colors - Monochromatic Gray */
  --bg-primary: #0a0a0a;
  --bg-secondary: #0f0f0f;
  --bg-tertiary: #151515;
  --bg-hover: #1a1a1a;
  --bg-active: #202020;

  --text-primary: #f0f0f0;
  --text-secondary: #808080;
  --text-muted: #505050;

  --border-primary: #252525;
  --border-secondary: #1a1a1a;
  --border-hover: #353535;

  /* Gold Accent */
  --accent-gold: #b8860b;
  --accent-gold-dim: rgba(184, 134, 11, 0.15);
  --accent-gold-glow: rgba(184, 134, 11, 0.08);

  /* Typography */
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Consolas', monospace;
  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;

  /* Spacing */
  --space-xs: 0.25rem;
  --space-sm: 0.5rem;
  --space-md: 1rem;
  --space-lg: 1.5rem;
  --space-xl: 2rem;
  --space-2xl: 3rem;

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 200ms ease;
  --transition-slow: 300ms ease;

  /* Layout */
  --sidebar-width: 280px;
  --container-max: 1400px;
  --header-height: 60px;
}

/* ==========================================================================
   Reset & Base
   ========================================================================== */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-primary);
  min-height: 100vh;
}

/* ==========================================================================
   Accessibility
   ========================================================================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--text-primary);
  color: var(--bg-primary);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-decoration: none;
  z-index: 1000;
  transition: top var(--transition-fast);
}

.skip-link:focus {
  top: var(--space-md);
}

/* Focus styles */
:focus-visible {
  outline: 2px solid var(--text-secondary);
  outline-offset: 2px;
}

/* ==========================================================================
   Layout
   ========================================================================== */

.container {
  max-width: var(--container-max);
  margin: 0 auto;
  padding: var(--space-xl) var(--space-lg);
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
}

@media (min-width: 768px) {
  .content-grid {
    grid-template-columns: var(--sidebar-width) 1fr;
    gap: var(--space-2xl);
  }
}

/* ==========================================================================
   Header
   ========================================================================== */

.feed-header {
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border-primary);
}

.feed-title {
  font-family: var(--font-sans);
  font-size: 2rem;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

.feed-count {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 400;
  color: var(--text-secondary);
  vertical-align: super;
  margin-left: 0.25em;
}

/* ==========================================================================
   Filter Sidebar
   ========================================================================== */

.filter-sidebar {
  display: none;
  flex-direction: column;
  gap: var(--space-lg);
}

@media (min-width: 768px) {
  .filter-sidebar {
    display: flex;
  }
}

.filter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.filter-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
}

.clear-filters-btn {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--space-xs) var(--space-sm);
  margin-left: auto;
  transition: color var(--transition-fast);
}

.clear-filters-btn:hover {
  color: var(--text-secondary);
}

.drawer-close {
  display: none;
}

/* Filter Groups */
.filter-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.filter-group-label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
  padding-bottom: var(--space-xs);
  border-bottom: 1px solid var(--border-secondary);
}

.filter-options {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Custom Checkbox */
.filter-option {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-xs) 0;
  cursor: pointer;
  transition: opacity var(--transition-fast);
}

.filter-option:hover {
  opacity: 0.8;
}

.filter-option input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.checkbox-custom {
  width: 12px;
  height: 12px;
  border: 1px solid var(--text-muted);
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.filter-option input[type="checkbox"]:checked + .checkbox-custom {
  background: var(--text-primary);
  border-color: var(--text-primary);
}

.filter-option input[type="checkbox"]:checked + .checkbox-custom::after {
  content: '';
  width: 4px;
  height: 4px;
  background: var(--bg-primary);
}

.filter-option input[type="checkbox"]:focus-visible + .checkbox-custom {
  outline: 2px solid var(--text-secondary);
  outline-offset: 2px;
}

.filter-text {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.filter-count {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Canvas Art
   ========================================================================== */

.canvas-container {
  margin-top: var(--space-lg);
  border: 1px solid var(--border-primary);
  background: var(--bg-secondary);
  overflow: hidden;
}

.canvas-chrome {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-sm) var(--space-md);
  border-bottom: 1px solid var(--border-primary);
}

.canvas-label {
  font-family: var(--font-mono);
  font-size: 0.625rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--text-muted);
}

#geometric-canvas {
  display: block;
  width: 100%;
  height: 180px;
  background: var(--bg-secondary);
}

/* ==========================================================================
   Resource List
   ========================================================================== */

.resource-section {
  min-height: 400px;
}

.list-header {
  display: grid;
  grid-template-columns: 90px 1fr 70px;
  gap: var(--space-md);
  padding: var(--space-sm) 0;
  border-bottom: 1px solid var(--border-primary);
  margin-bottom: var(--space-xs);
}

.list-header span {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-secondary);
}

.list-header-type {
  text-align: right;
}

.resource-list {
  list-style: none;
  display: flex;
  flex-direction: column;
}

.resource-item {
  display: grid;
  grid-template-columns: 90px 1fr 70px;
  gap: var(--space-md);
  padding: var(--space-md) 0;
  border-bottom: 1px solid var(--border-secondary);
  text-decoration: none;
  color: inherit;
  transition: background var(--transition-fast);
  position: relative;
}

.resource-item:hover {
  background: var(--bg-hover);
  margin: 0 calc(var(--space-md) * -1);
  padding-left: var(--space-md);
  padding-right: var(--space-md);
}

.resource-item:focus-visible {
  background: var(--bg-hover);
  outline: none;
}

.resource-date {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-xs);
}

.resource-date::before {
  content: '';
  width: 6px;
  height: 6px;
  background: var(--border-primary);
  flex-shrink: 0;
}

.resource-item:hover .resource-date::before {
  background: var(--text-muted);
}

.resource-title {
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  font-weight: 400;
  color: var(--text-primary);
  line-height: 1.4;
}

.resource-type {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  text-align: right;
  padding-top: 3px;
}

/* Highlighted resource items */
.resource-item.highlighted {
  background: var(--accent-gold-glow);
  border-left: 2px solid var(--accent-gold);
  padding-left: calc(var(--space-md) - 2px);
  margin-left: calc(var(--space-md) * -1);
}

.resource-item.highlighted .resource-date::before {
  background: var(--accent-gold);
  box-shadow: 0 0 8px var(--accent-gold-dim);
}

.resource-item.highlighted:hover {
  background: var(--accent-gold-dim);
}

.resource-item.highlighted .resource-title {
  color: #d4a855;
}

.resource-item.highlighted .resource-type {
  color: var(--accent-gold);
}

/* ==========================================================================
   Empty State
   ========================================================================== */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-2xl);
  text-align: center;
  min-height: 300px;
}

.empty-state[hidden] {
  display: none;
}

.empty-message {
  font-family: var(--font-sans);
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.empty-hint {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Tooltip
   ========================================================================== */

.tooltip {
  position: fixed;
  max-width: 320px;
  padding: var(--space-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  pointer-events: none;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity var(--transition-fast), transform var(--transition-fast);
  z-index: 1000;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

.tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

.tooltip p {
  font-family: var(--font-sans);
  font-size: 0.8125rem;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 0;
}

/* ==========================================================================
   Mobile Drawer
   ========================================================================== */

.mobile-filter-toggle {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  position: fixed;
  bottom: var(--space-lg);
  right: var(--space-lg);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  color: var(--text-primary);
  cursor: pointer;
  z-index: 100;
  transition: all var(--transition-fast);
}

.mobile-filter-toggle:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

.mobile-filter-toggle .label {
  font-family: var(--font-mono);
  font-size: 0.6875rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

@media (min-width: 768px) {
  .mobile-filter-toggle {
    display: none;
  }
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
  z-index: 200;
}

.drawer-backdrop.visible {
  opacity: 1;
  visibility: visible;
}

/* Mobile drawer state */
@media (max-width: 767px) {
  .filter-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(320px, 85vw);
    background: var(--bg-primary);
    border-right: 1px solid var(--border-primary);
    padding: var(--space-xl) var(--space-lg);
    transform: translateX(-100%);
    transition: transform var(--transition-slow);
    z-index: 300;
    overflow-y: auto;
  }

  .filter-sidebar.open {
    display: flex;
    transform: translateX(0);
  }

  .drawer-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: none;
    border: 1px solid var(--border-primary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
  }

  .drawer-close:hover {
    border-color: var(--border-hover);
    color: var(--text-primary);
  }

  .filter-header {
    margin-bottom: var(--space-md);
  }

  .list-header {
    grid-template-columns: 70px 1fr 60px;
  }

  .resource-item {
    grid-template-columns: 70px 1fr 60px;
  }
}

/* ==========================================================================
   Animations & Reduced Motion
   ========================================================================== */

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

  #geometric-canvas {
    display: none;
  }
}

/* Initial load animation */
.resource-item {
  animation: fadeInUp 0.4s ease backwards;
}

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

/* Stagger animation for list items */
.resource-item:nth-child(1) { animation-delay: 0.05s; }
.resource-item:nth-child(2) { animation-delay: 0.1s; }
.resource-item:nth-child(3) { animation-delay: 0.15s; }
.resource-item:nth-child(4) { animation-delay: 0.2s; }
.resource-item:nth-child(5) { animation-delay: 0.25s; }
.resource-item:nth-child(6) { animation-delay: 0.3s; }
.resource-item:nth-child(7) { animation-delay: 0.35s; }
.resource-item:nth-child(8) { animation-delay: 0.4s; }
.resource-item:nth-child(9) { animation-delay: 0.45s; }
.resource-item:nth-child(10) { animation-delay: 0.5s; }
.resource-item:nth-child(n+11) { animation-delay: 0.55s; }

/* ==========================================================================
   Scrollbar
   ========================================================================== */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--border-primary);
  border-radius: 0;
}

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

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-primary) var(--bg-primary);
}

/* ==========================================================================
   Post Overlay
   ========================================================================== */

.post-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.post-overlay[hidden] {
  display: none;
}

.post-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
}

.post-overlay-content {
  position: relative;
  width: calc(100% - 4rem);
  max-width: 800px;
  max-height: calc(100vh - 6rem);
  margin: 3rem auto;
  padding: var(--space-2xl) var(--space-xl);
  overflow-y: auto;
  background: var(--bg-primary);
  border: 1px solid var(--border-primary);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03),
    0 24px 80px -12px rgba(0, 0, 0, 0.8),
    0 0 120px -20px rgba(0, 0, 0, 0.5);
  animation: modalSlideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.post-overlay-close {
  position: absolute;
  top: var(--space-md);
  right: var(--space-md);
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--border-primary);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 1.5rem;
  line-height: 1;
  border-radius: 0;
  cursor: pointer;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.post-overlay-close:hover {
  background: var(--bg-hover);
  border-color: var(--border-hover);
}

/* Loading & Error States */
.post-loading,
.post-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 200px;
  color: var(--text-muted);
  gap: var(--space-md);
}

.post-loading[hidden],
.post-error[hidden],
.post-container[hidden] {
  display: none;
}

.spinner {
  width: 2rem;
  height: 2rem;
  border: 2px solid var(--border-primary);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.post-error {
  color: #ef4444;
}

.post-error p {
  font-family: var(--font-mono);
  font-size: 0.875rem;
}

/* Post Header */
.post-header {
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border-primary);
}

.post-title {
  font-family: var(--font-sans);
  font-size: 2rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--text-primary);
  margin-bottom: var(--space-md);
  letter-spacing: -0.02em;
}

.post-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.post-meta-separator {
  color: var(--border-primary);
}

/* ==========================================================================
   Post Body - Markdown Styles
   ========================================================================== */

.post-body {
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.8;
  color: var(--text-primary);
}

.post-body > *:first-child {
  margin-top: 0;
}

.post-body h1,
.post-body h2,
.post-body h3,
.post-body h4,
.post-body h5,
.post-body h6 {
  font-family: var(--font-sans);
  font-weight: 500;
  line-height: 1.4;
  color: var(--text-primary);
  margin-top: 2em;
  margin-bottom: 0.75em;
  letter-spacing: -0.01em;
}

.post-body h1 { font-size: 1.75rem; }
.post-body h2 { font-size: 1.5rem; }
.post-body h3 { font-size: 1.25rem; }
.post-body h4 { font-size: 1.125rem; }
.post-body h5 { font-size: 1rem; }
.post-body h6 { font-size: 0.875rem; color: var(--text-secondary); }

.post-body p {
  margin-bottom: 1.25em;
}

.post-body a {
  color: var(--text-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
  transition: opacity var(--transition-fast);
}

.post-body a:hover {
  opacity: 0.7;
}

/* Inline Code */
.post-body code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-tertiary);
  padding: 0.2em 0.4em;
  border: 1px solid var(--border-secondary);
}

/* Code Blocks */
.post-body pre {
  background: #0d1117;
  padding: var(--space-md);
  margin: 1.5em 0;
  overflow-x: auto;
  border: 1px solid var(--border-primary);
}

.post-body pre code {
  background: none;
  padding: 0;
  border: none;
  font-size: 0.8125rem;
  line-height: 1.6;
}

/* Blockquotes */
.post-body blockquote {
  border-left: 3px solid var(--border-primary);
  padding-left: var(--space-md);
  margin: 1.5em 0;
  color: var(--text-secondary);
  font-style: italic;
}

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

/* Lists */
.post-body ul,
.post-body ol {
  margin: 1.25em 0;
  padding-left: 1.5em;
}

.post-body li {
  margin-bottom: 0.5em;
}

.post-body li > ul,
.post-body li > ol {
  margin: 0.5em 0;
}

/* Tables */
.post-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5em 0;
  font-size: 0.875rem;
}

.post-body th,
.post-body td {
  border: 1px solid var(--border-primary);
  padding: var(--space-sm) var(--space-md);
  text-align: left;
}

.post-body th {
  background: var(--bg-tertiary);
  font-weight: 500;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.post-body tr:hover td {
  background: var(--bg-secondary);
}

/* Images */
.post-body img {
  max-width: 100%;
  height: auto;
  margin: 1.5em 0;
  border: 1px solid var(--border-primary);
}

/* Horizontal Rule */
.post-body hr {
  border: none;
  border-top: 1px solid var(--border-primary);
  margin: 2em 0;
}

/* Task Lists (GFM) */
.post-body input[type="checkbox"] {
  margin-right: var(--space-sm);
  accent-color: var(--text-primary);
}

.post-body ul:has(input[type="checkbox"]) {
  list-style: none;
  padding-left: 0;
}

/* Strikethrough */
.post-body del {
  color: var(--text-muted);
}

/* Mobile adjustments */
@media (max-width: 767px) {
  .post-overlay-content {
    width: calc(100% - 2rem);
    max-height: calc(100vh - 4rem);
    margin: 2rem auto;
    padding: var(--space-xl) var(--space-md);
  }

  .post-title {
    font-size: 1.5rem;
  }

  .post-body {
    font-size: 0.9375rem;
  }

  .post-body pre {
    margin-left: calc(var(--space-md) * -1);
    margin-right: calc(var(--space-md) * -1);
    border-left: none;
    border-right: none;
  }
}
