/* ChemVen AI & Computational Chemistry In-Browser Tools Shared Stylesheet */
@font-face{font-family:'Cormorant Garamond';font-style:normal;font-weight:400;font-display:swap;src:url('/assets/fonts/cormorant-400-latin.woff2') format('woff2');}
@font-face{font-family:'Cormorant Garamond';font-style:italic;font-weight:400 500;font-display:swap;src:url('/assets/fonts/cormorant-500i-latin.woff2') format('woff2');}
@font-face{font-family:'Cormorant Garamond';font-style:normal;font-weight:600 700;font-display:swap;src:url('/assets/fonts/cormorant-600-latin.woff2') format('woff2');}
@font-face{font-family:'Inter';font-style:normal;font-weight:100 900;font-display:swap;src:url('/assets/fonts/inter-var-latin.woff2') format('woff2');}
@font-face{font-family:'IBM Plex Mono';font-style:normal;font-weight:400;font-display:swap;src:url('/assets/fonts/plexmono-400-latin.woff2') format('woff2');}
@font-face{font-family:'IBM Plex Mono';font-style:normal;font-weight:500 700;font-display:swap;src:url('/assets/fonts/plexmono-500-latin.woff2') format('woff2');}

:root {
  --void: #0A0A0F;
  --void-2: #12121A;
  --panel: #101016;
  --panel-2: #14141E;
  --panel-border: rgba(216, 180, 90, 0.18);
  --line: rgba(216, 180, 90, 0.16);
  --ink: #F4EEE1;
  --head: #FFFFFF;
  --dim: rgba(244, 238, 225, 0.72);
  --faint: rgba(244, 238, 225, 0.56);
  --gold: #D8B45A;
  --gold-soft: #E9CE8F;
  --gold-dim: rgba(216, 180, 90, 0.14);
  --emerald: #2E856E;
  --emerald-bg: rgba(46, 133, 110, 0.15);
  --crimson: #C04851;
  --crimson-bg: rgba(192, 72, 81, 0.15);
  --amber: #D9822B;
  --amber-bg: rgba(217, 130, 43, 0.15);
  --font-display: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-serif: "Playfair Display", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

html[data-theme="day"], [data-theme="day"] {
  --void: #F8F9FA;
  --void-2: #FFFFFF;
  --panel: #FFFFFF;
  --panel-2: #F1F3F5;
  --panel-border: rgba(160, 120, 40, 0.25);
  --line: rgba(0, 0, 0, 0.1);
  --ink: #1F2328;
  --head: #0D1117;
  --dim: #4B5563;
  --faint: #6B7280;
  --gold: #966C1E;
  --gold-soft: #7A5614;
  --gold-dim: rgba(150, 108, 30, 0.12);
  --emerald: #1B6550;
  --emerald-bg: rgba(27, 101, 80, 0.12);
  --crimson: #CF222E;
  --crimson-bg: rgba(207, 34, 46, 0.12);
  --amber: #B35C0B;
  --amber-bg: rgba(179, 92, 11, 0.12);
  --bg-card: #FFFFFF;
  --bg-surface: #F1F3F5;
  --border-color: rgba(160, 120, 40, 0.25);
  --text-primary: #0D1117;
  --text-secondary: #4B5563;
  --text-muted: #6B7280;
  --cyan: #0969DA;
  --teal: #1B6550;
  --orange: #B35C0B;
  --red: #CF222E;
  --blue: #0969DA;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--void);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Accessibility Skip Link */
.skip-link {
  position: absolute;
  left: 16px;
  top: -60px;
  z-index: 9999;
  background: var(--gold);
  color: #141005;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 6px;
  text-decoration: none;
  transition: top 0.2s ease;
}
.skip-link:focus {
  top: 12px;
  outline: 2px solid #FFFFFF;
}

/* Header handled by chemven-static.css */

/* Breadcrumbs */
.ai-crumbs {
  padding: 14px 0;
  font-size: 0.85rem;
  color: var(--faint);
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.ai-crumbs a {
  color: var(--gold);
  text-decoration: none;
}
.ai-crumbs a:hover {
  text-decoration: underline;
}

/* Main Container */
.ai-main, .tool-container, .ai-container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 64px;
  flex: 1;
  width: 100%;
}

/* Typography */
.ai-hero-h1, .tool-title {
  font-family: var(--font-serif);
  font-size: clamp(1.4rem, 4.5vw, 2.5rem);
  font-weight: 700;
  color: var(--head);
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 12px;
  overflow-wrap: anywhere;
  word-break: normal;
}
.ai-lead, .tool-desc, .tool-subtitle {
  font-size: clamp(0.92rem, 2.5vw, 1.05rem);
  color: var(--dim);
  max-width: 820px;
  line-height: 1.6;
  margin-bottom: 20px;
  overflow-wrap: anywhere;
}
.ai-h2 {
  font-family: var(--font-display);
  font-size: 1.85rem;
  color: var(--gold-soft);
  margin: 40px 0 16px;
}
.ai-h3 {
  font-size: 1.2rem;
  color: var(--head);
  margin: 20px 0 10px;
}

/* Cards & Layouts */
.ai-card, .tool-card {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  padding: 22px;
  margin-bottom: 24px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  overflow-wrap: anywhere;
}
.ai-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 860px) {
  .ai-grid-2 { grid-template-columns: 1fr; }
}

/* Inputs & Form Controls */
.form-group {
  margin-bottom: 18px;
}
.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--head);
  margin-bottom: 6px;
}
.ai-input, .ai-textarea, .ai-select {
  width: 100%;
  min-height: 44px;
  background: var(--void-2);
  border: 1px solid var(--panel-border);
  color: var(--head);
  padding: 10px 14px;
  border-radius: 8px;
  font-family: var(--font-sans);
  font-size: 16px !important;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.ai-textarea {
  font-family: var(--font-mono);
  resize: vertical;
}
.ai-input:focus, .ai-textarea:focus, .ai-select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-dim);
}

