/* Packing Master landing page. Pixel-art fantasy theme built on the game's own
   assets (btn-start.png, panel-reward.png, bag.png, screenshot).
   Fixed light theme, image + text only, no interactive game elements.
   Fonts: Caprasimo (display) + Nunito (body). */

:root {
  --c-bg: #f1d9a5;         /* sand */
  --c-bg-alt: #e2bf80;     /* alt sections */
  --c-wood: #3b2420;       /* deep wood: outlines, header, footer */
  --c-wood-dark: #2a1815;
  --c-panel: #4a2f2b;      /* panel brown */
  --c-panel-edge: #8a5a3c; /* panel edge */
  --c-gold: #f2a93b;
  --c-cream: #fbf0d6;      /* text on dark */
  --c-fg: #2f1d19;         /* body text on sand */
  --c-ring: #2f1d19;
  --c-text-shadow: #1f1210; /* 1px crisp under-shadow for light text on dark */
  --shadow-hard: 0 4px 0 var(--c-wood);
  --shadow-hard-sm: 0 3px 0 var(--c-wood);
  --r-sm: 2px;
  --r-md: 4px;
  --s-7: 72px;             /* vertical rhythm: section padding-block */
  --btn-border: 14px;
  --panel-border: 16px;
  --font-head: "Caprasimo", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  --t: 200ms ease-out;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; }
body {
  margin: 0;
  background: var(--c-bg);
  color: var(--c-fg);
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.55;
  letter-spacing: normal;
  -webkit-text-size-adjust: 100%;
}
/* Belt-and-braces against page-level horizontal scroll (a ~45px shift was
   seen in the wild). hidden is the fallback; clip is preferred because it does
   NOT create a scroll container, so position: sticky on the header keeps
   working. */
html, body { overflow-x: hidden; }
@supports (overflow: clip) {
  html, body { overflow-x: clip; }
}
img, svg { max-width: 100%; }
h1, h2, h3 { font-family: var(--font-head); font-weight: 400; line-height: 1.15; margin: 0 0 var(--s-3, 16px); text-wrap: balance; }
/* Display sizes pinned to px so the 18px body base does not rescale them. */
h1 { font-size: clamp(35px, 6vw, 61px); }
h2 { font-size: clamp(27px, 4vw, 40px); color: var(--c-fg); }
h3 { font-size: 20px; }
p { margin: 0 0 16px; }
/* Layered fallbacks: even if max-width were dropped, padding-inline alone
   keeps >= 16px side padding. Never collapses to full viewport width. */
.container { width: 100%; max-width: 1120px; padding-inline: 16px; margin-inline: auto; }

:focus-visible { outline: 3px solid var(--c-ring); outline-offset: 3px; border-radius: var(--r-sm); }

.skip-link {
  position: absolute; left: 16px; top: -64px; z-index: 100;
  background: var(--c-wood); color: var(--c-cream); padding: 10px 16px;
  border: 3px solid var(--c-wood-dark); border-radius: var(--r-md);
  font-weight: 700; text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: var(--c-wood);
  border-bottom: 4px solid var(--c-wood-dark);
  padding-inline: 16px;
}
.header-inner { display: flex; align-items: center; gap: 16px; min-height: 68px; justify-content: space-between; width: 100%; max-width: 1120px; margin-inline: auto; }
.brand {
  display: inline-flex; align-items: center; min-height: 44px;
  font-family: var(--font-head); font-size: 19px; color: var(--c-gold);
  text-decoration: none; letter-spacing: .02em;
  -webkit-text-stroke: 1px var(--c-wood-dark);
  paint-order: stroke fill;
  text-shadow: 2px 2px 0 var(--c-wood-dark);
}
.site-header :focus-visible { outline-color: var(--c-gold); }
.site-header .btn { box-shadow: 0 4px 0 var(--c-wood-dark); }
.nav-list { display: none; list-style: none; margin: 0; padding: 0; gap: 4px; }
.nav-list a {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px;
  color: var(--c-cream); font-size: 17px; font-weight: 700; text-decoration: none;
  text-shadow: 0 1px 0 var(--c-text-shadow);
  border-radius: var(--r-md); transition: background var(--t);
}
.nav-list a:hover { background: var(--c-panel); }
@media (min-width: 768px) { .nav-list { display: flex; } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 0 24px;
  font-family: var(--font-head); font-weight: 400; font-size: 18px;
  border: var(--btn-border) solid transparent; border-radius: var(--r-md);
  text-decoration: none; cursor: pointer;
  box-shadow: var(--shadow-hard);
  transition: transform var(--t);
  touch-action: manipulation;
  background: none;
}
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: scale(.95); }
.btn-primary {
  color: #fff;
  border-image-source: url("../assets/game/btn-start.png");
  border-image-slice: 30 fill;
  border-image-width: var(--btn-border);
  border-image-repeat: stretch;
  -webkit-text-stroke: 1.5px #2f1d19;
  paint-order: stroke fill;
  text-shadow: 2px 2px 0 #2f1d19;
}
.btn-secondary {
  color: var(--c-cream);
  border-image-source: url("../assets/game/panel-reward.png");
  border-image-slice: 60 fill;
  border-image-width: var(--panel-border);
  border-image-repeat: stretch;
}
.btn-sm { min-height: 44px; padding: 0 16px; font-size: 16px; border-width: 10px; border-image-width: 10px; }
.btn-secondary.btn-sm { border-width: 12px; border-image-width: 12px; }
.btn-secondary { text-shadow: 0 1px 0 var(--c-text-shadow); }

