/* ============================================
   PRALAYA — shared styles
   Fully responsive: phone → tablet → desktop
   Breakpoints:
     mobile:  < 480px
     phablet: 480px – 767px
     tablet:  768px – 1023px
     desktop: 1024px+
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;700;900&family=Lato:wght@300;400;700&display=swap');

/* ── CSS Variables ── */
:root {
  --bg:          #0a0705;
  --bg2:         #110d08;
  --gold:        #ffcc00;
  --gold-dim:    #c8960a;
  --fire:        #ff6600;
  --fire-bright: #ff9900;
  --ember:       #ff3300;
  --white:       #fff9f0;
  --muted:       #a08060;
  --border:      rgba(255,180,0,0.28);
  --radius:      8px;
  --transition:  0.3s ease;

  /* spacing scale — shrinks on small screens */
  --space-sm:  0.75rem;
  --space-md:  1.5rem;
  --space-lg:  3rem;
  --space-xl:  4rem;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 16px;
  /* prevent text size inflation on mobile */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  background: var(--bg);
  color: var(--white);
  font-family: 'Lato', sans-serif;
  font-weight: 300;
  min-height: 100vh;
  line-height: 1.6;
  /* smooth scrolling everywhere */
  scroll-behavior: smooth;
  /* prevent horizontal overflow */
  overflow-x: hidden;
}

/* ── Typography — fluid scaling ── */
h1, h2, h3 {
  font-family: 'Cinzel', serif;
  letter-spacing: 0.06em;
  line-height: 1.2;
}

h1 { font-size: clamp(1.8rem, 6vw, 3.5rem); color: var(--gold); }
h2 { font-size: clamp(1.1rem, 3vw, 1.8rem); color: var(--fire-bright); }
h3 { font-size: clamp(0.95rem, 2vw, 1.1rem); color: var(--gold-dim); }
p  { font-size: clamp(0.9rem, 2vw, 1rem); color: var(--white); opacity: 0.92; }

/* ── Utility ── */
.center    { text-align: center; }
.muted     { color: var(--muted); font-size: 0.85rem; }
.gold-text { color: var(--gold); }
.fire-text { color: var(--fire); }
.hidden    { display: none !important; }
.visible   { display: block !important; }

/* ── Buttons ── */
.btn {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  font-family: 'Cinzel', serif;
  font-size: clamp(0.78rem, 2vw, 0.95rem);
  letter-spacing: 0.08em;
  border: 1px solid var(--gold-dim);
  background: transparent;
  color: var(--gold);
  cursor: pointer;
  border-radius: var(--radius);
  transition: var(--transition);
  text-transform: uppercase;
  /* prevent text wrapping on small buttons */
  white-space: nowrap;
  /* tap target size for mobile */
  min-height: 44px;
  touch-action: manipulation;
}
.btn:hover:not(:disabled) {
  background: rgba(255,204,0,0.1);
  border-color: var(--gold);
  box-shadow: 0 0 16px rgba(255,180,0,0.25);
}
.btn:active:not(:disabled) {
  transform: scale(0.98);
}
.btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.btn-fire {
  border-color: var(--fire);
  color: var(--fire-bright);
}
.btn-fire:hover:not(:disabled) {
  background: rgba(255,102,0,0.12);
  border-color: var(--fire-bright);
  box-shadow: 0 0 16px rgba(255,100,0,0.3);
}
.btn-ghost {
  border-color: var(--muted);
  color: var(--muted);
  font-size: clamp(0.72rem, 1.8vw, 0.8rem);
  padding: 0.5rem 1rem;
}
.btn-ghost:hover:not(:disabled) {
  border-color: var(--fire);
  color: var(--fire);
  background: transparent;
  box-shadow: none;
}

/* ── Inputs / Textareas ── */
textarea, input[type="text"] {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--white);
  font-family: 'Lato', sans-serif;
  font-size: clamp(0.9rem, 2vw, 0.95rem);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  width: 100%;
  resize: vertical;
  transition: border-color var(--transition);
  outline: none;
  /* prevent zoom on focus in iOS */
  font-size: max(16px, 0.95rem);
  /* tap target */
  min-height: 44px;
}
textarea:focus, input[type="text"]:focus {
  border-color: var(--gold-dim);
  box-shadow: 0 0 10px rgba(255,180,0,0.1);
}
textarea::placeholder, input::placeholder {
  color: var(--muted);
  font-style: italic;
}
textarea:disabled, input:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
textarea { min-height: 80px; }

