/* ---------- Fonts ---------- */

@font-face {
  font-family: "Bluu Next";
  src: url("fonts/BluuNext-Titling.otf") format("opentype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Bluu Next";
  src: url("fonts/BluuNext-Bolditalic.otf") format("opentype");
  font-weight: 700;
  font-style: italic;
  font-display: swap;
}

/* ---------- Reset ---------- */

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

html, body {
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
}

:root {
  --gutter: clamp(16px, 4vw, 64px);
}

#pixel-trail {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 40;
  mix-blend-mode: difference;
}

body {
  font-family: "Lato", sans-serif;
  background-color: #871D12;
  color: #f0d8ce;
  height: 100vh;
  position: relative;
}

body::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("images/texture.webp");
  background-size: cover;
  background-position: center;
  mix-blend-mode: multiply;
  opacity: 1;
  pointer-events: none;
}

/* ---------- Grid ---------- */

.page {
  position: relative;
  max-width: 1440px;
  height: 100%;
  margin: 0 auto;
  padding: 0 clamp(1rem, 3vw, 2.5rem);
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--gutter);
  grid-template-rows: auto 1fr auto;
}

/* ---------- Top bar / brand ---------- */

.topbar {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  justify-content: center;
  padding: clamp(1rem, 4vh, 2.2rem) 0 clamp(0.5rem, 2vh, 1rem);
}

.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.brand-logo {
  height: clamp(28px, 5.5vh, 40px);
  width: auto;
  display: block;
}

/* ---------- Hero ---------- */

.hero-row {
  position: relative;
  z-index: 0;
  grid-column: 1 / -1;
  grid-row: 2;
  align-self: center;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  column-gap: var(--gutter);
}

.hero-title {
  grid-column: 2 / 7;
  align-self: start;
  text-align: right;
  font-family: "Bluu Next", serif;
  font-weight: 700;
  font-style: normal;
  color: #F3ADA5;
  font-size: clamp(3.3rem, 7.425vw, 7.15rem);
  line-height: 0.95;
}

.hero-title .italic {
  font-style: italic;
}

.hero-content {
  grid-column: 7 / 12;
  align-self: end;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.hero-content p {
  font-size: clamp(0.95rem, 1.15vw, 1.15rem);
  line-height: 1.55;
  color: #F3ADA5;
}

.sacha-hover {
  position: relative;
}

.sacha-preview {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  width: 360px;
  height: 360px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: -1;
}

@media (any-hover: hover) {
  .sacha-hover:hover .sacha-preview {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

#sacha-canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ---------- Buttons ---------- */

.cta-row {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  margin-top: 0.6rem;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  font-family: "Lato", sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  text-decoration: none;
  white-space: nowrap;
}

.btn-filled {
  background-color: #C8DE21;
  color: #1C1F05;
}

/* ---------- Footer ---------- */

.site-footer {
  grid-column: 1 / -1;
  grid-row: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  text-align: center;
  gap: 0.35rem;
  padding: clamp(0.6rem, 3vh, 1.2rem) 0;
  font-size: 0.78rem;
  color: #B18185;
}

.legal-link {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: #B18185;
  text-decoration: underline;
  cursor: pointer;
  transition: color 0.15s ease;
}

.legal-link:hover {
  color: #fff;
  text-decoration: none;
}

/* ---------- Legal panel ---------- */

.legal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
  z-index: 50;
}

.legal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.legal-panel {
  --legal-pad-x: clamp(1.5rem, 4vw, 2.5rem);
  --legal-pad-y: clamp(2rem, 6vh, 3rem);
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  bottom: 1.5rem;
  height: auto;
  width: min(480px, calc(100% - 3rem));
  background-color: #fdf9f7;
  color: #3a1210;
  border-radius: 20px;
  transform: translateX(calc(100% + 1.5rem));
  transition: transform 0.35s ease;
  z-index: 60;
  overflow-y: auto;
  padding: var(--legal-pad-y) var(--legal-pad-x);
}

.legal-panel.open {
  transform: translateX(0);
  box-shadow: -8px 0 24px rgba(0, 0, 0, 0.35);
}

.legal-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  background: none;
  border: none;
  border-radius: 50%;
  color: #3a1210;
  cursor: pointer;
  padding: 0;
  transition: background-color 0.15s ease;
}

.legal-close:hover {
  background-color: #ECDFE0;
}

.legal-close:active {
  background-color: #D8C0C2;
}

.legal-close-mobile {
  display: none;
}

.legal-panel-content h2 {
  font-family: "Bluu Next", serif;
  font-weight: 700;
  font-size: 2rem;
  color: #5A140C;
  margin-bottom: 1.5rem;
}

.legal-panel-content h3 {
  font-size: 1.05rem;
  color: #5A140C;
  margin: 1.75rem 0 0.6rem;
}

.legal-panel-content p {
  font-size: 0.9rem;
  line-height: 1.6;
  margin-bottom: 0.75rem;
  color: #3a1210;
}

.legal-panel-content ul {
  margin: 0 0 0.75rem 1.2rem;
  padding: 0;
}

.legal-panel-content li {
  font-size: 0.9rem;
  line-height: 1.6;
  color: #3a1210;
  margin-bottom: 0.3rem;
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .hero-row {
    grid-template-columns: 1fr;
    row-gap: clamp(1rem, 3vh, 1.75rem);
  }

  .hero-title,
  .hero-content {
    grid-column: 1 / -1;
  }

  .hero-title {
    font-size: clamp(2.4rem, 8vw, 4.2rem);
    text-align: left;
  }

  .legal-close {
    display: none;
  }

  .legal-panel {
    display: flex;
    flex-direction: column;
    overflow-y: hidden;
  }

  .legal-panel-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
  }

  .legal-close-mobile {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    margin-top: 1.5rem;
    padding: 1.1rem 1rem;
    background-color: #16110f;
    color: #fff;
    border: none;
    border-radius: 999px;
    font-family: "Lato", sans-serif;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
    cursor: pointer;
  }

  .legal-close-mobile:hover,
  .legal-close-mobile:active {
    background-color: #000;
  }
}

@media (max-width: 560px) {
  .page {
    padding: 0 clamp(1rem, 5vw, 1.5rem);
  }

  .hero-title {
    font-size: clamp(2rem, 9vw, 2.8rem);
    line-height: 1;
  }

  .hero-content {
    gap: 0.7rem;
  }

  .hero-content p {
    font-size: 1.0625rem;
    line-height: 1.5;
  }

  .cta-row {
    gap: 0.6rem;
  }

  .btn {
    padding: 1rem 1.8rem;
    font-size: 1rem;
  }

  .site-footer {
    font-size: 0.85rem;
  }
}
