/* VELORA GEM AND JEWELRY: Buying Calculator page.
   Mobile-first. Two themes (light default, dark "purple desk") share one set of rules through variables.
   Hooks owned by calculator-engine.js, never restyled with display rules that could beat them:
     .hidden  .roughOnly  .cutOnly  .active  and the class list of #decision (decision buy|negotiate|walk).
   Breakpoints: 480, 768, 1024 (min-width). Nothing is forced with important flags. */

body.page-calculator {
  --cx-bg: #FAF8FF;
  --cx-surface: #FFFFFF;
  --cx-surface-2: #F6F2FF;
  --cx-field: #FFFFFF;
  --cx-ink: #1B1030;
  --cx-muted: #5F5878;
  --cx-line: #E1D9F5;
  --cx-accent: #5B21B6;
  --cx-focus: #7C3AED;
  --cx-title-a: #3B0A7A;
  --cx-title-b: #7C3AED;
  --cx-shadow: 0 8px 28px rgba(91, 33, 182, .09);
  --cx-buy-bg: #E6F4EC;  --cx-buy-line: #1F7A55;  --cx-buy-ink: #0F4D33;
  --cx-neg-bg: #FFF3D6;  --cx-neg-line: #A86A00;  --cx-neg-ink: #6B4300;
  --cx-walk-bg: #FCE8E6; --cx-walk-line: #B3261E; --cx-walk-ink: #7A1912;
  --cx-gutter: var(--tgs-gutter, clamp(1rem, 4vw, 2rem));
  --cx-tap: 2.75rem;
  --cx-ease: cubic-bezier(.22, 1, .36, 1);
  --cx-head: var(--tgs-font-head, 'Cormorant Garamond', Georgia, serif);
  --cx-body: var(--tgs-font-body, 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
  margin: 0;
  background: var(--cx-bg);
  color: var(--cx-ink);
  font-family: var(--cx-body);
  font-size: 1rem;
  line-height: 1.55;
}
body.page-calculator:not(.light) {
  --cx-bg: #150A2E;
  --cx-surface: #211045;
  --cx-surface-2: #2A1559;
  --cx-field: #170B33;
  --cx-ink: #F4F0FF;
  --cx-muted: #BFB4E2;
  --cx-line: rgba(221, 214, 254, .2);
  --cx-accent: #CDB6FF;
  --cx-focus: #C4A5FF;
  --cx-title-a: #EDE9FE;
  --cx-title-b: #C084FC;
  --cx-shadow: 0 10px 34px rgba(0, 0, 0, .35);
  --cx-buy-bg: rgba(52, 211, 153, .13);  --cx-buy-line: #34D399;  --cx-buy-ink: #B6F5DB;
  --cx-neg-bg: rgba(251, 191, 36, .13);  --cx-neg-line: #FBBF24;  --cx-neg-ink: #FDE9A8;
  --cx-walk-bg: rgba(248, 113, 113, .14); --cx-walk-line: #F87171; --cx-walk-ink: #FECACA;
}
.page-calculator *, .page-calculator *::before, .page-calculator *::after { box-sizing: border-box; }
.page-calculator :focus-visible { outline: 3px solid var(--cx-focus); outline-offset: 3px; }

/* Layout. main carries the theme background itself, so the page does not depend on the body background. */
.calcPage { min-width: 0; background: var(--cx-bg); color: var(--cx-ink); }
.calcShell { width: min(calc(100% - 2 * var(--cx-gutter)), 80rem); margin-inline: auto; padding-block: 0 6.5rem; }
.calcLayout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
.calcPanel { min-width: 0; padding: clamp(1rem, 3vw, 1.5rem); border: 1px solid var(--cx-line); border-radius: 1.25rem; background: var(--cx-surface); box-shadow: var(--cx-shadow); }
.page-calculator :where(h1, h2, h3, p) { margin: 0; }
.page-calculator :where(h1, h2, h3) { font-family: var(--cx-head); font-weight: 500; line-height: 1.1; color: var(--cx-ink); text-wrap: balance; }
body.page-calculator h1, body.page-calculator h2, body.page-calculator h3 { color: var(--cx-ink); }
body.page-calculator h1 { font-size: clamp(2.25rem, 1.7rem + 2.8vw, 4.25rem); }
body.page-calculator h2 { font-size: clamp(1.6rem, 1.4rem + 1vw, 2.25rem); }
body.page-calculator h3 { font-size: clamp(1.25rem, 1.15rem + .5vw, 1.5rem); }
.page-calculator em { font-style: italic; padding-inline-end: .08em; color: var(--cx-accent); }
@supports (background-clip: text) or (-webkit-background-clip: text) {
  .page-calculator em { background: linear-gradient(90deg, var(--cx-title-a), var(--cx-title-b)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; color: transparent; }
}
.calcEyebrow { margin-bottom: .6rem; font-size: .75rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--cx-accent); }

/* Toolbar */
body.page-calculator .calcTop { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; padding-block: 1rem; border-bottom: 1px solid var(--cx-line); }
.calcBrand { font-size: .75rem; font-weight: 700; letter-spacing: .18em; color: var(--cx-accent); }
.calcSub { font-size: .9375rem; color: var(--cx-muted); }
.calcActions { display: flex; flex-wrap: wrap; gap: .5rem; }
.calcQuiet {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: var(--cx-tap); padding: .5rem 1rem;
  border: 1px solid var(--cx-line); border-radius: 12px; background: var(--cx-surface); color: var(--cx-ink);
  font: 600 .9375rem/1.2 var(--cx-body); text-decoration: none; cursor: pointer;
}
.calcThemeIcon { width: 1rem; height: 1rem; border: 2px solid currentColor; border-radius: 50%; background: currentColor; }
body.page-calculator:not(.light) .calcThemeIcon { background: linear-gradient(90deg, currentColor 50%, transparent 50%); }

/* Hero */
.calcHero { padding-block: clamp(1.75rem, 5vw, 3.5rem) clamp(1.25rem, 3vw, 2rem); }
.calcLead { max-width: 40rem; margin-top: 1rem; font-size: clamp(1rem, .96rem + .2vw, 1.125rem); color: var(--cx-muted); }

/* Inputs */
.calcMode { display: grid; grid-template-columns: 1fr 1fr; gap: .25rem; margin-bottom: 1rem; padding: .25rem; border: 1px solid var(--cx-line); border-radius: 14px; background: var(--cx-surface-2); }
.calcMode button { min-height: var(--cx-tap); border: 0; border-radius: 10px; background: transparent; color: var(--cx-muted); font: 600 1rem/1.2 var(--cx-body); cursor: pointer; }
.calcMode button.active { background: linear-gradient(135deg, #3B0A7A, #5B21B6 60%, #6D28D9); color: #fff; box-shadow: 0 6px 16px rgba(91, 33, 182, .3); }
.calcMode button.active::before { content: "\2713\00A0"; content: "\2713\00A0" / ""; }
.calcGroup { min-width: 0; margin: 0 0 1rem; padding: 1rem; border: 1px solid var(--cx-line); border-radius: 12px; }
.calcGroup legend { padding-inline: .4rem; font-size: .8125rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--cx-accent); }
.calcFields { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: .75rem; }
.calcField { min-width: 0; }
.calcField label { display: block; margin-bottom: .35rem; font-size: .875rem; font-weight: 600; color: var(--cx-ink); }
.calcField select, .calcField input {
  width: 100%; min-width: 0; min-height: 3rem; padding: .65rem .85rem; border: 1px solid var(--cx-line); border-radius: 12px;
  background-color: var(--cx-field); color: var(--cx-ink); font: inherit; font-size: 1rem; line-height: 1.3;
}
.calcField select {
  appearance: none; padding-inline-end: 2.4rem; background-repeat: no-repeat; background-position: right .85rem center; background-size: 1rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237C3AED' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
.stageChips { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .5rem; }
.stageChips button { flex: 1 0 var(--cx-tap); min-width: var(--cx-tap); min-height: var(--cx-tap); border: 1px solid var(--cx-line); border-radius: 12px; background: var(--cx-field); color: var(--cx-ink); font: 600 .9375rem/1 var(--cx-body); cursor: pointer; }
.stageChips button.active { border-color: transparent; background: #5B21B6; color: #fff; }
.calcHint { font-size: .875rem; color: var(--cx-muted); }

/* Results */
.calcPanelHead { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.calcLive { display: inline-flex; align-items: center; gap: .5rem; padding: .3rem .75rem; border: 1px solid var(--cx-line); border-radius: 999px; font-size: .8125rem; font-weight: 600; color: var(--cx-muted); }
.calcLive::before { content: ""; width: .5rem; height: .5rem; border-radius: 50%; background: var(--cx-buy-line); }
.calcMaxHero { display: grid; gap: .25rem; margin-bottom: 1rem; padding: 1.1rem 1.25rem; border-radius: 14px; background: linear-gradient(150deg, #150A2E, #2A0F5C 60%, #4C1D95); color: #fff; }
.calcMaxHero span { font-size: .8125rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: #DDD6FE; }
.calcMaxHero strong { font-family: var(--cx-head); font-size: clamp(2rem, 1.4rem + 3vw, 3.25rem); font-weight: 600; line-height: 1.05; overflow-wrap: anywhere; }
.calcMetrics { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin-bottom: 1rem; }
.calcLadder { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.calcMetric { min-width: 0; padding: .75rem; border: 1px solid var(--cx-line); border-radius: 12px; background: var(--cx-surface-2); }
.calcMetric span { display: block; font-size: .75rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--cx-muted); }
.calcMetric strong { display: block; margin-top: .2rem; font-size: clamp(1rem, .92rem + .4vw, 1.2rem); font-weight: 700; overflow-wrap: anywhere; }
.calcMetricMax { border-color: var(--cx-accent); }

/* Decision: the engine rewrites the class list of #decision, so only its three states are styled here */
.decision { display: grid; gap: .25rem; margin-bottom: 1.25rem; padding: 1rem 1.15rem; border: 1px solid var(--cx-line); border-inline-start-width: .4rem; border-radius: 12px; background: var(--cx-surface-2); }
.decisionStatus { font-size: 1.125rem; font-weight: 800; letter-spacing: .08em; }
.decisionNote { color: var(--cx-muted); }
.decision.buy { background: var(--cx-buy-bg); border-color: var(--cx-buy-line); color: var(--cx-buy-ink); }
.decision.negotiate { background: var(--cx-neg-bg); border-color: var(--cx-neg-line); color: var(--cx-neg-ink); }
.decision.walk { background: var(--cx-walk-bg); border-color: var(--cx-walk-line); color: var(--cx-walk-ink); }
.decision.buy .decisionNote, .decision.negotiate .decisionNote, .decision.walk .decisionNote { color: inherit; }
.decision.buy .decisionStatus::before, .decision.negotiate .decisionStatus::before, .decision.walk .decisionStatus::before { margin-inline-end: .5rem; }
.decision.buy .decisionStatus::before { content: "\2713"; content: "\2713" / ""; }
.decision.negotiate .decisionStatus::before { content: "\21C4"; content: "\21C4" / ""; }
.decision.walk .decisionStatus::before { content: "\2715"; content: "\2715" / ""; }

/* Negotiation */
.calcNegotiation { display: grid; gap: .9rem; padding-top: 1.25rem; border-top: 1px solid var(--cx-line); }
.ladderTrack { position: relative; height: .5rem; margin: .9rem .6rem .6rem; border-radius: 999px; background: linear-gradient(90deg, var(--cx-buy-line), var(--cx-neg-line), var(--cx-walk-line)); }
.ladderMarker { position: absolute; top: 50%; left: 0; width: 1rem; height: 1rem; border: 2px solid var(--cx-ink); background: var(--cx-surface); transform: translate(-50%, -50%); }
.ladderMarker[hidden] { display: none; }
.markerOpen { border-radius: 50%; }
.markerTarget { border-radius: 50%; background: var(--cx-ink); }
.markerCeiling { border-radius: 2px; background: var(--cx-ink); }
.markerAsk { border-radius: 2px; transform: translate(-50%, -50%) rotate(45deg); }
.markerCounter { border-radius: 2px; background: var(--cx-ink); transform: translate(-50%, -50%) rotate(45deg); }
.ladderLegend { display: flex; flex-wrap: wrap; gap: .35rem 1rem; margin: 0; padding: 0; list-style: none; font-size: .8125rem; color: var(--cx-muted); }
.ladderLegend li::before { content: ""; display: inline-block; width: .7rem; height: .7rem; margin-inline-end: .4rem; border: 2px solid var(--cx-ink); background: var(--cx-surface); }
.ladderLegend .legendOpen::before { border-radius: 50%; }
.ladderLegend .legendTarget::before { border-radius: 50%; background: var(--cx-ink); }
.ladderLegend .legendCeiling::before { border-radius: 2px; background: var(--cx-ink); }
.ladderLegend .legendAsk::before { border-radius: 2px; transform: rotate(45deg); }
.ladderLegend .legendCounter::before { border-radius: 2px; background: var(--cx-ink); transform: rotate(45deg); }
.calcScript { padding: 1rem 1.15rem; border: 1px dashed var(--cx-line); border-radius: 12px; background: var(--cx-surface-2); }
.calcScriptLabel { margin-bottom: .35rem; font-size: .75rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--cx-accent); }
.calcScriptText { font-family: var(--cx-head); font-size: 1.25rem; line-height: 1.35; }
.calcResultActions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; margin-top: 1.25rem; }
.calcPrimary { min-height: var(--cx-tap); padding: .65rem 1.4rem; border: 0; border-radius: 12px; background: linear-gradient(135deg, #3B0A7A, #5B21B6 60%, #6D28D9); color: #fff; font: 600 1rem/1.2 var(--cx-body); cursor: pointer; box-shadow: 0 10px 24px rgba(91, 33, 182, .28); }
.calcCopyStatus { font-size: .9375rem; color: var(--cx-muted); }

/* How it works */
.calcHow { margin-top: 1rem; }
.calcHow h2 { margin-bottom: .75rem; }
.calcHow details { border-top: 1px solid var(--cx-line); }
.calcHow summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: var(--cx-tap); padding-block: .5rem; font-weight: 600; cursor: pointer; list-style: none; }
.calcHow summary::-webkit-details-marker { display: none; }
.calcHow summary::after { content: "+"; font-size: 1.25rem; color: var(--cx-accent); }
.calcHow details[open] summary::after { content: "\2212"; }
.calcHow details p { padding-bottom: 1rem; color: var(--cx-muted); }

/* Closing */
.calcClosing { margin-top: 1rem; padding: clamp(1.5rem, 4vw, 3rem); border-radius: 1.75rem; background: linear-gradient(160deg, #150A2E, #2A0F5C 60%, #4C1D95); color: #fff; }
.calcClosing .calcEyebrow { color: #DDD6FE; }
.page-calculator .calcClosing h2 { color: #fff; }
.page-calculator .calcClosing em { background-image: linear-gradient(90deg, #EDE9FE, #C084FC); }
.calcClosing > p:not(.calcEyebrow) { margin-top: .75rem; color: rgba(255, 255, 255, .88); }
.calcClosingLinks { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1.25rem; }
.calcClosingLinks a { display: inline-flex; align-items: center; min-height: var(--cx-tap); padding: .5rem 1.1rem; border: 1px solid rgba(255, 255, 255, .6); border-radius: 12px; color: #fff; font-weight: 600; text-decoration: none; }
.page-calculator .calcClosing :focus-visible { outline-color: #C4A5FF; }
.calcFooter { margin-top: 1.5rem; font-size: .875rem; text-align: center; color: var(--cx-muted); }
.calcNoscript { padding: 1rem; text-align: center; color: var(--cx-muted); }

/* Sticky summary bar (phones and tablets) */
.mobileSummary {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 40; display: flex; align-items: center; justify-content: space-between; gap: 1rem; width: 100%; min-height: 3.5rem;
  padding: .6rem var(--cx-gutter) calc(.6rem + env(safe-area-inset-bottom, 0px)); border: 0; border-radius: 0; text-align: start; cursor: pointer;
  background: linear-gradient(135deg, #150A2E, #3B0A7A); color: #fff; font: inherit; box-shadow: 0 -8px 28px rgba(21, 10, 46, .35);
}
.mobileSummaryMax { display: grid; min-width: 0; }
.mobileSummaryMax small { font-size: .75rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #DDD6FE; }
.mobileSummaryMax strong { font-size: 1.125rem; overflow-wrap: anywhere; }
.mobileStatus { flex: none; padding: .35rem .8rem; border: 1px solid rgba(255, 255, 255, .6); border-radius: 999px; font-size: .8125rem; font-weight: 800; letter-spacing: .08em; }
.mobileSummary.isHidden { visibility: hidden; opacity: 0; transform: translateY(100%); }
body:has(#decision.buy) .mobileStatus::before { content: "\2713\00A0"; content: "\2713\00A0" / ""; }
body:has(#decision.negotiate) .mobileStatus::before { content: "\21C4\00A0"; content: "\21C4\00A0" / ""; }
body:has(#decision.walk) .mobileStatus::before { content: "\2715\00A0"; content: "\2715\00A0" / ""; }

/* 480 */
@media (min-width: 480px) {
  .calcMetrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* 768 */
@media (min-width: 768px) {
  .calcLadder { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* 1024: two columns, results beside the inputs, summary bar not needed */
@media (min-width: 1024px) {
  .calcShell { padding-bottom: 3rem; }
  .calcLayout { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 1.5rem; align-items: start; }
  .calcMetrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .calcLadder { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mobileSummary { display: none; }
}
@media (min-width: 1024px) and (min-height: 900px) {
  .calcResults { position: sticky; top: 6rem; }
}
@media (min-width: 1280px) {
  .calcMetrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .calcLadder { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (hover: hover) {
  .calcQuiet, .calcClosingLinks a, .calcPrimary, .calcMode button, .stageChips button { transition: transform .3s var(--cx-ease), background-color .2s, border-color .2s; }
  .calcQuiet:hover, .calcClosingLinks a:hover { border-color: var(--cx-focus); }
  .calcPrimary:hover { transform: translateY(-2px); }
  .calcMode button:not(.active):hover { color: var(--cx-ink); }
}

/* Motion: transform and opacity only, and only when the visitor has not asked for less motion */
@media (prefers-reduced-motion: no-preference) {
  @keyframes cxUpdate { from { opacity: .45; transform: translateY(3px); } to { opacity: 1; transform: none; } }
  @keyframes cxLive { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: .45; transform: scale(.7); } }
  .isUpdated { animation: cxUpdate .4s var(--cx-ease) both; }
  .calcLive::before { animation: cxLive 2.4s ease-in-out infinite; }
  .mobileSummary { transition: transform .3s var(--cx-ease), opacity .3s var(--cx-ease), visibility 0s linear 0s; }
  .mobileSummary.isHidden { transition: transform .3s var(--cx-ease), opacity .3s var(--cx-ease), visibility 0s linear .3s; }
}

/* The engine toggles .hidden on fields and groups; nothing above sets display on those elements, and this rule always wins */
body.page-calculator .hidden { display: none; }
.calcOffscreen { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
