/* ==========================================================================
   GLOBAL NOTES MASTER STYLESHEET
   Contains all layout, typography, grids, widgets, and responsive rules.
   ========================================================================== */

/* ---------- Core Reset & Base Styles ---------- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  transition: background-color 0.2s ease, color 0.2s ease;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Typography & Fonts ---------- */
h1, h2, .sidebar-nav h3 {
  font-family: 'Fraunces', Georgia, serif;
  letter-spacing: -0.01em;
  color: var(--ink);
}

h1 {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  line-height: 1.25;
  margin-bottom: 12px;
}

h2 {
  font-size: 1.75rem;
  margin-top: 48px;
  margin-bottom: 20px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
}

h3 {
  font-size: 1.2rem;
  margin-top: 28px;
  margin-bottom: 14px;
  color: var(--ink);
}

p {
  margin-bottom: 16px;
  color: var(--ink-secondary);
  font-size: 1rem;
  overflow-wrap: break-word;
}

ul, ol {
  margin-bottom: 20px;
  padding-left: 20px;
}

li {
  margin-bottom: 6px;
  color: var(--ink-secondary);
  font-size: 0.98rem;
  overflow-wrap: break-word;
}

.mono, .unit-badge, .card-header-row .letter {
  font-family: 'IBM Plex Mono', monospace;
}

a {
  color: var(--card-accent);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--card-accent-bright, var(--card-accent-strong, var(--card-accent)));
}

*:not(table):not(tr):not(td):not(th) {
  max-width: 100%;
}

/* ---------- Top Bar Navigation ---------- */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 24px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 100;
  flex-wrap: wrap;
}

.top-bar a, .top-bar a.back {
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.95rem;
  transition: color 0.2s ease;
}

.top-bar a:hover, .top-bar a.back:hover {
  color: var(--card-accent-bright, var(--card-accent));
}

.top-bar .title {
  font-size: 0.95rem;
  letter-spacing: 0.02em;
  color: var(--steel, var(--card-accent));
  font-weight: 600;
}

.top-bar .label {
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--card-accent-bright, var(--card-accent));
  font-weight: 700;
}

.theme-toggle {
  background: none;
  border: 1px solid var(--rule);
  color: var(--ink);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.theme-toggle:hover {
  border-color: var(--card-accent);
  color: var(--card-accent);
  background: var(--rule);
}


/* ---------- Main Layout & Sidebar ---------- */
.container {
  display: flex;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
  gap: 40px;
  align-items: flex-start;
}

.container, .content, .sidebar, section, .directory, .dept-card, .type-card, .mnemonic-card, .card {
  min-width: 0;
}

.sidebar {
  width: 250px;
  flex-shrink: 0;
}

.sidebar-nav {
  position: sticky;
  top: 80px;
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 20px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  box-shadow: 0 1px 2px var(--shadow);
}

.sidebar-nav h3 {
  font-size: 1.1rem;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
  margin-top: 0;
}

.sidebar-nav ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.sidebar-nav li {
  margin-bottom: 10px;
}

.sidebar a, 
.sidebar-nav a {
  color: var(--ink-secondary);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  display: block;
  transition: color 0.2s ease;
}

.sidebar a:hover, 
.sidebar-nav a:hover {
  color: var(--card-accent-bright, var(--card-accent));
}

.sidebar-nav .sub-nav {
  padding-left: 12px !important;
  margin-top: 6px !important;
}

.sidebar-nav .sub-nav a {
  font-size: 0.85rem;
}

.module-title {
  font-weight: 700;
  font-size: 1rem;
  margin-top: 16px;
  margin-bottom: 8px;
  color: var(--ink);
}

.module-section {
  list-style: none;
  padding-left: 10px;
  border-left: 2px solid var(--rule);
  margin-bottom: 4px;
}

.module-section li {
  margin-bottom: 6px;
}

.content {
  flex: 1;
  min-width: 0;
}

/* ---------- Hero Section ---------- */
.hero {
  margin-bottom: 40px;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--card-accent);
  margin-bottom: 10px;
}

.subtitle {
  font-size: 1.1rem;
  color: var(--ink-secondary);
  margin-bottom: 24px;
}

.hero-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-top: 24px;
}

.hero-card {
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.hero-card strong {
  display: block;
  font-size: 0.9rem;
  color: var(--card-accent-bright, var(--card-accent));
  text-transform: uppercase;
  margin-bottom: 4px;
}

.hero-card span {
  font-size: 0.9rem;
  color: var(--ink-secondary);
}

/* ---------- Sections & Headers ---------- */
section {
  margin-bottom: 36px;
  scroll-margin-top: 90px;
}

section.styled-section {
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--card-accent);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 1px 2px var(--shadow);
}

.part-head h2 {
  font-size: 1.5rem;
  margin-bottom: 6px;
}

