/* ========================================
   TINYRISKS DESIGN SYSTEM
   A modular component library
   ======================================== */

/* 1. GLOBAL VARIABLES (The DNA) */
:root {
  /* COLORS - LIGHT THEME "Drafting Table" */
  --bg: #fafaf8;
  /* Clean paper (was #0f1115 dark) */
  --panel: #ffffff;
  /* Pristine white (was #14181f darker panel) */
  --ink: #0f1115;
  /* Deep charcoal - INVERTED (was #ffffff light) */
  --muted: #5a5e68;
  /* Darkened gray for contrast (was #8b8f98) */
  --line: #e0e0dc;
  /* Subtle grid lines (was #2a2e37 dark) */
  --accent: #b8895a;
  /* Brass darkened 15% for light bg (was #d6a76c) */

  /* TYPOGRAPHY */
  --font-serif: "Georgia", serif;
  --font-sans: "Helvetica Neue", "Arial", "system-ui", sans-serif;
  --font-mono: "Menlo", monospace;

  /* SPACING */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 32px;
  --space-xl: 64px;
  --radius: 2px;

  /* SHADOWS - New for light theme */
  --shadow-sm: 0 2px 8px rgba(15, 17, 21, 0.08);
  --shadow-md: 0 4px 16px rgba(15, 17, 21, 0.12);
  --shadow-lg: 0 8px 24px rgba(15, 17, 21, 0.16);

  /* FEEDBACK COLORS */
  --success: #059669;
  --danger: #dc2626;
}

/* DARK THEME (Optional - via data attribute) */
[data-theme="dark"] {
  --bg: #0f1115;
  --panel: #14181f;
  --ink: #ffffff;
  --muted: #8b8f98;
  --line: #2a2e37;
  --accent: #d6a76c;

  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
}

/* Auto Dark Mode (System Preference) */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg: #0f1115;
    --panel: #14181f;
    --ink: #ffffff;
    --muted: #8b8f98;
    --line: #2a2e37;
    --accent: #d6a76c;

    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.5);
  }
}

/* BASE RESET */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Remove grid on dark theme */
[data-theme="dark"] body,
@media (prefers-color-scheme: dark) {
  body {
    background-image: none;
  }
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--ink);
}

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


/* ========================================
   NOTE: LAYOUT UTILITIES
   Moved to css/layout.css for better organization
   (Grid, Container, Section, Flexbox)
   ======================================== */


/* ========================================
   NAVIGATION COMPONENT
   ======================================== */

/* ========================================
   NAVIGATION COMPONENT
   ======================================== */

.nav {
  border-bottom: 3px solid var(--ink);
  background: color-mix(in srgb, var(--bg), transparent 15%);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.05);
  /* Subtle depth */
}

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

.nav-logo {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-serif);
  font-size: 1.35rem;
  font-weight: 900;
  font-style: italic;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-decoration: none;
  position: relative;
  z-index: 10;
}

.brand-alien {
  width: 28px;
  height: 28px;
  color: var(--ink);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.nav-logo:hover .brand-alien {
  transform: scale(1.2) rotate(10deg);
  color: var(--accent);
}

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

.nav-links {
  display: flex;
  gap: var(--space-xs);
  /* Use tighter gap, larger padding handles space */
  list-style: none;
  align-items: center;
}

.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink);
  padding: 8px 14px;
  /* Compressed tap targets */
  border: 2px solid transparent;
  border-radius: var(--radius);
  transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease, color 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.nav-links a:hover {
  color: var(--accent);
  border-bottom: 2px solid transparent;
  border-bottom-color: var(--accent);
}

.nav-links a.active {
  color: var(--accent);
  border-bottom: 2px solid var(--accent);
  font-weight: 800;
}


/* ========================================
   2. KICKER & TYPOGRAPHY
   ======================================== */

.kicker {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  display: block;
  margin-bottom: var(--space-sm);
}

