/* ==========================================================================
   OPAL ATELIER — shared design system
   ========================================================================== */

:root{
  --purple-fill: #ddc9e6;
  --purple-fill-soft: #e8dced;
  --purple-line: #b18fe0;
  --navy: #16213a;
  --navy-deep: #0d1526;
  --cream: #efe6e2;
  --tan: #cbb191;
  --ink: #111111;
  --white: #ffffff;
  --pink: #ef4d8a;
  --blue-pill: #4fa8e6;
  --red-hype: #e3382c;
  --yellow: #f5d949;
  --dot: rgba(120, 90, 160, .35);
  --radius-window: 6px;
  --font-display: "Helvetica Neue", Helvetica, Arial, sans-serif;
}

*{ box-sizing:border-box; }
html,body{ margin:0; padding:0; }
body{
  font-family: var(--font-display);
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}
a{ color:inherit; text-decoration:none; }
button{ font-family:inherit; cursor:pointer; }
img{ display:block; max-width:100%; }

/* dot grid used on webstore + popups */
.dot-grid{
  background-image: radial-gradient(var(--dot) 1.4px, transparent 1.4px);
  background-size: 26px 26px;
}

/* organic blob shapes (webstore backdrop) */
.blob{
  position:absolute;
  background: var(--purple-fill);
  border-radius: 42% 58% 63% 37% / 41% 44% 56% 59%;
  opacity:.85;
  filter: blur(1px);
  z-index:0;
}
.blob-outline{
  position:absolute;
  border: 2px solid var(--purple-line);
  border-radius: 40% 60% 55% 45% / 50% 40% 60% 50%;
  background: transparent;
  z-index:0;
}

.wordmark{
  margin:0;
  line-height:0;
}
.wordmark img{
  height: clamp(18px, 2.4vw, 28px);
  width:auto;
  display:block;
}

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