/* Buttons */
.btn-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  margin: 16px 0;
}
.btn-primary {
  background: var(--gold);
  color: #141005;
  font-weight: 600;
  border: none;
  padding: 10px 20px;
  min-height: 44px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  transition: opacity 0.2s ease, transform 0.1s ease;
}
.btn-primary:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}
.btn-primary:active {
  transform: translateY(0);
}
.btn-ghost {
  background: transparent;
  color: var(--head);
  border: 1px solid var(--line);
  padding: 10px 18px;
  min-height: 44px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  transition: all 0.2s ease;
}
.btn-ghost:hover {
  border-color: var(--gold);
  color: var(--gold);
}
.btn-preset {
  background: var(--void-2);
  color: var(--dim);
  border: 1px solid var(--panel-border);
  padding: 10px 14px;
  min-height: 44px;
  border-radius: 6px;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  touch-action: manipulation;
  transition: all 0.2s ease;
}
.btn-preset:hover {
  color: var(--gold);
  border-color: var(--gold);
}

/* Badges & Tags */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.badge-pass {
  background: var(--emerald-bg);
  color: var(--emerald);
  border: 1px solid var(--emerald);
}
.badge-fail {
  background: var(--crimson-bg);
  color: var(--crimson);
  border: 1px solid var(--crimson);
}
.badge-warn {
  background: var(--amber-bg);
  color: var(--amber);
  border: 1px solid var(--amber);
}
.badge-info {
  background: var(--gold-dim);
  color: var(--gold);
  border: 1px solid var(--gold);
}

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin: 18px 0;
  border: 1px solid var(--panel-border);
  border-radius: 8px;
}
.ai-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.9rem;
}
.ai-table th {
  background: var(--void-2);
  color: var(--gold);
  font-weight: 600;
  padding: 12px 14px;
  border-bottom: 1px solid var(--panel-border);
}
.ai-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--panel-border);
  color: var(--ink);
}
.ai-table tr:last-child td {
  border-bottom: none;
}
.ai-table tr:hover td {
  background: var(--void-2);
}

