/* ============================================================
   KS Industry · Marine Robotics Lab — Global Styles
   ============================================================ */

:root {
  --ks-navy: #070d1f;
  --ks-navy2: #0d1632;
  --ks-deep: #040814;
  --ks-cyan: #00d4ff;
  --ks-cyan-soft: #7ee0f5;
  --ks-glow: #3b82f6;
}

html { scroll-behavior: smooth; }
body { background: var(--ks-deep); }

/* Hide horizontal scroll caused by background glows */
html, body { overflow-x: hidden; }

/* ---------- Hero Background ---------- */
.hero-bg {
  background:
    radial-gradient(ellipse 80% 55% at 70% 30%, rgba(0,212,255,0.18) 0%, rgba(0,212,255,0) 60%),
    radial-gradient(ellipse 70% 50% at 20% 70%, rgba(59,130,246,0.18) 0%, rgba(59,130,246,0) 60%),
    linear-gradient(180deg, #040814 0%, #070d1f 50%, #040814 100%);
  position: relative;
}
.hero-bg::before {
  content: "";
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(0,212,255,0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,212,255,0.06) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 70% 50% at 50% 50%, black 30%, transparent 80%);
  pointer-events: none;
}

.section-bg {
  background:
    radial-gradient(ellipse 60% 40% at 50% 0%, rgba(0,212,255,0.07) 0%, transparent 70%),
    #040814;
}

