/* ------------------------------------------------------------------
   Market Intelligence page. Loads after styles.css and uses its
   colours, type and buttons.
------------------------------------------------------------------- */
.mi-page {
  --s1: #b98a2c;   /* chart line 1: gold  */
  --s2: #4d8fe0;   /* chart line 2: blue  */
  --s3: #dd6656;   /* chart line 3: coral */
}
.mi-page .top { background: rgba(11, 17, 29, 0.92); }
.mi-page section[id] { scroll-margin-top: 84px; }

/* ---------- Hero ---------- */
.mi-hero {
  position: relative; min-height: min(72svh, 640px); display: flex; align-items: flex-end;
  padding: 150px var(--pad) clamp(40px, 6vw, 80px);
  background:
    linear-gradient(90deg, rgba(11,17,29,0.94) 0%, rgba(18,26,43,0.82) 45%, rgba(31,51,88,0.45) 100%),
    linear-gradient(180deg, rgba(11,17,29,0.55) 0%, rgba(11,17,29,0) 40%, rgba(11,17,29,0.9) 100%),
    url(assets/tower-bridge.jpg) 60% 45% / cover;
}
.mi-hero-copy { max-width: 46em; display: grid; gap: 18px; }
.mi-eyebrow { color: var(--gold); font-size: 14px; letter-spacing: 0.24em; text-transform: uppercase; font-weight: 400; }
.mi-hero h1 { font-size: clamp(40px, 6.4vw, 88px); letter-spacing: -0.015em; line-height: 1.04; }
.mi-hero-text { font-size: clamp(19px, 1.7vw, 24px); max-width: 28em; }
.mi-jump { display: flex; flex-wrap: wrap; gap: 6px 26px; margin-top: 10px; }
.mi-jump a { color: var(--stone); text-decoration: none; border-bottom: 1px solid var(--gold); padding: 12px 0 8px; font-size: 16px; }
.mi-jump a:hover { color: var(--gold); }

/* ---------- Sections ---------- */
.mi-section { padding: clamp(64px, 9vw, 120px) var(--pad); }
.mi-alt { background: var(--ink-2); }
.mi-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px 40px; align-items: end; margin-bottom: clamp(28px, 4vw, 48px); }
.mi-head-side { justify-self: end; display: grid; gap: 10px; justify-items: end; text-align: right; }
.mi-badge { display: inline-block; border: 1px solid var(--gold); color: var(--gold); padding: 6px 14px; font-size: 13px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 400; }
.mi-meta { color: var(--mute); font-size: 16px; max-width: 32em; }
.mi-unavailable { border: 1px solid var(--line); padding: 28px; font-size: 19px; }

/* ---------- Controls ---------- */
.mi-controls { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px; align-items: end; margin-bottom: 28px; }
.mi-field { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.mi-field label, .mi-field legend { font-size: 15px; color: var(--mute); padding: 0; display: flex; align-items: center; gap: 8px; }
.mi-field .opt { font-size: 13px; opacity: 0.8; }
.mi-key { width: 18px; height: 0; border-top: 3px solid var(--s1); flex: none; }
.mi-key-2 { border-top: 3px dashed var(--s2); }
.mi-key-3 { border-top: 3px dotted var(--s3); }
.mi-field select {
  width: 100%; min-height: 50px; padding: 10px 40px 10px 14px; font: inherit; font-size: 17px; color: var(--stone);
  background: var(--ink-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23c5a059' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 14px center;
  border: 1px solid var(--line); border-radius: 0; appearance: none; -webkit-appearance: none;
}
.mi-field select:hover { border-color: var(--gold); }
.mi-seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); min-height: 50px; }
.mi-seg label { position: relative; display: block; cursor: pointer; color: var(--stone); }
.mi-seg label + label { border-left: 1px solid var(--line); }
.mi-seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.mi-seg span { display: grid; place-items: center; height: 100%; min-height: 48px; font-size: 16px; padding: 0 6px; white-space: nowrap; }
.mi-seg input:checked + span { background: var(--gold); color: var(--ink); font-weight: 400; }
.mi-seg input:focus-visible + span { outline: 2px solid var(--gold); outline-offset: 3px; }

/* ---------- Summary cards ---------- */
.mi-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.mi-card { background: var(--ink-2); border: 1px solid var(--line); padding: 24px 26px; display: grid; gap: 4px; align-content: start; }
.mi-card-label { color: var(--mute); font-size: 15px; }
.mi-card-value { font-size: clamp(30px, 3.4vw, 46px); line-height: 1.1; font-weight: 300; }
.mi-card-value.is-none { font-size: 22px; color: var(--mute); padding: 8px 0; }
.mi-card-note { color: var(--mute); font-size: 15px; }
.mi-dir { font-size: 0.5em; vertical-align: 0.35em; margin-right: 8px; letter-spacing: 0.06em; text-transform: uppercase; font-weight: 400; }

