/* Wireframe styles — structure over polish; visual design pass comes later. */

:root {
  --orange: #d7642c;
  --yellow: #e6a532;
  --gray: #707070;
  --bg: #fff5ee;
  --ink: #2b2b2b;
  --muted: #6f675f;
  --line: #e4dbd1;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: #fff;
  line-height: 1.5;
}

.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

header {
  position: sticky; top: 0; z-index: 20;
  background: #fff; border-bottom: 1px solid var(--line);
}
/* Horizontal padding must match .container's (this shorthand overrides it),
   or the header runs edge-to-edge and clips on phones. */
.nav { display: flex; align-items: center; gap: 18px; padding: 12px 20px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { height: 17px; display: block; }
.brand span {
  font-weight: bold; font-size: 16px; color: var(--ink); white-space: nowrap;
  border-left: 1px solid var(--line); padding-left: 10px;
}
.nav a { color: var(--ink); text-decoration: none; font-size: 14px; }
.domain-toggle {
  display: flex; border: 1px solid var(--line); border-radius: 8px;
  overflow: hidden; margin-left: 4px; flex: 0 0 auto; align-self: center;
}
.domain-btn {
  font: inherit; font-size: 13px; padding: 6px 12px; border: 0;
  background: #fff; color: var(--ink); cursor: pointer;
}
.domain-btn + .domain-btn { border-left: 1px solid var(--line); }
.domain-btn.active { background: var(--orange); color: #fff; font-weight: bold; }
.nav a:hover { color: var(--orange); }
.nav .spacer { flex: 1; }
/* About link: same type as the "Lab" brand span, in the PRO gray. */
.nav .about-link { font-size: 16px; font-weight: bold; color: var(--gray); }
/* Phone header: the full row (brand + toggle + About) is wider than a phone
   screen and used to overflow, clipping the logo on the left and the About
   link on the right. Wrap instead: line 1 = brand + About, line 2 = the
   domain toggle stretched into a full-width segmented control. */
@media (max-width: 600px) {
  .nav { flex-wrap: wrap; gap: 10px; row-gap: 8px; }
  .brand img { height: 15px; }
  .domain-toggle { order: 3; flex-basis: 100%; margin-left: 0; }
  .domain-btn { flex: 1; text-align: center; }
}
select#market-select {
  font: inherit; padding: 6px 10px; border: 1px solid var(--line);
  border-radius: 6px; background: #fff;
}

section { padding: 44px 0; }
section.alt { background: var(--bg); }
h1 { font-size: 30px; margin: 0 0 6px; }
h2 { font-size: 22px; margin: 0 0 4px; }
.sub { color: var(--muted); margin: 0 0 20px; font-size: 15px; }
.kicker {
  color: var(--orange); font-size: 12px; letter-spacing: 0.08em;
  text-transform: uppercase; margin: 0 0 6px; font-weight: bold;
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }

.chart { width: 100%; height: 400px; }
.chart.tall { height: 470px; }
/* Hero pair on the Food & Drink lab: the choropleth needs room (the UK is a
   tall shape, and scroll-zoom wants headroom before the coastline leaves the
   frame); the demand/supply diagram matches it so the cards stay balanced. */
.chart.hero { height: 640px; }
/* Case-study pair: taller than .tall so the UK choropleth stays legible, and
   both cards use it so the grid row stays level. */
.chart.case { height: 545px; }
/* Phones keep the DESKTOP layout: every chart pair stays two-up (the user
   wants the phone page to mirror the regular site; for the slider-driven
   heroes it is also functional, both charts react at once). Chart heights
   derive from width so nothing looks stretched; js/compact.js reformats
   the Plotly internals (legends, titles, ticks) for narrow containers. */
@media (max-width: 920px) {
  .grid2 { gap: 10px; }
  .grid2 .card { padding: 8px; }
  .grid2 .card h3 { font-size: 12px; line-height: 1.3; }
  .grid2 .caption { font-size: 10.5px; }
  .chart, .chart.tall { height: auto; aspect-ratio: 1 / 1.05; }
  .chart.hero { height: auto; aspect-ratio: 1 / 1.35; }
  .chart.case { height: auto; aspect-ratio: 1 / 1.2; }
  .map-placeholder { height: 240px; }
}
/* Two-state switch above a chart (same look as the header domain toggle). */
.chart-switch {
  display: inline-flex; border: 1px solid var(--line); border-radius: 8px;
  overflow: hidden; margin: 2px 0 6px;
}
.chart-switch button {
  font: inherit; font-size: 12px; padding: 5px 11px; border: 0;
  background: #fff; color: var(--ink); cursor: pointer;
}
.chart-switch button + button { border-left: 1px solid var(--line); }
.chart-switch button.active { background: var(--orange); color: #fff; font-weight: bold; }
.card {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 14px;
}
/* Cards in a pair stretch to equal height; pinning the final caption (the
   Source line) to the bottom keeps the two Source lines level. */
.grid2 > .card { display: flex; flex-direction: column; }
.grid2 > .card > .caption:last-child { margin-top: auto; padding-top: 8px; }
/* And the chart in the shorter card of a pair stretches, so both plot areas
   run down to the level Source lines instead of leaving a gap. */
.grid2 > .card > .chart { flex-grow: 1; }
.card h3 { margin: 0 0 4px; font-size: 15px; }
.caption { font-size: 12px; color: var(--muted); margin: 8px 2px 0; }
/* 100% strip under the PCA chart: tide / rotation / local shares of true price variance */
.share-strip { display: flex; height: 24px; border-radius: 5px; overflow: hidden; margin: 8px 0 0;
  font-size: 12px; line-height: 24px; color: #fff; font-weight: bold; }
.share-strip div { text-align: center; white-space: nowrap; overflow: hidden; }
.share-key { font-size: 12px; color: var(--muted); display: flex; gap: 14px; flex-wrap: wrap; margin: 5px 2px 0; }
.share-key i { display: inline-block; width: 10px; height: 10px; margin-right: 5px; border-radius: 2px; vertical-align: -1px; }

.controls {
  display: flex; flex-wrap: wrap; gap: 20px; align-items: flex-end;
  background: #fff; border: 1px solid var(--line); border-radius: 10px;
  padding: 14px 16px; margin-bottom: 18px;
}
.control { min-width: 220px; flex: 1; }
.control label { display: block; font-size: 13px; font-weight: bold; }
.control .note { font-size: 11px; color: var(--muted); }
.control input[type="range"] { width: 100%; accent-color: var(--orange); }
.control .val { color: var(--orange); font-weight: bold; }
#btn-reset {
  font: inherit; padding: 8px 14px; border: 1px solid var(--line);
  background: #fff; border-radius: 6px; cursor: pointer;
}
#btn-reset:hover { border-color: var(--orange); color: var(--orange); }

.compare-label { font-size: 13.5px; color: var(--muted); margin: 0 0 10px; }
.compare-label b { color: var(--orange); }

/* Ordering panel (Spain heat). One SVG per product, three-up at every width
   (the slider moves all three at once). Cells share a viewBox so their dashed
   "normal July" lines align across the row; on narrow panels heat.js moves
   the labels out of the SVG into .stock-lbl so they stay crisp. */
#heat-stock { min-height: 300px; }
@media (max-width: 760px) { #heat-stock { min-height: 0; } }
.stock-key {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--gray); margin: 0 0 2px;
}
.stock-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stock-cell { max-width: 260px; width: 100%; margin: 0 auto; }
/* narrow panels: heat.js moves the cell labels out of the SVG into this */
.stock-lbl { text-align: center; font-size: 12px; line-height: 1.3; margin-top: 2px; color: var(--ink); }
@media (max-width: 760px) {
  .stock-row { gap: 6px; }
}

.readouts { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.chip {
  border: 1px solid var(--line); background: #fff; border-radius: 999px;
  padding: 6px 14px; font-size: 13px;
}
.chip b { color: var(--orange); }

.map-placeholder {
  height: 380px; border: 2px dashed var(--gray); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); text-align: center; padding: 20px; background: #fff;
}

.pricing { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; max-width: 760px; }
@media (max-width: 720px) { .pricing { grid-template-columns: 1fr; } }
.price-card {
  border: 1px solid var(--line); border-radius: 10px; padding: 20px;
  background: #fff;
}
.price-card.featured { border-color: var(--orange); }
.price-card .price { font-size: 30px; font-weight: bold; margin: 6px 0; }
/* request-only reports: the price line is a note, not a number */
.price-card .price.price-request { font-size: 13px; font-weight: normal; color: var(--muted); }
.price-card ul { margin: 10px 0 16px; padding-left: 18px; font-size: 14px; color: var(--muted); }
.btn-buy {
  font: inherit; width: 100%; padding: 10px; border: 0; border-radius: 6px;
  background: var(--orange); color: #fff; font-weight: bold; cursor: pointer;
}
.btn-buy:hover { filter: brightness(0.93); }
.btn-buy:disabled { opacity: 0.55; cursor: default; }
.btn-buy:disabled:hover { filter: none; }
/* Report-on-request button: a mailto link dressed as the buy button. Its own
   class so app.js's .btn-buy wiring (the flipbook stub) never attaches. */
a.btn-request {
  display: block; text-align: center; text-decoration: none;
  font: inherit; width: 100%; padding: 10px; border: 0; border-radius: 6px;
  background: var(--orange); color: #fff; font-weight: bold; cursor: pointer;
}
a.btn-request:hover { filter: brightness(0.93); }
.picker-row { display: flex; align-items: center; gap: 8px; margin-top: 18px; }
.draft-note { font-size: 12px; color: var(--muted); margin-top: 8px; }

footer {
  border-top: 1px solid var(--line); padding: 26px 0 40px;
  font-size: 12.5px; color: var(--muted);
}
footer p { margin: 6px 0; }

.wip-banner {
  background: var(--yellow); color: #3a2a00; font-size: 13px;
  text-align: center; padding: 6px 12px;
}

/* ---------- report flipbook ---------- */
.fb-overlay {
  position: fixed; inset: 0; z-index: 900;
  background: rgba(30, 26, 22, 0.82);
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 14px;
  opacity: 0; transition: opacity 0.2s ease;
}
.fb-overlay.fb-open { opacity: 1; }
.fb-bar {
  display: flex; align-items: center; gap: 18px;
  color: #fff5ee; font-size: 14px; width: min(92vw, 980px);
}
.fb-title { font-weight: bold; }
.fb-count { color: #cfc7bd; margin-left: auto; }
.fb-close {
  background: none; border: 0; color: #fff5ee; font-size: 30px;
  line-height: 1; cursor: pointer; padding: 0 4px;
}
.fb-stage-wrap { display: flex; align-items: center; gap: 10px; }
.fb-stage { position: relative; perspective: 2400px; }
.fb-leaf {
  position: absolute; top: 0; left: 50%;
  transform-style: preserve-3d; transform-origin: left center;
  transition: transform 0.62s cubic-bezier(0.42, 0, 0.24, 1);
  cursor: pointer;
}
.fb-leaf.fb-flipped { transform: rotateY(-180deg); }
.fb-face {
  position: absolute; inset: 0; backface-visibility: hidden;
  background: #fff; overflow: hidden;
}
.fb-face img { width: 100%; height: 100%; display: block; object-fit: contain; }
.fb-back { transform: rotateY(180deg); }
.fb-blank { background: #f4ede3; }
.fb-gate { display: grid; place-items: center; background: #fff5ee; }
.fb-gate-inner { text-align: center; padding: 24px; }
.fb-nav {
  background: rgba(255, 245, 238, 0.14); color: #fff5ee; border: 0;
  font-size: 30px; line-height: 1; width: 46px; height: 76px;
  border-radius: 8px; cursor: pointer;
}
.fb-nav:hover:not(:disabled) { background: rgba(255, 245, 238, 0.28); }
.fb-nav:disabled { opacity: 0.25; cursor: default; }
.fb-hint { color: #cfc7bd; font-size: 12px; }
@media (max-width: 700px) {
  .fb-nav { width: 34px; height: 60px; font-size: 22px; }
  .fb-hint { display: none; }
}
.fb-stage { transition: transform 0.62s cubic-bezier(0.42, 0, 0.24, 1); }
