/* AO3 Wrapppped — Reveal Sequence Styles (Light Theme) */

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

:root {
  --bg: #EFEFDA;
  --bg-light: #E4E0CC;
  --text: #2A2A2A;
  --text-muted: #6B6B5E;
  --ao3-green: #6C9930;
  --ao3-yellow: #C5A028;
  --ao3-orange: #C27529;
  --ao3-red: #9B1C1C;
  --ao3-blue: #3B5998;
  --ao3-gray: #D5D0C0;
  --ao3-complete-green: #6B8E23;
  --ao3-warning-orange: #C05621;
  --ao3-purple: #6B3FA0;
  --font-heading: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --reveal-dice-size: 72px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  min-height: 100vh;
  overflow-x: hidden;
}

/* --- Screens --- */
.screen {
  display: none;
  min-height: 100vh;
}
.screen.active {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

/* --- Loading --- */
.loading-content,
.no-data-content {
  text-align: center;
  padding: 20px;
}

.loading-content h1,
.no-data-content h1 {
  font-family: var(--font-heading);
  font-size: 2rem;
  margin-bottom: 12px;
}

.loading-content p,
.no-data-content p {
  color: var(--text-muted);
  margin-bottom: 24px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--bg-light);
  border-top-color: var(--ao3-red);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto;
}

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

.back-link {
  color: var(--ao3-red);
  text-decoration: none;
  font-weight: 600;
}

/* --- Reveal Cards --- */
#reveal-container {
  user-select: none;
  position: relative;
}

.reveal-cards {
  width: 100%;
  max-width: 600px;
  padding: 20px;
}

.reveal-card {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: 60vh;
  padding-bottom: 48px; /* reserve space so branding never overlaps content */
  animation: fadeIn 0.4s ease;
  position: relative;
}

.reveal-card.active {
  display: flex;
}

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

.reveal-label {
  font-size: 1.2rem;
  color: var(--text-muted);
  margin: 4px 0;
}

.reveal-number {
  font-family: var(--font-heading);
  font-size: 5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.reveal-comparison {
  font-size: 1rem;
  color: var(--text-muted);
  margin-top: 16px;
  font-style: italic;
}

.reveal-highlight {
  font-family: var(--font-heading);
  font-size: 2.4rem;
  font-weight: 700;
  color: var(--ao3-red);
  margin: 8px 0;
}

.reveal-sub {
  font-size: 1.1rem;
  color: var(--text-muted);
}

.reveal-tease {
  font-family: var(--font-heading);
  font-size: 2rem;
  font-weight: 700;
  animation: pulse 1.5s ease-in-out infinite;
}

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

/* --- Reveal Grid (3D Dice) --- */
.reveal-grid {
  display: grid;
  grid-template-columns: var(--reveal-dice-size) var(--reveal-dice-size);
  grid-template-rows: var(--reveal-dice-size) var(--reveal-dice-size);
  gap: 12px;
  margin: 0 auto;
}

.reveal-dice {
  width: var(--reveal-dice-size);
  height: var(--reveal-dice-size);
  perspective: 600px;
  overflow: hidden;
  border-radius: 6px;
}

.reveal-cube {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transform: rotateX(0deg);
}

.reveal-cube-face {
  position: absolute;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 32px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: transparent;
  color: var(--text);
}

.reveal-cube-face.front  { transform: rotateX(0deg)   translateZ(calc(var(--reveal-dice-size) / 2)); }
.reveal-cube-face.top    { transform: rotateX(90deg)  translateZ(calc(var(--reveal-dice-size) / 2)); }
.reveal-cube-face.back   { transform: rotateX(180deg) translateZ(calc(var(--reveal-dice-size) / 2)); }
.reveal-cube-face.bottom { transform: rotateX(-90deg) translateZ(calc(var(--reveal-dice-size) / 2)); }

@keyframes reveal-roll-up {
  0%   { transform: rotateX(0deg); }
  100% { transform: rotateX(1170deg); }
}

.reveal-cube.rolling {
  animation: reveal-roll-up 5.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.reveal-dice.settled {
  animation: reveal-pulse 1s ease-in-out;
}

@keyframes reveal-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.06); }
}

/* --- Archetype below dice (combined card) --- */
.archetype-below {
  opacity: 0;
  transition: opacity 0.6s ease;
  text-align: center;
  margin-top: 28px;
}

/* --- Archetype Reveal (legacy, kept for reference) --- */
.archetype-reveal {
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: fadeIn 0.6s ease;
}

.mini-grid {
  display: grid;
  grid-template-columns: 60px 60px;
  grid-template-rows: 60px 60px;
  gap: 4px;
  margin-bottom: 32px;
}

.mini-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 22px;
  background: var(--ao3-gray);
  color: var(--text);
}

.archetype-title {
  font-family: var(--font-heading);
  font-size: 2.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 12px;
  text-align: center;
}

.archetype-oneliner {
  font-size: 1.15rem;
  color: var(--text-muted);
  font-style: italic;
  max-width: 500px;
  text-align: center;
  line-height: 1.5;
}

/* --- Navigation: arrows + dots --- */
.reveal-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 20px 0 8px;
}

.reveal-arrow {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--ao3-gray);
  background: transparent;
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  flex-shrink: 0;
}

.reveal-arrow:hover:not(:disabled) {
  background: var(--ao3-red);
  border-color: var(--ao3-red);
  color: #fff;
}

.reveal-arrow:disabled {
  opacity: 0.25;
  cursor: default;
}

.reveal-dots {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg-light);
  transition: background 0.3s;
}

.dot.active {
  background: var(--ao3-red);
}

/* --- Decreasing progress bar --- */
.reveal-progress-track {
  width: 100%;
  max-width: 600px;
  height: 2px;
  background: var(--bg-light);
  margin: 0 auto;
}

.reveal-progress-fill {
  height: 100%;
  background: var(--ao3-red);
  transform-origin: left;
  transform: scaleX(1);
  animation-timing-function: linear;
  animation-fill-mode: forwards;
}

@keyframes progress-deplete {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

.reveal-hint {
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
  padding: 10px 0 20px;
  opacity: 0.6;
}

/* --- Reveal card branding --- */
.reveal-card-branding {
  position: absolute;
  bottom: 16px;
  left: 0;
  right: 0;
  text-align: center;
  color: #B0AC9A;
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  pointer-events: none;
}

/* --- Responsive --- */
@media (min-width: 768px) {
  :root { --reveal-dice-size: 85px; }

  .reveal-grid {
    gap: 16px;
  }

  .reveal-cube-face { font-size: 40px; }
  .reveal-number { font-size: 7rem; }
}

/* --- Dice icon sizing --- */
.reveal-cube-face img.dice-icon {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* --- Reduced Motion --- */
@media (prefers-reduced-motion: reduce) {
  .reveal-card { animation: none; }
  .reveal-tease { animation: none; }
  .spinner { animation: none; }
  .reveal-cube.rolling { animation: none; }
  .reveal-dice.settled { animation: none; }
  .dot { transition: none; }
  .archetype-below { transition: none; }
  .reveal-progress-fill { animation: none; }
}
