/* ================================================================
   Trunk Trick -- Design System v2
   Dark tech + editorial aesthetic. Amber on zinc.
   ================================================================ */

/* -----------------------------------------------------------------
   Geist Sans -- self-host via CDN (display typeface)
   ----------------------------------------------------------------- */
@font-face {
  font-family: 'Geist Sans';
  src: url('https://cdn.jsdelivr.net/npm/geist@1.3.1/dist/fonts/geist-sans/Geist-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Sans';
  src: url('https://cdn.jsdelivr.net/npm/geist@1.3.1/dist/fonts/geist-sans/Geist-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Sans';
  src: url('https://cdn.jsdelivr.net/npm/geist@1.3.1/dist/fonts/geist-sans/Geist-SemiBold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('https://cdn.jsdelivr.net/npm/geist@1.3.1/dist/fonts/geist-mono/GeistMono-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Geist Mono';
  src: url('https://cdn.jsdelivr.net/npm/geist@1.3.1/dist/fonts/geist-mono/GeistMono-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

/* -----------------------------------------------------------------
   Design Tokens
   ----------------------------------------------------------------- */
:root {
  /* Surfaces (dark zinc scale) */
  --ds-surface:           #09090b;
  --ds-surface-elevated:  #111113;
  --ds-surface-card:      #18181b;
  --ds-surface-hover:     #1f1f23;

  /* Borders */
  --ds-border:            #27272a;
  --ds-border-light:      #3f3f46;
  --ds-border-subtle:     rgba(255,255,255,0.06);

  /* Text */
  --ds-text-primary:      #fafafa;
  --ds-text-secondary:    #a1a1aa;
  --ds-text-tertiary:     #71717a;

  /* Accent -- amber/gold, preserved from original brand */
  --ds-accent:            #e8a840;
  --ds-accent-hover:      #f0b850;
  --ds-accent-muted:      rgba(232, 168, 64, 0.12);
  --ds-accent-glow:       rgba(232, 168, 64, 0.18);

  /* Semantic */
  --ds-success:           #22c55e;
  --ds-error:             #ef4444;
  --ds-warning:           #f59e0b;

  /* Typography */
  --font-display:         'Geist Sans', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body:            system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono:            'Geist Mono', 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;

  /* Type scale */
  --text-xs:              0.75rem;
  --text-sm:              0.875rem;
  --text-base:            1rem;
  --text-lg:              1.125rem;
  --text-xl:              1.25rem;
  --text-2xl:             1.5rem;
  --text-3xl:             1.875rem;
  --text-4xl:             2.25rem;
  --text-5xl:             3rem;
  --text-6xl:             3.75rem;

  /* Spacing */
  --section-gap:          5rem;
  --content-max:          1200px;
  --content-narrow:       800px;
  --nav-height:           64px;

  /* Radii -- single system: all-soft */
  --radius-sm:            6px;
  --radius-md:            10px;
  --radius-lg:            16px;
  --radius-full:          9999px;

  /* Shadows */
  --shadow-sm:            0 1px 2px rgba(0,0,0,0.3);
  --shadow-md:            0 4px 16px rgba(0,0,0,0.5);
  --shadow-lg:            0 8px 32px rgba(0,0,0,0.6);
  --shadow-glow:          0 0 24px var(--ds-accent-glow);

  /* Z-index scale */
  --z-base:               0;
  --z-above:              10;
  --z-nav:                50;
  --z-overlay:            100;
  --z-modal:              200;

  /* Transitions */
  --ease-out-expo:        cubic-bezier(0.16, 1, 0.3, 1);
  --ease-out-quint:       cubic-bezier(0.22, 1, 0.36, 1);
  --duration-fast:        150ms;
  --duration-normal:      300ms;
  --duration-slow:        500ms;
}

/* -----------------------------------------------------------------
   Reset & Base
   ----------------------------------------------------------------- */
*, *::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: var(--text-base);
  line-height: 1.6;
  color: var(--ds-text-primary);
  background: var(--ds-surface);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Typography defaults */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--ds-text-primary);
}

h1 { font-size: var(--text-4xl); }
h2 { font-size: var(--text-3xl); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }

p {
  color: var(--ds-text-secondary);
}

a {
  color: var(--ds-accent);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out-expo);
}

a:hover {
  color: var(--ds-accent-hover);
}

code, pre {
  font-family: var(--font-mono);
}

code {
  font-size: 0.875em;
  color: var(--ds-accent);
  background: var(--ds-accent-muted);
  padding: 0.15em 0.4em;
  border-radius: var(--radius-sm);
}

pre {
  background: var(--ds-surface-elevated);
  border: 1px solid var(--ds-border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  overflow-x: auto;
  font-size: var(--text-sm);
  line-height: 1.6;
}

pre code {
  color: var(--ds-text-primary);
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Selection */
::selection {
  background: var(--ds-accent-muted);
  color: var(--ds-accent);
}

/* Focus ring */
:focus-visible {
  outline: 2px solid var(--ds-accent);
  outline-offset: 2px;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: var(--ds-border);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--ds-border-light);
}

/* -----------------------------------------------------------------
   Shared Layout Utilities
   ----------------------------------------------------------------- */
.ds-container {
  width: 100%;
  max-width: var(--content-max);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.ds-container-narrow {
  width: 100%;
  max-width: var(--content-narrow);
  margin-left: auto;
  margin-right: auto;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.ds-section {
  padding-top: var(--section-gap);
  padding-bottom: var(--section-gap);
}

/* -----------------------------------------------------------------
   Navigation
   ----------------------------------------------------------------- */
.ds-nav {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  height: var(--nav-height);
  background: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(16px) saturate(180%);
  -webkit-backdrop-filter: blur(16px) saturate(180%);
  border-bottom: 1px solid var(--ds-border-subtle);
}

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

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

.ds-nav-logo:hover {
  color: var(--ds-accent);
}

.ds-nav-links {
  display: flex;
  align-items: center;
  gap: 2rem;
  list-style: none;
}

.ds-nav-links a {
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--ds-text-secondary);
  text-decoration: none;
  letter-spacing: -0.01em;
  transition: color var(--duration-fast) var(--ease-out-expo);
}

.ds-nav-links a:hover,
.ds-nav-links a.active {
  color: var(--ds-text-primary);
}

/* Mobile nav */
@media (max-width: 640px) {
  .ds-nav-links {
    gap: 1.25rem;
  }
  .ds-nav-links a {
    font-size: var(--text-xs);
  }
}

/* -----------------------------------------------------------------
   Buttons
   ----------------------------------------------------------------- */
.ds-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--font-display);
  font-size: var(--text-sm);
  font-weight: 500;
  letter-spacing: -0.01em;
  padding: 0.625rem 1.5rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out-expo);
  text-decoration: none;
  white-space: nowrap;
}

.ds-btn:active {
  transform: translateY(1px);
}

/* Primary */
.ds-btn-primary {
  background: var(--ds-accent);
  color: #0a0a0a;
  border-color: var(--ds-accent);
}

.ds-btn-primary:hover {
  background: var(--ds-accent-hover);
  color: #0a0a0a;
}

/* Secondary */
.ds-btn-secondary {
  background: transparent;
  color: var(--ds-text-primary);
  border-color: var(--ds-border-light);
}

.ds-btn-secondary:hover {
  background: var(--ds-surface-card);
  border-color: var(--ds-text-tertiary);
  color: var(--ds-text-primary);
}

/* Ghost */
.ds-btn-ghost {
  background: transparent;
  color: var(--ds-text-secondary);
  border-color: transparent;
}

.ds-btn-ghost:hover {
  background: var(--ds-surface-card);
  color: var(--ds-text-primary);
}

/* -----------------------------------------------------------------
   Cards
   ----------------------------------------------------------------- */
.ds-card {
  background: var(--ds-surface-card);
  border: 1px solid var(--ds-border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  transition: border-color var(--duration-normal) var(--ease-out-expo),
              background var(--duration-normal) var(--ease-out-expo);
}

.ds-card:hover {
  border-color: var(--ds-border);
  background: var(--ds-surface-hover);
}

.ds-card-interactive {
  cursor: pointer;
}

.ds-card-interactive:hover {
  border-color: var(--ds-border-light);
  box-shadow: 0 0 0 1px var(--ds-border-light);
}

/* -----------------------------------------------------------------
   Dividers & Hairlines
   ----------------------------------------------------------------- */
.ds-divider {
  border: none;
  border-top: 1px solid var(--ds-border-subtle);
  margin: 0;
}

/* -----------------------------------------------------------------
   Status dot
   ----------------------------------------------------------------- */
.ds-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--ds-success);
}

/* -----------------------------------------------------------------
   Code block enhancements
   ----------------------------------------------------------------- */
.ds-code-block {
  position: relative;
}

.ds-code-block::before {
  content: '';
  position: absolute;
  top: 0;
  left: 1.25rem;
  right: 1.25rem;
  height: 1px;
  background: var(--ds-border-subtle);
  pointer-events: none;
  opacity: 0;
}

/* -----------------------------------------------------------------
   Animations
   ----------------------------------------------------------------- */
@keyframes ds-fade-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes ds-fade-in-scale {
  from { opacity: 0; transform: scale(0.97); }
  to   { opacity: 1; transform: scale(1); }
}

.ds-animate-in {
  animation: ds-fade-in 0.6s var(--ease-out-expo) both;
}

.ds-animate-delay-1 { animation-delay: 0.1s; }
.ds-animate-delay-2 { animation-delay: 0.2s; }
.ds-animate-delay-3 { animation-delay: 0.3s; }
.ds-animate-delay-4 { animation-delay: 0.4s; }

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