/* ── Pangloss app styles ─────────────────────────────────────────────
   dolfin-suite.css loads first → provides all --ctp-* variables,
   base resets, and .dn-bar nav. This file: app-specific overrides.
   ──────────────────────────────────────────────────────────────────── */

/* ── Typography ─────────────────────────────────────────────────────── */
html, body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* ── Page layout ────────────────────────────────────────────────────── */
.pg-main {
  max-width: 1100px;
  margin: 2.5rem auto;
  padding: 0 1.5rem;
}

/* ── Login page ─────────────────────────────────────────────────────── */
.login-page {
  max-width: 380px;
  margin: 8rem auto 0;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 2.5rem 2rem 2rem;
  background: var(--ctp-mantle);
  border: 1px solid var(--ctp-surface1);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .login-page {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.25);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .login-page {
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), 0 2px 8px rgba(0, 0, 0, 0.25);
  }
}

.login-page h2 {
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: var(--ctp-subtext1);
  margin: 0;
}

.login-page .btn-primary {
  width: 100%;
  padding: 0.65rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  border-radius: 8px;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--ctp-blue) 30%, transparent);
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
}
.login-page .btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px color-mix(in srgb, var(--ctp-blue) 40%, transparent);
}
.login-page .btn-primary:active {
  transform: translateY(0);
}

/* ── Projects page ──────────────────────────────────────────────────── */
.projects-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
}
.projects-header h2 {
  margin: 0;
  font-size: 1.125rem;
}

.pg-main > h1 {
  font-size: 1.375rem;
  color: var(--ctp-text);
  margin: 0 0 1.25rem;
}

/* Heading for a secondary list on the projects page ("Shared with me"). */
.pg-section-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ctp-subtext0);
  margin: 2rem 0 1rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--ctp-surface0);
}

/* ── Cards ──────────────────────────────────────────────────────────── */
/* .card / .card-grid moved to the shared dolfin-suite.css */

/* ── Glossary layout ────────────────────────────────────────────────── */
.glossary-layout {
  display: grid;
  grid-template-columns: 268px 1fr;
  column-gap: 0;
  height: calc(100vh - 48px);
  overflow: hidden;
}

.glossary-sidebar {
  border-right: 1px solid var(--ctp-surface0);
  background: var(--ctp-mantle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-header {
  padding: 0.875rem;
  border-bottom: 1px solid var(--ctp-surface0);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--ctp-crust);
}

.sidebar-pkg {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--ctp-lavender);
}

.search-input {
  width: 100%;
  padding: 0.45rem 0.7rem;
  font-size: 0.875rem;
  border-radius: 6px;
  background: var(--ctp-base);
  border: 1px solid var(--ctp-surface1);
  color: var(--ctp-text);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.lang-select {
  width: 100%;
  padding: 0.4rem 0.6rem;
  font-size: 0.8125rem;
  border-radius: 6px;
  background: var(--ctp-base);
  border: 1px solid var(--ctp-surface1);
  color: var(--ctp-text);
}
.lang-select:focus {
  outline: none;
  border-color: var(--ctp-lavender);
}
.search-input:focus {
  outline: none;
  border-color: var(--ctp-lavender);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ctp-lavender) 20%, transparent);
}

.sidebar-lists { flex: 1; overflow-y: auto; }

.sidebar-section { padding: 0.25rem 0; }

.sidebar-section-title {
  padding: 0.6rem 0.875rem 0.25rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ctp-overlay0);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.sidebar-section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--ctp-surface0);
}

.sidebar-list { overflow-y: auto; }

.sidebar-item {
  font-size: 0.875rem;
  color: var(--ctp-subtext1);
  border-left: 2px solid transparent;
  transition: background 0.1s, color 0.1s;
}
.sidebar-item a {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.38rem 0.875rem;
  color: inherit;
  text-decoration: none;
}
.sidebar-item:hover {
  background: color-mix(in srgb, var(--ctp-lavender) 8%, transparent);
  color: var(--ctp-text);
}
.sidebar-item.active {
  color: var(--ctp-blue);
  border-left-color: var(--ctp-blue);
  background: color-mix(in srgb, var(--ctp-blue) 10%, transparent);
  font-weight: 500;
}

