:root{
  --bg: #0a0d12;
  --bg-raised: #10141b;
  --card: #131820;
  --line: #1f2733;
  --teal: #4fd8cf;
  --teal-soft: rgba(79,216,207,.15);
  --blue: #6ea8e8;
  --text: #eef2f6;
  --text-dim: #93a1b0;
  --radius: 18px;
  --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-body: 'Inter', 'Segoe UI', sans-serif;
  --frame-dark: #343141;
  --frame-mid: #2b2937;
  --frame-accent: #764536;
}

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

body{
  background:var(--bg);
  color:var(--text);
  font-family:var(--font-body);
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
}

a{color:inherit;text-decoration:none}
button{font-family:inherit;cursor:pointer;border:none;background:none;color:inherit}

img,canvas{max-width:100%;display:block}

/* ---------- Nav (iOS-style frosted glass) ---------- */
.topbar{
  position:sticky;top:0;z-index:50;
  display:flex;align-items:center;justify-content:center;gap:8px;
  padding:14px 24px;
  background:rgba(12,15,20,.55);
  -webkit-backdrop-filter:saturate(180%) blur(20px);
  backdrop-filter:saturate(180%) blur(20px);
  border-bottom:1px solid rgba(255,255,255,.08);
  box-shadow:0 1px 0 rgba(255,255,255,.05) inset, 0 12px 30px -16px rgba(0,0,0,.6);
}
.tabs{
  display:flex;gap:4px;padding:4px;border-radius:999px;
  background:rgba(255,255,255,.05);
  border:1px solid rgba(255,255,255,.08);
  -webkit-backdrop-filter:blur(8px);
  backdrop-filter:blur(8px);
}
.tab{
  padding:8px 18px;border-radius:999px;font-size:14px;font-weight:600;
  color:var(--text-dim);letter-spacing:.02em;transition:background .25s ease,color .2s,box-shadow .25s ease;
  white-space:nowrap;
}
.tab:hover{color:var(--text)}
.tab.active{
  background:rgba(255,255,255,.14);color:var(--text);
  box-shadow:0 1px 4px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.1) inset;
  -webkit-backdrop-filter:blur(10px);
  backdrop-filter:blur(10px);
}
.social{display:flex;gap:10px;margin-left:20px}
.social a{width:34px;height:34px;border-radius:50%;display:flex;align-items:center;justify-content:center;
  background:rgba(255,255,255,.05);border:1px solid rgba(255,255,255,.08);font-size:15px;
  -webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);transition:background .2s ease;}
.social a:hover{background:rgba(255,255,255,.1)}

/* ---------- Mobile nav: hamburger + column menu ---------- */
.menu-toggle{
  display:none;flex-direction:column;justify-content:center;gap:5px;
  width:34px;height:34px;border-radius:50%;
}
.menu-toggle span{width:16px;height:2px;margin:0 auto;background:var(--text);border-radius:2px;transition:transform .25s ease,opacity .2s ease}
.menu-toggle.open span:nth-child(1){transform:translateY(7px) rotate(45deg)}
.menu-toggle.open span:nth-child(2){opacity:0}
.menu-toggle.open span:nth-child(3){transform:translateY(-7px) rotate(-45deg)}
.mobile-menu{display:none;flex-direction:column;gap:4px;width:100%;margin-top:14px}
.mobile-menu.open{display:flex}
.mobile-menu .tab{width:100%;text-align:center;padding:13px}

/* Right above the hamburger breakpoint, 7 tabs at full size no longer fit alongside
   the social icons -- "About Me" was wrapping onto a second line and stretching the
   whole bar taller. Tightening the pill's own sizing here buys back enough width. */
@media (max-width:900px){
  .tabs .tab{padding:7px 12px;font-size:13px}
  .tabs{gap:2px}
  .social{margin-left:12px}
}

@media (max-width:767px){
  .topbar{flex-wrap:wrap;justify-content:space-between;padding:12px 16px}
  .tabs{display:none}
  .menu-toggle{display:flex}
  .social{margin-left:0}
}

