/* ============ Scramble Works — brand palette ============ */
:root {
  --orange: #ff7a1a;
  --orange-bright: #ff9440;
  --slate: #2f3a45;
  --slate-deep: #1b232b;
  --ink: #12181e;
  --ink-deep: #0b1015;
  --cream: #e9e6df;
  --grey: #8b98a5;
  --line: rgba(233, 230, 223, 0.1);
  --font-display: "Chakra Petch", sans-serif;
  --font-body: "Inter", sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--ink-deep);
  color: var(--cream);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }

.wrap { max-width: 1140px; margin: 0 auto; padding: 0 24px; }

h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; }

h1 { font-size: clamp(2.4rem, 6vw, 4.2rem); font-weight: 700; letter-spacing: 0.01em; }
h2 { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 600; }

.accent { color: var(--orange); }

/* ============ Reveal animation ============ */
.reveal {
  opacity: 0;
  transform: translateY(26px);
  transition:
    opacity 0.55s ease var(--rd, 0s),
    transform 0.7s cubic-bezier(0.22, 1.18, 0.36, 1) var(--rd, 0s);
}
.reveal.visible { opacity: 1; transform: none; }
/* (reduced-motion overrides live at the end of this file so they win the cascade) */

/* ============ Nav ============ */
.nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(11, 16, 21, 0.82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: 1140px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.nav-mark { width: 36px; height: 36px; }
/* Logo assembly: the two interlocking marks slide in from opposite sides and click together */
@keyframes mark-in-top {
  from { translate: -110px -80px; opacity: 0; }
  to { translate: 0 0; opacity: 1; }
}
@keyframes mark-in-bottom {
  from { translate: 110px 80px; opacity: 0; }
  to { translate: 0 0; opacity: 1; }
}
.nav .nav-mark path { transition: translate 0.25s cubic-bezier(0.22, 1.4, 0.36, 1); }
.nav .nav-mark path:first-child { animation: mark-in-top 0.7s cubic-bezier(0.22, 1.25, 0.36, 1) 0.15s backwards; }
.nav .nav-mark path:last-child { animation: mark-in-bottom 0.7s cubic-bezier(0.22, 1.25, 0.36, 1) 0.15s backwards; }
/* On hover the pieces pull slightly apart, then snap back */
.nav-brand:hover .nav-mark path:first-child { translate: -26px -20px; }
.nav-brand:hover .nav-mark path:last-child { translate: 26px 20px; }
.nav-word {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: 0.08em;
  color: var(--cream);
}
.nav-word em { font-style: normal; color: var(--orange); }
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a {
  color: var(--cream);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  opacity: 0.85;
  transition: opacity 0.2s, color 0.2s;
}
.nav-links a:hover { opacity: 1; color: var(--orange-bright); }
.nav-links a.active { opacity: 1; color: var(--orange-bright); }
.nav-progress {
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: linear-gradient(90deg, var(--orange), var(--orange-bright));
  transform: scaleX(0);
  transform-origin: left;
  pointer-events: none;
}
.nav-cta {
  border: 1px solid var(--orange);
  padding: 7px 16px;
  border-radius: 4px;
  color: var(--orange) !important;
  opacity: 1 !important;
}
.nav-cta:hover { background: var(--orange); color: var(--ink-deep) !important; }
.nav-toggle { display: none; background: none; border: none; cursor: pointer; padding: 6px; }
.nav-toggle span {
  display: block;
  width: 22px; height: 2px;
  background: var(--cream);
  margin: 5px 0;
  transition: transform 0.25s, opacity 0.25s;
}

/* ============ Hero ============ */
.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background: url("/assets/Scrambleworks.png") center / cover no-repeat;
  /* Ken Burns drift via the individual `scale` property so JS parallax can
     drive `translate` independently without the two fighting */
  animation: kenburns 26s ease-in-out infinite alternate;
  will-change: translate, scale;
}
@keyframes kenburns {
  from { scale: 1; }
  to { scale: 1.09; }
}
/* Shard layer: on desktop a fixed viewport-wide layer above content, below the
   nav; never intercepts input. (Fixed positioning escapes the hero's overflow.) */
.site-canvas {
  position: fixed;
  inset: 0;
  /* inset alone doesn't stretch replaced elements like canvas — size explicitly */
  width: 100%;
  height: 100%;
  /* Above backgrounds and the hero image, below content boxes (cards, panels,
     footer get z-index 1+) and the nav */
  z-index: 1;
  pointer-events: none;
}
/* Touch devices: shards confined to the hero only, and no Ken Burns —
   a full-page layer plus scroll effects can crash mobile GPUs */
