:root {
  color-scheme: light;
  --bg: #f7f5ef;
  --paper: #ffffff;
  --ink: #141414;
  --muted: #5f6368;
  --line: #ddd8ce;
  --teal: #087e74;
  --teal-soft: #e5f3f1;
  --amber: #f6c744;
  --red: #b34242;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
  text-decoration-color: rgba(8, 126, 116, 0.4);
  text-underline-offset: 3px;
}

a:hover {
  color: var(--teal);
}

.site-header,
.site-footer {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
}

.site-footer {
  border-top: 1px solid var(--line);
  border-bottom: 0;
  margin-top: 32px;
}

.nav,
.page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.footer-inner {
  width: min(1360px, calc(100% - 48px));
  margin: 0 auto;
}

.nav,
.footer-inner {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 900;
  text-decoration: none;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 8px;
  background: #111;
  color: var(--amber);
  font-weight: 900;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.nav-links a {
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  background: #111;
  color: #fff;
}

.page {
  padding: 42px 0 0;
  flex: 1 0 auto;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(360px, 1.05fr);
  gap: 34px;
  align-items: start;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--teal);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.08;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2.15rem, 4.2vw, 3.75rem);
  max-width: 720px;
}

h2 {
  font-size: clamp(1.28rem, 1.7vw, 1.65rem);
  margin-bottom: 14px;
}

h3 {
  font-size: 1.05rem;
}

.formula {
  display: inline-block;
  white-space: nowrap;
  font-variant-numeric: lining-nums;
}

.formula sub,
.formula sup {
  position: relative;
  font-size: 0.68em;
  line-height: 0;
}

.formula sub {
  bottom: -0.28em;
}

.formula sup {
  top: -0.48em;
  margin-left: 0.04em;
}

.lede {
  max-width: 680px;
  margin: 16px 0 0;
  color: #3e4247;
  font-size: 1.05rem;
}

.molecule-hero {
  grid-template-columns: minmax(0, 1fr) minmax(500px, 1.1fr);
  align-items: start;
}

.molecule-hero .eyebrow {
  margin-bottom: 22px;
  font-size: 0.98rem;
}

.molecule-hero h1 {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  column-gap: 0.28em;
  row-gap: 0.14em;
  max-width: 640px;
  font-size: clamp(1.9rem, 3vw, 2.55rem);
  line-height: 1.04;
}

.molecule-name {
  margin: 20px 0 0;
  color: #35383c;
  font-size: 1.25rem;
  font-weight: 800;
}

.tool-panel,
.structure-panel,
.section,
.callout {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 12px 28px rgba(33, 29, 20, 0.08);
}

.tool-panel {
  padding: 20px;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-top: 16px;
}

input,
button {
  font: inherit;
}

.search-input {
  width: 100%;
  min-height: 48px;
  border: 1px solid #cfc8bb;
  border-radius: 8px;
  padding: 0 14px;
  color: var(--ink);
}

.button {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  background: #111;
  color: #fff;
  font-weight: 900;
  cursor: pointer;
}

.button:hover {
  background: var(--teal);
}

.result-box {
  min-height: 44px;
  margin-top: 14px;
  color: var(--muted);
}

.quick-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 16px;
}

.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #faf9f6;
  padding: 0 10px;
  color: #2b2d30;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 800;
  white-space: nowrap;
}

.chip .formula {
  min-width: 34px;
  text-align: center;
}

.chip:hover {
  border-color: var(--teal);
  background: var(--teal-soft);
}

.structure-panel {
  overflow: hidden;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #111;
  color: #fff;
}

.panel-head h2 {
  margin-bottom: 0;
}

.panel-head p {
  margin: 9px 0 0;
  color: #c9ceca;
}

.lewis-svg {
  display: block;
  width: 100%;
  min-height: 250px;
  background: #fff;
}

.svg-bg {
  fill: #fff;
  stroke: transparent;
}

.bond-lines line {
  stroke: #171717;
  stroke-width: 2.6;
  stroke-linecap: round;
}

.electron-dots circle {
  fill: #171717;
}

.atom-label {
  dominant-baseline: middle;
  fill: #111;
  font-size: 25px;
  font-weight: 900;
  text-anchor: middle;
}

.atom-label.element-o {
  fill: #d93025;
}

.atom-label.element-n {
  fill: #1f5fbf;
}

.atom-label.element-s {
  fill: #a86a00;
}

.atom-label.element-f,
.atom-label.element-cl {
  fill: #16855b;
}

.atom-label.element-b {
  fill: #8a5a24;
}

.atom-charge {
  dominant-baseline: middle;
  fill: var(--red);
  font-size: 13px;
  font-weight: 900;
  text-anchor: middle;
}

