/* ponytail: fonts self-hosted as variable woff2 (latin subset) in public/fonts/
   for true offline-first — a desktop app must not depend on Google's CDN. */
@font-face {
  font-family: "Cinzel";
  font-style: normal;
  font-weight: 600 700;
  font-display: swap;
  src: url("/fonts/cinzel.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 600;
  font-display: swap;
  src: url("/fonts/inter.woff2") format("woff2");
}
@font-face {
  font-family: "JetBrains Mono";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/fonts/jetbrainsmono.woff2") format("woff2");
}

@import "tailwindcss";

/* ─── Design Tokens ─────────────────────────────────────────── */

@theme {
  /* Background layers */
  --color-bg-deep: #0a0e1a;
  --color-bg-surface: #111827;
  --color-bg-card: #1a2236;
  --color-bg-card-hover: #1f2a42;

  /* Borders */
  --color-border-glass: rgba(212, 175, 55, 0.12);
  --color-border-subtle: rgba(255, 255, 255, 0.06);

  /* Gold accents */
  --color-gold-bright: #d4af37;
  --color-gold-muted: #a8872a;
  --color-gold-glow: rgba(212, 175, 55, 0.25);

  /* Text — #7080a0 hits ~5.0:1 against --color-bg-deep (WCAG AA). */
  --color-text-primary: #e8e0d0;
  --color-text-secondary: #8b9bb4;
  --color-text-dim: #7080a0;

  /* Semantic */
  --color-danger: #ef4444;
  --color-success: #22c55e;
  --color-info: #3b82f6;

  /* Fonts */
  --font-heading: "Cinzel", serif;
  --font-sans: "Inter", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
}

/* ─── Base Styles ───────────────────────────────────────────── */

* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-gold-muted) transparent;
}

html,
body,
#root {
  margin: 0;
  padding: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--color-bg-deep);
  background: radial-gradient(ellipse at 50% 0%, #141e33 0%, var(--color-bg-deep) 70%);
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─── Glassmorphism Card ─────────────────────────────────────── */

.glass-card {
  background: rgba(26, 34, 54, 0.55);
  backdrop-filter: blur(18px) saturate(1.3);
  -webkit-backdrop-filter: blur(18px) saturate(1.3);
  border: 1px solid rgba(212, 175, 55, 0.12);
  border-radius: 16px;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.03),
    0 2px 8px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transition:
    box-shadow 0.2s ease,
    border-color 0.2s ease;
}

.glass-card:hover {
  border-color: rgba(212, 175, 55, 0.25);
  box-shadow:
    0 0 20px rgba(212, 175, 55, 0.08),
    0 4px 16px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.glass-card-active {
  border-color: var(--color-gold-bright) !important;
  box-shadow:
    0 0 24px rgba(212, 175, 55, 0.15),
    0 4px 16px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}

/* ─── Utility Classes ────────────────────────────────────────── */

.font-heading {
  font-family: var(--font-heading);
}

.font-mono {
  font-family: var(--font-mono);
}

.text-gold {
  color: var(--color-gold-bright);
}

.border-gold {
  border-color: var(--color-gold-bright);
}

.bg-deep {
  background-color: var(--color-bg-deep);
}

.bg-surface {
  background-color: var(--color-bg-surface);
}

.bg-card {
  background-color: var(--color-bg-card);
}

/* Gold glowing focus ring */
*:focus-visible {
  outline: 2px solid var(--color-gold-bright);
  outline-offset: 2px;
}

/* ponytail: custom tooltip on any [data-tooltip] element. The label sits to
   the right of icon-only nav buttons, hidden until hover or keyboard focus. */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  background: var(--color-bg-deep);
  color: var(--color-text-primary);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  padding: 4px 8px;
  border: 1px solid var(--color-gold-muted);
  border-radius: 6px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease 0.2s;
  z-index: 50;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
[data-tooltip]:hover::after,
[data-tooltip]:focus-visible::after {
  opacity: 1;
}

/* ─── Animations ──────────────────────────────────────────────── */

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateX(1rem);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ponytail: shimmer skeleton for image/art loading, and a thinking-dot
   cycle for LLM waits. Replaces "Generating…" button text for 5–20s waits. */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.skeleton {
  background: linear-gradient(
    90deg,
    var(--color-bg-surface) 25%,
    var(--color-bg-card-hover) 50%,
    var(--color-bg-surface) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}

@keyframes thinking {
  0%, 80%, 100% { opacity: 0.2; }
  40% { opacity: 1; }
}
.thinking-dot {
  animation: thinking 1.2s ease-in-out infinite;
}
.thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.thinking-dot:nth-child(3) { animation-delay: 0.4s; }

/* ponytail: respect users who ask for less motion. framer-motion honors this
   via its useReducedMotion hook, but the inline keyframes/glass-card transitions
   still need this CSS guard. */
@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;
  }
  [data-tooltip]::after {
    transition: none;
  }
}

/* ponytail: rendered Markdown for the session summary. Uses design tokens so
   it matches the glass-card surface. */
.md-preview h1, .md-preview h2, .md-preview h3 {
  font-family: var(--font-heading), serif;
  color: var(--color-gold-bright);
  font-weight: 600;
  margin: 0.6em 0 0.3em;
}
.md-preview h1 { font-size: 1.15rem; }
.md-preview h2 { font-size: 1.05rem; }
.md-preview h3 { font-size: 0.95rem; }
.md-preview p { margin: 0.35em 0; line-height: 1.5; }
.md-preview ul { margin: 0.35em 0; padding-left: 1.2em; list-style: disc; }
.md-preview li { margin: 0.15em 0; }
.md-preview code {
  font-family: var(--font-mono), monospace;
  font-size: 0.85em;
  background: var(--color-bg-deep);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}
.md-preview a { color: var(--color-gold-bright); text-decoration: underline; }
.md-preview strong { color: var(--color-text-primary); }