/* ---------- Chart and tables ---------- */
.mi-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.mi-panel { background: var(--ink-2); border: 1px solid var(--line); padding: 24px 26px 22px; min-width: 0; }
.mi-panel-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.mi-panel-sub { color: var(--mute); font-size: 15px; margin-top: 4px; }
.mi-toggle { background: none; border: 1px solid var(--line); color: var(--stone); font: inherit; font-size: 15px; padding: 10px 16px; min-height: 44px; cursor: pointer; }
.mi-toggle:hover, .mi-toggle[aria-pressed="true"] { border-color: var(--gold); color: var(--gold); }
.mi-legend { display: flex; flex-wrap: wrap; gap: 6px 24px; margin: 16px 0 6px; font-size: 16px; }
.mi-legend li { display: flex; align-items: center; gap: 10px; }
.mi-legend i { width: 26px; height: 0; border-top: 3px solid var(--s1); flex: none; }
.mi-legend li:nth-child(2) i { border-top-style: dashed; border-color: var(--s2); }
.mi-legend li:nth-child(3) i { border-top-style: dotted; border-color: var(--s3); }
.mi-chart-wrap { position: relative; }
.mi-chart { touch-action: pan-y; outline-offset: 4px; }
.mi-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.mi-chart .grid { stroke: rgba(232, 227, 217, 0.12); stroke-width: 1; }
.mi-chart .axis-text { fill: var(--mute); font-size: 13px; font-family: var(--font); }
.mi-chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.mi-chart .l1 { stroke: var(--s1); }
.mi-chart .l2 { stroke: var(--s2); stroke-dasharray: 7 5; }
.mi-chart .l3 { stroke: var(--s3); stroke-dasharray: 1.5 5; }
.mi-chart .cross { stroke: var(--stone); stroke-width: 1; opacity: 0.55; }
.mi-chart .dot { stroke: var(--ink-2); stroke-width: 2; }
.mi-chart .d1 { fill: var(--s1); } .mi-chart .d2 { fill: var(--s2); } .mi-chart .d3 { fill: var(--s3); }
.mi-chart .empty { fill: var(--mute); font-size: 16px; font-family: var(--font); }
.mi-tip {
  position: absolute; top: 0; left: 0; z-index: 2; pointer-events: none; min-width: 190px; max-width: 260px;
  background: var(--ink); border: 1px solid var(--gold); padding: 12px 14px; font-size: 15px; line-height: 1.5;
}
.mi-tip strong { display: block; font-weight: 400; color: var(--gold); margin-bottom: 4px; }
.mi-tip span { display: flex; justify-content: space-between; gap: 16px; }
.mi-tip b { font-weight: 400; color: #fff; }
.mi-help { color: var(--mute); font-size: 14px; margin-top: 10px; }
.mi-readout { position: absolute; left: -9999px; }

.mi-table-wrap, .mi-glance-wrap { overflow-x: auto; margin-top: 14px; }
.mi-glance tr[hidden] { display: none; }
.mi-glance-more { margin-top: 18px; width: 100%; }
.mi-page table { width: 100%; border-collapse: collapse; font-size: 16px; }
.mi-page th, .mi-page td { text-align: right; padding: 11px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; font-weight: 300; }
.mi-page th:first-child, .mi-page td:first-child { text-align: left; padding-left: 0; white-space: normal; }
.mi-page thead th { background: var(--ink-2); color: var(--mute); font-size: 14px; font-weight: 400; z-index: 1; }
.mi-page tbody th { font-weight: 400; }
.mi-page td.is-none { color: var(--mute); }
.mi-glance tr.is-picked th, .mi-glance tr.is-picked td { color: var(--gold); }
.mi-move { display: inline-flex; align-items: baseline; gap: 6px; }
.mi-move small { font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mute); }

.mi-notes { margin-top: 26px; display: grid; gap: 12px; color: var(--mute); font-size: 16px; max-width: 62em; }
.mi-notes strong { color: var(--stone); font-weight: 400; }
.mi-source { font-size: 14px; }

