/* ─── Security Page ──────────────────────────────────────────────── */

/* ─── Page background ───────────────────────────────────────── */
body {
  background: radial-gradient(ellipse 60% 50% at 50% 35%, rgba(45,59,68,.5) 0%, transparent 70%),
              var(--obsidian-slate);
  overflow-x: hidden;
}
#chat-widget { display: none !important; }

/* Subtle grid for HUD / tech feel */
.grid-bg {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(159,184,217,.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(159,184,217,.025) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
  z-index: 0;
}

/* ─── Back nav ──────────────────────────────────────────────── */
.sec-nav {
  position: relative;
  z-index: 1;
  padding: 1rem 0;
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .88rem;
  color: var(--cornflower-blue-dim);
}
.sec-back-link {
  font-weight: 600;
  color: var(--sandy-peach);
  transition: opacity .2s;
}
.sec-back-link:hover { opacity: .75; }
.sec-nav span { opacity: .6; }

/* ─── Header ────────────────────────────────────────────────── */
.sec-header {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 2.5rem 0 1.5rem;
}
.sec-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .2em;
  text-transform: uppercase;
  color: var(--sandy-peach);
  margin-bottom: .75rem;
}
.sec-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  line-height: 1.25;
  font-weight: 800;
  color: var(--parchment);
}
.sec-accent { color: var(--cornflower-blue); }
.sec-subtitle {
  margin-top: .8rem;
  font-size: .85rem;
  color: var(--cornflower-blue-dim);
  opacity: .6;
}

/* ═══════════════════════════════════════════════════════════════
   Shield Visualization — Concentric Circles
   ═══════════════════════════════════════════════════════════════ */
/* ─── Two-column layout ───────────────────────────────────── */
.sec-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  align-items: center;
  padding: 1.5rem 0 5rem;
}

.shield-section {
  display: flex;
  justify-content: center;
}

.shield {
  position: relative;
  width: min(460px, 100%);
  aspect-ratio: 1;
  transition: opacity .4s ease, transform .4s ease;
}
body.overlay-open .shield {
  opacity: .15;
  transform: scale(.94);
}

/* Crosshairs */
.shield::before,
.shield::after {
  content: '';
  position: absolute;
  z-index: 0;
  background: rgba(159,184,217,.04);
}
.shield::before {
  top: 50%; left: 5%; right: 5%; height: 1px;
  transform: translateY(-50%);
}
.shield::after {
  left: 50%; top: 5%; bottom: 5%; width: 1px;
  transform: translateX(-50%);
}

/* Radar sweep */
.shield-scan {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    transparent 290deg,
    rgba(159,184,217,.04) 320deg,
    rgba(159,184,217,.09) 350deg,
    transparent 360deg
  );
  animation: shield-scan 8s linear infinite;
  pointer-events: none;
  z-index: 1;
}
@keyframes shield-scan {
  to { transform: rotate(360deg); }
}

/* Ripple pulses from center */
.shield-ripple {
  position: absolute;
  top: 50%; left: 50%;
  border-radius: 50%;
  border: 1px solid rgba(139,107,35,.08);
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 0;
  animation: ripple 7s linear infinite;
}
.shield-ripple:nth-child(3) { animation-delay: -2.33s; }
.shield-ripple:nth-child(4) { animation-delay: -4.66s; }
@keyframes ripple {
  0%   { width: 12%; height: 12%; opacity: .6; }
  100% { width: 108%; height: 108%; opacity: 0; }
}

/* ─── Rings ─────────────────────────────────────────────────── */
.shield-ring {
  position: absolute;
  border-radius: 50%;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  cursor: pointer;
  transition: border-color .4s ease, box-shadow .4s ease, background .4s ease, opacity .5s ease;
  z-index: 2;
}

.shield-ring[data-layer="perimeter"] {
  width: 100%; height: 100%;
  z-index: 2;
  border: 1.5px solid rgba(159,184,217,.22);
  background: radial-gradient(circle, transparent 60%, rgba(159,184,217,.015) 100%);
}
.shield-ring[data-layer="identity"] {
  width: 76%; height: 76%;
  z-index: 3;
  border: 1.5px solid rgba(78,110,142,.3);
  background: radial-gradient(circle, transparent 55%, rgba(78,110,142,.02) 100%);
}
.shield-ring[data-layer="application"] {
  width: 54%; height: 54%;
  z-index: 4;
  border: 1.5px solid rgba(140,101,77,.3);
  background: radial-gradient(circle, transparent 45%, rgba(140,101,77,.025) 100%);
}
.shield-ring[data-layer="data"] {
  width: 34%; height: 34%;
  z-index: 5;
  border: 1.5px solid rgba(244,215,177,.22);
  background: radial-gradient(circle, transparent 30%, rgba(244,215,177,.03) 100%);
}
.shield-ring[data-layer="compliance"] {
  width: 16%; height: 16%;
  z-index: 6;
  border: 1.5px solid rgba(139,107,35,.4);
  background: radial-gradient(circle, rgba(139,107,35,.1) 0%, rgba(139,107,35,.03) 100%);
}

