:root {
  /* Customization point: brand colors. */
  --teal: #0f766e;
  --teal-strong: #0d9488;
  --purple: #7c3aed;
  --rose: #be185d;
  --gold: #f59e0b;
  --bg: #fbf9ff;
  --surface: #ffffff;
  --surface-soft: #f3eefc;
  --text: #1f2937;
  --muted: #667085;
  --border: #ded7ea;
  --shadow: 0 18px 45px rgba(55, 48, 92, 0.12);
  --radius: 8px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #111827;
  --surface: #172033;
  --surface-soft: #202b42;
  --text: #f8fafc;
  --muted: #cbd5e1;
  --border: #334155;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.14), transparent 28rem),
    radial-gradient(circle at top right, rgba(124, 58, 237, 0.14), transparent 24rem),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}

a {
  color: inherit;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(15, 148, 136, 0.45);
  outline-offset: 3px;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px);
}

.nav,
.hero-inner,
.app-layout,
.faq-section,
.site-footer,
.content-page {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
}

.nav {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 68px;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--teal), var(--purple));
  color: #fff;
  font-size: 0.88rem;
  letter-spacing: 0;
}

.nav-links {
  display: none;
  gap: 16px;
  margin-left: auto;
}

.nav-links a,
.site-footer a {
  color: var(--muted);
  font-weight: 700;
  text-decoration: none;
}

.nav-links a[aria-current="page"],
.nav-links a:hover,
.site-footer a:hover {
  color: var(--teal-strong);
}

.theme-toggle {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  margin-left: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}

.theme-glyph {
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 50%;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}

.nav-links + .theme-toggle {
  margin-left: 0;
}

.hero,
.page-hero {
  padding: 44px 0 18px;
}

.hero h1,
.page-hero h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(2.25rem, 7vw, 4.6rem);
  line-height: 1;
  letter-spacing: 0;
}

.hero p,
.page-hero p {
  max-width: 680px;
  color: var(--muted);
  font-size: 1.08rem;
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--teal-strong);
  font-size: 0.79rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ad-slot {
  display: grid;
  place-items: center;
  min-height: 84px;
  border: 1px dashed color-mix(in srgb, var(--border), var(--teal) 20%);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface-soft) 78%, transparent);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
  text-transform: uppercase;
}

.ad-wide {
  width: min(1120px, calc(100% - 32px));
  margin: 20px auto;
}

.app-layout {
  display: grid;
  gap: 20px;
  align-items: start;
  padding: 12px 0 20px;
}

.calculator-panel,
.history-panel,
.content-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.calculator-panel {
  padding: 18px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading h2,
.section-heading p {
  margin: 0;
}

.section-heading h2 {
  font-size: 1.35rem;
}

.section-heading p,
.muted,
.field-help,
.status {
  color: var(--muted);
}

.compact {
  align-items: center;
  margin-bottom: 8px;
}

.date-form {
  display: grid;
  gap: 14px;
}

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

.field label,
.share-panel label {
  font-weight: 800;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
}

input {
  min-height: 50px;
  padding: 0 14px;
}

textarea {
  resize: vertical;
  padding: 12px;
}

.results {
  margin-top: 18px;
}

.empty-state {
  display: grid;
  gap: 4px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.result-grid,
.insight-grid {
  display: grid;
  gap: 12px;
}

.metric-card,
.insight-card,
.compatibility,
.share-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 88%, var(--surface-soft));
  padding: 16px;
}

.primary-result {
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.13), rgba(124, 58, 237, 0.13));
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.metric-card strong,
.compatibility strong {
  display: block;
  margin: 6px 0;
  font-size: 1.6rem;
  line-height: 1.1;
}

.compatibility,
.insight-grid,
.share-panel {
  margin-top: 12px;
}

.compatibility-top,
.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.rating-pill {
  border-radius: 999px;
  background: color-mix(in srgb, var(--purple) 14%, var(--surface));
  color: var(--purple);
  padding: 7px 11px;
  font-weight: 900;
}

.gauge {
  height: 16px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}

.gauge span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--rose), var(--gold), var(--teal-strong));
  transition: width 180ms ease;
}

.insight-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.insight-card p {
  margin: 0;
}

.text-button,
.ghost-button,
.secondary-button,
.primary-button {
  border-radius: var(--radius);
  font-weight: 900;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--teal-strong);
  padding: 8px 0;
}

.ghost-button,
.secondary-button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 10px 14px;
}

.primary-button {
  border: 0;
  background: linear-gradient(135deg, var(--teal), var(--purple));
  color: #fff;
  padding: 11px 15px;
}

.share-panel {
  display: grid;
  gap: 10px;
}

.sidebar {
  display: grid;
  gap: 20px;
}

.ad-sidebar {
  min-height: 190px;
}

.history-panel {
  padding: 16px;
}

.history-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 22px;
}

.history-list li {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.history-list button {
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
  text-align: left;
}

.faq-section {
  padding: 24px 0 52px;
}

.faq-section h2 {
  margin-top: 0;
}

details {
  margin: 10px 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px 16px;
}

summary {
  cursor: pointer;
  font-weight: 900;
}

.site-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid var(--border);
  padding: 24px 0 34px;
  color: var(--muted);
}

.site-footer p {
  margin: 0;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

.content-page {
  padding-bottom: 52px;
}

.content-card {
  padding: 20px;
}

.content-card h2 {
  margin-top: 28px;
}

.content-card h2:first-child {
  margin-top: 0;
}

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

.is-hidden {
  display: none !important;
}

@media (min-width: 680px) {
  .nav-links {
    display: flex;
  }

  .date-form,
  .result-grid,
  .insight-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .site-footer {
    flex-direction: row;
    justify-content: space-between;
  }
}

@media (min-width: 960px) {
  .app-layout {
    grid-template-columns: minmax(0, 1fr) 300px;
  }

  .calculator-panel {
    padding: 22px;
  }
}
