/* ============================================================
   CLYPER — style.css
   Dark minimal · Noir profond · Gris élégant · Blanc pur
   ============================================================ */

/* ---- Reset ---- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ---- Tokens ---- */
:root {
  --bg:          #0D0E12;
  --surface:     #14161C;
  --surface-2:   #1C1F28;
  --border:      #2A2D36;
  --border-hi:   #3A3E4A;

  --text:        #F0F0F2;
  --text-mid:    #9A9EAA;
  --text-low:    #5A5E6A;

  --accent:      #FFFFFF;
  --glow:        rgba(255, 255, 255, 0.04);

  --font-head:   'Montserrat', sans-serif;
  --font-body:   'Jost', sans-serif;

  --radius:      20px;
  --radius-sm:   12px;
  --shadow:      0 16px 56px rgba(0, 0, 0, 0.8);
}

/* ---- Base ---- */
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 32px 20px 0;
  line-height: 1.7;
}

/* ---- Layout ---- */
.container {
  width: 100%;
  max-width: 880px;
  flex: 1;
}

/* ============================================================
   HEADER
   ============================================================ */
.header {
  text-align: center;
  margin-bottom: 44px;
}

.logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
}

.logo-img {
  display: block;
  max-width: 280px;
  height: auto;
}

.tagline {
  font-size: 0.95rem;
  font-weight: 300;
  color: var(--text-mid);
  letter-spacing: 0.03em;
}

/* ============================================================
   DROP ZONE
   ============================================================ */
.drop-zone {
  background: var(--surface);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 64px 24px;
  text-align: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: border-color 0.35s, transform 0.35s;
  outline: none;
}

.drop-zone::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, var(--glow), transparent 65%);
  opacity: 0;
  transition: opacity 0.4s;
  pointer-events: none;
}

.drop-zone:hover,
.drop-zone:focus-visible {
  border-color: var(--text-mid);
  transform: translateY(-3px);
}

.drop-zone:hover::after,
.drop-zone:focus-visible::after {
  opacity: 1;
}

.drop-zone.dragover {
  border-color: var(--text);
  transform: scale(1.015);
}

.drop-inner {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.drop-icon {
  font-size: 3.2rem;
  color: var(--text-low);
  margin-bottom: 6px;
  transition: color 0.3s;
}

.drop-zone:hover .drop-icon,
.drop-zone.dragover .drop-icon {
  color: var(--text-mid);
}

.drop-title {
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--text);
}

.drop-sub {
  font-size: 0.82rem;
  font-weight: 300;
  color: var(--text-low);
  letter-spacing: 0.02em;
}

.drop-sub i {
  margin-right: 5px;
  color: var(--text-mid);
}

.btn-browse {
  margin-top: 10px;
  padding: 9px 22px;
  background: transparent;
  border: 1px solid var(--border-hi);
  border-radius: 40px;
  color: var(--text-mid);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  cursor: pointer;
  transition: border-color 0.3s, color 0.3s;
}

.btn-browse i {
  margin-right: 6px;
}

.btn-browse:hover {
  border-color: var(--text-mid);
  color: var(--text);
}

/* ============================================================
   LOADING
   ============================================================ */
.loading {
  text-align: center;
  padding: 56px 20px;
}

.loading[hidden] { display: none; }

.spinner {
  width: 48px;
  height: 48px;
  border: 2.5px solid var(--border);
  border-top-color: var(--text-mid);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
  margin: 0 auto 18px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading p {
  font-size: 0.9rem;
  font-weight: 300;
  color: var(--text-mid);
  letter-spacing: 0.04em;
}

.loading p i {
  margin-right: 6px;
}

/* ============================================================
   RESULT
   ============================================================ */
.result-section[hidden] { display: none; }

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  margin-top: 30px;
  display: flex;
  gap: 32px;
  box-shadow: var(--shadow);
  animation: rise 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Cover */
.result-cover {
  flex-shrink: 0;
  width: 200px;
  height: 280px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  overflow: hidden;
  box-shadow: 0 8px 28px rgba(0,0,0,0.5);
}

.result-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.result-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-low);
  font-size: 2.5rem;
}

/* Info */
.result-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* === TITRE === */
.result-title {
  font-family: var(--font-head);
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 10px;
}

.result-title i {
  font-size: 1.2rem;
  color: var(--text-mid);
  flex-shrink: 0;
}

/* === ÉPISODE === */
.result-episode {
  font-size: 0.95rem;
  font-weight: 400;
  color: var(--text-mid);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.result-episode i {
  color: var(--text-low);
  font-size: 0.85rem;
}

/* === MÉTADONNÉES LIGNE 1 : Studio · Genre · Note · Année === */
.meta-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-bottom: 14px;
}

.meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-mid);
}

.meta-item i {
  color: var(--text-low);
  font-size: 0.8rem;
  width: 18px;
  text-align: center;
}

.meta-item strong {
  color: var(--text);
  font-weight: 500;
}

/* === CONFIDENCE === */
.conf-wrap {
  margin-bottom: 14px;
}

.conf-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-low);
  margin-bottom: 5px;
}

.conf-header strong {
  color: var(--text);
  font-weight: 500;
}

.conf-track {
  height: 3px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
}

.conf-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--text-mid);
  width: 0%;
  transition: width 1.1s cubic-bezier(0.22, 1, 0.36, 1);
}

/* === SYNOPSIS === */
.synopsis {
  font-size: 0.875rem;
  font-weight: 300;
  line-height: 1.85;
  color: var(--text-mid);
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 15;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* === GENRES (tags) === */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.tag {
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 4px 14px;
  border-radius: 20px;
  background: transparent;
  border: 1px solid var(--border-hi);
  color: var(--text-mid);
}

/* === PIED DE CARTE : plus d'infos === */
.result-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}

.result-footer-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--text-low);
}

.result-footer-item i {
  font-size: 0.78rem;
  width: 18px;
  text-align: center;
  color: var(--text-low);
}

.result-footer-item span {
  color: var(--text);
  font-weight: 500;
}

/* ============================================================
   STREAMING ANIMATIONS
   ============================================================ */
.streaming-text {
  animation: pulseText 1.2s ease-in-out infinite;
}

@keyframes pulseText {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.9; }
}

.streaming-dots {
  display: inline-block;
  animation: dots 1.2s steps(4) infinite;
}

@keyframes dots {
  0% { content: ''; }
  25% { content: '.'; }
  50% { content: '..'; }
  75% { content: '...'; }
}

.streaming-progress {
  animation: progressPulse 1.5s ease-in-out infinite;
  width: 30% !important;
}

@keyframes progressPulse {
  0%, 100% { width: 20%; }
  50% { width: 70%; }
}

.skeleton-cover {
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--surface-2) 25%, var(--border) 50%, var(--surface-2) 75%);
  background-size: 200% 200%;
  animation: shimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Streaming reveal */
.streaming-reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.streaming-reveal.show {
  opacity: 1;
  transform: translateY(0);
}

/* ============================================================
   ERROR STATE
   ============================================================ */
.result-card.error {
  border-color: var(--border-hi);
  justify-content: center;
  text-align: center;
  padding: 48px 28px;
}

.error-icon {
  font-size: 2.5rem;
  color: var(--text-mid);
  margin-bottom: 12px;
}

.error-title {
  font-family: var(--font-head);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.error-msg {
  font-size: 0.875rem;
  font-weight: 300;
  color: var(--text-mid);
}

/* ============================================================
   FOOTER / SOCIAL
   ============================================================ */
.footer {
  width: 100%;
  max-width: 880px;
  margin: 48px auto 0;
  padding: 32px 20px 28px;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer-label {
  font-size: 0.78rem;
  font-weight: 400;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-low);
  margin-bottom: 18px;
}

.social-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 22px;
}

.social-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 18px;
  border-radius: 40px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-mid);
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.25s, color 0.25s, transform 0.2s;
}

.social-btn i {
  font-size: 1rem;
  transition: color 0.25s;
}

.social-btn:hover {
  transform: translateY(-2px);
  border-color: var(--text-mid);
  color: var(--text);
}

.social-btn:hover i {
  color: var(--text);
}

.footer-copy {
  font-size: 0.75rem;
  font-weight: 300;
  color: var(--text-low);
  letter-spacing: 0.03em;
}

.footer-links {
  margin: 16px 0 12px;
  display: flex;
  justify-content: center;
  gap: 8px;
  font-size: 0.8rem;
}

.footer-link {
  color: var(--text-low);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-link:hover {
  color: var(--text-mid);
}

.footer-sep {
  color: var(--text-low);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 680px) {
  .logo-img {
    max-width: 200px;
  }

  .result-card {
    flex-direction: column;
    align-items: center;
    padding: 20px;
  }

  .result-cover {
    width: 160px;
    height: 224px;
  }

  .result-title {
    font-size: 1.5rem;
    justify-content: center;
    text-align: center;
  }

  .result-episode {
    justify-content: center;
    text-align: center;
  }

  .meta-grid {
    justify-content: center;
  }

  .result-footer {
    justify-content: center;
  }

  .drop-zone {
    padding: 48px 16px;
  }
}

@media (max-width: 420px) {
  .logo-img {
    max-width: 160px;
  }

  .social-btn span { display: none; }
  .social-btn { padding: 10px 14px; }
}

/* ---- Reduced motion ---- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}