.ion-brackets path {
  fill: none;
  stroke: #171717;
  stroke-width: 2;
  stroke-linecap: square;
  stroke-linejoin: round;
}

.ion-brackets text {
  dominant-baseline: middle;
  fill: #171717;
  font-size: 15px;
  font-weight: 900;
  text-anchor: start;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border-top: 1px solid var(--line);
  background: var(--line);
}

.stat {
  background: #faf9f6;
  padding: 12px 14px;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.stat strong {
  display: block;
  margin-top: 3px;
  font-size: 1rem;
}

.section-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 360px);
  gap: 24px;
  margin-top: 30px;
}

.section,
.callout {
  padding: 20px;
}

.vsepr-section {
  margin-top: 30px;
}

.vsepr-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.vsepr-item {
  min-height: 82px;
  border: 1px solid #e8e3d8;
  border-radius: 8px;
  background: #faf9f6;
  padding: 13px 14px;
}

.vsepr-item span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.vsepr-item strong {
  display: block;
  margin-top: 6px;
  font-size: 1.05rem;
  line-height: 1.2;
}

.section + .section {
  margin-top: 16px;
}

.solution-section {
  padding: 0;
  overflow: hidden;
}

.solution-section h2 {
  padding: 20px 20px 0;
}

.solution-list {
  display: grid;
  gap: 0;
}

.solution-step {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 14px;
  padding: 16px 20px;
  border-top: 1px solid var(--line);
}

.solution-step:first-of-type {
  border-top: 0;
}

.step-number {
  width: 28px;
  height: 28px;
  display: inline-grid;
  place-items: center;
  border: 2px solid var(--teal);
  border-radius: 999px;
  color: var(--teal);
  font-size: 0.86rem;
  font-weight: 900;
}

.solution-step h3 {
  margin-top: 2px;
}

.solution-step p {
  margin: 8px 0 0;
  color: #485056;
  font-size: 0.96rem;
}

.step-work {
  margin-top: 10px;
  border: 1px solid #e4ded2;
  border-radius: 8px;
  background: #f8fbfa;
  padding: 12px 14px;
  color: #111;
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 400;
  line-height: 1.45;
  text-align: left;
}

.final-step {
  border-top-color: #b8dfdc;
  background: #edf8f6;
}

.final-step .step-number {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}

.final-step .step-work {
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 1rem;
  font-weight: 400;
}

.steps {
  margin: 0;
  padding-left: 22px;
  font-size: 0.98rem;
}

.steps li + li {
  margin-top: 8px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.data-table th,
.data-table td {
  border-bottom: 1px solid var(--line);
  padding: 9px 11px;
  text-align: left;
  font-size: 0.96rem;
}

.data-table th {
  background: #f2efe7;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.data-table tr:last-child td {
  border-bottom: 0;
}

.note {
  border-left: 4px solid var(--amber);
  padding: 10px 12px;
  background: #fff8df;
  color: #3d341d;
  font-size: 0.94rem;
}

.molecule-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.molecule-card {
  min-height: 116px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 17px;
  text-decoration: none;
}

.molecule-card strong {
  display: block;
  min-height: 1.7rem;
  font-size: 1.32rem;
  line-height: 1.15;
}

.molecule-card span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.98rem;
}

.refs {
  color: var(--muted);
  font-size: 0.9rem;
}

.faq-section {
  margin-top: 28px;
}

.faq-item {
  border-top: 1px solid var(--line);
  padding: 13px 0;
}

.faq-item:first-of-type {
  border-top: 0;
}

.faq-item summary {
  cursor: pointer;
  font-weight: 850;
}

.faq-item p {
  margin: 10px 0 0;
  color: #3f464a;
  font-size: 0.98rem;
}

.site-footer .footer-inner {
  min-height: 112px;
  padding: 20px 0;
  align-items: center;
}

.site-footer .nav-links {
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 10px;
}

.site-footer .nav-links a {
  padding: 7px 9px;
  font-size: 0.9rem;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .hero,
  .section-grid {
    grid-template-columns: 1fr;
  }

  .stats-grid,
  .vsepr-grid,
  .molecule-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .molecule-hero h1 {
    max-width: 100%;
  }
}

@media (max-width: 620px) {
  .nav,
  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px 0;
  }

  .search-row,
  .stats-grid,
  .vsepr-grid,
  .molecule-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 2.15rem;
  }

  .molecule-hero h1 {
    font-size: 2rem;
  }

  .site-footer .nav-links {
    flex-wrap: wrap;
    justify-content: flex-start;
  }
}
