/* =========================
   Rife & Ruin — Global Styles
   (Header locked dark; site themeable)
   ========================= */

/* Base reset */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
html { scroll-behavior: smooth; }
body {
  font: 16px/1.6 Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* -------------------------
   Theme Tokens
   ------------------------- */
/* Light (default) */
:root{
  --bg: #f7f8fc;
  --text: #121417;
  --muted: #4b5563;

  --surface: #ffffff;
  --surface-2: #f1f5fb;
  --border: rgba(15,23,42,.12);
  --shadow: 0 10px 30px rgba(2,6,23,.06);

  --accent: #6b7bff;
  --accent-contrast: #ffffff;

  --chip-bg: #eef2ff;
  --chip-text: #2d3a8c;

  /* Header is intentionally *constant* across themes */
  --header-bg: #1a1d24;                 /* dark grey bar */
  --header-text: #ffffff;               /* header link/brand color */
  --header-border: rgba(255,255,255,.14);
  --header-h: 72px;
}

/* Dark (toggle) — site colors change, header stays constant */
html[data-theme="dark"]{
  --bg: #0c0c0e;
  --text: #f8fafc;
  --muted: #a7b0c0;

  --surface: rgba(255,255,255,.04);
  --surface-2: rgba(255,255,255,.06);
  --border: rgba(255,255,255,.12);
  --shadow: none;

  --accent: #7aa2ff;
  --accent-contrast: #0b0d12;

  /* header vars intentionally unchanged */
}

/* -------------------------
   Layout helpers
   ------------------------- */
.container { max-width: 1100px; margin: 0 auto; padding: 0 20px; }
section { padding: 60px 0; }
h1, h2, h3, h4 { color: var(--text); margin: 0 0 12px; }
p, .sub, .muted { color: var(--muted); }

/* -------------------------
   Header (fixed, constant dark)
   ------------------------- */
header{
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1000;
  height: var(--header-h);
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  backdrop-filter: blur(8px);
}
main { 
  padding-top: var(--header-h);
  position: relative; /* Allow absolute positioning of scrolling text */
}
section[id]{ scroll-margin-top: calc(var(--header-h) + 12px); } /* anchor offset */

.nav{
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
}

.brand{
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--header-text);
  text-decoration: none;
}

.logo{
  width: 40px; height: 40px; border-radius: 10px; flex: 0 0 auto;
  background: center / contain no-repeat url("img/logo.png");
  background-color: transparent; /* optional */
  box-shadow: 0 8px 20px rgba(110,168,255,.35);
}

.brand h1{
  margin: 0;
  font-size: 18px;
  letter-spacing: .6px;
  color: var(--header-text);
}

/* Header links — always header-text on the dark bar */
header nav a{
  margin-left: 18px;
  color: var(--header-text) !important;
  text-decoration: none;
}
header nav a:hover,
header nav a:focus,
header nav a.active{
  color: var(--header-text) !important;
  opacity: .8;
}
header nav svg{
  fill: var(--header-text);
  stroke: var(--header-text);
}

/* -------------------------
   Links & Buttons
   ------------------------- */
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Unified button sizing + alignment */
.btn,
.btn.secondary,
a.btn,
button.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;

  padding: 12px 20px;
  min-height: 48px;
  line-height: 1;           /* prevents baseline offset */
  font-weight: 600;

  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
}

/* Primary button */
.btn {
  background: var(--accent);
  color: var(--accent-contrast);
  border: 1px solid var(--accent);
  box-shadow: var(--shadow);
}

/* Secondary button */
.btn.secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

/* -------------------------
   Hero
   ------------------------- */
