/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

/* Self-hosted fonts (latin + latin-ext subsets) — replaces the Google Fonts
   <link>s to take fonts.gstatic.com off the critical path and remove the
   font-swap CLS. Variable weight ranges preserved. Propshaft rewrites the
   relative url()s to digested /assets paths. Generated 2026-06-18. */
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: italic;
  font-weight: 200 800;
  font-display: swap;
  src: url("/assets/plus-jakarta-sans-italic-latin-ext-0dc275fe.woff2") format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: italic;
  font-weight: 200 800;
  font-display: swap;
  src: url("/assets/plus-jakarta-sans-italic-latin-25321de8.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/assets/plus-jakarta-sans-normal-latin-ext-ff4456f1.woff2") format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Plus Jakarta Sans';
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/assets/plus-jakarta-sans-normal-latin-d2ff26bc.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Russo One';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/assets/russo-one-normal-latin-d6d25b34.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Crimson Pro';
  font-style: italic;
  font-weight: 300 700;
  font-display: swap;
  src: url("/assets/crimson-pro-italic-latin-ext-315c7c63.woff2") format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Crimson Pro';
  font-style: italic;
  font-weight: 300 700;
  font-display: swap;
  src: url("/assets/crimson-pro-italic-latin-b0155b66.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Crimson Pro';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/assets/crimson-pro-normal-latin-ext-efdd7884.woff2") format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: 'Crimson Pro';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url("/assets/crimson-pro-normal-latin-15aa6c7b.woff2") format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* Today subapp + News editorial headings — self-hosted Crimson Pro serif
   (spec §10 typography refresh). Italic by default to match the design mock. */
.nr-heading {
  font-family: 'Crimson Pro', Georgia, 'Times New Roman', serif;
  font-style: italic;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* Speech mode: hide streaming text until audio plays.
   Two classes on #messages work together:
   - .speech-mode-hiding   → instant hide (no transition), applied BEFORE
     the shell arrives so CSS hides it on first paint — zero flash.
   - .speech-mode-revealing → smooth expand + fade when audio starts. The
     ease-out curve front-loads visible expansion (~100 ms for typical
     content) even though max-height overshoots.  */
#messages.speech-mode-hiding [id^="message-"]:not([data-role]) {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
}

#messages.speech-mode-revealing [id^="message-"]:not([data-role]) {
  max-height: 5000px;
  opacity: 1;
  transition: opacity 0.35s ease-out, max-height 0.5s ease-out;
}

/* Citation link styles - icon-based badges */
.citation-link {
  cursor: pointer;
  text-decoration: none !important;
  transition: all 0.15s ease;
  vertical-align: baseline;
}

.citation-link:hover {
  text-decoration: none !important;
  transform: translateY(-1px);
}

.citation-link svg {
  flex-shrink: 0;
}

/* Source highlight animation */
.source-card {
  transition: all 0.3s ease;
}

.source-highlight {
  border-color: #6366f1 !important;
  background-color: #eef2ff !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
  animation: highlight-pulse 0.5s ease-in-out 2;
}

.dark .source-highlight {
  background-color: rgba(99, 102, 241, 0.15) !important;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.3);
}

@keyframes highlight-pulse {
  0%, 100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.02);
  }
}

/* Pagy pagination styles */
.pagy-nav-wrapper nav.series-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
}

.pagy-nav-wrapper nav.series-nav a,
.pagy-nav-wrapper nav.series-nav a[role="link"] {
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  color: #4b5563;
  border-radius: 0.5rem;
  transition: background-color 0.15s ease;
  text-decoration: none;
}

.pagy-nav-wrapper nav.series-nav a:hover {
  background-color: #f3f4f6;
}

/* Current page */
.pagy-nav-wrapper nav.series-nav a[aria-current="page"] {
  font-weight: 500;
  color: white;
  background-color: var(--color-primary-600);
  pointer-events: none;
}

/* Disabled/gap elements */
.pagy-nav-wrapper nav.series-nav a[aria-disabled="true"] {
  color: #9ca3af;
  pointer-events: none;
}

