/*
 * Kargo 2 — website base. "Sunlit Toy Depot": the same tokens as the app (src/theme/tokens.ts).
 * Every pressable surface is a painted block: a top face plus a darker lip underneath.
 */

@font-face {
  font-family: "Baloo 2";
  src: url("../fonts/baloo2-800.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Baloo 2";
  src: url("../fonts/baloo2-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("../fonts/nunito-600.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Nunito";
  src: url("../fonts/nunito-800.woff2") format("woff2");
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;

  /* Ink and paper (app: colors.ink, cream…) */
  --ink: #1b2440;
  --ink-soft: #47527a;
  --ink-muted: #5f6888;
  --on-dark: #fff4e2;
  --on-dark-soft: #d9cfef;
  --cream: #fff4e2;
  --cream-hi: #fffbf3;
  --cream-deep: #f7e4c6;
  --cream-lip: #e3c79c;
  --white: #ffffff;

  /* Actions */
  --amber: #ffb320;
  --amber-hi: #ffcb5c;
  --amber-lip: #d98a00;
  --teal: #19b8a6;
  --teal-hi: #52d4c5;
  --teal-lip: #0e8c7e;
  --teal-deep: #0a6e63;
  --coral: #f2545b;
  --coral-hi: #f98288;
  --coral-lip: #c23840;
  --success-lip: #1e7540;
  /* Amber dark enough for small text: 4.96:1 on creamDeep, 5.7:1 on cream. */
  --amber-ink: #8f5300;
  /* Placeholder text: 5.7:1 on its pink wash. */
  --ph-ink: #a82a33;
  --star: #ffc93c;
  --star-lip: #e09a00;
  --focus: #2c62c4;

  /* Parcels: face / lip (app: theme/parcels.ts) */
  --p-amber: #ffb930;
  --p-amber-lip: #d98a00;
  --p-coral: #f4646a;
  --p-coral-lip: #c23840;
  --p-teal: #22c2b0;
  --p-teal-lip: #0e8c7e;
  --p-blue: #4c8df6;
  --p-blue-lip: #2c62c4;
  --p-violet: #9b6cf2;
  --p-violet-lip: #6c41bf;
  --p-lime: #9bd23c;
  --p-lime-lip: #6c9e17;

  /* Sorting belt and night shift */
  --belt: #3a4366;
  --belt-slot: #4b5579;
  --belt-roller: #646e96;
  --night: #1b2440;
  --night-deep: #131a31;

  /* Gold parcels (bonus levels) */
  --gold: #ffd84a;
  --gold-hi: #fff6c2;
  --gold-lip: #b97a00;
  --gold-ink: #5a3a00;

  /* World accents (app: theme/worlds.ts) */
  --w-depo: #f08a3c;
  --w-depo-lip: #9c4c12;
  --w-liman: #0f9fb5;
  --w-liman-lip: #0a7386;
  --w-havaalani: #5b7cf0;
  --w-havaalani-lip: #3b58c4;
  --w-tren: #5c9a4b;
  --w-tren-lip: #3f7431;
  --w-uzay: #b58cff;
  --w-uzay-lip: #7e54d1;

  /* Type */
  --font-display: "Baloo 2", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  --text-sm: 0.9375rem;
  --text-base: clamp(1.0313rem, 0.99rem + 0.2vw, 1.125rem);
  --text-lead: clamp(1.125rem, 1.05rem + 0.45vw, 1.375rem);
  --text-h3: clamp(1.3125rem, 1.2rem + 0.5vw, 1.625rem);
  --text-h2: clamp(2rem, 1.45rem + 2.4vw, 3.5rem);
  --text-hero: clamp(3.25rem, 2rem + 5.4vw, 6.25rem);
  --text-giant: clamp(5.5rem, 3rem + 11vw, 13rem);

  /* Space: 4-pt base with a deliberate jump for sections */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-section: clamp(4rem, 2.6rem + 6vw, 8.5rem);
  --gutter: clamp(1rem, 0.5rem + 2.4vw, 2.5rem);
  --page-max: 76rem;

  /* Shape */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --r-pill: 999px;
  --lip: 5px;
  --lip-lg: 7px;
  --shadow-soft: 0 3px 8px rgba(27, 36, 64, 0.14);
  --shadow-lifted: 0 8px 18px rgba(27, 36, 64, 0.18);
  --shadow-deep: 0 18px 40px rgba(27, 36, 64, 0.28);

  /* Motion (app: motion.duration) */
  --dur-press: 70ms;
  --dur-fast: 140ms;
  --dur-base: 220ms;
  --dur-slow: 320ms;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-pop: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Base ───────────────────────────────────────────────────────────────────────────── */

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: var(--space-5);
}

body {
  margin: 0;
  min-width: 0;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--ink);
  /* Paper grain over warm cream: the paintings are gouache, the page should not be flat plastic. */
  background-color: var(--cream);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.42 0 0 0 0 0.3 0 0 0 0 0.12 0 0 0 0.07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

img {
  height: auto;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 800;
  line-height: 1.05;
  margin: 0;
  text-wrap: balance;
}

h3 {
  font-weight: 700;
  font-size: var(--text-h3);
  line-height: 1.15;
}

p {
  margin: 0;
  text-wrap: pretty;
}

a {
  color: var(--focus);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--ink);
}

strong,
b {
  font-weight: 800;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 6px;
}

.on-dark :focus-visible {
  outline-color: var(--amber-hi);
}

.on-dark a:not(.btn, .ph) {
  color: var(--amber-hi);
}

.on-dark a:not(.btn, .ph):hover {
  color: var(--cream-hi);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--space-4);
  top: var(--space-3);
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  font-weight: 800;
  color: var(--ink);
  background: var(--amber);
  border-radius: var(--r-md);
  box-shadow: 0 var(--lip) 0 var(--amber-lip);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

.wrap {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.icon {
  width: 1.25em;
  height: 1.25em;
  flex: none;
  fill: currentColor;
}

/* ── Placeholders the owner must fill (kept visible on purpose) ─────────────────────── */

.ph {
  display: inline;
  padding: 0.05em 0.4em;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.92em;
  color: var(--ph-ink);
  background: #ffe3e4;
  border: 2px dashed var(--coral);
  border-radius: 6px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
  overflow-wrap: anywhere;
}

a.ph {
  text-decoration: none;
}

/* ── Painted blocks and buttons ─────────────────────────────────────────────────────── */

.btn {
  --face: var(--amber);
  --face-hi: var(--amber-hi);
  --lip-color: var(--amber-lip);
  --btn-ink: var(--ink);
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 3.5rem;
  padding: 0.7rem 1.15rem 0.75rem 1rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.1875rem;
  line-height: 1.1;
  color: var(--btn-ink);
  text-decoration: none;
  background: linear-gradient(180deg, var(--face-hi) 0%, var(--face) 38%);
  border: 0;
  border-radius: var(--r-lg);
  box-shadow: 0 var(--lip) 0 var(--lip-color), var(--shadow-soft);
  transition: transform var(--dur-fast) var(--ease-out);
}

.btn:hover {
  color: var(--btn-ink);
  transform: translateY(-2px);
}

.btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--lip-color);
  transition-duration: var(--dur-press);
}

