/* 
 * Deltarune Prophecy Generator - Main Styles
 * Uses kebab-case naming convention throughout
 */

/* ======================== 
   Font Definitions 
   ======================== */
@font-face {
  font-family: 'ProphecyType';
  src: url('../assets/fonts/PROPHECYTYPE.ttf') format('truetype');
  font-display: swap;
}

@font-face {
  font-family: 'DTMSans';
  src: url('../assets/fonts/DTM-Sans.otf') format('opentype');
  font-display: swap;
}

/* ======================== 
   Base Styles 
   ======================== */
html, body {
  margin: 0; 
  padding: 0;
  font-family: 'DTMSans', sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  color: white;
  background: black;
}

/* ======================== 
   Text Containers 
   ======================== */
#text-container {
  width: 75vw;
  max-width: 425px;
  margin-top: 20px;
  margin-bottom: 10px;
  text-align: center;
  font-family: 'ProphecyType', serif;
  font-size: 32px;
  line-height: 1;
  color: transparent;
  background-size: 256px 256px;
  -webkit-background-clip: text;
  background-clip: text;
  mix-blend-mode: screen;
  animation: scroll-background 30s linear infinite;
  background-repeat: repeat;
}

#text-container-red {
  position: absolute;
  top: 0;
  left: 50;
  width: 75vw;
  max-width: 425px;
  margin-top: 20px;
  margin-bottom: 10px;
  text-align: center;
  font-family: 'ProphecyType', serif;
  font-size: 32px;
  line-height: 1;
  color: transparent;
  background-size: 256px 256px;
  -webkit-background-clip: text;
  background-clip: text;
  mix-blend-mode: screen;
  animation: scroll-background 30s linear infinite, pulse-final-red 2s infinite;
  background-repeat: repeat;
  opacity: 0;
  pointer-events: none;
  z-index: 10;
}

/* ======================== 
   Animation Definitions 
   ======================== */
@keyframes scroll-background {
  0% { background-position: 0 0; }
  100% { background-position: 512px 512px; }
}

@keyframes pulse-final-red {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

@keyframes pulse-final-ghost1 {
  0%, 100% { opacity: 0; }
  50% { opacity: 0.4; }
}

@keyframes pulse-final-ghost2 {
  0%, 100% { opacity: 0; }
  50% { opacity: 0.2; }
}

@keyframes pulse-final-background {
  0%, 100% { opacity: 0; }
  50% { opacity: 0.5; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ======================== 
   Output Canvas Area 
   ======================== */
#output-canvas {
  position: relative;
  width: 90vw;
  max-width: 512px;
  aspect-ratio: 2 / 1;
  max-height: 256px;
}

canvas {
  position: absolute;
  width: 90vw;
  max-width: 512px;
  height: auto;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-optimize-contrast;
  background: transparent;
}

/* ======================== 
   Layer Styles 
   ======================== */
#ghost-icon {
  z-index: 1;
  opacity: 0.4;
  pointer-events: none;
  top: -50px;
}

#ghost-icon-2 {
  z-index: 1;
  opacity: 0.2;
  pointer-events: none;
  top: -50px;
}

#panel-layer {
  z-index: 2;
  top: -50px;
}

#ghost-icon-red {
  z-index: 11;
  pointer-events: none;
  top: -50px;
  opacity: 0;
  animation: pulse-final-ghost1 2s infinite;
}

#ghost-icon-2-red {
  z-index: 11;
  pointer-events: none;
  top: -50px;
  opacity: 0;
  animation: pulse-final-ghost2 2s infinite;
}

#panel-layer-red {
  z-index: 12;
  top: -50px;
  pointer-events: none;
  opacity: 0;
  animation: pulse-final-red 2s infinite;
}

#background-layer-red {
  position: absolute;
  width: 90vw;
  max-width: 512px;
  height: auto;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5; 
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-optimize-contrast;
  opacity: 0;
  pointer-events: none;
  animation: pulse-final-background 2s infinite;
}

#background-layer {
  position: absolute;
  width: 90vw;
  max-width: 512px;
  height: auto;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 0; 
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  image-rendering: -moz-crisp-edges;
  image-rendering: -webkit-optimize-contrast;
  opacity: 0.5;
}

/* ======================== 
   Theme Styles 
   ======================== */
body.susie-theme #background-layer {
  opacity: 0.5;
}

body.final-theme #ghost-icon {
  animation: pulse-final-ghost1 2s infinite 1s;
}

body.final-theme #ghost-icon-2 {
  animation: pulse-final-ghost2 2s infinite 1s;
}

body.final-theme #background-layer {
  animation: pulse-final-background 2s infinite 1s;
}

/* ======================== 
   Form Elements 
   ======================== */
input[type="file"], 
input[type="text"] {
  margin-top: 10px;
  padding: 5px;
  width: 75vw;
  max-width: 512px;
}

