/* Shared layout for the interactive tools. Loaded after styles.css, so it inherits every
   custom property and only adds what a calculator needs. */

.tool-wrap { max-width: var(--container); margin: 0 auto; padding: 0 clamp(1.2rem, 4vw, 3rem); }

.tool-grid {
  display: grid;
  grid-template-columns: minmax(0, 340px) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  align-items: start;
}
@media (max-width: 900px) { .tool-grid { grid-template-columns: 1fr; } }

/* ---- inputs ---- */
.tool-inputs {
  position: sticky; top: 92px;
  background: var(--navy-mid);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1.6rem 1.5rem;
}
@media (max-width: 900px) { .tool-inputs { position: static; } }

.tool-inputs fieldset { border: 0; margin: 0 0 1.4rem; padding: 0; }
.tool-inputs legend {
  font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.16em;
  color: var(--gold); margin-bottom: 0.9rem; padding: 0;
}
.field { margin-bottom: 0.95rem; }
.field label {
  display: block; font-size: 0.78rem; color: var(--silver-dim);
  margin-bottom: 0.32rem; letter-spacing: 0.01em;
}
.field input, .field select {
  width: 100%; padding: 0.6rem 0.7rem;
  background: var(--navy-deep); color: var(--silver-bright);
  border: 1px solid var(--line); border-radius: 4px;
  font-family: inherit; font-size: 0.92rem;
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--gold-deep);
  box-shadow: 0 0 0 3px rgba(184,152,106,0.12);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; }
.field-hint { font-size: 0.7rem; color: var(--silver-ghost); margin-top: 0.28rem; line-height: 1.45; }

.field-range { display: flex; align-items: center; gap: 0.8rem; }
.field-range input[type=range] { flex: 1; accent-color: var(--gold); }
.field-range output {
  font-variant-numeric: tabular-nums; font-size: 0.85rem;
  color: var(--silver-bright); min-width: 4.5rem; text-align: right;
}

/* ---- headline ---- */
.tool-headline {
  background: linear-gradient(135deg, var(--navy-mid), var(--navy-soft));
  border: 1px solid var(--line-strong);
  border-radius: 6px; padding: clamp(1.6rem, 4vw, 2.6rem);
  margin-bottom: 1.4rem;
}
.tool-headline .eyebrow {
  font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.18em;
  color: var(--gold); margin: 0 0 0.7rem;
}
.tool-headline .figure {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: clamp(2.6rem, 8vw, 4.4rem); line-height: 1;
  color: var(--silver-bright); font-weight: 500;
  font-variant-numeric: tabular-nums; margin: 0 0 0.6rem;
}
.tool-headline .figure.is-negative { color: #d98b8b; }
.tool-headline .caption { font-size: 0.95rem; color: var(--silver); margin: 0; line-height: 1.6; max-width: 44rem; }
.tool-headline .subcaption { font-size: 0.8rem; color: var(--silver-ghost); margin: 0.8rem 0 0; line-height: 1.6; }

/* ---- stat strip ---- */
.tool-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px; background: var(--line); border: 1px solid var(--line);
  border-radius: 6px; overflow: hidden; margin-bottom: 1.4rem;
}
.tool-stat { background: var(--navy-mid); padding: 1.1rem 1.2rem; }
.tool-stat dt {
  font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.13em;
  color: var(--silver-ghost); margin-bottom: 0.4rem;
}
.tool-stat dd {
  margin: 0; font-size: 1.32rem; color: var(--silver-bright);
  font-variant-numeric: tabular-nums;
}
.tool-stat .stat-note { font-size: 0.7rem; color: var(--silver-ghost); margin-top: 0.3rem; line-height: 1.4; }

/* ---- the cliff callout ---- */
.cliff-note {
  border: 1px solid rgba(217,139,139,0.35);
  background: rgba(217,139,139,0.06);
  border-left: 2px solid #d98b8b;
  border-radius: 4px; padding: 1.1rem 1.3rem; margin-bottom: 1.4rem;
}
.cliff-note h3 {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.14em;
  color: #d98b8b; margin: 0 0 0.5rem; font-weight: 500;
}
.cliff-note p { margin: 0; font-size: 0.87rem; line-height: 1.65; color: var(--silver); }
.cliff-note strong { color: var(--silver-bright); }

/* ---- chart ---- */
.tool-chart { background: var(--navy-mid); border: 1px solid var(--line); border-radius: 6px; padding: 1.4rem; margin-bottom: 1.4rem; }
.tool-chart h3 { font-size: 0.95rem; color: var(--silver-bright); margin: 0 0 0.3rem; font-weight: 500; }
.tool-chart .chart-sub { font-size: 0.78rem; color: var(--silver-ghost); margin: 0 0 1.1rem; line-height: 1.55; }
.tool-chart svg { width: 100%; height: auto; display: block; overflow: visible; }

