/* Gift shelf (home) + open-the-box view + 3D quick-action tiles.
   Ported from docs/design/gift-shelf-prototype.html. 3D extras only apply under
   html.ui-3d; html.ui-flat keeps the current flat look. */

:root {
  --box-base: #3E4A58;
  --box-inside: #566273;
  --extrude: #94A3B8;               /* tiles extrude toward slate in light mode */
  --tile-drop: rgba(15, 23, 42, 0.18);
  --shelf-spot: rgba(37, 99, 235, 0.13);
  --shelf-floor: rgba(15, 23, 42, 0.38);
  --gs-chip-bg: #2563EB;            /* white text on this = 5.2:1 */
  --gs-chip-glow: rgba(37, 99, 235, 0.35);
  --gs-hint: var(--text-muted);
  --go-paper: #FFFFFF;
  --go-paper-ink: #0F172A;
  --go-paper-ink-2: #475569;
  --go-paper-edge: #CBD5E1;
  --go-card-drop: rgba(15, 23, 42, 0.18);
  --go-round-bg: var(--bg-tile);
  --go-round-edge: var(--bg-tile-border);
}
:root.theme-dark {
  --box-base: #2B323C;
  --box-inside: #4A5463;
  --extrude: #1F2126;
  --tile-drop: rgba(0, 0, 0, 0.45);
  --shelf-spot: rgba(147, 197, 253, 0.24);
  --shelf-floor: rgba(0, 0, 0, 0.55);
  --gs-chip-bg: #2563EB;
  --gs-chip-glow: rgba(37, 99, 235, 0.5);
  --gs-hint: var(--text-primary);   /* muted gray fails 4.5:1 on the #4A4D54 page */
  --go-paper: #F1F5F9;
  --go-paper-edge: #94A3B8;
  --go-card-drop: rgba(0, 0, 0, 0.45);
  --go-round-bg: var(--bg-tile);
  --go-round-edge: #1F2126;
}

/* ---------- Box ---------- */
.gb3 { position: relative; transform-style: preserve-3d; }
.gb3 .gb3-face { position: absolute; backface-visibility: visible; }
.gb3 .gb3-top { inset: 0; background: url(../img/box-top.webp) center / cover no-repeat;
  clip-path: polygon(23% 0, 77% 0, 100% 23%, 100% 77%, 77% 100%, 23% 100%, 0 77%, 0 23%); }
.gb3 .gb3-base { inset: 0; background: var(--box-base);
  clip-path: polygon(23% 0, 77% 0, 100% 23%, 100% 77%, 77% 100%, 23% 100%, 0 77%, 0 23%); }
.gb3 .gb3-inside { inset: 6%; background: var(--box-inside);
  clip-path: polygon(23% 0, 77% 0, 100% 23%, 100% 77%, 77% 100%, 23% 100%, 0 77%, 0 23%); }
.gb3 .gb3-band { position: absolute; top: 0; bottom: 0; left: 50%; transform: translateX(-50%); }
.gb3 .gb3-lid { position: absolute; inset: 0; transform-style: preserve-3d;
  transition: transform .8s cubic-bezier(.2, .9, .25, 1.15); }
