/* =====================================================
   Metal Calculators — app.css
   Styled to match the Incorp theme (marvelmachines.com).
   Design tokens sourced from reduxfall.css (Redux output).
   ===================================================== */

.mm-calc {
  /* Theme design tokens */
  --mm-red:         #d24545;   /* primary CTA / active tab  */
  --mm-red-hover:   #2a2c44;   /* button hover / nav dark   */
  --mm-accent:      #ff6969;   /* highlight / focus ring    */
  --mm-text:        #232323;   /* body text                 */
  --mm-muted:       #48435b;   /* secondary / meta text     */
  --mm-border:      #e9eff3;   /* all borders               */
  --mm-bg-ghost:    #fbfcfd;   /* subtle section background */
  --mm-error:       #a01e41;   /* error messages            */
  --mm-font-body:   "DM Sans", sans-serif;
  --mm-font-head:   Onest, sans-serif;
  --mm-radius:      3px;
  --mm-transition:  all 0.2s ease-in;

  width: 100%;
  font-family: var(--mm-font-body);
  color: var(--mm-text);
}

/* ── Header ─────────────────────────────────────── */
.mm-calc__header {
  margin-bottom: 1.5rem;
}

.mm-calc__title {
  margin: 0 0 0.3rem;
  font-family: var(--mm-font-head);
  font-weight: 600;
  color: #222;
}

.mm-calc__subtitle {
  margin: 0;
  color: var(--mm-muted);
}

/* ── Main tab bar ────────────────────────────────── */
.mm-calc__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1rem;
}

.mm-calc__tab {
  font-family: var(--mm-font-head);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 9px 18px;
  background: var(--mm-bg-ghost);
  color: var(--mm-text);
  border: 1px solid var(--mm-border);
  border-radius: var(--mm-radius);
  cursor: pointer;
  transition: var(--mm-transition);
}

.mm-calc__tab:hover {
  background: var(--mm-red-hover);
  color: #fff;
  border-color: var(--mm-red-hover);
}

.mm-calc__tab.is-active {
  background: var(--mm-red);
  color: #fff;
  border-color: var(--mm-red);
}

/* ── Panel show / hide ───────────────────────────── */
.mm-calc__panel           { display: none; }
.mm-calc__panel.is-active { display: block; }
.mm-calc__subpanel           { display: none; }
.mm-calc__subpanel.is-active { display: block; }

/* ── Card ────────────────────────────────────────── */
.mm-calc__card {
  padding: 1.5rem;
  background: #fff;
  border: 1px solid var(--mm-border);
  border-radius: var(--mm-radius);
  box-shadow: 0 0 7px -2px rgba(0, 0, 0, 0.08);
}

.mm-calc__card > h3 {
  margin: 0 0 1rem;
  font-family: var(--mm-font-head);
  font-weight: 600;
  font-size: 20px;   /* theme uses 30px for h3 globally; 20px fits a card heading */
  color: #222;
}

/* ── Sub-tab bar (inside a card) ─────────────────── */
.mm-calc__subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1rem;
}

.mm-calc__subtab {
  font-family: var(--mm-font-head);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 7px 14px;
  background: var(--mm-bg-ghost);
  color: var(--mm-text);
  border: 1px solid var(--mm-border);
  border-radius: var(--mm-radius);
  cursor: pointer;
  transition: var(--mm-transition);
}

.mm-calc__subtab:hover {
  background: var(--mm-red-hover);
  color: #fff;
  border-color: var(--mm-red-hover);
}

.mm-calc__subtab.is-active {
  background: var(--mm-red);
  color: #fff;
  border-color: var(--mm-red);
}

/* ── Form grid ───────────────────────────────────── */
.mm-calc__grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.mm-calc__grid label {
  display: grid;
  gap: 0.3rem;
  font-family: var(--mm-font-head);
  font-size: 13px;
  font-weight: 600;
  color: var(--mm-text);
}

/* Override the theme's global `margin: 0 0 15px 0` on inputs/selects */
.mm-calc__grid input,
.mm-calc__grid select {
  width: 100%;
  margin: 0 !important;
  padding: 10px 14px;
  border: 1px solid var(--mm-border) !important;
  border-radius: var(--mm-radius);
  font-family: var(--mm-font-body);
  font-size: 16px;
  color: var(--mm-text);
  background: #fff;
  line-height: 1.4 !important;
  transition: border-color 0.2s;
}

.mm-calc__grid input:focus,
.mm-calc__grid select:focus {
  outline: none;
  border-color: var(--mm-accent) !important;
  box-shadow: 0 0 0 2px rgba(255, 105, 105, 0.15);
}

/* ── Actions row ─────────────────────────────────── */
.mm-calc__actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

/* Calculate button — mirrors `.mainbutton` from the theme */
.mm-calc__btn {
  font-family: var(--mm-font-head);
  font-weight: 600;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding: 13px 28px;
  min-width: 130px;
  text-align: center;
  background: var(--mm-red);
  color: #fff;
  border: none;
  border-radius: var(--mm-radius);
  margin: 0;           /* override theme's button margin */
  cursor: pointer;
  transition: var(--mm-transition);
}

.mm-calc__btn:hover {
  background: var(--mm-red-hover);
  color: #fff;
}

/* ── Results & helpers ───────────────────────────── */
.mm-calc__err {
  color: var(--mm-error);
  min-height: 1.2em;
  font-size: 0.9em;
}

.mm-calc__result {
  margin-top: 1rem;
  display: grid;
  gap: 0.4rem;
  padding: 1rem 1.25rem;
  background: var(--mm-bg-ghost);
  border: 1px solid var(--mm-border);
  border-radius: var(--mm-radius);
  font-size: 15px;
}

.mm-calc__note {
  margin: 0.5rem 0 0;
  color: var(--mm-muted);
  font-size: 0.9em;
}

/* ── Parameter diagrams ──────────────────────────── */
.mm-calc__diagram {
  display: block;
  max-width: 220px;
  width: 100%;
  margin: 0.75rem 0 1rem;
  overflow: visible;
}

.mm-calc__diagram text {
  font-family: var(--mm-font-body);
}

/* ── Responsive ──────────────────────────────────── */
@media (max-width: 900px) {
  .mm-calc__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .mm-calc__grid { grid-template-columns: 1fr; }
  .mm-calc__actions { flex-direction: column; align-items: stretch; }
  .mm-calc__btn { width: 100%; }
}