.btn .icon {
  width: 1.6rem;
  height: 1.6rem;
}

.btn__text {
  display: grid;
  text-align: left;
}

.btn__small {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.8;
}

.btn--teal {
  --face: var(--teal);
  --face-hi: var(--teal-hi);
  --lip-color: var(--teal-lip);
}

.btn--cream {
  --face: var(--cream-hi);
  --face-hi: var(--white);
  --lip-color: var(--cream-lip);
}

/* A store that is not open yet: a crate with a dashed outline, not a link. */
.btn--soon {
  --face: transparent;
  --face-hi: transparent;
  --btn-ink: var(--ink-soft);
  background: transparent;
  border: 2px dashed var(--ink-muted);
  box-shadow: none;
  cursor: default;
}

.btn--soon:hover,
.btn--soon:active {
  transform: none;
  box-shadow: none;
}

.on-dark .btn--soon {
  --btn-ink: var(--on-dark-soft);
  border-color: var(--on-dark-soft);
}

.soon-tag {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--star);
  border-radius: var(--r-pill);
  box-shadow: 0 3px 0 var(--star-lip);
}

.store-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4) var(--space-4);
  align-items: center;
}

/* Little parcel: colored face + lip, white disc with an arrow, the color's glyph in the corner. */
.parcel {
  --face: var(--p-amber);
  --lip-color: var(--p-amber-lip);
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: var(--size, 2.75rem);
  height: var(--size, 2.75rem);
  border-radius: 24%;
  background: var(--face);
  box-shadow: 0 calc(var(--size, 2.75rem) * 0.1) 0 var(--lip-color);
  vertical-align: middle;
}

.parcel__arrow {
  width: 62%;
  height: 62%;
}

.parcel__glyph {
  position: absolute;
  top: 7%;
  left: 7%;
  width: 26%;
  height: 26%;
  fill: var(--ink);
}

.parcel--coral {
  --face: var(--p-coral);
  --lip-color: var(--p-coral-lip);
}
.parcel--teal {
  --face: var(--p-teal);
  --lip-color: var(--p-teal-lip);
}
.parcel--blue {
  --face: var(--p-blue);
  --lip-color: var(--p-blue-lip);
}
.parcel--violet {
  --face: var(--p-violet);
  --lip-color: var(--p-violet-lip);
}
.parcel--lime {
  --face: var(--p-lime);
  --lip-color: var(--p-lime-lip);
}
.parcel--right .parcel__arrow {
  transform: rotate(90deg);
}
.parcel--down .parcel__arrow {
  transform: rotate(180deg);
}
.parcel--left .parcel__arrow {
  transform: rotate(-90deg);
}