.gb3.gb3-add-box .gb3-top { filter: grayscale(1) brightness(1.08); }
.gb3 .gb3-plus { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.gb3 .gb3-plus-dot { position: relative; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(15, 23, 42, .25); }
.gb3 .gb3-plus-dot::before, .gb3 .gb3-plus-dot::after { content: ""; position: absolute; left: 50%; top: 50%;
  width: 56%; height: 12%; margin: -6% 0 0 -28%; border-radius: 4px; background: #2563EB; }
.gb3 .gb3-plus-dot::after { transform: rotate(90deg); }

/* Flat: just the top image, no walls. */
html.ui-flat .gb3, .gs-flat .gb3 { transform-style: flat; }
html.ui-flat .gb3 .gb3-side, html.ui-flat .gb3 .gb3-base, html.ui-flat .gb3 .gb3-inside,
.gs-flat .gb3 .gb3-side, .gs-flat .gb3 .gb3-base, .gs-flat .gb3 .gb3-inside { display: none; }
html.ui-flat .gb3 .gb3-face, html.ui-flat .gb3 .gb3-plus { transform: none !important; }
html.ui-flat .gb3 .gb3-lid { transition: none; }

/* ---------- Shelf ---------- */
#giftShelfHost { margin: -6px -16px 0; }
.gs-wrap { position: relative; }
.gs-spot { position: absolute; left: 50%; top: 4px; width: 420px; max-width: 110%; height: 260px; transform: translateX(-50%);
  background: radial-gradient(ellipse at 50% 45%, var(--shelf-spot), transparent 65%); pointer-events: none; }
.gs-row { position: relative; display: flex; overflow-x: auto; scroll-snap-type: x mandatory;
  padding: 4px calc(50% - 70px) 6px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.gs-row::-webkit-scrollbar { display: none; }
.gs-li { flex: 0 0 140px; scroll-snap-align: center; display: flex; justify-content: center; }
.gs-slot { width: 140px; min-height: 44px; display: flex; flex-direction: column; align-items: center; gap: 4px;
  border: 0; background: transparent; padding: 0; font-family: inherit; color: var(--text-primary); cursor: pointer;
  -webkit-tap-highlight-color: transparent; border-radius: 18px; }
.gs-slot:focus-visible { outline: 3px solid #2563EB; outline-offset: -2px; }
:root.theme-dark .gs-slot:focus-visible { outline-color: #BFDBFE; }
.gs-stage { width: 140px; height: 168px; position: relative; perspective: 700px; display: flex; align-items: center; justify-content: center; }
.gs-lift { position: relative; transform-style: preserve-3d; will-change: transform; }
.gs-floor { position: absolute; left: 50%; bottom: 34px; width: 110px; height: 22px; margin-left: -55px; border-radius: 50%;
  background: radial-gradient(closest-side, var(--shelf-floor), transparent); will-change: transform, opacity; } /* gradient, not filter: blur (blur is redrawn on every change) */
html.ui-flat .gs-floor, .gs-flat .gs-floor { display: none; }
html.ui-flat .gs-lift, .gs-flat .gs-lift { transform-style: flat; }
.gs-who { text-align: center; min-height: 50px; font-family: 'Outfit', sans-serif; }
.gs-who b { display: block; font-size: 16px; font-weight: 700; max-width: 136px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-who .gs-chip { font-size: 12px; color: var(--text-secondary); }
.gs-slot.is-center .gs-chip { display: inline-block; margin-top: 4px; padding: 4px 10px; border-radius: 999px;
  background: var(--gs-chip-bg); color: #fff; font-weight: 600; box-shadow: 0 4px 12px var(--gs-chip-glow); }
.gs-hint { text-align: center; margin: 2px 0 14px; font-size: 13px; color: var(--gs-hint); font-family: 'Outfit', sans-serif; }

/* ---------- Up next ---------- */
.gs-next { display: flex; align-items: center; gap: 14px; margin: 0 0 18px; padding: 12px 14px; border-radius: 20px;
  background: var(--go-paper); color: var(--go-paper-ink); border: 1px solid var(--go-paper-edge); font-family: 'Outfit', sans-serif; }
html.ui-3d .gs-next { border-color: transparent; box-shadow: inset 0 1px 0 #fff, 0 6px 0 var(--go-paper-edge), 0 18px 30px var(--go-card-drop); }
.gs-cal { width: 50px; height: 54px; flex-shrink: 0; border-radius: 12px; background: #2563EB; color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center; }
html.ui-3d .gs-cal { box-shadow: 0 4px 0 #1E3A8A; }
.gs-cal small { font-size: 11px; font-weight: 700; letter-spacing: .08em; }
.gs-cal strong { font-size: 20px; line-height: 1; }
.gs-next-txt { flex: 1; min-width: 0; }
.gs-next-txt p { margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-next-t1 { font-size: 16px; font-weight: 700; }
.gs-next-t2 { font-size: 13px; color: var(--go-paper-ink-2); }
.gs-go { width: 44px; height: 44px; border-radius: 50%; border: 0; flex-shrink: 0; background: var(--go-paper-ink); color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer; }
.gs-go:focus-visible, .go-card:focus-visible, .go-idea:focus-visible, .go-round:focus-visible, .go-pill:focus-visible,
.ui-style-option:focus-visible { outline: 3px solid #2563EB; outline-offset: 3px; }

/* ---------- 3D quick-action tiles ---------- */
/* The prototype tilts the whole grid; the app's grid is 5 rows tall, so a whole-grid tilt
   shrinks the top rows and leaves a gap. Each tile gets the same lean instead. */
html.ui-3d .home-action-card {
  transform-origin: 50% 100%; transform: perspective(900px) rotateX(14deg);
  border-color: transparent;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 7px 0 var(--extrude), 0 14px 22px var(--tile-drop);
  transition: transform .08s, box-shadow .08s;
}
html.ui-3d .home-action-card:active {
  transform: perspective(900px) rotateX(14deg) translateY(6px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 1px 0 var(--extrude), 0 4px 8px var(--tile-drop);
}
.home-action-icon { --orb-glow: rgba(37, 99, 235, .5); }
.home-action-icon.qa-blue  { --orb-glow: rgba(59, 130, 246, .5); }
.home-action-icon.qa-cyan  { --orb-glow: rgba(2, 132, 199, .5); }
.home-action-icon.qa-teal  { --orb-glow: rgba(8, 145, 178, .5); }
.home-action-icon.qa-amber { --orb-glow: rgba(217, 119, 6, .5); }
.home-action-icon.qa-pink  { --orb-glow: rgba(219, 39, 119, .5); }
.home-action-icon.qa-coral { --orb-glow: rgba(239, 68, 68, .5); }
.home-action-card[data-tile="dreamBoard"] .home-action-icon { --orb-glow: rgba(124, 58, 237, .5); }
html.ui-3d .home-action-icon {
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .5), inset 0 -4px 8px rgba(15, 23, 42, .25), 0 6px 12px var(--orb-glow) !important;
}

/* ---------- Open-the-box view ---------- */
.gs-open { position: fixed; inset: 0; z-index: 90; display: none; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg-page); color: var(--text-primary); font-family: 'Outfit', sans-serif;
  padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
.gs-open.show { display: block; }
.go-inner { max-width: 430px; margin: 0 auto; padding-bottom: 40px; }
.go-pad { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.go-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 16px; }
.go-bar > div { text-align: center; min-width: 0; flex: 1; }
.go-bar h3 { margin: 0; font-family: 'Playfair Display', Georgia, serif; font-size: 28px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.go-bar p { margin: 0; font-size: 13px; color: var(--text-secondary); }
.go-round { width: 44px; height: 44px; border-radius: 50%; flex-shrink: 0; border: 1px solid var(--bg-tile-border);
  background: var(--go-round-bg); color: var(--text-primary); display: flex; align-items: center; justify-content: center; cursor: pointer; }
html.ui-3d .go-round { border-color: transparent; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .12), 0 4px 0 var(--go-round-edge); }
.go-big { position: relative; height: 400px; perspective: 900px; }
.go-big .gs-spot { top: 20px; }
.go-holder { position: absolute; left: 50%; top: 240px; transform-style: preserve-3d; }
.go-big .gs-floor { bottom: 70px; width: 220px; margin-left: -110px; height: 30px; }
.go-fan { position: absolute; left: 0; right: 0; top: 0; height: 300px; pointer-events: none; }
.go-card { position: absolute; left: 50%; top: 150px; width: 120px; min-height: 88px; margin-left: -60px; box-sizing: border-box;
  border: 1px solid var(--go-paper-edge); border-radius: 16px; padding: 12px; text-align: left; font-family: inherit;
  background: var(--go-paper); color: var(--go-paper-ink); opacity: 0; transform: translate(0, 90px) scale(.5);
  transition: transform .7s cubic-bezier(.2, .9, .25, 1.2), opacity .4s; pointer-events: auto; cursor: pointer; }
html.ui-3d .go-card { border-color: transparent; box-shadow: inset 0 1px 0 #fff, 0 5px 0 var(--go-paper-edge), 0 16px 26px var(--go-card-drop); }
.go-card small { display: block; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.go-card span { display: block; margin-top: 4px; font-size: 14px; font-weight: 600; line-height: 1.25; }
.go-card.is-empty span { color: #1D4ED8; text-decoration: underline; text-underline-offset: 2px; }
.go-sizes small { color: #0E7490; } .go-loves small { color: #BE185D; } .go-wish small { color: #1D4ED8; } .go-skip small { color: #B91C1C; }
.gs-open.is-open .go-card { opacity: 1; }
.gs-open.is-open .go-c1 { transform: translate(-132px, 40px) rotate(-16deg); transition-delay: .25s; }
.gs-open.is-open .go-c2 { transform: translate(-58px, -40px) rotate(-6deg); transition-delay: .32s; }
.gs-open.is-open .go-c3 { transform: translate(58px, -40px) rotate(6deg); transition-delay: .39s; }
.gs-open.is-open .go-c4 { transform: translate(132px, 40px) rotate(16deg); transition-delay: .46s; }
.go-ideas-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.go-ideas-head h4 { margin: 0; font-size: 19px; }
.go-ideas-head p { margin: 0; font-size: 13px; color: var(--text-secondary); }
.go-pill { min-height: 44px; border: 0; border-radius: 999px; padding: 0 16px; flex-shrink: 0; background: #2563EB; color: #fff;
  font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
html.ui-3d .go-pill { background: linear-gradient(150deg, #3B82F6, #1D4ED8); box-shadow: inset 0 2px 0 rgba(255, 255, 255, .4), 0 5px 0 #1E3A8A, 0 12px 20px rgba(37, 99, 235, .4); }
.go-ideas { display: flex; gap: 14px; overflow-x: auto; padding: 18px max(16px, env(safe-area-inset-right, 0px)) 14px max(16px, env(safe-area-inset-left, 0px));
  perspective: 700px; scrollbar-width: none; }
.go-ideas::-webkit-scrollbar { display: none; }
.go-ideas-empty { margin: 0; font-size: 14px; color: var(--text-secondary); }
.go-idea { flex: 0 0 148px; height: 140px; border: 1px solid var(--bg-tile-border); border-radius: 18px; padding: 0; overflow: hidden;
  display: flex; flex-direction: column; background: var(--bg-tile); color: var(--text-primary); text-align: left; font-family: inherit; cursor: pointer; }
html.ui-3d .go-idea { border-color: transparent; transform: rotateY(-10deg);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1), 0 6px 0 var(--extrude), 0 14px 24px var(--tile-drop); }
.go-pic { height: 76px; align-self: stretch; display: flex; align-items: center; justify-content: center; font-size: 30px; font-weight: 700; }
.go-pic-0 { background: #134E4A; color: #5EEAD4; } .go-pic-1 { background: #4C1D95; color: #C4B5FD; }
.go-pic-2 { background: #78350F; color: #FCD34D; } .go-pic-3 { background: #1E3A8A; color: #93C5FD; }
.go-idea b { padding: 10px 12px 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.go-idea i { padding: 2px 12px 0; font-size: 13px; font-style: normal; color: var(--text-secondary); }

/* ---------- Settings: Interface style ---------- */
.ui-style-option { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px; min-height: 44px;
  background: var(--bg-tile); border: 2px solid var(--bg-tile-border); border-radius: 14px; cursor: pointer; font-family: inherit;
  color: var(--text-primary); text-align: left; }
.ui-style-option[aria-pressed="true"] { border-color: #2563EB; }
:root.theme-dark .ui-style-option[aria-pressed="true"] { border-color: #93C5FD; }
.ui-style-option b { font-size: 14px; } .ui-style-option span { font-size: 11px; color: var(--text-secondary); }

@media (prefers-reduced-motion: reduce) {
  .gb3 .gb3-lid, .go-card, html.ui-3d .home-action-card { transition: none !important; }
}

/* ---------- Profile photos ---------- */
/* Peeks out from behind the box; moves and scales with it (gift-shelf.js layout). */
.gs-face { position: absolute; left: 50%; top: -12px; width: 60px; height: 60px; margin-left: -30px; border-radius: 50%;
  object-fit: cover; border: 3px solid #fff; box-shadow: 0 6px 14px rgba(15, 23, 42, .3); background: var(--bg-tile); will-change: transform;
  transform-origin: 50% 96px; pointer-events: none; }
.gs-row:has(.gs-face) { padding-top: 26px; } /* room for photos above the boxes */
:root.theme-dark .gs-face { border-color: #E2E8F0; box-shadow: 0 6px 14px rgba(0, 0, 0, .5); }
.go-face-slot:empty { display: none; }
.go-face-slot { display: block; margin: 0 auto 4px; width: 40px; height: 40px; }
.go-face { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; border: 2px solid #fff; box-shadow: 0 3px 8px rgba(15, 23, 42, .25); }

/* ---------- Shelf arrows (desktop) ---------- */
.gs-nav { display: none; }
.gs-desk .gs-nav { display: flex; position: absolute; top: 74px; z-index: 2; width: 44px; height: 44px; border-radius: 50%;
  align-items: center; justify-content: center; cursor: pointer; border: 1px solid var(--line-2, var(--bg-tile-border));
  background: var(--bg-1, var(--bg-page)); color: var(--fg-1, var(--text-primary)); box-shadow: 0 4px 12px rgba(15, 23, 42, .15); }
.gs-desk .gs-nav:hover { background: var(--bg-3, var(--bg-tile)); }
.gs-desk .gs-nav:focus-visible { outline: 3px solid #2563EB; outline-offset: 2px; }
.gs-desk .gs-nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.gs-desk .gs-nav-prev { left: 14px; }
.gs-desk .gs-nav-next { right: 14px; }
.gs-desk .gs-row:has(.gs-face) ~ .gs-nav { top: 96px; }
.gs-desk .gs-wrap { overflow: hidden; border-radius: 0 0 var(--r-lg, 16px) var(--r-lg, 16px); }
.gs-desk .gs-row { padding-bottom: 10px; }
.gs-desk .gs-hint { margin: 0 0 14px; }
.gs-desk .gs-hint::first-letter { text-transform: none; }

/* ---------- Desktop quick actions: raised in 3D ---------- */
@media (min-width: 768px) {
  html.is-web { --desk-extrude: #D9D3C4; --desk-drop: rgba(20, 24, 30, .12); }
  html.is-web.theme-dark { --desk-extrude: #0E1013; --desk-drop: rgba(0, 0, 0, .45); }
  html.is-web.ui-3d .desk-qa {
    border-color: transparent;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 5px 0 var(--desk-extrude), 0 12px 20px var(--desk-drop);
    transition: transform .1s, box-shadow .1s, background .15s;
    overflow: visible;
  }
  html.is-web.ui-3d .desk-qa::before { border-radius: inherit; }
  html.is-web.ui-3d .desk-qa:hover { transform: translateY(-2px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 7px 0 var(--desk-extrude), 0 16px 24px var(--desk-drop); }
  html.is-web.ui-3d .desk-qa:active { transform: translateY(4px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08), 0 1px 0 var(--desk-extrude), 0 4px 8px var(--desk-drop); }
  html.is-web.ui-3d .desk-qa .desk-tile {
    box-shadow: inset 0 2px 0 rgba(255, 255, 255, .45), inset 0 -4px 8px rgba(15, 23, 42, .25), 0 6px 12px var(--tile-glow, rgba(79, 139, 255, .5));
  }

  /* Open-the-box: a centred window over a dimmed page. */
  html.is-web .gs-open { background: rgba(15, 23, 42, .55); padding: 4vh 16px; }
  html.is-web .gs-open.show { display: flex; align-items: flex-start; justify-content: center; }
  html.is-web .gs-open .go-inner { width: 480px; max-width: 100%; background: var(--bg-page); border-radius: 24px;
    padding-bottom: 24px; box-shadow: 0 30px 80px rgba(0, 0, 0, .45); overflow: hidden; }
}
/* Desktop: boxes fade out at the card edges instead of being cut off. */
.gs-desk .gs-row { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 9%, #000 91%, transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 9%, #000 91%, transparent 100%); }

/* Desktop "Up next" rows are buttons now (open the box). */
.gs-upnext-row { width: 100%; padding: 10px 14px; gap: 12px; border: 0; background: transparent; color: inherit;
  font-family: inherit; cursor: pointer; border-radius: 12px; display: flex; align-items: center; }
.gs-upnext-row:hover { background: var(--bg-3, rgba(0, 0, 0, .04)); }
.gs-upnext-row:focus-visible { outline: 3px solid #2563EB; outline-offset: -2px; }

/* ---------- Desktop Friends: Connect with people ---------- */
.desk-connect-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.desk-connect-link .desk-btn { white-space: nowrap; }
@media (max-width: 1100px) { .desk-connect-grid { grid-template-columns: 1fr; } }

/* Open-the-box: clear ways to the person's full profile (was a bare "…" button). */
.go-profile { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 14px; flex-shrink: 0;
  border: 0; border-radius: 999px; background: #2563EB; color: #fff; font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
html.ui-3d .go-profile { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), 0 4px 0 #1E3A8A, 0 8px 16px rgba(37, 99, 235, .35); }
.go-profile:active { transform: translateY(2px); }
.go-profile:focus-visible, .go-profile-link:focus-visible { outline: 3px solid #2563EB; outline-offset: 3px; }
.go-bar > div { padding: 0 4px; }
.go-profile-row { display: flex; justify-content: center; margin: -6px 0 18px; }
.go-profile-link { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 18px; border-radius: 999px;
  border: 2px solid #2563EB; background: transparent; color: #1D4ED8; font-family: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
:root.theme-dark .go-profile-link { border-color: #93C5FD; color: #BFDBFE; }
