/* The gold calculator (gold-calculator.html): one card, three tabs, big
   numerals. Built on pages.css's tokens. */

.calc-stage { position: relative; isolation: isolate; padding-block: clamp(24px, 5vw, 56px) clamp(40px, 7vw, 80px); }
.calc-stage::before {
  content: ""; position: absolute; z-index: -1; inset: 0 0 25% 0;
  background:
    radial-gradient(55% 70% at 15% 15%, rgb(252 215 116 / 0.28), transparent 70%),
    radial-gradient(55% 70% at 90% 20%, rgb(154 132 248 / 0.22), transparent 70%),
    linear-gradient(180deg, #fbf8ff 0%, rgb(250 250 250 / 0) 100%);
}
.calc-intro { max-width: 760px; margin-inline: auto; text-align: center; display: grid; justify-items: center; gap: 4px; }
.calc-intro h1 { margin-top: 14px; font-size: clamp(1.8rem, 1.1rem + 2.6vw, 2.8rem); font-weight: 800; line-height: 1.45; }
.calc-intro h1 em { font-style: normal; color: var(--primary-ink); }
.calc-intro .answer { margin-inline: auto; }

.calc {
  max-width: 880px; margin: clamp(24px, 4vw, 40px) auto 0;
  background: var(--surface); border: 1px solid var(--primary-100); border-radius: 32px;
  box-shadow: 0 1px 0 #fff inset, 0 40px 80px -40px rgb(74 51 196 / 0.4);
  padding: clamp(14px, 3vw, 28px);
}

/* the tabs: a segmented control */
.calc-tabs {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px;
  padding: 5px; border-radius: 20px; background: var(--soft); border: 1px solid var(--stroke);
}
.calc-tabs button {
  font: inherit; font-weight: 800; font-size: clamp(0.85rem, 0.8rem + 0.3vw, 1rem);
  border: 0; border-radius: 15px; padding: 10px 6px; background: transparent; color: var(--ink-2); cursor: pointer;
  display: grid; justify-items: center; gap: 2px; line-height: 1.5;
}
.calc-tabs button small { font-weight: 400; font-size: 0.75rem; color: var(--ink-3); }
.calc-tabs button[aria-selected="true"] {
  background: #fff; color: var(--primary-ink);
  box-shadow: 0 1px 2px rgb(23 23 23 / 0.06), 0 10px 24px -14px rgb(74 51 196 / 0.45);
}
/* without the script every panel shows, one under another */
.calc:not(.is-live) .calc-tabs { display: none; }
.calc-panel { padding-top: clamp(18px, 3vw, 26px); display: grid; gap: 18px; }
.calc-panel[hidden] { display: none; }
.calc-panel + .calc-panel { border-top: 1px dashed var(--stroke-2); margin-top: 18px; }
.calc.is-live .calc-panel + .calc-panel { border-top: 0; margin-top: 0; }

/* fields */
.c-row { display: grid; gap: 12px; align-items: end; }
@media (min-width: 640px) { .c-row.two { grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); } .c-row.pair { grid-template-columns: 1fr 1fr; } }
.c-field { display: grid; gap: 6px; min-width: 0; }
.c-field label { font-weight: 800; font-size: 0.95rem; }
.c-field label small { font-weight: 400; color: var(--ink-3); }
.c-input { position: relative; }
.c-input input {
  width: 100%; height: 64px; padding: 0 18px 0 74px; border-radius: 18px;
  border: 1.5px solid var(--stroke-2); background: #fcfcfd; color: var(--ink);
  font-family: "DanaFaNum", "Koochak", sans-serif; font-size: 1.45rem; font-weight: 700;
  direction: ltr; text-align: right; outline: none;
  transition: border-color 200ms, box-shadow 200ms, background-color 200ms;
}
.c-input input::placeholder { color: #b5bac4; font-weight: 600; }
.c-input input:focus { border-color: var(--primary); background: #fff; box-shadow: 0 0 0 4px rgb(127 99 245 / 0.16); }
.c-input .unit {
  position: absolute; inset-block: 10px; left: 10px; display: grid; place-items: center;
  padding: 0 12px; border-radius: 12px; background: var(--primary-50); color: var(--primary-ink);
  font-weight: 800; font-size: 0.9rem; pointer-events: none;
}
.c-echo { min-height: 1.5em; font-size: 0.85rem; color: var(--ink-3); }

.swap {
  justify-self: center; width: 44px; height: 44px; border-radius: 14px; margin-bottom: 10px;
  display: grid; place-items: center; background: linear-gradient(226.94deg, #9a84f8, var(--primary-deep)); color: #fff;
  box-shadow: 0 10px 20px -10px rgb(97 71 227 / 0.8);
}
.swap svg { width: 20px; height: 20px; }
@media (max-width: 639px) { .swap { transform: rotate(90deg); margin: 0; } }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button {
  font: inherit; font-size: 0.85rem; font-weight: 700; cursor: pointer;
  padding: 6px 12px; border-radius: 999px; border: 1px solid var(--stroke-2); background: #fff; color: var(--ink-2);
}
.chips button:hover { border-color: #c9bdfb; color: var(--primary-ink); }
.chips button[aria-pressed="true"] { background: var(--primary-50); border-color: #c9bdfb; color: var(--primary-deep); }
.chips .lbl { align-self: center; font-size: 0.8rem; color: var(--ink-3); }

/* results */
.result {
  border-radius: 22px; padding: 18px 20px; display: grid; gap: 4px;
  background: linear-gradient(150deg, #f5f2ff, #fff 60%); border: 1px solid var(--primary-100);
}
.result.gold { background: linear-gradient(150deg, #fff6dc, #fff 60%); border-color: #f6e3ad; }
.result .k { font-size: 0.85rem; font-weight: 700; color: var(--ink-3); display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.result .v { font-family: "DanaFaNum", "Koochak", sans-serif; font-weight: 900; font-size: clamp(1.5rem, 1.1rem + 1.6vw, 2.2rem); line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; }
.result .n { font-size: 0.85rem; color: var(--ink-2); }
.results { display: grid; gap: 12px; }
@media (min-width: 640px) { .results.two { grid-template-columns: 1fr 1fr; } }
.copy-btn {
  font: inherit; font-size: 0.78rem; font-weight: 700; cursor: pointer; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--stroke-2); background: #fff; color: var(--ink-2);
}
.calc:not(.is-live) .copy-btn, .calc:not(.is-live) .chips button, .calc:not(.is-live) .swap { display: none; }
.calc-foot { margin-top: 18px; text-align: center; font-size: 0.82rem; color: var(--ink-3); }
