/* ==========================================================================
   Calculator pages — card layout
   --------------------------------------------------------------------------
   Page outline:
     main.calc-page
       .calc-page__inner
         header.calc-page__intro      eyebrow, <h1>, lead paragraph
         nav.calc-tabs                switch between the three calculators
         form.calc                    inputs card + results card
         section.calc-card                 extra information

   Inputs card:   .field (label + control), .unit-input (box with a unit),
                  .segmented (2–5 choices as one bar), .chips (small choices),
                  .stepper (− number +), .layer (one laminate layer row)
   Results card:  .results (dark), .results__big (headline figure),
                  .order-list (container rows with "× n" badges)
   ========================================================================== */

/* --- Colours used only on these pages ------------------------------------ */

.calc-page {
  --calc-bg: #f3f3ef;          /* page background behind the cards */
  --calc-line: #e4e4de;        /* card borders */
  --calc-field: #cfcfc7;       /* input borders */
  --calc-muted: #5c5c55;       /* helper text */
  --calc-chip: #dcdcd5;        /* chip borders */
  --calc-well: #f0f0eb;        /* segmented control background */
  --calc-amber: #fcb900;       /* highlight (same as the site's callouts) */
  --calc-amber-ink: #6b5300;   /* dark amber for small text on white */
  --calc-error: #b3261e;
}


/* --- Page frame ---------------------------------------------------------- */

.calc-page {
  margin-top: 0;                 /* grey background starts right under the header */
  background: var(--calc-bg);
  font-weight: 400;
}

/* …and runs straight into the footer */
body:has(.calc-page) .site-footer {
  margin-top: 0;
}

.calc-page__inner {
  display: flex;
  flex-direction: column;
  gap: 32px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px var(--page-gutter) 72px;
}

.calc-page__intro {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 820px;
}