/* ── Page wrapper — fluid padding ── */
.page {
  max-width: 720px;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md) 6rem;
  width: 100%;
}

/* ── Divider ── */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

/* ── Message box ── */
.msg-box {
  padding: 1rem 1.25rem;
  border-left: 3px solid var(--fire);
  background: rgba(255,80,0,0.06);
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.9rem;
  color: var(--fire-bright);
  margin: 1rem 0;
}

/* ── Nav link ── */
.nav-link {
  display: inline-block;
  color: #b09070;
  text-decoration: none;
  font-size: clamp(0.72rem, 2vw, 0.8rem);
  letter-spacing: 0.08em;
  font-family: 'Cinzel', serif;
  text-transform: uppercase;
  transition: color var(--transition);
  padding: 0.5rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}
.nav-link:hover { color: var(--gold-dim); }

/* ── Section label ── */
.section-label {
  font-family: 'Cinzel', serif;
  font-size: clamp(0.65rem, 1.8vw, 0.7rem);
  letter-spacing: 0.25em;
  color: var(--muted);
  text-transform: uppercase;
  margin-bottom: 1rem;
}

/* ============================================
   RESPONSIVE BREAKPOINTS
   ============================================ */

/* ── Mobile: up to 480px ── */
@media (max-width: 480px) {
  :root {
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 2rem;
    --space-xl: 2.5rem;
  }

  .page { padding: var(--space-lg) var(--space-md) 4rem; }

  /* stack all flex rows vertically */
  .seal-actions,
  .choices-actions,
  .emotion-row,
  .media-row {
    flex-direction: column;
    align-items: stretch;
  }

  /* full width buttons on mobile */
  .btn { width: 100%; text-align: center; }
  .btn-ghost { width: 100%; text-align: center; }

  /* bottom nav more space between */
  .bottom-nav { gap: 1rem; }

  /* choice cards full width */
  .choice-card { width: 100%; }

  /* level grid single column */
  .level-grid { grid-template-columns: 1fr !important; }

  /* mirror grid single column */
  .mirror-grid { grid-template-columns: 1fr !important; }

  /* masonry single column */
  .masonry-grid { columns: 1 !important; }

  /* heatmap — scroll horizontally, don't squish */
  #heatmap-section { overflow-x: auto; }

  /* xp card stack vertically */
  .xp-card { flex-direction: column; align-items: flex-start; gap: 1rem; }

  /* chakra smaller on tiny screens */
  #chakra-container {
    width: 260px !important;
    height: 260px !important;
  }
  #chakra-container svg {
    width: 260px !important;
    height: 260px !important;
  }
}

/* ── Phablet: 481px – 767px ── */
@media (min-width: 481px) and (max-width: 767px) {
  .page { padding: 2.5rem 1.25rem 5rem; }

  .level-grid { grid-template-columns: 1fr 1fr !important; }
  .masonry-grid { columns: 1 !important; }

  .seal-actions { flex-wrap: wrap; }
  .btn { min-width: 140px; }

  #chakra-container {
    width: 280px !important;
    height: 280px !important;
  }
  #chakra-container svg {
    width: 280px !important;
    height: 280px !important;
  }
}

/* ── Tablet: 768px – 1023px ── */
@media (min-width: 768px) and (max-width: 1023px) {
  .page { max-width: 680px; padding: 3rem 2rem 6rem; }

  .level-grid { grid-template-columns: repeat(2, 1fr) !important; }
  .masonry-grid { columns: 2 !important; }

  #chakra-container {
    width: 300px !important;
    height: 300px !important;
  }
  #chakra-container svg {
    width: 300px !important;
    height: 300px !important;
  }
}

/* ── Desktop: 1024px+ ── */
@media (min-width: 1024px) {
  .page { max-width: 720px; }
  .level-grid { grid-template-columns: repeat(4, 1fr) !important; }
  .masonry-grid { columns: 2 !important; }
}

/* ── Large desktop: 1440px+ ── */
@media (min-width: 1440px) {
  .page { max-width: 800px; }
}

/* ── Touch devices — remove hover effects that feel wrong ── */
@media (hover: none) {
  .btn:hover { background: transparent; box-shadow: none; }
  .btn-fire:hover { background: transparent; box-shadow: none; }
  .entry-card:hover { border-color: var(--border); }
}

/* ── Reduced motion — respect user preference ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}