input[type="text"] {
  font-family: 'DTMSans', sans-serif;
  background-color: black;
  color: white;
  border: 2px solid white;
  padding: 5px 10px;
  outline: none;
  border-radius: 0px; 
  box-sizing: border-box;
}

input[type="text"]:focus {
  outline: none;
  border-color: #fff; 
  box-shadow: 0 0 5px white; 
}

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 125px;
  max-width: 512px;
  height: 10px;
  background: transparent; 
  margin-top: 10px;
  padding: 0;
  border-radius: 0px;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-runnable-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.2); 
  border-radius: 0px;
}

input[type="range"]::-moz-range-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 0px;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px;
  height: 15px;
  background: white;
  border: 0px;
  margin-top: -4px; 
  cursor: pointer;
  box-shadow: 0 0 2px rgba(0,0,0,0.5);
}

input[type="range"]::-moz-range-thumb {
  width: 15px;
  height: 15px;
  background: white;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 2px rgba(0,0,0,0.5);
}

/* ======================== 
   Button Styles 
   ======================== */
.custom-file-upload {
  display: inline-block;
  font-family: 'DTMSans', sans-serif;
  background-color: black;
  color: white;
  border: 2px solid white;
  padding: 5px 10px;
  cursor: pointer;
  border-radius: 0px;
  user-select: none;
  text-align: center;
}

.custom-file-upload:hover {
  background-color: #222;
  border-color: #fff;
}

.custom-file-upload:active {
  background-color: #111;
}

.custom-file-upload.small {
  display: inline-block;
  font-family: 'DTMSans', sans-serif;
  background-color: black;
  color: white;
  border: 2px solid white;
  padding: 3px 6px;
  font-size: 14px;
  cursor: pointer;
  border-radius: 0px;
  user-select: none;
  text-align: center;
  margin-top: 4px;
}

.custom-file-upload.small:hover {
  background-color: #222;
  border-color: #fff;
}

.custom-file-upload.small:active {
  background-color: #111;
}

.btn {
  font-family: 'DTMSans', sans-serif;
  background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
  color: white;
  border: 2px solid #4a9eff;
  padding: 12px 24px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  margin: 8px;
  box-shadow: 0 4px 12px rgba(74, 158, 255, 0.2);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 1px;
  font-size: 16px;
}

.btn:hover {
  background: linear-gradient(135deg, #4a9eff 0%, #357abd 100%);
  border-color: #6bb3ff;
  box-shadow: 0 6px 20px rgba(74, 158, 255, 0.4);
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(74, 158, 255, 0.3);
}

.btn-success {
  border-color: #4ade80;
  box-shadow: 0 4px 12px rgba(74, 222, 128, 0.2);
}

.btn-success:hover {
  background: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
  border-color: #6ee7b7;
  box-shadow: 0 6px 20px rgba(74, 222, 128, 0.4);
}

/* ======================== 
   Select Dropdown 
   ======================== */
select#style-select {
  font-family: 'DTMSans', sans-serif;
  background-color: black;
  color: white;
  border: 2px solid white;
  padding: 5px 10px;
  border-radius: 0;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  text-align: center;
  margin-top: 10px;
  width: 125px;
  max-width: 512px;
}

select#style-select:hover {
  background-color: #222;
  border-color: #fff;
}

select#style-select:focus {
  outline: none;
  border-color: #fff;
  box-shadow: 0 0 5px white;
}

/* ======================== 
   Layout Containers 
   ======================== */
.checkbox-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
  text-align: center;
  width: 100%;
}

#sine-wrapper {
  will-change: transform;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#overlay-wrapper {
  position: relative;
  width: 100%;
  max-width: 512px;
  display: flex;
  flex-direction: column;
  align-items: center;
  background-color: black;
}

.main-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 20px;
}

/* ======================== 
   Advanced Settings 
   ======================== */
#advanced-settings {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-top: 10px;
}

#advanced-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 12px;
  background: black;
  border: 2px solid white;
  text-align: center;
  max-width: 400px;
}

.advanced-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.preview-box {
  width: 96px;
  height: 96px;
  border: 2px solid white;
  background-color: #111;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 36px;
  margin-bottom: 8px;
  image-rendering: pixelated;
  object-fit: contain;
  overflow: hidden;
}

.file-label {
  font-family: 'DTMSans', sans-serif;
  font-size: 14px;
  margin-bottom: 4px;
  color: white;
  font-weight: 500;
}

.slider-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 80px;
  width: 125px;
  margin-top: 2px;
  gap: 4px;
  user-select: none;
  grid-column: span 2;
  justify-self: center;
}

#font-scale {
  -webkit-appearance: none;
  appearance: none;
  width: 125px;
  height: 10px;
  background: transparent;
  cursor: pointer;
  margin: 0;
  align-self: center;
}

#font-scale::-webkit-slider-runnable-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 0px;
}

