/* Volatility drag calculator: page layout on top of the shared /style.css.
   Kept in this folder so the shared stylesheet stays untouched. Same layout as the other
   calculators: graph and answer on the left, a short inputs panel on the right
   (stacked graph, inputs, stats on phones). Everything is scoped to body.vd. */

.vd .hero-head { display: block; padding-block: 26px 6px; }
.vd .hero-head h1 { font-size: var(--step-3); max-width: none; margin-top: 6px; }
.vd .workspace { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 28px 40px; align-items: start; padding-top: 18px; }
.vd .stage { position: sticky; top: 12px; display: grid; min-width: 0; }
.vd .answer { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 4px 18px; }
.vd .answer .label { flex-basis: 100%; }
.vd .answer .big { font-size: clamp(2.8rem, 2rem + 2.6vw, 4.2rem); color: var(--gold); }
.vd .answer .big .was { color: var(--muted); font-size: 0.42em; letter-spacing: -0.02em; margin-left: 10px; text-decoration: line-through; text-decoration-thickness: 1.5px; text-decoration-color: var(--rust); }
.vd .answer-line { padding-bottom: 6px; max-width: 48ch; }
.vd .answer-line b { font-weight: 700; }
.vd .answer-line .r { color: var(--rust); }
.vd .landscape { padding-top: 14px; }
.vd .legend-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 24px; padding-top: 10px; }
.vd .legend { pointer-events: none; }
.vd .legend span { display: inline-flex; align-items: center; gap: 7px; }
.vd .chip-steady { border-color: var(--ink); border-top-width: 1.6px; border-top-style: dashed; }
.vd .chip-drag { width: 12px; height: 10px; border: 0; border-radius: 2px; background: var(--rust); opacity: 0.28; }

/* Stats under the graph */
.vd .stats { margin-top: 22px; grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 640px) { .vd .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } .vd .stat:nth-child(3) { padding-left: 0; border-left: 0; } .vd .stat:nth-child(n+3) { border-top: 1px solid var(--line); } }
.vd .stat { align-content: start; }
.vd .stat .sub { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.vd .stat-gold .v { color: var(--gold); }
.vd .stat-rust .v { color: var(--rust); }

/* Inputs panel */
.vd .panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px 18px; display: grid; gap: 4px; min-width: 0; }
.vd .panel-head { display: grid; gap: 10px; padding-bottom: 12px; }
.vd .panel-head h2 { font-size: 1.45rem; }
.vd .panel-head .btn-row { flex-wrap: nowrap; }
.vd .panel-head .inline-field { flex: 1; min-width: 0; }
.vd .panel-head .inline-field select { width: 100%; }
.vd .simple { display: grid; grid-template-columns: minmax(0, 1fr); border-top: 1px solid var(--ink); }
.vd .simple .col { border: 0; margin: 0; padding: 14px 0; display: grid; gap: 12px; align-content: start; min-width: 0; }
.vd .simple .col + .col { border-top: 1px solid var(--line); }
.vd .simple .col:last-child { padding-bottom: 4px; }
.vd .simple legend { float: left; width: 100%; padding: 0; font-family: var(--font-display); font-size: 1.05rem; }
.vd .simple legend + * { clear: both; }
.vd .row2 { gap: 10px; align-items: start; }
.vd .field { align-content: start; }
.vd .field-hint { font-size: 0.78rem; color: var(--muted); line-height: 1.4; }
.vd .vol-label { font-size: 0.88rem; font-weight: 600; }
.vd .presets { gap: 6px; }
.vd .presets .preset { display: grid; gap: 0; line-height: 1.15; padding: 6px 10px; text-align: center; }
.vd .presets .preset small { font-size: 0.72rem; font-weight: 500; opacity: 0.85; }
.vd .preset-custom { width: 5.4rem; align-self: stretch; display: flex; }
.vd .preset-custom input { padding-right: 26px; height: 100%; }
.vd .pct input { padding-right: 28px; }
.vd .privacy { margin-top: 8px; }
.vd input[type="text"] { min-height: 42px; }
/* Hide the "%" unit while the custom volatility box shows its placeholder. */
.vd .preset-custom input:placeholder-shown + span { visibility: hidden; }