.pagy-nav-wrapper nav.series-nav a[role="separator"] {
  padding: 0.375rem 0.5rem;
}

/* Dark mode */
.dark .pagy-nav-wrapper nav.series-nav a,
.dark .pagy-nav-wrapper nav.series-nav a[role="link"] {
  color: #9ca3af;
}

.dark .pagy-nav-wrapper nav.series-nav a:hover {
  background-color: #1f2937;
}

.dark .pagy-nav-wrapper nav.series-nav a[aria-current="page"] {
  color: white;
  background-color: var(--color-primary-600);
}

.dark .pagy-nav-wrapper nav.series-nav a[aria-disabled="true"] {
  color: #4b5563;
}

/* ========================================
   Keyword highlight mirror
   ======================================== */

/* Wrapper created by JS around the textarea */
.kw-wrapper {
  position: relative;
}

/* Mirror div — sits behind the transparent textarea */
.kw-mirror {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: transparent;
  z-index: 0;
}

/* Highlighted keyword spans — soft background pill */
.kw-highlight {
  color: transparent;
  border-radius: 3px;
  padding: 1px 0;
}

/* Category background colours — soft tint */
.kw-route      { background: rgba(99, 102, 241, 0.15); }
.kw-excel      { background: rgba(16, 185, 129, 0.15); }
.kw-excel-op   { background: rgba(16, 185, 129, 0.15); }
.kw-research   { background: rgba(139, 92, 246, 0.15); }
.kw-chart      { background: rgba(245, 158, 11, 0.15); }
.kw-factset    { background: rgba(14, 165, 233, 0.15); }
.kw-dynamo     { background: rgba(59, 130, 246, 0.15); }
.kw-web        { background: rgba(249, 115, 22, 0.15); }
.kw-cpec       { background: rgba(47, 97, 101, 0.15); }
.kw-calculator { background: rgba(20, 184, 166, 0.15); }
.kw-news       { background: rgba(234, 88, 12, 0.15); }
.kw-company    { background: rgba(5, 150, 105, 0.20); border-radius: 3px; }

/* Dark mode — slightly brighter tints */
.dark .kw-route      { background: rgba(129, 140, 248, 0.20); }
.dark .kw-excel      { background: rgba(52, 211, 153, 0.20); }
.dark .kw-excel-op   { background: rgba(52, 211, 153, 0.20); }
.dark .kw-research   { background: rgba(167, 139, 250, 0.20); }
.dark .kw-chart      { background: rgba(251, 191, 36, 0.20); }
.dark .kw-factset    { background: rgba(56, 189, 248, 0.20); }
.dark .kw-dynamo     { background: rgba(96, 165, 250, 0.20); }
.dark .kw-web        { background: rgba(251, 146, 60, 0.20); }
.dark .kw-cpec       { background: rgba(94, 234, 212, 0.20); }
.dark .kw-calculator { background: rgba(45, 212, 191, 0.20); }
.dark .kw-news       { background: rgba(251, 146, 60, 0.20); }
.dark .kw-company    { background: rgba(52, 211, 153, 0.25); border-radius: 3px; }