/* ---------- Sections ---------- */
.view-stage{position:relative;overflow-x:hidden}
.view{display:none;padding:64px 24px 100px;max-width:1200px;margin:0 auto}
.view.full-bleed{padding:0;max-width:none;margin:0}
.view.active{display:block}
.view.exiting{position:absolute;top:0;left:0;width:100%;z-index:2}

.eyebrow{color:var(--teal);font-size:13px;font-weight:700;letter-spacing:.12em;text-transform:uppercase;margin-bottom:10px}
h1,h2,h3{font-family:var(--font-display);letter-spacing:.01em}
.section-title{font-size:34px;margin-bottom:32px}

/* ---------- Home hero ----------
   The Rive scene's own aspect ratio rarely matches the viewport's, so rather than
   letterboxing with plain black bars, the leftover width on each side is filled with
   a decorative 3-band "door frame" (script.js measures the real ratio and sizes
   hero-canvas-wrap to it; the frame sides just absorb whatever space is left). */
.hero{
  position:relative;
  background:#000;
  height:calc(100vh - 71px); /* fills the page below the sticky nav */
  display:flex;
  overflow:hidden;
}
.hero-frame{display:flex;height:100%;flex:1 1 0%;min-width:0}
.hero-frame .frame-band{height:100%}
.frame-a{flex:80 1 0%;background:var(--frame-dark)}
.frame-b{flex:13 1 0%;background:var(--frame-mid)}
.frame-c{flex:7 1 0%;background:var(--frame-accent)}
.hero-canvas-wrap{height:100%;flex:0 0 auto;aspect-ratio:3/2}
#rive-home{width:100%;height:100%}

@media (max-width:767px){
  /* Phone file fills the full screen instead -- no frame, sides may crop (see script.js fit:Cover) */
  .hero-frame{display:none}
  .hero-canvas-wrap{flex:1 1 auto;width:100%;aspect-ratio:auto}
}
.hero-cta{
  display:inline-block;background:var(--text);color:#0a0d12;font-weight:700;
  padding:12px 26px;border-radius:999px;text-align:center;
}

/* ---------- Design (character) ----------
   The character stage now fills the full page width (like the galleries) with the
   canvas sized to fill its height -- script.js locks the box to the artboard's real
   aspect ratio (applyAspectRatioToBox), so there's no more empty space above/below
   from a fixed portrait box that didn't match the content. */
.design-layout{display:grid;grid-template-columns:1.2fr .8fr;gap:28px}
.design-layout.single{display:block}
/* The frame is a separate outer box so its padding always reads as an equal
   pixel margin on every side -- the inner stage keeps the artboard's own real
   aspect ratio (so Rive's Contain fit never has to letterbox), and the frame
   just shrink-wraps around it with a uniform gap. */
.rive-frame{
  display:flex;width:fit-content;margin:0 auto;
  padding:32px;
  background:var(--bg-raised);border:1px solid var(--line);border-radius:var(--radius);
}
.character-stage.large{
  height:min(70vh,680px);
  aspect-ratio:3/4; /* fallback until JS sets the real ratio */
}
.character-stage{
  display:flex;align-items:center;justify-content:center;overflow:hidden;
}
.character-stage.large.melian-stage{
  height:min(88vh,860px);
}
#rive-character,#rive-melian{width:100%;height:100%}

@media (max-width:767px){
  /* Height-locked sizing let a wide artboard compute a width taller/wider than the
     phone screen and overflow it; width-locked with height:auto never can. A
     fit-content frame can't work here either -- its child wants 100% of it,
     which is circular -- so the frame stretches full width instead. */
  .rive-frame{width:100%;padding:16px}
  .character-stage.large{height:auto;width:100%}
}
/* ---------- About: Rive stats file staged as a monitor screen ----------
   Two nested frames sell the "computer" read: computer-frame is the bigger outer
   casing (fills the full section width), computer-bezel is the thin inner lip
   directly around the screen (a few px on each side) -- script.js locks it to the
   loaded artboard's real aspect ratio (Stats on desktop, Stats 2 on phone) so the
   canvas fills essentially the whole bezel, no separate black screen layer needed. */