/* ---------- full-screen popup overlay (INFO / T&C / PRIVACY / CONTACT) ---------- */
.overlay{
  position:fixed; inset:0; z-index:500;
  background: rgba(17,17,17,.55);
  display:flex; align-items:center; justify-content:center;
  opacity:0; pointer-events:none;
  transition: opacity .25s ease;
  padding: 24px;
}
.overlay.open{ opacity:1; pointer-events:auto; }
.overlay-panel{
  position:relative;
  width:min(640px, 92vw);
  max-height:86vh;
  overflow-y:auto;
  background: var(--white);
  border-radius: var(--radius-window);
  box-shadow: 0 30px 70px rgba(0,0,0,.4);
  padding: 40px 36px 36px;
  transform: translateY(14px) scale(.98);
  transition: transform .25s ease;
}
.overlay.open .overlay-panel{ transform:none; }
.overlay-close{
  position:absolute; top:14px; right:16px;
  width:30px; height:30px; border-radius:50%;
  border:1.5px solid var(--ink); background:var(--white);
  font-size:16px; line-height:1;
  display:flex; align-items:center; justify-content:center;
}
.overlay h2{ margin:0 0 4px; font-size:22px; }
.overlay .overlay-sub{ color:#777; font-size:12px; text-transform:uppercase; letter-spacing:.08em; margin-bottom:18px;}
.overlay p{ font-size:14px; line-height:1.65; color:#333; }
.overlay .pp-date{ font-size:12px; color:#777; margin:0 0 14px; }
.overlay h3.pp{ font-size:13px; text-transform:uppercase; letter-spacing:.06em; margin:28px 0 8px; }
.overlay ul.pp{ margin:0 0 14px; padding-left:20px; font-size:14px; line-height:1.65; color:#333; }
.overlay ul.pp li{ margin-bottom:4px; }
.overlay-signature{ font-family: 'Segoe Script','Brush Script MT',cursive; font-size:30px; margin-top:18px; }

/* ---------- lightbox (viewer icons just zoom) ---------- */
.lightbox{
  position:fixed; inset:0; z-index:520;
  background: rgba(10,10,10,.75);
  display:flex; align-items:center; justify-content:center;
  opacity:0; pointer-events:none;
  transition: opacity .2s ease;
}
.lightbox.open{ opacity:1; pointer-events:auto; }
.lightbox img, .lightbox .lightbox-emoji{
  max-width:60vw; max-height:60vh;
  filter: drop-shadow(0 20px 40px rgba(0,0,0,.5));
}
.lightbox .lightbox-emoji{ font-size: 180px; }

/* ---------- toast (small instruction bubble for click-around game) ---------- */
.toast{
  position:fixed; left:50%; bottom:38px; transform:translateX(-50%) translateY(20px);
  background: var(--ink); color:var(--white);
  padding:12px 20px; border-radius:30px;
  font-size:13px; letter-spacing:.02em;
  z-index:600; opacity:0; pointer-events:none;
  transition: all .3s ease;
  max-width: 86vw; text-align:center;
}
.toast.show{ opacity:1; transform:translateX(-50%) translateY(0); }

/* ---------- glitch / error transition ---------- */
.glitch-flash{
  position:fixed; inset:0; z-index:900; background:#fff;
  opacity:0; pointer-events:none;
}
.glitch-flash.on{
  opacity:1;
  animation: glitchflash .5s steps(2,end) 3;
}
@keyframes glitchflash{
  0%{ background:#fff; }
  25%{ background:#111; }
  50%{ background:#e3382c; }
  75%{ background:#111; }
  100%{ background:#fff; }
}
.glitch-video{
  position:fixed; inset:0; z-index:900;
  width:100%; height:100%;
  object-fit:cover;
  background:#111;
  opacity:0; pointer-events:none;
  transition: opacity .08s ease;
}
.glitch-video.on{ opacity:1; }
/* Phone held upright: crop the video to fill the whole screen (cover, set above). The video file has
   its own black bands top and bottom (about 12% each), so it is scaled up slightly to push those off-screen.
   Phone turned sideways: shrink the whole video to fit the screen (letterboxed) instead of cropping it. */
@media (max-width: 880px) and (orientation: portrait){
  .glitch-video{ transform:scale(1.34); }
}
@media (max-height: 500px) and (orientation: landscape){
  .glitch-video{ object-fit:contain; object-position:center; }
}


/* ==========================================================================
   Webstore animated background
   .bg-canvas always fills the screen exactly like "background-size: cover"
   (3024x1702 artwork, centered), so the blobs stay locked to their spots on
   the dot-grid / outline artwork at every screen size.
   ========================================================================== */
.bg-stage{ position:fixed; inset:0; overflow:hidden; z-index:0; pointer-events:none; }
.bg-canvas{
  position:absolute; left:50%; top:50%;
  width:  max(100vw, calc(100vh * 3024 / 1702));
  height: max(100vh, calc(100vw * 1702 / 3024));
  transform: translate(-50%, -50%);
}
.bg-base{ position:absolute; inset:0; width:100%; height:100%; display:block; }
.bg-blob{ position:absolute; display:block; }
.bg-blob img{ width:100%; height:auto; display:block; }


/* ==========================================================================
   Webstore: cart panel (design preview)
   ========================================================================== */
.overlay-cart .overlay-panel{ width:min(460px, 92vw); }
.cart-empty{ font-size:13px; color:#777; margin:18px 0; }
.cart-row{
  display:grid; grid-template-columns:56px 1fr auto; gap:12px; align-items:start;
  padding:14px 0; border-bottom:1px solid #e6e6e6;
}
.cart-row img{ width:56px; height:84px; object-fit:contain; object-position:center bottom; }
.cart-name{ font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.02em; line-height:1.35; }
.cart-meta{ font-size:12px; color:#666; margin-top:2px; }
.cart-qty{ display:flex; align-items:center; gap:8px; margin-top:8px; font-size:13px; }
.cart-qty button{
  width:26px; height:26px; border-radius:50%; border:1.5px solid var(--ink);
  background:#fff; font-size:15px; line-height:1; padding:0;
}
.cart-qty .cart-rm{
  width:auto; height:auto; border:none; border-radius:0; background:none;
  font-size:11px; color:#777; text-decoration:underline; margin-left:6px;
}
.cart-price{ font-size:12px; font-weight:700; white-space:nowrap; }
.cart-total{ display:flex; justify-content:space-between; font-size:14px; font-weight:700; margin:18px 0 6px; }
.cart-note{ font-size:12px !important; color:#777 !important; line-height:1.55 !important; margin:0 0 16px; }
.cart-checkout{
  width:100%; background:var(--ink); color:#fff; border:none; border-radius:24px;
  padding:14px; font-size:13px; letter-spacing:.08em; font-weight:700;
}
.cart-checkout:disabled{ opacity:.35; cursor:default; }
.cart-preview{ font-size:12px !important; color:#555 !important; text-align:center; margin:12px 0 0; }

/* ==========================================================================
   Webstore: phone layout
   ========================================================================== */
@media (max-width: 880px){
  /* sticky, compact header: back  ·  wordmark  ·  cart */
  .shop-wrap .shop-header, .pd-wrap .shop-header{
    position:sticky; top:0; z-index:60;
    grid-template-columns:44px 1fr auto;
    gap:10px; padding:10px 14px;
    background:rgba(255,255,255,.82);
    -webkit-backdrop-filter:blur(8px); backdrop-filter:blur(8px);
  }
  .shop-header .back-btn{ width:40px; height:40px; }
  .shop-header .wordmark img{ height:22px; width:auto; max-width:100%; }
  .shop-header .cart-pill{
    padding:10px 18px; font-size:11px; letter-spacing:.08em; white-space:nowrap;
  }

  /* cart panel becomes a bottom sheet */
  .overlay-cart{ align-items:flex-end; padding:0; }
  .overlay-cart .overlay-panel{
    width:100%; max-height:82vh; max-height:82dvh;
    border-radius:18px 18px 0 0; padding:28px 20px 24px;
    transform:translateY(30px);
  }
  .overlay-cart.open .overlay-panel{ transform:none; }
}


/* ==========================================================================
   Webstore background on portrait phones: the desktop artwork turned 90 degrees
   (clockwise) so the landscape drawing fills a tall screen. Blobs are children
   of .bg-canvas, so they turn with it and stay locked to their spots.
   ========================================================================== */
@media (max-width: 880px) and (orientation: portrait){
  .bg-canvas{
    width:  max(100vh, calc(100vw * 3024 / 1702));
    height: max(calc(100vh * 1702 / 3024), 100vw);
    transform: translate(-50%, -50%) rotate(90deg);
  }
}
