:root {
  color-scheme: light;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-strong: #eef6ff;
  --text: #172033;
  --muted: #5d6b82;
  --border: #dbe4ef;
  --primary: #0f766e;
  --primary-strong: #115e59;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --green-soft: #dcfce7;
  --amber-soft: #fef3c7;
  --rose-soft: #ffe4e6;
  --violet-soft: #ede9fe;
  --shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
  --radius: 8px;
  --max: 1160px;
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(16px);
}

.nav-shell {
  width: min(100% - 32px, var(--max));
  min-height: 72px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  color: #ffffff;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  font-size: 0.82rem;
}

.header-search {
  order: 3;
  grid-column: 1 / -1;
  width: 100%;
}

.header-search input,
.hero-search input,
.form-field input,
.form-field select,
.tool-textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
  color: var(--text);
  outline: none;
  padding: 12px 14px;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.header-search input:focus,
.hero-search input:focus,
.form-field input:focus,
.form-field select:focus,
.tool-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}

.menu-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.menu-toggle span:not(.sr-only) {
  width: 18px;
  height: 2px;
  margin: 0 auto;
  background: var(--text);
}

.primary-menu {
  display: none;
  grid-column: 1 / -1;
  padding: 0 0 16px;
}

.primary-menu.is-open {
  display: grid;
  gap: 8px;
}

.primary-menu a {
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--muted);
  font-weight: 650;
}

.primary-menu a:hover {
  background: var(--surface-strong);
  color: var(--primary-strong);
}

.hero-section {
  width: min(100% - 32px, var(--max));
  margin: 34px auto 0;
  padding: 56px 0 34px;
}

.hero-content {
  max-width: 820px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--primary-strong);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 920px;
  margin-bottom: 18px;
  font-size: clamp(2.3rem, 7vw, 4.8rem);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  line-height: 1.12;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.08rem;
  line-height: 1.25;
}

p {
  color: var(--muted);
}

.hero-content p {
  max-width: 690px;
  font-size: 1.12rem;
}

.hero-search {
  display: grid;
  gap: 10px;
  max-width: 760px;
  margin: 28px 0 16px;
}

.hero-search input {
  min-height: 58px;
  padding-inline: 18px;
  font-size: 1rem;
}

.button,
.hero-search button,
.tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  border: 0;
  border-radius: var(--radius);
  background: var(--primary);
  color: #ffffff;
  padding: 12px 18px;
  font-weight: 800;
}

.button:hover,
.hero-search button:hover,
.tool-button:hover {
  background: var(--primary-strong);
}

.button.secondary,
.tool-button.secondary {
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
}

.calculate-button {
  margin-top: 18px;
}

.rate-button {
  min-height: 38px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  padding: 8px 12px;
  font-weight: 800;
}

.rate-button:hover,
.rate-button.is-active {
  border-color: var(--primary);
  background: var(--surface-strong);
  color: var(--primary-strong);
}

.hero-badges,
.pill-links,
.tool-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.rate-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hero-badges span,
.pill-links a,
.badge {
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--muted);
  padding: 7px 12px;
  font-size: 0.9rem;
  font-weight: 700;
}

.section-wrap {
  width: min(100% - 32px, var(--max));
  margin: 0 auto;
  padding: 56px 0;
}

.muted-band {
  width: 100%;
  max-width: none;
  padding-inline: max(16px, calc((100% - var(--max)) / 2));
  background: #eef6f8;
  border-block: 1px solid var(--border);
}

.section-heading {
  max-width: 720px;
  margin-bottom: 24px;
}

.section-heading .eyebrow,
.split-section .eyebrow,
.tool-page .eyebrow {
  margin-bottom: 12px;
}

.card-grid,
.category-grid,
.related-grid,
.result-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.tool-card,
.category-card,
.feature-list article,
.tool-panel,
.result-card,
.faq-list details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.tool-card,
.category-card,
.feature-list article,
.result-card {
  padding: 20px;
}

.tool-card h3 a:hover,
.card-link:hover,
.pill-links a:hover {
  color: var(--primary-strong);
}

.card-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.badge {
  background: var(--accent-soft);
  color: #1e40af;
}

.card-link {
  color: var(--primary);
  font-weight: 800;
}

.category-card {
  min-height: 178px;
}

.category-dot {
  display: block;
  width: 34px;
  height: 8px;
  margin-bottom: 28px;
  border-radius: 999px;
  background: var(--accent-soft);
}

.accent-green .category-dot {
  background: var(--green-soft);
}

.accent-amber .category-dot {
  background: var(--amber-soft);
}

.accent-rose .category-dot {
  background: var(--rose-soft);
}

.accent-violet .category-dot {
  background: var(--violet-soft);
}

.split-section {
  display: grid;
  gap: 24px;
}

.feature-list {
  display: grid;
  gap: 14px;
}

.faq-list {
  display: grid;
  gap: 12px;
}

