/* Shared visual language for the public system catalogue and workspace. */
body[data-theme="violet"] {
  --page-bg: #080a1c;
  --radial-one: rgba(76, 45, 175, 0.19);
  --radial-two: rgba(36, 79, 113, 0.07);
  --panel: rgba(17, 21, 45, 0.94);
  --panel-strong: #171e42;
  --soft: #9da7c6;
  --system-card-border: rgba(168, 56, 239, 0.85);
  --system-card-bg-a: rgba(77, 26, 126, 0.22);
  --system-card-bg-b: rgba(13, 17, 44, 0.96);
  --system-card-glow: rgba(108, 46, 184, 0.06);
}

.topbar { min-height: 72px; padding-top: 12px; padding-bottom: 12px; }
.desktop-nav a { position: relative; }
.desktop-nav a[href="#systems"]::after {
  position: absolute;
  right: 0;
  bottom: -9px;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--violet), transparent);
  content: "";
}

.systems-section, .workspace-section { scroll-margin-top: 72px; }
.systems-section { padding-top: 14px; padding-bottom: 28px; }
.workspace-section { padding-top: 28px; }
.systems-section .section-heading, .systems-grid { width: 100%; }
.systems-section .section-heading { gap: 6px; margin-bottom: 16px; }
.systems-section .section-heading .eyebrow { font-size: 14px; line-height: 1.5; }
.systems-section .section-heading h2, .workspace-section .section-heading h2 {
  font-size: clamp(30px, 3.4vw, 48px);
  letter-spacing: -0.035em;
}
.systems-section .section-heading p:last-child { font-size: 14px; line-height: 1.8; }
.workspace-section .section-heading { gap: 10px; margin-bottom: 28px; }
.workspace-section .section-heading p:last-child { font-size: 15px; line-height: 1.9; }