/* Type marker dot — distinguishes concept / property / rule items */
.sidebar-item--concept a::before,
.sidebar-item--property a::before,
.sidebar-item--rule a::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ctp-overlay0);
}
.sidebar-item--concept a::before  { background: var(--ctp-blue); }
.sidebar-item--property a::before { background: var(--ctp-mauve); }
.sidebar-item--rule a::before     { background: var(--ctp-green); }

/* ── Glossary right panel ───────────────────────────────────────────── */
.glossary-right { display: flex; flex-direction: column; overflow: hidden; }
.glossary-detail {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1.75rem 2.25rem;
}
.detail-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 0.5rem;
  color: var(--ctp-subtext0);
}
.detail-empty::before {
  content: "📖";
  font-size: 2rem;
  opacity: 0.5;
}

/* ── Compilation errors ─────────────────────────────────────────────── */
.compilation-error-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background: color-mix(in srgb, var(--ctp-red) 8%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--ctp-red) 20%, transparent);
  font-size: 0.875rem;
  color: var(--ctp-red);
  font-weight: 500;
}

/* ── Publish panel ──────────────────────────────────────────────────── */
.publish-panel {
  margin-top: 2rem;
  padding: 1.25rem;
  border: 1px solid var(--ctp-surface1);
  border-radius: 10px;
  background: var(--ctp-mantle);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}
.publish-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.publish-panel-header h2 {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--ctp-text);
}

.publication-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0;
  font-size: 0.875rem;
  border-bottom: 1px solid var(--ctp-surface0);
}
.publication-row:last-child { border-bottom: none; }
.publication-url {
  color: var(--ctp-sapphire);
  font-family: ui-monospace, "Cascadia Code", "Fira Code", monospace;
  flex: 1;
  font-size: 0.8125rem;
}
.publication-date { color: var(--ctp-overlay1); font-size: 0.8rem; }

/* ── Public banner ──────────────────────────────────────────────────── */
.public-banner {
  text-align: center;
  padding: 0.5rem 1rem;
  font-size: 0.8rem;
  color: var(--ctp-subtext1);
  background: color-mix(in srgb, var(--ctp-teal) 8%, var(--ctp-crust));
  border-bottom: 1px solid color-mix(in srgb, var(--ctp-teal) 20%, transparent);
}

/* ── Detail pages ───────────────────────────────────────────────────── */
.detail-content { max-width: 780px; }

.detail-header {
  margin-bottom: 1.25rem;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.detail-header h1 {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  flex-wrap: wrap;
  font-size: 1.5rem;
  margin: 0 0 0.35rem;
  color: var(--ctp-text);
}

.open-in-agrafe {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.75rem;
  color: var(--ctp-sapphire);
  border: 1px solid color-mix(in srgb, var(--ctp-sapphire) 50%, transparent);
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
  text-decoration: none;
  white-space: nowrap;
  margin-left: auto;
  background: color-mix(in srgb, var(--ctp-sapphire) 6%, transparent);
  transition: background 0.15s, border-color 0.15s;
}
.open-in-agrafe:hover {
  background: var(--ctp-sapphire);
  color: var(--ctp-base);
  border-color: var(--ctp-sapphire);
}

.iri-chip {
  font-family: ui-monospace, "Cascadia Code", "Fira Code", monospace;
  font-size: 0.72rem;
  color: var(--ctp-overlay1);
  background: var(--ctp-crust);
  border: 1px solid var(--ctp-surface0);
  border-radius: 4px;
  padding: 0.15rem 0.5rem;
}

.definition {
  color: var(--ctp-subtext1);
  line-height: 1.6;
  margin-bottom: 0.875rem;
}
.alt-labels {
  color: var(--ctp-subtext0);
  font-size: 0.875rem;
  margin-bottom: 0.875rem;
}

.badge-enum {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--ctp-mauve) 12%, transparent);
  color: var(--ctp-mauve);
  border: 1px solid color-mix(in srgb, var(--ctp-mauve) 30%, transparent);
}

/* ── Section headings ───────────────────────────────────────────────── */
section { margin-bottom: 1.75rem; }

section h2 {
  font-size: 0.8125rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ctp-subtext0);
  margin: 0 0 0.875rem;
  padding-bottom: 0;
  padding-left: 0.6rem;
  border-left: 3px solid var(--ctp-lavender);
  border-bottom: none;
  line-height: 1.4;
}

