/* Meridian Portal. Navy ground, saffron meridian, mono numerals. Fills the whole screen. */

:root {
  --bg: #070f20;
  --panel: #0b1529;
  --panel-2: #0f1b33;
  --line: #1a2945;
  --line-2: #24375a;
  --ink: #e9eef8;
  --ink-2: #aebbd3;
  --ink-3: #6f7f9e;
  --saffron: #e8912a;
  --saffron-soft: rgba(232, 145, 42, 0.12);
  --up: #3ccf91;
  --down: #ff6b6b;
  --sans: "Inter", ui-sans-serif, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
a { color: inherit; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; text-align: left; }
:focus-visible { outline: 1px solid var(--saffron); outline-offset: 1px; }

.term {
  display: grid;
  grid-template-rows: 48px 40px minmax(0, 1fr) 28px;
  height: 100vh;
  height: 100dvh;
}

/* Top bar */
.bar { display: flex; align-items: center; gap: 20px; padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: none; }
.logo svg { width: 22px; height: 22px; }
.logo b { font-weight: 500; letter-spacing: -0.01em; }
.logo span { font-family: var(--mono); font-size: 11px; color: var(--saffron); letter-spacing: 0.08em; }
.cmd { flex: 1; max-width: 560px; display: flex; align-items: center; height: 30px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line-2); border-radius: 4px; }
.cmd:focus-within { box-shadow: inset 0 0 0 1px var(--saffron); }
.cmd label { font-family: var(--mono); color: var(--saffron); padding: 0 8px 0 10px; font-size: 13px; }
.cmd input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: 0; color: var(--ink); font: 400 13px var(--mono); text-transform: uppercase; }
.cmd input::placeholder { color: var(--ink-3); text-transform: none; font-family: var(--sans); }
.cmd button { height: 100%; padding: 0 12px; font: 500 12px var(--mono); color: var(--bg); background: var(--saffron); border-radius: 0 4px 4px 0; letter-spacing: 0.04em; }
.clocks { display: flex; gap: 16px; margin-left: auto; font-family: var(--mono); font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.clock b { font-weight: 400; color: var(--ink-3); margin-right: 6px; }
.clock-ist { color: var(--ink); }
.clock-ist b { color: var(--saffron); }
.live { display: flex; align-items: center; gap: 7px; font: 500 11px var(--mono); letter-spacing: 0.08em; color: var(--up); flex: none; }
.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px rgba(60, 207, 145, 0.18); animation: blink 2s infinite; }
.live.is-down { color: var(--down); }
@keyframes blink { 50% { opacity: 0.35; } }

/* Market tape */
.tape { display: flex; list-style: none; margin: 0; padding: 0; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; background: var(--bg); }
.tape::-webkit-scrollbar { display: none; }
.tape li { display: flex; align-items: center; gap: 10px; padding: 0 18px; border-right: 1px solid var(--line); white-space: nowrap; font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; flex: 1 0 auto; }
.q-label { color: var(--ink-3); }
.q-price { color: var(--ink); }
.up .q-chg { color: var(--up); }
.down .q-chg { color: var(--down); }
.tape svg { width: 44px; height: 14px; }
.q-off { color: var(--ink-3); }

