/* ===================================================================
   Showcase theme — ported from the portfolio's token system.

   The portfolio (rustytrooser.dev) owns the canonical values; this file
   restates them so the showcase can be served standalone by web/server.mjs
   without reaching into the site's own css/. Token names are kept identical
   so a rule copied from either side lands correctly in the other.
   =================================================================== */

:root {
  --bg-ocean: #120a0d;
  --bg-deep: #1a0c11;

  --text-primary: #f3e7d2;
  --text-secondary: #d8b9a4;
  --text-muted: #9c7a68;

  --gold: #f5c842;
  --gold-light: #ffe066;
  --gold-dark: #c9991a;
  --crimson: #e23744;
  --crimson-light: #ff5a67;
  --crimson-dark: #a71d2a;

  --accent-gradient: linear-gradient(135deg, var(--crimson), var(--gold));
  --treasure-gradient: linear-gradient(135deg, var(--gold-dark), var(--gold), var(--gold-light));
  --straw-hat-gradient: linear-gradient(135deg, var(--gold), var(--crimson), var(--gold));
  --night-ocean: linear-gradient(180deg, #120a0d 0%, #1c0d11 38%, #2e0f16 100%);

  --border-color: rgba(226, 55, 68, 0.20);
  --border-hover: rgba(226, 55, 68, 0.5);
  --glow-gold: rgba(245, 200, 66, 0.22);

  --card-gradient-from: rgba(32, 14, 18, 0.9);
  --card-gradient-to: rgba(46, 18, 24, 0.85);
  --card-hover-from: rgba(46, 18, 24, 0.95);
  --card-hover-to: rgba(62, 24, 30, 0.9);
  --nav-bg: rgba(18, 10, 13, 0.95);
  --footer-bg: rgba(18, 10, 13, 0.8);
  --section-bg-a: rgba(42, 16, 20, 0.5);
  --section-bg-b: rgba(62, 18, 24, 0.32);
  --section-bg-c: rgba(18, 10, 13, 0.5);
  --wave1-from: rgba(226, 55, 68, 0.28);
  --wave1-to: rgba(122, 29, 38, 0.15);
  --wave2-from: rgba(245, 200, 66, 0.16);
  --wave2-to: rgba(226, 55, 68, 0.12);
  --wave3-from: rgba(255, 90, 103, 0.10);
  --wave3-to: rgba(245, 200, 66, 0.10);

  /* The 3D subjects are lit by a neutral studio rig and shot on transparent
     film, so the stage they sit on is a warm near-black rather than the page
     gradient — a gradient behind a floating object reads as a seam. */
  --stage-ground: radial-gradient(ellipse 80% 70% at 50% 42%, #241016 0%, #150b0f 55%, #0e070a 100%);
  --hair: rgba(245, 200, 66, 0.14);

  --font-pirate: 'Pirata One', cursive;
  --font-primary: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --font-display: 'Space Grotesk', sans-serif;

  --section-padding: 100px;
  --container-width: 1200px;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 20px;

  color-scheme: dark;
}

[data-theme="light"] {
  --bg-ocean: #ecd7b3;
  --bg-deep: #ddc498;

  --text-primary: #3a1f12;
  --text-secondary: #5e3a26;
  --text-muted: #876a4c;

  --gold: #b8860b;
  --gold-light: #c9991a;
  --gold-dark: #a07818;
  --crimson: #c0271f;
  --crimson-light: #e63946;
  --crimson-dark: #7a1f1a;

  --border-color: rgba(140, 50, 35, 0.30);
  --border-hover: rgba(140, 50, 35, 0.55);
  --glow-gold: rgba(201, 153, 26, 0.18);

  --card-gradient-from: rgba(248, 236, 208, 0.95);
  --card-gradient-to: rgba(236, 216, 184, 0.92);
  --card-hover-from: rgba(252, 244, 222, 0.98);
  --card-hover-to: rgba(242, 224, 196, 0.95);
  --nav-bg: rgba(236, 220, 186, 0.96);
  --footer-bg: rgba(226, 208, 172, 0.93);
  --section-bg-a: rgba(219, 199, 156, 0.42);
  --section-bg-b: rgba(192, 39, 31, 0.12);
  --section-bg-c: rgba(236, 220, 186, 0.36);
  --night-ocean: linear-gradient(180deg, #f1e3c2 0%, #e9d3a6 45%, #e0c193 100%);
  --wave1-from: rgba(192, 39, 31, 0.15);
  --wave1-to: rgba(122, 31, 26, 0.08);
  --wave2-from: rgba(201, 153, 26, 0.11);
  --wave2-to: rgba(192, 39, 31, 0.06);
  --wave3-from: rgba(224, 80, 60, 0.09);
  --wave3-to: rgba(120, 90, 40, 0.08);

  /* Light theme keeps a dark stage. The instruments are near-white plastic;
     on parchment they lose their silhouette entirely. */
  --stage-ground: radial-gradient(ellipse 80% 70% at 50% 42%, #2a1219 0%, #1a0d11 55%, #120a0d 100%);
  --hair: rgba(140, 50, 35, 0.22);

  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-primary);
  background: var(--night-ocean);
  color: var(--text-primary);
  line-height: 1.7;
  /* clip, not hidden: `overflow: hidden` makes body a scroll container, which
     silently kills the `position: sticky` stage on the scroll-driven page. */
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
  transition: background 0.4s ease, color 0.4s ease;
}

a { color: inherit; text-decoration: none; }

.container { max-width: var(--container-width); margin: 0 auto; padding: 0 24px; }

.pirate-text {
  font-family: var(--font-pirate);
  background: var(--straw-hat-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  filter: drop-shadow(0 0 12px rgba(226, 55, 68, 0.45)) drop-shadow(0 0 6px rgba(245, 200, 66, 0.4));
}

/* ------------------------------------------------------------ overlays */
.grain-overlay {
  position: fixed; inset: 0; z-index: 9998; pointer-events: none; opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grainShift 0.6s steps(2) infinite;
}
@keyframes grainShift {
  0% { transform: translate(0, 0); }
  50% { transform: translate(-2%, 1%); }
  100% { transform: translate(1%, -1%); }
}

.vignette-overlay {
  position: fixed; inset: 0; z-index: 9997; pointer-events: none;
  background: radial-gradient(ellipse 100% 100% at 50% 45%, transparent 55%, rgba(0, 0, 0, 0.35) 100%);
}

.ocean-bg {
  position: fixed; bottom: 0; left: 0; width: 100%; height: 280px;
  z-index: 0; pointer-events: none; overflow: hidden;
}
/**
 * Anchored to the foot of the document rather than the foot of the viewport.
 *
 * The portfolio can leave the waves fixed because its sections each paint their
 * own background over them. A single flowing document has no such layer, so a
 * fixed band would ride up behind running text and take the contrast with it.
 * Requires `position: relative` on the body.
 */
.ocean-bg.anchored { position: absolute; }
.wave { position: absolute; bottom: 0; left: -50%; width: 200%; height: 120px; border-radius: 40% 45% 0 0; }
.wave-1 { background: linear-gradient(180deg, var(--wave1-from), var(--wave1-to)); animation: waveMove 8s ease-in-out infinite; bottom: 0; }
.wave-2 { background: linear-gradient(180deg, var(--wave2-from), var(--wave2-to)); animation: waveMove 10s ease-in-out infinite reverse; bottom: 15px; }
.wave-3 { background: linear-gradient(180deg, var(--wave3-from), var(--wave3-to)); animation: waveMove 12s ease-in-out infinite; bottom: 30px; }
@keyframes waveMove {
  0%, 100% { transform: translateX(0) scaleY(1); }
  50% { transform: translateX(-6%) scaleY(1.12); }
}

.particles { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.particle { position: absolute; border-radius: 50%; opacity: 0; animation: particleFloat 10s infinite ease-in-out; }
@keyframes particleFloat {
  0% { opacity: 0; transform: translateY(100vh) scale(0.4); }
  10%, 90% { opacity: 0.7; }
  100% { opacity: 0; transform: translateY(-10vh) scale(1.1); }
}
@keyframes twinkle {
  0%, 100% { opacity: 0.2; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.5); }
}

/* ------------------------------------------------------------ preloader */
.preloader {
  position: fixed; inset: 0; z-index: 10001;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(ellipse 70% 60% at 50% 40%, rgba(226, 55, 68, 0.15), transparent 70%),
    var(--night-ocean);
  transition: opacity 0.8s ease, visibility 0.8s ease;
  animation: preloaderFailsafe 0.7s ease 6s forwards;
}
.preloader.done { animation: none; opacity: 0; visibility: hidden; pointer-events: none; }
@keyframes preloaderFailsafe { to { opacity: 0; visibility: hidden; } }

.preloader-inner { display: flex; flex-direction: column; align-items: center; gap: 22px; padding: 24px; }
.preloader-logo-wrap { position: relative; width: 140px; height: 140px; display: flex; align-items: center; justify-content: center; }
.preloader-logo {
  width: 110px; height: auto; z-index: 2;
  filter: drop-shadow(0 0 18px rgba(226, 55, 68, 0.35)) drop-shadow(0 0 30px rgba(245, 200, 66, 0.15));
  animation: markBob 3s ease-in-out infinite, markGlow 2.2s ease-in-out infinite;
}
.preloader-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--crimson-light);
  border-right-color: var(--gold);
  animation: spin 1.1s linear infinite;
}
.preloader-title {
  font-family: 'Cinzel', var(--font-pirate); font-weight: 900;
  letter-spacing: 0.32em; font-size: clamp(0.85rem, 2.4vw, 1.15rem);
  background: var(--treasure-gradient);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  padding-left: 0.32em;
}
.preloader-bar { width: min(240px, 70vw); height: 4px; border-radius: 4px; background: rgba(245, 200, 66, 0.12); overflow: hidden; }
.preloader-bar span { display: block; height: 100%; width: 0%; border-radius: 4px; background: var(--accent-gradient); box-shadow: 0 0 12px rgba(245, 200, 66, 0.5); transition: width 0.25s ease; }
.preloader-text { font-family: var(--font-mono); font-size: 0.78rem; color: var(--text-muted); letter-spacing: 0.05em; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes markBob { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
@keyframes markGlow {
  0%, 100% { filter: drop-shadow(0 0 14px rgba(226, 55, 68, 0.30)) drop-shadow(0 0 26px rgba(245, 200, 66, 0.12)); }
  50% { filter: drop-shadow(0 0 22px rgba(226, 55, 68, 0.6)) drop-shadow(0 0 40px rgba(245, 200, 66, 0.22)); }
}

/* ------------------------------------------------------------ navbar */
.navbar { position: fixed; top: 0; left: 0; right: 0; z-index: 1000; padding: 16px 0; transition: all var(--transition-base); }
.navbar.scrolled {
  padding: 10px 0;
  background: var(--nav-bg);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.4), 0 0 20px var(--glow-gold);
}
/* Pages whose content sits under the bar from the first pixel (the 3D stage,
   the viewer) never get an unscrolled state to fade in from. */
.navbar.always-solid {
  padding: 10px 0;
  background: var(--nav-bg);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
}
.nav-container {
  max-width: var(--container-width); margin: 0 auto; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.nav-logo {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-pirate); font-size: clamp(1rem, 2.5vw, 1.5rem);
  transition: transform var(--transition-fast); white-space: nowrap;
}
.nav-logo:hover { transform: scale(1.05); filter: drop-shadow(0 0 8px rgba(245, 200, 66, 0.4)); }
.nav-logo-img {
  width: 34px; height: 34px; object-fit: contain;
  filter: drop-shadow(0 0 6px rgba(226, 55, 68, 0.35));
  animation: markBob 3s ease-in-out infinite, markGlow 2.6s ease-in-out infinite;
  transition: transform var(--transition-fast);
}
.nav-logo:hover .nav-logo-img { transform: scale(1.12) rotate(4deg); }
.logo-text {
  background: var(--treasure-gradient);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.nav-links { display: flex; align-items: center; gap: 4px; }
.nav-link {
  font-size: 0.9rem; font-weight: 500; color: var(--text-secondary);
  padding: 8px 16px; border-radius: var(--radius-sm);
  transition: all var(--transition-fast); position: relative;
}
.nav-link:hover, .nav-link.active { color: var(--gold); }
.nav-link.active { background: rgba(245, 200, 66, 0.1); }
.nav-link::after {
  content: ''; position: absolute; bottom: 2px; left: 50%; width: 0; height: 2px;
  background: var(--treasure-gradient); border-radius: 2px;
  transition: width 0.3s, left 0.3s;
}
.nav-link:hover::after, .nav-link.active::after { width: 60%; left: 20%; }

.nav-note {
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.04em;
  color: var(--text-muted); opacity: 0.75; text-align: right; max-width: 30ch; line-height: 1.4;
}

.nav-toggle { display: none; flex-direction: column; gap: 5px; background: none; border: none; cursor: pointer; padding: 8px; z-index: 1001; }
.nav-toggle span { width: 24px; height: 2px; background: var(--gold); border-radius: 2px; transition: all var(--transition-base); }
.nav-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
.nav-toggle.active span:nth-child(2) { opacity: 0; }
.nav-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

/* ------------------------------------------------------------ theme toggle */
.theme-toggle {
  position: fixed; bottom: 28px; right: 28px; z-index: 1002;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent-gradient);
  border: 2px solid var(--border-hover);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem; color: #fff;
  box-shadow: 0 4px 20px rgba(220, 53, 69, 0.3), 0 0 20px rgba(245, 200, 66, 0.15);
  transition: all var(--transition-base);
  backdrop-filter: blur(10px);
}
.theme-toggle:hover { transform: scale(1.1) rotate(15deg); box-shadow: 0 6px 35px rgba(220, 53, 69, 0.5), 0 0 40px rgba(245, 200, 66, 0.25); }
.theme-toggle .icon-sun, .theme-toggle .icon-moon { position: absolute; transition: all 0.3s ease; }
.theme-toggle .icon-sun { opacity: 0; transform: rotate(-90deg) scale(0.5); }
.theme-toggle .icon-moon { opacity: 1; transform: rotate(0deg) scale(1); }
[data-theme="light"] .theme-toggle .icon-sun { opacity: 1; transform: rotate(0deg) scale(1); }
[data-theme="light"] .theme-toggle .icon-moon { opacity: 0; transform: rotate(90deg) scale(0.5); }
[data-theme="light"] .theme-toggle { background: linear-gradient(135deg, #f5c842, #e6b422); border-color: rgba(201, 153, 26, 0.4); box-shadow: 0 4px 20px rgba(201, 153, 26, 0.3); }

/* ------------------------------------------------------------ type & sections */
.section { padding: var(--section-padding) 0; position: relative; z-index: 1; }
.section-header { text-align: center; margin-bottom: 56px; }
.section-tag { font-family: var(--font-pirate); font-size: 1rem; color: var(--gold-dark); display: block; margin-bottom: 10px; letter-spacing: 0.05em; }
.section-title { font-family: var(--font-display); font-size: clamp(1.8rem, 4vw, 2.8rem); font-weight: 800; margin: 0 0 10px; text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2); }
.section-subtitle { font-size: 1rem; color: var(--text-secondary); margin: 0; }

.hero-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 20px;
  background: rgba(245, 200, 66, 0.1);
  border: 1px solid rgba(245, 200, 66, 0.25);
  border-radius: 50px; font-size: 0.85rem; font-weight: 500;
  color: var(--gold); margin-bottom: 24px;
}
.badge-dot { width: 8px; height: 8px; background: #00d26a; border-radius: 50%; animation: pulseDot 2s ease-in-out infinite; }
@keyframes pulseDot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(0, 210, 106, 0.4); }
  50% { box-shadow: 0 0 0 6px rgba(0, 210, 106, 0); }
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 800; line-height: 1.15; margin: 0 0 20px;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}
.hero-alias {
  display: block; font-family: var(--font-mono); font-weight: 500;
  font-size: clamp(0.7rem, 1.4vw, 0.95rem); letter-spacing: 0.08em;
  color: var(--text-muted); margin-top: 8px; opacity: 0.85;
}

/* ------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 28px; border-radius: 50px;
  font-family: var(--font-primary); font-size: 0.95rem; font-weight: 600;
  cursor: pointer; transition: all var(--transition-base); border: none;
  position: relative; overflow: hidden;
}
.btn-primary { background: var(--accent-gradient); color: #fff; box-shadow: 0 4px 20px rgba(220, 53, 69, 0.3), 0 0 20px rgba(245, 200, 66, 0.15); }
.btn-primary:hover { box-shadow: 0 6px 35px rgba(220, 53, 69, 0.5), 0 0 40px rgba(245, 200, 66, 0.25); transform: translateY(-3px); }
.btn-secondary { background: transparent; color: var(--gold); border: 1px solid var(--border-hover); }
.btn-secondary:hover { background: rgba(245, 200, 66, 0.1); transform: translateY(-3px); box-shadow: 0 4px 20px rgba(245, 200, 66, 0.15); }

/* ------------------------------------------------------------ cards */
.treasure-card {
  background: linear-gradient(135deg, var(--card-gradient-from), var(--card-gradient-to));
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  transition: all var(--transition-base);
  position: relative; overflow: hidden;
}
.treasure-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--treasure-gradient); opacity: 0;
  transition: opacity var(--transition-base); z-index: 3;
}
.treasure-card:hover {
  background: linear-gradient(135deg, var(--card-hover-from), var(--card-hover-to));
  border-color: var(--border-hover);
  transform: translateY(-6px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 40px var(--glow-gold), inset 0 1px 0 rgba(245, 200, 66, 0.1);
}
.treasure-card:hover::before { opacity: 1; }
[data-theme="light"] .treasure-card:hover {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08), 0 0 40px rgba(201, 153, 26, 0.1), inset 0 1px 0 rgba(201, 153, 26, 0.15);
}

