/* /cpi — Personal Inflation Calculator
   Uses the same design tokens + classes as /wfh (templates/index.html)
   for visual consistency. */

:root {
  --cream:           #faf6f1;
  --ink:             #1a1612;
  --ink-light:       #3d3630;
  --ink-muted:       #7a7068;
  --ink-faint:       #b5ada5;
  --rule:            #d9d2ca;
  --save-green:      #1d7a4e;
  --save-green-bg:   #e8f5ee;
  --cost-red:        #b8372b;
  --cost-red-bg:     #fbeae8;
  --accent-gold:     #c4941e;
  --accent-gold-bg:  #fdf6e3;
  --card-bg:         #ffffff;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { background: var(--cream); }
body {
  font-family: 'Libre Franklin', sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

/* Noise texture overlay (matches /wfh) */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
}

.container {
  max-width: 540px;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

/* --- Language toggle (matches /wfh) --- */
.lang-toggle {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0.75rem;
}
.lang-toggle-inner {
  display: flex;
  border: 1px solid var(--rule);
  border-radius: 2px;
  overflow: hidden;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}
.lang-btn {
  padding: 0.3rem 0.5rem;
  background: transparent;
  border: none;
  color: var(--ink-faint);
  cursor: pointer;
  font-family: 'Libre Franklin', sans-serif;
  font-size: 0.65rem;
  font-weight: 600;
  transition: all 0.15s;
}
.lang-btn.active {
  background: var(--ink);
  color: var(--cream);
}
.lang-btn:not(.active):hover { color: var(--ink); }

/* --- Topline rule + badge --- */
.topline {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 2.5rem;
  padding-top: 0.5rem;
}
.topline::before, .topline::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--ink);
}
.topline-badge {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-gold);
  background: var(--accent-gold-bg);
  padding: 0.3rem 0.75rem;
  border-radius: 2px;
  white-space: nowrap;
}

/* --- Header --- */
.header { text-align: center; margin-bottom: 2.5rem; }
.header h1 {
  font-family: 'DM Serif Display', serif;
  font-size: 2.25rem;
  line-height: 1.15;
  color: var(--ink);
  margin-bottom: 0.5rem;
  letter-spacing: -0.01em;
}
.header h1 em {
  font-style: italic;
  color: var(--save-green);
}
.header .subtitle {
  font-size: 0.85rem;
  color: var(--ink-muted);
  line-height: 1.5;
  margin-bottom: 0.4rem;
}
.header .source-badge {
  font-size: 0.7rem;
  color: var(--ink-faint);
  font-weight: 500;
}
.header .source-badge a { color: var(--ink-muted); text-decoration: underline; }

/* --- Form fields (mirror /wfh) --- */
.form-group { margin-bottom: 1.25rem; }
.form-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-light);
  margin-bottom: 0.4rem;
}
.form-hint {
  font-size: 0.7rem;
  color: var(--ink-faint);
  margin-top: 0.25rem;
}
.form-input {
  width: 100%;
  padding: 0.75rem 0.875rem;
  font-family: 'Libre Franklin', sans-serif;
  font-size: 1rem;
  color: var(--ink);
  background: var(--card-bg);
  border: 1.5px solid var(--rule);
  border-radius: 3px;
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
  font-variant-numeric: tabular-nums;
}
.form-input:focus { border-color: var(--ink); }
.form-input::placeholder { color: var(--ink-faint); font-weight: 400; }
.form-input[type=number]::-webkit-outer-spin-button,
.form-input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.form-input[type=number] { -moz-appearance: textfield; }
select.form-input {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%237a7068' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.875rem center;
  padding-right: 2.5rem;
}

