﻿:root {
  color: #332a2d;
  background: #f7f1eb;
  font-family: "Lato UI", Arial, sans-serif;
}

@font-face {
  font-display: swap;
  font-family: "Lato UI";
  font-style: normal;
  font-weight: 400;
  src: url("/static/fonts/Lato-Regular.ttf") format("truetype");
}

@font-face {
  font-display: swap;
  font-family: "Lato UI";
  font-style: normal;
  font-weight: 700;
  src: url("/static/fonts/Lato-Bold.ttf") format("truetype");
}

@font-face {
  font-display: swap;
  font-family: "Kalam Hand";
  font-style: normal;
  font-weight: 700;
  src: url("/static/fonts/Kalam-Bold.ttf") format("truetype");
}

* { box-sizing: border-box; }

body { margin: 0; background: #f7f1eb; }

button, input, select, textarea { font: inherit; }

.site-shell { width: min(1080px, calc(100% - 32px)); margin: 0 auto; padding-bottom: 28px; }

.site-header {
  align-items: center;
  background: #f5d5d5;
  border-radius: 0 0 18px 18px;
  display: flex;
  justify-content: space-between;
  margin-bottom: 42px;
  padding: 20px 28px;
}

h1, h2 { font-family: "Lato UI", Arial, sans-serif; }
.brand, #home-title, #home .home-card h2 { font-family: "Kalam Hand", "Segoe Print", cursive; }

.brand {
  align-items: center;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  font-size: 1.5rem;
  font-weight: bold;
  gap: 9px;
  padding: 0;
  text-align: left;
}

.brand-mark { flex: 0 0 auto; height: 36px; overflow: visible; width: 58px; }
.brand-mark-stroke, .nav-icon {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.brand-mark-stroke { stroke-width: 1.9; }
.brand-mark-formula {
  fill: currentColor;
  font-family: Georgia, serif;
  font-size: 9px;
  font-weight: bold;
}

nav { display: flex; gap: 12px; }
.header-tools { align-items: flex-end; display: flex; flex-direction: column; gap: 6px; }
nav button, .back-button {
  align-items: center;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  font-size: 1.05rem;
  gap: 6px;
  padding: 10px 13px;
}

.nav-icon { flex: 0 0 auto; height: 19px; stroke-width: 1.8; width: 19px; }
nav button:nth-child(odd) .nav-icon { transform: rotate(-2deg); }
nav button:nth-child(even) .nav-icon { transform: rotate(2deg); }

nav button:hover, .back-button:hover { text-decoration: underline; }

.screen { min-height: 440px; }

.visually-hidden {
  border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  height: 1px;
  margin: -1px;
  overflow: hidden;
  padding: 0;
  position: absolute;
  white-space: nowrap;
  width: 1px;
}

.intro { margin: 0 auto 36px; max-width: 760px; text-align: center; }
.eyebrow { font-size: .78rem; font-weight: bold; letter-spacing: .11em; margin: 0 0 10px; text-transform: uppercase; }
h1 { font-size: clamp(2rem, 5vw, 3.5rem); line-height: 1.08; margin: 0 0 14px; }
.home-title--compact { font-size: clamp(1.9rem, 4.2vw, 3rem); }
h2 { font-size: 1.35rem; margin-top: 0; }
.intro p:last-child { font-size: 1.15rem; line-height: 1.6; margin: 0; }

.home-cards, .formatter-grid { display: grid; gap: 24px; grid-template-columns: repeat(3, 1fr); }
.formatter-grid { grid-template-columns: repeat(2, 1fr); }

.home-card, .content-card, .shortcut-card {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 8px 22px rgb(79 54 58 / 8%);
  padding: 28px;
}

.home-card { display: flex; flex-direction: column; min-height: 300px; }
.home-card p { line-height: 1.55; margin-top: 0; }
.home-card-example {
  align-items: center;
  color: #4c3b40;
  display: flex;
  flex-direction: column;
  font-family: "Times New Roman", serif;
  font-size: .95rem;
  gap: 2px;
  margin: 8px 0;
  text-align: center;
}
.home-card-formatted { font-weight: bold; }
.mathematics-example { display: block; white-space: nowrap; }
.chemistry-example-source { font-family: "Lato UI", Arial, sans-serif; font-size: .8rem; }
.chemistry-example-arrow { color: #a95f72; font-size: .95rem; font-weight: bold; line-height: 1; }
.chemistry-example-output { font-weight: bold; }

.home-card button, .action-row button, .result-actions button, .report-actions button,
.finder-meta button, .formula-actions button, .explain-actions button {
  background: #f5d5d5;
  border: 0;
  border-radius: 9px;
  color: #332a2d;
  cursor: pointer;
  font-weight: bold;
  margin-top: 0;
  padding: 11px 14px;
}
.home-card button { margin-top: auto; }

button:disabled { cursor: not-allowed; opacity: .55; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, h1:focus-visible {
  outline: 3px solid #a95f72;
  outline-offset: 3px;
}

.screen-heading { align-items: center; display: flex; justify-content: space-between; margin-bottom: 22px; }
.screen-heading h1 { font-size: clamp(2rem, 4vw, 2.8rem); margin: 0; }
label { display: block; font-weight: bold; margin-bottom: 8px; }
textarea { border: 1px solid #d8c8c4; border-radius: 10px; resize: vertical; padding: 12px; width: 100%; }
input, select {
  background: #fff;
  border: 1px solid #d8c8c4;
  border-radius: 10px;
  color: inherit;
  margin-bottom: 14px;
  padding: 12px;
  width: 100%;
}
.action-row { display: flex; gap: 10px; margin-top: 14px; }
.action-row button { margin-top: 0; }

.result-card output { display: block; font-family: "Times New Roman", serif; font-size: 1.25rem; line-height: 1.6; min-height: 160px; }
.result-card output[data-stale="true"] { color: #6d5c60; }
.result-actions, .report-actions { display: flex; gap: 10px; margin-top: 14px; }
.result-actions[hidden] { display: none; }
.result-actions button, .report-actions button { margin-top: 0; }
.explain-actions { margin-top: 14px; }
.ai-explanation {
  background: #fbf7f4;
  border-left: 3px solid #f5d5d5;
  line-height: 1.55;
  margin: 12px 0 0;
  padding: 12px 14px;
}

.check-report {
  border: 1px solid #d8c8c4;
  border-radius: 10px;
  line-height: 1.5;
  margin-top: 16px;
  padding: 14px;
}

.check-report.report-success { background: #f0f6ef; border-color: #b8cbb5; }
.check-report.report-error { background: #fff3f1; border-color: #ddb7af; }
.check-report ul { margin: 10px 0 0; padding-left: 22px; }
.check-report li + li { margin-top: 10px; }
.report-summary, .correction-preview { margin: 0; }
.issue-position { display: block; font-size: .85rem; font-weight: bold; margin-top: 3px; }
.correction-preview { font-family: "Times New Roman", serif; margin-top: 8px; }
.element-counts { margin-top: 10px; }
.element-counts caption { font-family: "Lato UI", Arial, sans-serif; font-size: .8rem; font-weight: bold; text-align: left; text-transform: uppercase; }
.shortcut-card { margin-top: 20px; }
.finder-search { max-width: 680px; }
.finder-filters { display: grid; gap: 14px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.quiet-note { color: #6d5c60; font-size: .9rem; line-height: 1.5; }
.finder-meta { align-items: center; display: flex; gap: 16px; justify-content: space-between; }
.finder-meta p { margin: 0; }
.finder-meta button, .formula-actions button, .explain-actions button { margin-top: 0; }
.degraded-notice {
  background: #fff3f1;
  border: 1px solid #ddb7af;
  border-radius: 10px;
  line-height: 1.5;
  padding: 12px;
}
.finder-status { min-height: 1.5em; }
.finder-results { display: grid; gap: 20px; margin-top: 20px; }
.formula-result {
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 8px 22px rgb(79 54 58 / 8%);
  padding: 24px;
}
.formula-result h3 { font-family: "Lato UI", Arial, sans-serif; font-size: 1.35rem; margin: 0; }
.formula-alternate { color: #6d5c60; margin: 4px 0 0; }
.formula-category {
  font-size: .78rem;
  font-weight: bold;
  letter-spacing: .1em;
  text-transform: uppercase;
}
.formula-display {
  font-family: "Times New Roman", serif;
  font-size: 1.75rem;
  margin: 16px 0;
}
.symbol-notes { display: grid; grid-template-columns: minmax(36px, auto) 1fr; gap: 6px 14px; }
.symbol-notes dt { font-family: "Times New Roman", serif; font-weight: bold; }
.symbol-notes dd { margin: 0; }
.formula-explanation { line-height: 1.55; }
.formula-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.empty-result { background: #fff; border-radius: 18px; margin: 0; padding: 24px; }
table { border-collapse: collapse; font-family: "Times New Roman", serif; text-align: left; width: 100%; }
th, td { border-bottom: 1px solid #eadfdb; padding: 10px; }
th { font-family: "Lato UI", Arial, sans-serif; font-size: .8rem; text-transform: uppercase; }

.site-footer { color: #6d5c60; font-size: .85rem; margin-top: 44px; text-align: center; }
.visitor-count { margin: 0 0 7px; }
footer { margin: 0; }

@media (max-width: 640px) {
  .site-shell { width: min(100% - 24px, 900px); }
  .site-header { align-items: flex-start; flex-direction: column; gap: 14px; margin-bottom: 26px; padding: 18px; }
  .header-tools { align-items: flex-start; }
  nav { flex-wrap: wrap; }
  .home-cards, .formatter-grid { grid-template-columns: 1fr; }
  .screen-heading { align-items: flex-start; flex-direction: column; gap: 12px; }
  .finder-filters { grid-template-columns: 1fr; }
  .finder-meta { align-items: stretch; flex-direction: column; }
}


/* Button interaction feedback */
.home-card button, .action-row button, .result-actions button, .report-actions button,
.finder-meta button, .formula-actions button, .explain-actions button {
  transition: background .12s ease, transform .08s ease, box-shadow .12s ease;
  box-shadow: 0 2px 6px rgb(79 54 58 / 10%);
}

.home-card button:hover, .action-row button:hover, .result-actions button:hover,
.report-actions button:hover, .finder-meta button:hover, .formula-actions button:hover,
.explain-actions button:hover {
  background: #efbcbc;
}

.home-card button:active, .action-row button:active, .result-actions button:active,
.report-actions button:active, .finder-meta button:active, .formula-actions button:active,
.explain-actions button:active {
  background: #e8aaaa;
  transform: translateY(1px) scale(.98);
  box-shadow: 0 1px 3px rgb(79 54 58 / 14%);
}


nav button, .back-button {
  transition: background .12s ease, transform .08s ease;
  border-radius: 8px;
}
nav button:hover, .back-button:hover { background: rgb(51 42 45 / 6%); text-decoration: none; }
nav button:active, .back-button:active { background: rgb(51 42 45 / 12%); transform: translateY(1px); }

.brand { transition: opacity .12s ease; }
.brand:hover { opacity: .8; }
.brand:active { opacity: .6; }
