/* ============================================================
   Is the Disney Dining Plan Worth It, the interactive calculator
   Scoped to .guide--dining. Uses the site Nightfall tokens.
   ============================================================ */

.dp-calc {
  --dp-warm: oklch(64% 0.135 28);   /* terracotta, the "out of pocket / costs more" hue */
  margin: var(--space-xl) 0 var(--space-2xl);
  background: var(--paper-2);
  border: 1px solid var(--hair);
  border-radius: 8px;
  padding: var(--space-lg);
  box-shadow: 0 14px 40px oklch(10% 0.03 278 / 0.45);
}
.dp-calc-head { margin-bottom: var(--space-lg); }
/* scoped under .dp-calc so these beat the generic `.guide p` rule (0,0,1,1) in site.css */
.dp-calc .dp-sub { font-family: var(--text); font-size: 16px; line-height: 1.5; color: var(--ink-soft); margin: var(--space-2xs) 0 0; max-width: 60ch; }

.dp-grid {
  display: grid;
  grid-template-columns: minmax(0, 330px) minmax(0, 1fr);
  gap: var(--space-xl);
  align-items: stretch;
}
@media (max-width: 720px) { .dp-grid { grid-template-columns: 1fr; gap: var(--space-lg); } }

/* ---- controls (left column: inputs, then the verdict) -------------------- */
.dp-controls { display: flex; flex-direction: column; gap: var(--space-lg); min-width: 0; }
.dp-form { display: flex; flex-direction: column; gap: var(--space-lg); min-width: 0; }

.dp-fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-sm); }
.dp-field { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.dp-field-l { font-family: var(--label); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); display: flex; flex-direction: column; gap: 1px; }
.dp-field-l i { font-style: normal; font-size: 10px; letter-spacing: 0.03em; opacity: 0.72; text-transform: none; }

.dp-stepper {
  display: flex; align-items: stretch; width: 100%; min-width: 0;
  background: var(--paper); border: 1px solid var(--hair); border-radius: 6px; overflow: hidden;
  transition: border-color 0.16s;
}
.dp-stepper:focus-within { border-color: var(--gold); outline: 2px solid var(--gold); outline-offset: 1px; }
.dp-step {
  flex: 0 0 34px; border: 0; background: transparent; color: var(--ink-soft);
  font: 600 20px/1 var(--text); cursor: pointer; padding: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s, color 0.15s; -webkit-tap-highlight-color: transparent;
}
.dp-step:hover { background: oklch(84% 0.13 86 / 0.16); color: var(--gold); }
.dp-step:active { background: oklch(84% 0.13 86 / 0.26); }
.dp-stepper input {
  flex: 1 1 auto; width: 100%; min-width: 2ch; text-align: center;
  font: 600 21px/1 var(--display); color: var(--ink);
  background: transparent; border: 0; border-inline: 1px solid var(--hair);
  padding: 11px 2px; -moz-appearance: textfield; appearance: textfield;
}
.dp-stepper input::-webkit-outer-spin-button,
.dp-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.dp-stepper input:focus-visible { outline: none; }

/* ---- segmented controls ------------------------------------------------- */
.dp-seg { border: 0; padding: 0; margin: 0; min-width: 0; }
.dp-seg legend { font-family: var(--label); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding: 0 0 8px; }
.dp-seg-opts {
  display: flex; gap: 4px; min-width: 0;
  background: var(--paper); border: 1px solid var(--hair); border-radius: 7px; padding: 4px;
}
.dp-seg-opts label {
  flex: 1 1 0; min-width: 0; text-align: center; cursor: pointer; white-space: nowrap;
  font: 500 14px/1 var(--text); color: var(--ink-soft);
  border-radius: 4px; padding: 9px 6px;
  transition: background 0.16s, color 0.16s; -webkit-tap-highlight-color: transparent;
}
.dp-seg-opts label:hover:not(:has(input:checked)) { color: var(--gold); }
.dp-seg-opts input { position: absolute; opacity: 0; pointer-events: none; }
.dp-seg-opts label:has(input:checked) { background: var(--gold); color: oklch(20% 0.04 278); font-weight: 600; }
.dp-seg-opts label:has(input:focus-visible) { outline: 2px solid var(--gold); outline-offset: 2px; }
/* scoped under .dp-calc so it beats the generic `.guide p` rule in site.css */
.dp-calc .dp-seg-help { font-family: var(--text); font-size: 12.5px; line-height: 1.4; color: var(--ink-soft); margin: 8px 0 0; max-width: 44ch; }

/* ---- verdict (the answer block, color-keyed to the result) -------------- */
.dp-verdict {
  margin-top: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 10px;
  padding: var(--space-md) var(--space-lg); border-radius: 8px;
  border: 1px solid var(--hair); background: var(--paper);
}
.dp-verdict-tag {
  font-family: var(--label); font-weight: 700; font-size: 12px; text-transform: uppercase;
  letter-spacing: 0.1em; line-height: 1; padding: 6px 12px; border-radius: 999px;
}
.dp-verdict-text { font-family: var(--display); font-size: clamp(19px, 2.3vw, 24px); line-height: 1.28; color: var(--ink); margin: 0; text-wrap: balance; }
.dp-verdict-text b { font-weight: 600; }

.dp-verdict.is-good { background: oklch(84% 0.13 86 / 0.10); border-color: oklch(84% 0.13 86 / 0.42); }
.dp-verdict.is-good .dp-verdict-tag { background: var(--gold); color: oklch(20% 0.04 278); }
.dp-verdict.is-good .dp-verdict-text b { color: var(--gold); }