/* Ring labels — positioned at the top of each circle, breaking the border like a fieldset legend */
.ring-label {
  position: absolute;
  top: -1px; left: 50%;
  transform: translate(-50%, -50%);
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  white-space: nowrap;
  padding: .15rem .7rem;
  background: var(--obsidian-slate);
  color: var(--parchment);
  opacity: .55;
  transition: opacity .3s, color .3s;
  z-index: 3;
}

/* Hover states */
.shield-ring:hover .ring-label { opacity: 1; }

.shield-ring[data-layer="perimeter"]:hover {
  border-color: rgba(159,184,217,.55);
  box-shadow: 0 0 40px rgba(159,184,217,.1), inset 0 0 40px rgba(159,184,217,.03);
}
.shield-ring[data-layer="identity"]:hover {
  border-color: rgba(78,110,142,.6);
  box-shadow: 0 0 40px rgba(78,110,142,.12), inset 0 0 40px rgba(78,110,142,.03);
}
.shield-ring[data-layer="application"]:hover {
  border-color: rgba(140,101,77,.6);
  box-shadow: 0 0 40px rgba(140,101,77,.12), inset 0 0 40px rgba(140,101,77,.03);
}
.shield-ring[data-layer="data"]:hover {
  border-color: rgba(244,215,177,.5);
  box-shadow: 0 0 40px rgba(244,215,177,.1), inset 0 0 40px rgba(244,215,177,.03);
}
.shield-ring[data-layer="compliance"]:hover {
  border-color: rgba(139,107,35,.7);
  box-shadow: 0 0 40px rgba(139,107,35,.18), inset 0 0 40px rgba(139,107,35,.05);
}

/* Dimmed when overlay is open */
body.overlay-open .shield-ring { pointer-events: none; }

/* ─── Pulsing nodes on the rings ────────────────────────────── */
.ring-node {
  position: absolute;
  width: 5px; height: 5px;
  border-radius: 50%;
  z-index: 4;
  pointer-events: none;
}
.ring-node::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  background: inherit;
  opacity: .35;
  animation: node-pulse 3.5s ease-in-out var(--d, 0s) infinite;
}
@keyframes node-pulse {
  0%, 100% { transform: scale(1); opacity: .35; }
  50%      { transform: scale(2.8); opacity: 0; }
}

/* ═══════════════════════════════════════════════════════════════
   Detail Overlay
   ═══════════════════════════════════════════════════════════════ */
.layer-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(18,25,30,.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease;
}
.layer-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.layer-card {
  position: fixed;
  z-index: 201;
  left: var(--cx, 50%);
  top: var(--cy, 50%);
  translate: -50% -50%;
  width: min(520px, 88vw);
  aspect-ratio: 1;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4.5rem;
  background: rgba(27,37,44,.97);
  box-shadow: 0 0 80px rgba(0,0,0,.45), 0 0 0 1px rgba(255,255,255,.06);
  transform: scale(.3);
  transition: transform .55s cubic-bezier(.34,1.56,.64,1), opacity .35s ease;
  opacity: 0;
  pointer-events: none;
  cursor: default;
}
.layer-card.active {
  transform: scale(1);
  opacity: 1;
  pointer-events: auto;
}

/* Ring border that matches the layer colour */
.layer-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.1);
  pointer-events: none;
  transition: border-color .3s;
}

/* Subtle rotating sweep on the card */
.layer-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: conic-gradient(
    from 0deg,
    transparent 0deg,
    transparent 320deg,
    rgba(255,255,255,.015) 345deg,
    rgba(255,255,255,.035) 355deg,
    transparent 360deg
  );
  animation: shield-scan 12s linear infinite;
  pointer-events: none;
}

/* Layer-specific ring colour on the card circle */
.layer-card[data-active="perimeter"]::before   { border-color: rgba(159,184,217,.35); }
.layer-card[data-active="identity"]::before     { border-color: rgba(78,110,142,.4); }
.layer-card[data-active="application"]::before  { border-color: rgba(140,101,77,.4); }
.layer-card[data-active="data"]::before         { border-color: rgba(244,215,177,.3); }
.layer-card[data-active="compliance"]::before    { border-color: rgba(139,107,35,.45); }


