/* ============================================
   Plexi Games — style.css
   Warm palette · light/dark themes · Fredoka + Nunito
   ============================================ */

:root {
  --font-display: "Fredoka", "Baloo 2", "Arial Rounded MT Bold", sans-serif;
  --font-body: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  --radius: 18px;
}

/* ---------- Themes ---------- */
:root,
:root[data-theme="light"] {
  --bg: #fdf3e7;
  --bg-soft: #f7e8d4;
  --surface: #fffaf2;
  --text: #3d2c23;
  --text-dim: #8a6c5a;
  --primary: #ee5d36;
  --primary-deep: #c74622;
  --accent: #f5a623;
  --accent-deep: #cf8410;
  --danger: #e8484f;
  --border: rgba(61, 44, 35, 0.14);
  --border-strong: rgba(61, 44, 35, 0.32);
  --shadow: 0 16px 40px rgba(120, 72, 40, 0.14);
  --header-bg: rgba(253, 243, 231, 0.85);
  --blob-1: rgba(245, 166, 35, 0.28);
  --blob-2: rgba(238, 93, 54, 0.18);
  --screen-1: #fff1dc;
  --screen-2: #ffe2bd;
  --bezel-1: #4a352a;
  --bezel-2: #33231b;
}

:root[data-theme="dark"] {
  --bg: #211611;
  --bg-soft: #2a1d16;
  --surface: #2e2018;
  --text: #f8ead9;
  --text-dim: #c2a189;
  --primary: #ff7a4d;
  --primary-deep: #b8431f;
  --accent: #ffb84d;
  --accent-deep: #d18a1d;
  --danger: #ff6b72;
  --border: rgba(248, 234, 217, 0.13);
  --border-strong: rgba(248, 234, 217, 0.3);
  --shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  --header-bg: rgba(33, 22, 17, 0.85);
  --blob-1: rgba(245, 166, 35, 0.1);
  --blob-2: rgba(238, 93, 54, 0.09);
  --screen-1: #38271d;
  --screen-2: #241811;
  --bezel-1: #453226;
  --bezel-2: #1c120d;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  overflow-x: hidden;
  transition: background 0.35s ease, color 0.35s ease;
}

/* Soft warm background blobs */
body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(90px);
  pointer-events: none;
}

body::before {
  width: 540px;
  height: 540px;
  background: var(--blob-1);
  top: -190px;
  right: -140px;
}

body::after {
  width: 440px;
  height: 440px;
  background: var(--blob-2);
  bottom: -170px;
  left: -150px;
}

.container {
  width: min(1120px, 92%);
  margin-inline: auto;
}

/* Browsers don't apply the hidden attribute to inline <svg> (icon sprite) */
[hidden] {
  display: none !important;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding-block: 0.8rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text);
}

.logo-mark { width: 38px; height: 38px; display: block; }

.logo-text {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.3rem;
  letter-spacing: 0.01em;
}

.logo-text em {
  font-style: normal;
  color: var(--primary);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.7rem;
  list-style: none;
  margin-left: auto;
}

.nav-links a {
  color: var(--text-dim);
  text-decoration: none;
  font-weight: 800;
  font-size: 0.95rem;
  transition: color 0.2s;
}

.nav-links a:hover { color: var(--primary); }

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.theme-toggle {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 2px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  box-shadow: 0 3px 0 var(--border-strong);
  transition: transform 0.12s, box-shadow 0.12s;
}

.theme-toggle:active {
  transform: translateY(3px);
  box-shadow: none;
}

.theme-toggle .icon { width: 19px; height: 19px; }

:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
}

.nav-toggle span {
  width: 24px;
  height: 3px;
  background: var(--text);
  border-radius: 3px;
  transition: transform 0.25s, opacity 0.25s;
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  align-items: center;
  gap: 3rem;
  min-height: calc(100vh - 70px);
  padding-block: 4rem;
}

.icon {
  width: 1em;
  height: 1em;
  vertical-align: -0.15em;
}

