/* AI-Specs website - styles layered on the SC mini skin + sc-extension-theme.
   Colors come from the SC theme CSS variables so dark/light mode works
   automatically (driven by <html data-theme="...">). asp- prefixes only. */

html, body { height: 100%; margin: 0; padding: 0; }

/* ---- Header / brand ---------------------------------------------------- */
.asp-brand { display: flex; align-items: center; height: 60px; padding-left: 16px; gap: 12px; }
.asp-brand-logo { height: 34px; width: 34px; flex: 0 0 34px; }
.asp-brand-text { display: flex; flex-direction: column; line-height: 1.12; }
.asp-brand-product { font-size: 19px; font-weight: 700; color: var(--accent-success); letter-spacing: .2px; }
.asp-brand-owner { font-size: 11px; color: var(--text-muted); margin-top: 2px; letter-spacing: .3px; }

.asp-tagline { display: flex; align-items: center; height: 60px; }
.asp-tag-pill {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bg-tertiary); color: var(--text-secondary);
  border-radius: 999px; padding: 6px 14px; font-size: 12.5px; font-weight: 500;
}
.asp-tag-pill .sci { color: var(--sc-primary); font-size: 15px; }

/* ---- Sidebar (sclist with custom template) ----------------------------- */
.asp-sidebar-list .webix_list_item { position: relative; }
.asp-sidebar-list .webix_list_item::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px;
  background: transparent; transition: background .15s ease;
}
.asp-sidebar-list .webix_list_item:hover::before,
.asp-sidebar-list .webix_list_item.webix_selected::before { background: var(--sc-primary); }

.asp-menu-icon {
  display: inline-block; width: 22px; text-align: center; margin-right: 12px;
  color: var(--text-muted); font-size: 18px; vertical-align: middle; transition: color .15s ease;
}
.asp-menu-label { vertical-align: middle; font-size: 14px; color: var(--text-primary); transition: color .15s ease; }

.asp-sidebar-list .webix_list_item:hover .asp-menu-icon,
.asp-sidebar-list .webix_list_item.webix_selected .asp-menu-icon { color: var(--sc-primary) !important; }
.asp-sidebar-list .webix_list_item.webix_selected .asp-menu-label { color: var(--accent-success) !important; font-weight: 600; }

/* ---- Content surface --------------------------------------------------- */
.asp-page-scroll .webix_scroll_cont { padding: 0; }
.asp-section {
  padding: 30px 40px 60px 40px; color: var(--text-primary);
  font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif; line-height: 1.55;
}
.asp-section h1 { font-size: 27px; margin: 0 0 6px 0; font-weight: 700; }
.asp-section h2 { font-size: 19px; margin: 30px 0 12px 0; font-weight: 700; }
.asp-kicker {
  display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--accent-success); margin-bottom: 10px;
}
.asp-lead { font-size: 16px; color: var(--text-secondary); max-width: 760px; }
.asp-section p { max-width: 760px; color: var(--text-primary); }
.asp-section code {
  background: var(--bg-tertiary); border-radius: 4px; padding: 1px 6px;
  font-family: "SFMono-Regular", Consolas, monospace; font-size: 13px; color: var(--accent-success);
}

/* ---- Diagram ----------------------------------------------------------- */
.asp-diagram { width: 100%; max-width: 1000px; margin: 8px 0 0 0; }
.asp-diagram svg { width: 100%; height: auto; display: block; }
.asp-legend { display: flex; flex-wrap: wrap; gap: 16px 22px; margin: 18px 0 0 0; padding: 0; list-style: none; }
.asp-legend li { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); }
.asp-dot { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* ---- Cards ------------------------------------------------------------- */
.asp-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 18px; margin-top: 8px; max-width: 900px; }
.asp-card {
  background: var(--bg-input); border: 1px solid var(--bg-tertiary); border-radius: 12px;
  padding: 20px; box-shadow: 0 1px 2px rgba(16,24,40,.05);
}
.asp-card .sci { font-size: 26px; color: var(--sc-primary); }
.asp-card h3 { margin: 10px 0 6px 0; font-size: 16px; color: var(--text-primary); }
.asp-card p { margin: 0; font-size: 14px; color: var(--text-secondary); }
.asp-pillar { border-left: 4px solid var(--sc-primary); }
.asp-pill-num {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px;
  border-radius: 50%; background: var(--sc-primary); color: #16320a; font-weight: 700; font-size: 14px;
}

