/* ==========================================================================
   Urja Investment — live market layer: TradingView frames, search, stock pages
   ========================================================================== */

.mktsplit { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.mktsplit--wide { margin-bottom: 18px; }
.tvframe--tall { margin-top: 0; }

/* ---------- index tiles ---------- */
.idxrow { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 16px; }
.idxrow--home { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.idxtile { min-width: 0; padding: 6px; border-radius: 4px 24px 4px 24px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-soft); transition: transform .35s var(--ease-out), box-shadow .35s var(--ease-out); }
.idxtile:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.idxtile__blurb { padding: 4px 14px 12px; font-size: .78rem; line-height: 1.45; color: var(--text-soft); }

/* ---------- search ---------- */
.ssearch { position: relative; }
.ssearch__field { display: flex; align-items: center; gap: 14px; padding: 0 18px; border-radius: 4px 22px 4px 22px; background: var(--surface); border: 1px solid var(--line); transition: border-color .2s ease, box-shadow .2s ease; }
.ssearch__field:focus-within { border-color: var(--gold-deep); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 26%, transparent); }
.ssearch__field svg { width: 22px; height: 22px; flex: none; color: var(--bronze); }
.ssearch__field input { flex: 1; min-width: 0; padding: 17px 0; border: 0; outline: 0; background: none; font: inherit; font-size: 1.02rem; color: var(--text); }
.ssearch__field input::-webkit-search-cancel-button { -webkit-appearance: none; }
.ssearch__kbd { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 3px 9px 3px 9px; border: 1px solid var(--line); background: var(--bg); font-family: var(--font-body); font-size: .8rem; font-weight: 600; color: var(--slate); }
.ssearch__hint { margin-top: 8px; font-size: .78rem; color: var(--slate); }
.ssearch__list { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 8px); max-height: 60vh; overflow-y: auto; padding: 8px; border-radius: 4px 22px 4px 22px; background: var(--surface); border: 1px solid rgba(176, 122, 35, .26); box-shadow: 0 40px 70px -34px rgba(10, 21, 28, .55); }
.ssearch__list[hidden] { display: none; }
.ssearch__list a { display: grid; grid-template-columns: minmax(78px, auto) minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 11px 14px; border-radius: 3px 16px 3px 16px; }
.ssearch__list li.is-active a, .ssearch__list a:hover { background: color-mix(in srgb, var(--gold) 14%, var(--surface)); }
.ssearch__list b { font-weight: 700; font-size: .92rem; letter-spacing: .02em; }
.ssearch__list span { font-size: .9rem; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ssearch__list i { font-style: normal; font-size: .72rem; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--bronze); white-space: nowrap; }
.ssearch__list i.is-muted { color: var(--slate); }
.ssearch__empty { padding: 16px 14px; font-size: .9rem; color: var(--text-soft); }

.mktsearch { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr); gap: clamp(20px, 4vw, 56px); align-items: center; padding: clamp(22px, 3vw, 38px); border-radius: 8px clamp(30px, 4vw, 52px) 8px clamp(30px, 4vw, 52px); background: linear-gradient(150deg, color-mix(in srgb, var(--gold) 14%, var(--surface)), var(--surface)); border: 1px solid rgba(176, 122, 35, .22); }
.mktsearch--compact { padding: clamp(18px, 2vw, 26px); }
.mktsearch__copy h2 { margin: 10px 0 8px; font-size: clamp(1.4rem, 2.4vw, 2rem); }
.mktsearch__copy p { font-size: .92rem; color: var(--text-soft); }
.mktsearch__box { min-width: 0; }
.mktsearch__chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.mktsearch__chips a { display: block; padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: .8rem; font-weight: 600; }
.mktsearch__chips a:hover { border-color: var(--gold-deep); color: var(--gold-deep); }
.homesearch { max-width: 620px; margin-top: 20px; }

/* ---------- stock chips & directory ---------- */
.stockgrid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.stockgrid--tight { grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 8px; }
.stockchip { display: grid; gap: 2px; padding: 14px 16px; min-width: 0; border-radius: 4px 18px 4px 18px; background: var(--surface); border: 1px solid var(--line); transition: transform .3s var(--ease-out), border-color .25s ease, box-shadow .3s var(--ease-out); }
.stockchip:hover { transform: translateY(-3px); border-color: var(--gold-deep); box-shadow: var(--shadow-soft); }
.stockchip b { font-size: .92rem; font-weight: 700; letter-spacing: .02em; }
.stockchip span { font-size: .8rem; color: var(--text-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stockchip i { font-style: normal; font-size: .68rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--bronze); }
.dirsectors { display: grid; gap: 10px; }
.dirsector { border-radius: 4px 22px 4px 22px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.dirsector summary { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 22px; cursor: pointer; font-weight: 700; font-size: 1.02rem; list-style: none; }
.dirsector summary::-webkit-details-marker { display: none; }
.dirsector summary b { font-size: .82rem; font-weight: 600; color: var(--bronze); }
.dirsector[open] summary { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--gold) 10%, transparent); }
.dirsector .stockgrid { padding: 14px 18px 18px; }
.dirgroup { margin-top: 26px; scroll-margin-top: calc(var(--nav-h) + 20px); }
.dirgroup .ggroup__letter { margin-bottom: 12px; font-size: clamp(1.8rem, 3vw, 2.6rem); }