.headline {
  font-family: var(--font-serif);
  font-size: 2.5rem;
  font-weight: 400;
  line-height: 1.1;
  color: var(--ink);
  margin: 0 0 var(--space-md) 0;
}

.headline-lg {
  font-size: 3.5rem;
}

.headline-sm {
  font-size: 1.8rem;
}

.subhead {
  font-family: var(--font-sans);
  font-size: 1.2rem;
  color: var(--muted);
  line-height: 1.4;
  max-width: 60ch;
}


/* ========================================
   2.5 BUTTONS (Composable)
   ======================================== */

.btn {
  --btn-bg: var(--panel);
  --btn-fg: var(--ink);
  --btn-border: var(--line);
  --btn-shadow: var(--shadow-sm);

  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  /* default = md */
  border: 1px solid var(--btn-border);
  border-radius: var(--radius);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  user-select: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease, transform 0.06s ease;
}

.btn:hover {
  box-shadow: var(--btn-shadow);
}

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

.btn:disabled,
.btn[aria-disabled="true"],
.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  box-shadow: none;
}

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

/* Variants */
.btn--primary {
  --btn-bg: var(--accent);
  --btn-fg: var(--bg);
  --btn-border: var(--accent);
}

.btn--secondary {
  --btn-bg: var(--panel);
  --btn-fg: var(--ink);
  --btn-border: var(--line);
}

.btn--outline {
  --btn-bg: transparent;
  --btn-fg: var(--accent);
  --btn-border: var(--accent);
}

.btn--ghost {
  --btn-bg: transparent;
  --btn-fg: var(--muted);
  --btn-border: transparent;
}

.btn--ghost:hover {
  --btn-fg: var(--accent);
  --btn-border: var(--line);
}

.btn--danger {
  --btn-bg: var(--danger);
  --btn-fg: #fff;
  --btn-border: var(--danger);
}

.btn--success {
  --btn-bg: var(--success);
  --btn-fg: #fff;
  --btn-border: var(--success);
}

/* Sizes */
.btn--sm {
  padding: 6px 10px;
  font-size: 0.85rem;
}

.btn--md {
  padding: 10px 14px;
  font-size: 0.95rem;
}

.btn--lg {
  padding: 12px 18px;
  font-size: 1rem;
}

.btn--block {
  width: 100%;
}

.btn__icon {
  display: inline-flex;
  width: 1em;
  height: 1em;
}

@media (prefers-reduced-motion: reduce) {
  .btn {
    transition: none;
  }
}


/* ========================================
   3. MODULE (Universal Card)
   ======================================== */

.module {
  border: 1px solid var(--line);
  background: var(--bg);
  transition: transform 0.2s ease, border-color 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
}

.module:hover {
  transform: translateY(-4px);
  border-color: var(--accent);
  z-index: 10;
  box-shadow: var(--shadow-md);
}

.module-lens {
  width: 100%;
  aspect-ratio: 4/3;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: #000;
}

.module-lens img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(100%) brightness(0.95);
  transition: filter 0.3s;
}

.module:hover .module-lens img {
  filter: grayscale(0%);
}

.module-body {
  padding: var(--space-md);
}

.module-title {
  font-family: var(--font-serif);
  font-size: 1.3rem;
  color: var(--ink);
  margin: var(--space-sm) 0;
}

.module-meta {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}


/* ========================================
   4. DECK (Audio Player)
   ======================================== */

.deck {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  position: relative;
  z-index: 1;
  overflow: visible;
}

.deck-info {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.deck-title {
  color: var(--ink);
}

.deck-meta {
  color: var(--muted);
  font-size: 0.75rem;
}


/* ========================================
   5. FRAME (Video)
   ======================================== */

.frame {
  width: 100%;
  aspect-ratio: 16/9;
  border: 1px solid var(--line);
  background: #000;
  position: relative;
  overflow: hidden;
}

.frame::after {
  content: "REC •";
  position: absolute;
  top: 12px;
  right: 12px;
  font-family: var(--font-mono);
  color: red;
  font-size: 0.7rem;
  pointer-events: none;
  opacity: 0.8;
}

.frame video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}


