/* Terminal, neon monospace aesthetic for Bookend */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Courier New', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
  background: #000000;
  color: #e0e0e0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  position: relative;
}

#shader-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  display: none;
}

.crt-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.2);
  width: min(95vw, 1000px);
  aspect-ratio: 800 / 670;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  animation: crtIntro 2.5s ease-out forwards;
  animation-delay: 0.5s;
}

@keyframes crtIntro {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.2);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.2);
  }
  40% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(0.2);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.crt-monitor {
  position: absolute;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 10;
  pointer-events: none;
}

.crt-screen {
  position: absolute;
  width: 72.5%;
  height: 72.4%;
  top: 11%;
  left: 13.75%;
  background: black;
  overflow: hidden;
  z-index: 5;
  pointer-events: auto;
  border-radius: 8px;
  box-shadow: 
    inset 0 0 40px rgba(0, 255, 65, 0.1),
    inset 0 0 80px rgba(0, 255, 65, 0.05),
    0 0 40px rgba(0, 255, 65, 0.2);
}

.crt-screen::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    rgba(0, 255, 65, 0.03) 50%,
    rgba(0, 0, 0, 0.25) 50%
  );
  background-size: 100% 4px;
  pointer-events: none;
  z-index: 20;
  animation: scanlines 8s linear infinite;
}

.crt-screen::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 255, 65, 0.03) 1px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0) 3px
  );
  pointer-events: none;
  z-index: 21;
  opacity: 0.7;
}

@keyframes scanlines {
  0% { transform: translateY(0); }
  100% { transform: translateY(10px); }
}

.crt-content {
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8% 15%;
  padding-bottom: 25%;
  position: relative;
  opacity: 0;
  animation: contentFadeIn 1s ease-out forwards, flicker 0.15s infinite;
  animation-delay: 1.8s, 2.8s;
}

@keyframes contentFadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

@keyframes flicker {
  0% { opacity: 1; }
  50% { opacity: 0.98; }
  100% { opacity: 1; }
}

.container {
  width: 100%;
  text-align: center;
  position: relative;
  z-index: 1;
}

.hero { margin-bottom: 40px; }

.ascii-art {
  font-family: 'Courier New', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
  font-size: clamp(7px, 1.4vw, 11px);
  line-height: 1;
  color: #00ff41;
  white-space: pre;
  margin: 10px 0;
  text-shadow: 0 0 6px #00ff41, 0 0 12px rgba(0, 255, 65, 0.4);
  animation: glowPulse 2.4s ease-in-out infinite alternate;
  overflow: hidden;
}