.dp-verdict.is-bad { background: oklch(64% 0.135 28 / 0.13); border-color: oklch(64% 0.135 28 / 0.45); }
.dp-verdict.is-bad .dp-verdict-tag { background: var(--dp-warm); color: oklch(97% 0.02 28); }
.dp-verdict.is-bad .dp-verdict-text b { color: oklch(74% 0.135 28); }

.dp-verdict.is-meh .dp-verdict-tag { background: var(--hair); color: var(--ink); }
.dp-verdict.is-meh .dp-verdict-text b { color: var(--ink); }

/* ---- stage (right column: the scale, then the numbers) ------------------ */
.dp-stage { display: flex; flex-direction: column; gap: var(--space-md); min-width: 0; }

.dp-viz { display: flex; flex-direction: column; gap: 4px; width: 100%; min-width: 0; }
.dp-viz-caps { display: none; justify-content: space-between; padding: 0 6px; }
.dp-cap { font-family: var(--label); font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; }
.dp-cap-oop { color: oklch(74% 0.10 28); }
.dp-cap-plan { color: var(--gold); }
.dp-3d-on .dp-viz-caps { display: flex; }

/* "cheaper" marker on the winning side, a text channel so the winner does not rely on color alone */
.dp-cap-mark { font-weight: 700; }
.dp-cap-mark:not(:empty)::before { content: " · "; font-weight: 400; opacity: 0.55; }

.dp-canvas { display: none; width: 100%; aspect-ratio: 4 / 3; max-height: 320px; }
.dp-3d-on .dp-canvas { display: block; }
.dp-3d-on .dp-bars { display: none; }

/* fallback bars (also the no-JS / no-WebGL view) */
.dp-bars { display: flex; align-items: flex-end; justify-content: center; gap: var(--space-2xl); height: 100%; min-height: 220px; padding: var(--space-md) 0; }
.dp-bar { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 84px; height: 100%; justify-content: flex-end; }
.dp-bar-track { width: 60px; flex: 1 1 auto; min-height: 0; display: flex; align-items: flex-end; background: var(--paper); border: 1px solid var(--hair); border-radius: 4px 4px 0 0; overflow: hidden; }
.dp-bar-fill { width: 100%; display: block; transition: height 0.5s cubic-bezier(0.2, 0.8, 0.2, 1); }
.dp-bar-oop .dp-bar-fill { background: var(--dp-warm); }
.dp-bar-plan .dp-bar-fill { background: var(--gold); }
.dp-bar-label { font-family: var(--label); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

/* ---- stat tiles --------------------------------------------------------- */
.dp-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--hair); border: 1px solid var(--hair); border-radius: 6px; overflow: hidden; }
.dp-stat { background: var(--paper); padding: var(--space-sm) var(--space-md); display: flex; flex-direction: column; justify-content: space-between; gap: var(--space-sm); min-width: 0; }
.dp-stat-l { font-family: var(--label); font-size: 11px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.dp-stat-v { font-family: var(--display); font-size: clamp(22px, 2.4vw, 27px); line-height: 1; color: var(--ink); }
.dp-stat-net { background: var(--paper-2); }
.dp-stat-net.is-good .dp-stat-v { color: var(--gold); }
.dp-stat-net.is-bad .dp-stat-v { color: oklch(74% 0.135 28); }
.dp-stat-net.is-meh .dp-stat-v { color: var(--ink); }

/* ---- assumptions footnote (full width under the grid) ------------------- */
/* scoped under .dp-calc so it beats the generic `.guide p` rule (0,0,1,1) in site.css.
   Deliberately fine print, but kept at --ink-soft for legibility since it is the accuracy note. */
.dp-calc .dp-assume {
  font-family: var(--text); font-size: 13.5px; line-height: 1.55; color: var(--ink-soft);
  margin: var(--space-lg) 0 0; padding-top: var(--space-md); border-top: 1px solid var(--hair);
  max-width: 78ch;
}

/* ---- narrow phones: fields become full-width rows ----------------------- */
@media (max-width: 560px) {
  .dp-calc { padding: var(--space-md); border-radius: 6px; }
  .dp-fields { grid-template-columns: 1fr; gap: 2px; }
  .dp-field { flex-direction: row; align-items: center; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--hair); gap: var(--space-md); }
  .dp-field:last-child { border-bottom: 0; }
  .dp-field-l { flex-direction: row; align-items: baseline; gap: 8px; }
  .dp-field .dp-stepper { width: 134px; flex: 0 0 auto; }
  .dp-seg-opts label { font-size: 13px; padding: 9px 4px; }
}

/* ---- supporting prose bits (tables, lists) ------------------------------ */
.dp-table { width: 100%; border-collapse: collapse; margin: var(--space-md) 0; font-family: var(--text); }
.dp-table th, .dp-table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--hair); font-size: 15px; }
.dp-table thead th { font-family: var(--label); font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--gold); }
.dp-table tbody th { color: var(--ink-soft); font-weight: 600; }
.dp-table td { color: var(--ink); }

.dp-list { margin: var(--space-sm) 0 var(--space-md); padding-left: 1.1em; }
.dp-list li { font-family: var(--text); font-size: 16px; line-height: 1.55; color: var(--ink-soft); margin: 0 0 6px; }

@media (prefers-reduced-motion: reduce) {
  .dp-bar-fill { transition: none; }
}
