/* ============================
   past-archive.css
   "Το Γράμμα στο Παρελθόν"
   ============================ */

/* ===== PAST FORM PAGE ===== */
.past-form-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 120px 20px 60px;
  position: relative;
  z-index: 1;
}

.past-form-card {
  background: var(--card-bg);
  border: 2px solid var(--border);
  padding: 50px;
  border-radius: 12px;
  width: 100%;
  max-width: 600px;
  animation: borderGlow 3s ease-in-out infinite;
}

.past-form-card h2 {
  font-family: 'HeadingFont', sans-serif;
  color: var(--neon);
  font-size: 2.2rem;
  margin-bottom: 10px;
  text-align: center;
}

.past-form-card .subtitle {
  text-align: center;
  color: var(--text-light);
  margin-bottom: 40px;
  font-size: 1rem;
  line-height: 1.6;
}

.past-form-card label {
  display: block;
  color: var(--neon);
  font-family: 'HeadingFont', sans-serif;
  font-size: 0.9rem;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.past-form-card .past-success {
  display: none;
  text-align: center;
  padding: 60px 20px;
}

.past-form-card .past-success-icon {
  font-size: 3rem;
  margin-bottom: 20px;
}

.past-form-card .past-success h3 {
  font-family: 'HeadingFont', sans-serif;
  color: var(--neon);
  font-size: 1.5rem;
  margin-bottom: 15px;
}

.past-form-card .past-success p {
  color: var(--text-light);
  font-size: 1.1rem;
  line-height: 1.7;
}

.past-hint {
  display: flex;
  align-items: center;
  background: rgba(0, 242, 255, 0.08);
  border: 1px solid rgba(0, 242, 255, 0.2);
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 20px;
  color: var(--text-light);
  font-size: 0.85rem;
  line-height: 1.5;
}

.past-local-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 242, 255, 0.06);
  border: 1px solid rgba(0, 242, 255, 0.15);
  border-radius: 20px;
  padding: 8px 16px;
  margin-bottom: 20px;
  color: var(--neon);
  font-size: 0.8rem;
  font-family: 'HeadingFont', sans-serif;
  letter-spacing: 1px;
  animation: archiveFadeIn 1s ease;
}

.past-local-badge svg {
  flex-shrink: 0;
}

.past-back-link {
  display: inline-block;
  margin-top: 30px;
  color: var(--text-light);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s;
}

.past-back-link:hover {
  color: var(--neon);
}

/* ===== INTERCEPTION OVERLAY ===== */
#past-archive-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 9999;
  background: #000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 60px 30px;
  overflow-y: auto;
  transition: background 0.8s ease;
}

#past-archive-overlay > .archive-phase-1,
#past-archive-overlay > .archive-phase-2 {
  margin-top: auto;
  margin-bottom: auto;
  width: 100%;
  max-width: 720px;
}

#past-archive-overlay.revealed {
  background: #1a1008;
}

/* ===== CRT Scanlines ===== */
.archive-scanlines {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(255, 255, 255, 0.015) 2px,
    rgba(255, 255, 255, 0.015) 4px
  );
  animation: archiveScanMove 8s linear infinite;
}

@keyframes archiveScanMove {
  0% { background-position: 0 0; }
  100% { background-position: 0 100px; }
}

/* ===== Floating Dust Particles ===== */
.archive-dust {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.archive-dust-particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: rgba(255, 215, 0, 0.3);
  border-radius: 50%;
  animation: archiveDustFloat var(--dur, 12s) ease-in-out var(--delay, 0s) infinite;
}

@keyframes archiveDustFloat {
  0% {
    transform: translateY(100vh) translateX(0) scale(0);
    opacity: 0;
  }
  20% {
    opacity: 0.4;
  }
  80% {
    opacity: 0.4;
  }
  100% {
    transform: translateY(-10vh) translateX(var(--drift, 50px)) scale(1);
    opacity: 0;
  }
}

/* ===== PHASE 1: Black screen with message ===== */
.archive-phase-1 {
  text-align: center;
  max-width: 750px;
  width: 100%;
  position: relative;
  z-index: 2;
}

.archive-typewriter-wrap {
  color: #ccc;
  font-family: 'BodyFont', monospace;
  font-size: clamp(1rem, 2.5vw, 1.3rem);
  line-height: 1.9;
  margin-bottom: 50px;
  min-height: 5em;
  opacity: 0;
  animation: archiveFadeIn 2s ease forwards;
}

@keyframes archiveFadeIn {
  to { opacity: 1; }
}

.archive-cursor {
  display: inline;
  animation: archiveBlink 0.7s step-end infinite;
  color: var(--neon);
}

@keyframes archiveBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.archive-open-btn {
  padding: 18px 50px;
  background: transparent;
  border: 3px solid #d4a017;
  color: #d4a017;
  font-family: 'HeadingFont', sans-serif;
  font-size: clamp(1rem, 2vw, 1.3rem);
  letter-spacing: 4px;
  cursor: pointer;
  transition: all 0.3s;
  text-transform: uppercase;
  display: none;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
  animation: archiveBtnPulse 1.5s ease-in-out infinite;
}

