/* Walls engine demo (#wave, assets/js/wave.js). Ported from the app's walls.css: the same classes and sizes, on the site's
   theme tokens. Differences: the app's amber (#e8b04a: call-side volume bars, max pain, highlights) is ink-2 here (no gold
   on the site); `:root.light` overrides are light-dark() pairs, so Midnight / Onyx / Platinum / Light all follow color-scheme. */
#wave { --font: var(--bl-font); --ring: light-dark(#0070b1, #008fd2); --shadow-float: var(--shadow-card); --wl-mid: var(--ink-2); }
#wave .lede { max-width: none; }
.walls-page { container-type: inline-size; display: flex; flex-direction: column; gap: 10px; font-family: var(--font); text-shadow: none; }

.wl-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font: 500 11px/1 var(--font); color: var(--muted); }
.wl-bar label { display: inline-flex; align-items: center; gap: 6px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; font-size: 10px; }
.wl-bar select, .wl-foot select, .wl-bar input { background: var(--card); color: var(--ink); border: 1px solid var(--line-2); border-radius: 7px; padding: 3px 6px; font: 500 11px/1.2 var(--font); }
.wl-time input[type=range] { padding: 0; width: 150px; accent-color: var(--ink); border: 0; background: none; }
.wl-time output { min-width: 4ch; font: 600 11px/1 var(--font); color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: 0; text-transform: none; }
.wl-play { min-width: 58px; }
.wl-state { display: inline-flex; align-items: center; gap: 6px; font-variant-numeric: tabular-nums; }
.wl-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); display: inline-block; }
.wl-dot.ok { background: var(--profit); }