/* Main grid */
.main { display: grid; grid-template-columns: minmax(320px, 26vw) minmax(0, 1fr) minmax(380px, 30vw); min-height: 0; }
.col { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.col:last-child { border-right: 0; }
.col-head { display: flex; align-items: center; justify-content: space-between; height: 36px; padding: 0 14px; border-bottom: 1px solid var(--line); font: 500 11px var(--mono); letter-spacing: 0.08em; color: var(--ink-3); flex: none; }
.col-head b { color: var(--ink); font-weight: 500; }

.wire { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.wire-item { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 10px; width: 100%; padding: 12px 14px 12px 12px; border-bottom: 1px solid var(--line); border-left: 2px solid transparent; transition: background 0.15s; }
.wire-item:hover { background: var(--panel); }
.wire-item.is-on { background: var(--panel-2); border-left-color: var(--cat); }
.wire-item.is-fresh { animation: fresh 8s ease-out; }
@keyframes fresh { 0%, 30% { background: var(--saffron-soft); } 100% { background: transparent; } }
.wire-time { font: 400 12px var(--mono); color: var(--ink-3); padding-top: 1px; font-variant-numeric: tabular-nums; }
.wire-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.wire-meta { display: flex; gap: 8px; font: 400 11px var(--mono); color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.03em; }
.wire-meta span:first-of-type { color: var(--cat); }
.wire-breaking { color: var(--saffron); font-weight: 500; }
.wire-head { font-size: 14px; line-height: 1.4; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.wire-item.is-on .wire-head, .wire-item:hover .wire-head { color: var(--ink); }
.wire-empty { padding: 20px 14px; color: var(--ink-3); }

/* Globe */
.stage { position: relative; display: flex; flex-direction: column; min-height: 0; background: radial-gradient(ellipse at 50% 45%, #0e1d3a 0%, var(--bg) 70%); }
.stage-canvas { flex: 1; min-height: 0; display: grid; place-items: center; padding: 20px; }
.stage-canvas canvas { width: min(100%, calc(100dvh - 200px)); max-width: 820px; aspect-ratio: 1; opacity: 0; transition: opacity 0.8s; touch-action: none; cursor: grab; }
.stage-canvas canvas.is-ready { opacity: 1; }
.stage-note { position: absolute; top: 14px; left: 16px; font: 400 11px var(--mono); color: var(--ink-3); letter-spacing: 0.04em; line-height: 1.7; pointer-events: none; }
.stage-note b { color: var(--saffron); font-weight: 400; }
.keys { display: flex; gap: 6px; justify-content: center; padding: 10px 12px; overflow-x: auto; scrollbar-width: none; border-top: 1px solid var(--line); background: rgba(7, 15, 32, 0.6); }
.key { display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 9px; flex: none; white-space: nowrap; border-radius: 4px; box-shadow: inset 0 0 0 1px var(--line-2); font: 400 12px var(--mono); color: var(--ink-2); }
.key i { font-style: normal; color: var(--ink-3); font-size: 10px; }
.key s { text-decoration: none; width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--ink-3)); }
.key:hover { color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink-3); }
.key.is-on { background: var(--ink); color: var(--bg); box-shadow: none; }
.key.is-on i { color: var(--bg); }

/* Story pane */
.pane { overflow-y: auto; flex: 1; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.pane-close { display: none; }
.pane-empty { padding: 28px 20px; color: var(--ink-3); }
.pane-keys { margin-top: 12px; font-size: 12px; }
kbd { font: 400 11px var(--mono); padding: 1px 6px; border-radius: 3px; box-shadow: inset 0 0 0 1px var(--line-2); color: var(--ink-2); margin-right: 4px; }
.story { padding: 20px 20px 32px; }
.story-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; margin: 0 0 12px; font: 400 11px var(--mono); color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.03em; }
.story-meta .cat { color: var(--cat); }
.story h2 { font-size: clamp(20px, 1.7vw, 26px); line-height: 1.2; letter-spacing: -0.025em; font-weight: 400; margin: 0 0 16px; }
.story-lens { background: var(--saffron-soft); border-left: 2px solid var(--saffron); padding: 10px 14px; margin-bottom: 18px; border-radius: 0 4px 4px 0; }
.story-lens span { display: block; font: 500 10px var(--mono); letter-spacing: 0.08em; color: var(--saffron); text-transform: uppercase; margin-bottom: 3px; }
.story-lens p { margin: 0; color: var(--ink); font-size: 14px; }
.story figure { margin: 0 0 18px; }
.story img { width: 100%; max-height: 300px; object-fit: cover; object-position: 50% 20%; border-radius: 4px; display: block; background: var(--panel); }
.story figcaption { margin-top: 6px; font-size: 11px; color: var(--ink-3); }
.story figcaption a { color: var(--ink-3); }
.story-body p { margin: 0 0 12px; color: var(--ink-2); font-size: 15px; line-height: 1.6; }
.story h3 { font: 500 11px var(--mono); letter-spacing: 0.08em; color: var(--ink-3); margin: 22px 0 6px; }
.story-sources { list-style: none; margin: 0; padding: 0; }
.story-sources a { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: var(--ink-2); font-size: 13px; }
.story-sources a:hover { color: var(--ink); }
.story-sources span { color: var(--ink-3); }
.story-actions { display: flex; align-items: center; gap: 8px; margin-top: 20px; }
.tbtn { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border-radius: 4px; box-shadow: inset 0 0 0 1px var(--line-2); font: 500 12px var(--mono); text-decoration: none; color: var(--ink); }
.tbtn:hover { box-shadow: inset 0 0 0 1px var(--saffron); color: var(--saffron); }
.story-ago { margin-left: auto; font: 400 11px var(--mono); color: var(--ink-3); }

/* Status bar */
.status { display: flex; align-items: center; gap: 18px; padding: 0 16px; border-top: 1px solid var(--line); background: var(--panel); font: 400 11px var(--mono); color: var(--ink-3); white-space: nowrap; overflow: hidden; }
.status a { text-decoration: none; }
.status a:hover { color: var(--ink); }
.status .push { margin-left: auto; }

@media (max-width: 1280px) {
  .clocks .clock:nth-child(n + 4) { display: none; }
}
@media (max-width: 1100px) {
  body { overflow: auto; }
  .term { height: auto; min-height: 100dvh; grid-template-rows: auto 40px auto auto; }
  .bar { flex-wrap: wrap; padding: 10px 12px; gap: 10px; }
  .cmd { order: 3; flex-basis: 100%; max-width: none; }
  .clocks { gap: 12px; }
  .clocks .clock:nth-child(n + 2) { display: none; }
  .main { grid-template-columns: 1fr; }
  .col { border-right: 0; }
  .stage { order: -1; border-bottom: 1px solid var(--line); }
  .stage-canvas canvas { width: min(100%, 520px); }
  .wire { overflow: visible; }
  .col-pane { position: fixed; inset: 0; z-index: 30; background: var(--bg); transform: translateY(100%); transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1); }
  .pane-open .col-pane { transform: none; }
  .pane-close { display: inline-flex; color: var(--ink); font: 500 12px var(--mono); }
  .status { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