.hero-eyebrow {
  color: var(--primary);
  font-weight: 900;
  font-size: 0.85rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  margin-bottom: 1.2rem;
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.6rem, 6vw, 4.6rem);
  font-weight: 600;
  line-height: 1.12;
  letter-spacing: 0.005em;
  margin-bottom: 1.9rem; /* extra room: the squiggle underline hangs below the text */
}

/* Hand-drawn squiggle underline */
.highlight {
  color: var(--primary);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 12' preserveAspectRatio='none'%3E%3Cpath d='M3 8 Q 16 3 31 7 T 61 7 T 90 6 T 117 6' stroke='%23f5a623' stroke-width='5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E")
    no-repeat bottom center / 100% 0.22em;
  padding-bottom: 0.16em;
}

.tint { color: var(--primary); }

.hero-sub {
  color: var(--text-dim);
  font-size: 1.1rem;
  font-weight: 600;
  max-width: 46ch;
  margin-bottom: 2rem;
}

.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; }

/* ---------- Buttons (chunky, game-style) ---------- */
/* Both variants share the exact same box (border included) so they
   render at identical heights and their labels sit on the same line. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.8rem 1.7rem;
  border: 2.5px solid transparent;
  border-radius: 14px;
  line-height: 1.2;
  font-family: var(--font-body);
  font-weight: 900;
  font-size: 0.95rem;
  text-decoration: none;
  transition: transform 0.12s, box-shadow 0.12s;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 0 var(--primary-deep);
}

.btn-primary:hover { filter: brightness(1.06); }

.btn-primary:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--primary-deep);
}

.btn-ghost {
  background: transparent; /* <button> keeps its UA background otherwise */
  color: var(--text);
  border-color: var(--border-strong);
  box-shadow: 0 4px 0 var(--border-strong);
}

.btn-ghost:active {
  transform: translateY(3px);
  box-shadow: 0 1px 0 var(--border-strong);
}

.btn-lg { padding: 1rem 2.3rem; font-size: 1.05rem; }

/* ---------- Phone mock + mini game ---------- */
.hero-visual { display: grid; place-items: center; }

.phone-mock {
  width: min(280px, 70vw);
  aspect-ratio: 9 / 19;
  border-radius: 38px;
  background: linear-gradient(160deg, var(--bezel-1), var(--bezel-2));
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 14px;
  transform: rotate(4deg);
  transition: transform 0.4s ease;
}

.phone-mock:hover { transform: rotate(0deg) scale(1.02); }

.phone-screen {
  width: 100%;
  height: 100%;
  border-radius: 26px;
  overflow: hidden;
  background: linear-gradient(170deg, var(--screen-1), var(--screen-2));
  position: relative;
}

.mini-game {
  position: absolute;
  inset: 0;
  user-select: none;
  -webkit-user-select: none;
}

.mini-score {
  position: absolute;
  top: 20px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  color: var(--primary);
  pointer-events: none;
}

.mini-hint {
  position: absolute;
  bottom: 16px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-dim);
  pointer-events: none;
}

.mini-tiles {
  position: absolute;
  top: 54%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 78%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.mini-bar {
  height: 26px;
  border-radius: 9px;
  border: none;
  cursor: pointer;
  background: linear-gradient(90deg, var(--bar-c1), var(--bar-c2));
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.18);
  transition: width 0.35s cubic-bezier(0.34, 1.56, 0.64, 1),
              transform 0.15s, outline-color 0.15s;
  outline: 3px solid transparent;
  outline-offset: 2px;
}

.mini-bar:active { transform: scale(0.95); }

.mini-bar.selected {
  outline-color: var(--accent);
  transform: scale(1.06);
}

.mini-tiles.solved .mini-bar {
  animation: bar-pop 0.45s ease;
}

@keyframes bar-pop {
  40% { transform: scale(1.12); }
}

/* ---------- Sections ---------- */
.section { padding-block: 6rem; }

.section-title {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 4vw, 2.8rem);
  font-weight: 600;
  margin-bottom: 0.6rem;
}