.faq-list details {
  padding: 18px 20px;
}

.faq-list summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 800;
}

.faq-list p {
  margin: 12px 0 0;
}

.tool-hero {
  width: min(100% - 32px, var(--max));
  margin: 34px auto 0;
  padding: 44px 0 18px;
}

.tool-hero p {
  max-width: 760px;
  font-size: 1.08rem;
}

.tool-layout {
  display: grid;
  gap: 20px;
}

.tool-panel {
  padding: 20px;
}

.upload-box {
  display: grid;
  place-items: center;
  min-height: 250px;
  border: 2px dashed #b9c7d8;
  border-radius: var(--radius);
  background: #f8fbff;
  text-align: center;
  padding: 24px;
}

.upload-box input {
  max-width: 320px;
  margin-top: 16px;
}

.converter-shell {
  display: grid;
  gap: 18px;
}

.converter-dropzone {
  display: grid;
  place-items: center;
  min-height: 270px;
  border: 2px dashed #b9c7d8;
  border-radius: var(--radius);
  background: #f8fbff;
  padding: 24px;
  text-align: center;
  transition: border-color 160ms ease, background 160ms ease;
}

.converter-dropzone.is-dragging {
  border-color: var(--primary);
  background: var(--surface-strong);
}

.converter-dropzone h2 {
  margin-bottom: 8px;
  font-size: 1.45rem;
}

.converter-dropzone p {
  margin-bottom: 14px;
}

.converter-input {
  display: none;
}

.converter-details {
  display: grid;
  gap: 14px;
}

.converter-file-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 14px;
}

.converter-preview {
  min-height: 180px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: #f1f5f9;
  overflow: hidden;
}

.converter-preview img {
  display: block;
  max-width: 100%;
  max-height: 260px;
  object-fit: contain;
}

.file-name {
  margin-bottom: 4px;
  color: var(--text);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.file-size {
  margin-bottom: 0;
}

.converter-error {
  min-height: 24px;
  margin: 0;
  color: #b91c1c;
  font-weight: 800;
}

.download-button[hidden] {
  display: none;
}

.placeholder-note,
.status-message {
  margin-top: 14px;
  border-radius: var(--radius);
  background: var(--surface-strong);
  padding: 12px 14px;
  color: var(--muted);
}

.status-message.compact {
  min-height: 0;
  margin-bottom: 0;
  padding: 0;
  background: transparent;
  color: var(--primary-strong);
  font-weight: 700;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.option-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.choice-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #ffffff;
  padding: 12px 14px;
  color: var(--text);
  font-weight: 750;
}

.choice-card input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.form-field {
  display: grid;
  gap: 7px;
}

.form-field label {
  color: var(--text);
  font-weight: 800;
}

.result-grid {
  margin-top: 20px;
}

.formula-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.result-card span {
  display: block;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.result-card strong {
  display: block;
  margin-top: 4px;
  font-size: 1.6rem;
}

.tool-textarea {
  min-height: 280px;
  resize: vertical;
}

.error-message {
  color: #b91c1c;
  font-weight: 700;
}

.site-footer {
  margin-top: 30px;
  border-top: 1px solid var(--border);
  background: #111827;
  color: #e5e7eb;
}

.footer-grid {
  width: min(100% - 32px, var(--max));
  margin: 0 auto;
  padding: 38px 0;
  display: grid;
  gap: 26px;
}

.site-footer p,
.site-footer a {
  color: #cbd5e1;
}

.site-footer h2 {
  margin-bottom: 12px;
  color: #ffffff;
  font-size: 1rem;
}

.site-footer a:not(.brand) {
  display: block;
  margin: 8px 0;
}

.footer-brand {
  color: #ffffff;
}

.footer-bottom {
  width: min(100% - 32px, var(--max));
  margin: 0 auto;
  padding: 18px 0 26px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
}

@media (min-width: 680px) {
  .hero-search {
    grid-template-columns: 1fr auto;
  }

  .card-grid,
  .category-grid,
  .related-grid,
  .result-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-grid {
    grid-template-columns: 1.5fr 1fr 1fr;
  }

  .option-grid,
  .formula-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .converter-file-card {
    grid-template-columns: minmax(180px, 0.75fr) 1fr;
    align-items: center;
  }
}

@media (min-width: 980px) {
  .nav-shell {
    grid-template-columns: auto minmax(260px, 380px) 1fr;
  }

  .header-search {
    order: initial;
    grid-column: auto;
  }

  .menu-toggle {
    display: none;
  }

  .primary-menu {
    display: flex;
    grid-column: auto;
    justify-content: flex-end;
    align-items: center;
    gap: 4px;
    padding: 0;
  }

  .primary-menu a {
    padding: 8px 9px;
    font-size: 0.92rem;
  }

  .card-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .category-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .split-section,
  .tool-layout {
    grid-template-columns: 0.9fr 1.1fr;
    align-items: start;
  }
}
