/* ==========================================================================
   CARMITE / style.css
   Customize the look here. The palette + fonts live in :root below;
   everything else inherits from those variables.
   ========================================================================== */

/* ---------- Fonts (self-hosted, see /fonts) ---------- */
@font-face {
  font-family: "Baloo 2";
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url("fonts/baloo2-latin-var.woff2") format("woff2");
}
@font-face {
  font-family: "Press Start 2P";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("fonts/press-start-2p-latin.woff2") format("woff2");
}

/* ---------- Palette & knobs ---------- */
:root {
  --bg:        #171029;   /* deep cave */
  --bg-soft:   #1f1637;   /* raised panels */
  --bg-softer: #2a1d4a;   /* cards */
  --ink:       #fff3e2;   /* cream text */
  --muted:     #b3a4d4;   /* secondary text */
  --red:       #ff4365;   /* carmite */
  --red-soft:  #ff8ba0;
  --gold:      #ffc94d;   /* treasure */
  --mint:      #5fe8b2;   /* tech accent */
  --line:      rgba(255, 243, 226, 0.14);

  --font-body:  "Baloo 2", "Segoe UI", system-ui, sans-serif;
  --font-pixel: "Press Start 2P", monospace;

  --radius: 18px;
  --shadow-pop: 5px 5px 0;   /* the chunky offset shadow used on buttons/cards */
  --max-width: 1080px;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.06rem;
  line-height: 1.6;
  overflow-x: hidden;
}

/* faint film grain over everything */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  opacity: 0.05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

h1, h2, h3 {
  font-weight: 800;
  line-height: 1.12;
  margin: 0 0 0.5em;
  letter-spacing: -0.01em;
}
h2 { font-size: clamp(2rem, 4.5vw, 3rem); }
h3 { font-size: 1.25rem; }
p  { margin: 0 0 1em; }
a  { color: inherit; }
em { color: var(--gold); font-style: normal; }
strong { color: var(--ink); }

::selection { background: var(--red); color: var(--ink); }

.eyebrow {
  font-family: var(--font-pixel);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
  color: var(--red);
  margin-bottom: 1.4em;
}

.section-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: clamp(4rem, 9vw, 7rem) clamp(1.25rem, 5vw, 3rem);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
  text-decoration: none;
  background: transparent;
  border: 3px solid var(--ink);
  border-radius: 14px;
  padding: 0.65em 1.4em;
  box-shadow: var(--shadow-pop) rgba(255, 243, 226, 0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
  cursor: pointer;
}
.btn:hover {
  transform: translate(-2px, -2px);
  box-shadow: 7px 7px 0 rgba(255, 243, 226, 0.25);
}
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 rgba(255, 243, 226, 0.25); }
.btn-primary {
  background: var(--red);
  border-color: var(--red);
  box-shadow: var(--shadow-pop) rgba(255, 67, 101, 0.35);
}
.btn-primary:hover { box-shadow: 7px 7px 0 rgba(255, 67, 101, 0.35); }
.btn-small { font-size: 0.9rem; padding: 0.45em 1.1em; }

