:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f1e8;
  color: #182421;
  --ink: #182421;
  --evergreen: #18332f;
  --evergreen-soft: #d9efe4;
  --gold: #ffcf5a;
  --blue: #1c68bf;
  --teal: #2b9ba0;
  --paper: #fffdf7;
  --paper-soft: #f7f4ea;
  --line: #ddd4c0;
  --muted: #596761;
}

* {
  box-sizing: border-box;
}

body {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(244, 241, 232, 0.94)),
    url("./assets/calculator-caddy-pattern.png") center top / 680px auto repeat,
    #f4f1e8;
  margin: 0;
  min-height: 100vh;
}

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

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.brand-hero {
  background:
    linear-gradient(90deg, rgba(255, 253, 247, 1) 0%, rgba(255, 253, 247, 0.96) 45%, rgba(255, 253, 247, 0.62) 70%, rgba(255, 253, 247, 0.12) 100%),
    url("./assets/calculator-caddy-hero.png") center right / cover no-repeat;
  border: 1px solid rgba(221, 212, 192, 0.9);
  border-radius: 10px;
  box-shadow: 0 18px 48px rgba(24, 36, 33, 0.14);
  display: grid;
  margin: 0 auto 18px;
  max-width: 1180px;
  min-height: 390px;
  overflow: hidden;
  padding: clamp(28px, 5vw, 54px);
  place-items: center start;
}

.brand-hero-content {
  max-width: 620px;
}

.brand-script {
  color: var(--blue);
  filter: drop-shadow(0 10px 18px rgba(28, 104, 191, 0.16));
  font-family: "Segoe Script", "Brush Script MT", "Lucida Handwriting", cursive;
  font-size: clamp(3.25rem, 7vw, 6.75rem);
  font-weight: 700;
  line-height: 0.82;
  margin: 0 0 4px -5px;
  text-shadow:
    0 2px 0 rgba(255, 255, 255, 0.9),
    0 14px 34px rgba(23, 37, 33, 0.12);
  transform: rotate(-3deg);
  transform-origin: left center;
}

.brand-tagline {
  color: var(--evergreen);
  font-size: clamp(1.45rem, 3vw, 2.7rem);
  font-weight: 850;
  line-height: 1.05;
  margin: 0 0 14px;
  max-width: 540px;
}

.brand-copy {
  color: #1d312d;
  font-size: 1.08rem;
  font-weight: 650;
  line-height: 1.52;
  margin: 0;
  max-width: 560px;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.86);
}

.hero-actions {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.hero-actions a {
  background: var(--gold);
  border-radius: 8px;
  color: #14231f;
  font-weight: 880;
  padding: 12px 16px;
  text-decoration: none;
}

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

h1,
h2 {
  color: var(--ink);
  letter-spacing: 0;
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.35rem);
  font-weight: 820;
}

h2 {
  font-size: 1.35rem;
  font-weight: 800;
}

.sponsor-strip {
  align-items: center;
  background: rgba(255, 253, 247, 0.96);
  border: 1px solid #d7cfbd;
  border-radius: 8px;
  box-shadow: 0 10px 28px rgba(24, 36, 33, 0.08);
  color: var(--evergreen);
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin: 0 auto 18px;
  max-width: 1180px;
  padding: 12px 14px;
}

.sponsor-strip img,
.sponsor-footer img {
  aspect-ratio: 1;
  align-self: center;
  background: #ffffff;
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgba(20, 35, 31, 0.08);
  height: 136px;
  object-fit: cover;
  object-position: center 16%;
  width: 136px;
}

.sponsor-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.sponsor-strip strong {
  color: var(--evergreen);
  font-size: 1rem;
}

.sponsor-strip div span {
  color: #5d6863;
  font-size: 0.92rem;
}

.sponsor-contact {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin-top: 5px;
}

.sponsor-contact a,
.sponsor-contact span {
  color: #2d514b;
  font-size: 0.9rem;
  font-weight: 760;
  text-decoration: none;
}

.sponsor-action {
  background: var(--gold);
  border-radius: 6px;
  color: #14231f;
  display: inline-flex;
  font-size: 0.88rem;
  font-weight: 850;
  justify-content: center;
  min-width: 92px;
  padding: 8px 10px;
  text-decoration: none;
  white-space: nowrap;
}

