/* Trade-up Calculator guide: page layout, empty state, intro, how it works (Optimize, pins, fill time and the
   Plan vs. Optimize example), glossary, FAQ, final CTA and footer.
   lp-* rules are copied from /profitable-tradeups so both pages look the same. If you move them into
   a shared stylesheet later, delete them here. cg-* and calc-* rules are for this page only. */

/* ===== Page layout: the tool stays one screen tall, the guide scrolls below it ===== */
body.calc-page {
  display: block;
  height: auto;
  min-height: 100dvh;
}
.calc-app {
  display: flex;
  gap: var(--standart-margin);
  height: 100dvh;
}
@supports (height: 100svh) {
  /* svh doesn't change when a mobile browser bar collapses, so the guide doesn't jump while scrolling */
  .calc-app { height: 100svh; overflow: hidden; }
}
/* On phones calculator.css sizes the panel to 100dvh, which grows when the browser bar collapses while
   scrolling: the panel gets taller than the app, its contents jump and the empty state slides around.
   Here it stretches to the app instead (as in the finder), so it keeps its size. */
@media (max-width: 1023px) {
  .calc-app #listings_container { height: auto; }
}
@media (prefers-reduced-motion: no-preference) {
  html { scroll-behavior: smooth; }
}

/* ===== Empty state ===== */
#no_skin_text.calc-empty {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 1;
  box-sizing: border-box;
  width: min(100%, 560px);
  padding: 0 20px;
  transform: translate(-50%, -50%);
  color: var(--text-2-color);
  text-align: center;
}
/* Phones: centered in the space below Settings and Plan/Optimize (they end 101px into the panel) instead of
   the whole panel, so the title never slides over those buttons on short screens. If the content doesn't
   fit, it scrolls inside that space. calculator.js toggles display inline, so this stays a block. */
