:root {
  color-scheme: light;
  --ink: #173452;
  --ink-deep: #0c2236;
  --blue: #236f8b;
  --gold: #d5a63b;
  --paper: #f6efe2;
  --paper-2: #fffaf0;
  --line: rgba(23, 52, 82, 0.16);
  --muted: rgba(23, 52, 82, 0.68);
  --shadow: 0 28px 90px rgba(12, 34, 54, 0.14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  background: transparent;
}

body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  margin: 0;
  background: transparent;
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
  min-width: 0;
  max-width: 100%;
}

.calc-shell {
  width: 100%;
  max-width: 1180px;
  overflow-x: hidden;
  margin: 0 auto;
  padding: clamp(14px, 2vw, 24px);
  background:
    linear-gradient(135deg, rgba(35, 111, 139, 0.08), transparent 36%),
    var(--paper);
}

.calc-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(16px, 2.5vw, 28px);
  align-items: start;
  padding: clamp(24px, 4vw, 44px);
  background:
    linear-gradient(90deg, rgba(246, 239, 226, 0.07) 1px, transparent 1px),
    linear-gradient(180deg, rgba(246, 239, 226, 0.07) 1px, transparent 1px),
    var(--ink);
  background-size: 44px 44px;
  color: var(--paper-2);
}

.calc-eyebrow,
.calc-panel__head p {
  margin: 0;
  color: #b9d4e3;
  font-size: 0.72rem;
  font-weight: 850;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.calc-hero h1 {
  max-width: 13ch;
  margin: 12px 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.55rem, 5.8vw, 5.4rem);
  font-weight: 400;
  line-height: 0.94;
  letter-spacing: 0;
}

.calc-title-line {
  display: block;
}

.calc-lead {
  max-width: 780px;
  margin: 22px 0 0;
  color: rgba(255, 250, 240, 0.84);
  font-size: clamp(1rem, 1.4vw, 1.16rem);
  line-height: 1.62;
}

.calc-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(280px, 0.52fr);
  gap: clamp(16px, 2vw, 24px);
  align-items: start;
  padding-top: clamp(16px, 2vw, 24px);
}

.calc-grid > *,
.calc-panel,
.calc-result,
.calc-hero,
.field,
.checks label {
  min-width: 0;
}

.calc-panel,
.calc-result {
  border: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.82);
  box-shadow: var(--shadow);
}

.calc-panel {
  display: grid;
  gap: 16px;
  padding: clamp(18px, 3vw, 30px);
}

.calc-inputs {
  grid-row: span 2;
}

.calc-panel__head {
  display: grid;
  gap: 8px;
  margin-bottom: 4px;
}

.calc-panel__head p {
  color: var(--blue);
}

.calc-panel__head h2,
.calc-result h2 {
  max-width: 100%;
  margin: 0;
  color: var(--ink-deep);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  font-weight: 400;
  line-height: 1;
  overflow-wrap: anywhere;
}

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

.field span,
.checks label {
  color: var(--ink-deep);
  font-size: 0.88rem;
  font-weight: 800;
}

.field select,
.field input[type="range"] {
  width: 100%;
}

