/* =========================================================================
   The CraftingTable — Global Design System
   Premium, minimal, Minecraft-inspired. Shared across all pages.
   ========================================================================= */

/* ----------------------------- Tokens ---------------------------------- */
:root {
  /* ---- Liquid Glass color system (Apple VisionOS / premium gaming) ---- */
  --foreground: #ffffff;                    /* primary text   */
  --muted: rgba(255, 255, 255, 0.75);       /* secondary text */
  --border: rgba(255, 255, 255, 0.12);      /* glass border   */
  --input: rgba(255, 255, 255, 0.06);
  --primary: #ffffff;                        /* accent         */
  --primary-dark: #e6e8eb;                   /* accent hover   */
  --secondary: #e6e8eb;
  --success: #e8eaed;
  --accent: rgba(255, 255, 255, 0.12);

  /* Legacy tokens remapped to glass so older rules stay on-theme. */
  --cream: rgba(255, 255, 255, 0.06);
  --sand: rgba(255, 255, 255, 0.05);
  --earth: rgba(255, 255, 255, 0.55);
  --warm-dark: rgba(12, 16, 24, 0.55);

  --bg: transparent;
  --surface: rgba(255, 255, 255, 0.06);     /* glass surface  */

  /* Frosted glass primitives */
  --glass: rgba(255, 255, 255, 0.06);
  --glass-strong: rgba(255, 255, 255, 0.12);
  --glass-line: rgba(255, 255, 255, 0.12);
  --blur: 30px;
  --ink: #0a0a0c;                            /* near-black for text on white fills */

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;

  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.18);
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 24px 60px rgba(0, 0, 0, 0.4);
  --glow-accent: 0 0 0 1px rgba(255, 255, 255, 0.25), 0 20px 60px rgba(0, 0, 0, 0.35);

  --container: 1200px;
  --nav-h: 64px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* ------------------------------ Reset ---------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  color: var(--foreground);
  background: var(--bg);
  line-height: 1.6;
  font-size: 16px;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.bg-video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
  pointer-events: none;
}

.video-overlay {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at top, rgba(255, 255, 255, 0.08), rgba(0, 0, 0, 0.55) 60%);
  pointer-events: none;
  z-index: -1;
}

.app-shell {
  position: relative;
  z-index: 1;
}

.spa-transition .page-loader,
.spa-transition main {
  transition: opacity 0.4s ease, transform 0.4s ease;
}

.spa-fade-out {
  opacity: 0;
  transform: translateY(12px);
}

.spa-fade-in {
  opacity: 1;
  transform: translateY(0);
}

.spa-loader {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  gap: 14px;
  padding: 24px;
  color: var(--foreground);
  background: rgba(4, 8, 16, 0.5);
  backdrop-filter: blur(16px);
  z-index: 2;
}

.spa-loader__dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--primary);
  animation: spa-pulse 1s infinite ease-in-out;
}

@keyframes spa-pulse {
  0%, 100% { transform: scale(0.9); opacity: 0.7; }
  50% { transform: scale(1.3); opacity: 1; }
}

/* Lenis smooth-scroll support */
html.lenis,
html.lenis body {
  height: auto;
}
.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}
.lenis.lenis-stopped {
  overflow: hidden;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

h1,
h2,
h3,
h4 {
  line-height: 1.12;
  font-weight: 800;
  letter-spacing: -0.02em;
}

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

/* --------------------------- Layout helpers ---------------------------- */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 96px 0;
}

.section-head {
  text-align: center;
  max-width: 640px;
  margin: 0 auto 56px;
}

.eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--primary);
  background: var(--accent);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 18px;
}

.section-head h2 {
  font-size: clamp(28px, 4vw, 44px);
}

.section-head p {
  margin-top: 14px;
  color: var(--muted);
  font-size: 17px;
}

/* ------------------------------ Buttons -------------------------------- */
.btn {
  --btn-bg: rgba(255, 255, 255, 0.18);
  --btn-fg: #ffffff;
  --btn-brd: rgba(255, 255, 255, 0.45);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 26px;
  border: 1px solid var(--btn-brd);
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  -webkit-backdrop-filter: saturate(150%) blur(12px);
  backdrop-filter: saturate(150%) blur(12px);
  transition: transform 0.25s var(--spring), box-shadow 0.3s var(--ease),
    background 0.3s var(--ease), border-color 0.3s var(--ease);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22);
  will-change: transform;
}