/* ---- Read-more blocks (progressive disclosure) ------------------------- */
.asp-section details { margin-top: 10px; }
.asp-section summary {
  cursor: pointer; list-style: none; display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; color: var(--accent-success); user-select: none;
}
.asp-section summary::-webkit-details-marker { display: none; }
.asp-section summary::before { content: "\25B8"; font-size: 12px; transition: transform .15s ease; }
.asp-section details[open] > summary::before { transform: rotate(90deg); }
.asp-card details p { margin-top: 8px; }
.asp-more { max-width: 1000px; }
.asp-more > summary { font-size: 14px; }
.asp-more .asp-cards { margin-top: 14px; }
.asp-next { margin-top: 22px; font-size: 14px; color: var(--text-muted); }
.asp-next a { color: var(--accent-success); font-weight: 600; text-decoration: none; }
.asp-next a:hover { text-decoration: underline; }

/* ---- Problem -> solution pairs (Why page) ------------------------------ */
.asp-pairs { display: grid; grid-template-columns: 1fr 44px 1fr; gap: 12px 0; max-width: 900px; margin-top: 14px; }
.asp-pair-head { display: contents; }
.asp-pair-head span { font-size: 11.5px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--text-muted); padding: 0 4px 2px 4px; }
.asp-pair { display: grid; grid-template-columns: subgrid; grid-column: 1 / -1; align-items: center; }
.asp-pair-side {
  display: grid; grid-template-columns: 34px 1fr; grid-template-rows: auto auto; column-gap: 12px; align-items: center;
  padding: 14px 18px; border-radius: 12px; background: var(--bg-input); border: 1px solid var(--bg-tertiary);
}
.asp-pair-side .sci { grid-row: 1 / 3; font-size: 26px; }
.asp-pair-side b { font-size: 16px; color: var(--text-primary); }
.asp-pair-side small { font-size: 12.5px; color: var(--text-muted); }
.asp-pair-problem { border-left: 4px solid #d92d20; }
.asp-pair-problem .sci { color: #d92d20; }
.asp-pair-solution { border-left: 4px solid var(--sc-primary); }
.asp-pair-solution .sci { color: var(--sc-primary); }
.asp-pair-arrow { justify-self: center; font-size: 22px; color: var(--text-muted); }
.asp-pair details { grid-column: 1 / -1; margin: 2px 0 0 4px; }
.asp-pair details p { margin: 6px 0 0 0; font-size: 14px; color: var(--text-secondary); }
.asp-lanes { max-width: 900px; margin-top: 10px; }
.asp-lanes p { margin: 8px 0; color: var(--text-secondary); }

/* ---- Chips ------------------------------------------------------------- */
.asp-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; max-width: 820px; }
.asp-chip {
  background: var(--bg-tertiary); color: var(--accent-success); border: 1px solid var(--sc-primary);
  border-radius: 999px; padding: 7px 14px; font-size: 13px; font-weight: 500;
}

/* ---- Mermaid diagrams -------------------------------------------------- */
/* White card behind every diagram so the SC mermaid palette (fixed hexes)
   stays legible in both light and dark theme. */
.asp-mermaid {
  position: relative;
  background: #ffffff; border: 1px solid var(--bg-tertiary); border-radius: 12px;
  padding: 18px; margin: 10px 0 4px 0; max-width: 1000px; overflow-x: auto; text-align: center;
}
.asp-mermaid svg { max-width: 100%; height: auto; }

/* expand-to-fullscreen button on each diagram */
.asp-mermaid-expand {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--bg-tertiary); border-radius: 8px; background: #ffffff;
  color: var(--sc-primary); cursor: pointer; font-size: 16px; line-height: 1;
  opacity: .55; transition: opacity .15s ease;
}
.asp-mermaid-expand:hover { opacity: 1; }

