/* ═══════════════════════════════════════════════════════════════
   SHIELD AI — Layout: Shell Grid, Sidebar, Workspace
   ═══════════════════════════════════════════════════════════════ */

.shell {
  display: grid;
  grid-template-columns: 360px 1fr;
  min-height: 100vh;
}

.shield-topbar {
  position: sticky;
  top: 0;
  z-index: 2000;
  height: 44px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  border-bottom: 1px solid rgba(143, 172, 210, 0.3);
  background: linear-gradient(90deg, #102945 0%, #1a436f 55%, #264c7a 100%);
  box-shadow: 0 8px 18px rgba(8, 22, 42, 0.18);
}

.shield-topbar-link {
  color: #eaf3ff;
  text-decoration: none;
  font: 600 12px/1 var(--font-display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.shield-topbar-link:hover {
  color: #f8fbff;
}

.app-page .shell {
  display: block;
  min-height: auto;
  max-width: 1320px;
  margin: 0 auto;
  padding: 10px var(--space-3) var(--space-3);
}

/* ── Sidebar ── */
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-2);
  border-right: 1px solid var(--line-strong); /* S-009: slightly brighter separator */
  background: linear-gradient(180deg, #f8fbff 0%, #f3f8ff 100%);
  /* S-053: Scroll fade edges */
  mask-image: linear-gradient(to bottom, transparent 0px, black 12px, black calc(100% - 12px), transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0px, black 12px, black calc(100% - 12px), transparent 100%);
}

.app-page .sidebar {
  position: static;
  top: auto;
  height: auto;
  overflow: visible;
  gap: var(--space-3);
  padding: var(--space-3);
  border-right: none;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: linear-gradient(180deg, #edf2f9 0%, #e3ebf6 100%);
  mask-image: none;
  -webkit-mask-image: none;
}

.app-page .sidebar::after {
  display: none;
}

/* S-097: Sidebar section divider — input above, output below */
.section-divide {
  border: none;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--accent-dim) 30%, var(--accent-dim) 70%, transparent);
  margin: var(--space-1) var(--space-3);
}

/* S-085: Panel borders — softer inside sidebar */
.sidebar > .panel + .panel {
  border-top: none;
  margin-top: -1px;
}

.sidebar > .panel:first-child {
  border-top-left-radius: var(--radius-sm);
  border-top-right-radius: var(--radius-sm);
}

.sidebar > .panel:last-of-type {
  border-bottom-left-radius: var(--radius-sm);
  border-bottom-right-radius: var(--radius-sm);
}

/* S-075: Sidebar bottom cap — "you've seen everything" */
.sidebar::after {
  content: '';
  display: block;
  flex-shrink: 0;
  height: 1px;
  background: var(--line);
  margin-top: var(--space-2);
}

/* ── Workspace ── */
.workspace {
  display: flex;
  flex-direction: column;
  gap: var(--space-3); /* S-017: bigger gaps between major sections */
  padding: var(--space-2);
  overflow-x: hidden;
}

.app-page .workspace {
  padding: var(--space-3) 0 0;
}

.app-page .prompt-map-grid {
  display: grid;
  grid-template-columns: minmax(440px, 1fr) minmax(440px, 1fr);
  gap: var(--space-3);
  align-items: stretch;
}

.app-page .prompt-panel {
  position: sticky;
  top: 60px;
  min-height: 620px;
  height: 100%;
}

.app-page .prompt-map-grid > .map-panel {
  height: 100%;
}

.app-page .map-panel > summary {
  margin-bottom: var(--space-2);
}

/* ── Grid layouts ── */
.grid-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, 0.6fr);
  gap: var(--space-2);
}

.grid-2-equal {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-2);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-2);
}

.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-2);
}

/* ── Dev tools tab navigation ── */
.dev-tabs {
  margin-top: var(--space-2);
}

/* S-109: Sliding amber underline */
.dev-tab-bar {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--space-2);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.dev-tab-bar::after {
  content: '';
  position: absolute;
  bottom: 0;
  height: 2px;
  background: var(--accent);
  left: var(--tab-left, 0px);
  width: var(--tab-width, 0px);
  transition: left 250ms ease, width 250ms ease;
}

.dev-tab-btn {
  width: auto;
  padding: 6px 12px;
  font: 500 var(--text-xs)/1 var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast);
  white-space: nowrap;
}