/* Main graph extras */
.chart-box .l-steady { fill: none; stroke: var(--ink); stroke-width: 1.6; stroke-dasharray: 5 4; stroke-linecap: round; }
.chart-box .l-trend { fill: none; stroke: var(--gold); stroke-width: 1.2; stroke-dasharray: 2 4; opacity: 0.75; }
.chart-box .drag-area { fill: var(--rust); fill-opacity: 0.12; }
.chart-box .gap-line { stroke: var(--rust); stroke-width: 2; stroke-linecap: round; }
.chart-box .gap-bracket { fill: none; stroke: var(--rust); stroke-width: 1.3; }
.chart-box .gap-v { font-size: 13px; font-weight: 700; fill: var(--rust); }
.chart-box .end-v { font-size: 13px; font-weight: 700; }
.chart-box .steady-dot { fill: var(--ink); stroke: var(--paper); stroke-width: 2; }
.chart-box .start-dot { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; }
.chart-box .yr-dot { fill: var(--gold); stroke: var(--paper); stroke-width: 1.2; }
.chart-box .halo { paint-order: stroke; stroke: var(--paper); stroke-width: 4px; stroke-linejoin: round; }
.chart-box .hover-steady { fill: var(--ink); stroke: var(--paper); stroke-width: 2; }
.tip .t-up { color: var(--gold); font-weight: 600; }
.tip .t-down { color: var(--rust); font-weight: 600; }