.section-sub {
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 2.6rem;
  font-size: 1.05rem;
}

/* ---------- Games grid ---------- */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.6rem;
}

.game-card {
  --card-color: var(--primary);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.25s, border-color 0.25s, box-shadow 0.25s;
}

.game-card:hover {
  transform: translateY(-6px) rotate(-0.5deg);
  border-color: var(--card-color);
  box-shadow: var(--shadow);
}

.game-thumb {
  display: grid;
  place-items: center;
  height: 160px;
  background: color-mix(in srgb, var(--card-color) 16%, var(--bg-soft));
}

.thumb-icon {
  width: 58px;
  height: 58px;
  color: var(--card-color);
  transition: transform 0.3s ease;
}

.game-card:hover .thumb-icon { transform: scale(1.12) rotate(-4deg); }

.game-info {
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.game-info h3 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  margin-bottom: 0.4rem;
}

.game-info p {
  color: var(--text-dim);
  font-size: 0.93rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

/* Simple status line instead of pill badges */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: auto; /* pins the label to the card bottom so all cards align */
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-dim);
}

.status::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--card-color, var(--accent));
}

/* ---------- About ---------- */
.about-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 3rem;
  align-items: center;
}

.about-grid p {
  color: var(--text-dim);
  font-weight: 600;
  margin-bottom: 1rem;
  max-width: 55ch;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}

.stat {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.6rem 1rem;
  text-align: center;
}

.stat-num, .stat-plus {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 600;
  color: var(--primary);
}

.stat-label {
  display: block;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-weight: 800;
  margin-top: 0.3rem;
}

/* ---------- Contact ---------- */
.contact-card {
  text-align: center;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: calc(var(--radius) * 1.5);
  padding: 4rem 2rem;
  box-shadow: var(--shadow);
}

.contact-card .section-sub { margin-bottom: 2rem; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 1.6rem;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.8rem;
  color: var(--text-dim);
  font-weight: 600;
  font-size: 0.9rem;
}

.footer-links { display: flex; gap: 1.4rem; }

.footer-links a {
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s;
}

.footer-links a:hover { color: var(--primary); }

/* ---------- Scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}

/* ---------- Legal page (privacy) ---------- */
.legal {
  max-width: 780px;
  margin-inline: auto;
  padding-block: 4rem 6rem;
}

.legal h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 600;
  margin-bottom: 0.4rem;
}

.legal .meta {
  color: var(--text-dim);
  font-size: 0.95rem;
  margin-bottom: 2.5rem;
}

.legal h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.4rem;
  margin: 2.4rem 0 0.8rem;
  padding-top: 1.2rem;
  border-top: 1px solid var(--border);
}

.legal h3 { font-size: 1.1rem; margin: 1.4rem 0 0.5rem; }

.legal p, .legal li { color: var(--text-dim); font-weight: 600; margin-bottom: 0.8rem; }

.legal ul { padding-left: 1.4rem; margin-bottom: 1rem; }

.legal a { color: var(--primary); }

.legal strong { color: var(--text); }

.legal .toc {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.4rem 1.6rem;
  margin-bottom: 1rem;
}

.legal .toc ul { margin: 0; list-style: none; padding: 0; }

.legal .toc a { text-decoration: none; font-weight: 800; }

.legal .toc a:hover { text-decoration: underline; }

/* ---------- Error page ---------- */
.error-page {
  text-align: center;
  padding-block: 8rem;
}

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding-block: 3rem;
    min-height: auto;
  }

  .hero-actions { justify-content: center; }

  .hero-sub { margin-inline: auto; }

  .about-grid { grid-template-columns: 1fr; }

  .nav-toggle { display: flex; }

  /* nav-links goes absolute below, so it no longer pushes the actions right */
  .nav-actions { margin-left: auto; }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    flex-direction: column;
    gap: 0;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  .nav-links.open { max-height: 320px; }

  .nav-links li { width: 100%; text-align: center; }

  .nav-links a {
    display: block;
    padding: 1rem;
  }

  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
}