/* ── Fields table ───────────────────────────────────────────────────── */
.fields-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.875rem;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--ctp-surface0);
}
.fields-table th {
  text-align: left;
  padding: 0.45rem 0.75rem;
  color: var(--ctp-subtext0);
  font-weight: 600;
  font-size: 0.8125rem;
  background: var(--ctp-mantle);
  border-bottom: 1px solid var(--ctp-surface0);
}
.fields-table td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--ctp-surface0);
  vertical-align: top;
}
.fields-table tr:last-child td { border-bottom: none; }
.fields-table tbody tr:hover td {
  background: color-mix(in srgb, var(--ctp-blue) 4%, transparent);
}

/* ── Type + variant chips ───────────────────────────────────────────── */
.type-chip {
  font-family: ui-monospace, "Cascadia Code", "Fira Code", monospace;
  font-size: 0.78rem;
  background: color-mix(in srgb, var(--ctp-teal) 10%, transparent);
  color: var(--ctp-teal);
  border: 1px solid color-mix(in srgb, var(--ctp-teal) 25%, transparent);
  border-radius: 999px;
  padding: 0.12rem 0.55rem;
}

.cardinality {
  color: var(--ctp-overlay1);
  font-size: 0.78rem;
}

.variant-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.variant {
  font-family: ui-monospace, "Cascadia Code", "Fira Code", monospace;
  font-size: 0.82rem;
  background: var(--ctp-surface0);
  border: 1px solid var(--ctp-surface1);
  border-radius: 6px;
  padding: 0.18rem 0.55rem;
  color: var(--ctp-text);
  transition: border-color 0.12s, background 0.12s;
}
.variant:hover {
  border-color: var(--ctp-overlay0);
  background: var(--ctp-surface1);
}

/* ── Links ──────────────────────────────────────────────────────────── */
.ref-link {
  color: var(--ctp-blue);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in srgb, var(--ctp-blue) 35%, transparent);
  transition: border-color 0.12s, color 0.12s;
}
.ref-link:hover {
  color: var(--ctp-lavender);
  border-bottom-color: var(--ctp-lavender);
  text-decoration: none;
}

/* ── States ─────────────────────────────────────────────────────────── */
.empty {
  color: var(--ctp-subtext0);
  font-style: italic;
  font-size: 0.875rem;
}
.loading {
  color: var(--ctp-subtext0);
  padding: 3rem;
  text-align: center;
  font-size: 0.875rem;
}

/* ── Lint Problems Panel ─────────────────────────────────────────────── */
.lint-problems-panel {
  border: 1px solid var(--ctp-surface1);
  border-radius: 8px;
  background: var(--ctp-base);
  margin: 1rem;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}
.lint-problems-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  background: var(--ctp-mantle);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ctp-subtext0);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid var(--ctp-surface1);
}
.lint-problems-list { padding: 0.25rem 0; }
.lint-file-group { padding: 0.25rem 0; }
.lint-file-name {
  font-size: 0.72rem;
  font-family: ui-monospace, "Cascadia Code", "Fira Code", monospace;
  color: var(--ctp-overlay1);
  padding: 0.2rem 0.875rem;
}
.lint-problem-card {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.3rem 0.875rem 0.3rem 1.5rem;
  font-size: 0.85rem;
  border-left: 3px solid transparent;
  transition: background 0.1s;
}
.lint-problem-card:hover { background: color-mix(in srgb, var(--ctp-blue) 5%, transparent); }
.lint-problem-card.lint-error   { border-left-color: var(--ctp-red); }
.lint-problem-card.lint-warning { border-left-color: var(--ctp-yellow); }
.lint-problem-card.lint-hint    { border-left-color: var(--ctp-teal); }
.lint-problem-card.lint-info    { border-left-color: var(--ctp-blue); }
.lint-problem-icon { font-size: 0.75rem; flex-shrink: 0; }
.lint-problem-body { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem; }
.lint-problem-msg  { color: var(--ctp-text); }
.lint-problem-loc  { color: var(--ctp-overlay1); font-size: 0.75rem; font-family: ui-monospace, "Cascadia Code", "Fira Code", monospace; }
.lint-problem-help { width: 100%; color: var(--ctp-subtext1); font-size: 0.78rem; padding-left: 0.2rem; }
