/*
 * Earthlight AR -- HUD-only exhibit styles.
 *
 * Carried over from ar-7.html. Removed: the MindAR loading/scanning captions and
 * the body.is-locked rule that hid MindAR's overlay, because a HUD-only page never
 * starts MindAR. Added: the HUD background, the Top/Panel segmented toggle and the
 * model loading notice.
 */

@font-face {
  font-family: 'IMFellEnglishSC';
  src: url('../fonts/IMFellEnglishSC-Regular.ttf') format('truetype');
}
@font-face {
  font-family: 'IMFellEnglish';
  src: url('../fonts/IMFellEnglish-Regular.ttf') format('truetype');
}

:root {
  /* Painted behind the transparent WebGL canvas. With no camera feed behind the
     HUD, this is the whole backdrop; brand browns from the controls and overlay. */
  --hud-bg: radial-gradient(circle at 50% 42%, #4a3422 0%, #2a1d12 45%, #120c07 100%);
  --brand-brown: #73491d;
  --brand-sand: #DCCCB4;
}

html, body { height: 100%; }

body {
  margin: 0;
  overflow: hidden;
  background: #120c07 var(--hud-bg) no-repeat fixed;
  font-family: 'IMFellEnglishSC', serif;
}

canvas.a-canvas { touch-action: none; }
.a-enter-vr, .a-enter-ar { display: none !important; }

/* ---- Info / commerce overlay ---------------------------------------------- */

.overlay {
  display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.8); z-index: 10000; color: #111;
  align-items: center; justify-content: center;
}
.overlay.is-open { display: flex; }

.overlay__content-wrapper {
  width: 95vw; height: 90dvh; max-width: 800px;
  background-color: rgba(242, 236, 230, 0.95);
  border: none; display: flex; flex-direction: column;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5); border-radius: 8px;
}

.overlay__header {
  display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 20px;
  background: rgba(20, 20, 20, 0.05); border-bottom: 1px solid rgba(0,0,0,0.1);
}
.overlay__title {
  margin: 0; font-family: "nelson rugged", nelson, serif; font-size: 1.5rem; color: #333; border: none; line-height: 1 !important; text-align: left;
}
.overlay__close {
  padding: 8px 16px; cursor: pointer; background: #333; color: white;
  border: none; border-radius: 4px; font-family: 'IMFellEnglishSC', serif; font-size: 1.1rem;
}
.overlay__body {
  padding: 20px; overflow-y: auto; flex-grow: 1; display: flex; flex-direction: column; align-items: center;
}
#overlayBody img:not(.bc-product-image):not(.btn-icons img) {
  width: 90%;
  max-width: 500px;
  margin: 0 auto;
  display: block;
}
#overlayBody p.teaser {
  width: 100%;
  padding: 1rem;
  font-size: 1.2rem;
  font-family: IMFellEnglish, Arial;
}
#overlayBody h3 {
  line-height: 1;
  font-weight: normal;
}

button:focus-visible, select:focus-visible, .overlay__close:focus-visible {
  outline: 2px solid #ae4517; outline-offset: 2px;
}