.part-head p {
  color: var(--ink-secondary);
  max-width: 65ch;
  margin-bottom: 4px;
}

.part-label, .part-tag {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--steel, var(--card-accent));
  background: var(--rule);
  border: 1px solid var(--rule);
  border-radius: 999px;
  padding: 3px 10px;
  margin-bottom: 8px;
  font-weight: 700;
}

/* ---------- Interactive Directory Component ---------- */
.directory, .interactive-section {
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 1px 2px var(--shadow);
  margin: 24px 0;
}

.directory-tabs, .tab-buttons {
  display: flex;
  gap: 12px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 12px;
  margin-bottom: 18px;
  overflow-x: auto;
}

.directory-tabs button, .tab-btn {
  background: none;
  border: 1px solid var(--rule);
  color: var(--ink-secondary);
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.directory-tabs button:hover, .tab-btn:hover {
  background: var(--bg);
  color: var(--ink);
}

.directory-tabs button.active, .tab-btn.active {
  background: var(--card-accent);
  border-color: var(--card-accent);
  color: #ffffff;
}

.directory-panel, .tab-panel {
  color: var(--ink-secondary);
}

.directory-panel .dept-tag, .tab-panel .dept-tag {
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--card-accent-bright, var(--card-accent));
  display: block;
  margin-bottom: 6px;
}

.directory-panel h3, .tab-panel h3 {
  font-size: 1.25rem;
  margin-bottom: 10px;
  color: var(--ink);
}

.directory-panel ul, .tab-panel ul {
  list-style: none;
  display: grid;
  gap: 8px;
}

.directory-panel li {
  position: relative;
  padding-left: 20px;
  font-size: 0.95rem;
  color: var(--ink);
}

.directory-panel li::before {
  content: "—";
  position: absolute;
  left: 0;
  color: var(--card-accent);
}

/* ---------- Reference Cards & Grids ---------- */
.type-grid, .cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin: 24px 0;
}

.type-card, .card {
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--card-accent);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 4px 12px var(--shadow);
}

.type-card .letter {
  font-size: 1.1rem;
  color: var(--card-accent-bright, var(--card-accent));
  font-weight: 700;
  display: block;
}

.type-card h4, .card h3 {
  font-size: 1.05rem;
  margin-bottom: 8px;
  color: var(--ink);
}

.type-card p, .card p {
  font-size: 0.9rem;
  color: var(--ink-secondary);
}

.type-card ul, .card ul {
  margin-top: 6px;
  padding-left: 18px;
  color: var(--ink-secondary);
}

.type-card li, .card li {
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.unit-badge {
  background: var(--bg);
  border: 1px solid var(--rule);
  color: var(--card-accent-bright, var(--card-accent));
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 600;
}

.dept-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}

.dept-card {
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 20px;
}

.dept-tag {
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--card-accent-bright, var(--card-accent));
  display: block;
  margin-bottom: 6px;
}

.dept-card h4 {
  font-size: 1.1rem;
  margin-bottom: 10px;
  color: var(--ink);
}

.dept-card ul {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 5px;
}

.dept-card li {
  font-size: 0.86rem;
  color: var(--ink-secondary);
  position: relative;
  padding-left: 14px;
}

.dept-card li::before {
  content: "·";
  position: absolute;
  left: 0;
  color: var(--card-accent);
  font-weight: 700;
}

/* ---------- Callouts & Notes ---------- */
.callout, .definition-box, .note {
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-left: 4px solid var(--card-accent);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-top: 16px;
  color: var(--ink-secondary);
  font-size: 0.94rem;
}

.callout strong, .definition-box strong {
  color: var(--ink);
}

/* ---------- Reference Tables ---------- */
.table-wrapper {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin-top: 16px;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}

.table-wrapper table, table {
  width: 100%;
  min-width: 640px;
  border-collapse: collapse;
  background: var(--bg-raised);
  table-layout: fixed;
}

.table-wrapper th, .table-wrapper td, th, td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--rule);
  font-size: 0.88rem;
  vertical-align: top;
  word-wrap: break-word;
}

.table-wrapper th, th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-secondary);
  background: rgba(255, 255, 255, 0.02);
}

/* ---------- Dedication Card & Footer ---------- */
.dedication-card {
  width: 100%;
  margin: 48px 0 16px;
  background: var(--bg-raised);
  border: 2px solid var(--card-accent);
  border-radius: var(--radius);
  padding: 24px 28px;
  text-align: center;
  box-shadow: 0 4px 15px var(--shadow);
}

.dedication-card p {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}

footer.page-footer {
  text-align: center;
  padding: 24px;
  color: var(--ink-secondary);
  font-size: 0.8rem;
  border-top: 1px solid var(--rule);
  margin-top: 20px;
}