.sponsor-action:hover {
  background: #f0bd3f;
}

.workspace {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 18px 45px rgba(24, 36, 33, 0.12);
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  margin: 0 auto;
  max-width: 1180px;
  min-height: 680px;
  overflow: hidden;
}

.tool-shelf {
  align-items: center;
  background:
    linear-gradient(90deg, rgba(255, 253, 247, 0.96), rgba(255, 253, 247, 0.86)),
    url("./assets/calculator-caddy-pattern.png") center / 580px auto repeat;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 38px rgba(24, 36, 33, 0.1);
  display: grid;
  gap: 20px;
  grid-template-columns: 150px minmax(0, 0.8fr) minmax(0, 1.2fr);
  margin: 18px auto 0;
  max-width: 1180px;
  padding: 20px;
}

.tool-shelf-art {
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(24, 36, 33, 0.12);
  display: block;
  width: 100%;
}

.tool-shelf h2 {
  margin-bottom: 8px;
}

.tool-shelf p {
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.tool-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.tool-links a {
  background: var(--evergreen);
  border-radius: 6px;
  color: #fffdf7;
  font-weight: 820;
  padding: 10px 12px;
  text-decoration: none;
}

.affiliate-disclosure {
  flex-basis: 100%;
  font-size: 0.86rem;
  text-align: right;
}

.app-downloads {
  align-items: center;
  border-top: 1px solid rgba(221, 212, 192, 0.9);
  display: flex;
  flex-basis: 100%;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 6px;
  padding-top: 14px;
}

.app-downloads button {
  background: var(--gold);
  border: 0;
  border-radius: 6px;
  color: #14231f;
  cursor: pointer;
  font-weight: 880;
  padding: 11px 13px;
}

.app-downloads span {
  color: var(--muted);
  flex-basis: 100%;
  font-size: 0.88rem;
  text-align: right;
}

.side-nav {
  background: var(--evergreen);
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
}

.nav-button {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: #e9f3ef;
  cursor: pointer;
  font-weight: 760;
  min-height: 44px;
  padding: 10px 12px;
  text-align: left;
}

.nav-button.active,
.nav-button:hover {
  background: var(--gold);
  color: #14231f;
}

.panel {
  display: none;
  padding: 28px;
}

.panel.active {
  display: block;
}

.panel-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 20px;
}

.panel-actions {
  display: flex;
  gap: 8px;
}

.icon-button {
  background: var(--evergreen);
  border: 0;
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  font-weight: 800;
  min-height: 40px;
  padding: 8px 14px;
}

.icon-button:hover {
  background: #244a44;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-bottom: 16px;
  min-width: 0;
}

.field span,
.section-title {
  color: #58655f;
  font-size: 0.85rem;
  font-weight: 760;
}

input,
select,
textarea {
  background: #ffffff;
  border: 1px solid #cfc5ad;
  border-radius: 6px;
  color: var(--ink);
  min-height: 48px;
  outline: none;
  padding: 10px 12px;
  width: 100%;
}

input:focus,
select:focus,
textarea:focus {
  border-color: #2f6e62;
  box-shadow: 0 0 0 3px rgba(47, 110, 98, 0.16);
}

.compact {
  max-width: 260px;
}

.measurement-card {
  background: #ffffff;
  border: 1px solid #dfd4bd;
  border-radius: 8px;
  margin-bottom: 16px;
  padding: 14px;
}

.measure-calc-row {
  align-items: stretch;
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(260px, 1fr) 86px minmax(260px, 1fr);
}

.operation-field {
  align-self: center;
}

.fraction-converter-row {
  align-items: end;
  display: grid;
  gap: 14px;
  grid-template-columns: 0.9fr 1fr 1.3fr 1fr;
}

.decimal-converter-row {
  grid-template-columns: 0.9fr 1.4fr 1fr;
}

.fraction-pair {
  align-items: center;
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(58px, 1fr) auto minmax(58px, 1fr);
}

.fraction-pair span {
  color: var(--evergreen);
  font-size: 1.1rem;
  font-weight: 850;
  text-align: center;
}