.bc-ui-group { width: 100%; max-width: 400px; margin-bottom: 15px; }
.bc-ui-group label { display: block; font-size: 1.1rem; margin-bottom: 5px; color: #555; text-align: left;}
.bc-ui-select {
  width: 100%; padding: 12px; font-size: 1.1rem; font-family: inherit;
  border: 1px solid #ccc; border-radius: 4px; background: #fff;
}
.bc-divider { width: 100%; height: 1px; background: #ddd; margin: 20px 0; }

.bc-btn-primary {
  padding: 16px 32px; background: #111; color: white; border: none; font-size: 1.2rem;
  cursor: pointer; font-family: 'IMFellEnglishSC', serif; text-transform: uppercase;
  letter-spacing: 1px; transition: background 0.2s; border-radius: 4px; width: 100%; max-width: 400px; margin-top: 10px;
}
.bc-btn-primary:active { background: #555; }
.bc-btn-primary:disabled { cursor: progress; }

.bc-btn-secondary {
  padding: 12px 24px; background: transparent; color: var(--brand-brown); border: 2px solid var(--brand-brown);
  font-size: 1.1rem; cursor: pointer; font-family: inherit; text-transform: uppercase;
  transition: all 0.2s; border-radius: 4px; width: 100%; max-width: 400px; margin-top: 10px;
}
.bc-btn-secondary:active { background: var(--brand-brown); color: #fff; }

/* ---- HUD controls bar ------------------------------------------------------ */

#ar-controls {
  position: fixed; bottom: 0; left: 0; width: 100%;
  background: rgba(15, 15, 15, 0.9); border-top: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); z-index: 9999;

  display: flex; justify-content: center; align-items: center;
  gap: 12px; flex-wrap: wrap;

  padding: 10px 20px calc(10px + env(safe-area-inset-bottom));
  box-sizing: border-box; font-family: 'IMFellEnglishSC', serif;
}
.control-group { display: flex; gap: 8px; align-items: center; }
.ar-btn {
  background: var(--brand-sand); color: #000; border: 1px solid #fff; border-radius: 6px;
  padding: 10px 16px; font-size: 20px; font-weight: normal; cursor: pointer;
  min-height: 44px; transition: background 0.2s, color 0.2s; font-family: inherit;
}
.ar-btn:active { background: #555; }
.zoom-btn { width: 44px; padding: 0; display: flex; justify-content: center; align-items: center; font-size: 24px; }

/* Model (Candles | Shirts/Mugs) and view (Top | Panel) are two-segment pills
   rather than a dropdown or one button whose label flips -- the convention the
   AR Builder settled on for Lock/Unlock: each half is a plain idempotent button
   and aria-pressed carries the state. */
.seg-toggle { gap: 0; }
.seg-toggle .ar-btn { border-radius: 0; }
.seg-toggle .ar-btn:first-child { border-radius: 6px 0 0 6px; }
.seg-toggle .ar-btn:last-child { border-radius: 0 6px 6px 0; border-left: none; }
.seg-toggle .ar-btn[aria-pressed="true"] { background: var(--brand-brown); color: #fff; }

/* ---- Floating cart --------------------------------------------------------- */

/* Above the overlay (10000): the expanded "Checkout" pill only appears while the
   overlay is open, and in ar-7 it sat underneath the overlay's backdrop, where a
   tap landed on the backdrop and closed the overlay instead. */
#floating-cart-btn {
  position: fixed; top: 20px; right: 20px; background: var(--brand-brown); color: #fff;
  padding: 12px 20px; border-radius: 30px; font-family: inherit; font-size: 1.1rem;
  border: 1px solid #fff; box-shadow: 0 4px 12px rgba(0,0,0,0.4); cursor: pointer; z-index: 10001;
  display: none; align-items: center; justify-content: center; gap: 8px;
}
#floating-cart-btn.is-collapsed {
  width: 54px; height: 54px; padding: 0; border-radius: 50%;
}
/* While the overlay is open the pill moves to the bottom-right so it does not sit
   on the overlay header's Close button on a narrow phone. */
body.overlay-open #floating-cart-btn {
  top: auto; bottom: calc(16px + env(safe-area-inset-bottom));
}
.cart-icon { width: 24px; height: 24px; fill: currentColor; }
.cart-badge {
  position: absolute; top: -4px; right: -4px; background: #d32f2f; color: white;
  font-size: 0.8rem; font-family: sans-serif; font-weight: bold; width: 22px; height: 22px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; border: 1px solid #fff;
}
.your-coconut h3, .your-candle h3 {font-size: 1.5rem;}
.your-coconut ul li, .your-candle ul li {font-size: 1.2rem;}

/* ---- Model loading notice -------------------------------------------------- */

/* Stands in for MindAR's own loading spinner, which a HUD-only page never shows.
   Driven by the payload models' model-loaded / model-error events. */
#hud-loading {
  position: fixed; inset: 0; z-index: 9000;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  color: #fff; font-size: 1.2rem; letter-spacing: 2px; text-transform: uppercase;
  text-shadow: 0 2px 8px rgba(0,0,0,0.9);
}

.hidden { display: none !important; }