.field select {
  min-width: 0;
  max-width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid rgba(23, 52, 82, 0.22);
  border-radius: 0;
  background: #fffdf7;
  color: var(--ink);
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.field input[type="range"] {
  accent-color: var(--blue);
}

.field em {
  color: var(--muted);
  font-size: 0.82rem;
  font-style: normal;
  line-height: 1.4;
}

.checks {
  display: grid;
  gap: 12px;
}

.checks label {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid rgba(23, 52, 82, 0.12);
  background: #fffdf7;
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.checks input {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
}

.calc-result {
  position: sticky;
  top: 12px;
  display: grid;
  gap: 18px;
  padding: clamp(20px, 3vw, 32px);
  background: var(--ink);
  color: var(--paper-2);
}

body[data-embed="article"] .calc-grid {
  grid-template-columns: minmax(0, 0.95fr) minmax(280px, 0.52fr);
}

body[data-embed="article"] .calc-inputs {
  grid-row: span 2;
}

body[data-embed="article"] .calc-result {
  position: static;
}

body[data-embed="wide"] .calc-shell {
  max-width: none;
  padding: 0;
  background: transparent;
}

body[data-embed="wide"] .calc-grid {
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.5fr);
}

body[data-embed="wide"] .calc-result {
  position: sticky;
}

.calc-result__top {
  display: grid;
  gap: 18px;
}

.calc-result h2 {
  margin-top: 8px;
  color: #f6d36e;
  font-size: clamp(3rem, 6vw, 5.2rem);
}

.calc-result__top span,
.calc-complexity,
.calc-timeline p {
  max-width: 100%;
  color: rgba(255, 250, 240, 0.78);
  line-height: 1.52;
  overflow-wrap: anywhere;
}

.calc-result__top a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 18px;
  background: #f6d36e;
  color: var(--ink-deep);
  font-size: 0.76rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-decoration: none;
  text-transform: uppercase;
}

.calc-meter {
  height: 10px;
  overflow: hidden;
  background: rgba(255, 250, 240, 0.14);
}

.calc-meter span {
  display: block;
  width: 42%;
  height: 100%;
  background: linear-gradient(90deg, #6eb7cf, #f6d36e);
  transition: width 0.2s ease;
}

.calc-breakdown {
  display: grid;
  gap: 10px;
}

.breakdown-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid rgba(255, 250, 240, 0.14);
}

.breakdown-row span {
  color: rgba(255, 250, 240, 0.7);
  font-size: 0.84rem;
  line-height: 1.35;
}

.breakdown-row strong {
  color: var(--paper-2);
  white-space: nowrap;
}

.calc-timeline {
  display: grid;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 250, 240, 0.18);
}

.calc-timeline strong {
  color: #f6d36e;
  line-height: 1.35;
}

.calc-timeline p {
  margin: 0;
  font-size: 0.9rem;
}

@media (max-width: 900px) {
  .calc-hero,
  .calc-grid,
  body[data-embed="wide"] .calc-grid {
    grid-template-columns: 1fr;
  }

  .calc-inputs,
  body[data-embed="wide"] .calc-inputs {
    grid-row: auto;
  }

  .calc-result,
  body[data-embed="wide"] .calc-result {
    position: static;
  }
}

@media (max-width: 560px) {
  .calc-shell {
    width: 100%;
    max-width: 100%;
    padding: 0;
  }

  .calc-hero,
  .calc-panel,
  .calc-result {
    width: 100%;
    max-width: 100%;
    padding: 18px;
  }

  .calc-grid {
    gap: 14px;
    padding-top: 14px;
  }

  .calc-panel__head h2,
  .calc-result h2 {
    font-size: clamp(1.45rem, 7.6vw, 2rem);
    line-height: 1.04;
  }

  .calc-hero h1 {
    max-width: 100%;
    font-size: clamp(2.25rem, 11.4vw, 3rem);
    line-height: 0.98;
    overflow-wrap: break-word;
  }

  .calc-title-line > span {
    display: block;
  }

  .calc-lead {
    font-size: 1rem;
    line-height: 1.55;
  }

  .field {
    gap: 9px;
  }

  .field span,
  .checks label {
    font-size: 0.9rem;
    line-height: 1.25;
  }

  .field select {
    appearance: none;
    min-height: 56px;
    padding: 0 42px 0 14px;
    background:
      #fffdf7
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%23173452' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")
      no-repeat right 14px center / 16px 16px;
    font-size: 1rem;
  }

  .field em {
    font-size: 0.84rem;
    line-height: 1.45;
  }

  .checks label {
    grid-template-columns: 22px minmax(0, 1fr);
    align-items: start;
    padding: 14px;
  }

  .checks input {
    margin-top: 1px;
  }

  .breakdown-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .breakdown-row strong {
    white-space: normal;
  }
}

@media (max-width: 680px) {
  body[data-embed="article"] .calc-grid {
    grid-template-columns: 1fr;
  }

  body[data-embed="article"] .calc-inputs {
    grid-row: auto;
  }
}