@keyframes archiveBtnPulse {
  0%, 100% {
    border-color: #d4a017;
    box-shadow: 0 0 10px rgba(212, 160, 23, 0.3);
    transform: scale(1);
  }
  50% {
    border-color: #ffd700;
    box-shadow: 0 0 40px rgba(212, 160, 23, 0.7);
    transform: scale(1.05);
  }
}

.archive-open-btn::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: #d4a017;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
  z-index: -1;
}

.archive-open-btn:hover {
  color: #000;
}

.archive-open-btn:hover::before {
  width: 400px;
  height: 400px;
}

/* ===== Dramatic FLASH EFFECT ===== */
#archive-flash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #fff;
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
}

#archive-flash.active {
  animation: archiveFlash 0.45s ease forwards;
}

@keyframes archiveFlash {
  0% { opacity: 1; transform: scale(1); }
  30% { transform: scale(1.02); }
  100% { opacity: 0; transform: scale(1); }
}

/* ===== PHASE 2: Letter Reveal ===== */
.archive-phase-2 {
  display: none;
  width: 100%;
  max-width: 720px;
  padding: 20px;
  text-align: center;
  position: relative;
  z-index: 2;
}

.archive-phase-2.active {
  display: block;
  animation: archiveLetterAppear 0.7s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes archiveLetterAppear {
  0% {
    opacity: 0;
    transform: scale(0.85) translateY(30px) rotate(-1deg);
    filter: blur(4px);
  }
  60% {
    transform: scale(1.02) translateY(-5px) rotate(0.5deg);
    filter: blur(0);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0) rotate(0);
    filter: blur(0);
  }
}

.archive-letter {
  background: #f4e4c1;
  color: #2c1810;
  padding: 50px 45px;
  border-radius: 4px;
  font-family: 'Courier New', 'BodyFont', monospace;
  font-size: clamp(0.95rem, 2vw, 1.1rem);
  line-height: 1.9;
  position: relative;
  box-shadow:
    0 8px 40px rgba(0, 0, 0, 0.6),
    inset 0 0 80px rgba(139, 115, 85, 0.25);
  min-height: 250px;
  white-space: pre-wrap;
  word-wrap: break-word;
  text-align: left;
  overflow: hidden;
  animation: archivePaperGlow 4s ease-in-out infinite;
}

@keyframes archivePaperGlow {
  0%, 100% { box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6), inset 0 0 80px rgba(139, 115, 85, 0.25); }
  50% { box-shadow: 0 8px 50px rgba(139, 115, 85, 0.4), inset 0 0 80px rgba(139, 115, 85, 0.3); }
}

/* Paper texture overlay */
.archive-letter::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 3px,
      rgba(0, 0, 0, 0.02) 3px,
      rgba(0, 0, 0, 0.02) 4px
    ),
    repeating-linear-gradient(
      90deg,
      transparent,
      transparent 30px,
      rgba(0, 0, 0, 0.01) 30px,
      rgba(0, 0, 0, 0.01) 31px
    );
  pointer-events: none;
  border-radius: 4px;
}

/* Worn edges + burning effect */
.archive-letter::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background:
    radial-gradient(ellipse at 8% 15%, transparent 55%, rgba(0, 0, 0, 0.1) 100%),
    radial-gradient(ellipse at 92% 85%, transparent 55%, rgba(0, 0, 0, 0.08) 100%),
    radial-gradient(ellipse at 50% 0%, transparent 70%, rgba(0, 0, 0, 0.04) 100%);
  pointer-events: none;
  border-radius: 4px;
  animation: archiveEdgeFlicker 6s ease-in-out infinite;
}

@keyframes archiveEdgeFlicker {
  0%, 100% { opacity: 1; }
  25% { opacity: 0.85; }
  50% { opacity: 0.95; }
  75% { opacity: 0.8; }
}

.archive-letter-date {
  text-align: right;
  margin-bottom: 30px;
  font-style: italic;
  color: #6b4a35;
  font-size: 0.95rem;
  font-family: 'Courier New', 'BodyFont', monospace;
  position: relative;
  z-index: 1;
}

.archive-letter-body {
  font-family: inherit;
  position: relative;
  z-index: 1;
  white-space: pre-wrap;
}

.archive-letter-seal {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  margin-top: 40px;
  position: relative;
  z-index: 1;
}

.archive-seal-svg {
  width: 55px;
  height: 55px;
  animation: archiveSealDrop 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.3));
}

@keyframes archiveSealDrop {
  0% {
    transform: translateY(-30px) scale(0.3) rotate(-15deg);
    opacity: 0;
  }
  60% {
    transform: translateY(5px) scale(1.1) rotate(3deg);
    opacity: 1;
  }
  100% {
    transform: translateY(0) scale(1) rotate(0);
    opacity: 1;
  }
}

.archive-seal-text {
  color: #8b7355;
  font-family: 'Courier New', monospace;
  font-size: 0.8rem;
  letter-spacing: 3px;
  opacity: 0.5;
}

