/* ===========================================================================
   Crye Precision brand layer for the Django app.
   Ported verbatim 2026-07 from the retired React app's index.css (the design
   source of truth at port time; history: CP_DB repo): Crye typefaces, oklch
   color tokens (light + dark), the cp-* typography
   utilities, and the markdown/shimmer styles. Plain CSS only — no Tailwind
   @apply — so it loads under the Tailwind Play CDN without a build step.
   The token VARIABLES here are also registered as Tailwind colors in base.html,
   so utilities like bg-background / text-muted-foreground / border-border work.
   =========================================================================== */

/* --- Crye typefaces. Two files per family share a name with split weight
   ranges so weight >=600 selects the Bold cut. ascent/descent overrides
   center uppercase on the cap band in tight boxes (see index.css notes). --- */
@font-face {
  font-family: "Crye Copy";
  src: url("../fonts/CryeStatic-Copy.ttf") format("truetype");
  font-weight: 100 500; font-style: normal; font-display: swap;
  ascent-override: 95%; descent-override: 25%; line-gap-override: 0%;
}
@font-face {
  font-family: "Crye Copy";
  src: url("../fonts/CryeStatic-CopyBold.ttf") format("truetype");
  font-weight: 600 900; font-style: normal; font-display: swap;
  ascent-override: 95%; descent-override: 25%; line-gap-override: 0%;
}
@font-face {
  font-family: "Crye Caption";
  src: url("../fonts/CryeStatic-Caption.ttf") format("truetype");
  font-weight: 100 500; font-style: normal; font-display: swap;
  ascent-override: 95%; descent-override: 25%; line-gap-override: 0%;
}
@font-face {
  font-family: "Crye Caption";
  src: url("../fonts/CryeStatic-CaptionBold.ttf") format("truetype");
  font-weight: 600 900; font-style: normal; font-display: swap;
  ascent-override: 95%; descent-override: 25%; line-gap-override: 0%;
}
@font-face {
  font-family: "Crye Supertype";
  src: url("../fonts/CryeStatic-Supertype.ttf") format("truetype");
  font-weight: 100 900; font-style: normal; font-display: swap;
  ascent-override: 95%; descent-override: 25%; line-gap-override: 0%;
}

/* --- Color tokens. Dark is the default look; .dark on <html> is set by the
   pre-paint script in base.html. Gold (#CC8800) is the primary accent. --- */
:root {
  --radius: 0.25rem;
  --background: oklch(0.98 0.002 286.32);
  --foreground: oklch(0.141 0.005 285.823);
  --card: oklch(1 0 0);
  --card-foreground: oklch(0.141 0.005 285.823);
  --popover: oklch(1 0 0);
  --popover-foreground: oklch(0.141 0.005 285.823);
  --primary: oklch(0.679 0.144 73.84);
  --primary-foreground: oklch(0.21 0.006 285.885);
  --secondary: oklch(0.967 0.001 286.375);
  --secondary-foreground: oklch(0.21 0.006 285.885);
  --muted: oklch(0.967 0.001 286.375);
  --muted-foreground: oklch(0.552 0.016 285.938);
  --accent: oklch(0.94 0.002 286.375);  /* a shade darker than --muted so
                                            "active" surfaces read in light
                                            mode (owner, 2026-08-02) */
  --accent-foreground: oklch(0.21 0.006 285.885);
  --destructive: hsl(0 80% 46%);          /* strong true red (hue 0) */
  --destructive-foreground: hsl(0 0% 100%);
  --success: hsl(120 100% 28%);
  --success-foreground: hsl(0 0% 100%);
  --warning: hsl(48 93% 40%);             /* yellow (hue 48), dark enough to read on white; clear of red + gold */
  --warning-foreground: hsl(0 0% 0%);
  --border: oklch(0.92 0.004 286.32);
  --input: oklch(0.92 0.004 286.32);
  --ring: oklch(0.679 0.144 73.84);
  --sidebar: var(--background);  /* #13: sidebar matches the page in both themes */
  --sidebar-foreground: oklch(0.141 0.005 285.823);
  --sidebar-accent: oklch(0.967 0.001 286.375);
  --sidebar-border: oklch(0.92 0.004 286.32);
}
.dark {
  --background: oklch(0.141 0.005 285.823);
  --foreground: oklch(0.985 0 0);
  --card: oklch(0.21 0.006 285.885);
  --card-foreground: oklch(0.985 0 0);
  --popover: oklch(0.21 0.006 285.885);
  --popover-foreground: oklch(0.985 0 0);
  --primary: oklch(0.737 0.152 75.58);
  --primary-foreground: oklch(0.21 0.006 285.885);
  --secondary: oklch(0.274 0.006 286.033);
  --secondary-foreground: oklch(0.985 0 0);
  --muted: oklch(0.274 0.006 286.033);
  --muted-foreground: oklch(0.705 0.015 286.067);
  --accent: oklch(0.274 0.006 286.033);
  --accent-foreground: oklch(0.985 0 0);
  --destructive: hsl(0 85% 63%);          /* strong red, brighter for dark bg */
  --destructive-foreground: hsl(0 0% 100%);
  --success: hsl(120 70% 42%);
  --success-foreground: hsl(0 0% 0%);
  --warning: hsl(52 96% 58%);             /* bright yellow on dark; clear of red + gold */
  --warning-foreground: hsl(0 0% 0%);
  --border: oklch(1 0 0 / 10%);
  --input: oklch(1 0 0 / 15%);
  --ring: oklch(0.737 0.152 75.58);
  --sidebar: var(--background);  /* #13: sidebar matches the page in both themes */
  --sidebar-foreground: oklch(0.985 0 0);
  --sidebar-accent: oklch(0.274 0.006 286.033);
  --sidebar-border: oklch(1 0 0 / 10%);
}