.check-field {
  align-items: center;
  background: #ffffff;
  border: 1px solid #cfc5ad;
  border-radius: 6px;
  display: flex;
  gap: 8px;
  min-height: 48px;
  padding: 10px 12px;
}

.check-field input {
  min-height: auto;
  width: auto;
}

.check-field span {
  color: var(--ink);
  font-size: 0.94rem;
  font-weight: 760;
}

.measurement-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 10px;
}

.fraction-measure-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(135px, 1.25fr);
}

.two-col,
.three-col,
.four-col {
  display: grid;
  gap: 14px;
}

.two-col,
.three-col,
.four-col {
  grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr));
}

.subcalc {
  border: 1px solid #dfd4bd;
  border-radius: 8px;
  margin-bottom: 14px;
  padding: 14px;
}

.subcalc h3 {
  color: var(--evergreen);
  font-size: 1rem;
  margin: 0 0 12px;
}

.results-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 16px;
}

.inline-results {
  margin-top: 4px;
}

.combined-results {
  display: none;
}

.result-card {
  background: var(--paper-soft);
  border: 1px solid #dfd4bd;
  border-radius: 8px;
  min-height: 92px;
  padding: 14px;
}

.result-card strong {
  color: #58655f;
  display: block;
  font-size: 0.82rem;
  margin-bottom: 8px;
}

.result-card span {
  color: #162520;
  display: block;
  font-size: 1.45rem;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.estimate-note {
  background: #fff8df;
  border: 1px solid #e6d191;
  border-radius: 8px;
  color: #4f4525;
  line-height: 1.45;
  margin: 0 0 18px;
  padding: 12px 14px;
}

.paint-surfaces {
  display: grid;
  gap: 12px;
  margin-top: 6px;
}

.paint-row {
  background: #ffffff;
  border: 1px solid #dfd4bd;
  border-radius: 8px;
  padding: 14px;
}

.paint-row-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.paint-row-title {
  color: var(--evergreen);
  font-weight: 850;
}

.remove-paint-row {
  background: transparent;
  border: 1px solid #d7cfbd;
  border-radius: 6px;
  color: #5d6863;
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 780;
  min-height: 34px;
  padding: 6px 10px;
}

.paint-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(min(160px, 100%), 1fr));
}

.add-paint-row {
  align-items: center;
  background: var(--evergreen);
  border: 0;
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  display: inline-flex;
  font-weight: 850;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  width: fit-content;
}

.add-paint-row:hover {
  background: #244a44;
}

.openings-block {
  border-top: 1px solid #eee5d5;
  margin-top: 4px;
  padding-top: 14px;
}

.standard-openings {
  background: #fffdf7;
  border: 1px solid #eee5d5;
  border-radius: 8px;
  margin-bottom: 14px;
  padding: 12px;
}

.opening-quick-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(90px, 0.35fr) minmax(260px, 1fr);
  margin-top: 10px;
}

.custom-openings-head {
  margin-top: 8px;
}

.calculator-request {
  align-items: start;
  background: rgba(255, 253, 247, 0.96);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 16px 38px rgba(24, 36, 33, 0.1);
  display: grid;
  gap: 20px;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  margin: 18px auto 0;
  max-width: 1180px;
  padding: 20px;
}

.calculator-request p {
  color: var(--muted);
  line-height: 1.5;
  margin: 0;
}

.calculator-request form {
  display: grid;
  gap: 12px;
}

.calculator-request button {
  background: var(--evergreen);
  border: 0;
  border-radius: 6px;
  color: #fffdf7;
  cursor: pointer;
  font-weight: 850;
  min-height: 42px;
  padding: 10px 14px;
  width: fit-content;
}

.request-status {
  font-size: 0.92rem;
  font-weight: 760;
}

.hidden-field {
  display: none;
}

.opening-row {
  border: 1px solid #eadfcb;
  border-radius: 8px;
  margin-top: 10px;
  padding: 12px;
}

.muted-note {
  color: #65726c;
  margin: 0;
}

.error {
  background: #fff0ed;
  border-color: #e5a193;
  color: #832616;
  grid-column: 1 / -1;
}

.result-actions {
  align-items: flex-start;
  border-top: 1px solid #e4d9c4;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
  padding-top: 16px;
}