.dev-tab-btn:hover {
  color: var(--text-primary);
  background: none;
  filter: none;
  transform: none;
}

/* S-180: Active tab amber background fill */
.dev-tab-btn.active {
  color: var(--accent);
  border-bottom-color: transparent;
  background: var(--accent-glow);
}

.dev-tab-content {
  display: none;
}

.dev-tab-content.active {
  display: block;
}

/* S-205: Cinematic boot sequence — the overture */
@keyframes power-on {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes boot-text {
  from { opacity: 0; transform: translateX(-8px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes boot-heading {
  0% { opacity: 0; letter-spacing: 0.4em; }
  40% { opacity: 1; }
  100% { opacity: 1; letter-spacing: 0.08em; }
}

@keyframes boot-map {
  0% { opacity: 0; filter: brightness(0); }
  30% { opacity: 1; filter: brightness(0.3); }
  100% { opacity: 1; filter: brightness(1); }
}

@keyframes line-draw {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* Shell elements cascade in */
.sidebar { animation: power-on 400ms ease-out 100ms both; }
.workspace { animation: power-on 400ms ease-out 200ms both; }
.dev-tabs { animation: power-on 400ms ease-out 350ms both; }

/* Masthead elements cascade with text effects */
.masthead .eyebrow { animation: boot-text 400ms ease-out 300ms both; }
.masthead h1 { animation: boot-heading 600ms ease-out 400ms both; }
.masthead .utc-clock { animation: boot-text 400ms ease-out 600ms both; }
.masthead .lede { animation: boot-text 400ms ease-out 700ms both; }

/* Map brightens like a monitor warming up */
.map-panel { animation: boot-map 800ms ease-out 250ms both; }

/* S-093: Commit flash — camera shutter on analyze */
@keyframes commit-flash {
  0% { background: rgba(255, 255, 255, 0.03); }
  100% { background: transparent; }
}

.workspace.did-commit {
  animation: commit-flash 200ms ease-out;
}

/* ── S-063: Dev tools slide-down reveal ── */
#dev-tools-section {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transition: max-height 400ms ease, opacity 300ms ease 100ms;
}

#dev-tools-section.open {
  max-height: 2000px;
  opacity: 1;
}

/* ── Responsive ── */
@media (max-width: 1080px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .shield-topbar {
    height: 40px;
  }

  .app-page .shell {
    padding: var(--space-2);
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .app-page .sidebar {
    border: 1px solid var(--line);
  }

  .grid-2,
  .grid-2-equal {
    grid-template-columns: 1fr;
  }

  .app-page .prompt-map-grid {
    grid-template-columns: 1fr;
  }

  .app-page .prompt-panel {
    position: static;
    top: auto;
    min-height: 0;
    height: auto;
  }

  .grid-3,
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* S-076: Mobile — map IS the interface */
@media (max-width: 720px) {
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .sidebar {
    gap: var(--space-1);
    padding: var(--space-1);
  }
  .sidebar > section:nth-child(n+3) { display: none; }
  .sidebar > details { display: none; }
  .masthead h1 { font-size: var(--text-lg); }
  .masthead .lede { display: none; }
}

/* ── Intro route (first page) ── */
.intro-page {
  min-height: 100vh;
  margin: 0;
  background: #eef3f9;
}

.intro-shell {
  position: relative;
  min-height: calc(94vh - 44px);
  background: linear-gradient(180deg, #0a1527 0%, #101f37 58%, #10243f 100%);
  overflow: hidden;
  display: grid;
  place-items: center;
}

.intro-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: brightness(0.78) contrast(1.08) saturate(1.05);
  z-index: 0;
  opacity: 0;
  transition: opacity 260ms ease;
}

.intro-generated-loop {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 1;
}

.intro-video.is-live {
  opacity: 1;
}

.intro-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 44%, rgba(19, 38, 70, 0.16), rgba(3, 8, 18, 0.64));
  z-index: 1;
}

.intro-stars {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.35) 1px, transparent 1.5px),
    radial-gradient(circle at 80% 24%, rgba(255, 255, 255, 0.45) 1px, transparent 1.5px),
    radial-gradient(circle at 65% 75%, rgba(255, 255, 255, 0.3) 1px, transparent 1.5px),
    radial-gradient(circle at 35% 65%, rgba(255, 255, 255, 0.35) 1px, transparent 1.5px);
  background-size: 320px 320px;
  opacity: 0.35;
  animation: stars-drift 30s linear infinite;
  z-index: 1;
}

.intro-shield-circle {
  display: none;
  position: absolute;
  left: 50%;
  top: 57%;
  width: min(54vw, 700px);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  clip-path: none;
  background:
    radial-gradient(circle at 50% 50%, rgba(130, 213, 255, 0.18) 0%, rgba(82, 171, 248, 0.14) 44%, rgba(43, 117, 223, 0.09) 67%, transparent 84%),
    repeating-conic-gradient(from 0deg at 50% 50%, rgba(182, 236, 255, 0.08) 0deg 2deg, transparent 2deg 15deg);
  border: none;
  box-shadow:
    0 0 60px rgba(78, 190, 255, 0.32),
    0 0 150px rgba(35, 128, 239, 0.22);
  z-index: 1;
  pointer-events: none;
  animation: intro-shield-pulse 6s ease-in-out infinite;
}

.intro-shield-circle::before {
  content: "";
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  border: 2px solid rgba(168, 236, 255, 0.74);
  box-shadow:
    0 0 14px rgba(189, 242, 255, 0.66),
    0 0 36px rgba(103, 204, 255, 0.44),
    0 0 84px rgba(60, 160, 247, 0.38);
  opacity: 0.94;
}

.intro-shield-circle::after {
  content: "";
  position: absolute;
  inset: 2%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 9% 61%, rgba(205, 244, 255, 0.92) 0 2px, transparent 7px),
    radial-gradient(circle at 24% 23%, rgba(205, 244, 255, 0.74) 0 1.6px, transparent 7px),
    radial-gradient(circle at 78% 18%, rgba(205, 244, 255, 0.76) 0 1.7px, transparent 7px),
    radial-gradient(circle at 91% 58%, rgba(205, 244, 255, 0.88) 0 2px, transparent 8px),
    radial-gradient(circle at 50% 94%, rgba(205, 244, 255, 0.9) 0 2.2px, transparent 8px);
  opacity: 0.84;
  animation: intro-shield-spin 24s linear infinite;
}