.computer-frame{
  position:relative;
  width:100%;max-width:800px;margin:0 auto;
  /* Brighter grey top-left fading to darker grey bottom-right -- reads as a
     brushed-metal device casing rather than a flat panel. */
  background:linear-gradient(155deg, #6b6f78 0%, #3a3d44 45%, #1e2025 100%);
  border-radius:22px;
  padding:22px;
  box-shadow:0 30px 70px -24px rgba(0,0,0,.65), inset 0 1px 0 rgba(255,255,255,.15);
}
.computer-bezel{
  position:relative;
  background:linear-gradient(165deg,#232529,#101114);
  border-radius:10px;
  padding:8px; /* the even, few-px gap between the frame and the artboard */
  height:min(62vh,620px);
  aspect-ratio:16/10; /* fallback until JS sets the real ratio */
  margin:0 auto;
  box-shadow:inset 0 2px 8px rgba(0,0,0,.65), inset 0 -1px 0 rgba(255,255,255,.04);
}
/* Flickering glow traced around the screen itself, like a monitor's edge-lighting. */
.computer-bezel::after{
  content:'';position:absolute;inset:0;border-radius:10px;
  box-shadow:0 0 0 2px rgba(110,168,232,.85), 0 0 22px 4px rgba(110,168,232,.55);
  pointer-events:none;
  animation:screen-flicker 3.6s ease-in-out infinite;
}
@keyframes screen-flicker{
  0%,100%{opacity:.55}
  38%{opacity:.95}
  46%{opacity:.3}
  62%{opacity:.8}
  80%{opacity:.45}
}
#rive-about{width:100%;height:100%;border-radius:4px;overflow:hidden;display:block}
.computer-stand-neck{width:64px;height:26px;margin:0 auto;background:linear-gradient(180deg,#2c2e34,#1a1b1f);border-radius:0 0 6px 6px}
.computer-stand-base{width:190px;height:14px;margin:0 auto;background:linear-gradient(180deg,#2c2e34,#17181c);border-radius:8px;box-shadow:0 10px 20px -8px rgba(0,0,0,.5)}

@media (max-width:767px){
  .computer-frame{padding:12px;border-radius:16px}
  .computer-bezel{padding:5px;height:44vh;border-radius:8px}
  .computer-stand-neck{width:44px;height:18px}
  .computer-stand-base{width:130px;height:10px}
}

.controls-panel{background:var(--bg-raised);border:1px solid var(--line);border-radius:var(--radius);padding:24px}
.controls-panel h3{color:var(--teal);font-size:13px;letter-spacing:.1em;text-transform:uppercase;margin:18px 0 12px}
.controls-panel h3:first-child{margin-top:0}
.ctrl-btn{
  width:100%;text-align:left;padding:14px 18px;margin-bottom:8px;border-radius:12px;
  background:var(--card);border:1px solid var(--line);font-weight:600;transition:.15s;
}
.ctrl-btn:hover{border-color:var(--teal);color:var(--teal)}

/* ---------- Galleries (Animation / AI / Illustration) ---------- */
.gallery{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:14px;margin-bottom:56px}
.gallery.wide{grid-template-columns:repeat(2,1fr)}
/* A gallery with only one video (e.g. AI, for now) fills the full width instead of
   sitting in half the grid with an empty gap next to it -- and reverts to the normal
   2-up layout automatically the moment a second video is added. */
.gallery.wide:has(.tile:only-child){grid-template-columns:1fr}
.gallery.wide .tile{aspect-ratio:16/9}

@media (max-width:767px){
  .gallery.wide{grid-template-columns:1fr}
}
.tile{
  position:relative;aspect-ratio:4/3;border-radius:14px;overflow:hidden;
  background:linear-gradient(135deg,#132029,#0d1319);border:1px solid var(--line);
  display:flex;align-items:center;justify-content:center;cursor:pointer;
  transition:transform .35s cubic-bezier(.22,1,.36,1), box-shadow .35s ease;
}
.tile:hover{transform:translateY(-4px);box-shadow:0 18px 40px -12px rgba(0,0,0,.6)}

/* Justified layout: script.js measures each image's real aspect ratio and sets
   width/height inline so full rows pack edge-to-edge with no cropping and no gaps. */
.img-gallery{display:flex;flex-wrap:wrap;gap:10px}
.img-gallery .tile{flex:none;aspect-ratio:auto;height:240px;width:320px}
.tile img,.tile video{
  width:100%;height:100%;object-fit:cover;display:block;
  transition:transform .5s cubic-bezier(.22,1,.36,1);
}
.tile:hover img,.tile:hover video{transform:scale(1.06)}
.tile .play{
  position:absolute;bottom:12px;right:12px;width:34px;height:34px;border-radius:50%;
  background:rgba(0,0,0,.5);border:1px solid var(--teal-soft);display:flex;align-items:center;justify-content:center;color:var(--teal);
  z-index:2;
}
.tile-caption{
  position:absolute;left:0;right:0;bottom:0;padding:24px 16px 14px;
  background:linear-gradient(to top, rgba(6,8,12,.92), transparent);
  color:var(--text);font-size:14px;font-weight:600;
  transform:translateY(60%);opacity:0;transition:transform .3s ease, opacity .3s ease;
}
.tile:hover .tile-caption{transform:translateY(0);opacity:1}
/* Fallback shown when an image/video file hasn't been added yet */
.tile.img-missing img,.tile.img-missing video{display:none}
.tile.img-missing::before{
  content:attr(data-label);color:var(--text-dim);font-size:13px;text-align:center;padding:0 16px;
}
.tile.img-missing .tile-caption{display:none}

/* Single, centered title per gallery block -- replaces the old eyebrow+heading+subhead stack */
.gallery-title{
  text-align:center;font-size:26px;font-weight:600;
  margin:0 0 24px;color:var(--text);
  text-transform:uppercase;letter-spacing:0.04em;
}

/* ---------- Lightbox ---------- */
.lightbox{flex-direction:column;padding:40px}
.lightbox img,.lightbox video{max-width:min(90vw,1000px);max-height:75vh;border-radius:12px;object-fit:contain}
.lightbox iframe{width:min(90vw,1000px);aspect-ratio:16/9;max-height:75vh;border-radius:12px;border:none}
.lightbox #lightbox-caption{color:var(--text-dim);margin-top:16px;font-size:14px}
.lightbox .modal-close{color:var(--text)}

/* Elegant glass prev/next arrows for stepping through the gallery the lightbox
   was opened from, without closing it. */
.lightbox-nav{
  position:absolute;top:50%;transform:translateY(-50%);
  width:48px;height:48px;border-radius:50%;
  background:rgba(255,255,255,.07);border:1px solid rgba(255,255,255,.14);
  -webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);
  color:var(--text);
  display:flex;align-items:center;justify-content:center;
  transition:background .2s ease;
  z-index:2;
}
.lightbox-nav svg{display:block}
.lightbox-nav:hover{background:rgba(255,255,255,.16)}
.lightbox-prev{left:16px}
.lightbox-next{right:16px}
@media (max-width:700px){
  .lightbox-nav{width:38px;height:38px}
  .lightbox-nav svg{width:16px;height:16px}
  .lightbox-prev{left:6px}
  .lightbox-next{right:6px}
}

/* ---------- Shop ---------- */
.shop-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:20px}
.product-card{
  background:var(--bg-raised);border:1px solid var(--line);border-radius:var(--radius);overflow:hidden;
  display:flex;flex-direction:column;transition:.2s;
}
.product-card:hover{border-color:var(--teal)}
.product-media{aspect-ratio:1/1;background:linear-gradient(135deg,#132029,#0d1319);display:flex;align-items:center;justify-content:center;color:var(--text-dim);font-size:13px}
.product-body{padding:16px 18px 20px}
.product-body h4{font-size:16px;margin-bottom:4px}
.product-price{color:var(--teal);font-weight:700;margin-bottom:14px}
.buy-btn{
  display:block;text-align:center;width:100%;padding:11px;border-radius:999px;
  background:var(--teal);color:#06231f;font-weight:700;
}
.shop-note{
  margin-top:32px;padding:16px 20px;border:1px dashed var(--line);border-radius:12px;
  color:var(--text-dim);font-size:14px;
}

/* ---------- Contact modal (same frosted-glass treatment as the nav) ---------- */
.modal-overlay{
  display:none;position:fixed;inset:0;z-index:100;background:rgba(6,8,12,.55);
  -webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px);
  align-items:center;justify-content:center;padding:20px;
}
.modal-overlay.open{display:flex}
.modal-box{
  background:rgba(20,23,31,.55);
  -webkit-backdrop-filter:saturate(180%) blur(20px);
  backdrop-filter:saturate(180%) blur(20px);
  border:1px solid rgba(255,255,255,.1);
  box-shadow:0 1px 0 rgba(255,255,255,.06) inset, 0 24px 60px -20px rgba(0,0,0,.6);
  border-radius:var(--radius);
  padding:32px;width:100%;max-width:420px;position:relative;
}
.modal-close{position:absolute;top:14px;right:18px;font-size:22px;color:var(--text-dim)}
.modal-close:hover{color:var(--text)}
.modal-box h3{margin-bottom:18px}
.modal-box form{display:flex;flex-direction:column;gap:12px}
.modal-box input,.modal-box textarea{
  background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.12);border-radius:10px;padding:11px 14px;
  color:var(--text);font-family:inherit;font-size:14px;resize:vertical;
}

@media (max-width:767px){
  /* Same dialog, just sized down -- the old fixed 32px padding/420px box read as
     oversized against a small phone viewport. */
  .modal-box{max-width:100%;padding:22px 18px;border-radius:16px}
  .modal-box h3{font-size:17px;margin-bottom:14px}
  .modal-box form{gap:10px}
  .modal-box input,.modal-box textarea{padding:10px 12px;font-size:16px} /* 16px avoids iOS auto-zoom on focus */
  .modal-box textarea{min-height:80px}
}
.modal-box input:focus,.modal-box textarea:focus{outline:2px solid var(--teal);outline-offset:1px}

/* ---------- Design: UI preview gallery ----------
   "Sale Milestone Tracker" and "Live Preview Panel" get twice the width of the
   others (grid-column:span 2 across the same 1fr tracks as everyone else, so it's a
   literal 2fr-vs-1fr ratio). Every tile -- wide or not -- shares one fixed row height
   (grid-auto-rows) instead of sizing itself from its own aspect-ratio: a wide tile can
   end up alone in its row (nothing else fits next to a 2-column-wide item once the
   dense algorithm packs the rest), and without a shared row height it had nothing to
   stretch to, so its box collapsed to the canvas's own raw pixel size instead (huge,
   since Rive sets that from devicePixelRatio). A fixed row height sidesteps that: wide
   tiles fill 2 columns' width at that same height, normal tiles fill 1 column's width
   at it -- always matching whatever's beside them, never dependent on row composition. */
.ui-gallery{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));grid-auto-rows:480px;gap:16px;grid-auto-flow:dense}
.ui-tile{
  background:var(--bg-raised);border:1px solid var(--line);border-radius:14px;overflow:hidden;
  display:flex;flex-direction:column;
}
.ui-tile.wide{grid-column:span 2}
.ui-tile canvas{flex:1;width:100%;min-height:0}
.ui-label{padding:10px 14px;font-size:13px;color:var(--text-dim);border-top:1px solid var(--line)}

@media (max-width:767px){
  .ui-gallery{grid-auto-rows:auto}
  .ui-tile{aspect-ratio:9/16}
  .ui-tile.wide{grid-column:span 1;aspect-ratio:9/16}
}

/* ---------- Footer ---------- */
footer{
  border-top:1px solid var(--line);padding:40px 24px;display:flex;gap:60px;
  max-width:1200px;margin:0 auto;flex-wrap:wrap;
}
.foot-col a{display:block;color:var(--text-dim);font-size:14px;margin-bottom:10px}
.foot-col a:hover{color:var(--teal)}