/* ---------- Responsive Rules ---------- */
@media (max-width: 820px) {
  .container {
    flex-direction: column;
    padding: 20px 16px;
  }
  .sidebar {
    width: 100%;
  }
  .sidebar-nav {
    position: static;
  }
}

@media (max-width: 640px) {
  .top-bar { padding: 10px 14px; gap: 8px; }
  .top-bar .label { display: none; }
  h1 { font-size: 2rem; }
  .type-grid, .dept-grid { grid-template-columns: 1fr; }
}

/* ---------- Grid & Component Additions ---------- */
.def-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.mnemonic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.mnemonic-card {
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 16px 18px;
}

.mnemonic-card h4 {
  font-size: 0.95rem;
  color: var(--card-accent-bright, var(--card-accent));
  margin-bottom: 10px;
  font-family: 'IBM Plex Mono', monospace;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.mnemonic-card ol, .mnemonic-card ul {
  padding-left: 18px;
}

.mnemonic-card li {
  font-size: 0.88rem;
  margin-bottom: 5px;
  color: var(--ink);
}

.mnemonic-card .letter-key {
  color: var(--card-accent-bright, var(--card-accent));
  font-weight: 700;
}

/* ---------- Nav Heading Fix ---------- */
.sidebar h3 {
  font-size: 1.1rem;
  margin-bottom: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--rule);
  margin-top: 0;
}

/* ==========================================================================
   SIDEBAR & HERO COMPATIBILITY FIXES
   ========================================================================== */

/* 1. Apply sticky container styles when HTML uses <nav class="sidebar"> directly */
nav.sidebar,
.sidebar-nav {
  position: sticky;
  top: 80px;
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 20px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  box-shadow: 0 1px 2px var(--shadow);
}

/* 2. Style hero container as a padded card box */
header.hero {
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 28px;
}

/* 3. Restore card letter typography and pill button shapes */
.type-card .letter {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.35rem;
}

.directory-tabs button {
  border-radius: 999px;
}

header.hero {
  background:
    repeating-linear-gradient(90deg, var(--rule) 0 10px, transparent 10px 22px) top / 100% 6px no-repeat,
    repeating-linear-gradient(90deg, var(--rule) 0 10px, transparent 10px 22px) bottom / 100% 6px no-repeat,
    var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 22px 22px 26px;
  margin-bottom: 28px;
  position: relative;
}

/* ---------- Arts / MAPEH Inner Cards, Tags & Notes ---------- */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

/* Overrides section-level .card styling for inner grid items */
.cards .card {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-left: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: none;
}

.cards .card h3 {
  font-size: 1.05rem;
  margin-top: 0;
  margin-bottom: 8px;
  color: var(--ink);
}

.cards .card p {
  color: var(--ink-secondary);
  margin-bottom: 0;
  font-size: 0.9rem;
}

.tag {
  display: inline-block;
  margin-bottom: 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-gradient, var(--pink-gradient));
  color: var(--card-accent);
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px solid var(--rule);
}

.note {
  margin-top: 16px;
  padding: 14px 16px;
  border-left: 4px solid var(--card-accent);
  background: var(--accent-gradient, var(--pink-gradient));
  color: var(--ink);
  border-radius: var(--radius);
}

.hero-card {
  background: var(--accent-gradient, var(--bg-raised));
}

.footer-note {
  color: var(--ink-secondary);
  text-align: center;
  padding: 16px 0 24px;
  font-size: 0.92rem;
}

/* ---------- Universal Sidebar Container Fix ---------- */
.sidebar {
  width: 250px;
  flex-shrink: 0;
  position: sticky;
  top: 80px;
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 20px;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  box-shadow: 0 1px 2px var(--shadow);
}

/* Prevents double borders/padding when .sidebar-nav is nested inside .sidebar */
.sidebar .sidebar-nav {
  position: static;
  background: transparent;
  border: none;
  padding: 0;
  box-shadow: none;
  max-height: none;
  overflow: visible;
}

/* ---------- pH Scale Component ---------- */
.ph-scale-wrapper {
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 24px;
  margin-top: 16px;
  box-shadow: 0 4px 12px var(--shadow);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.ph-category-bar {
  display: flex;
  min-width: 600px;
  margin-bottom: 12px;
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid var(--rule);
}

.ph-cat-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 8px 4px;
  text-align: center;
}

.cat-acid {
  flex: 7;
  background: rgba(239, 68, 68, 0.15);
  border-right: 2px dashed rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.cat-neutral {
  flex: 1;
  background: rgba(34, 197, 94, 0.25);
  border-right: 2px dashed rgba(34, 197, 94, 0.4);
  color: #86efac;
}

.cat-alkaline {
  flex: 7;
  background: rgba(139, 92, 246, 0.15);
  color: #c4b5fd;
}

.cat-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
}

.cat-range {
  font-size: 0.75rem;
  opacity: 0.85;
}

