/* ==========================================================================
   MMM Study — The Study Signal (Phase 2.4 Natural Academic Refinement)
   Warm, Dignified, Understated Academic Loading Experience
   Myanmar Matriculation Academic Learning Platform
   ========================================================================== */

#study-signal-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 99999;
  background-color: #0B0F17;
  color: #F5F2EB;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  opacity: 1;
  visibility: visible;
  transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.35s ease;
  overflow-y: auto;
  overflow-x: hidden;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#study-signal-overlay.study-signal-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Development Preview & Test Badges */
.study-signal-dev-badge {
  position: absolute;
  top: 18px;
  right: 18px;
  background: rgba(18, 24, 38, 0.95);
  border: 1px solid rgba(197, 168, 128, 0.35);
  padding: 5px 12px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: #E7E3D8;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  z-index: 10;
}

.study-signal-dev-badge.study-signal-test-badge {
  border-color: rgba(197, 168, 128, 0.45);
}

.study-signal-dev-badge .dev-tag {
  color: #D4AF37;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.05em;
}

.study-signal-dev-badge.study-signal-test-badge .dev-tag {
  color: #C5A880;
}

.btn-preview-dismiss {
  background: rgba(245, 242, 235, 0.1);
  border: 1px solid rgba(245, 242, 235, 0.18);
  color: #F5F2EB;
  padding: 3px 9px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-preview-dismiss:hover {
  background: rgba(245, 242, 235, 0.2);
}

/* Hairline Top Progress Stream (For Warm Navigation) */
#study-signal-top-progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  z-index: 100000;
  background: transparent;
  pointer-events: none;
  overflow: hidden;
  display: none;
}

#study-signal-top-progress.active {
  display: block;
}

#study-signal-top-progress::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -100%;
  width: 100%;
  background: linear-gradient(90deg, transparent 0%, #C5A880 50%, #D4AF37 75%, transparent 100%);
  animation: signalTopProgress 1.8s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

@keyframes signalTopProgress {
  0% { left: -100%; width: 35%; }
  50% { left: 25%; width: 75%; }
  100% { left: 100%; width: 35%; }
}

/* Central Composition Frame */
.study-signal-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 420px;
  width: 100%;
  margin: auto;
  position: relative;
  box-sizing: border-box;
}

/* Official Logo Wrap */
.study-signal-logo-wrap {
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.study-signal-logo {
  width: 38px;
  height: 38px;
  object-fit: contain;
  border-radius: 8px;
  image-rendering: -webkit-optimize-contrast;
  display: block;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
}

/* Academic Brand Hierarchy */
.study-signal-eyebrow {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #8C867A;
  margin-bottom: 6px;
}

.study-signal-brand {
  font-size: clamp(22px, 4.5vw, 26px);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #F5F2EB;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.study-signal-brand-dot {
  width: 5px;
  height: 5px;
  background: #C5A880;
  border-radius: 50%;
  opacity: 0.9;
}

.study-signal-subtitle {
  font-size: 12px;
  font-weight: 400;
  color: #A8A29E;
  letter-spacing: 0.02em;
  margin-bottom: 20px;
}

/* Tasteful Open-Book Fine-Line Illustration */
.study-signal-graphic {
  width: 140px;
  height: 96px;
  margin-bottom: 18px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.study-signal-svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.study-signal-spine {
  stroke: #C5A880;
  stroke-width: 1.5;
  stroke-linecap: round;
  opacity: 0.95;
}

.study-signal-outer-page {
  stroke: #F5F2EB;
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  opacity: 0.88;
  animation: signalAcademicBreathe 3.6s ease-in-out infinite;
}

.study-signal-inner-page {
  stroke: rgba(245, 242, 235, 0.32);
  stroke-width: 1;
  stroke-dasharray: 2 4;
  fill: none;
}

.study-signal-base-line {
  stroke: rgba(197, 168, 128, 0.22);
  stroke-width: 1.2;
  stroke-linecap: round;
}

@keyframes signalAcademicBreathe {
  0%, 100% {
    opacity: 0.8;
    stroke: rgba(245, 242, 235, 0.82);
  }
  50% {
    opacity: 1;
    stroke: #FDFBF7;
  }
}

/* Six Subtle Subject Indicators with Exact Labels */
.study-signal-subjects {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
  width: 100%;
  max-width: 320px;
}

.signal-pip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 40px;
  transition: all 0.3s ease;
}

.signal-pip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  opacity: 0.35;
  transition: all 0.3s ease;
}

.signal-pip-code {
  font-size: 9.5px;
  font-weight: 500;
  color: #78716C;
  letter-spacing: 0.02em;
  transition: color 0.3s ease;
}