/* ---------- Glass cards ---------- */
.glass {
  background: linear-gradient(180deg, rgba(20,30,55,0.65) 0%, rgba(10,16,32,0.65) 100%);
  border: 1px solid rgba(0,212,255,0.15);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.glass-strong {
  background: linear-gradient(180deg, rgba(20,30,55,0.85) 0%, rgba(10,16,32,0.85) 100%);
  border: 1px solid rgba(0,212,255,0.22);
  backdrop-filter: blur(14px);
}

/* ---------- Animated gradient text ---------- */
.text-gradient {
  background: linear-gradient(90deg, #00d4ff 0%, #7ee0f5 35%, #3b82f6 70%, #00d4ff 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: gradient-pan 8s linear infinite;
}
@keyframes gradient-pan {
  to { background-position: 200% 0; }
}

/* ---------- Buttons ---------- */
.btn-primary {
  background: linear-gradient(135deg, #00d4ff 0%, #3b82f6 100%);
  color: #040814;
  font-weight: 700;
  box-shadow: 0 8px 30px rgba(0,212,255,0.35);
  transition: transform .2s ease, box-shadow .2s ease;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 40px rgba(0,212,255,0.45); }

.btn-ghost {
  border: 1px solid rgba(0,212,255,0.35);
  color: #e5f7ff;
  background: rgba(0,212,255,0.06);
  transition: all .2s ease;
}
.btn-ghost:hover { background: rgba(0,212,255,0.15); border-color: rgba(0,212,255,0.6); }

/* ---------- Glow accent ---------- */
.glow-border {
  position: relative;
}
.glow-border::after {
  content: "";
  position: absolute; inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, rgba(0,212,255,0.6), rgba(59,130,246,0.0) 50%, rgba(0,212,255,0.4));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}

/* ---------- Pulse dot ---------- */
.pulse-dot {
  position: relative;
  width: 8px; height: 8px;
  background: #00d4ff;
  border-radius: 9999px;
}
.pulse-dot::after {
  content: ""; position: absolute; inset: -6px;
  border-radius: 9999px;
  background: rgba(0,212,255,0.5);
  animation: pulse 1.8s ease-out infinite;
}
@keyframes pulse {
  0% { transform: scale(0.6); opacity: 0.9; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* ---------- Reveal on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .8s ease, transform .8s ease;
  will-change: opacity, transform;
}
.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Chat widget ---------- */
.chat-launcher {
  background: linear-gradient(135deg, #00d4ff 0%, #3b82f6 100%);
  box-shadow: 0 10px 40px rgba(0,212,255,0.45), 0 0 0 4px rgba(0,212,255,0.12);
}
.chat-launcher:hover { transform: translateY(-3px) scale(1.04); }

.chat-panel {
  background:
    radial-gradient(ellipse 70% 60% at 50% 0%, rgba(0,212,255,0.08) 0%, transparent 60%),
    linear-gradient(180deg, #0a1226 0%, #060a18 100%);
  border: 1px solid rgba(0,212,255,0.2);
  box-shadow: 0 30px 80px rgba(0,0,0,0.6), 0 0 0 1px rgba(0,212,255,0.08);
}

.bubble-user {
  background: linear-gradient(135deg, #00d4ff 0%, #3b82f6 100%);
  color: #040814;
}
.bubble-bot {
  background: rgba(20,30,55,0.85);
  border: 1px solid rgba(0,212,255,0.18);
  color: #e5f7ff;
}

/* Typing indicator dots */
.typing span {
  display: inline-block; width: 6px; height: 6px;
  margin: 0 2px;
  background: #00d4ff; border-radius: 50%;
  opacity: 0.4;
  animation: typing 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-4px); }
}

/* ---------- Floating compass icon (MARIN avatar accent) ---------- */
.compass-ring {
  background: conic-gradient(from 0deg, #00d4ff, #3b82f6, #00d4ff);
  -webkit-mask: radial-gradient(circle, transparent 60%, black 62%);
          mask: radial-gradient(circle, transparent 60%, black 62%);
  animation: spin 14s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Roadmap timeline ---------- */
.timeline-line {
  background: linear-gradient(180deg, rgba(0,212,255,0.6), rgba(0,212,255,0.1));
}

/* ---------- Scrollbar (chat) ---------- */
.chat-scroll::-webkit-scrollbar { width: 6px; }
.chat-scroll::-webkit-scrollbar-track { background: transparent; }
.chat-scroll::-webkit-scrollbar-thumb {
  background: rgba(0,212,255,0.25); border-radius: 4px;
}

/* ---------- Industry card hover ---------- */
.industry-card { transition: transform .3s ease, border-color .3s ease, background .3s ease; }
.industry-card:hover {
  transform: translateY(-6px);
  border-color: rgba(0,212,255,0.45);
  background: linear-gradient(180deg, rgba(20,30,55,0.85) 0%, rgba(10,16,32,0.85) 100%);
}

/* ---------- Marquee badges ---------- */
.marquee {
  display: flex; gap: 2rem;
  animation: marquee 30s linear infinite;
}
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ---------- Safe area for fixed chat ---------- */
@media (max-width: 640px) {
  .chat-panel-mobile {
    width: 100vw !important;
    height: auto !important;
    max-height: calc(100dvh - 5rem) !important; /* 상단 5rem 여유 확보(헤더 가림 방지) */
    top: 5rem !important;
    right: 0 !important;
    bottom: 0 !important;
    border-radius: 16px 16px 0 0 !important;
  }
}

/* ---------- Reality cards (industry photo cards) ---------- */
.reality-card {
  border: 1px solid rgba(255,255,255,0.06);
  box-shadow: 0 30px 60px -30px rgba(0,0,0,0.6);
  transition: transform 0.4s ease, border-color 0.4s ease;
}
.reality-card:hover {
  transform: translateY(-4px);
  border-color: rgba(0,212,255,0.35);
}

/* ---------- Client chips ---------- */
.client-chip {
  border: 1px solid rgba(255,255,255,0.06);
  transition: all 0.25s ease;
}
.client-chip:hover {
  border-color: rgba(0,212,255,0.4);
  transform: translateY(-2px);
  background: rgba(0,212,255,0.04);
}

/* ---------- Product table responsive tweaks ---------- */
@media (max-width: 768px) {
  table { font-size: 12px; }
}

/* ---------- Section dividers (subtle) ---------- */
.section-bg {
  position: relative;
}
.section-bg::before {
  content: '';
  position: absolute;
  top: 0; left: 50%;
  transform: translateX(-50%);
  width: 60%;
  max-width: 600px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,212,255,0.25), transparent);
}

/* ============================================================
   Phone Frame (Hero Demo iframe)
   ============================================================ */
.phone-frame {
  position: relative;
  /* Sized to match the mil-mro /m/ demo's native 375x812 viewport
     so the iframe renders at native 1:1 pixel ratio (no scale = no blur). */
  width: 380px;
  height: 796px;
  margin: 0 auto;
  background: linear-gradient(145deg, #0a1024, #050912);
  border-radius: 44px;
  padding: 14px 12px;
  box-shadow:
    0 0 0 2px rgba(0, 212, 255, 0.25),
    0 0 0 8px rgba(255, 255, 255, 0.04),
    0 25px 60px rgba(0, 0, 0, 0.6),
    0 0 80px rgba(0, 212, 255, 0.15);
}

.phone-notch {
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 110px;
  height: 22px;
  background: #000;
  border-radius: 0 0 16px 16px;
  z-index: 3;
}
.phone-notch::after {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 50px;
  height: 6px;
  background: #1a1f2e;
  border-radius: 3px;
}

.phone-screen {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 32px;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(0, 212, 255, 0.15);
}
.phone-screen iframe,
.phone-iframe {
  display: block;
  border: 0;
  width: 100%;
  height: 100%;
  /* No transform/scale — frame is sized to demo's native 375x812 viewport
     so text renders at native pixel density without blur or distortion. */
}

.phone-side-btn {
  position: absolute;
  background: #1a2030;
  border-radius: 2px;
}
.phone-btn-power {
  right: -3px;
  top: 130px;
  width: 3px;
  height: 60px;
}
.phone-btn-vol-up {
  left: -3px;
  top: 110px;
  width: 3px;
  height: 36px;
}
.phone-btn-vol-dn {
  left: -3px;
  top: 160px;
  width: 3px;
  height: 56px;
}

/* Maintain native 375:812 viewport aspect ratio at smaller breakpoints
   so iframe content stays sharp without transform scaling. */
@media (max-width: 1024px) {
  .phone-frame { width: 320px; height: 668px; }
}
@media (max-width: 380px) {
  .phone-frame { width: 280px; height: 580px; }
}

/* ============================================================
   Chat avatar gender toggle
   ============================================================ */
.avatar-toggle {
  color: #94a3b8;
  background: transparent;
}
.avatar-toggle:hover {
  color: #cbd5e1;
}
.avatar-toggle.avatar-toggle-active {
  background: linear-gradient(135deg, rgba(0, 212, 255, 0.25), rgba(0, 212, 255, 0.1));
  color: #00d4ff;
  border: 1px solid rgba(0, 212, 255, 0.3);
  box-shadow: 0 0 12px rgba(0, 212, 255, 0.2);
}

#chat-hero-avatar {
  transition: opacity 0.25s ease, transform 0.25s ease;
}
#chat-hero-avatar.avatar-swapping {
  opacity: 0;
  transform: scale(0.95);
}

/* Microphone recording state — pulsing red ring */
#chat-mic.mic-recording {
  background: rgba(244, 63, 94, 0.25);
  color: #fb7185;
  animation: mic-pulse 1.2s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(244, 63, 94, 0.7); }
  50% { box-shadow: 0 0 0 6px rgba(244, 63, 94, 0); }
}