/* ---------- News ---------- */
.mi-filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 28px; }
.mi-filters button { background: none; border: 1px solid var(--line); color: var(--stone); font: inherit; font-size: 16px; padding: 10px 18px; min-height: 46px; cursor: pointer; }
.mi-filters button:hover { border-color: var(--gold); }
.mi-filters button[aria-pressed="true"] { background: var(--gold); border-color: var(--gold); color: var(--ink); font-weight: 400; }
.mi-news { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.mi-article { background: var(--ink); border: 1px solid var(--line); border-top: 2px solid var(--gold); padding: 26px; display: flex; flex-direction: column; gap: 12px; }
.mi-article-cat { color: var(--gold); font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; font-weight: 400; }
.mi-article h3 { font-size: 23px; line-height: 1.25; font-weight: 400; }
.mi-article-meta { color: var(--mute); font-size: 15px; }
.mi-article p.mi-article-sum { font-size: 17px; flex: 1; }
.mi-news[data-r3="2"] .mi-article:first-child { grid-column: span 2; }
.mi-news[data-r3="1"] .mi-article:first-child { grid-column: 1 / -1; }
.mi-article:first-child h3 { font-size: clamp(23px, 2.2vw, 30px); }
.mi-empty { grid-column: 1 / -1; color: var(--mute); border: 1px solid var(--line); padding: 26px; }

/* ---------- Guides ---------- */
.mi-guides { display: grid; gap: 0; border-top: 1px solid var(--line); }
.mi-guide { border-bottom: 1px solid var(--line); }
.mi-guide summary { list-style: none; cursor: pointer; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 28px; gap: 8px 32px; align-items: center; padding: 26px 0; }
.mi-guide summary::-webkit-details-marker { display: none; }
.mi-guide summary::after { content: "+"; color: var(--gold); font-size: 30px; line-height: 1; justify-self: end; }
.mi-guide[open] summary::after { content: "\2212"; }
.mi-guide-title { font-size: clamp(22px, 2.4vw, 32px); }
.mi-guide-sub { color: var(--mute); font-size: 17px; }
.mi-guide summary:hover .mi-guide-title { color: var(--gold); }
.mi-guide-body { display: grid; gap: 12px; padding: 0 0 34px; max-width: 46em; }
.mi-tag { color: var(--gold); font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase; font-weight: 400; margin-top: 10px; }
.mi-sources { display: grid; gap: 8px; margin-top: 10px; padding-top: 16px; border-top: 1px solid var(--line); font-size: 16px; }
.mi-sources a { color: var(--gold); text-underline-offset: 4px; }
.mi-sources span { display: block; color: var(--mute); font-size: 14px; }
.mi-caution { color: var(--mute); font-size: 15px; }
.mi-guide-body .btn { margin-top: 8px; }

/* ---------- Calls to action ---------- */
.mi-speak { background: var(--navy); padding: clamp(56px, 8vw, 110px) var(--pad); display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(32px, 6vw, 90px); align-items: center; }
.mi-speak-copy { display: grid; gap: 18px; justify-items: start; }
.mi-speak-copy p { font-size: 20px; }
.mi-speak-links { display: grid; gap: 0; border-top: 1px solid rgba(232, 227, 217, 0.3); }
.mi-speak-links a { display: grid; gap: 2px; padding: 20px 34px 20px 0; text-decoration: none; border-bottom: 1px solid rgba(232, 227, 217, 0.3); position: relative; }
.mi-speak-links a::after { content: "\2192"; position: absolute; right: 2px; top: 50%; transform: translateY(-50%); color: var(--gold); font-size: 22px; }
.mi-speak-links strong { font-weight: 400; font-size: 21px; }
.mi-speak-links span { color: #c9d0de; font-size: 16px; }
.mi-speak-links a:hover strong { color: var(--gold); }

/* ---------- Smaller screens ---------- */
@media (max-width: 1100px) {
  .mi-controls { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mi-period { grid-column: span 2; }
  .mi-grid { grid-template-columns: minmax(0, 1fr); }
  .mi-news { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mi-news[data-r3] .mi-article:first-child { grid-column: auto; }
  .mi-news[data-r2="1"] .mi-article:first-child { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  .mi-hero { padding-top: 120px; min-height: 0; }
  .mi-head { grid-template-columns: minmax(0, 1fr); align-items: start; }
  .mi-head-side { justify-self: start; justify-items: start; text-align: left; }
  .mi-controls { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .mi-period { grid-column: auto; }
  .mi-cards { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .mi-card, .mi-panel { padding: 20px 18px; }
  .mi-news { grid-template-columns: minmax(0, 1fr); }
  .mi-news[data-r2] .mi-article:first-child, .mi-news[data-r3] .mi-article:first-child { grid-column: auto; }
  .mi-guide summary { grid-template-columns: minmax(0, 1fr) 28px; }
  .mi-guide-sub { grid-column: 1; grid-row: 2; }
  .mi-guide summary::after { grid-row: 1 / span 2; grid-column: 2; }
  .mi-speak { grid-template-columns: minmax(0, 1fr); }
  .mi-page th, .mi-page td { padding: 11px 8px; font-size: 15px; }
  .mi-tip { font-size: 14px; }
  .mi-glance td { white-space: normal; }
  .mi-move { flex-wrap: wrap; justify-content: flex-end; column-gap: 6px; row-gap: 0; }
  .mi-move small { flex-basis: 100%; text-align: right; }
}
@media (prefers-reduced-motion: reduce) {
  .mi-page * { transition: none !important; animation: none !important; }
}
@media (forced-colors: active) {
  .mi-chart .line { stroke: CanvasText; }
  .mi-seg input:checked + span, .mi-filters button[aria-pressed="true"] { outline: 2px solid Highlight; }
}