/* ---- year table ---- */
.tool-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; margin-bottom: 1.4rem; }
table.tool-table { width: 100%; border-collapse: collapse; font-size: 0.78rem; font-variant-numeric: tabular-nums; }
table.tool-table th, table.tool-table td { padding: 0.5rem 0.7rem; text-align: right; white-space: nowrap; }
table.tool-table th {
  background: var(--navy-soft); color: var(--silver-dim);
  font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 500;
  position: sticky; top: 0;
}
table.tool-table td { border-top: 1px solid var(--line-soft); color: var(--silver); }
table.tool-table th:first-child, table.tool-table td:first-child { text-align: left; }
table.tool-table tbody tr:nth-child(even) td { background: rgba(255,255,255,0.012); }
table.tool-table tr.is-cliff td { background: rgba(217,139,139,0.08); }
table.tool-table .tier-badge {
  display: inline-block; min-width: 1.35rem; padding: 0.05rem 0.3rem;
  border-radius: 3px; font-size: 0.68rem; text-align: center;
  background: var(--navy-fog); color: var(--silver-dim);
}
table.tool-table .tier-badge.t1, table.tool-table .tier-badge.t2 { background: rgba(184,152,106,0.22); color: var(--gold-bright); }
table.tool-table .tier-badge.t3, table.tool-table .tier-badge.t4, table.tool-table .tier-badge.t5 { background: rgba(217,139,139,0.22); color: #e0a5a5; }

/* ---- gate ---- */
.tool-gate {
  background: var(--navy-mid); border: 1px solid var(--line-strong);
  border-radius: 6px; padding: clamp(1.4rem, 3vw, 2.2rem); margin-bottom: 1.4rem;
}
.tool-gate h3 { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 1.55rem; font-weight: 500; color: var(--silver-bright); margin: 0 0 0.5rem; }
.tool-gate p { font-size: 0.88rem; color: var(--silver-dim); line-height: 1.65; margin: 0 0 1.2rem; max-width: 40rem; }
.gate-form { display: grid; grid-template-columns: 1fr 1fr; gap: 0.7rem; max-width: 34rem; }
.gate-form .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .gate-form { grid-template-columns: 1fr; } }
.gate-form input {
  width: 100%; padding: 0.7rem 0.8rem;
  background: var(--navy-deep); color: var(--silver-bright);
  border: 1px solid var(--line); border-radius: 4px; font-family: inherit; font-size: 0.92rem;
}
.gate-form input:focus { outline: none; border-color: var(--gold-deep); box-shadow: 0 0 0 3px rgba(184,152,106,0.12); }
.gate-form button {
  padding: 0.75rem 1.6rem; background: var(--gold); color: var(--navy-deep);
  border: 0; border-radius: 4px; font-family: inherit; font-size: 0.88rem;
  font-weight: 500; letter-spacing: 0.03em; cursor: pointer;
  transition: background 0.2s var(--ease);
}
.gate-form button:hover { background: var(--gold-bright); }
.gate-form button[disabled] { opacity: 0.5; cursor: default; }
.gate-consent { grid-column: 1 / -1; display: flex; gap: 0.6rem; align-items: flex-start; }
.gate-consent input { width: auto; margin-top: 0.18rem; flex: none; }
.gate-consent label { font-size: 0.76rem; color: var(--silver-ghost); line-height: 1.55; }
.gate-msg { grid-column: 1 / -1; font-size: 0.83rem; line-height: 1.6; margin: 0.3rem 0 0; }
.gate-msg.err { color: #d98b8b; }
.gate-msg.ok { color: var(--gold-bright); }
/* Honeypot: reachable to automation, invisible and unfocusable for people. */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.gate-done { display: none; }
.tool-gate.is-done .gate-form, .tool-gate.is-done > p, .tool-gate.is-done > h3 { display: none; }
.tool-gate.is-done .gate-done { display: block; }
.gate-done h3 { font-family: 'Cormorant Garamond', Georgia, serif; font-size: 1.55rem; font-weight: 500; color: var(--silver-bright); margin: 0 0 0.5rem; }
.gate-done p { font-size: 0.88rem; color: var(--silver-dim); line-height: 1.65; margin: 0 0 1.1rem; }
.gate-done .book-cta {
  display: inline-block; padding: 0.75rem 1.6rem; background: var(--gold);
  color: var(--navy-deep); border-radius: 4px; text-decoration: none;
  font-size: 0.88rem; font-weight: 500; letter-spacing: 0.03em;
}
.gate-done .book-cta:hover { background: var(--gold-bright); }

.locked { position: relative; }
.locked::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(to bottom, transparent, var(--navy) 78%);
  pointer-events: none;
}
.locked.is-unlocked::after { display: none; }