@media (hover: none), (pointer: coarse) {
  .site-canvas { position: absolute; }
  .hero-bg { animation: none; will-change: auto; }
}
.hero-scrim {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at center 40%, rgba(11,16,21,0.15) 0%, rgba(11,16,21,0.72) 75%),
    linear-gradient(to bottom, rgba(11,16,21,0.65) 0%, rgba(11,16,21,0.25) 30%, rgba(11,16,21,0.55) 70%, var(--ink-deep) 100%);
}
.hero-content {
  position: relative;
  z-index: 2;
  padding: 120px 24px 80px;
  max-width: 860px;
}
.hero-kicker {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--orange-bright);
  margin-bottom: 18px;
}
.hero h1 { text-shadow: 0 4px 30px rgba(0,0,0,0.6); }
.hero-sub {
  margin: 22px auto 34px;
  max-width: 620px;
  font-size: 1.08rem;
  color: rgba(233, 230, 223, 0.9);
  text-shadow: 0 2px 16px rgba(0,0,0,0.7);
}
.hero-actions { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.hero-scroll {
  position: absolute;
  bottom: 26px; left: 50%;
  transform: translateX(-50%);
  z-index: 2;
}
.hero-scroll span {
  display: block;
  width: 2px; height: 34px;
  background: linear-gradient(var(--orange), transparent);
  animation: drop 1.8s ease-in-out infinite;
}
@keyframes drop {
  0% { transform: scaleY(0); transform-origin: top; }
  50% { transform: scaleY(1); transform-origin: top; }
  100% { transform: scaleY(0); transform-origin: bottom; }
}

/* ============ Buttons ============ */
.btn {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.05em;
  text-decoration: none;
  padding: 13px 28px;
  border-radius: 4px;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s, color 0.2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  position: relative;
  overflow: hidden;
  background: var(--orange);
  color: var(--ink-deep);
  box-shadow: 0 4px 24px rgba(255, 122, 26, 0.35);
}
.btn-primary::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  left: -75%;
  width: 50%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transform: skewX(-18deg);
}
.btn-primary:hover::after { animation: sheen 0.7s ease; }
@keyframes sheen {
  from { left: -75%; }
  to { left: 125%; }
}
.btn-primary:hover { background: var(--orange-bright); box-shadow: 0 6px 32px rgba(255, 122, 26, 0.5); }
.btn-ghost {
  border: 1px solid rgba(233, 230, 223, 0.4);
  color: var(--cream);
}
.btn-ghost:hover { border-color: var(--orange); color: var(--orange-bright); }
.btn-lg { font-size: 1.1rem; padding: 16px 36px; }

/* ============ Pillars ============ */
.pillars {
  padding: 90px 0;
  border-bottom: 1px solid var(--line);
}
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 40px; }
.pillar-num {
  font-family: var(--font-display);
  color: var(--orange);
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.2em;
  margin-bottom: 10px;
}
.pillar h3 { margin-bottom: 10px; }
.pillar p { color: var(--grey); font-size: 0.96rem; }

/* ============ Sections ============ */
.section { padding: 110px 0; }
.section-alt { background: var(--ink); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-kicker {
  font-family: var(--font-display);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--orange);
  margin-bottom: 12px;
}
.section-lead {
  max-width: 680px;
  margin: 18px 0 0;
  color: rgba(233, 230, 223, 0.82);
  font-size: 1.05rem;
}
.section-note {
  margin-top: 40px;
  color: var(--grey);
  font-size: 0.95rem;
  max-width: 640px;
}

/* ============ Cards ============ */
.games-grid { margin-top: 52px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; }
.card {
  position: relative;
  z-index: 1; /* keep card boxes above the shard layer */
  background: var(--slate-deep);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 28px 24px;
  /* Each motion gets its own channel so none of them fight:
     reveal = opacity/scale, hover lift = translate, JS pointer-tilt = transform */
  transition:
    opacity 0.55s ease var(--rd, 0s),
    scale 0.7s cubic-bezier(0.22, 1.18, 0.36, 1) var(--rd, 0s),
    translate 0.2s,
    transform 0.2s ease-out,
    border-color 0.2s,
    box-shadow 0.25s;
}
.card.reveal { transform: none; scale: 0.94; }
.card.reveal.visible { scale: 1; }
.card:hover {
  translate: 0 -5px;
  border-color: rgba(255, 122, 26, 0.55);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}
/* Cursor spotlight — position driven by --mx/--my from JS */
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(220px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 122, 26, 0.13), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
}
.card:hover::after { opacity: 1; }
.card-icon {
  width: 48px; height: 48px;
  color: var(--orange);
  margin-bottom: 18px;
}
.card-icon svg { width: 100%; height: 100%; }
/* Icon character animations on card hover */
@keyframes icon-wobble {
  0%, 100% { rotate: 0deg; }
  25% { rotate: -9deg; }
  55% { rotate: 7deg; }
  80% { rotate: -3deg; }
}
@keyframes icon-bob {
  0%, 100% { translate: 0 0; }
  30% { translate: 2px -3px; }
  65% { translate: -2px 1px; }
}
@keyframes icon-rock {
  0%, 100% { rotate: 0deg; translate: 0 0; }
  30% { rotate: 10deg; translate: 1px -2px; }
  70% { rotate: -8deg; translate: -1px 1px; }
}
.card:hover .icon-ball svg { animation: icon-wobble 0.7s ease; }
.card:hover .icon-wave svg { animation: icon-bob 0.9s ease-in-out; }
.card:hover .icon-paddle svg { animation: icon-rock 0.8s ease-in-out; }
.card h3 { margin-bottom: 10px; }
.card p { color: var(--grey); font-size: 0.92rem; margin-bottom: 14px; }
.tag {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--orange-bright);
  border: 1px solid rgba(255, 122, 26, 0.4);
  border-radius: 3px;
  padding: 3px 9px;
}
.card-training { border-top: 3px solid var(--orange); }
.card-training p { margin-bottom: 0; }