/* ---------- stock page header ---------- */
.shead { padding: clamp(20px, 3vw, 34px) 0 clamp(18px, 2.4vw, 28px); background: radial-gradient(80% 160% at 100% 0%, color-mix(in srgb, var(--gold) 26%, var(--bg-warm)), var(--bg-warm) 62%); border-bottom: 1px solid var(--line); }
.shead__row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(280px, 420px); gap: clamp(20px, 3vw, 44px); align-items: center; }
.shead__exch { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--bronze); }
.shead__badge { display: inline-block; padding: 4px 10px; border-radius: 3px 10px 3px 10px; background: var(--navy); color: var(--gold); font-size: .7rem; letter-spacing: .1em; }
.shead__tag { padding: 3px 10px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--gold-deep) 40%, transparent); color: var(--gold-deep); font-size: .66rem; }
.shead h1 { margin: 10px 0 6px; font-size: clamp(1.8rem, 3.8vw, 3rem); line-height: 1.04; }
.shead__sym { font-size: .92rem; font-weight: 600; color: var(--text-soft); }
.shead__quote { min-width: 0; padding: 6px 10px; border-radius: 4px 22px 4px 22px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-soft); }
.shead__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 22px; }
.shead__call { display: inline-flex; align-items: center; gap: 10px; font-size: .9rem; font-weight: 600; color: var(--text); }
.shead__call:hover { color: var(--gold-deep); }

@media (max-width: 1180px) {
  .idxrow, .idxrow--home { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stockgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mktsplit { grid-template-columns: 1fr; }
  .mktsearch { grid-template-columns: 1fr; }
  .shead__row { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .stockgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tvframe { border-radius: 4px 22px 4px 22px; padding: 6px; }
  .idxtile__blurb { display: none; }
}
@media (max-width: 480px) {
  .idxrow, .idxrow--home, .stockgrid, .stockgrid--tight { grid-template-columns: 1fr; }
  .ssearch__kbd { display: none; }
  .ssearch__list a { grid-template-columns: minmax(70px, auto) minmax(0, 1fr); }
  .ssearch__list i { display: none; }
  .shead__actions .btn { flex: 1 1 100%; }
  .dirsector summary { padding: 14px 16px; font-size: .94rem; }
}

/* narrow-screen guards */
.chartcard, .idxtile, .mktsearch, .mktsearch__box, .ssearch, .shead__quote, .stockchip, .qtile { min-width: 0; max-width: 100%; }
.shead__row > *, .mktsplit > * { min-width: 0; }

/* the fixed mobile CTA bar must shrink with the viewport, not set the page width */
.stickycta { max-width: 100vw; box-sizing: border-box; }
.stickycta > * { min-width: 0; }
.stickycta__call { flex: 0 1 auto; overflow: hidden; }
.stickycta__call span { overflow: hidden; text-overflow: ellipsis; }
.stickycta .btn { flex: 1 1 auto; min-width: 0; white-space: normal; }
@media (max-width: 400px) { .stickycta__call span { display: none; } }
/* belt and braces: nothing may create a horizontal scroll at any width */
html { overflow-x: clip; max-width: 100%; }
body { overflow-x: clip; max-width: 100%; }

/* ==========================================================================
   Own-brand market UI (replaces the third-party widgets)
   ========================================================================== */
.mockbadge { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px; background: color-mix(in srgb, var(--gold) 20%, var(--surface)); border: 1px solid color-mix(in srgb, var(--gold-deep) 35%, transparent); font-size: .78rem; font-weight: 600; color: var(--bronze); }
.mockbadge::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--gold-deep); }

/* quote tiles */
.qtile { position: relative; display: block; min-width: 0; padding: 18px 20px; border-radius: 4px 22px 4px 22px; background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-soft); transition: transform .3s var(--ease-out), border-color .25s ease; }
a.qtile:hover { transform: translateY(-3px); border-color: var(--gold-deep); }
.qtile__name { font-size: .82rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-soft); }
.qtile__last { font-size: clamp(1.3rem, 2.1vw, 1.75rem); font-weight: 800; letter-spacing: -.03em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.qtile__chg { font-size: .84rem; font-weight: 600; font-variant-numeric: tabular-nums; min-height: 1.2em; }
.qtile__blurb { margin-top: 8px; font-size: .78rem; line-height: 1.45; color: var(--text-soft); }
.qtile[data-dir="up"] .qtile__chg { color: var(--gain); }
.qtile[data-dir="down"] .qtile__chg { color: var(--loss); }
.qtile[data-dir="flat"] .qtile__chg { color: var(--slate); }
.qtile[data-state="loading"] .qtile__last { color: var(--line); }
.qtile[data-state="loading"] .qtile__last::after { content: '••••'; letter-spacing: .1em; }
.qtile[data-state="error"] .qtile__chg::after { content: 'Live price unavailable'; color: var(--slate); font-weight: 500; }
.qtile__state { position: absolute; top: 16px; right: 18px; width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.qtile[data-state="live"] .qtile__state { background: var(--gain); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gain) 18%, transparent); }
.qtile--big .qtile__last { font-size: clamp(1.9rem, 3.4vw, 2.8rem); }