/* Shipping tag: the small label used for eyebrows and metadata. */
.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0.3rem 0.8rem 0.3rem 0.65rem;
  font-weight: 800;
  font-size: 0.8125rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--cream-hi);
  border: 2px solid var(--ink);
  border-radius: var(--r-sm);
  box-shadow: 3px 3px 0 var(--ink);
}

.tag::before {
  content: "";
  width: 0.55rem;
  height: 0.55rem;
  border: 2px solid var(--ink);
  border-radius: 50%;
}

/* ── Header ─────────────────────────────────────────────────────────────────────────── */

.site-header {
  position: relative;
  z-index: 10;
  padding-block: var(--space-4);
}

.site-header__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-5);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  margin-right: auto;
  color: var(--ink);
  text-decoration: none;
}

.brand img {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 12px;
  box-shadow: 0 4px 0 var(--amber-lip);
  transform: rotate(-4deg);
  transition: transform var(--dur-base) var(--ease-pop);
}

.brand:hover img {
  transform: rotate(4deg) scale(1.05);
}

.brand__name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.625rem;
  line-height: 1;
  padding-top: 0.15em;
}

.site-nav {
  order: 3;
  width: 100%;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1);
  margin-inline: -0.7rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.35rem 0.7rem;
  font-weight: 800;
  font-size: var(--text-sm);
  color: var(--ink);
  text-decoration: none;
  border-radius: var(--r-md);
  transition: transform var(--dur-fast) var(--ease-out);
}

.site-nav a:hover {
  background: var(--cream-deep);
  transform: translateY(-1px);
}

.site-nav a[aria-current="page"] {
  background: var(--cream-hi);
  box-shadow: 0 4px 0 var(--cream-lip);
}

.lang-switch {
  display: inline-flex;
  padding: 4px;
  background: var(--cream-deep);
  border-radius: var(--r-md);
  box-shadow: inset 0 2px 0 var(--cream-lip);
}

.lang-switch a,
.lang-switch span {
  display: inline-grid;
  place-items: center;
  min-width: 2.9rem;
  min-height: 2.5rem;
  padding: 0 0.6rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1rem;
  color: var(--ink-soft);
  text-decoration: none;
  border-radius: 10px;
}

.lang-switch a:hover {
  color: var(--ink);
}

.lang-switch [aria-current="true"] {
  color: var(--ink);
  background: var(--amber);
  box-shadow: 0 3px 0 var(--amber-lip);
}

@media (min-width: 52rem) {
  .site-nav {
    order: 0;
    width: auto;
  }
  .site-nav ul {
    gap: var(--space-2);
    margin-inline: 0;
  }
  .site-nav a {
    padding-inline: 0.9rem;
  }
}

/* ── Conveyor belt (the game's sorting belt) ────────────────────────────────────────── */

.belt-strip {
  position: relative;
  height: 2.75rem;
  background-color: var(--belt);
  background-image:
    radial-gradient(circle at 50% 50%, #8a93bb 0 4px, var(--belt-roller) 5px 9px, transparent 10px),
    linear-gradient(180deg, #4a5378 0 5px, transparent 5px);
  background-size: 2.25rem 100%, 100% 100%;
  background-position: 0 6px, 0 0;
  background-repeat: repeat-x, no-repeat;
}

/* ── Footer ─────────────────────────────────────────────────────────────────────────── */

.site-footer {
  color: var(--on-dark);
  background: var(--night-deep);
}

.site-footer a {
  color: var(--on-dark);
}

.site-footer a:hover {
  color: var(--amber-hi);
}

.site-footer__inner {
  display: grid;
  gap: var(--space-6);
  padding-block: var(--space-7);
}

.site-footer__brand {
  display: grid;
  gap: var(--space-3);
  max-width: 26rem;
}

.site-footer__brand .brand {
  color: var(--on-dark);
}

.site-footer__brand p {
  color: var(--on-dark-soft);
  font-size: var(--text-sm);
}

.site-footer h2 {
  margin-bottom: var(--space-3);
  font-size: 0.8125rem;
  font-family: var(--font-body);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber-hi);
}

.site-footer ul {
  display: grid;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-lang-title {
  margin-top: var(--space-5);
}

.site-footer__legal {
  padding-block: var(--space-4) var(--space-5);
  font-size: 0.8125rem;
  color: var(--on-dark-soft);
  border-top: 1px solid rgba(255, 244, 226, 0.14);
}

@media (min-width: 48rem) {
  .site-footer__inner {
    grid-template-columns: 1.4fr 1fr 1fr;
  }
}

/* ── Motion preferences ─────────────────────────────────────────────────────────────── */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0ms !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}
