/* Base */
html { scroll-behavior: smooth; }
body { background: #0d0d0d; color: #141615; }
.hero-text { text-wrap: balance; }
.font-avenir { font-family: "Avenir Next LT Pro", "Avenir Next", Avenir, sans-serif; }
.grain { background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.07'/%3E%3C/svg%3E"); }

/* Hero background and mobile menu */
#galaxyBackground { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; overflow: hidden; opacity: .95; mix-blend-mode: screen; pointer-events: auto; }
#galaxyBackground canvas { display: block; width: 100%; height: 100%; }
.menu-icon, .menu-icon::before, .menu-icon::after { display: block; width: 18px; height: 2px; background: currentColor; content: ''; }
.menu-icon { position: relative; }
.menu-icon::before, .menu-icon::after { position: absolute; left: 0; }
.menu-icon::before { top: -6px; }
.menu-icon::after { top: 6px; }
.menu-icon.is-open { background: transparent; }
.menu-icon.is-open::before { top: 0; transform: rotate(45deg); }
.menu-icon.is-open::after { top: 0; transform: rotate(-45deg); }

/* Depth carousel */
.depth-carousel { position: relative; display: flex; width: 100%; height: 620px; min-height: 460px; align-items: center; justify-content: center; perspective: 1400px; perspective-origin: 50% 50%; touch-action: pan-y; outline: none; user-select: none; cursor: grab; }
.depth-carousel:active { cursor: grabbing; }
.depth-carousel:focus-visible { outline: 2px solid rgba(214, 222, 216, .45); outline-offset: 8px; border-radius: 12px; }
.depth-stage { position: absolute; inset: 0; transform-style: preserve-3d; }
.depth-card { position: absolute; top: 50%; left: 50%; overflow: hidden; background: #0b0d12; box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .45), 0 8px 20px -10px rgba(0, 0, 0, .35); will-change: transform, opacity, filter; cursor: pointer; transform-origin: center; transition: box-shadow .2s ease; }
.depth-card:hover { box-shadow: 0 34px 70px -18px rgba(0, 0, 0, .55), 0 10px 25px -10px rgba(0, 0, 0, .45); }
.depth-card img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; user-select: none; }
.depth-card::after { position: absolute; inset: 0; background: #05060a; content: ''; opacity: var(--depth-tint-opacity, 0); mix-blend-mode: multiply; pointer-events: none; transition: opacity .2s ease; }
.depth-card .depth-caption { position: absolute; right: 1.2rem; bottom: 1.2rem; left: 1.2rem; z-index: 2; color: #dccccc; text-shadow: 0 2px 15px rgba(0, 0, 0, .55); pointer-events: none; }
.depth-caption h3 { font-family: Georgia, serif; font-size: 1.7rem; line-height: .95; }
.depth-caption p { margin-top: .5rem; font-size: .65rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
.add-button { color: #171b18; font-weight: 800; }
.depth-card .add-button { z-index: 4; }
.depth-arrow { position: absolute; top: 50%; z-index: 3000; display: grid; width: 44px; height: 44px; place-items: center; border: 1px solid rgba(240, 248, 244, .25); border-radius: 999px; background: rgba(23, 27, 24, .8); color: #f0f8f4; font-size: 1.5rem; cursor: pointer; transform: translateY(-50%); transition: background .2s ease, transform .2s ease; }
.depth-arrow:hover { background: #0e0c0c; }
.depth-arrow:active { transform: translateY(-50%) scale(.94); }
.depth-arrow.prev { left: 1rem; }
.depth-arrow.next { right: 1rem; }
.depth-dots { position: absolute; bottom: 1.5rem; left: 50%; z-index: 3000; display: flex; gap: 7px; padding: 8px 11px; border-radius: 999px; background: rgba(23, 27, 24, .55); transform: translateX(-50%); }
.depth-dot { width: 7px; height: 7px; padding: 0; border: 0; border-radius: 999px; background: rgba(255, 255, 255, .4); cursor: pointer; transition: width .25s ease, background .2s ease; }
.depth-dot.is-active { width: 20px; background: #ccc0c0; }
#depthCarousel { display: none; }

/* Magic Bento */
.magic-bento { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: 250px; gap: 16px; max-width: 1180px; margin: 0 auto; perspective: 1000px; }
.magic-card { --glow-x: 50%; --glow-y: 50%; --glow-intensity: 0; --glow-color: 198, 107, 74; position: relative; display: flex; min-height: 250px; padding: 28px; flex-direction: column; justify-content: space-between; overflow: hidden; border: 1px solid rgba(198, 107, 74, .25); border-radius: 18px; background: #171b18; color: #fff; cursor: pointer; transform-style: preserve-3d; transition: box-shadow .3s ease, border-color .3s ease; }
.magic-card::before { position: absolute; inset: 0; z-index: 1; background: radial-gradient(circle var(--spotlight-radius, 300px) at var(--glow-x) var(--glow-y), rgba(var(--glow-color), calc(var(--glow-intensity) * .3)), transparent 65%); content: ''; pointer-events: none; }
.magic-card::after { position: absolute; inset: 0; z-index: 2; border: 1px solid rgba(var(--glow-color), calc(var(--glow-intensity) * .9)); border-radius: inherit; box-shadow: 0 0 30px rgba(var(--glow-color), calc(var(--glow-intensity) * .32)); content: ''; opacity: var(--glow-intensity); pointer-events: none; }
.magic-card:hover { border-color: rgba(45, 44, 43, 0.8); box-shadow: 0 12px 35px rgba(23, 27, 24, .18); }
.magic-card--large { grid-column: span 2; grid-row: span 2; }
.magic-card--wide { grid-column: span 2; }
.magic-card__image { position: absolute; inset: 0; z-index: 0; width: 100%; height: 100%; object-fit: cover; opacity: .55; transition: transform .5s ease, opacity .3s ease; }
.magic-card:hover .magic-card__image { opacity: .7; transform: scale(1.06); }
.magic-card__shade { position: absolute; inset: 0; z-index: 1; background: linear-gradient(180deg, rgba(23, 27, 24, .05), rgba(23, 27, 24, .85)); pointer-events: none; }
.magic-card__content, .magic-card__label { position: relative; z-index: 3; }
.magic-card__label { align-self: flex-start; border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px; padding: 5px 9px; font-size: 9px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
.magic-card__title { margin: 0 0 5px; font-family: Georgia, serif; font-size: clamp(1.5rem, 3vw, 2.8rem); line-height: .95; }
.magic-card__description { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; opacity: .75; }
.magic-card .add-button { z-index: 5; }
.magic-card:hover .add-button { opacity: 1; }
.magic-particle { position: absolute; z-index: 4; width: 4px; height: 4px; border-radius: 50%; background: rgb(var(--glow-color)); box-shadow: 0 0 8px rgba(var(--glow-color), .9); pointer-events: none; }
.magic-ripple { position: absolute; z-index: 6; border-radius: 50%; background: radial-gradient(circle, rgba(var(--glow-color), .45), transparent 70%); pointer-events: none; transform: scale(0); animation: magic-ripple .8s ease-out forwards; }

/* Journal and overlays */
#journal { font-family: "Trebuchet MS", sans-serif; }
#journal h2, #journal h3 { font-family: "Trebuchet MS", sans-serif; font-weight: 700; letter-spacing: 0; }
.bag-drawer { transform: translateX(100%); transition: transform .3s cubic-bezier(.2, .8, .2, 1); }
.bag-drawer.is-open { transform: translateX(0); }
.bag-backdrop { opacity: 0; pointer-events: none; transition: opacity .3s ease; }
.bag-backdrop.is-open { opacity: 1; pointer-events: auto; }
.search-panel { position: fixed; inset: 0; z-index: 60; display: flex; align-items: flex-start; justify-content: center; padding: 7rem 1.25rem 2rem; background: rgba(23, 27, 24, .48); opacity: 0; pointer-events: none; transition: opacity .25s ease; }
.search-panel.is-open { opacity: 1; pointer-events: auto; }
.search-box { width: min(680px, 100%); max-height: min(620px, 80vh); overflow: hidden; background: #f5f3ed; box-shadow: 0 24px 80px rgba(23, 27, 24, .25); transform: translateY(-12px); transition: transform .25s ease; }
.search-panel.is-open .search-box { transform: translateY(0); }
.search-results { max-height: 52vh; overflow-y: auto; }
.search-result { display: flex; align-items: center; gap: 1rem; border-top: 1px solid rgba(23, 27, 24, .12); padding: .85rem 1.1rem; }
.search-result img { width: 48px; height: 60px; object-fit: cover; }
.search-empty { padding: 1.25rem; color: rgba(23, 27, 24, .55); font-size: .9rem; }

/* Motion and responsive rules */
.reveal { animation: rise .7s cubic-bezier(.2, .8, .2, 1) both; }
.delay-1 { animation-delay: .12s; }
.delay-2 { animation-delay: .22s; }
.delay-3 { animation-delay: .32s; }
@keyframes magic-ripple { to { opacity: 0; transform: scale(1); } }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: translateY(0); } }
@media (max-width: 800px) { .magic-bento { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 220px; gap: 12px; } .magic-card, .magic-card--large, .magic-card--wide { min-height: 220px; padding: 22px; grid-column: span 1; grid-row: span 1; } }
@media (max-width: 640px) { .depth-carousel { height: 500px; } .depth-arrow.prev { left: 0; } .depth-arrow.next { right: 0; } }
@media (max-width: 480px) { .magic-bento { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; scroll-behavior: auto !important; } }