.btn:hover {
  transform: translateY(-2px) scale(1.02);
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.7);
  box-shadow: var(--glow-accent);
}

.btn:active {
  transform: translateY(0) scale(0.99);
}

.btn--dark {
  --btn-bg: rgba(255, 255, 255, 0.05);
  --btn-brd: var(--glass-line);
}

.btn--dark:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn--ghost {
  --btn-bg: rgba(255, 255, 255, 0.06);
  --btn-fg: var(--foreground);
  --btn-brd: var(--glass-line);
  box-shadow: none;
}

.btn--ghost:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.6);
}

.btn--block {
  width: 100%;
}

.btn--lg {
  padding: 17px 32px;
  font-size: 16px;
}

.btn[disabled] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

/* ------------------------------- Navbar -------------------------------- */
/* Floating glass pill — detached from the top edge, rounded 999px. */
.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 16px 0;
  background: transparent;
  transition: padding 0.35s var(--ease);
}

.nav.scrolled {
  padding: 8px 0;
}

.nav__inner {
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 14px 0 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  -webkit-backdrop-filter: saturate(160%) blur(30px);
  backdrop-filter: saturate(160%) blur(30px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
  transition: background 0.35s var(--ease), box-shadow 0.35s var(--ease);
}

.nav.scrolled .nav__inner {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 800;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.brand img {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  object-fit: cover;
}

.brand span b {
  color: var(--primary);
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
}

.nav__links a {
  padding: 9px 15px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 15px;
  color: var(--foreground);
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.nav__links a:hover,
.nav__links a.active {
  background: var(--cream);
  color: var(--primary);
}

.nav__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cart-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  cursor: pointer;
  transition: border-color 0.2s var(--ease), transform 0.2s var(--spring),
    background 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.cart-btn:hover {
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.14);
  transform: translateY(-2px) scale(1.05);
  box-shadow: 0 0 20px rgba(255, 255, 255, 0.3);
}

.cart-btn svg {
  width: 20px;
  height: 20px;
}

.cart-badge {
  position: absolute;
  top: -7px;
  right: -7px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--primary);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: scale(0);
  transition: transform 0.3s var(--ease);
}

.cart-badge.show {
  transform: scale(1);
}

.nav__toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  width: 44px;
  height: 44px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.nav__toggle span {
  width: 20px;
  height: 2px;
  background: var(--foreground);
  border-radius: 2px;
  transition: transform 0.3s var(--ease), opacity 0.3s var(--ease);
}

/* ---------------------------- Mobile menu ------------------------------ */
.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(10, 14, 22, 0.82);
  -webkit-backdrop-filter: saturate(150%) blur(28px);
  backdrop-filter: saturate(150%) blur(28px);
  display: flex;
  flex-direction: column;
  padding: 24px;
  transform: translateX(100%);
  transition: transform 0.4s var(--ease);
  visibility: hidden;
}

.mobile-menu.open {
  transform: translateX(0);
  visibility: visible;
}

.mobile-menu__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 36px;
}

.mobile-menu__close {
  width: 44px;
  height: 44px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  font-size: 22px;
  cursor: pointer;
}

.mobile-menu nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mobile-menu nav a {
  padding: 16px 18px;
  border-radius: 14px;
  font-size: 20px;
  font-weight: 700;
  transition: background 0.2s var(--ease);
}

.mobile-menu nav a:hover {
  background: var(--cream);
  color: var(--primary);
}

.mobile-menu__cta {
  margin-top: auto;
  display: grid;
  gap: 12px;
}

/* ------------------------------ Toast ---------------------------------- */
.toast-wrap {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(14, 19, 28, 0.85);
  -webkit-backdrop-filter: saturate(150%) blur(18px);
  backdrop-filter: saturate(150%) blur(18px);
  border: 1px solid var(--glass-line);
  color: #ffffff;
  padding: 13px 20px;
  border-radius: 14px;
  box-shadow: var(--shadow-lg);
  font-weight: 600;
  font-size: 14px;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e8eaed;
}

/* ------------------------------ Footer --------------------------------- */
.footer {
  background: var(--warm-dark);
  color: var(--foreground);
  padding: 72px 0 32px;
  margin-top: 80px;
}

.footer__grid {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
  gap: 40px;
}

.footer__brand {
  max-width: 320px;
}

.footer__brand .brand {
  color: var(--foreground);
  margin-bottom: 16px;
}