/* --- CTA --- */
.btn-primary {
  display: block;
  width: 100%;
  padding: 1rem;
  font-family: 'DM Serif Display', serif;
  font-size: 1.15rem;
  color: var(--cream);
  background: var(--ink);
  border: none;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.15s;
  letter-spacing: 0.01em;
  margin-top: 0.5rem;
}
.btn-primary:hover { background: #2a2520; }
.btn-primary:active { transform: translateY(1px); }

/* --- Validation --- */
.validation-error {
  margin: 1rem 0;
  padding: 0.75rem 1rem;
  background: var(--cost-red-bg);
  border-left: 3px solid var(--cost-red);
  color: var(--cost-red);
  font-size: 0.85rem;
  font-weight: 500;
}

/* --- Result card --- */
.result-card {
  margin: 2.5rem 0 1rem;
  background: var(--card-bg);
  border: 1.5px solid var(--rule);
  border-radius: 4px;
  padding: 2rem 1.5rem;
}
.kicker {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 0.25rem;
}
.big-number {
  font-family: 'DM Serif Display', serif;
  font-size: 4rem;
  line-height: 1;
  color: var(--save-green);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  margin-bottom: 0.75rem;
}
.big-number .pct {
  font-size: 2rem;
  vertical-align: super;
  margin-left: 0.1em;
}
.delta {
  font-size: 0.9rem;
  color: var(--ink-muted);
  line-height: 1.4;
  margin-bottom: 1.5rem;
}
.delta strong { color: var(--ink); }
.delta-up strong { color: var(--cost-red); }
.delta-down strong { color: var(--save-green); }

.contributors h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.15rem;
  font-weight: 400;
  margin-bottom: 0.75rem;
  color: var(--ink);
}
.contrib-list { list-style: none; }
.contrib-list li { margin-bottom: 1rem; }
.contrib-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}
.contrib-name { font-size: 0.85rem; font-weight: 600; color: var(--ink); }
.contrib-pct {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--save-green);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.bar { background: var(--cream); border: 1px solid var(--rule); height: 6px; overflow: hidden; }
.bar-fill { background: var(--save-green); height: 100%; transition: width 0.4s ease; }
.contrib-meta {
  font-size: 0.7rem;
  color: var(--ink-faint);
  margin-top: 0.3rem;
  font-variant-numeric: tabular-nums;
}

.card-footer {
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  font-size: 0.7rem;
  color: var(--ink-faint);
}
.card-footer p { margin: 0.25rem 0; }
.card-footer a { color: var(--ink-muted); }
.brand-tag { font-family: 'DM Serif Display', serif; color: var(--save-green); font-size: 0.8rem; }

/* --- Share bar --- */
.share-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}
.share-btn {
  flex: 1;
  min-width: 120px;
  padding: 0.75rem;
  background: var(--card-bg);
  border: 1.5px solid var(--rule);
  border-radius: 3px;
  font-family: 'Libre Franklin', sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: all 0.15s;
}
.share-btn:hover { border-color: var(--ink); }
.share-btn-primary { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.share-btn-primary:hover { background: #2a2520; }
.share-hint {
  font-size: 0.7rem;
  color: var(--ink-faint);
  margin: 0 0 2rem;
  line-height: 1.45;
}

/* --- Methodology --- */
.methodology {
  margin-top: 2rem;
  padding: 1.5rem;
  background: var(--cream);
  border: 1px solid var(--rule);
  border-radius: 4px;
}
.methodology h2 {
  font-family: 'DM Serif Display', serif;
  font-size: 1.05rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
  color: var(--ink);
}
.methodology h3 {
  font-family: 'DM Serif Display', serif;
  font-size: 0.95rem;
  font-weight: 400;
  margin: 1.25rem 0 0.5rem;
  color: var(--ink);
}
.methodology p {
  font-size: 0.8rem;
  color: var(--ink-muted);
  line-height: 1.6;
  margin-bottom: 0.5rem;
}
.methodology a { color: var(--save-green); text-decoration: underline; }
.methodology ul.limitations { margin: 0.5rem 0 0; padding-left: 1.25rem; }
.methodology ul.limitations li {
  font-size: 0.75rem;
  color: var(--ink-muted);
  line-height: 1.55;
  margin-bottom: 0.5rem;
}
.methodology ul.limitations li::marker { color: var(--save-green); }

/* --- Footer --- */
.site-footer {
  text-align: center;
  padding: 2rem 0 0;
  margin-top: 2rem;
  font-size: 0.7rem;
  color: var(--ink-faint);
  border-top: 1px solid var(--rule);
}
.site-footer a { color: var(--ink-muted); margin: 0 0.5rem; text-decoration: none; }
.site-footer a:hover { color: var(--ink); }

/* --- Toast --- */
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-100px);
  transition: transform 0.25s;
  padding: 0.75rem 1.25rem;
  border-radius: 3px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.15);
  z-index: 9999;
  font-size: 0.85rem;
  font-weight: 600;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast-success { background: var(--save-green); color: white; }
.toast-error { background: var(--cost-red); color: white; }

/* --- Mobile --- */
@media (max-width: 480px) {
  .header h1 { font-size: 1.75rem; }
  .big-number { font-size: 3rem; }
  .big-number .pct { font-size: 1.5rem; }
  .container { padding: 1.5rem 1rem 2.5rem; }
  .share-bar { flex-direction: column; }
  .share-btn { min-width: 0; }
}