#font-scale::-moz-range-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 0px;
}

#font-scale::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 15px;
  height: 15px;
  background: white;
  border: none;
  margin-top: -2px;
  box-shadow: 0 0 2px rgba(0,0,0,0.5);
  cursor: pointer;
}

#font-scale::-moz-range-thumb {
  width: 15px;
  height: 15px;
  background: white;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 0 2px rgba(0,0,0,0.5);
}

.slider-wrapper > .file-label:first-child {
  margin-bottom: auto;
}

.slider-wrapper > #font-scale-value {
  margin-top: auto;
}

#font-preview-text {
  transition: font-size 0.1s ease;
}

/* ======================== 
   Headings and Paragraphs 
   ======================== */
h1 {
  margin-top: 15px;
  margin-bottom: 20px;
  text-align: center;
  font-size: 42px;
  font-weight: bold;
  color: #4a9eff;
  text-shadow: 0 0 10px rgba(74, 158, 255, 0.5);
}

h2 {
  font-size: 28px;
  margin-bottom: 20px;
  font-weight: 600;
}

h3 {
  font-size: 22px;
  margin-bottom: 15px;
  font-weight: 500;
}

h4 {
  font-size: 18px;
  margin-bottom: 12px;
  font-weight: 500;
}

p {
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 15px;
}

#directions {
  max-width: 512px;
  text-align: center;
  color: #fff;
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.4;
}

footer {
  margin-top: 20px;
  padding: 10px;
  color: #fff;
  font-size: 14px;
  text-align: center;
  width: 100%;
  max-width: 512px;
}

.alt-font {
  font-family: 'ProphecyType', serif;
}

/* ======================== 
   FAQ Styles 
   ======================== */
#faq {
  max-width: 700px;
  margin: 40px auto;
  padding: 0 20px;
  color: white;
}

.faq-header {
  text-align: center;
  margin-bottom: 30px;
  font-family: 'ProphecyType', serif;
  font-size: 32px;
  color: #4a9eff;
  text-shadow: 0 0 10px rgba(74, 158, 255, 0.5);
}

.faq-item {
  margin-bottom: 20px;
  border: 1px solid #333;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(20, 20, 20, 0.8);
  backdrop-filter: blur(10px);
}

.faq-question {
  padding: 16px 20px;
  background: linear-gradient(135deg, #2a2a2a 0%, #1a1a1a 100%);
  cursor: pointer;
  font-weight: bold;
  font-size: 18px;
  border-bottom: 1px solid #333;
  transition: background 0.3s ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.faq-question:hover {
  background: linear-gradient(135deg, #3a3a3a 0%, #2a2a2a 100%);
}

.faq-answer {
  padding: 0 20px;
  max-height: 0;
  overflow: hidden;
  transition: all 0.3s ease;
  background: rgba(10, 10, 10, 0.5);
  font-size: 16px;
  line-height: 1.6;
}

.faq-answer.active {
  padding: 16px 20px;
  max-height: 500px;
}

.faq-toggle {
  font-size: 18px;
  transition: transform 0.3s ease;
}

.faq-toggle.active {
  transform: rotate(180deg);
}

/* ======================== 
   Export Button Container 
   ======================== */
.export-container {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 20px 0;
  flex-wrap: wrap;
}

/* ======================== 
   Loading Animation 
   ======================== */
.loading {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(255,255,255,.3);
  border-radius: 50%;
  border-top-color: #4a9eff;
  animation: spin 1s ease-in-out infinite;
  margin-left: 10px;
}

/* ======================== 
   Responsive Design 
   ======================== */
@media (max-width: 768px) {
  h1 {
    font-size: 36px;
  }
  
  h2 {
    font-size: 24px;
  }
  
  h3 {
    font-size: 20px;
  }
  
  h4 {
    font-size: 16px;
  }
  
  p {
    font-size: 15px;
  }
  
  .btn {
    font-size: 15px;
    padding: 10px 20px;
  }
  
  input[type="text"], select {
    font-size: 15px;
  }
  
  label {
    font-size: 15px;
  }
  
  .faq-question {
    font-size: 14px;
  }
  
  .faq-answer {
    font-size: 14px;
  }

  #directions {
    flex-direction: column !important;
    text-align: center !important;
    gap: 20px !important;
  }
  
  #directions > div:first-child {
    text-align: center !important;
  }
  
  #directions > div:last-child {
    flex: 0 0 auto !important;
    max-width: 280px !important;
  }
}

@media (max-width: 480px) {
  h1 {
    font-size: 32px;
  }
  
  h2 {
    font-size: 22px;
  }
  
  h3 {
    font-size: 18px;
  }
  
  p {
    font-size: 14px;
  }
  
  .btn {
    font-size: 14px;
    padding: 8px 16px;
  }
  
  input[type="text"], select {
    font-size: 14px;
  }
  
  label {
    font-size: 14px;
  }
}