/* ---------- Nav ---------- */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 2rem;
  padding: 0.8rem clamp(1.25rem, 4vw, 2.5rem);
  background: rgba(23, 16, 41, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.nav-logo {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  font-family: var(--font-pixel);
  font-size: 0.82rem;
  letter-spacing: 0.12em;
}
.nav-gem { width: 26px; height: 26px; transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
.nav-logo:hover .nav-gem { transform: rotate(180deg) scale(1.15); }
.nav-links {
  display: flex;
  gap: 1.6rem;
  margin-left: auto;
}
.nav-links a {
  text-decoration: none;
  font-weight: 700;
  color: var(--muted);
  transition: color 0.15s ease;
}
.nav-links a:hover { color: var(--gold); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  overflow: hidden;
}
.hero-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: clamp(3rem, 7vw, 5.5rem) clamp(1.25rem, 5vw, 3rem) 2rem;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: center;
  gap: 2rem;
  min-height: 72vh;
}
.hero-copy h1 { font-size: clamp(2.4rem, 5.5vw, 4rem); }
.glint {
  color: var(--red);
  background: linear-gradient(100deg, var(--red) 20%, var(--gold) 50%, var(--red) 80%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  animation: glint 5s linear infinite;
}
@keyframes glint {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.hero-sub { color: var(--muted); max-width: 30rem; font-size: 1.15rem; }
.hero-ctas { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1.6rem 0 1rem; }
.hero-hint {
  font-family: var(--font-pixel);
  font-size: 0.58rem;
  color: var(--muted);
  opacity: 0.75;
}

.hero-gem {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.gem-glow {
  position: absolute;
  width: 70%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 67, 101, 0.35), transparent 65%);
  filter: blur(12px);
  animation: pulse 4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50%      { transform: scale(1.12); opacity: 1; }
}
#gem-canvas {
  position: relative;
  width: min(100%, 460px);
  aspect-ratio: 1;
  cursor: pointer;
  touch-action: manipulation;
}
.gem-counter {
  font-family: var(--font-pixel);
  font-size: 0.6rem;
  color: var(--gold);
  min-height: 1.4em;
  text-align: center;
}

/* ---------- Marquee ---------- */
.marquee {
  overflow: hidden;
  background: var(--red);
  border-top: 3px solid var(--ink);
  border-bottom: 3px solid var(--ink);
  transform: rotate(-1.2deg) scale(1.02);
  margin: 1.5rem -1rem 2.5rem;
}
.marquee-track {
  display: inline-flex;
  white-space: nowrap;
  padding: 0.7rem 0;
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--ink);
  animation: marquee 60s linear infinite;
}
.marquee-track span { padding: 0 1.2rem; }
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ---------- Story ---------- */
.story { background: var(--bg-soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.story-lede { max-width: 40rem; font-size: 1.15rem; color: var(--muted); }
.story-lede em { color: var(--gold); }
/* the descent: staggered alcoves carved into the cave wall */
.cave {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2.8rem;
  margin: 3.2rem 0 2.8rem;
}
.cave-vein {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.vein-glow {
  fill: none;
  stroke: var(--red);
  stroke-width: 9;
  opacity: 0.08;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
}
.vein-line {
  fill: none;
  stroke: url(#vein-grad);
  stroke-width: 2;
  opacity: 0.5;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
  stroke-dasharray: 1;
}
/* the vein etches itself in once the first alcove appears */
@supports selector(:has(*)) {
  .vein-line { stroke-dashoffset: 1; transition: stroke-dashoffset 2.6s ease 0.35s; }
  .cave:has(.alcove.on) .vein-line { stroke-dashoffset: 0; }
}

.alcove {
  position: relative;
  z-index: 1;
  width: min(100%, 27rem);
  padding: 1.7rem 1.9rem 1.4rem;
  /* carved into the wall: dark recess, shadowed top edge, faint rim light below */
  background:
    linear-gradient(160deg, rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0) 44%),
    linear-gradient(335deg, rgba(255, 243, 226, 0.05), rgba(255, 243, 226, 0) 30%),
    var(--alcove-bg, #191033);
}
/* each opening is chiseled a little differently */
.alcove-1 {
  --tilt: -0.7deg;
  --alcove-bg: #1b1236;
  clip-path: polygon(2% 0, 62% 3%, 98% 0, 100% 24%, 97% 78%, 100% 94%, 55% 100%, 6% 97%, 0 82%, 2% 30%);
}
.alcove-2 {
  --tilt: 0.6deg;
  --alcove-bg: #150e2c;
  clip-path: polygon(0 6%, 40% 0, 96% 2%, 100% 38%, 98% 90%, 62% 97%, 30% 100%, 2% 95%, 3% 55%, 0 28%);
}
.alcove-3 {
  --tilt: -0.5deg;
  --alcove-bg: #110a24;
  clip-path: polygon(4% 3%, 45% 0, 94% 4%, 100% 20%, 97% 60%, 99% 92%, 70% 100%, 12% 98%, 0 90%, 1% 25%);
}
/* a stray gem left in the wall of each alcove */
.alcove::after {
  content: "";
  position: absolute;
  right: 1.4rem;
  bottom: 1.3rem;
  width: 7px;
  height: 7px;
  background: var(--gold);
  transform: rotate(45deg);
  opacity: 0.55;
}
.alcove-3::after { background: var(--red); opacity: 0.8; }

.alcove-depth {
  position: absolute;
  top: 1rem;
  right: 1.3rem;
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  letter-spacing: 0.16em;
  color: var(--gold);
  opacity: 0.55;
}
.alcove-icon {
  display: block;
  width: 46px;
  height: auto;
  margin-bottom: 0.9rem;
  fill: #9a8ac2;
  opacity: 0.9;
}
.alcove-icon-gem {
  fill: var(--red);
  opacity: 1;
  filter: drop-shadow(0 0 7px rgba(255, 67, 101, 0.45));
}
.alcove h3 { margin-bottom: 0.35em; }
.alcove p { color: var(--muted); margin: 0; font-size: 0.98rem; }
.alcove:hover { transform: translateY(-3px) rotate(var(--tilt, 0deg)); }

/* the stagger: each alcove sits deeper in the cave than the last */
@media (min-width: 881px) {
  .alcove-2 { align-self: flex-end; margin-right: 3%; }
  .alcove-3 { align-self: center; margin-left: 5%; }
}

.story-ambition { font-size: 1.2rem; }
.story-ambition strong { color: var(--gold); }

/* ---------- Bloxodachi ---------- */
.bloxo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: center;
}
.bloxo-copy p { color: var(--muted); max-width: 32rem; }
.bloxo-copy p strong { color: var(--ink); }

/* the tamagotchi shell */
.pet-wrap { display: flex; flex-direction: column; align-items: center; gap: 0.8rem; }
.pet-shell {
  background: linear-gradient(160deg, #ff5876, #e02c50);
  border: 4px solid #ffb3c1;
  border-radius: 46% 46% 44% 44% / 40% 40% 48% 48%;
  padding: 3.4rem 3.6rem 2.2rem;
  box-shadow:
    inset 0 -14px 0 rgba(0, 0, 0, 0.18),
    inset 0 10px 0 rgba(255, 255, 255, 0.18),
    10px 12px 0 rgba(0, 0, 0, 0.28);
}
.pet-screen {
  background: #241a3e;
  border: 4px solid #12092a;
  border-radius: 14px;
  padding: 8px;
  box-shadow: inset 0 4px 12px rgba(0, 0, 0, 0.5);
}
#pet-canvas {
  display: block;
  width: min(52vw, 230px);
  height: auto;
  image-rendering: pixelated;
  border-radius: 8px;
}
.pet-status {
  font-family: var(--font-pixel);
  font-size: 0.56rem;
  text-align: center;
  color: #ffe6ec;
  margin: 0.9rem 0 0.8rem;
  min-height: 1.5em;
}
.pet-buttons { display: flex; justify-content: center; gap: 0.9rem; }
.pet-btn {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  color: #4a0c1e;
  background: #ffd9e0;
  border: 3px solid #4a0c1e;
  border-radius: 50px;
  padding: 0.7em 1.1em;
  cursor: pointer;
  box-shadow: 0 4px 0 #4a0c1e;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.pet-btn:hover { background: #fff; }
.pet-btn:active { transform: translateY(4px); box-shadow: 0 0 0 #4a0c1e; }
.pet-caption {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  color: var(--muted);
}

/* ---------- Favorites ---------- */
.faves { background: var(--bg-soft); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.faves-sub { color: var(--muted); font-size: 1.15rem; }
.faves-group { margin-top: 2.2rem; }
.faves-label {
  font-family: var(--font-pixel);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  color: var(--gold);
  margin-bottom: 1rem;
}
.pills {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0;
  margin: 0;
}
.pills li {
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 0.32em 1em;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--muted);
  background: var(--bg-softer);
  transition: transform 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  cursor: default;
}
.pills li:hover {
  transform: rotate(-2deg) scale(1.07);
  color: var(--ink);
  border-color: var(--red);
}
.pills-current li { border-color: rgba(95, 232, 178, 0.35); }
.pills-current li:hover { border-color: var(--mint); }
.faves-more { color: var(--muted); margin-top: 1.6rem; font-style: italic; }

/* ---------- Contact ---------- */
.contact .section-inner { text-align: center; }
.contact-sub { color: var(--muted); font-size: 1.15rem; max-width: 34rem; margin: 0 auto 1em; }
.contact-ctas { justify-content: center; }

/* ---------- Footer ---------- */
.footer {
  border-top: 1px solid var(--line);
  padding: 2rem 1.5rem 2.6rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
}
.footer p { margin: 0.3em 0; }
.footer-hint {
  font-family: var(--font-pixel);
  font-size: 0.55rem;
  opacity: 0.5;
  letter-spacing: 0.2em;
}

/* ---------- Scroll reveals ---------- */
.reveal {
  opacity: 0;
  transform: translateY(22px) rotate(var(--tilt, 0deg));
  transition: opacity 0.6s ease, transform 0.6s ease;
}
.reveal.on { opacity: 1; transform: rotate(var(--tilt, 0deg)); }

/* ---------- Konami gem rain ---------- */
.rain-drop {
  position: fixed;
  top: -3rem;
  z-index: 1000;
  font-size: 1.6rem;
  pointer-events: none;
  animation: rain-fall linear forwards;
}
@keyframes rain-fall {
  to { transform: translateY(110vh) rotate(360deg); }
}

/* ---------- Responsive ---------- */
@media (max-width: 880px) {
  .hero-inner {
    grid-template-columns: 1fr;
    min-height: 0;
    text-align: center;
  }
  .hero-copy { order: 2; }
  .hero-gem  { order: 1; }
  #gem-canvas { width: min(76vw, 340px); }
  .hero-sub { margin-inline: auto; }
  .hero-ctas { justify-content: center; }
  .bloxo-grid { grid-template-columns: 1fr; }
  .nav-links { display: none; }
  .nav { justify-content: space-between; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .marquee-track { animation: none; }
  .glint { animation: none; }
  .gem-glow { animation: none; }
  .reveal { opacity: 1; transform: rotate(var(--tilt, 0deg)); transition: none; }
  .vein-line { stroke-dashoffset: 0 !important; transition: none !important; }
  .rain-drop { display: none; }
}