/* ========================================
   6. PROSE (Reading Container)
   ======================================== */

.prose {
  max-width: 65ch;
  margin: 0 auto;
  font-family: var(--font-sans);
  font-size: 1.1rem;
  line-height: 1.6;
  color: var(--ink);
}

.prose p {
  margin-bottom: 1.5em;
}

.prose h2 {
  font-family: var(--font-serif);
  font-size: 2rem;
  margin: 2em 0 0.5em 0;
  color: var(--ink);
}

.prose h3 {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  margin: 1.5em 0 0.5em 0;
  color: var(--ink);
}

.prose blockquote {
  border-left: 2px solid var(--accent);
  margin: 2em 0;
  padding-left: 1em;
  font-style: italic;
  color: var(--muted);
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--panel);
  padding: 2px 6px;
  border-radius: var(--radius);
}

.prose pre {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: var(--space-md);
  overflow-x: auto;
  margin: 2em 0;
}

.prose pre code {
  background: none;
  padding: 0;
}

.prose ul,
.prose ol {
  margin: 1em 0 1em 2em;
}

.prose li {
  margin-bottom: 0.5em;
}


/* ========================================
   7. DATUM (Divider)
   ======================================== */

.datum {
  width: 100%;
  height: 1px;
  background: var(--line);
  margin: var(--space-lg) 0;
  position: relative;
}

.datum::after {
  content: "+";
  position: absolute;
  left: 50%;
  top: -8px;
  transform: translateX(-50%);
  background: var(--bg);
  color: var(--muted);
  padding: 0 4px;
  font-family: var(--font-mono);
}


/* ========================================
   HERO COMPONENT
   ======================================== */

.hero {
  min-height: 28vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: clamp(16px, 3vw, 32px) clamp(16px, 2vw, 24px);
  border-bottom: 1px solid var(--line);
}

.hero-content {
  max-width: 800px;
}


/* ========================================
   FOOTER COMPONENT
   ======================================== */

.footer {
  border-top: 1px solid var(--line);
  padding: var(--space-lg) 0;
  margin-top: clamp(32px, 4vw, 48px);
}

.footer-inner {
  max-width: 1600px;
  margin: 0 auto;
  padding: 0 var(--space-md);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-md);
  position: relative;
}

.footer-text {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  z-index: 2;
}

.footer-scene {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 40px;
  overflow: hidden;
  pointer-events: none;
  opacity: 0.6;
}

.alien-chase {
  position: absolute;
  display: flex;
  gap: 20px;
  align-items: flex-end;
  bottom: 5px;
  left: -200px;
  animation: chase-across 15s linear infinite;
}

.runner {
  width: 24px;
  height: 24px;
}

.runner.chased {
  animation: bob 0.4s infinite ease-in-out alternate;
}

.runner.chaser {
  animation: bob 0.4s infinite ease-in-out alternate-reverse;
}

.runner .leg {
  transform-origin: top;
  animation: run-legs 0.2s infinite alternate ease-in-out;
}

@keyframes chase-across {
  0% {
    left: -100px;
  }

  100% {
    left: 100%;
  }
}

@keyframes bob {
  0% {
    transform: translateY(0) rotate(-2deg);
  }

  100% {
    transform: translateY(-3px) rotate(2deg);
  }
}

@keyframes run-legs {
  0% {
    transform: rotate(-15deg);
  }

  100% {
    transform: rotate(15deg);
  }
}


/* ========================================
   RESPONSIVE BREAKPOINTS
   ======================================== */

@media (max-width: 768px) {
  .headline {
    font-size: 2rem;
  }

  .headline-lg {
    font-size: 2.5rem;
  }

  .nav-inner {
    flex-direction: column;
    gap: var(--space-md);
  }

  .nav-links {
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
  }

  .nav-links a {
    flex-grow: 1;
    text-align: center;
    padding: 14px 10px;
    /* Even larger touch target for mobile */
    font-size: 0.85rem;
  }
}