/* Restrained Muted Academic Subject Hues */
.pip-myan .signal-pip-dot { background: #D96B74; } /* Academic Rose */
.pip-eng  .signal-pip-dot { background: #5B8FB9; } /* Slate Blue */
.pip-math .signal-pip-dot { background: #D4A359; } /* Warm Ochre Gold */
.pip-chem .signal-pip-dot { background: #4FA882; } /* Muted Sage */
.pip-phy  .signal-pip-dot { background: #8E82B5; } /* Soft Amethyst */
.pip-bio  .signal-pip-dot { background: #68A678; } /* Botanical Laurel */

.signal-pip.active .signal-pip-dot {
  opacity: 1;
  transform: scale(1.25);
  box-shadow: 0 0 6px currentColor;
}

.signal-pip.active .signal-pip-code {
  color: #F5F2EB;
  font-weight: 600;
}

/* Hairline Pure Stream Progress Track */
.study-signal-progress-track {
  width: 180px;
  height: 1.75px;
  background: rgba(245, 242, 235, 0.08);
  border-radius: 2px;
  position: relative;
  overflow: hidden;
  margin-bottom: 18px;
}

.study-signal-progress-fill {
  position: absolute;
  top: 0;
  bottom: 0;
  left: -100%;
  width: 100%;
  background: linear-gradient(90deg, transparent 0%, #C5A880 50%, #D4AF37 75%, transparent 100%);
  border-radius: 2px;
  animation: signalStream 2.6s cubic-bezier(0.65, 0, 0.35, 1) infinite;
}

@keyframes signalStream {
  0% { left: -100%; width: 40%; }
  50% { left: 20%; width: 80%; }
  100% { left: 100%; width: 40%; }
}

/* Microcopy */
.study-signal-status-box {
  min-height: 22px;
}

.study-signal-status-en {
  font-size: 13px;
  font-weight: 400;
  color: #E7E3D8;
  letter-spacing: 0.01em;
  margin-bottom: 4px;
}

.study-signal-status-my {
  font-family: 'Noto Sans Myanmar', 'Pyidaungsu', sans-serif;
  font-size: 12px;
  color: #A8A29E;
  line-height: 1.6;
}

/* Graceful 4-Second Timeout / Error State */
.study-signal-error-card {
  display: none;
  background: rgba(20, 25, 36, 0.95);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: 8px;
  padding: 16px 20px;
  margin-top: 22px;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.study-signal-error-card.visible {
  display: block;
  animation: signalFadeIn 0.3s ease-out;
}

@keyframes signalFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.study-signal-error-title {
  font-size: 13px;
  font-weight: 600;
  color: #FCA5A5;
  margin-bottom: 6px;
}

.study-signal-error-desc {
  font-size: 12px;
  color: #CBD5E1;
  margin-bottom: 14px;
  line-height: 1.5;
  font-family: 'Noto Sans Myanmar', 'Pyidaungsu', sans-serif;
}

.study-signal-error-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-signal-retry {
  background: #DC2626;
  border: none;
  color: #FFFFFF;
  font-size: 12px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-signal-retry:hover {
  background: #B91C1C;
}

.btn-signal-bypass {
  background: rgba(245, 242, 235, 0.08);
  border: 1px solid rgba(245, 242, 235, 0.18);
  color: #E7E3D8;
  font-size: 12px;
  font-weight: 500;
  padding: 7px 14px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn-signal-bypass:hover {
  background: rgba(245, 242, 235, 0.16);
}

/* Screen reader announcement utility */
.study-signal-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ================= ACCESSIBILITY: REDUCED MOTION ================= */
@media (prefers-reduced-motion: reduce) {
  .study-signal-outer-page,
  .study-signal-progress-fill,
  #study-signal-top-progress::after,
  .signal-pip.active .signal-pip-dot {
    animation: none !important;
    transition: none !important;
  }
  .study-signal-progress-fill {
    left: 0 !important;
    width: 100% !important;
    opacity: 0.6;
  }
  #study-signal-overlay {
    transition: none !important;
  }
}

/* ================= RESPONSIVE ADJUSTMENTS ================= */
@media (max-width: 480px) {
  #study-signal-overlay {
    padding: 16px;
  }
  .study-signal-dev-badge {
    top: 12px;
    right: 12px;
    padding: 4px 10px;
    font-size: 11px;
    gap: 6px;
  }
  .study-signal-logo {
    width: 34px;
    height: 34px;
  }
  .study-signal-graphic {
    width: 124px;
    height: 84px;
    margin-bottom: 14px;
  }
  .study-signal-progress-track {
    width: 150px;
  }
  .study-signal-subjects {
    gap: 6px;
    margin-bottom: 16px;
    max-width: 100%;
  }
  .signal-pip {
    min-width: 36px;
    gap: 5px;
  }
  .signal-pip-code {
    font-size: 9px;
  }
  .study-signal-error-card {
    padding: 14px 16px;
    margin-top: 18px;
  }
}

/* Narrow Mobile Screens (360px - 375px) */
@media (max-width: 375px) {
  .study-signal-subjects {
    gap: 4px;
  }
  .signal-pip {
    min-width: 32px;
  }
  .signal-pip-code {
    font-size: 8.5px;
  }
  .study-signal-brand {
    font-size: 21px;
  }
}