/* Alerts */
.ai-alert, .methodology-banner {
  padding: 16px 20px;
  border-radius: 6px;
  margin: 20px 0;
  font-size: 0.92rem;
  line-height: 1.6;
  border-left: 4px solid var(--gold);
  background: var(--gold-dim);
  color: var(--ink);
  overflow-wrap: anywhere;
}
.ai-alert-refusal {
  background: var(--crimson-bg);
  border: 1px solid var(--crimson);
  color: var(--ink);
}
.ai-alert-refusal strong {
  color: var(--crimson);
  display: block;
  margin-bottom: 4px;
}
.ai-alert-info {
  background: var(--gold-dim);
  border: 1px solid var(--gold);
  color: var(--ink);
}

/* Canvas & 3D Stage */
.canvas-container {
  width: 100%;
  height: 420px;
  background: #000000;
  border: 1px solid var(--panel-border);
  border-radius: 10px;
  position: relative;
  overflow: hidden;
}

/* Theory & Worked Examples Section */
.theory-block {
  margin-top: 36px;
  border-top: 1px solid var(--line);
  padding-top: 30px;
}
.worked-example {
  background: var(--void-2);
  border-left: 3px solid var(--gold);
  padding: 18px 20px;
  border-radius: 0 8px 8px 0;
  margin: 16px 0;
}
.worked-example h4 {
  color: var(--gold);
  margin-bottom: 8px;
  font-size: 1.05rem;
}

/* Footer handled by chemven-static.css */

/* Print Styles */
@media print {
  .skip-link, .ai-header, .theme-toggle-btn, .btn-group, .btn-primary, .btn-ghost, .btn-preset {
    display: none !important;
  }
  body, .ai-card, .ai-main {
    background: #FFFFFF !important;
    color: #000000 !important;
  }
}


/* --- Unified Tool Aliases & WCAG 2.2 AA Contrast Palette --- */
:root {
  --bg-card: #101016;
  --bg-surface: #14141E;
  --border-color: rgba(216, 180, 90, 0.18);
  --text-primary: #F4EEE1;
  --text-secondary: rgba(244, 238, 225, 0.76);
  --text-muted: rgba(244, 238, 225, 0.56);
  --cyan: #06B6D4;
  --teal: #10B981;
  --orange: #F97316;
  --red: #EF4444;
  --blue: #3B82F6;
}

html[data-theme="day"] {
  --bg-card: #FFFFFF;
  --bg-surface: #FBF8F1;
  --border-color: rgba(138, 106, 36, 0.24);
  --text-primary: #1F1D18;
  --text-secondary: rgba(31, 29, 24, 0.82);
  --text-muted: rgba(31, 29, 24, 0.62);
  --cyan: #0891B2;
  --teal: #059669;
  --orange: #EA580C;
  --red: #DC2626;
  --blue: #2563EB;
}

/* tool-header handled by chemven-static.css */
.tool-container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 20px 64px;
  flex: 1;
  width: 100%;
}
.breadcrumb {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.breadcrumb a {
  color: var(--gold);
  text-decoration: none;
}
.breadcrumb a:hover {
  text-decoration: underline;
}
.tool-title {
  font-size: clamp(1.8rem, 4vw, 2.5rem);
  font-weight: 700;
  color: var(--head);
  margin-bottom: 6px;
  line-height: 1.2;
}
.tool-subtitle {
  font-size: 1.05rem;
  color: var(--text-secondary);
  max-width: 820px;
  line-height: 1.5;
}
.methodology-banner {
  background: rgba(216, 180, 90, 0.08);
  border-left: 4px solid var(--gold);
  border-radius: 6px;
  padding: 14px 18px;
  margin: 20px 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--text-primary);
}
.tool-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 24px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  margin-bottom: 24px;
}
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.result-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}
.result-card-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--gold);
  margin-bottom: 6px;
}
.result-card-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--head);
  font-family: var(--font-mono);
}
.theory-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 28px;
  margin-bottom: 40px;
  line-height: 1.6;
}
.theory-section h2 {
  font-size: 1.4rem;
  color: var(--gold);
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
  margin-bottom: 16px;
}
.theory-section h3 {
  font-size: 1.15rem;
  color: var(--head);
  margin: 18px 0 8px;
}
.theory-section h4 {
  font-size: 1.05rem;
  color: var(--gold);
  margin: 14px 0 6px;
}
/* tool-footer handled by chemven-static.css */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 18px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--gold);
  color: #141005;
}
.btn-primary:hover {
  background: var(--gold-soft);
}
.btn-secondary {
  background: var(--bg-surface);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}