/* ------------------------------------------------------------ reveal & entrance */
.reveal { opacity: 0; transform: translateY(40px); transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1); }
.reveal.visible { opacity: 1; transform: translateY(0); }

.animate-fade-up { opacity: 0; transform: translateY(30px); animation: fadeUp 0.8s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
.delay-1 { animation-delay: 0.15s; }
.delay-2 { animation-delay: 0.3s; }
.delay-3 { animation-delay: 0.45s; }
.delay-4 { animation-delay: 0.6s; }
.delay-5 { animation-delay: 0.75s; }
@keyframes fadeUp { to { opacity: 1; transform: translateY(0); } }

@keyframes cardPop {
  0% { opacity: 0; transform: translateY(64px) scale(0.9); }
  60% { opacity: 1; transform: translateY(-8px) scale(1.02); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.pop { animation: cardPop 0.8s var(--spring) both; }

/* ------------------------------------------------------------ iris wipe */
.iris-wipe {
  position: fixed; inset: 0; z-index: 100000; pointer-events: none;
  clip-path: circle(0% at var(--ix, 50%) var(--iy, 50%));
  transition: clip-path 0.55s cubic-bezier(0.83, 0, 0.17, 1);
  background: var(--iris-color, #120a0d);
}
.iris-wipe.go { clip-path: circle(150% at var(--ix, 50%) var(--iy, 50%)); }

/* ------------------------------------------------------------ footer */
.footer { background: var(--footer-bg); border-top: 1px solid var(--border-color); padding: 40px 0; position: relative; z-index: 1; }
.footer-content { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.footer-text { color: var(--text-muted); font-size: 0.85rem; margin: 0; }

@media (max-width: 860px) {
  :root { --section-padding: 68px; }
  .nav-note { display: none; }
  .nav-links { gap: 0; }
  .nav-link { padding: 8px 10px; font-size: 0.82rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .reveal, .animate-fade-up { opacity: 1; transform: none; }
  .grain-overlay { animation: none; }
}