/* Floating tooltip */
.kw-tooltip {
  position: fixed;
  z-index: 9999;
  max-width: 280px;
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.4;
  color: white;
  background: #1e293b;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.kw-tooltip.visible { opacity: 1; }

/* Keyword reference popover — fixed-positioned, appended to body */
.kw-reference {
  position: fixed;
  z-index: 9999;
  width: 320px;
  max-height: 400px;
  overflow-y: auto;
  margin-top: 4px;
  padding: 12px;
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.1);
  font-size: 12px;
  line-height: 1.5;
}
.dark .kw-reference {
  background: #1f2937;
  border-color: #374151;
}
.kw-reference h4 {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #9ca3af;
  margin: 8px 0 4px;
}
.kw-reference h4:first-child { margin-top: 0; }
.kw-ref-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 0;
  color: #374151;
}
.dark .kw-ref-item { color: #d1d5db; }
.kw-ref-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
  margin-top: 5px;
}
.kw-ref-keyword { font-weight: 500; }
.kw-ref-desc { color: #6b7280; }
.dark .kw-ref-desc { color: #9ca3af; }

/* Clickable reference items */
.kw-ref-clickable {
  cursor: pointer;
  border-radius: 4px;
  padding: 4px 6px;
  margin: 0 -6px;
  transition: background-color 0.15s;
}
.kw-ref-clickable:hover { background: #f3f4f6; }
.dark .kw-ref-clickable:hover { background: #374151; }

/* @ mention autocomplete dropdown */
.kw-at-dropdown {
  position: fixed;
  z-index: 9999;
  min-width: 240px;
  max-width: 360px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  padding: 4px;
  font-size: 13px;
}
.dark .kw-at-dropdown {
  background: #1f2937;
  border-color: #374151;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
}
.kw-at-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 6px;
  cursor: pointer;
  color: #374151;
}
.dark .kw-at-item { color: #d1d5db; }
.kw-at-item:hover, .kw-at-item.kw-at-active {
  background: #f3f4f6;
}
.dark .kw-at-item:hover, .dark .kw-at-item.kw-at-active {
  background: #374151;
}
.kw-at-trigger {
  font-weight: 600;
  color: #2F6165;
  white-space: nowrap;
}
.dark .kw-at-trigger { color: #5eead4; }
.kw-at-desc {
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ========================================
   Workspace view mode toggle (cards / list)
   ======================================== */

/* Card mode: grid layout, show card-view, hide list-view */
[data-view-mode="cards"] {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 0.75rem;
}
@media (min-width: 640px) {
  [data-view-mode="cards"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  [data-view-mode="cards"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
/* Documents card mode: 4 columns on xl */
.workspace-docs-container[data-view-mode="cards"] {
  grid-template-columns: repeat(1, minmax(0, 1fr));
}
@media (min-width: 768px) {
  .workspace-docs-container[data-view-mode="cards"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .workspace-docs-container[data-view-mode="cards"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1280px) {
  .workspace-docs-container[data-view-mode="cards"] { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
[data-view-mode="cards"] .workspace-doc-item .card-view { display: block; }
[data-view-mode="cards"] .workspace-doc-item .list-view { display: none; }

/* List mode: stacked rows, show list-view, hide card-view */
[data-view-mode="list"] {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
[data-view-mode="list"] .workspace-doc-item .card-view { display: none; }
[data-view-mode="list"] .workspace-doc-item .list-view { display: flex; }

/* Library docs: default (cards) — hide list-view, show card-view */
.library-doc-item .list-view { display: none; }
.library-doc-item .card-view { display: block; }
.library-docs-container {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 0.75rem;
}
@media (min-width: 768px) {
  .library-docs-container { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .library-docs-container { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1280px) {
  .library-docs-container { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Library docs: list mode override */
.library-docs-container[data-view-mode="list"] {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}
.library-docs-container[data-view-mode="list"] .library-doc-item .card-view { display: none; }
.library-docs-container[data-view-mode="list"] .library-doc-item .list-view { display: flex; }


/* ── Inline XLSX viewer rail — compact composer ────────────────────────────
   When the viewer opens, xlsx_viewer_controller reflows the chat column to a
   ~26rem right-hand rail and stamps `.xlsx-viewer-open` on the root. The
   composer still uses viewport-based `sm:` (desktop) layout there, so the
   secondary tool levers crowd and the verbose model name wraps to several
   lines. Collapse to the essentials — Attach · model · mic · send — mirroring
   the Analyser minimal composer / mobile collapse (design §6, pure CSS). */
.xlsx-viewer-open [data-controller~="search-toggle"],
.xlsx-viewer-open [data-controller~="task-engine-toggle"],
.xlsx-viewer-open [data-controller~="forced-skills"],
.xlsx-viewer-open .composer-rail-hide {
  display: none !important;
}

/* Keep the model selector, but stop the long "Auto (Claude Sonnet 5
   (Thinking))" label from wrapping — truncate it on one line (the sparkle
   button still opens the full picker). */
.xlsx-viewer-open [data-model-selector-target="label"] {
  display: inline-block;
  max-width: 8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