.intro-earth {
  position: absolute;
  width: min(42vw, 520px);
  aspect-ratio: 1;
  border-radius: 50%;
  right: -8vw;
  bottom: -10vw;
  background: radial-gradient(circle at 35% 35%, rgba(96, 165, 250, 0.55), rgba(22, 78, 99, 0.26) 45%, rgba(2, 6, 23, 0.14) 68%, transparent 72%);
  filter: blur(0.2px);
  opacity: 0.8;
  box-shadow: 0 0 120px rgba(59, 130, 246, 0.28);
  animation: earth-drift 26s ease-in-out infinite;
}

@keyframes earth-drift {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

@keyframes stars-drift {
  from { transform: translateY(0); }
  to { transform: translateY(-24px); }
}

.intro-content {
  position: relative;
  z-index: 2;
  max-width: 1040px;
  padding: 40px 22px;
  text-align: center;
  text-shadow: 0 8px 24px rgba(5, 15, 32, 0.45);
}

.intro-kicker {
  margin-bottom: 16px;
  color: rgba(230, 236, 255, 0.86);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font: 500 12px/1.2 var(--font-display);
}

.intro-content h1 {
  margin: 0;
  text-transform: uppercase;
  font: 800 clamp(40px, 9vw, 86px)/0.95 var(--font-display);
  letter-spacing: 0.03em;
  color: #f7fbff;
}

.intro-content p {
  margin: 20px auto 0;
  max-width: 760px;
  color: rgba(235, 243, 255, 0.94);
  font: 400 clamp(16px, 2.4vw, 20px)/1.5 var(--font-body);
}

.intro-cta {
  display: inline-flex;
  margin-top: 28px;
  align-items: center;
  justify-content: center;
  min-width: 220px;
  padding: 14px 20px;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font: 500 12px/1 var(--font-display);
  color: #f7fbff;
  text-decoration: none;
  background: linear-gradient(120deg, rgba(24, 54, 125, 0.74), rgba(10, 26, 71, 0.82));
  transition: transform 180ms ease, background 180ms ease;
}

.intro-cta:hover {
  transform: translateY(-1px);
  background: linear-gradient(120deg, rgba(23, 66, 171, 0.74), rgba(11, 34, 97, 0.86));
}

/* ── Sections band: dark cosmic background with white cards inside ── */
.intro-sections {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 80px 32px;
  background:
    radial-gradient(ellipse at 30% 0%, rgba(28, 64, 132, 0.45), transparent 55%),
    radial-gradient(ellipse at 70% 100%, rgba(18, 42, 92, 0.40), transparent 55%),
    linear-gradient(180deg, #050a1c 0%, #0a1530 50%, #050a1c 100%);
  display: grid;
  gap: 28px;
  grid-template-columns: 1fr;
  justify-items: center;
}

/* Each card is now a self-contained white box on the dark blue surface */
.intro-section-card,
.intro-section-band {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  background: #f6f9fc;
  padding: 44px 56px;
  position: relative;
  width: 100%;
  max-width: 1120px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 18px 48px rgba(0, 0, 0, 0.32);
}

.intro-section-band:nth-child(even) {
  background: #ffffff;
}

.intro-section-inner {
  max-width: none;
  margin: 0;
  padding: 0;
}

/* Drop the dotted divider that ran between bands — cards stand alone now */
.intro-section-card + .intro-section-card::before {
  content: none;
}

.intro-section-card .eyebrow {
  color: var(--accent);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  margin: 0 0 12px;
}

.intro-section-card h2 {
  margin: 0;
  font: 700 clamp(22px, 2.4vw, 30px)/1.25 var(--font-display);
  letter-spacing: 0;
  text-transform: none;
  color: #10223c;
  max-width: none;
  white-space: normal;
  overflow-wrap: normal;
  word-break: normal;
}

.intro-section-card p {
  margin: 16px 0 0;
  color: #32465f;
  font: 400 16px/1.7 var(--font-body);
  max-width: 84ch;
}

.intro-source-list {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
  max-width: 80ch;
}

.intro-source-list li {
  color: #32465f;
  font: 400 16px/1.6 var(--font-body);
  padding-left: 18px;
  position: relative;
}

.intro-source-list li::before {
  content: "\203A";
  position: absolute;
  left: 0;
  top: 0;
  color: var(--accent);
  font-weight: 700;
}

.intro-source-list li strong {
  color: #10223c;
  font-weight: 600;
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-right: 6px;
}

/* ── Final CTA section ──────────────────────────────────────────────── */
.intro-cta-section {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(28, 64, 132, 0.55), transparent 65%),
    linear-gradient(180deg, #050a1c 0%, #0a1530 100%);
  padding: 96px 32px 120px;
  text-align: center;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.intro-cta-inner {
  max-width: 720px;
  margin: 0 auto;
  background: #f6f9fc;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  padding: 56px 48px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.06) inset,
    0 18px 48px rgba(0, 0, 0, 0.32);
}

.intro-cta-inner .eyebrow {
  color: var(--accent);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  margin: 0 0 12px;
}

.intro-cta-inner h2 {
  margin: 0;
  font: 700 clamp(24px, 2.8vw, 32px)/1.2 var(--font-display);
  letter-spacing: 0;
  text-transform: none;
  color: #10223c;
}

.intro-cta-inner p {
  margin: 16px auto 0;
  color: #32465f;
  font: 400 18px/1.75 var(--font-body);
  max-width: 60ch;
}

.intro-cta-section .intro-cta {
  margin-top: 32px;
}

@media (max-width: 980px) {
  .intro-sections {
    padding: 40px 16px 56px;
    gap: 20px;
  }

  .intro-shield-circle {
    top: 60%;
    width: min(88vw, 600px);
  }

  .intro-section-card,
  .intro-section-band {
    padding: 28px 22px;
  }

  .intro-section-inner {
    padding: 0;
  }

  .intro-section-card h2 {
    max-width: 100%;
  }

  .intro-section-card p {
    font-size: 15px;
  }

  .intro-cta-section {
    padding: 48px 16px 64px;
  }

  .intro-cta-inner {
    padding: 36px 22px;
  }

  .intro-section-card + .intro-section-card::before {
    left: 0;
    right: 0;
    top: -8px;
  }
}

@keyframes intro-shield-pulse {
  0%, 100% {
    opacity: 0.72;
    transform: translate(-50%, -50%) scale(1);
  }
  50% {
    opacity: 0.92;
    transform: translate(-50%, -50%) scale(1.015);
  }
}

@keyframes intro-shield-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}