.wl-screen { position: relative; min-width: 0; display: flex; flex-direction: column; border: 1px solid var(--line-2); border-radius: 12px; background: var(--card); overflow: hidden; }
.wl-scroll { position: relative; overflow-x: auto; overflow-y: hidden; }
.wl-svg { display: block; width: 100%; height: 640px; min-width: 554px; }
.wl-foot { flex: none; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 7px 12px 9px; border-top: 1px solid var(--line-2); font: 500 11px/1 var(--font); color: var(--muted); }
.wl-foot label { display: inline-flex; align-items: center; gap: 5px; color: var(--ink); }
.wl-foot input[type=checkbox] { accent-color: var(--ink); }
.wl-note { margin-left: auto; font-size: 10.5px; }
.wl-hint { margin: 0; font: 500 12px/1.4 var(--font); color: var(--muted); }
.wl-h { margin: 0 0 6px; font: 650 10px/1 var(--font); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

/* svg parts */
.wl-svg text { font-family: var(--font); font-size: 10.5px; fill: var(--ink); font-variant-numeric: tabular-nums; }
.wl-svg .w-mute { fill: var(--muted); } .wl-svg .w-b { font-weight: 650; }
.wl-svg .w-s { font-size: 9.5px; } .wl-svg .w-n { font-size: 9.6px; }
.wl-svg .w-pct { fill: var(--ink); }
.wl-svg .w-band { fill: var(--muted); }
.wl-svg .w-exp { stroke: var(--ring); stroke-width: 1.2; }
.wl-svg .w-pre { stroke: var(--ink); stroke-width: 2; fill: none; }
.wl-svg .w-c { stroke: var(--ink); stroke-width: 1; fill: none; }
/* Color Spaghetti: fixed call / put hues, as the app (Flow's candles use the same) */
.wl-svg .w-c.up { stroke: light-dark(#00806f, #2de0c8); } .wl-svg .w-c.dn { stroke: light-dark(#c2187f, #ff5ccf); }
.wl-svg .w-f { stroke: var(--ink); stroke-width: .9; fill: none; opacity: .55; }
.wl-svg .w-x { fill: #8966f9; font-size: 11px; }
.wl-svg .w-wall { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 4 3; opacity: .6; }
.wl-svg .w-chip { fill: var(--ink); } .wl-svg .w-chipt { fill: var(--card); font-weight: 600; }
.wl-svg .w-up { stroke: var(--profit); stroke-width: 1.4; } .wl-svg .w-dn { stroke: var(--loss); stroke-width: 1.4; }
.wl-svg .w-up-f { fill: var(--profit); } .wl-svg .w-dn-f { fill: var(--loss); }
.wl-svg .w-va { fill: var(--wl-mid); } .wl-svg .w-vb { fill: var(--ring); } .wl-svg .w-neg { fill: var(--loss); }
.wl-svg .w-axis { stroke: var(--muted); stroke-width: 1; }
.wl-svg .w-spot { stroke: var(--loss); stroke-width: .8; opacity: .8; }
.wl-svg rect { shape-rendering: crispEdges; } .wl-svg .w-chip { shape-rendering: auto; }
.wl-svg .w-hit { fill: transparent; cursor: crosshair; } .wl-svg .w-hit:hover { fill: var(--ink); fill-opacity: .06; }
.wl-svg .w-c.hot, .wl-svg .w-f.hot { stroke: var(--ring); stroke-width: 2.2; stroke-opacity: 1; opacity: 1; }
.wl-svg .w-pad { cursor: crosshair; } .wl-svg .w-pad:hover { fill: transparent; }
.wl-svg .w-xh { pointer-events: none; } .wl-svg .w-xl { stroke: var(--muted); stroke-width: .8; stroke-dasharray: 3 3; }

.wl-tip { position: absolute; z-index: 3; min-width: 230px; pointer-events: none; display: flex; flex-direction: column; gap: 2px; padding: 8px 10px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--card); box-shadow: var(--shadow-float); font: 500 11px/1.35 var(--font); color: var(--muted); font-variant-numeric: tabular-nums; }
.wl-tip[hidden] { display: none; }
.wl-tip b { color: var(--ink); font-weight: 650; } .wl-tip .hi { color: var(--ink); font-weight: 650; }
.wl-tip .c { color: var(--profit); } .wl-tip .p { color: var(--loss); }

/* stat tiles */
.wl-kpis { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; }
@container (max-width: 1700px) { .wl-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@container (max-width: 820px) { .wl-kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@container (max-width: 560px) { .wl-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.wl-kpi { min-width: 0; display: flex; flex-direction: column; gap: 2px; padding: 6px 8px 6px 9px; border: 1px solid var(--line-2); border-radius: 9px; background: var(--card); position: relative; overflow: hidden; }
.wl-kpi::before { content: ''; position: absolute; left: 0; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--line-2); }
.wl-kpi.up::before { background: var(--profit); } .wl-kpi.dn::before { background: var(--loss); }
.wl-kpi span { font: 650 8.5px/1 var(--font); letter-spacing: .06em; white-space: nowrap; text-transform: uppercase; color: var(--muted); }
.wl-kpi b { font: 650 13px/1.1 var(--font); color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.wl-kpi small { font: 500 9px/1.2 var(--font); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.wl-kpi small b { font-size: inherit; line-height: inherit; }
.wl-kpi small .pos { color: var(--profit); font-weight: 600; } .wl-kpi small .neg { color: var(--loss); font-weight: 600; }
.wl-kpi span i { font-style: normal; text-transform: none; }

/* screen + strike profile */
.wl-mid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; }
@container (max-width: 1000px) { .wl-mid { grid-template-columns: minmax(0, 1fr) 240px; } }
@container (max-width: 820px) { .wl-mid { grid-template-columns: minmax(0, 1fr); } .wl-prof { height: 420px; } }
.wl-prof { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--line-2); border-radius: 12px; background: var(--card); padding: 10px 12px; }
.wl-prof .wl-tip { min-width: 200px; }
.wl-prof-head { flex: none; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 6px 8px; }
.wl-prof-head .wl-h { margin: 0; white-space: nowrap; }
.wl-seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 7px; overflow: hidden; }
.wl-seg button { background: none; border: 0; color: var(--muted); font: 600 10px/1 var(--font); padding: 4px 8px; cursor: pointer; }
.wl-seg button.on { background: var(--ink); color: var(--card); }
.wl-prof-svg { display: block; flex: 1 1 auto; min-height: 0; width: 100%; height: 100%; margin-top: 6px; }
.wl-prof-svg text { font-family: var(--font); font-size: 9.5px; fill: var(--ink); font-variant-numeric: tabular-nums; }
.wl-prof-svg .w-mute { fill: var(--muted); } .wl-prof-svg .w-b { font-weight: 700; }
.wl-prof-svg .w-hit { fill: transparent; } .wl-prof-svg .w-hit:hover { fill: var(--ink); fill-opacity: .06; }
.wl-prof-svg .w-pc { fill: var(--profit); fill-opacity: .55; } .wl-prof-svg .w-pp { fill: var(--loss); fill-opacity: .55; }
.wl-prof-svg .wall { fill-opacity: 1; }
.wl-prof-svg .w-axis { stroke: var(--muted); stroke-width: 1; }
.wl-prof-svg .w-grid { stroke: var(--line-2); stroke-width: 1; }
.wl-prof-svg .w-tb { fill: var(--ring); fill-opacity: .45; } .wl-prof-svg .w-tb.on { fill-opacity: 1; }
.wl-prof-svg .w-tl { stroke: #8966f9; stroke-width: 1.6; fill: none; } .wl-prof-svg .w-td, .wl-prof-svg .w-lf { fill: #8966f9; }
.wl-prof-svg .w-lvl { stroke-width: 1; stroke-dasharray: 4 3; fill: none; }
.w-lvl.w-ls { stroke: var(--ring); } .w-lvl.w-lm { stroke: var(--wl-mid); } .w-lvl.w-lf { stroke: #8966f9; }
.wl-legend { flex: none; display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; font: 500 10px/1 var(--font); color: var(--muted); }
.wl-legend[hidden] { display: none; }
.wl-legend span::before { content: ''; display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 4px; vertical-align: middle; }
.wl-legend .c::before { background: var(--profit); } .wl-legend .p::before { background: var(--loss); }
.wl-legend .s::before { background: var(--ring); } .wl-legend .m::before { background: var(--wl-mid); } .wl-legend .f::before { background: #8966f9; }

/* Focus: the options screen takes the width */
.wl-focus-btn { background: var(--card); color: var(--ink); border: 1px solid var(--line-2); border-radius: 7px; padding: 3px 8px; font: 600 11px/1.2 var(--font); cursor: pointer; }
.wl-focused [data-w-focus], .wl-play[aria-pressed=true] { background: var(--ink); color: var(--card); }
.wl-focused .wl-kpis, .wl-focused .wl-prof { display: none; }
.wl-focused .wl-mid { grid-template-columns: minmax(0, 1fr); }
.wl-seg button:hover:not(.on), .wl-focus-btn:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 8%, transparent); }
.wl-focused [data-w-focus]:hover, .wl-play[aria-pressed=true]:hover { background: var(--ink); color: var(--card); opacity: .85; }
.walls-page button:focus-visible, .walls-page select:focus-visible, .walls-page input:focus-visible, .wl-svg:focus-visible, .wl-prof-svg:focus-visible { outline: 2px solid var(--ring); outline-offset: 1px; }
.wl-svg:focus, .wl-prof-svg:focus { outline: none; }
.wl-svg:focus-visible, .wl-prof-svg:focus-visible { outline: 2px solid var(--ring); outline-offset: -2px; }

@media (max-width: 700px) { .wl-svg { height: 600px; } .wl-note { margin-left: 0; } }

/* Fits the window (owner: "automatically fit the tab… width"): full page width, the chart scales with
   its width instead of a fixed 640px height, stat tiles in two rows of six, a narrower strike profile. */
#wave .walls-page { width: 100%; }   /* fills the page width at any window size; the chart's height follows its width */
#wave .wl-svg { height: auto; aspect-ratio: 1100 / 640; }
#wave .wl-kpis { grid-template-columns: repeat(6, minmax(0, 1fr)); }
#wave .wl-mid { grid-template-columns: minmax(0, 1fr) clamp(200px, 20%, 280px); }
#wave .wl-kpi { padding: 5px 8px 5px 9px; }

/* Owner's note on the engine, under the section's intro sentence */
#wave .wv-quote { margin: 18px 0 28px; max-width: none; padding: 4px 0 4px 18px; border-left: 2px solid var(--line-2); }
#wave .wv-quote blockquote { margin: 0; }
#wave .wv-quote p { margin: 0; font-size: 15.5px; line-height: 1.7; color: var(--ink-2); }
#wave .wv-quote figcaption { margin-top: 12px; font-size: 14px; font-weight: 600; color: var(--ink); }
#wave .wv-quote figcaption span { display: block; margin-top: 2px; padding-left: 1.1em; font-size: 12px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
/* Stop the strike profile growing on every repaint: its svg reads its own height to build the viewBox, and its
   content was feeding back into the row height (+21px per 2 s tick, worst on GEX/Term). size containment makes
   the panel contribute no height of its own, so the row takes the wave screen's height and the panel stretches
   to it; the stacked phone layout keeps its explicit 420px. */
#wave .wl-prof { contain: size; }

/* ---- Phone layout (≤ 720px). The desktop size rules above pinned 6 tile columns and a side-by-side profile,
   which crushed everything on a phone. Here: 2 tile columns; the wave screen at a readable fixed size inside a
   sideways-scrolling frame (wave first, swipe for the put table); the strike profile full width below it;
   controls in a tidy grid. ---- */
@media (max-width: 720px) {
  #wave .wl-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  #wave .wl-kpi b { font-size: 15px; }
  #wave .wl-mid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  #wave .wl-prof { height: 460px; }
  #wave .wl-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
  #wave .wl-svg { width: 900px; min-width: 900px; height: 520px; aspect-ratio: auto; }
  #wave .wl-screen::before { content: "Swipe the chart sideways for the volume fan and put table →"; order: -1; display: block; padding: 8px 12px 0; font: 500 11px/1.3 var(--font); color: var(--muted); }
  #wave .wl-bar { gap: 8px 10px; }
  #wave .wl-bar input[type=range] { flex: 1 1 140px; min-width: 0; }
  #wave .wl-bar .wl-state { flex-basis: 100%; white-space: normal; line-height: 1.35; }
  #wave .wl-foot { display: grid; grid-template-columns: 1fr 1fr; align-items: center; gap: 10px 12px; }
  #wave .wl-foot .wl-note { grid-column: 1 / -1; margin-left: 0; }
  #wave .wv-quote { padding-left: 12px; }
  #wave .wv-quote p { font-size: 14.5px; }
}