.ph-line-container {
  min-width: 600px;
  position: relative;
  padding: 10px 0 35px 0;
}

.ph-gradient-bar {
  height: 22px;
  width: 100%;
  border-radius: 11px;
  background: linear-gradient(
    to right,
    #ef4444 0%,
    #f97316 20%,
    #eab308 35%,
    #84cc16 45%,
    #22c55e 50%,
    #06b6d4 60%,
    #3b82f6 75%,
    #8b5cf6 90%,
    #6d28d9 100%
  );
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.ph-ticks-row {
  display: flex;
  justify-content: space-between;
  position: relative;
  margin-top: -22px;
}

.ph-tick {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  text-align: center;
}

.ph-tick .tick-line {
  width: 2px;
  height: 22px;
  background: rgba(255, 255, 255, 0.6);
}

.ph-tick.neutral-tick .tick-line {
  background: #ffffff;
  width: 3px;
  box-shadow: 0 0 8px #ffffff;
}

.ph-tick .tick-num {
  margin-top: 6px;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
}

.ph-tick.neutral-tick .tick-num {
  color: var(--card-accent);
  font-size: 1rem;
}

.ph-examples-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px dashed var(--rule);
}

.example-chip {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.acid-chip { border-left: 3px solid #ef4444; }
.neutral-chip { border-left: 3px solid #22c55e; }
.base-chip { border-left: 3px solid #8b5cf6; }

.chip-ph {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--steel, var(--card-accent));
}

.chip-desc {
  font-size: 0.85rem;
  color: var(--ink);
}

/* Fix Mobile Cutoff */
@media (max-width: 640px) {
  .ph-scale-wrapper {
    overflow-x: auto !important;
  }
}

/* ---------- Interactive Chart & Visualizer Components ---------- */
.section-card {
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}

.substance-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.control-label {
  font-weight: 600;
  color: var(--ink);
  font-size: 0.9rem;
}

.pill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--bg);
  border: 1.5px solid var(--pill-color, var(--card-accent));
  color: var(--ink);
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  transition: all 0.2s ease;
}

.pill-btn input[type="checkbox"] {
  accent-color: var(--pill-color, var(--card-accent));
  cursor: pointer;
}

.graph-wrapper {
  position: relative;
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

#solubilitySvg {
  width: 100%;
  min-width: 580px;
  height: auto;
  display: block;
}

/* Overrides global max-width rule to protect SVG internal vectors */
#solubilitySvg, #solubilitySvg * {
  max-width: none !important;
}

.graph-tooltip {
  position: absolute;
  display: none;
  pointer-events: none;
  background: var(--bg-raised);
  border: 1px solid var(--card-accent);
  color: var(--ink);
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.82rem;
  box-shadow: 0 4px 12px var(--shadow);
  z-index: 10;
  white-space: nowrap;
}

.comparative-card {
  margin-top: 20px;
  padding: 18px;
  background: var(--bg);
  border: 1px dashed var(--rule);
  border-radius: var(--radius);
}

.comparative-card h3 {
  margin-top: 0;
  margin-bottom: 6px;
  color: var(--card-accent);
  font-size: 1.05rem;
}

.query-form {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: center;
  margin-top: 12px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.88rem;
  color: var(--ink-secondary);
}

.form-group select, .form-group input {
  background: var(--bg-raised);
  color: var(--ink);
  border: 1px solid var(--rule);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.88rem;
}

.temp-badge {
  font-weight: 700;
  color: var(--steel, var(--card-accent));
}

.query-result {
  margin-top: 14px;
  padding: 12px 16px;
  background: var(--bg-raised);
  border-left: 4px solid var(--card-accent);
  border-radius: 4px;
  font-size: 0.92rem;
  color: var(--ink);
}

@media (max-width: 640px) {
  #solubilitySvg text {
    font-size: 14px !important;
  }
}

/* ---------- FOHBOH Grid & Tab Components ---------- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.card .tag {
  font-size: 0.75rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--card-accent);
  letter-spacing: 0.05em;
  display: inline-block;
  margin-bottom: 6px;
}

.tab-container {
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 20px;
}

.tab-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 12px;
}

.tab-btn {
  background: var(--bg);
  color: var(--ink-secondary);
  border: 1px solid var(--rule);
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.tab-btn.active, .tab-btn:hover {
  background: var(--card-accent-strong);
  color: #ffffff;
  border-color: var(--card-accent-strong);
}

.tab-panel {
  padding: 12px;
}

.tab-panel h3 {
  font-size: 1.15rem;
  color: var(--card-accent);
  margin-bottom: 8px;
}

.tab-panel ul {
  list-style-type: disc;
  padding-left: 20px;
  color: var(--ink);
}

.tab-panel ul li {
  margin-bottom: 6px;
  font-size: 0.9rem;
}