/* Hero */
/* Hero: full-bleed illustrated scene. The key art fills the section behind the
   content (z 0), the bottom fade sits between (z 1), content on top (z 2).
   Logo + buttons are sized to stay inside the top ~46% of the hero at common
   viewports so they never cover the character's fists or the enemy group. */
.hero {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  min-height: 560px;
  min-height: clamp(560px, calc(100svh - 68px), 820px);
}
@media (min-width: 768px) {
  .hero { min-height: clamp(520px, 56.25vw, 880px); }
}
.hero picture { position: absolute; inset: 0; z-index: 0; display: block; }
.hero picture img {
  width: 100%; height: 100%; object-fit: cover; object-position: 38% bottom;
  transform-origin: center bottom;
  animation: hero-zoom 28s ease-in-out infinite alternate;
}
@media (min-width: 768px) {
  .hero picture img { object-position: center bottom; }
}
@keyframes hero-zoom { from { transform: scale(1); } to { transform: scale(1.06); } }
.hero::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 16%; z-index: 1;
  background: linear-gradient(to bottom, transparent, #f1d9a5);
  pointer-events: none;
}
.hero-content {
  position: relative; z-index: 2;
  display: flex; flex-direction: column; align-items: center;
  padding-top: 24px;
}
@media (min-width: 768px) { .hero-content { padding-top: 32px; } }
.hero-logo { margin: 0; line-height: 0; width: min(70vw, 280px); height: 170px; }
.hero-logo img {
  display: block; width: 100%; height: 100%; object-fit: contain;
  filter: drop-shadow(0 4px 0 rgba(42, 24, 21, .4));
}
@media (min-width: 768px) {
  .hero-logo { width: clamp(220px, 24vw, 340px); height: clamp(130px, 15vw, 240px); }
}
.cta-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 16px; margin: 16px 0 0; }
.cta-note {
  position: absolute; left: 50%; top: calc(100% + 8px); transform: translateX(-50%);
  margin: 0; padding: 6px 14px; border-radius: 999px; white-space: nowrap;
  background: var(--c-wood); color: var(--c-cream);
  font-size: 14px; font-weight: 700;
  text-shadow: 0 1px 0 var(--c-text-shadow);
}
.cta-note:empty { display: none; }

/* Lead sentence on a wooden plate (assets/game/plate-wood-header.png, 420x72).
   SCALE FORMULA: everything derives from --plate-h. The artwork is 72px tall
   with a 14px top bevel, a 12px bottom bevel and a 46px brown field (measured
   rows 14-59); the end caps are 56px wide. Changing --plate-h rescales all of
   it by s = --plate-h / 72: caps stay 56*s wide (they live in the left/right
   border-image area and scale with the element height — no distortion, just a
   bigger plate), padding-top = 14*s, padding-bottom = 12*s, brown field =
   46*s. Text is flex-centred in that box, so it sits centred in the brown
   field with equal gaps above and below. padding-inline clears the caps
   symmetrically on both axes. Two sentences: .lead-full on wide screens,
   .lead-short on phones (display:none removes the other from the a11y tree).
   No shadow, outline or border-bottom — the artwork alone forms the shape. */