/* Featured slate cards */
.featured-grid { margin-top: 52px; gap: 22px; }
.card-featured { display: flex; flex-direction: column; padding: 32px 28px; }
.card-featured .card-hook {
  color: var(--orange-bright);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 0.98rem;
  line-height: 1.45;
}
.card-featured p:not(.card-hook) { flex: 1; }
.card-featured .tag { align-self: flex-start; }
.tier-heading {
  margin-top: 72px;
  font-size: 0.95rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--cream);
}
.tier-heading::after {
  content: "";
  display: inline-block;
  width: 48px; height: 3px;
  background: var(--orange);
  margin-left: 16px;
  vertical-align: middle;
}
.tier-sub { color: var(--grey); font-size: 0.92rem; margin-top: 8px; }
.tier-heading + .games-grid, .tier-sub + .games-grid { margin-top: 28px; }
.card-compact { padding: 24px 22px; }
.card-compact h4 {
  font-family: var(--font-display);
  font-size: 1.02rem;
  font-weight: 600;
  margin-bottom: 8px;
}
.card-compact p { margin-bottom: 0; }
.wt {
  display: block;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--grey);
  margin-top: 2px;
}

/* ============ Split layout ============ */
.split {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 64px;
  align-items: center;
}
.split-text .reveal + .reveal { margin-top: 16px; }
.feature-list {
  list-style: none;
  margin-top: 26px;
}
.feature-list li {
  padding: 12px 0 12px 30px;
  position: relative;
  border-bottom: 1px solid var(--line);
  color: rgba(233, 230, 223, 0.9);
}
.feature-list li::before {
  content: "";
  position: absolute;
  left: 0; top: 20px;
  width: 14px; height: 8px;
  background: var(--orange);
  clip-path: polygon(0 0, 100% 0, 100% 100%, 25% 100%);
}
.split-panel {
  position: relative;
  z-index: 1; /* keep panel boxes above the shard layer */
  background: var(--slate-deep);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 34px;
}
.spec {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.spec-label {
  font-size: 0.82rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--grey);
}
.spec-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  color: var(--orange-bright);
}
.spec-note { margin-top: 20px; color: var(--grey); font-size: 0.9rem; }
.studio-panel { padding: 0; overflow: hidden; }
.studio-logo { width: 100%; height: auto; }

/* ============ Roadmap / contact ============ */
.contact-wrap { text-align: center; }
.contact-wrap .section-lead { margin: 34px auto; }
.roadmap {
  position: relative;
  z-index: 1; /* keep the roadmap box above the shard layer */
  display: flex;
  flex-direction: column;
  gap: 0;
  max-width: 560px;
  margin: 40px auto 0;
  text-align: left;
}
.roadmap-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.02rem;
}
.roadmap-dot {
  flex: 0 0 auto;
  width: 10px; height: 10px;
  background: var(--orange);
  clip-path: polygon(0 0, 100% 0, 100% 70%, 70% 100%, 0 100%);
}

/* ============ Footer ============ */
.footer {
  position: relative;
  z-index: 1; /* keep footer text above the shard layer */
  border-top: 1px solid var(--line);
  padding: 56px 0 40px;
  background: var(--ink);
}
.footer-inner { text-align: center; color: var(--grey); font-size: 0.92rem; }
.footer-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 16px;
}
.footer-fine { margin-top: 8px; font-size: 0.8rem; opacity: 0.7; }

/* ============ Responsive ============ */
@media (max-width: 960px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .featured-grid { grid-template-columns: 1fr; }
  .split { grid-template-columns: 1fr; gap: 40px; }
}
@media (max-width: 720px) {
  .grid-3 { grid-template-columns: 1fr; gap: 32px; }
  .nav-links {
    position: fixed;
    top: 65px; left: 0; right: 0;
    background: rgba(11, 16, 21, 0.97);
    border-bottom: 1px solid var(--line);
    flex-direction: column;
    padding: 24px;
    gap: 20px;
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-toggle { display: block; }
  .nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .section { padding: 80px 0; }
}
@media (max-width: 520px) {
  .grid-4 { grid-template-columns: 1fr; }
}

/* ============ Reduced motion ============ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .card.reveal { scale: 1; transition: border-color 0.2s, box-shadow 0.25s; }
  .card:hover { translate: none; }
  .site-canvas { display: none; }
  .hero-bg { animation: none; }
  .nav-mark path { animation: none; transition: none; }
  .nav-brand:hover .nav-mark path { translate: none; }
  .btn-primary::after { display: none; }
  .card:hover .card-icon svg { animation: none; }
  .hero-scroll span { animation: none; }
}