.systems-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.system-card {
  grid-template-rows: auto auto auto 1fr auto;
  align-content: start;
  min-width: 0;
  min-height: 236px;
  padding: 13px 17px 10px;
  border-width: 1px;
  border-radius: 13px;
  box-shadow: inset 0 0 42px var(--system-card-glow), 0 0 0 3px rgba(134, 54, 204, 0.045);
}
.system-card::before, .system-card::after { display: none; }
.system-card-top { gap: 10px; margin-bottom: 6px; }
.system-card .system-id { font-size: clamp(32px, 2.8vw, 42px); letter-spacing: -0.05em; }
.system-card .status-pill { min-height: 23px; margin-top: 0; padding: 0 7px; gap: 5px; font-size: 10px; }
.system-card h3 { margin: 0; font-size: clamp(15px, 1.3vw, 20px); line-height: 1.3; font-weight: 750; }
.system-card p { max-width: none; margin-top: 5px; font-size: 12px; line-height: 1.55; font-weight: 500; }
.system-card-art {
  align-self: center;
  justify-self: center;
  width: 100%;
  height: 90px;
  margin: 4px 0 0;
  object-fit: contain;
  transition: transform 200ms ease;
}
.system-card-art, .sidebar-system-art, .active-system-source { display: block; mix-blend-mode: lighten; }
.system-card:hover .system-card-art { transform: translateY(-3px); }
.system-meta { align-items: center; gap: 8px; margin-top: 4px; }
.system-card .tier-chip { font-size: 11px; }
.system-card .card-arrow { width: 32px; height: 32px; border-width: 1px; }
.status-pill { color: #31e4bc; border-color: rgba(35, 224, 175, 0.4); background: rgba(11, 156, 118, 0.14); }
.status-pill.with-dot::before { width: 6px; height: 6px; background: #24e2b5; box-shadow: 0 0 7px rgba(35, 224, 175, 0.5); }

.workspace-grid { grid-template-columns: 290px minmax(0, 1fr); gap: 16px; }
.system-list { top: 88px; max-height: calc(100vh - 104px); padding: 7px; scrollbar-width: thin; scrollbar-color: #555278 transparent; }
.system-group + .system-group,
.system-group + .system-group-single,
.system-group-single + .system-group,
.system-group-single + .system-group-single { margin-top: 3px; }
.system-group-toggle, .system-button:not(.system-child-button) {
  grid-template-columns: 54px 26px minmax(0, 1fr) auto;
  gap: 7px;
  min-height: 69px;
  padding: 8px 6px;
}
.sidebar-system-art { width: 54px; height: 43px; object-fit: contain; }
.system-list .system-id { width: auto; height: auto; min-width: 0; background: transparent; color: var(--text); font-size: 14px; font-weight: 600; }
.system-group-copy, .system-button > span { min-width: 0; }
.system-group-copy strong, .system-button strong { font-size: 12px; line-height: 1.3; font-weight: 650; }
.system-group-copy small, .system-button small { font-size: 10px; line-height: 1.4; margin-top: 4px; }
.system-group-actions { gap: 3px; }
.system-list .tier-chip { max-width: 56px; padding: 3px 5px; font-size: 9px; text-align: center; line-height: 1.35; }
.system-chevron { width: 12px; font-size: 14px; }
.system-group.has-active .system-group-toggle, .system-group-single.active {
  border-color: #9d7be8;
  background: linear-gradient(110deg, var(--accent-soft), transparent);
  box-shadow: inset 0 0 0 1px rgba(184, 151, 255, 0.12);
}
.system-child-button { grid-template-columns: 46px minmax(0, 1fr); gap: 9px; min-height: 52px; padding: 9px; }
.system-child-button > .tier-chip { display: none; }
.system-child-button .system-id { font-size: 11px; }
.tool-panel { min-width: 0; padding: 0; }
.tool-header { align-items: center; gap: 20px; padding: 28px 26px 22px; border-bottom: 0; }
.active-system-art { flex: 0 0 136px; width: 136px; height: 90px; padding-right: 18px; border-right: 1px solid var(--line); object-fit: contain; }
.active-system-source { width: 100%; height: 100%; }
.tool-heading-copy { flex: 1; min-width: 0; }
.tool-heading-copy h3 { margin: 4px 0 0; font-size: clamp(21px, 2.1vw, 30px); letter-spacing: -0.025em; line-height: 1.3; }
.tool-heading-copy .panel-kicker { margin: 0; font-size: 11px; font-weight: 600; }
.tool-header #activeDesc { margin: 8px 0 0; font-size: 13px; line-height: 1.8; }
.tool-status-actions { flex: 0 0 auto; gap: 10px; }
.tool-status-actions .status-pill { margin: 0; min-height: 25px; padding: 0 9px; font-size: 10px; }
.how-to-toggle { font-size: 11px; }
.system-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 0 26px; border-bottom: 1px solid var(--line); }
.system-tab { min-height: 40px; padding: 10px 18px; border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0; background: transparent; color: var(--muted); font-size: 13px; text-align: left; }
.system-tab:hover { background: var(--accent-soft); color: var(--text); }
.system-tab[aria-current="page"] { color: #fff; border-color: rgba(185, 148, 255, 0.4); background: linear-gradient(110deg, #8455d6, #6440c7); box-shadow: 0 -3px 18px rgba(104, 62, 202, 0.1); }
.tool-body { grid-template-columns: minmax(260px, 35%) minmax(0, 1fr); min-height: 440px; padding: 16px 12px 20px; }
.input-stack { min-width: 0; gap: 12px; padding: 0 14px; border-right: 1px solid var(--line-soft); border-bottom: 0; }
.upload-box, .field-box { padding: 12px; }
.upload-label, .field-box label { font-size: 12px; }
.drop-zone { min-height: 125px; }
.drop-zone:not(:has(img)) > span::before {
  display: block;
  width: 25px;
  height: 27px;
  margin: 0 auto 12px;
  background: #b491f0;
  clip-path: polygon(47% 0, 77% 29%, 70% 35%, 54% 19%, 54% 70%, 44% 70%, 44% 19%, 28% 35%, 21% 29%, 47% 0, 47% 0, 47% 0);
  content: "";
}
.drop-zone span { color: var(--muted); font-size: 13px; font-weight: 500; }
.generate-button { min-height: 45px; }
.generation-notice { margin: 0; padding: 12px; font-size: 11px; line-height: 1.8; }
.result-panel { min-height: 0; padding: 0 14px; }
.result-toolbar { align-items: center; gap: 10px; margin-bottom: 14px; }
.result-toolbar .panel-kicker { margin: 0 0 5px; font-size: 10px; letter-spacing: 0.04em; }
.result-toolbar h4 { font-size: 19px; }
.result-actions { gap: 8px; }
.result-actions .icon-button { min-height: 36px; padding: 7px 12px; font-size: 12px; }
.prompt-output { min-height: 310px; padding: 20px; font-size: 12px; line-height: 2; overflow-wrap: anywhere; }
.main-preview { min-height: 310px; }

/* Preserve the original artwork's colors on light themes with its dark backing. */
body[data-theme="silver"] .system-card-art,
body[data-theme="white"] .system-card-art,
body[data-theme="silver"] .sidebar-system-art,
body[data-theme="white"] .sidebar-system-art,
body[data-theme="silver"] .active-system-source,
body[data-theme="white"] .active-system-source { mix-blend-mode: normal; }
body[data-theme="silver"] .status-pill:not(.pending),
body[data-theme="white"] .status-pill:not(.pending) { color: #087154; border-color: #83b8aa; background: #e3f4ed; }
body[data-theme="silver"] .how-to-toggle,
body[data-theme="white"] .how-to-toggle { color: #146c60; }
body[data-theme="silver"] .result-toolbar .panel-kicker,
body[data-theme="white"] .result-toolbar .panel-kicker { color: #146c60; }

.system-card:focus-visible, .system-tab:focus-visible,
.system-group-toggle:focus-visible, .system-button:focus-visible,
.how-to-toggle:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.drop-zone:focus-within { outline: 2px solid var(--cyan); outline-offset: 2px; }

@media (min-width: 1440px) {
  .workspace-grid { grid-template-columns: 316px minmax(0, 1fr); }
  .system-group-copy strong, .system-button strong { font-size: 13px; }
  .system-card { min-height: 290px; padding: 20px; }
  .system-card-art { height: 136px; }
}

@media (max-width: 1199px) {
  .systems-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .system-card { min-height: 270px; }
  .workspace-grid { grid-template-columns: 254px minmax(0, 1fr); }
  .system-list { position: sticky; top: 88px; max-height: calc(100vh - 104px); }
  .system-group-toggle, .system-button:not(.system-child-button) { grid-template-columns: 42px 24px minmax(0, 1fr) auto; gap: 5px; }
  .sidebar-system-art { width: 42px; }
  .system-group-actions { flex-direction: column; gap: 0; }
  .tool-header { flex-wrap: wrap; gap: 14px; padding: 20px; }
  .active-system-art { flex-basis: 88px; width: 88px; height: 65px; padding-right: 12px; }
  .tool-status-actions { display: flex; align-items: center; justify-content: flex-end; width: 100%; }
  .system-tabs { margin: 0 20px; }
  .tool-body { grid-template-columns: 1fr; padding: 16px 6px; }
  .input-stack { border-right: 0; border-bottom: 1px solid var(--line-soft); padding-bottom: 18px; }
  .result-panel { padding-top: 20px; }
}

@media (max-width: 760px) {
  .topbar { align-items: center; gap: 12px; padding: 12px 16px; }
  .brand { gap: 9px; }
  .brand strong { font-size: 12px; }
  .brand small { font-size: 10px; }
  .brand-mark { flex-shrink: 0; width: 34px; height: 34px; }
  .top-actions .ghost-button { min-height: 36px; padding: 7px 10px; font-size: 12px; }
  .systems-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .system-card { min-height: 246px; padding: 13px; border-radius: 11px; }
  .system-card-top { flex-wrap: wrap; gap: 7px; }
  .system-card .system-id { font-size: 30px; }
  .system-card .status-pill { font-size: 8px; padding: 0 5px; min-height: 20px; }
  .system-card h3 { font-size: 15px; }
  .system-card p { font-size: 11px; }
  .system-card-art { height: 95px; }
  .system-card .tier-chip { font-size: 9px; padding: 4px 6px; }
  .system-card .card-arrow { width: 27px; height: 27px; }
  .workspace-grid { grid-template-columns: minmax(0, 1fr); }
  .system-list { position: static; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px; max-height: 272px; align-items: start; }
  .system-list > * { margin-top: 0 !important; }
  .system-group-toggle, .system-button:not(.system-child-button) { grid-template-columns: 36px minmax(0, 1fr); column-gap: 6px; padding: 9px 6px; }
  .sidebar-system-art { grid-row: span 2; width: 36px; height: 32px; }
  .system-list .system-group-toggle > .system-id, .system-list .system-group-single > .system-id { font-size: 12px; justify-content: start; }
  .system-group-copy, .system-group-single > span:nth-of-type(2) { grid-column: 2; }
  .system-group-actions, .system-group-single > .tier-chip, .system-group-copy small, .system-group-single small { display: none; }
  .system-group-copy strong, .system-group-single strong { font-size: 10px; }
  .system-child-button { width: calc(100% - 4px); margin-left: 4px; grid-template-columns: minmax(0, 1fr); gap: 3px; }
  .system-child-button .system-id { justify-content: start; }
  .system-child-button strong { font-size: 10px; }
  .tool-header { padding: 18px 16px; }
  .active-system-art { flex-basis: 68px; width: 68px; height: 60px; }
  .tool-heading-copy h3 { font-size: 19px; }
  .tool-header #activeDesc { font-size: 12px; }
  .system-tabs { margin: 0 16px; }
  .system-tab { font-size: 12px; padding: 9px 12px; }
  .prompt-output { padding: 16px; }
}

@media (max-width: 380px) {
  .systems-grid { grid-template-columns: minmax(0, 1fr); }
  .system-card { min-height: 260px; }
  .system-card-art { height: 120px; }
  .brand strong { font-size: 10px; }
  .active-system-art { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .system-card, .system-card-art, .system-group, .system-group-children,
  .system-chevron, .system-child-button { transition: none; }
  .system-card:hover, .system-card:hover .system-card-art { transform: none; }
}
