/* ============================================================
   PIA — Property Intelligence & Alerts
   Design language: monochrome ink gravitas + signal orange
   (Clyde & Co-inspired), quiet motion, editorial typography.
   ============================================================ */

:root {
  --ink: #16191f;          /* near-black charcoal */
  --ink-2: #232833;        /* raised ink */
  --ink-3: #3a4150;        /* muted ink */
  --orange: #e9531d;       /* signal orange accent */
  --orange-soft: #fdeee6;
  --paper: #f7f6f3;        /* warm paper background */
  --card: #ffffff;
  --text: #1d2129;
  --muted: #6f7683;
  --line: #e6e4de;
  --green: #1f7a43;
  --green-soft: #e8f4ec;
  --amber-soft: #fff3cd;
  --amber-text: #7a4a00;
  --red: #b02020;
  --red-soft: #fbeaea;
  --navy: #16191f;         /* legacy alias — kept so nothing breaks */
  --shadow-sm: 0 1px 2px rgba(22, 25, 31, .06);
  --shadow-md: 0 6px 24px rgba(22, 25, 31, .10);
  --shadow-lg: 0 18px 50px rgba(22, 25, 31, .16);
  --ease: cubic-bezier(.22, .8, .28, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: "Inter", "Segoe UI", -apple-system, Helvetica, Arial, sans-serif;
  background: var(--paper);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
}

a { color: var(--ink); transition: color .18s var(--ease); }
a:hover { color: var(--orange); }

/* ---------- entrance animations ---------- */
@keyframes fadeUp   { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes riseIn   { from { opacity: 0; transform: translateY(22px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes sweep    { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes ddslide  { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }
@keyframes pulseDot { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: var(--ink);
  color: #fff;
  padding: 16px 30px;
  display: flex; align-items: center; gap: 16px;
  box-shadow: var(--shadow-md);
}
.topbar::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: linear-gradient(90deg, var(--orange), #f5813f 45%, transparent 90%);
  transform-origin: left; animation: sweep .9s var(--ease) both;
}
/* P.I.A. wordmark: tightened letters, orange points sitting slightly high —
   reads as a monogram rather than punctuation. */
.brandmark { letter-spacing: .06em; }
.brandmark .bdot {
  color: var(--orange);
  font-weight: 800;
  margin: 0 1px;
  position: relative;
  top: -1px;
}

.topbar h1 {
  font-size: 20px; margin: 0; font-weight: 700; letter-spacing: .04em;
}
.topbar .tagline {
  font-size: 12px; opacity: .62; letter-spacing: .06em; text-transform: uppercase;
  border-left: 1px solid rgba(255,255,255,.25); padding-left: 16px;
}
.topbar .spacer { flex: 1; }
.topbar a {
  color: #c9cdd6; font-size: 13px; text-decoration: none; margin-left: 18px;
  position: relative; padding-bottom: 2px;
}
.topbar a::after {
  content: ""; position: absolute; left: 0; bottom: -2px; width: 100%; height: 1.5px;
  background: var(--orange); transform: scaleX(0); transform-origin: left;
  transition: transform .25s var(--ease);
}
.topbar a:hover { color: #fff; }
.topbar a:hover::after { transform: scaleX(1); }

.badge-beta {
  background: var(--orange); color: #fff; font-size: 10px; font-weight: 800;
  padding: 3px 8px; border-radius: 3px; letter-spacing: .14em; vertical-align: middle;
}

.wrap { max-width: 1150px; margin: 30px auto; padding: 0 22px; animation: fadeIn .5s var(--ease) both; }

/* ---------- gate / auth pages ---------- */
.gatebox {
  max-width: 400px; margin: 84px auto; background: var(--card);
  border: 1px solid var(--line); border-top: 3px solid var(--orange);
  border-radius: 10px; padding: 40px 36px; text-align: center;
  box-shadow: var(--shadow-lg);
  animation: riseIn .55s var(--ease) both;
}
.gatebox h2 { color: var(--ink); margin: 10px 0 4px; font-size: 22px; letter-spacing: -.01em; }
.gatebox p { color: var(--muted); font-size: 13.5px; line-height: 1.55; }
.gatebox input, .gatebox select {
  width: 100%; padding: 11px 13px; margin: 7px 0; border: 1px solid var(--line);
  border-radius: 6px; font-size: 14px; font-family: inherit; background: #fff;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.gatebox input:focus, .gatebox select:focus {
  outline: none; border-color: var(--ink-3); box-shadow: 0 0 0 3px rgba(233, 83, 29, .12);
}
.gatebox select { width: auto; }
.gatebox button[type="submit"] {
  width: 100%; padding: 12px; background: var(--ink); color: #fff; border: 0;
  border-radius: 6px; font-size: 14px; font-weight: 600; letter-spacing: .02em;
  cursor: pointer; margin-top: 10px; font-family: inherit;
  transition: background .2s var(--ease), transform .15s var(--ease), box-shadow .2s var(--ease);
}
.gatebox button[type="submit"]:hover { background: var(--orange); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.gatebox button[type="submit"]:active { transform: none; }
.error { color: var(--red); font-size: 13px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 18px; border-bottom: 2px solid var(--line); }
.tabs a {
  padding: 11px 20px; font-size: 14px; text-decoration: none; color: var(--muted);
  font-weight: 500; position: relative; margin-bottom: -2px;
  transition: color .2s var(--ease);
}
.tabs a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px;
  background: var(--orange); transform: scaleX(0); transform-origin: left;
  transition: transform .28s var(--ease);
}
.tabs a:hover { color: var(--ink); }
.tabs a.active { color: var(--ink); font-weight: 700; }
.tabs a.active::after { transform: scaleX(1); }
.tabs .count {
  background: var(--paper); border: 1px solid var(--line); border-radius: 11px;
  font-size: 11px; padding: 1px 8px; margin-left: 6px; color: var(--ink-3);
}
.tabs a.active .count { background: var(--orange-soft); border-color: #f5b391; color: var(--orange); }

/* ---------- filters ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 22px; align-items: center; }
.filters select, .filters input[type="search"] {
  padding: 9px 12px; border: 1px solid var(--line); border-radius: 6px; font-size: 13px;
  background: #fff; font-family: inherit; color: var(--text);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.filters select:focus, .filters input[type="search"]:focus {
  outline: none; border-color: var(--ink-3); box-shadow: 0 0 0 3px rgba(233, 83, 29, .10);
}
.btn {
  padding: 9px 16px; background: var(--ink); color: #fff; border: 0; border-radius: 6px;
  font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none;
  display: inline-block; font-family: inherit; letter-spacing: .01em;
  transition: background .2s var(--ease), transform .15s var(--ease), box-shadow .2s var(--ease);
}
.btn:hover { background: var(--orange); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid var(--ink-3); }
.btn.secondary:hover { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- cards ---------- */
.card {
  background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--ink);
  border-radius: 8px; padding: 18px 22px; margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
  animation: fadeUp .45s var(--ease) both;
  transition: transform .22s var(--ease), box-shadow .22s var(--ease), border-color .22s var(--ease);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-left-color: var(--orange); }
.card:nth-child(1)  { animation-delay: .03s; }
.card:nth-child(2)  { animation-delay: .07s; }
.card:nth-child(3)  { animation-delay: .11s; }
.card:nth-child(4)  { animation-delay: .15s; }
.card:nth-child(5)  { animation-delay: .19s; }
.card:nth-child(6)  { animation-delay: .23s; }
.card:nth-child(7)  { animation-delay: .27s; }
.card:nth-child(8)  { animation-delay: .31s; }
.card:nth-child(n+9) { animation-delay: .35s; }
.card.law { border-left-color: var(--orange); }
.card.law:hover { border-left-color: var(--ink); }
.card h3 { margin: 0 0 6px; font-size: 15.5px; line-height: 1.4; letter-spacing: -.005em; }
.card h3 a { text-decoration: none; }
.card .meta { font-size: 12px; color: var(--muted); margin-bottom: 8px; line-height: 2; }
.card .meta .pill {
  background: var(--paper); border: 1px solid var(--line); color: var(--ink-3);
  border-radius: 11px; padding: 2px 10px; margin-right: 6px; font-size: 11px;
  font-weight: 600; letter-spacing: .02em; display: inline-block;
  transition: transform .15s var(--ease);
}
.card .meta .pill:hover { transform: translateY(-1px); }
.card .meta .pill.red { background: var(--orange-soft); border-color: #f5b391; color: var(--orange); }
.card .meta .pill.warn { background: var(--red-soft); border-color: #e5b4b4; font-size: 12px; padding: 2px 8px; }
.card .meta .pill.amber { background: var(--amber-soft); border-color: #ecd9a0; color: var(--amber-text); }
.card .meta .pill.ok { background: var(--green-soft); border-color: #bfe0cb; font-size: 12px; padding: 2px 8px; }
.card .meta .pill.amber { font-size: 12px; padding: 2px 8px; }
.card p { margin: 4px 0 10px; font-size: 13.5px; color: #454b57; line-height: 1.6; }
.card .actions { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.card .actions a { font-size: 12.5px; font-weight: 600; }
.linkbtn {
  background: none; border: none; color: var(--ink); font-size: 12.5px; font-weight: 600;
  cursor: pointer; padding: 0; text-decoration: underline; font-family: inherit;
  transition: color .18s var(--ease);
}
.linkbtn:hover { color: var(--orange); }

/* ---------- deep-dive progress ---------- */
.dd-progress {
  width: 110px; height: 6px; background: var(--line); border-radius: 3px;
  overflow: hidden; display: inline-block; vertical-align: middle; margin-right: 6px;
}
.dd-progress i {
  display: block; height: 100%; width: 40%;
  background: linear-gradient(90deg, var(--ink), var(--orange));
  border-radius: 3px; animation: ddslide 1.15s infinite linear;
}

/* ---------- notices / empty states ---------- */
.empty { text-align: center; color: var(--muted); padding: 70px 0; font-size: 14px; animation: fadeIn .6s var(--ease) both; }
.notice {
  background: var(--green-soft); border: 1px solid #bfe0cb; color: var(--green);
  padding: 11px 16px; border-radius: 6px; font-size: 13px; margin-bottom: 16px;
  animation: fadeUp .4s var(--ease) both;
}
.notice::before { content: "● "; color: var(--green); animation: pulseDot 1.6s infinite; }

/* ---------- email log table ---------- */
table.log { width: 100%; border-collapse: collapse; background: #fff; font-size: 13px;
  border-radius: 8px; overflow: hidden; box-shadow: var(--shadow-sm); animation: fadeUp .45s var(--ease) both; }
table.log th, table.log td { border: 1px solid var(--line); padding: 9px 12px; text-align: left; }
table.log th { background: var(--ink); color: #fff; font-weight: 600; letter-spacing: .03em; font-size: 12px; border-color: var(--ink-2); }
table.log tr { transition: background .15s var(--ease); }
table.log tr:hover td { background: var(--paper); }
.ok { color: var(--green); font-weight: 700; } .fail { color: var(--red); font-weight: 700; }

footer { text-align: center; color: var(--muted); font-size: 11.5px; padding: 36px 20px; line-height: 1.6; }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001s !important; transition-duration: .001s !important; }
}

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  .topbar { padding: 13px 16px; flex-wrap: wrap; }
  .topbar .tagline { display: none; }
  .wrap { margin: 18px auto; }
  .gatebox { margin: 40px auto; padding: 30px 22px; }
  .filters select, .filters input[type="search"] { flex: 1 1 45%; }
}

/* ---------- source tri-state toggle ---------- */
.srctoggle {
  padding: 8px 13px; border-radius: 6px; font-size: 15px; line-height: 1; font-weight: 600;
  text-decoration: none; border: 1px solid var(--line); background: #fff;
  color: var(--muted); user-select: none;
  transition: background .2s var(--ease), color .2s var(--ease),
              border-color .2s var(--ease), transform .12s var(--ease),
              box-shadow .2s var(--ease);
}
.srctoggle:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); color: var(--ink); }
.srctoggle:active { transform: none; }
.srctoggle.high { background: var(--green-soft); border-color: #bfe0cb; color: var(--green); box-shadow: inset 0 0 0 1px #bfe0cb; }
.srctoggle.low { background: var(--red-soft); border-color: #e5b4b4; color: var(--red); box-shadow: inset 0 0 0 1px #e5b4b4; }

/* Small yellow dot next to the ✅ on a card pill: verified, but some of the
   corroborating sources are off-list (partially corroborated). */
.pill .minidot {
  display: inline-block; width: 7px; height: 7px; margin-left: 3px;
  background: #e8b000; border: 1px solid #c79500; border-radius: 50%;
  vertical-align: super;
}

/* Stage toggle: same caps-lock behaviour, labelled (stages aren't self-evident
   from an icon alone). Active stages get a soft tint per stage. */
.stagetoggle { font-size: 13px; white-space: nowrap; }
.stagetoggle.announced { background: #f3edfd; border-color: #cfc0ee; color: #5b3fa8; box-shadow: inset 0 0 0 1px #cfc0ee; }
.stagetoggle.underway  { background: #fdf3e7; border-color: #eccfa8; color: #9a5b13; box-shadow: inset 0 0 0 1px #eccfa8; }
.stagetoggle.delivered { background: var(--green-soft); border-color: #bfe0cb; color: var(--green); box-shadow: inset 0 0 0 1px #bfe0cb; }

.linkbtn.disabled { color: var(--muted); text-decoration: line-through; cursor: default; opacity: .55; }

/* ===========================================================================
   GEO THEME — geographic constellation backdrops (UI_THEME=geo, the default)
   Rollback: set UI_THEME=classic in the environment, or git tag classic-look.
   =========================================================================== */

/* Auth pages (beta gate / login / signup): night-operations stage.
   The animated SVG pans and zooms between the covered cities. */
/* keep the canvas behind the stage dark too (overscroll / short pages) */
html:has(body.authpage) { background: #0a0e14; }
body.authpage {
  min-height: 100vh;
  min-height: 100dvh;
  background-color: #0a0e14;
  background-image:
    radial-gradient(1100px 600px at 50% 8%, #1d2635 0%, #10151d 55%, #0a0e14 100%);
  background-repeat: no-repeat;
  background-attachment: fixed;
  display: flex;
  flex-direction: column;
}
body.authpage .wrap { flex: 1; }
.geo-stage {
  position: fixed; inset: 0; z-index: 0; overflow: hidden;
  pointer-events: none;
}
.geo-stage svg { width: 100%; height: 100%; display: block; opacity: .9; }
/* vignette so the card area stays calm and legible */
.geo-stage::after {
  content: ""; position: absolute; inset: 0;
  background: radial-gradient(720px 520px at 50% 46%,
              rgba(10,14,20,.72) 0%, rgba(10,14,20,.30) 55%, rgba(10,14,20,0) 100%);
}
body.authpage .topbar { background: rgba(13, 17, 24, .72); backdrop-filter: blur(6px); }
body.authpage .wrap { position: relative; z-index: 1; }
body.authpage .gatebox {
  background: rgba(250, 249, 246, .96);
  backdrop-filter: blur(10px);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .55), 0 2px 10px rgba(0, 0, 0, .35);
  border: 1px solid rgba(255, 255, 255, .08);
}
body.authpage footer { color: #55627a; position: relative; z-index: 1; }

/* Dashboard: faint static constellation behind the cards. When a country
   filter is active, the map leans toward that country's coordinates. */
.dashgeo {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  opacity: .075; overflow: hidden;
}
.dashgeo svg {
  width: 100%; height: 100%; display: block;
  transition: transform 1.1s cubic-bezier(.22, .8, .3, 1);
}
.dashgeo.f-ALL svg { transform: scale(1.06); transform-origin: 50% 50%; }
.dashgeo.f-AE svg { transform-origin: 93.3% 71.1%; transform: scale(2.4); }
.dashgeo.f-SA svg { transform-origin: 81.0% 73.9%; transform: scale(2.4); }
.dashgeo.f-QA svg { transform-origin: 87.9% 70.6%; transform: scale(2.4); }
.dashgeo.f-KW svg { transform-origin: 82.9% 47.8%; transform: scale(2.4); }
.dashgeo.f-BH svg { transform-origin: 86.6% 65.6%; transform: scale(2.4); }
.dashgeo.f-OM svg { transform-origin: 97.7% 80.0%; transform: scale(2.4); }
.dashgeo.f-EG svg { transform-origin: 58.9% 44.4%; transform: scale(2.4); }
.dashgeo.f-MA svg { transform-origin: 3.4% 24.4%; transform: scale(2.4); }
.dashgeo.f-DZ svg { transform-origin: 18.7% 6.9%; transform: scale(2.4); }
.wrap { position: relative; z-index: 1; }

/* Portrait phones: the 2:1 map cannot fit a tall screen — instead of cropping
   to near-empty mid-sea, pin the full-height map to the right edge so the
   Gulf cluster (the main coverage area) fills the screen with real coastline.
   Landscape/desktop keeps the whole region via preserveAspectRatio slice. */
@media (orientation: portrait) {
  .geo-stage svg, .dashgeo svg {
    position: absolute; top: 0; right: 0;
    height: 100%; width: auto; aspect-ratio: 1400 / 700;
  }
  /* the camera tour is framed for landscape; hold the Gulf view instead */
  .geo-stage .geo-world { animation: none !important; transform: none !important; }
}

/* ---------- piaintel.com coming-soon landing ---------- */
body.landingpage .topbar { display: none; }
.landing {
  min-height: 78vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  position: relative; z-index: 1; animation: riseIn .8s var(--ease) both;
}
.landing-mark { font-size: clamp(56px, 12vw, 96px); color: #f2efe9; margin: 0; font-weight: 800; }
.landing-sub {
  color: #8fa1bd; font-size: clamp(11px, 2.6vw, 14px); letter-spacing: .34em;
  text-transform: uppercase; margin: 10px 0 0;
}
.landing-rule {
  width: 68px; height: 2px; margin: 34px 0;
  background: linear-gradient(90deg, transparent, var(--orange), transparent);
}
.landing-coming {
  color: #d8dde7; font-size: clamp(15px, 3.4vw, 19px); letter-spacing: .5em;
  text-transform: uppercase; margin: 0 0 16px; padding-left: .5em;
}
.landing-beta { margin: 0 0 26px; }
.landing-beta .badge-beta { font-size: 11px; padding: 4px 12px; letter-spacing: .2em; }
.landing-note { color: #55627a; font-size: 12.5px; letter-spacing: .04em; max-width: 420px; }
body.landingpage footer { display: none; }

/* Category chips: tap one off to exclude it, tap again to bring it back.
   All-on is the default state, so switching one off filters it out. */
.catchips { display: inline-flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.catchip {
  font-size: 12px; padding: 7px 12px; border-radius: 20px; text-decoration: none;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  white-space: nowrap; user-select: none;
  transition: background .2s var(--ease), color .2s var(--ease),
              border-color .2s var(--ease), opacity .2s var(--ease);
}
.catchip.on { background: var(--ink); color: #fff; border-color: var(--ink); font-weight: 600; }
.catchip.on:hover { background: var(--orange); border-color: var(--orange); color: #fff; }
.catchip.off { opacity: .5; text-decoration: line-through; }
.catchip.off:hover { opacity: 1; text-decoration: none; border-color: var(--ink-3); }

/* Cross-referenced coverage: other outlets reporting the same development. */
.related {
  font-size: 11.5px; color: var(--muted); margin: 2px 0 8px;
  padding-left: 2px;
}
.related a { color: var(--ink-3); text-decoration: none; border-bottom: 1px dotted var(--line); }
.related a:hover { color: var(--orange); border-bottom-color: var(--orange); }
