@import "tailwindcss";
@plugin "@tailwindcss/typography";

@layer base {
  a[href],
  button,
  select,
  summary,
  [role="button"],
  [role="link"],
  [role="option"],
  [role="menuitem"],
  [role="tab"] {
    cursor: pointer;
  }
}

@theme {
  --font-sans: "Geist", ui-sans-serif, system-ui, sans-serif,
    "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  --font-mono: "JetBrains Mono", ui-monospace, monospace;

  /* Primary — Teal */
  --color-teal-300: #B5DDEF;
  --color-teal-500: #67B2D7;
  --color-teal-700: #357F9E;

  /* Neutrals Dark — Navy */
  --color-navy-950: #0F1729;
  --color-navy-800: #252C3D;
  --color-navy-600: #4B5768;

  /* Neutrals Light — Ice */
  --color-ice-50: #F7F9FB;
  --color-ice-100: #E8EDF3;
  --color-ice-300: #A8B5C5;

  /* Accent */
  --color-mint: #5AC8A8;
  --color-amber: #F0A45B;
  --color-coral: #E86B6B;

  /* ── Semantic tokens (dark defaults) ── */
  --color-page: #0F1729;
  --color-panel: #252C3D;
  --color-panel-alt: #1a2133;
  --color-overlay: rgba(255, 255, 255, 0.04);
  --color-overlay-strong: rgba(255, 255, 255, 0.10);
  --color-fg: #ffffff;
  --color-fg-2: #E8EDF3;
  --color-fg-3: #A8B5C5;
  --color-fg-muted: #4B5768;
  --color-line: rgba(255, 255, 255, 0.06);
  --color-line-strong: rgba(255, 255, 255, 0.12);
  --color-focus: rgba(103, 178, 215, 0.4);
}

/* ── Light theme overrides ── */

.light {
  /* Semantic tokens */
  --color-page: #ffffff;
  --color-panel: #f8fafc;
  --color-panel-alt: #f1f5f9;
  --color-overlay: rgba(0, 0, 0, 0.04);
  --color-overlay-strong: rgba(0, 0, 0, 0.10);
  --color-fg: #0f172a;
  --color-fg-2: #1e293b;
  --color-fg-3: #475569;
  --color-fg-muted: #94a3b8;
  --color-line: rgba(0, 0, 0, 0.08);
  --color-line-strong: rgba(0, 0, 0, 0.15);
  --color-focus: rgba(14, 116, 144, 0.5);

  /* Accent — darkened for WCAG AA on white */
  --color-mint: #0d9488;
  --color-amber: #d97706;
  --color-coral: #dc2626;
  --color-teal-300: #0891b2;
  --color-teal-500: #0e7490;
}

/* ── Chart variables ── */

:root {
  --chart-gridline: rgba(255, 255, 255, 0.04);
  --chart-axis-label: rgba(75, 87, 104, 1);
}

.light {
  --chart-gridline: rgba(0, 0, 0, 0.06);
  --chart-axis-label: rgba(71, 85, 105, 1);
}

/* ── Background atmosphere ── */

.bg-atmosphere {
  background-color: var(--color-page);
  background-image:
    radial-gradient(ellipse 120% 60% at 15% 5%, rgba(53, 127, 158, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse 80% 50% at 85% 90%, rgba(90, 200, 168, 0.07) 0%, transparent 45%);
  background-attachment: fixed;
}

.light .bg-atmosphere,
.light.bg-atmosphere {
  background-image:
    radial-gradient(ellipse 120% 60% at 15% 5%, rgba(14, 116, 144, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse 80% 50% at 85% 90%, rgba(13, 148, 136, 0.04) 0%, transparent 45%);
}

.bg-atmosphere::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 200px 200px;
}

.light .bg-atmosphere::before,
.light.bg-atmosphere::before {
  opacity: 0.03;
}

/* ── @pierre/diffs brand overrides ── */

:root {
  --diffs-font-family: "JetBrains Mono", ui-monospace, monospace;
  --diffs-header-font-family: "Geist", ui-sans-serif, system-ui, sans-serif;
  --diffs-font-size: 13px;
  --diffs-line-height: 20px;

  /* Surfaces */
  --diffs-bg-buffer-override: #0F1729;
  --diffs-bg-context-override: #161d2e;
  --diffs-bg-hover-override: #1c2438;
  --diffs-bg-separator-override: #252C3D;

  /* Line numbers */
  --diffs-fg-number-override: #4B5768;

  /* Additions — mint */
  --diffs-addition-color-override: #5AC8A8;
  --diffs-fg-number-addition-override: rgba(90, 200, 168, 0.5);

  /* Deletions — coral */
  --diffs-deletion-color-override: #E86B6B;
  --diffs-fg-number-deletion-override: rgba(232, 107, 107, 0.5);
}

/* ── Server-rendered SVG graph overrides ── */
/* The server injects @media (prefers-color-scheme: dark) but the app uses
   .dark/.light classes, so we apply dark-mode colors via the class. */

.dark .graph-svg text { fill: #c6d4e0; }
.dark .graph-svg [stroke="#357f9e"] { stroke: #67B2D7; }
.dark .graph-svg [stroke="#666666"] { stroke: #5a7a94; }
.dark .graph-svg polygon[fill="#357f9e"] { fill: #67B2D7; }
.dark .graph-svg polygon[fill="#666666"] { fill: #5a7a94; }
.dark .graph-svg ellipse[fill="#ffffff"],
.dark .graph-svg polygon[fill="#ffffff"] { fill: #1a2b3c; }
.dark .graph-svg ellipse[stroke="#357f9e"],
.dark .graph-svg polygon[stroke="#357f9e"] { stroke: #67B2D7; }
.dark .graph-svg [fill="#1a1a1a"] { fill: #c6d4e0; }

.light {
  --diffs-bg-buffer-override: #ffffff;
  --diffs-bg-context-override: #f8fafc;
  --diffs-bg-hover-override: #f1f5f9;
  --diffs-bg-separator-override: #e2e8f0;
  --diffs-fg-number-override: #94a3b8;
  --diffs-addition-color-override: #0d9488;
  --diffs-fg-number-addition-override: rgba(13, 148, 136, 0.5);
  --diffs-deletion-color-override: #dc2626;
  --diffs-fg-number-deletion-override: rgba(220, 38, 38, 0.5);
}