/* --- Base --- */
html { scrollbar-gutter: stable; font-size: 16px; }
@media (min-width: 1280px) { html { font-size: 17px; } }
@media (min-width: 1536px) { html { font-size: 18px; } }
@media (min-width: 1920px) { html { font-size: 19px; } }
body {
  font-family: "Crye Copy", ui-sans-serif, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
/* NOTE: page-title styling lives in base.html's .page-title (Supertype, uppercase,
   large). We deliberately do NOT style bare <h1> here so markdown/product headings
   keep the body font and normal case. */

/* --- Crye typography utilities --- */
.cp-supertype  { font-family: "Crye Supertype", "Crye Copy", sans-serif; font-weight: 600; text-transform: uppercase; }
.cp-header     { font-weight: 600; letter-spacing: -0.01em; text-transform: uppercase; }
.cp-subheader  { font-weight: 600; text-transform: uppercase; }
.cp-caption-bold { font-weight: 600; }
.font-mono, .cp-mono { font-family: "Crye Caption", ui-monospace, SFMono-Regular, Menlo, monospace; }

/* --- Markdown-rendered assistant answers (plain-CSS port of .cp-markdown) --- */
.cp-markdown { line-height: 1.65; }
.cp-markdown > :first-child { margin-top: 0; }
.cp-markdown > :last-child { margin-bottom: 0; }
.cp-markdown p { margin: 0.5rem 0; }
.cp-markdown ul { margin: 0.5rem 0; padding-left: 1.25rem; list-style: disc; }
.cp-markdown ol { margin: 0.5rem 0; padding-left: 1.25rem; list-style: decimal; }
.cp-markdown li { line-height: 1.6; }
.cp-markdown strong { font-weight: 600; color: var(--foreground); }
.cp-markdown a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }
.cp-markdown a:hover { text-decoration: none; }
.cp-markdown h1, .cp-markdown h2, .cp-markdown h3, .cp-markdown h4 { margin: 0.75rem 0 0.25rem; font-weight: 600; color: var(--foreground); text-transform: none; }
.cp-markdown code { border-radius: 8px; background: var(--muted); padding: 0.1em 0.35em; font-family: "Crye Caption", ui-monospace, monospace; font-size: 0.85em; }
.cp-markdown pre { margin: 0.5rem 0; overflow-x: auto; border-radius: var(--radius); background: var(--muted); padding: 0.75rem; font-size: 0.85em; }
.cp-markdown pre code { background: transparent; padding: 0; }
.cp-markdown blockquote { margin: 0.5rem 0; border-left: 2px solid var(--border); padding-left: 0.75rem; color: var(--muted-foreground); }
.cp-markdown hr { margin: 0.75rem 0; border: 0; border-top: 1px solid var(--border); }
.cp-markdown table { margin: 0.5rem 0; width: 100%; border-collapse: collapse; font-size: 0.95em; }
.cp-markdown th { border: 1px solid var(--border); background: var(--muted); padding: 0.25rem 0.5rem; text-align: left; }
.cp-markdown td { border: 1px solid var(--border); padding: 0.25rem 0.5rem; }

/* Product description HTML pulled from NetSuite. */
.product-html { color: var(--muted-foreground); line-height: 1.65; }
.product-html p { margin: 0.5rem 0; }
.product-html h6 { margin: 1rem 0 0.25rem; font-weight: 700; color: var(--foreground); }
.product-html ol { list-style: decimal; padding-left: 1.5rem; margin: 0.5rem 0; }
.product-html ul { list-style: disc; padding-left: 1.5rem; margin: 0.5rem 0; }
.product-html table { margin: 0.75rem 0; border-collapse: collapse; }
.product-html td { padding: 0.25rem 0.75rem; border: 1px solid var(--border); }
.product-html a { color: var(--primary); text-decoration: underline; text-underline-offset: 2px; }

/* --- "working…" shimmer while the assistant streams --- */
.cp-shimmer {
  background: linear-gradient(90deg, var(--muted-foreground) 0%, var(--foreground) 25%, var(--muted-foreground) 50%);
  background-size: 200% 100%;
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; color: transparent;
  animation: cp-shimmer 1.6s linear infinite;
}
@keyframes cp-shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  .cp-shimmer { animation: none; -webkit-text-fill-color: var(--muted-foreground); color: var(--muted-foreground); }
}