.hero{ 
  padding: 80px 0 40px; 
  position: relative;
  overflow: hidden;
}
.scrolling-text-wrapper-full {
  position: absolute;
  top: var(--header-h);
  left: 0;
  right: 0;
  width: 100%;
  height: 0;
  pointer-events: none;
  z-index: 1;
  overflow: visible;
}
.scrolling-text-svg-full {
  width: 100%;
  height: 200px;
  position: absolute;
  top: 0;
  left: 0;
}
.scrolling-text-full {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.2em;
  fill: #FFD700;
  stroke: #000000;
  stroke-width: 1px;
  stroke-linejoin: round;
  paint-order: stroke fill;
  opacity: 0.9;
  text-transform: uppercase;
}
@media (max-width: 1024px) {
  .scrolling-text-wrapper-full {
    display: none;
  }
}
.hero-inner{
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 30px;
  align-items: center;
  position: relative;
  z-index: 2;
}
.hero-inner > div:first-child {
  padding: 24px 32px 24px 32px;
  font-family: 'Fredoka', sans-serif;
}
.hero h2{ 
  font-size: 40px; 
  line-height: 1.25; 
  margin: 0 0 20px; 
  font-family: 'Fredoka', sans-serif;
  font-weight: 600;
}
.hero p{ 
  margin: 0 0 28px; 
  line-height: 1.6; 
  font-family: 'Fredoka', sans-serif;
  font-weight: 400;
}
.hero .chip { 
  margin-bottom: 16px; 
  font-family: 'Fredoka', sans-serif;
}
.hero .cta-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.chip{
  display: inline-block;
  background: var(--chip-bg);
  color: var(--chip-text);
  border: 1px solid var(--border);
  padding: 6px 10px; border-radius: 999px; margin-right: 8px; font-size: 12px;
}

/* Give the home/hero rounded corners + clip overlays */
#home{
  border-radius: 24px;
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow);
  margin: 24px auto;
}
#home::before, #home::after{ border-radius: inherit; }

