/* ═══════════════════════════════════════════════════════════════
   CalcHub UK — calculator styling
   Everything is scoped under .chuk so it cannot leak into the theme,
   and the properties themes most often override are set explicitly.
   ═══════════════════════════════════════════════════════════════ */

.chuk {
  --chuk-ink: #14281f;
  --chuk-ink-2: #1d382b;
  --chuk-accent: #f97316;
  --chuk-accent-soft: #fdba74;
  --chuk-paper: #f9faf8;
  --chuk-rule: #dfe4e0;
  --chuk-rule-2: #eef1ea;
  --chuk-muted: #5b6b63;
  --chuk-muted-2: #98a29d;

  display: block;
  margin: 2rem 0;
  font-size: 16px;
  line-height: 1.55;
  color: var(--chuk-ink);
  -webkit-text-size-adjust: 100%;
}

.chuk *,
.chuk *::before,
.chuk *::after { box-sizing: border-box; }

/* ─── Heading ─── */
.chuk-head { margin-bottom: 1.25rem; }

.chuk-title {
  margin: 0 0 .4rem;
  font-size: 1.45rem;
  line-height: 1.25;
  font-weight: 700;
  color: var(--chuk-ink);
}

.chuk-desc {
  margin: 0;
  font-size: .95rem;
  color: var(--chuk-muted);
}

/* ─── Layout ─── */
.chuk-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1.1rem;
  align-items: start;
}

@media (max-width: 720px) {
  .chuk-grid { grid-template-columns: 1fr; }
}

/* ─── Form ─── */
.chuk-form {
  margin: 0;
  padding: 1.15rem 1.25rem;
  background: var(--chuk-paper);
  border: 1px solid var(--chuk-rule);
  border-radius: 12px;
}

.chuk-field { margin-bottom: .85rem; }
.chuk-field:last-child { margin-bottom: 0; }

.chuk-label {
  display: block;
  margin-bottom: .3rem;
  font-size: .82rem;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--chuk-ink);
}

.chuk-input,
.chuk-select {
  display: block;
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: .6rem .7rem;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--chuk-ink);
  background: #fff;
  border: 1px solid var(--chuk-rule);
  border-radius: 7px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color .14s, box-shadow .14s;
}

.chuk-select {
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235b6b63' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .7rem center;
  padding-right: 2rem;
  cursor: pointer;
}

.chuk-input:focus,
.chuk-select:focus {
  border-color: var(--chuk-accent);
  box-shadow: 0 0 0 3px rgba(249, 115, 22, .14);
}

/* ─── Results ─── */
.chuk-results {
  padding: 1.15rem 1.25rem;
  background: var(--chuk-ink);
  border-radius: 12px;
  color: #fff;
  min-height: 7rem;
}

.chuk-result {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
  padding: .45rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, .09);
}

.chuk-result:last-child { border-bottom: none; }

.chuk-result-label {
  font-size: .88rem;
  color: rgba(242, 250, 245, .72);
}

.chuk-result-value {
  font-size: .98rem;
  font-weight: 600;
  color: #fff;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* The headline figure */
.chuk-result.chuk-primary {
  display: block;
  margin: -.15rem 0 .6rem;
  padding: .75rem .9rem;
  background: rgba(253, 186, 116, .12);
  border: 1px solid rgba(253, 186, 116, .3);
  border-radius: 9px;
}

.chuk-primary .chuk-result-label {
  display: block;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--chuk-accent-soft);
  margin-bottom: .15rem;
}

.chuk-primary .chuk-result-value {
  display: block;
  font-size: 1.85rem;
  line-height: 1.15;
  text-align: left;
  white-space: normal;
}

/* Section headings inside the results */
.chuk-group {
  margin: .9rem 0 .3rem;
  padding-top: .7rem;
  border-top: 1px solid rgba(255, 255, 255, .14);
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: rgba(242, 250, 245, .45);
}

.chuk-group:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

/* ─── Messages ─── */
.chuk-hint {
  margin: 0;
  font-size: .9rem;
  color: rgba(242, 250, 245, .5);
}

.chuk-error {
  margin: 0;
  padding: .7rem .85rem;
  font-size: .9rem;
  color: #ff6b6b;
  background: rgba(190, 40, 30, .14);
  border-radius: 7px;
}

.chuk-note {
  margin: .85rem 0 0;
  font-size: .78rem;
  line-height: 1.5;
  color: var(--chuk-muted-2);
}

/* ─── Index shortcode ─── */
.chuk-index-head {
  display: flex;
  align-items: baseline;
  gap: .6rem;
  margin: 2rem 0 .2rem;
  padding-bottom: .45rem;
  border-bottom: 2px solid #dfe4e0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -.01em;
  color: #14281f;
}
.chuk-index-head:first-child { margin-top: 0; }

.chuk-index-count {
  font-size: .78rem;
  font-weight: 600;
  color: #5a675f;
  font-variant-numeric: tabular-nums;
}

.chuk-index-soon {
  display: block;
  padding: .7rem .85rem;
  font-size: .92rem;
  font-weight: 500;
  color: #8d9a93;
  background: #f9faf8;
  border: 1px dashed #dfe4e0;
  border-radius: 9px;
}

.chuk-index {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: .55rem;
  margin: 1.5rem 0;
  padding: 0;
  list-style: none;
}

.chuk-index li { margin: 0; }

.chuk-index a {
  display: block;
  padding: .7rem .85rem;
  font-size: .92rem;
  font-weight: 600;
  text-decoration: none;
  color: #14281f;
  background: #fff;
  border: 1px solid #dfe4e0;
  border-radius: 9px;
  transition: border-color .14s, transform .1s;
}

.chuk-index a:hover {
  border-color: #f97316;
  color: #f97316;
  transform: translateY(-1px);
}

/* ─── Reduced motion ─── */
@media (prefers-reduced-motion: reduce) {
  .chuk-input,
  .chuk-select,
  .chuk-index a { transition: none; }
  .chuk-index a:hover { transform: none; }
}

/* ─── Custom interfaces ───
   The seven calculators that draw themselves reuse the form and results
   furniture above; these are the few extra controls they need. */

.chuk-custom { display: block; }

.chuk-btn {
  appearance: none;
  display: block;
  width: 100%;
  margin-top: 1rem;
  padding: .7rem 1rem;
  font-family: inherit;
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.3;
  color: #fff;
  background: var(--chuk-accent);
  border: 1px solid var(--chuk-accent);
  border-radius: 8px;
  cursor: pointer;
  transition: background .14s, border-color .14s;
}

.chuk-btn:hover { background: #ea670c; border-color: #ea670c; }
.chuk-btn:active { background: #d85f0a; }

.chuk-btn:focus-visible {
  outline: 3px solid var(--chuk-ink);
  outline-offset: 2px;
}

/* Native colour well, sized to match the text inputs beside it. */
.chuk-colour {
  width: 100%;
  height: 2.75rem;
  padding: .25rem;
  background: #fff;
  border: 1px solid var(--chuk-rule);
  border-radius: 7px;
  cursor: pointer;
}
.chuk-colour::-webkit-color-swatch-wrapper { padding: 0; }
.chuk-colour::-webkit-color-swatch { border: none; border-radius: 4px; }
.chuk-colour::-moz-color-swatch { border: none; border-radius: 4px; }

/* The live preview under the colour fields. */
.chuk-swatch {
  height: 4.5rem;
  margin-top: .9rem;
  border: 1px solid var(--chuk-rule);
  border-radius: 8px;
  background: var(--chuk-accent);
}

@media (prefers-reduced-motion: reduce) {
  .chuk-btn { transition: none; }
}