/* full-viewport overlay showing the rendered SVG large */
.asp-mermaid-overlay {
  position: fixed; inset: 0; z-index: 9999; background: rgba(15, 23, 42, .85);
  display: flex; align-items: center; justify-content: center;
}
.asp-mermaid-overlay-svg {
  width: 96vw; height: 92vh; padding: 16px; box-sizing: border-box;
  background: #ffffff; border-radius: 12px; overflow: auto;
  display: flex; align-items: center; justify-content: center;
}
.asp-mermaid-overlay-svg svg { max-width: 100%; max-height: 100%; }
.asp-mermaid-overlay-close {
  position: fixed; top: 18px; right: 22px; width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 50%; background: #ffffff; color: #111;
  cursor: pointer; font-size: 20px;
}

/* status badges (live / in progress / planned) */
.asp-st {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .4px;
  text-transform: uppercase; border-radius: 999px; padding: 2px 9px; margin-left: 8px; vertical-align: middle;
}
.asp-st-live { background: #e8ffe0; color: #2f7d12; border: 1px solid #4a9f1c; }
.asp-st-wip { background: #fff7e6; color: #b76e00; border: 1px solid #f59e0b; }
.asp-st-planned { background: #eef2ff; color: #4f46e5; border: 1px solid #6366f1; }
.asp-note { font-size: 13px; color: var(--text-muted); margin-top: 18px; max-width: 900px; }

/* ---- Etalon: requirement-level cards + category table ------------------ */
.asp-level { border-left: 4px solid var(--bg-tertiary); }
.asp-level-r  { border-left-color: #d92d20; }
.asp-level-cr { border-left-color: #f59e0b; }
.asp-level-o  { border-left-color: #6366f1; }
.asp-level .sci.asp-lv-r  { color: #d92d20; }
.asp-level .sci.asp-lv-cr { color: #f59e0b; }
.asp-level .sci.asp-lv-o  { color: #6366f1; }
.asp-level h3 .asp-lv-tag { font-weight: 800; letter-spacing: .5px; }

.asp-etable { width: 100%; max-width: 760px; border-collapse: collapse; margin: 8px 0 4px 0; font-size: 13.5px; }
.asp-etable caption { caption-side: top; text-align: left; color: var(--text-muted); font-size: 13px; margin-bottom: 8px; }
.asp-etable th, .asp-etable td { padding: 7px 12px; border-bottom: 1px solid var(--bg-tertiary); }
.asp-etable thead th { text-align: left; color: var(--text-muted); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.asp-etable td.asp-num, .asp-etable th.asp-num { text-align: right; font-variant-numeric: tabular-nums; }
.asp-etable tbody tr:hover { background: var(--bg-tertiary); }
.asp-etable tfoot td { font-weight: 700; color: var(--text-primary); border-top: 2px solid var(--sc-primary); border-bottom: none; }
.asp-etable .asp-cat { color: var(--text-primary); font-weight: 600; }

/* ---- Tablet and narrow desktop windows --------------------------------- */
/* Appearance only. The shell owns the breakpoint (aispecs-page.js), publishes
   asp-compact (<1200px) on <html>, and this stays the file's last block so a
   base rule above cannot outrank it. A phone is sent to /decide.html before
   the site paints (ADR-037), so there is no phone tier here. */
@media (max-width: 1199px) {
  .asp-section { padding: 22px 24px 48px 24px; }
  .asp-section h1 { font-size: 24px; }
  .asp-cards { gap: 12px; }
  /* A wide table scrolls inside its own box, never by moving the page. */
  .asp-etable { display: block; overflow-x: auto; max-width: 100%; }
  .asp-mermaid { overflow: auto; padding: 8px; -webkit-overflow-scrolling: touch; }
  /* Mermaid writes its own inline max-width; a diagram keeps a readable size
     and pans inside its box instead of shrinking to a thumbnail. */
  .asp-mermaid svg { max-width: none !important; width: auto !important; height: auto; }
  .asp-mermaid-expand { opacity: 1; }
}