.footer__brand p {
  color: var(--earth);
  font-size: 15px;
}

.footer h4 {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 18px;
  color: var(--primary);
}

.footer ul {
  list-style: none;
  display: grid;
  gap: 12px;
}

.footer ul a {
  color: var(--earth);
  font-size: 15px;
  transition: color 0.2s var(--ease);
}

.footer ul a:hover {
  color: var(--foreground);
}

.footer__bottom {
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--earth);
  font-size: 14px;
}

.footer__social {
  display: flex;
  gap: 10px;
}

.footer__social a {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease);
}

.footer__social a:hover {
  background: var(--primary);
  border-color: var(--primary);
}

.footer__social svg {
  width: 18px;
  height: 18px;
}

/* --------------------------- Product card ------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease),
    border-color 0.35s var(--ease);
  position: relative;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-lg);
  border-color: var(--accent);
}

.card__media {
  position: relative;
  aspect-ratio: 1 / 1;
  background: radial-gradient(circle at 50% 35%, var(--cream), var(--sand));
  overflow: hidden;
}

.card__media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 18%;
  transition: transform 0.5s var(--ease);
}

.card:hover .card__media img {
  transform: scale(1.08) translateY(-4px);
}

.card__badge {
  position: absolute;
  top: 14px;
  left: 14px;
  background: var(--primary);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 5px 11px;
  border-radius: 999px;
  z-index: 2;
}

.card__quick {
  position: absolute;
  inset: auto 14px 14px;
  transform: translateY(14px);
  opacity: 0;
  transition: transform 0.35s var(--ease), opacity 0.35s var(--ease);
}

.card:hover .card__quick {
  transform: translateY(0);
  opacity: 1;
}

.card__body {
  padding: 18px 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.card__cat {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.card__name {
  font-size: 18px;
  font-weight: 800;
}

.card__short {
  font-size: 14px;
  color: var(--muted);
  flex: 1;
}

.card__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.card__price {
  font-size: 20px;
  font-weight: 800;
  color: var(--primary);
}

.card__rating {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* ----------------------------- Reveal ---------------------------------- */
[data-reveal] {
  opacity: 0;
  transform: translateY(28px);
}

/* ------------------------------ Forms ---------------------------------- */
.field {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.field label {
  font-size: 14px;
  font-weight: 600;
}

.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 14px 16px;
  border: 1.5px solid var(--border);
  background: var(--input);
  color: var(--foreground);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-radius: var(--radius);
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease),
    background 0.2s var(--ease);
}

.field input::placeholder,
.field textarea::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

/* Native dropdown lists render with OS chrome — force a dark, readable menu. */
.field select option,
select option {
  background: #0e131c;
  color: #ffffff;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.2);
}

.field textarea {
  resize: vertical;
  min-height: 110px;
}

.field .err {
  color: #c0392b;
  font-size: 13px;
  display: none;
}

.field.invalid input,
.field.invalid textarea {
  border-color: #c0392b;
}

.field.invalid .err {
  display: block;
}

/* --------------------------- Page header ------------------------------- */
.page-hero {
  padding: 72px 0 40px;
  text-align: center;
}

.page-hero h1 {
  font-size: clamp(34px, 5vw, 56px);
}

.page-hero p {
  margin-top: 14px;
  color: var(--muted);
  font-size: 18px;
}

.breadcrumb {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 8px;
}

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

/* ---------------------------- Utilities -------------------------------- */
.grid {
  display: grid;
  gap: 26px;
}

.grid--4 {
  grid-template-columns: repeat(4, 1fr);
}

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

.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--muted);
}

.empty-state svg {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  opacity: 0.4;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--accent);
  border-top-color: var(--primary);
  border-radius: 50%;
  margin: 60px auto;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* --------------------------- Responsive -------------------------------- */
@media (max-width: 1024px) {
  .grid--4 {
    grid-template-columns: repeat(3, 1fr);
  }
  .footer__grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 860px) {
  .nav__links {
    display: none;
  }
  .nav__actions .btn {
    display: none;
  }
  .nav__toggle {
    display: flex;
  }
  .section {
    padding: 72px 0;
  }
  .grid--4,
  .grid--3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 540px) {
  .container {
    padding: 0 18px;
  }
  .grid--4,
  .grid--3 {
    grid-template-columns: 1fr;
  }
  .footer__grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .section {
    padding: 56px 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