.calc-page__eyebrow {
  color: var(--calc-amber-ink);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.calc-page h1 {
  font-size: clamp(30px, 4vw, 44px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -1px;
}

.calc-page__lead {
  color: #4a4a45;
  font-size: clamp(16px, 1.6vw, 18px);
  line-height: 1.55;
}

/* Pills that switch between the calculators */
.calc-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;           /* room for the focus ring when scrolling */
}
.calc-tabs a {
  flex: none;
  padding: 10px 18px;
  border: 1px solid var(--calc-chip);
  border-radius: 999px;
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
}
.calc-tabs a:hover {
  border-color: #111;
}
.calc-tabs a[aria-current="page"] {
  border-color: #111;
  background: #111;
  color: #fff;
}


/* --- Cards --------------------------------------------------------------- */

.calc-card {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 32px;
  border: 1px solid var(--calc-line);
  border-radius: 20px;
  background: #fff;
}

.calc-card__title {
  font-size: 20px;
  font-weight: 700;
}

.calc-card__note {
  color: var(--calc-muted);
  font-size: 14px;
}

/* "What affects the amount" and similar side-by-side info cards */
.calc-card--info {
  flex-direction: row;
  flex-wrap: wrap;
  gap: 16px 48px;
  padding: 28px 32px;
}
.calc-card--info .calc-card__title {
  flex: 1 1 220px;
  font-size: 18px;
}
.calc-card--info .calc-card__body {
  flex: 999 1 420px;
  color: #3d3d38;
  font-size: 16px;
  line-height: 1.7;
}
.calc-card--info .calc-card__body > * + * {
  margin-top: 12px;
}
.calc-card--info ul {
  padding-left: 20px;
}
.calc-card--info li {
  margin-top: 0;
}


/* --- The form: inputs on the left, results on the right ------------------ */

.calc {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 24px;
}

.calc__inputs {
  flex: 999 1 460px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.calc__results {
  flex: 1 1 360px;
  min-width: 0;
}

/* On wide screens the results card stays in view while scrolling,
   just below the sticky site header. */
@media (min-width: 900px) {
  .calc__results {
    position: sticky;
    top: calc(var(--site-header-height, 0px) + 24px);
  }
}


/* --- Fields -------------------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.field__label {
  font-size: 15px;
  font-weight: 600;
}

.field__hint {
  color: var(--calc-muted);
  font-size: 13px;
}

/* Text box with a unit on the right, e.g. [ 40      m² ] */
.unit-input {
  position: relative;            /* anchors the error tooltip */
  display: flex;
  align-items: center;
  max-width: 280px;
  border: 1.5px solid var(--calc-field);
  border-radius: 12px;
  background: #fafaf7;
}
.unit-input:focus-within {
  border-color: #111;
}
.unit-input input {
  flex: 1;
  min-width: 0;
  padding: 14px 16px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: #111;
  font: 600 22px var(--font-body);
}
.unit-input input:focus-visible {
  outline: none;                 /* the box border shows focus instead */
}
.unit-input__unit {
  padding: 0 16px;
  color: var(--calc-muted);
  font-weight: 600;
}

/* Hide the real radio/checkbox but keep it focusable and clickable */
.segmented input,
.chips input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

/* Segmented control: one bar, the chosen option filled dark */
.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-width: 520px;
  margin: 0;
  padding: 6px;
  border: 0;
  border-radius: 14px;
  background: var(--calc-well);
}
.segmented label {
  flex: 1 1 0;
  position: relative;
}
.segmented span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  color: #3d3d38;
  font-size: 16px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.segmented span:hover {
  background: rgb(0 0 0 / 0.05);
}
.segmented input:checked + span {
  background: #111;
  color: #fff;
  font-weight: 700;
}
.segmented input:focus-visible + span,
.chips input:focus-visible + span {
  outline: 2px solid #111;
  outline-offset: 2px;
}

/* Chips: small rounded choices (weights in g/m²) */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  border: 0;
}
.chips label {
  position: relative;
}
.chips span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--calc-chip);
  border-radius: 999px;
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}
.chips span:hover {
  border-color: #111;
}
.chips input:checked + span {
  border-color: #111;
  background: #111;
  color: #fff;
}

/* − [ 2 ] + */
.stepper {
  position: relative;            /* anchors the error tooltip */
  display: flex;
  align-items: center;
  width: 132px;
  border: 1.5px solid var(--calc-field);
  border-radius: 12px;
  background: #fff;
}
.stepper:focus-within {
  border-color: #111;
}
.stepper button {
  width: 40px;
  height: 44px;
  border: 0;
  background: none;
  color: #111;
  font: 700 20px var(--font-body);
  cursor: pointer;
}
.stepper input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  color: #111;
  font: 700 18px var(--font-body);
  text-align: center;
  -moz-appearance: textfield;
}
.stepper input::-webkit-inner-spin-button,
.stepper input::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.stepper input:focus-visible {
  outline: none;
}

/* Error state and tooltip (added by calculator.js) */
.unit-input:has([aria-invalid="true"]),
.stepper:has([aria-invalid="true"]) {
  border-color: var(--calc-error);
}
.calc__error {
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 10;
  margin-top: 10px;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--calc-error);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.calc__error::before {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 14px;
  border: 6px solid transparent;
  border-bottom-color: var(--calc-error);
}
.calc__error[hidden] {
  display: none;
}

/* Tip box under the inputs */
.tip {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 18px;
  border-radius: 12px;
  background: #fff7d6;
  color: #4a3a00;
  font-size: 14px;
  line-height: 1.5;
}
.tip svg {
  flex: none;
  width: 20px;
  height: 20px;
  margin-top: 1px;
}


/* --- Laminate layer rows ------------------------------------------------- */

.layers {
  display: flex;
  flex-direction: column;
}

.layers__head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding-bottom: 12px;
}

.layer {
  display: grid;
  grid-template-columns: minmax(140px, 200px) 132px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid #ececE6;
}

