/*
 * Informa AI orbital layer (orbital.js, globe.js). Loads after command.css on every page.
 * Holds the planet palette, the aurora field, the comet overlay, region signal edges on
 * story cards and the pinned-story "absorb" ring. All motion stops with the site's motion
 * switch, reduced motion, forced colours and print.
 */

/* ---------- Planet palette (read by globe.js) ---------- */
:root {
  --globe-ocean: #13407e; --globe-ocean-deep: #030b20; --globe-land-tint: #2b78c9;
  --globe-dot: #a8f1ff; --globe-city: #ffe2a0; --globe-rim: #67d6ff;
  --aurora-a: #6ec3ff; --aurora-b: #00d0ef; --aurora-c: #3d7cff;
  --region-NA: #38bdf8; --region-LatAm: #2dd4bf; --region-EU: #60a5fa;
  --region-Africa: #22d3ee; --region-MENA: #7dd3fc; --region-APAC: #0ea5e9;
}
:root[data-theme="dark"] { --aurora-a: #0f4fa3; --aurora-b: #06b6d4; --aurora-c: #4f8dfb; }

/* The shader now draws the planet, its halo and the dawn line; the CSS disc stays only as
   the fallback when WebGL is unavailable. */
.signal-globe.is-live::before, .command-deck .signal-globe.is-live::before {
  background: radial-gradient(circle, #22d3ee1c 0 38%, transparent 62%);
  box-shadow: none; inset: 4%;
}
@media (min-width: 1101px) { .command-deck .signal-globe.is-live { --globe-size: clamp(380px, 35vw, 540px); } }
.command-deck .signal-globe.is-live::after { inset: 4%; border-color: #7dd3fc24; outline-offset: 26px; }

/* ---------- Aurora field (orbital.js) ---------- */
.aurora-field {
  position: fixed; inset: 0; z-index: -2; width: 100vw; height: 100vh; pointer-events: none;
  opacity: 0; animation: orbital-fade-in 1400ms ease-out 120ms forwards;
}
:root[data-motion="off"] .aurora-field { display: none; }
@keyframes orbital-fade-in { to { opacity: 1; } }

/* ---------- Comets, sparks and the warp-in ---------- */
.orbital-overlay { position: fixed; inset: 0; z-index: 2147483000; width: 100vw; height: 100vh; pointer-events: none; }

/* The Brief Builder takes in a pinned story with a ring of light. */
.orbital-absorb { animation: orbital-absorb 820ms cubic-bezier(.2, .9, .2, 1); }
@keyframes orbital-absorb {
  0% { box-shadow: 0 0 0 0 #22d3eecc, 0 0 0 0 #38bdf880; scale: 1; }
  25% { scale: 1.08; }
  100% { box-shadow: 0 0 0 16px #22d3ee00, 0 0 34px 8px #38bdf800; scale: 1; }
}

/* ---------- Decoding headlines ---------- */
[data-decoding] { font-variant-ligatures: none; }

/* ---------- Region signal edges on story cards ---------- */
.reading .stories:not(.story-list) > .story[data-region] {
  --region-hue: var(--region-NA);
  box-shadow: var(--sys-e1), inset 0 1px 0 var(--edge-highlight), inset 0 2px 0 color-mix(in srgb, var(--region-hue) 70%, transparent);
}
.reading .story[data-region="LatAm"] { --region-hue: var(--region-LatAm); }
.reading .story[data-region="EU"] { --region-hue: var(--region-EU); }
.reading .story[data-region="Africa"] { --region-hue: var(--region-Africa); }
.reading .story[data-region="MENA"] { --region-hue: var(--region-MENA); }
.reading .story[data-region="APAC"] { --region-hue: var(--region-APAC); }
@media (hover: hover) and (pointer: fine) {
  .reading .stories:not(.story-list) > .story[data-region]:hover {
    box-shadow: var(--sys-e2), inset 0 1px 0 var(--edge-highlight), inset 0 2px 0 var(--region-hue), 0 18px 40px -26px var(--region-hue);
  }
}

/* ---------- Catch up: one card per development (catchup-cards.js) ---------- */
#home-catchup.briefing-intro {
  display: block; padding: 0; border: 0; background: none; box-shadow: none; margin-bottom: 22px;
}
#home-catchup > .briefing-overview {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px;
  padding: 14px 18px; border: 1px solid var(--line); border-radius: 14px; background: var(--sys-card); box-shadow: var(--sys-e1);
}
#home-catchup-status { margin: 0; max-width: none; color: var(--ink); font: 600 14px/1.4 var(--font-ui); }
#home-catchup .briefing-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 0; }
#home-catchup .briefing-actions .text-button { font-size: 13px; }
#home-catchup-freshness:empty { display: none; }
#home-catchup-freshness .reader-freshness {
  margin: 10px 0 0; padding: 8px 14px; border: 1px solid color-mix(in srgb, #f59e0b 30%, var(--line)); border-radius: 10px;
  background: color-mix(in srgb, #f59e0b 7%, var(--paper)); color: var(--muted); font-size: 12.5px;
}
#home-catchup-freshness .reader-freshness summary { cursor: pointer; color: var(--ink); font-weight: 600; }
#home-catchup-freshness .reader-freshness p, #home-catchup-freshness .reader-freshness strong { display: block; margin: 6px 0 0; }

#home-catchup-results {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 14px; margin-top: 14px;
}
#home-catchup-results > .button { justify-self: start; }
.catchup-card {
  position: relative; display: flex; flex-direction: column; gap: 10px; min-width: 0; margin: 0;
  padding: 18px 18px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--sys-card);
  box-shadow: var(--sys-e1), inset 0 2px 0 color-mix(in srgb, var(--sys-signal) 55%, transparent);
  overflow-wrap: anywhere; transition: transform 220ms var(--sys-curve, ease), box-shadow 220ms, border-color 200ms;
}
.catchup-card[data-change="updated"] { box-shadow: var(--sys-e1), inset 0 2px 0 color-mix(in srgb, #f59e0b 70%, transparent); }
@media (hover: hover) and (pointer: fine) {
  .catchup-card:hover { transform: translateY(-2px); box-shadow: var(--sys-e2); border-color: var(--accent-line); }
}
.catchup-card-head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.catchup-badge {
  flex: none; padding: 3px 9px; border-radius: 999px; font: 700 10.5px/1.3 var(--font-ui); letter-spacing: .06em; text-transform: uppercase;
  background: var(--sys-signal-soft); color: var(--green);
}
.catchup-card[data-change="updated"] .catchup-badge { background: color-mix(in srgb, #f59e0b 16%, var(--paper)); color: #92400e; }
:root[data-theme="dark"] .catchup-card[data-change="updated"] .catchup-badge { color: #fcd34d; }
.catchup-topic {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 3px 9px; border: 1px solid var(--line);
  border-radius: 999px; color: var(--muted); font: 600 11px/1.3 var(--font-ui);
}
.catchup-time { margin-left: auto; flex: none; color: var(--muted); font: 500 12px/1.3 var(--font-ui); font-variant-numeric: tabular-nums; }
.catchup-title { margin: 0; font: 400 21px/1.22 var(--serif); letter-spacing: -.01em; text-wrap: balance; }
.catchup-title button {
  all: unset; cursor: pointer; color: var(--ink); text-align: start;
  background: linear-gradient(currentColor, currentColor) 0 100% / 0 1px no-repeat; transition: background-size 280ms;
}
.catchup-title button:hover { background-size: 100% 1px; }
.catchup-title button:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 4px; }
.catchup-summary {
  margin: 0; color: var(--summary); font-size: 14px; line-height: 1.55;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden;
}
.catchup-changes { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.catchup-changes li { display: grid; gap: 4px; padding: 10px 12px; border-radius: 10px; background: var(--subtle); }
.catchup-change-label { color: var(--green); font: 700 10.5px/1.3 var(--font-ui); letter-spacing: .06em; text-transform: uppercase; }
.catchup-changes .catchup-summary { font-size: 13px; -webkit-line-clamp: 2; line-clamp: 2; }
.catchup-change-source { justify-self: start; color: var(--green); font: 600 12px/1.4 var(--font-ui); }
.catchup-explanation { border-top: 1px dashed var(--line); padding-top: 8px; font-size: 13px; }
.catchup-explanation summary { cursor: pointer; color: var(--green); font: 600 12.5px/1.4 var(--font-ui); }
.catchup-explanation .catchup-claim { margin-top: 8px; }
.catchup-explanation p { margin: 0 0 6px; color: var(--summary); }
.catchup-card-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; padding-top: 12px;
  border-top: 1px solid var(--line);
}
.catchup-source { display: flex; align-items: center; gap: 9px; min-width: 0; }
.catchup-avatar {
  display: grid; flex: none; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: var(--sys-signal-soft); color: var(--green); font: 700 13px/1 var(--font-ui);
}
.catchup-source-names { display: grid; min-width: 0; }
.catchup-source-names strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font: 600 13px/1.3 var(--font-ui); }
.catchup-source-names span { color: var(--muted); font: 500 11.5px/1.3 var(--font-ui); }
.catchup-actions { display: flex; flex: none; align-items: center; gap: 6px; }
.catchup-actions a {
  display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border-radius: 999px; text-decoration: none;
  font: 600 12px/1 var(--font-ui); white-space: nowrap;
}
.catchup-read { background: var(--green); color: var(--action-text); }
.catchup-read:hover { background: var(--action-hover); color: var(--action-text); }
.catchup-timeline { border: 1px solid var(--line); color: var(--ink); background: var(--paper); }
.catchup-timeline:hover { border-color: var(--accent-line); background: var(--subtle); }
.catchup-actions a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (max-width: 560px) {
  .catchup-card { padding: 15px 15px 12px; }
  .catchup-title { font-size: 19px; }
  .catchup-card-foot { flex-wrap: wrap; }
}
@media print { .catchup-card { break-inside: avoid; box-shadow: none; } .catchup-actions { display: none; } }

/* ---------- Accessibility and output fallbacks ---------- */
@media (prefers-reduced-motion: reduce) {
  .aurora-field, .orbital-overlay { display: none !important; }
  .orbital-absorb { animation: none; }
}
@media (forced-colors: active) {
  .aurora-field, .orbital-overlay { display: none !important; }
}
@media print {
  .aurora-field, .orbital-overlay { display: none !important; }
}