.archive-close-btn {
  margin-top: 30px;
  padding: 14px 35px;
  background: transparent;
  border: 2px solid #8b7355;
  color: #8b7355;
  font-family: 'HeadingFont', sans-serif;
  font-size: 1rem;
  letter-spacing: 2px;
  cursor: pointer;
  transition: all 0.3s;
  border-radius: 6px;
  text-transform: uppercase;
  position: relative;
  z-index: 2;
}

.archive-close-btn:hover {
  background: #8b7355;
  color: #f4e4c1;
  box-shadow: 0 0 20px rgba(139, 115, 85, 0.4);
  transform: translateY(-2px);
}

/* ===== SHARE BAR ===== */
.archive-share-bar {
  margin-top: 30px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 2;
}

.archive-share-label {
  font-family: 'Courier New', 'BodyFont', monospace;
  font-size: 0.8rem;
  color: #8b7355;
  letter-spacing: 2px;
  text-transform: uppercase;
  opacity: 0.7;
}

.archive-share-buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.archive-share-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid #8b7355;
  background: transparent;
  color: #8b7355;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  padding: 0;
}

.archive-share-btn:hover {
  background: #8b7355;
  color: #f4e4c1;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(139, 115, 85, 0.3);
}

.archive-share-btn svg {
  display: block;
}

/* ---- Brand on letter (geia icon + stomellon.gr) ---- */
.archive-letter-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 30px;
  padding-top: 20px;
  border-top: 1px solid rgba(139, 115, 85, 0.3);
  position: relative;
  z-index: 1;
}

.archive-brand-icon {
  border-radius: 4px;
  display: block;
}

.archive-brand-text {
  font-family: 'HeadingFont', Georgia, serif;
  font-size: 0.95rem;
  color: #8b7355;
  letter-spacing: 2px;
  font-weight: bold;
}

/* ---- Prominent Download Button ---- */
.archive-download-btn {
  margin-top: 20px;
  width: 100%;
  max-width: 320px;
  padding: 14px 24px;
  border: 2px solid #d4a017;
  border-radius: 30px;
  background: linear-gradient(135deg, rgba(212, 160, 23, 0.12), rgba(212, 160, 23, 0.06));
  color: #d4a017;
  font-family: 'HeadingFont', sans-serif;
  font-size: 1rem;
  font-weight: bold;
  letter-spacing: 2px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  transition: all 0.3s ease;
  animation: archiveDownloadPulse 2s ease-in-out infinite;
  text-transform: uppercase;
}

.archive-download-btn:hover {
  background: linear-gradient(135deg, #d4a017, #b8860b);
  color: #1a1008;
  box-shadow: 0 0 30px rgba(212, 160, 23, 0.5), 0 0 60px rgba(212, 160, 23, 0.2);
  transform: translateY(-3px) scale(1.02);
}

@keyframes archiveDownloadPulse {
  0%, 100% {
    box-shadow: 0 0 10px rgba(212, 160, 23, 0.2);
    border-color: #d4a017;
  }
  50% {
    box-shadow: 0 0 25px rgba(212, 160, 23, 0.5);
    border-color: #ffd700;
  }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .past-form-card {
    padding: 25px 15px;
  }

  .past-form-card h2 {
    font-size: 1.5rem;
  }

  .past-form-card .past-success h3 {
    font-size: 1.2rem;
  }

  .past-form-card .past-success p {
    font-size: 0.95rem;
  }

  .archive-phase-2 {
    padding: 10px;
  }

  .archive-letter {
    padding: 30px 20px 25px;
  }

  .archive-letter-date {
    font-size: 0.85rem;
    margin-bottom: 20px;
  }

  .archive-open-btn {
    padding: 14px 30px;
    font-size: 1rem;
  }

  .archive-share-btn {
    width: 40px;
    height: 40px;
  }

  .archive-download-btn {
    max-width: 100%;
    padding: 12px 18px;
    font-size: 0.85rem;
  }

  .archive-letter-brand {
    margin-top: 20px;
    padding-top: 15px;
  }

  .archive-brand-text {
    font-size: 0.8rem;
  }

  .archive-seal-svg {
    width: 40px;
    height: 40px;
  }
}

@media (max-width: 480px) {
  .archive-letter {
    padding: 25px 15px 20px;
    font-size: 0.9rem;
  }

  .archive-seal-svg {
    width: 35px;
    height: 35px;
  }
}

/* ===== FALLBACK: Disable animations if user prefers reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  .archive-typewriter-wrap,
  .archive-open-btn,
  #archive-flash,
  .archive-phase-2,
  .archive-scanlines,
  .archive-dust-particle,
  .archive-seal-svg {
    animation: none !important;
  }

  #past-archive-overlay {
    transition: none;
  }

  .archive-open-btn {
    animation: none !important;
    border-color: #d4a017;
  }

  .archive-letter {
    animation: none !important;
  }

  .archive-letter::after {
    animation: none !important;
  }
}