.layer__name {
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
}
.layer__name small {
  display: block;
  margin-top: 2px;
  color: var(--calc-muted);
  font-size: 13px;
  font-weight: 400;
}

.layer__thickness {
  min-width: 80px;
  font-size: 17px;
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

/* Narrow screens: name on top, then plies, weights and thickness */
@media (max-width: 700px) {
  .layer {
    grid-template-columns: 132px minmax(0, 1fr);
  }
  .layer__name {
    grid-column: 1 / -1;
  }
  .layer .chips {
    grid-column: 1 / -1;
    order: 3;
  }
}

/* Yes / No switches side by side */
.toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}
.toggle {
  flex: 1 1 240px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 12px 12px 16px;
  border: 1px solid var(--calc-line);
  border-radius: 14px;
  background: #fafaf7;
}
.toggle__label {
  font-size: 17px;
  font-weight: 600;
}
.toggle .segmented {
  flex: none;
  padding: 4px;
  border-radius: 10px;
}
.toggle .segmented span {
  min-width: 56px;
  min-height: 36px;
  font-size: 14px;
  border-radius: 8px;
}


/* --- Results card (dark) ------------------------------------------------- */

.results {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 32px;
  border-radius: 20px;
  background: #111;
  color: #fff;
}

.results__title {
  color: #bdbdb5;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.results__big {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
}
.results__big output {
  color: var(--calc-amber);
  font-size: 72px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -2px;
}
.results__big span {
  font-size: 22px;
  font-weight: 600;
}

/* Three headline figures side by side (Gel Coat repairs) */
.results__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border-radius: 12px;
  background: #1d1d1b;
}
.stat output {
  color: var(--calc-amber);
  font-size: 26px;
  font-weight: 800;
  line-height: 1.1;
}
.stat span {
  color: #d6d6cf;
  font-size: 13px;
}

.results__rule {
  height: 1px;
  border: 0;
  margin: 0;
  background: #2e2e2b;
}

.results__subtitle {
  font-size: 15px;
  font-weight: 700;
}

/* Rows like "20 kg containers ........ × 1" */
.order-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.order-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: 12px 16px;
  border-radius: 12px;
  background: #1d1d1b;
  font-size: 16px;
}
.order-list__count {
  flex: none;
  min-width: 44px;
  padding: 3px 12px;
  border-radius: 999px;
  background: var(--calc-amber);
  color: #111;
  font-size: 17px;
  font-weight: 800;
  text-align: center;
}
.order-list__amount {
  font-weight: 800;
  white-space: nowrap;
}

/* Smaller variant for the repairs page's three groups */
.order-group + .order-group {
  margin-top: 16px;
}
.order-group h4 {
  margin-bottom: 8px;
  color: #d6d6cf;
  font-size: 14px;
  font-weight: 700;
}
.order-list--compact {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.order-list--compact li {
  padding: 10px 12px;
  font-size: 14px;
}
.order-list--compact .order-list__count {
  min-width: 36px;
  padding: 2px 10px;
  font-size: 15px;
}

/* Dashed note at the bottom of the results card */
.results__note {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  border: 1px dashed #4a4a44;
  border-radius: 12px;
  color: #d6d6cf;
  font-size: 14px;
  line-height: 1.5;
}
.results__note svg {
  flex: none;
  width: 20px;
  height: 20px;
}
.results__note output {
  color: #fff;
  font-weight: 700;
}


/* --- Phones -------------------------------------------------------------- */

@media (max-width: 600px) {
  .calc-page__inner {
    gap: 20px;
    padding: 28px 16px 40px;
  }
  .calc-card,
  .results {
    padding: 22px 20px;
    border-radius: 18px;
  }
  .unit-input {
    max-width: none;
  }
  .results__big output {
    font-size: 60px;
  }
  .results__stats {
    grid-template-columns: 1fr;
  }
  .order-list--compact {
    grid-template-columns: 1fr;
  }
}