/* Optional gentle background glow for hero in light theme */
.hero{
  background:
    radial-gradient(1200px 600px at 10% -10%, #dbeafe 0%, transparent 60%),
    radial-gradient(900px 600px at 100% 0, #bfdbfe 0%, transparent 60%);
}

/* -------------------------
   Cards / Showcase
   ------------------------- */
.showcase{ display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.card{
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px; overflow: hidden;
  box-shadow: var(--shadow);
}
.shot{ 
  aspect-ratio: 16/9; 
  background: var(--surface-2); 
  display: block;
  position: relative; 
  overflow: hidden; 
}
.shot img{ 
  width: 100%; 
  height: 100%; 
  object-fit: cover; 
  display: block; 
}
.card-body{ padding: 16px; }
.card h4{ margin: 0 0 6px; }
.tags{ display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.tag{
  font-size: 12px; color: var(--muted);
  border: 1px solid var(--border);
  padding: 3px 8px; border-radius: 999px;
}
.store-links{ display: flex; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.store{
  flex: 1; text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 10px; border-radius: 10px;
  color: var(--text);
  font-weight: 600;
}
html[data-theme="dark"] .store{
  background: rgba(255,255,255,.12);
  color: #ffffff;
}
.store:hover{ filter: brightness(1.02); }
.store-icon{
  height: 40px;
  width: auto;
  display: block;
  object-fit: contain;
}
/* Rotator store links use same styling as showcase */
.slide .copy .store-links{
  margin-top: 16px;
}

/* -------------------------
   Founders (name above small circle; text box to the right)
   ------------------------- */

/* Container displays founders horizontally - 4 per row */
.founders{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
}

/* Each founder card: vertical layout with name, image, and bio */
.founder-card,
.team-card{
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  min-height: 240px;
}
.founders .founder-card{
  flex: 0 0 auto;
}
.team .team-card{
  flex: 0 0 auto;
  width: calc((100% - 72px) / 4);
}

/* Name and image centered above bio - shared by founders and team */
.founder-left,
.team-left{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.founder-name,
.team-name{
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  text-align: center;
}

/* Circle headshot — larger for horizontal cards */
.headshot{
  background: none !important;
  border: none !important;
  box-shadow: none !important;
}
.headshot img{
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

/* Bio text below image - shared by founders and team */
.founder-bio,
.team-bio{
  text-align: center;
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  width: 100%;
}
.founder-bio h4,
.team-bio h4{
  margin: 8px 0 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}
.founder-bio p,
.team-bio p{
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

/* Team section - identical to founders */
.team{
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
}

/* -------------------------
   Rotator (hero slider)
   ------------------------- */
.rotator{
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: transparent;
  margin: 16px;
}

/* Accept both class and ID "slides" */
.slides,
#slides{
  display: flex;
  transition: transform .6s ease;
  background: transparent !important;     /* transparent container */
  box-shadow: none !important;
}
.slide{
  min-width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: transparent;                /* no panel fill */
}
.slide .art{
  background: transparent;
  display: grid;
  place-items: center;
}
.slides img,
#slides img{
  background: transparent !important;
  border: none !important;
  display: block;
}
.slide .art img{
  width: 72%;
  height: auto;
  max-height: 100%;
  border-radius: 12px;
  box-shadow: var(--shadow);
  object-fit: cover;
}
.slide .art img[src$=".svg"]{
  width: 72%;
  height: auto;
  max-height: 100%;
  object-fit: cover;
  display: block;
}
.slide .copy{
  padding: 26px;
  position: relative;                     /* ensure copy area is above controls */
  z-index: 1;
}
.slide h4{ margin: 0 0 8px; }

/* Controls stay on left (artwork) half, centered vertically */
.controls{
  position: absolute;
  top: 50%;
  left: 0;
  width: 50%;                              /* confined to art side */
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  padding: 0 10px;
  z-index: 2;                               /* above art, below copy/buttons */
  pointer-events: none;                     /* only buttons receive clicks */
}
.ctrl{
  pointer-events: auto;
  background: rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

/* Ensure app buttons always sit above anything else on the copy side */
.slide .copy .store-links{ position: relative; z-index: 3; }

/* -------------------------
   Modal
   ------------------------- */
dialog#contact{
  width: min(680px, 92vw);
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
.modal-head{
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.modal-body{ padding: 18px; }
.grid{ display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
label{ font-size: 13px; color: var(--muted); }
input, textarea, select{
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}
input[type="file"]{
  padding: 8px;
  cursor: pointer;
}
input[type="file"]::file-selector-button{
  padding: 8px 16px;
  margin-right: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
  transition: all 0.2s;
}
input[type="file"]::file-selector-button:hover{
  background: var(--accent);
  color: var(--accent-contrast);
  border-color: var(--accent);
}
textarea{ min-height: 120px; resize: vertical; }
input:focus, textarea:focus, select:focus{
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(107,123,255,.15);
}

/* -------------------------
   Footer
   ------------------------- */
footer{
  padding: 30px 0;
  color: var(--muted);
}

/* -------------------------
   Utilities
   ------------------------- */
.center{ display: grid; place-items: center; }
.hide{ display: none !important; }

/* -------------------------
   Responsive
   ------------------------- */
@media (max-width: 1024px){
  .hero-inner{ grid-template-columns: 1fr; }
  .showcase{ grid-template-columns: 1fr; }
  .founders{ grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
  .team{ grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
}

@media (max-width: 720px){
  :root{ --header-h: 64px; }
  .hero h2{ font-size: 32px; }
  .hero-inner > div:first-child {
    padding: 20px 20px 20px 20px;
  }
  .slide{ grid-template-columns: 1fr; }
  .controls{ width: 100%; justify-content: space-between; padding: 0 8px; }
  .slide .art img{ width: 86%; }
  .founders{ grid-template-columns: 1fr; }
  .team{ grid-template-columns: 1fr; }
  .store-links{ flex-direction: column; }
  .store{ width: 100%; }
}

/* -------------------------
   Hardening overrides (keep at end)
   ------------------------- */
#slides { background: transparent !important; box-shadow: none !important; }
#slides img { background: transparent !important; border: none !important; }
/* ==== Contact modal hardening & layout fixes ==== */

/* Proper modal sizing + clipping */
dialog#contact{
  width: min(680px, 92vw);
  max-height: 85vh;            /* keep it on screen */
  padding: 0;                  /* header/body handle inner spacing */
  overflow: hidden;            /* prevent fields from spilling out */
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

/* Dim the page behind the modal */
dialog#contact::backdrop{
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(2px);
}

/* Sticky header so it doesn't get covered by textarea when scrolling */
.modal-head{
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  border-top-left-radius: 16px;
  border-top-right-radius: 16px;
}

/* Scroll the body when content is tall */
.modal-body{
  max-height: calc(85vh - 58px); /* 58px ≈ header height */
  overflow: auto;
  padding: 18px;
}

/* Form grid that won’t overlap */
.grid{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  align-items: start;
}

/* Wrap each label+input pair in .field for consistent spacing */
.field{
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Make wide rows (e.g., Message) span both columns */
.field.full{ grid-column: 1 / -1; }

label{ font-size: 13px; color: var(--muted); }

/* Inputs that respect the grid cell, no overflow */
input, textarea, select{
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  line-height: 1.4;
  box-shadow: none;
}

/* Comfortable textarea that can grow, but won’t cover other UI */
textarea{
  min-height: 140px;
  resize: vertical;
}

/* Focus state */
input:focus, textarea:focus, select:focus{
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(107,123,255,.15);
}

/* Footer buttons row never hides under rounded corners */
.modal-actions{
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 16px;
}
/* ==== Dark mode: contact modal opacity & clarity fixes ==== */

/* Add per-component tokens (default to current values) */
:root{
  --modal-surface: var(--surface);
  --field-surface: var(--surface);
  --field-border: var(--border);
  --backdrop-dim: rgba(0,0,0,.55);
}

/* Use the tokens in the modal */
dialog#contact{
  background: var(--modal-surface);
  border: 1px solid var(--field-border);
}
dialog#contact::backdrop{
  background: var(--backdrop-dim);
}

/* Inputs/textarea pick up the field tokens */
dialog#contact input,
dialog#contact textarea,
dialog#contact select{
  background: var(--field-surface);
  border: 1px solid var(--field-border);
}

/* Dark-mode overrides: more opaque surfaces + stronger backdrop */
html[data-theme="dark"]{
  --modal-surface: #0f1116;                 /* solid, not see-through */
  --field-surface: #171a21;                 /* slightly lighter than modal */
  --field-border: rgba(255,255,255,.18);
  --backdrop-dim: rgba(0,0,0,.72);          /* darker page dim */
}

/* Optional: clearer placeholder + label contrast in dark */
html[data-theme="dark"] dialog#contact ::placeholder{ color: #9aa3b2; }
html[data-theme="dark"] dialog#contact label{ color: #cbd5e1; }

.game-img {
  width: 200px;       /* set your desired width */
  height: 300px;      /* set your desired height */
  object-fit: cover;  /* keeps aspect ratio but crops to fit */
  display: block;
  margin: 0 auto;     /* center image horizontally */
}

/* -------------------------
   Policy Modals (Privacy & Terms)
   ------------------------- */
.policy-modal {
  max-width: 800px;
  max-height: 80vh;
  width: 90%;
  padding: 0;
  border: none;
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
  overflow: hidden;
}

.policy-modal::backdrop {
  background: rgba(0,0,0,.6);
}

.policy-modal-content {
  padding: 40px;
  max-height: 80vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.policy-modal-content h2 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
}

.policy-modal-content .sub {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 24px;
}

.policy-modal-content h3 {
  margin: 32px 0 12px;
  font-size: 20px;
  font-weight: 600;
  color: var(--text);
}

.policy-modal-content h3:first-of-type {
  margin-top: 0;
}

.policy-modal-content p {
  margin: 0 0 16px;
  line-height: 1.7;
  color: var(--text);
}

.policy-modal-content ul {
  margin: 12px 0 16px;
  padding-left: 24px;
}

.policy-modal-content li {
  margin: 8px 0;
  line-height: 1.7;
}

.policy-modal-content a {
  color: var(--accent);
  text-decoration: none;
}

.policy-modal-content a:hover {
  text-decoration: underline;
}

.policy-modal-content code {
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 14px;
  font-family: 'Courier New', monospace;
}

.policy-modal-content button {
  margin-top: 32px;
  width: 100%;
}

/* Dark mode adjustments */
html[data-theme="dark"] .policy-modal {
  background: #0f1116;
}

html[data-theme="dark"] .policy-modal::backdrop {
  background: rgba(0,0,0,.8);
}

/* Mobile responsive */
@media (max-width: 720px) {
  .policy-modal {
    width: 95%;
    max-height: 90vh;
  }
  
  .policy-modal-content {
    padding: 24px;
    max-height: 90vh;
  }
  
  .policy-modal-content h2 {
    font-size: 24px;
  }
  
  .policy-modal-content h3 {
    font-size: 18px;
  }
}