/* Second graph: the bumpier, the bigger the drag */
.vd .bumpier { padding-top: 64px; display: grid; gap: 14px; }
.vd .bumpier-msg { font-size: 1.05rem; max-width: 70ch; }
.vd .bumpier-msg b { font-weight: 700; }
.vd .bumpier-msg .g { color: var(--gold); }
.vd .bumpier-msg .r { color: var(--rust); }
.vd .curve-box { position: relative; border-top: 1px solid var(--ink); padding-top: 8px; }
.vd .curve-box svg { display: block; width: 100%; height: auto; overflow: visible; }
.vd .curve-box text { font-family: var(--font-body); font-size: 12px; font-variant-numeric: tabular-nums; }
.curve-box .ax { fill: var(--muted); }
.curve-box .gridline { stroke: var(--grid); stroke-width: 1; }
.curve-box .baseline { stroke: var(--ink); stroke-width: 1; }
.curve-box .zero { stroke: var(--ink); stroke-width: 1; opacity: 0.5; }
.curve-box .avg-line { stroke: var(--ink); stroke-width: 1.6; stroke-dasharray: 5 4; }
.curve-box .avg-l { font-weight: 600; fill: var(--ink); }
.curve-box .c-line { fill: none; stroke: var(--gold); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.curve-box .c-area { fill: var(--rust); fill-opacity: 0.12; }
.curve-box .mark { fill: var(--paper); stroke: var(--ink); stroke-width: 1.5; }
.curve-box .mark-l { fill: var(--muted); font-size: 11.5px; }
.curve-box .mark-stem { stroke: var(--ink); stroke-width: 1; opacity: 0.35; stroke-dasharray: 2 3; }
.curve-box .you { fill: var(--gold); stroke: var(--paper); stroke-width: 2.5; }
.curve-box .you-l { font-weight: 700; fill: var(--gold); font-size: 13px; }
.curve-box .you-s { fill: var(--muted); }
.curve-box .you-gap { stroke: var(--rust); stroke-width: 2; stroke-linecap: round; }
.curve-box .halo { paint-order: stroke; stroke: var(--paper); stroke-width: 4px; stroke-linejoin: round; }
.curve-box .cross { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 2 3; opacity: 0.45; }
.curve-box .hover-dot { fill: var(--gold); stroke: var(--paper); stroke-width: 2; }

/* Tables */
.vd #history, .vd #years { padding-top: 56px; }
.vd #history h2, .vd #years h2 { margin-bottom: 14px; }
.vd .lead { max-width: 70ch; margin-bottom: 14px; }
.vd .yt-scroll { overflow-x: auto; }
.vd .yt { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 0.95rem; border-top: 1px solid var(--ink); }
.vd .yt th, .vd .yt td { padding: 8px 12px 8px 0; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.vd .yt th:first-child { text-align: left; }
.vd .yt th:last-child, .vd .yt td:last-child { padding-right: 0; }
.vd .yt thead th { font-size: 0.78rem; color: var(--muted); font-weight: 600; white-space: normal; vertical-align: bottom; }
.vd .yt tbody th { font-weight: 600; }
.vd .yt td.g { color: var(--gold); font-weight: 600; }
.vd .yt td.r { color: var(--rust); }
.vd .yt tfoot th, .vd .yt tfoot td { font-weight: 700; border-bottom: 0; border-top: 1px solid var(--ink); }
.vd .yt-note { margin-top: 10px; }
.vd .years-box summary { cursor: pointer; font-family: var(--font-display); font-size: 1.12rem; padding: 12px 0; border-top: 1px solid var(--ink); }
.vd .years-box[open] summary { margin-bottom: 4px; }
.vd .years-box .yt { border-top: 1px solid var(--line); }

/* Reading: one content width, heading left and text right on wide screens */
.vd .prose, .vd .disclaimer { max-width: none; }
@media (min-width: 900px) {
  .vd .section.prose { grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); column-gap: 48px; row-gap: 0; align-items: start; }
  .vd .section.prose > h2 { grid-column: 1; grid-row: 1 / span 30; }
  .vd .section.prose > :not(h2) { grid-column: 2; margin-bottom: 16px; }
}
.vd .sources { font-size: var(--step--1); color: var(--muted); }

@media (max-width: 1200px) and (min-width: 961px) { .vd .workspace { grid-template-columns: minmax(0, 1fr) 330px; gap: 28px; } }
@media (max-width: 960px) {
  .vd .workspace { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .vd .stage { display: contents; }
  .vd .stage .answer { order: 1; }
  .vd .stage .landscape { order: 2; }
  .vd .panel { order: 3; margin-top: 20px; }
  .vd .stage .stats { order: 4; margin-top: 28px; }
}
@media (max-width: 960px) and (min-width: 600px) {
  .vd .simple { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .vd .simple .col + .col { border-top: 0; border-left: 1px solid var(--line); padding-left: 18px; }
  .vd .simple .col:first-child { padding-right: 18px; }
}
@media (max-width: 600px) {
  .vd .hero-head { padding-block: 18px 0; }
  .vd .hero-head h1 { font-size: 1.6rem; }
  .vd .hero-head .eyebrow { display: none; }
  .vd .answer .big { font-size: 2.9rem; }
  .vd .answer-line { font-size: 0.85rem; flex-basis: 100%; padding-bottom: 0; }
  .vd .landscape { padding-top: 6px; }
  .vd .panel { padding: 14px 14px 16px; margin-inline: -4px; margin-top: 14px; }
  .vd .legend-row { gap: 6px 14px; padding-top: 6px; }
  .vd .legend { gap: 2px 14px; font-size: 0.8rem; }
  .vd .yt { font-size: 0.84rem; }
  .vd .yt th, .vd .yt td { padding-right: 8px; }
  .vd .yt .wide { display: none; }
}

/* While a number is invalid, keep the last result but fade it. */
.vd .is-stale .landscape, .vd .is-stale .stats { opacity: 0.35; transition: opacity 0.15s; }