@keyframes glowPulse {
  from { text-shadow: 0 0 4px #00ff41, 0 0 8px rgba(0,255,65,0.3); }
  to   { text-shadow: 0 0 10px #00ff41, 0 0 22px rgba(0,255,65,0.6); }
}

.cursor {
  display: inline-block;
  width: 0.65ch;
  margin-left: 2px;
  color: #00ff41;
  text-shadow: 0 0 8px #00ff41;
  animation: blink 1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.tagline {
  font-size: clamp(11px, 1.8vw, 14px);
  color: #00ff41;
  margin: 15px 0;
  line-height: 1.6;
}

.manifesto {
  margin: 20px auto;
  text-align: left;
  padding: 0;
}

.manifesto p {
  color: #00ff41;
  font-size: clamp(11px, 1.8vw, 14px);
  line-height: 1.6;
  margin-bottom: 15px;
}

.manifesto p:first-child {
  font-size: clamp(11px, 1.8vw, 14px);
  color: #00ff41;
  text-shadow: 0 0 4px rgba(0, 255, 65, 0.3);
  margin-bottom: 20px;
}

.buttons { display: flex; gap: 15px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }

.btn {
  background: transparent;
  border: 2px solid #00ff41;
  color: #00ff41;
  padding: 8px 16px;
  border-radius: 4px;
  text-decoration: none;
  font-family: 'Courier New', ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', monospace;
  font-size: clamp(11px, 1.8vw, 14px);
  font-weight: bold;
  transition: all 0.2s ease;
  cursor: pointer;
}

.btn:hover { background: #00ff41; color: #000; box-shadow: 0 0 20px #00ff41; }

.btn:focus-visible { outline: 2px solid #00ff41; outline-offset: 2px; }

.btn.btn-secondary { border-color: #ff6b35; color: #ff6b35; }
.btn.btn-secondary:hover { background: #ff6b35; color: #000; box-shadow: 0 0 20px #ff6b35; }

.footer { margin-top: 20px; color: #00ff41; font-size: clamp(11px, 1.8vw, 14px); opacity: 0.7; }

.system-requirements {
  margin: 30px auto 20px;
  text-align: left;
  padding: 20px;
  border: 1px solid #00ff41;
  border-radius: 4px;
  background: rgba(0, 255, 65, 0.02);
}

.system-requirements h3 {
  color: #00ff41;
  font-size: clamp(11px, 1.8vw, 14px);
  margin-bottom: 15px;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-shadow: 0 0 4px rgba(0, 255, 65, 0.3);
}

.system-requirements ul {
  list-style: none;
  padding: 0;
  margin: 0;
  text-align: left;
}

.system-requirements li {
  color: #00ff41;
  font-size: clamp(11px, 1.8vw, 14px);
  line-height: 1.6;
  margin-bottom: 8px;
  text-align: left;
}

.system-requirements li::before {
  content: "> ";
  color: #ff6b35;
  font-weight: bold;
  margin-right: 8px;
}

.system-requirements .req-label {
  color: #ff6b35;
  font-weight: bold;
  margin-right: 8px;
}

.system-requirements .tech-note {
  color: #00ff41;
  font-size: clamp(10px, 1.6vw, 12px);
  line-height: 1.6;
  opacity: 0.8;
  font-style: italic;
  margin: 15px 0 0 0;
  padding-top: 15px;
  border-top: 1px solid rgba(0, 255, 65, 0.3);
}

/* Modal styles - base */
.modal {
  display: none;
  align-items: flex-start; /* Start at top instead of center */
  justify-content: center;
}

.modal.active {
  display: flex;
}

/* CRT Modal - inside the CRT screen */
.modal-crt {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 30; /* Above CRT content but below scanlines */
  padding: 20px;
  overflow-y: auto;
  /* Allow scrolling on the modal container itself */
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}

.modal-crt .modal-window {
  background: #000;
  border: 2px solid #00ff41;
  border-radius: 0;
  width: 90%;
  max-width: 500px;
  max-height: none; /* Remove max-height to prevent cropping */
  overflow-y: visible; /* Content visible, scrolling handled by parent */
  box-shadow: 
    0 0 20px rgba(0, 255, 65, 0.5),
    inset 0 0 20px rgba(0, 255, 65, 0.05);
  position: relative;
  padding: 20px;
  padding-bottom: 40px;
  margin: 20px auto; /* Center horizontally, add top/bottom margin */
  margin-top: 20px; /* Start near top on mobile */
}

/* Fullscreen Modal - for video */
.modal-fullscreen {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.98);
  z-index: 100000; /* Above everything */
}

.modal-fullscreen .modal-window {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0;
  max-width: 90vw;
  max-height: 90vh;
  width: auto;
  height: auto;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  border: 1px solid #ff6b35;
  color: #ff6b35;
  padding: 2px 8px;
  cursor: pointer;
  font-family: inherit;
  font-size: clamp(11px, 1.8vw, 14px);
  transition: all 0.2s;
  z-index: 10;
}

.modal-close:hover {
  background: #ff6b35;
  color: #000;
}

.modal-content {
  padding: 0;
}

.modal-panel {
  animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.modal-content p {
  color: #00ff41;
  font-size: clamp(11px, 1.8vw, 14px);
  margin-bottom: 15px;
}

.preorder-image {
  width: 100%;
  height: auto;
  margin-top: 30px;
  margin-bottom: 20px;
  border: 1px solid #00ff41;
  display: block;
}

.download-list,
.preorder-features {
  list-style: none;
  padding: 0;
  margin-bottom: 20px;
}

.download-list li,
.preorder-features li {
  color: #00ff41;
  font-size: clamp(11px, 1.8vw, 14px);
  margin-bottom: 10px;
  line-height: 1.6;
}

.download-list a {
  color: #ff6b35;
  text-decoration: none;
  transition: all 0.2s;
}

.download-list a:hover {
  color: #00ff41;
  text-shadow: 0 0 8px #00ff41;
}

.modal-note {
  font-size: clamp(10px, 1.6vw, 12px);
  opacity: 0.8;
  border-top: 1px solid #00ff41;
  padding-top: 15px;
}

.modal-price {
  font-size: clamp(14px, 2.2vw, 18px);
  color: #ff6b35;
  font-weight: bold;
  margin: 20px 0 10px 0;
  text-align: center;
}

.modal-deposit {
  font-size: clamp(11px, 1.8vw, 14px);
  color: #00ff41;
  text-align: center;
  margin: 0 0 20px 0;
  opacity: 0.9;
}

.modal-action {
  display: block;
  margin: 0 auto;
  text-align: center;
  text-decoration: none;
}

/* Video play button */
.video-trigger {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 2em 0;
  cursor: pointer;
}

.video-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 180px;
  height: 60px;
  border: 2px solid #00ff41;
  border-radius: 4px;
  background: transparent;
  transition: all 0.3s ease;
  position: relative;
}

.video-button:hover {
  background: rgba(0, 255, 65, 0.1);
  box-shadow: 0 0 20px rgba(0, 255, 65, 0.5);
}

.play-icon {
  color: #00ff41;
  font-size: 27px;
  margin-left: 4px; /* Center the triangle visually */
}

.video-label {
  margin-top: 0.5em;
  color: #00ff41;
  font-size: 12px;
  opacity: 0.8;
  transition: opacity 0.3s ease;
}

.video-trigger:hover .video-label {
  opacity: 1;
}

#video-content {
  text-align: center;
  padding: 0;
}

#demo-video {
  border: none;
  border-radius: 4px;
  max-width: 54vw; /* Desktop: 60% of viewport */
  max-height: 54vh;
  width: auto;
  height: auto;
  display: block;
  margin: 0 auto;
}

@media (max-width: 768px) {
  .buttons { flex-direction: column; align-items: center; }
  .btn { width: 80%; max-width: 200px; }
  .modal-window { width: 95%; }
  
  /* Full width video on mobile */
  #demo-video {
    max-width: 95vw;
    max-height: 80vh; /* Reasonable height limit on mobile */
  }
  
  /* Make CRT 20% larger on mobile */
  .crt-container {
    width: 120vw; /* Scale beyond viewport for zoom effect */
    max-width: none;
  }
  
  .ascii-art {
    font-size: clamp(5px, 1.2vw, 9px); /* Smaller to fit mobile */
  }
  
  .manifesto p,
  .system-requirements li,
  .modal-content p {
    font-size: clamp(12px, 2vw, 15px); /* ~10% larger */
  }
  
  .system-requirements h3 {
    font-size: clamp(12px, 2vw, 15px);
  }
  
  .btn {
    font-size: clamp(12px, 2vw, 15px);
    padding: 10px 18px;
  }
  
  .crt-content {
    padding: 6% 12%; /* More horizontal padding to prevent clipping */
    padding-bottom: 20%;
  }
}

/* Deferred reveal after ASCII types */
.deferred {
  opacity: 0;
  transform: translateY(6px);
  filter: blur(2px);
  pointer-events: none;
  transition: opacity .45s ease, transform .45s ease, filter .45s ease;
}

.is-revealed .deferred {
  opacity: 1;
  transform: none;
  filter: none;
  pointer-events: auto;
}