.lead-band { position: relative; z-index: 3; margin-top: -32px; }
.lead-plate {
  --plate-h: 96px;
  --cap-w: calc(56 / 72 * var(--plate-h));
  display: flex; align-items: center; justify-content: center;
  max-width: 680px; min-height: var(--plate-h);
  margin: 0 auto;
  padding: calc(14 / 72 * var(--plate-h)) 20px calc(12 / 72 * var(--plate-h));
  border: 0 solid transparent; border-width: 0 var(--cap-w);
  border-image-source: url("../assets/game/plate-wood-header.png");
  border-image-slice: 0 56 fill;
  border-image-width: 0 var(--cap-w);
  border-image-repeat: stretch;
  box-shadow: none; outline: none;
  color: #fbf0d6;
  font-size: 18px; font-weight: 700; line-height: 1.3; text-align: center;
  text-shadow: 0 1px 0 var(--c-text-shadow);
  image-rendering: pixelated;
}
.lead-short { display: none; }
@media (max-width: 599px) {
  .lead-band { margin-top: -24px; }
  .lead-plate { --plate-h: 108px; font-size: 14px; padding-inline: 8px; }
  .lead-full { display: none; }
  .lead-short { display: inline; }
}
#how { padding-top: 48px; }
@media (max-width: 767px) { #how { padding-top: 40px; } }

/* Sections */
.section { padding-block: var(--s-7); border-bottom: 4px solid var(--c-wood); }
.section-alt { background: var(--c-bg-alt); }
.section-lead { font-size: 20px; font-weight: 600; color: var(--c-fg); max-width: 60ch; }
@media (max-width: 767px) { .section-lead { font-size: 18px; } }

.card {
  color: var(--c-cream);
  border: var(--panel-border) solid transparent; border-radius: var(--r-md);
  border-image-source: url("../assets/game/panel-reward.png");
  border-image-slice: 60 fill;
  border-image-width: var(--panel-border);
  border-image-repeat: stretch;
  box-shadow: var(--shadow-hard);
  padding: 24px;
}
.card p { color: var(--c-cream); text-shadow: 0 1px 0 var(--c-text-shadow); }
.card h3 {
  color: var(--c-gold);
  -webkit-text-stroke: 1px var(--c-wood-dark);
  paint-order: stroke fill;
  text-shadow: 2px 2px 0 var(--c-wood-dark);
}

/* Steps */
.steps { list-style: none; margin: 32px 0 0; padding: 0; display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .steps { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .steps { grid-template-columns: repeat(4, 1fr); } }
.step p { margin: 0; }
.step-num {
  display: inline-grid; place-items: center; width: 44px; height: 44px; margin-bottom: 16px;
  border: 2px solid var(--c-wood); border-radius: var(--r-md);
  background: var(--c-gold); color: var(--c-wood-dark);
  font-family: var(--font-head); font-size: 20px;
  box-shadow: var(--shadow-hard-sm);
}

/* Combos: bag image + copy, image first on mobile */
.combos-grid { display: grid; gap: 32px; align-items: center; }
@media (min-width: 900px) {
  .combos-grid { grid-template-columns: 1fr 1fr; gap: 48px; }
  .combos-copy { order: 1; }
  .bag-figure { order: 2; }
}
.bag-figure {
  display: block; width: min(560px, 100%); height: auto;
  margin-inline: auto;
  border: 4px solid var(--c-wood); border-radius: var(--r-md);
  box-shadow: var(--shadow-hard);
  background: var(--c-panel);
}
.combos-copy p { max-width: 46ch; margin: 0; }

/* Features */
.features { list-style: none; margin: 32px 0 48px; padding: 0; display: grid; gap: 24px; grid-template-columns: 1fr; }
@media (min-width: 768px) { .features { grid-template-columns: repeat(3, 1fr); } }
.feature svg { color: var(--c-gold); margin-bottom: 16px; filter: drop-shadow(2px 2px 0 var(--c-wood-dark)); }
.feature p { margin: 0; }
.shots-title { margin-bottom: 16px; color: var(--c-fg); -webkit-text-stroke: 0; text-shadow: none; }

/* Screenshot carousel */
.carousel { --card-w: min(72vw, 280px); }
.carousel-track {
  position: relative;
  display: flex; align-items: flex-start; gap: 16px;
  overflow-x: auto; scrollbar-width: none;
  scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  padding: 4px calc((100% - var(--card-w)) / 2) 16px;
  user-select: none; -webkit-user-select: none;
  cursor: grab;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track.dragging { scroll-snap-type: none; cursor: grabbing; }
.shot-card {
  flex: 0 0 var(--card-w); width: var(--card-w);
  aspect-ratio: 9 / 16; margin: 0;
  scroll-snap-align: center;
  border: 4px solid var(--c-wood); border-radius: var(--r-md);
  box-shadow: 0 6px 0 var(--c-wood);
  overflow: hidden; background: var(--c-wood-dark);
}
.shot-card img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  user-select: none; -webkit-user-drag: none;
}

/* Final CTA + footer */
.cta-card { text-align: center; padding: 48px 32px; }
.cta-card .section-lead { color: var(--c-cream); margin-inline: auto; text-shadow: 0 1px 0 var(--c-text-shadow); }
.cta-card h2 { color: var(--c-cream); -webkit-text-stroke: 1.2px var(--c-wood-dark); paint-order: stroke fill; text-shadow: 2px 2px 0 var(--c-wood-dark); }
.site-footer {
  background: var(--c-wood); color: var(--c-cream);
  border-top: 4px solid var(--c-wood-dark); padding: 32px 0;
}
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
.footer-inner p { margin: 0; font-size: 17px; font-weight: 700; text-shadow: 0 1px 0 var(--c-text-shadow); }

/* Motion safety */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