.layer-card-number {
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  margin-bottom: .2rem;
}
.layer-card-title {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--parchment);
  margin-bottom: .25rem;
  line-height: 1.3;
}
.layer-card-desc {
  font-size: .8rem;
  color: var(--cornflower-blue-dim);
  margin-bottom: 1.2rem;
  line-height: 1.55;
}

.layer-card-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .4rem;
  max-width: 340px;
}
.layer-card-list li {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  font-size: .82rem;
  line-height: 1.5;
  color: var(--parchment);
  opacity: .85;
  text-align: left;
}
.layer-card-list li::before {
  content: '';
  flex-shrink: 0;
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-top: .55rem;
}

/* Dismiss hint */
.layer-dismiss-hint {
  position: absolute;
  bottom: clamp(1.5rem, 5%, 2.5rem);
  left: 50%;
  transform: translateX(-50%);
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--cornflower-blue-dim);
  opacity: 0;
  animation: hint-fade 4s .8s ease-in-out forwards;
  pointer-events: none;
}
@keyframes hint-fade {
  0%   { opacity: 0; }
  15%  { opacity: .5; }
  85%  { opacity: .5; }
  100% { opacity: 0; }
}

/* Layer-specific accent colours on the card */
.layer-card[data-active="perimeter"] .layer-card-accent   { background: rgba(159,184,217,.6); }
.layer-card[data-active="perimeter"] .layer-card-number   { color: var(--cornflower-blue); }
.layer-card[data-active="perimeter"] .layer-card-list li::before { background: rgba(159,184,217,.55); }

.layer-card[data-active="identity"] .layer-card-accent   { background: rgba(78,110,142,.7); }
.layer-card[data-active="identity"] .layer-card-number   { color: var(--twilight-blue); }
.layer-card[data-active="identity"] .layer-card-list li::before { background: rgba(78,110,142,.6); }

.layer-card[data-active="application"] .layer-card-accent   { background: rgba(140,101,77,.7); }
.layer-card[data-active="application"] .layer-card-number   { color: var(--deep-sand); }
.layer-card[data-active="application"] .layer-card-list li::before { background: rgba(140,101,77,.6); }

.layer-card[data-active="data"] .layer-card-accent   { background: rgba(244,215,177,.5); }
.layer-card[data-active="data"] .layer-card-number   { color: var(--sandy-peach); }
.layer-card[data-active="data"] .layer-card-list li::before { background: rgba(244,215,177,.45); }

.layer-card[data-active="compliance"] .layer-card-accent   { background: rgba(139,107,35,.7); }
.layer-card[data-active="compliance"] .layer-card-number   { color: var(--vintage-bronze); }
.layer-card[data-active="compliance"] .layer-card-list li::before { background: rgba(139,107,35,.6); }

/* "Ask the bot" CTA inside the card */
.layer-card-ask {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  margin-top: 1rem;
  padding: .4rem .9rem;
  font-size: .72rem;
  font-weight: 600;
  color: var(--parchment);
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 99px;
  cursor: pointer;
  transition: background .2s;
  position: relative;
  z-index: 1;
}
.layer-card-ask:hover { background: rgba(255,255,255,.12); }

/* ═══════════════════════════════════════════════════════════════
   Chatbot (right column)
   ═══════════════════════════════════════════════════════════════ */
.chat-section {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.chat-section .ai-chat-embed {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}
.chat-section .ai-chat-log {
  flex: 1;
  min-height: 200px;
}
#sec-chat-input {
  flex: 1;
  background: transparent;
  border: none;
  padding: .5rem .4rem;
  font-size: .85rem;
  color: var(--parchment);
  font-family: inherit;
  outline: none;
}
#sec-chat-input::placeholder { color: #5a7a96; }
#sec-chat-send {
  background: var(--deep-sand);
  border: none;
  border-radius: 8px;
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  color: #fff;
  font-size: .85rem;
  cursor: pointer;
  transition: background .2s;
  flex-shrink: 0;
}
#sec-chat-send:hover { background: #a87d63; }

/* ─── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 820px) {
  .sec-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1rem 0 3rem;
  }
  .shield {
    width: min(360px, 85vw);
  }
  .sec-header { padding: 1.5rem 0 .25rem; }
  .ring-label { font-size: .48rem; letter-spacing: .1em; padding: .1rem .4rem; }
  .layer-card { padding: 3rem 2rem; width: min(400px, 92vw); }
  .layer-card-title { font-size: 1.15rem; }
  .layer-card-desc { font-size: .75rem; }
  .layer-card-list li { font-size: .75rem; }
  .layer-card-list { max-width: 260px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .shield-scan,
  .shield-ripple { animation: none; }
  .ring-node::after { animation: none; }
  .layer-overlay, .layer-card { transition-duration: .01s; }
}