/* chart */
.chartcard { margin: 0; border-radius: 6px 30px 6px 30px; background: var(--surface); border: 1px solid rgba(176, 122, 35, .22); box-shadow: 0 30px 60px -44px rgba(16, 34, 46, .45); overflow: hidden; }
.chartcard__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 18px; padding: 20px 24px 14px; }
.chartcard__title { font-family: var(--font-display); font-size: 1.15rem; font-weight: 800; letter-spacing: -.02em; }
.ch__meta { font-size: .84rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--slate); }
.ch__meta.is-up { color: var(--gain); } .ch__meta.is-down { color: var(--loss); }
.chartcard .rangetabs { background: var(--bg); }
.chartcard .rangetabs button { color: var(--text-soft); }
.chartcard .rangetabs button.is-active { background: linear-gradient(135deg, var(--cta-from), var(--cta-to)); color: #FFF8EA; }
.ch { position: relative; padding: 4px 18px 14px; min-height: 300px; }
.ch svg { width: 100%; height: clamp(250px, 30vw, 360px); display: block; overflow: visible; }
.ch__grid { stroke: var(--line); stroke-width: 1; shape-rendering: crispEdges; }
/* 1:1 viewBox, so these are real pixels and the type is never distorted */
.ch__ylabel, .ch__xlabel { fill: var(--slate); font-family: var(--font-body); font-size: 12px; font-weight: 500; font-variant-numeric: tabular-nums; letter-spacing: 0; }
.ch__ylabel { text-anchor: start; dominant-baseline: middle; }
.ch__xlabel { text-anchor: middle; }
.ch__msg { position: absolute; inset: 0; display: none; place-content: center; text-align: center; padding: 24px; font-size: .92rem; color: var(--text-soft); }
.ch[data-state="loading"] .ch__msg--loading, .ch[data-state="error"] .ch__msg--error, .ch[data-state="empty"] .ch__msg--empty { display: grid; }
.ch[data-state="loading"] svg, .ch[data-state="error"] svg, .ch[data-state="empty"] svg { opacity: .15; }
.ch__msg a { color: var(--gold-deep); text-decoration: underline; }

/* strips */
.qstrip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.qbar { display: flex; gap: 10px; overflow-x: auto; scrollbar-width: none; padding: 12px 0; }
.qbar::-webkit-scrollbar { display: none; }
.qbar .qtile { flex: 0 0 auto; min-width: 200px; }
.ohlc { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0; margin-top: 20px; border-radius: 4px 20px 4px 20px; background: var(--surface); border: 1px solid var(--line); overflow: hidden; }
.ohlc div { padding: 14px 16px; border-left: 1px solid var(--line); min-width: 0; }
.ohlc div:first-child { border-left: 0; }
.ohlc dt { font-size: .7rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--bronze); }
.ohlc dd { margin: 4px 0 0; font-size: 1.02rem; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 900px) { .qstrip { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ohlc { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ohlc div:nth-child(odd) { border-left: 0; } .ohlc div:nth-child(n+3) { border-top: 1px solid var(--line); } }
@media (max-width: 480px) { .qstrip { grid-template-columns: 1fr; } .ohlc { grid-template-columns: 1fr; } .ohlc div { border-left: 0; border-top: 1px solid var(--line); } }

/* breathing room where the search card is followed by the data disclosure */
.mktsearch + .prose__note, .ssearch + .prose__note { margin-top: 22px; }
.mktsearch--compact + .prose__note { margin-top: 18px; }
.sec--tight .prose__note { margin-bottom: 4px; }
.chartcard + .ohlc { margin-top: 18px; }
.ohlc + .mockbadge { margin-top: 18px; }

/* a tile says for itself whether its number is a live price or a sample */
.qtile[data-feed="sample"] .qtile__state { background: var(--gold-deep); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gold) 22%, transparent); }
.qtile[data-feed="sample"]::after { content: 'sample'; position: absolute; right: 16px; bottom: 12px; font-size: .6rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--bronze); opacity: .75; }
.qtile[data-feed="live"] .qtile__state { background: var(--gain); box-shadow: 0 0 0 4px color-mix(in srgb, var(--gain) 18%, transparent); }
.mockbadge { line-height: 1.45; text-align: left; }