.btn-secondary:hover {
  border-color: var(--gold);
  color: var(--gold);
}
.form-control {
  width: 100%;
  min-height: 44px;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--head);
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 16px !important;
}
.form-control:focus {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* ====================================================================
 * Comprehensive Mobile Responsiveness: 1024px, 768px, 640px, 480px, 360px
 * ==================================================================== */

@media (max-width: 768px) {
  .ai-header-inner {
    flex-wrap: wrap;
    padding: 10px 16px;
    gap: 12px;
  }
  .ai-brand-sub {
    display: none;
  }
  .ai-nav-links {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    gap: 12px;
  }
  .ai-nav-links a {
    white-space: nowrap;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    padding: 0 6px;
  }
}

@media (max-width: 640px) {
  .ai-container, .tool-container { padding: 0 16px; }
  .ai-card, .tool-card { padding: 18px 16px; border-radius: 10px; }
  .result-grid { grid-template-columns: 1fr; }
  .theory-section { padding: 18px 16px; border-radius: 10px; }
  .btn-group { gap: 10px; }
}

@media (max-width: 480px) {
  .ai-container, .tool-container { padding: 0 12px; }
  .ai-card, .tool-card { padding: 16px 12px; }
  .btn-group { flex-direction: column; align-items: stretch; }
  .btn-group .btn-primary, .btn-group .btn-ghost, .btn-group .btn-secondary { width: 100%; }
}

@media (max-width: 360px) {
  .ai-container, .tool-container { padding: 0 8px; }
  .ai-card, .tool-card { padding: 14px 10px; border-radius: 8px; }
  .ai-brand-title { font-size: 1.15rem; }
  .result-card-value { font-size: 1.2rem; }
}

/* Reduced Motion Compliance */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}


/* ====================================================================
 * AI Tools Mobile Ergonomics & Overflow Safeguards
 * ==================================================================== */
pre, .ai-card pre {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  white-space: pre-wrap;
  word-break: break-word;
}

code, .ai-card code {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

input[type="range"] {
  max-width: 100%;
  min-height: 44px;
  font-size: 16px;
}

.chem-table-wrap, .table-wrap, [style*="overflow-x: auto"] {
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 540px) {
  .slider-row {
    flex-wrap: wrap !important;
    gap: 6px !important;
  }
  .slider-row label {
    flex: 1 1 100% !important;
    margin-bottom: 2px;
  }
  .slider-row input[type="range"] {
    flex: 1 1 140px !important;
    min-width: 120px;
    min-height: 44px;
  }
  .slider-row span.val-display {
    flex: 0 0 auto !important;
  }
}

/* --- Harmonized Global Button Styles --- */
.btn-primary {
  background: var(--gold);
  color: #0A0A0F;
  font-weight: 600;
  border-radius: 6px;
  padding: 10px 18px;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  text-decoration: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.btn-primary:hover {
  opacity: 0.92;
  text-decoration: none;
}
.btn-ghost, .btn-secondary, .btn-preset {
  background: var(--panel-2);
  color: var(--ink);
  border: 1px solid var(--panel-border);
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 0.88rem;
  min-height: 40px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}
.btn-ghost:hover, .btn-secondary:hover, .btn-preset:hover {
  border-color: var(--gold);
  color: var(--gold);
}
.btn-preset.active {
  background: var(--gold-dim);
  border-color: var(--gold);
  color: var(--gold);
  font-weight: 600;
}