.result-actions button {
  background: var(--evergreen);
  border: 0;
  border-radius: 6px;
  color: #ffffff;
  cursor: pointer;
  font-weight: 820;
  min-height: 40px;
  padding: 8px 12px;
}

.result-actions button:hover {
  background: #244a44;
}

.result-actions input {
  max-width: 270px;
}

.email-action {
  align-items: center;
  display: flex;
  gap: 10px;
  max-width: 580px;
  width: 100%;
}

.email-action input {
  flex: 1 1 230px;
  max-width: none;
}

.email-action button {
  flex: 0 0 auto;
}

.history {
  border-top: 1px solid #e4d9c4;
  margin-top: 28px;
  padding-top: 18px;
}

.history-item {
  align-items: center;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #eee5d5;
  color: #25342f;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  min-height: 44px;
  padding: 8px 0;
  text-align: left;
  width: 100%;
}

.history-item span:last-child {
  color: #65726c;
}

.sponsor-footer {
  align-items: center;
  background: var(--evergreen);
  border-radius: 8px;
  box-shadow: 0 16px 38px rgba(24, 36, 33, 0.14);
  color: #f7f4ea;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin: 18px auto 0;
  max-width: 1180px;
  padding: 20px;
}

.sponsor-footer > div {
  flex: 1;
}

.sponsor-footer img {
  background: #ffffff;
  height: 160px;
  width: 160px;
}

.sponsor-footer h2 {
  color: #ffffff;
  margin-bottom: 8px;
}

.sponsor-footer p {
  color: #dbe5df;
  margin: 0;
  max-width: 720px;
}

.sponsor-footer .eyebrow {
  color: var(--gold);
}

.sponsor-footer > a {
  background: var(--gold);
  border-radius: 6px;
  color: #14231f;
  font-weight: 850;
  padding: 10px 12px;
  text-decoration: none;
  white-space: nowrap;
}

.sponsor-footer .sponsor-contact a,
.sponsor-footer .sponsor-contact span {
  color: #edf7f2;
}

.site-footer {
  align-items: center;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
  margin: 20px auto 0;
  max-width: 1180px;
  text-align: center;
}

.site-footer nav {
  display: flex;
  gap: 14px;
  justify-content: center;
}

.site-footer a {
  color: var(--evergreen);
  font-weight: 760;
}

@media (max-width: 760px) {
  .app-shell {
    padding: 14px;
  }

  .brand-hero {
    background:
      linear-gradient(180deg, rgba(255, 253, 247, 0.99) 0%, rgba(255, 253, 247, 0.94) 58%, rgba(255, 253, 247, 0.42) 100%),
      url("./assets/calculator-caddy-hero.png") center right / cover no-repeat;
    min-height: 520px;
    place-items: start;
  }

  .brand-script {
    font-size: clamp(3rem, 15vw, 5.45rem);
    margin-left: -2px;
    transform: rotate(-2deg);
  }

  .sponsor-strip,
  .sponsor-footer,
  .tool-shelf,
  .calculator-request {
    align-items: flex-start;
    grid-template-columns: 1fr;
  }

  .sponsor-strip,
  .sponsor-footer {
    flex-direction: column;
  }

  .sponsor-strip img,
  .sponsor-footer img {
    height: min(72vw, 220px);
    width: min(72vw, 220px);
  }

  .tool-links {
    justify-content: flex-start;
  }

  .affiliate-disclosure {
    text-align: left;
  }

  .app-downloads {
    justify-content: flex-start;
  }

  .app-downloads span {
    text-align: left;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .side-nav {
    flex-direction: row;
    overflow-x: auto;
  }

  .nav-button {
    flex: 0 0 auto;
    text-align: center;
  }

  .panel {
    padding: 18px;
  }

  .two-col,
  .three-col,
  .four-col,
  .paint-grid,
  .measure-calc-row,
  .fraction-converter-row,
  .decimal-converter-row,
  .results-grid {
    grid-template-columns: 1fr;
  }

  .email-action {
    min-width: 100%;
  }
}

@media (max-width: 520px) {
  .measurement-grid,
  .fraction-measure-grid {
    grid-template-columns: 1fr;
  }

  .opening-quick-grid {
    grid-template-columns: 1fr;
  }
}