@media (max-width: 1023px) {
  #no_skin_text.calc-empty {
    top: 113px;
    bottom: 0;
    overflow-y: auto;
    padding-bottom: 12px;
    transform: translateX(-50%);
    align-content: center;
    align-content: safe center;
  }
}
.calc-empty-title {
  margin: 0;
  color: #f2f2f2;
  font-size: clamp(24px, 1.1rem + 1.2vw, 32px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}
.calc-empty-tagline {
  margin: 10px 0 0;
  color: #c2c2c2;
  font-size: clamp(16px, 0.9rem + 0.35vw, 19px);
  font-weight: 600;
  line-height: 1.35;
}
.calc-empty-text {
  max-width: 28em;
  margin: 12px auto 0;
  font-size: 15px;
  line-height: 1.5;
}
.calc-empty-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
}
.calc-empty-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.calc-empty-btn--primary { background: #4676b5; color: #fff; }
.calc-empty-btn--primary:hover { background: #3e6aa6; }
.calc-empty-btn--ghost { border-color: #424242; background: none; color: #c2c2c2; }
.calc-empty-btn--ghost:hover { border-color: #5e5e5e; color: #f2f2f2; }
.calc-empty-hint {
  margin: 18px 0 0;
  color: rgba(163, 163, 163, 0.7);
  font-size: 13px;
  line-height: 1.5;
}
@media (hover: none) and (pointer: coarse) {
  /* no keyboard on phones and tablets: the shortcut hint is noise there */
  .calc-empty-hint { display: none; }
}
.calc-empty-hint kbd {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid #363636;
  border-radius: 5px;
  background: #212121;
  color: #c2c2c2;
  font: 12px/1.4 Inter, sans-serif;
}
.calc-empty-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--text-2-color);
  font-size: 13px;
  text-decoration: underline;
  text-decoration-color: #5c5c5c;
  text-underline-offset: 3px;
}
.calc-empty-link:hover { color: #f2f2f2; text-decoration-color: #f2f2f2; }
.calc-empty-btn:focus-visible,
.calc-empty-link:focus-visible {
  outline: 2px solid #8fb4e6;
  outline-offset: 3px;
}

/* ===== Example in the empty state: this hour's top free trade-up of the Finder =====
   calculator_guide.js fills it. Until then it keeps its space, so the centered empty state
   doesn't jump; if it can't load, it is removed. The card looks like a row of the Finder. */
.calc-example {
  max-width: 420px;
  margin: 26px auto 0;
}
.calc-example.is-loading { visibility: hidden; }
.calc-example[hidden] { display: none; }
.calc-example-label {
  margin: 0 0 10px;
  color: rgba(163, 163, 163, 0.7);
  font-size: 13px;
  line-height: 1.4;
}
.calc-example-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  box-sizing: border-box;
  width: 100%;
  min-height: 63px;
  padding: 8px 14px 8px 13px;
  overflow: hidden;   /* rounds the outer corners of the stripe, its inner edge stays straight */
  border: 1px solid #363636;
  border-radius: 8px;
  background: #212121;
  text-align: left;
  text-decoration: none;
  transition: border-color 0.15s, background-color 0.15s;
}
/* Rarity stripe, like the rows of the Finder */
.calc-example-card::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 3px;
  background: var(--rarity-color, #8847ff);
}
.calc-example-card:hover {
  border-color: #5e5e5e;
  background: #262626;
}
.calc-example-card:focus-visible {
  outline: 2px solid #8fb4e6;
  outline-offset: 3px;
}
.calc-example-img {
  flex: none;
  width: 47px;
  height: 47px;
  object-fit: contain;
}
.calc-example-main {
  display: grid;
  flex: 1;
  gap: 3px;
  min-width: 0;
}
.calc-example-name {
  overflow: hidden;
  color: #f2f2f2;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.calc-example-meta,
.calc-example-roi {
  color: rgba(163, 163, 163, 0.8);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.3;
}
.calc-example-side {
  display: grid;
  flex: none;
  gap: 3px;
  justify-items: end;
  font-variant-numeric: tabular-nums;
}
.calc-example-return {
  color: #26a69a;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

/* ===== Guide: tokens (same as /profitable-tradeups, plus the colors of the example) ===== */
:root {
  --lp-page: #212121;
  --lp-panel: #1c1c1c;
  --lp-card: #212121;
  --lp-line: #363636;
  --lp-line-strong: #424242;
  --lp-text-strong: #f2f2f2;
  --lp-text-soft: #c2c2c2;
  --lp-text: #a3a3a3;
  --lp-muted: #8a8a8a;
  --lp-blue: #387fb4;
  --lp-blue-text: #5b9bd0;
  --lp-action: #4676b5;
  --lp-action-hover: #3e6aa6;
  --lp-teal: #52a49a;
  --lp-covert: #d95752;
  --lp-data: #0081b9;
  --lp-font: "Helvetica Neue", Helvetica, Arial, sans-serif;

  /* Example skins: the two that sell a lot stay grey, the rare one is blue */
  --cg-skin-a: #b0b0b0;
  --cg-skin-b: #707070;
  --cg-skin-c: var(--lp-blue-text);
  --cg-track: #262626;      /* empty part of a bar */
  color-scheme: dark;
}

/* Base */
.lp {
  color: var(--lp-text);
  font-family: var(--lp-font);
  font-size: 17px;
  line-height: 1.6;
}
.lp *, .lp *::before, .lp *::after { box-sizing: border-box; }
.lp :where(h1, h2, h3, p, ol, ul, dl, dd, figure, figcaption) { margin: 0; padding: 0; }
.lp :where(ol, ul) { list-style: none; }
.lp :where(a) { color: inherit; }

.lp-visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.lp-wrap {
  width: 100%;
  max-width: 1240px;
  margin-inline: auto;
  padding-inline: clamp(20px, 4vw, 40px);
}
.lp-section { padding-block: clamp(72px, 9vw, 136px); }

/* Type */
.lp-h2 {
  max-width: 17em;
  color: var(--lp-text-strong);
  font-size: clamp(1.85rem, 1.2rem + 2.2vw, 3rem);
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.028em;
  text-wrap: balance;
}
.lp-h3 {
  color: var(--lp-text-strong);
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.012em;
}
.lp-lead {
  max-width: 34em;
  font-size: clamp(1.0625rem, 0.98rem + 0.4vw, 1.25rem);
  line-height: 1.55;
}

.lp-textlink {
  color: var(--lp-text-strong);
  text-decoration: underline;
  text-decoration-color: #5c5c5c;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
.lp-textlink:hover { text-decoration-color: var(--lp-text-strong); }

/* Buttons & focus */
.lp-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}
.lp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 24px;
  border: 1px solid transparent;
  border-radius: 10px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}
.lp-btn--primary { background: var(--lp-action); color: #fff; }
.lp-btn--primary:hover { background: var(--lp-action-hover); }
.lp-btn--ghost { border-color: var(--lp-line-strong); background: none; color: var(--lp-text-soft); }
.lp-btn--ghost:hover { border-color: #5e5e5e; color: var(--lp-text-strong); }

.lp a:focus-visible,
.lp button:focus-visible,
.lp summary:focus-visible {
  outline: 2px solid #8fb4e6;
  outline-offset: 3px;
}

.lp-panel {
  background: var(--lp-panel);
  border-radius: 24px;
}

/* ===== Intro ===== */
.cg-nobr { white-space: nowrap; }
.cg-intro { padding-block: clamp(64px, 8vw, 120px) clamp(24px, 3vw, 40px); }
.cg-intro-grid {
  display: grid;
  align-items: end;
  gap: 28px 72px;
}
@media (min-width: 980px) {
  .cg-intro-grid { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); }
}
.lp-tag {
  display: inline-block;
  margin-bottom: 24px;
  padding: 9px 14px;
  border-radius: 10px;
  background: var(--lp-panel);
  color: var(--lp-text-soft);
  font-size: 15px;
  line-height: 1.2;
}
.cg-display {
  max-width: 13em;
  color: var(--lp-text-strong);
  font-size: clamp(2.3rem, 1.3rem + 3.6vw, 4.4rem);
  font-weight: 700;
  line-height: 1.03;
  letter-spacing: -0.035em;
  text-wrap: balance;
}

/* ===== How it works: Optimize, pins and the fill time, next to the Plan vs. Optimize example ===== */
.cg-how .lp-lead { margin-top: 24px; }
#how-it-works,
#optimize,
#pin,
#fill-time,
#buy-orders,
#faq { scroll-margin-top: 80px; }

.cg-how-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 40px;
  margin-top: clamp(40px, 5vw, 72px);
}
.cg-feature p { max-width: 31em; margin-top: 10px; }
.cg-inline-pin {
  display: inline-block;
  width: 1.05em;
  height: 1.05em;
  vertical-align: -0.17em;
  fill: currentColor;
}
.lp-visual { align-self: start; min-width: 0; }

@media (min-width: 1000px) {
  /* Text left, example right. The last row takes up the rest of the example's height,
     so the three text blocks stay together at the top. */
  .cg-how-grid {
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    grid-template-rows: auto auto 1fr;
    grid-template-areas:
      "opt  fig"
      "pin  fig"
      "fill fig";
    gap: 44px clamp(48px, 5vw, 88px);
  }
  .cg-f-opt { grid-area: opt; }
  .cg-f-pin { grid-area: pin; }
  .cg-f-fill { grid-area: fill; }
  .cg-compare { grid-area: fig; }
}

/* Shared panel parts (same as the examples on /profitable-tradeups) */
.lp-hw-panel {
  padding: clamp(18px, 2.6vw, 28px);
  font-variant-numeric: tabular-nums;
}
.lp-hw-title {
  color: var(--lp-text-strong);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.35;
}
.lp-hw-sub {
  margin-top: 2px;
  color: var(--lp-muted);
  font-size: 14px;
  line-height: 1.4;
}
.lp-hw-foot { margin-top: 18px; color: rgba(163, 163, 163, 0.7); font-size: 12px; line-height: 1.5; }

/* ===== Example: Plan vs. Optimize, one bar per skin, each ends when its last copy is bought ===== */
.cg-cmp { container-type: inline-size; }   /* the rows adapt to the panel's width, not the window's */
.cg-cmp-head,
.cg-cmp-row,
.cg-cmp-axisrow {
  display: grid;
  grid-template-columns: 88px 92px minmax(0, 1fr) 72px;
  grid-template-areas: "name float track days";
  align-items: center;
  column-gap: 12px;
  font: 13px/18px Inter, var(--lp-font);
  font-variant-numeric: tabular-nums;
}
.cg-cmp-head { margin-top: 20px; color: var(--lp-muted); }
.cg-cmp-name { grid-area: name; overflow: hidden; white-space: nowrap; }
.cg-cmp-float { grid-area: float; white-space: nowrap; }
.cg-cmp-days { grid-area: days; text-align: right; white-space: nowrap; }

.cg-cmp-mode { margin-top: 12px; }
.cg-cmp-mode + .cg-cmp-mode {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--lp-line);
}
.cg-cmp-mode-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 12px;
}
.cg-cmp-mode-name {
  color: var(--lp-text-strong);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
}
.cg-cmp-mode-fill { color: var(--lp-muted); font-size: 13px; line-height: 1.3; }
.cg-cmp-mode-fill b {
  margin-left: 6px;
  color: var(--lp-text-strong);
  font-size: 18px;
  font-weight: 700;
}

.cg-cmp-rows { margin-top: 6px; }
.cg-cmp-row { padding: 4px 0; color: var(--lp-text); }
.cg-cmp-row .cg-cmp-name,
.cg-cmp-row .cg-cmp-days { color: var(--lp-text-soft); }
.cg-cmp-row.is-slowest .cg-cmp-days { color: var(--lp-text-strong); font-weight: 700; }   /* the skin that holds everything up */
.cg-cmp-row[data-skin="a"] { --bar: var(--cg-skin-a); }
.cg-cmp-row[data-skin="b"] { --bar: var(--cg-skin-b); }
.cg-cmp-row[data-skin="c"] { --bar: var(--cg-skin-c); }
.cg-cmp-track {
  grid-area: track;
  position: relative;
  height: 12px;
  border-radius: 3px;
  background: var(--cg-track);
}
.cg-cmp-bar {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  border-radius: 3px;
  background: var(--bar);
}
/* Dashed line: the last input arrives, so this is the fill time */
.cg-cmp-track::after {
  content: "";
  position: absolute;
  top: -7px;
  bottom: -7px;
  left: var(--cg-end, 100%);
  border-left: 1px dashed rgba(242, 242, 242, 0.55);
}

.cg-cmp-axisrow { margin-top: 6px; }
.cg-cmp-axis {
  grid-area: track;
  position: relative;
  height: 16px;
  color: var(--lp-muted);
  font-size: 11px;
  line-height: 16px;
}
.cg-cmp-axis span { position: absolute; top: 0; white-space: nowrap; transform: translateX(-50%); }
.cg-cmp-axis span:first-child { left: 0; transform: none; }
.cg-cmp-axis span:nth-child(2) { left: 33.333%; }
.cg-cmp-axis span:nth-child(3) { left: 66.667%; }
.cg-cmp-axis span:last-child { right: 0; left: auto; transform: none; }

/* Narrow panel: each bar gets its own line */
@container (max-width: 520px) {
  .cg-cmp-head,
  .cg-cmp-row {
    grid-template-columns: minmax(0, 1fr) 92px 72px;
    grid-template-areas: "name float days" "track track track";
  }
  .cg-cmp-row { row-gap: 6px; padding: 6px 0; }
  .cg-cmp-track::after { top: -3px; bottom: -3px; }
  .cg-cmp-axisrow { grid-template-columns: minmax(0, 1fr); grid-template-areas: "track"; }
}
@supports not (container-type: inline-size) {
  @media (max-width: 560px) {
    .cg-cmp-head,
    .cg-cmp-row {
      grid-template-columns: minmax(0, 1fr) 92px 72px;
      grid-template-areas: "name float days" "track track track";
    }
    .cg-cmp-row { row-gap: 6px; padding: 6px 0; }
    .cg-cmp-track::after { top: -3px; bottom: -3px; }
    .cg-cmp-axisrow { grid-template-columns: minmax(0, 1fr); grid-template-areas: "track"; }
  }
}

/* ===== Glossary ===== */
.cg-metrics .lp-lead { margin-top: 20px; }
.lp-glossary {
  display: grid;
  column-gap: 48px;
  margin-top: clamp(36px, 4vw, 56px);
}
@media (min-width: 720px) {
  .lp-glossary { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1100px) {
  .lp-glossary { grid-template-columns: repeat(3, 1fr); }
}
.lp-glossary > div {
  padding-block: 22px;
  border-top: 1px solid var(--lp-line);
}
.lp-glossary dt {
  color: var(--lp-text-strong);
  font-size: 17px;
  font-weight: 700;
}
.lp-glossary dd {
  margin-top: 6px;
  font-size: 16px;
  line-height: 1.55;
}

/* ===== FAQ ===== */
.lp-faq-grid {
  display: grid;
  gap: 32px 72px;
}
@media (min-width: 980px) {
  .lp-faq-grid { grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr); align-items: start; }
}
.lp-qa { border-top: 1px solid var(--lp-line); }
.lp-qa:last-child { border-bottom: 1px solid var(--lp-line); }
.lp-qa summary {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding-block: 22px;
  color: var(--lp-text-strong);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
  list-style: none;
  cursor: pointer;
}
.lp-qa summary::-webkit-details-marker { display: none; }
.lp-qa-icon {
  position: relative;
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 5px;
}
.lp-qa-icon::before,
.lp-qa-icon::after {
  content: "";
  position: absolute;
  top: 7px;
  left: 0;
  width: 16px;
  height: 2px;
  border-radius: 1px;
  background: var(--lp-text);
  transition: transform 0.2s;
}
.lp-qa-icon::after { transform: rotate(90deg); }
.lp-qa[open] .lp-qa-icon::after { transform: rotate(0deg); }
.lp-qa-a {
  max-width: 40em;
  padding: 0 40px 26px 0;
}
@media (max-width: 600px) {
  .lp-qa-a { padding-right: 0; }
}

/* ===== Final CTA ===== */
.lp-final { padding-top: 0; }
.lp-final-panel { padding: clamp(32px, 6vw, 80px); }
.lp-final-panel .lp-lead { margin-top: 18px; }

/* ===== Footer ===== */
.lp-footer {
  border-top: 1px solid var(--lp-line);
  background: var(--lp-panel);
}
.lp-footer-inner {
  display: grid;
  gap: 20px;
  padding-block: 40px 48px;
}
.lp-footer-links ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 26px;
}
.lp-footer-links a {
  color: var(--lp-text);
  font-size: 15px;
  text-decoration: none;
}
.lp-footer-links a:hover { color: var(--lp-text-strong); }
.lp-footer-note {
  max-width: 62em;
  color: var(--lp-muted);
  font-size: 14px;
}