* { box-sizing: border-box; }
  html, body { margin: 0; padding: 0; background: #ece8dd; }
  body { font-family: 'Inter', system-ui, sans-serif; }
  ::selection { background: #c6311a; color: #fff; }
  button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
  .grain::before {
    content: '';
    position: fixed; inset: 0;
    pointer-events: none;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.5 0'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='0.5'/></svg>");
    opacity: 0.06;
    mix-blend-mode: multiply;
    z-index: 1000;
  }
  #tweak-panel {
    position: fixed; bottom: 80px; right: 20px; z-index: 9999;
    background: rgba(12,12,12,0.95); backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.15); color: #f2efe6;
    padding: 16px; font-family: 'JetBrains Mono', monospace;
    font-size: 11px; letter-spacing: 0.1em; min-width: 240px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  }
  #tweak-panel h4 { margin: 0 0 12px; font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase; opacity: 0.6; }
  .tweak-row { margin-bottom: 14px; }
  .tweak-row-label { opacity: 0.6; text-transform: uppercase; font-size: 9px; letter-spacing: 0.25em; margin-bottom: 6px; }
  .tweak-btn-group { display: flex; gap: 4px; flex-wrap: wrap; }
  .tweak-btn { flex: 1; background: transparent; border: 1px solid rgba(255,255,255,0.2); color: #f2efe6; padding: 6px 8px; font-family: inherit; font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; cursor: pointer; }
  .tweak-btn.active { color: #fff; }
  .toast {
    position: fixed; top: 24px; right: 24px; z-index: 9999;
    background: #0a0a0a; color: #ece8dd; padding: 12px 16px;
    border: 1px solid rgba(0,0,0,0.15);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px; letter-spacing: 0.15em; text-transform: uppercase;
    animation: toastin 0.2s ease-out;
  }
  @keyframes toastin { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

  /* ── Glitch system (hover-driven) ─────────────────────────────────── */
  /* BigLogo: SVG displacement filter ("waterdrop"). Idle = scale 0 (no
     distortion). Hover = scale animates up then settles, like a stone
     dropped in water — letters briefly ripple/warp. */
  .logo-glitch { position: relative; display: block; }
  .logo-glitch .logo-stack { position: relative; display: block; }
  .logo-glitch .logo-stack > img,
  .logo-glitch .logo-stack > .logo-fallback {
    display: block; width: 100%; height: auto;
    filter: url(#massivan-ripple);
  }

  /* Camera-flash burst at the cursor on hover-enter.
     Centered at (left, top) — inline-styled by JS — radial white-hot core
     fading through accent halo to transparent. Single 600ms pop. */
  .logo-flash {
    position: absolute;
    width: 1200px; height: 1200px;
    margin-left: -600px; margin-top: -600px;
    pointer-events: none;
    border-radius: 50%;
    background: radial-gradient(
      circle at center,
      rgba(255,255,255,1) 0%,
      rgba(255,255,255,0.85) 4%,
      rgba(255,240,230,0.55) 10%,
      rgba(198,49,26,0.35) 22%,
      rgba(198,49,26,0.12) 38%,
      rgba(198,49,26,0) 60%
    );
    mix-blend-mode: screen;
    opacity: 0;
    animation: logoFlash 600ms cubic-bezier(.2, .9, .25, 1) forwards;
    z-index: 5;
  }
  @keyframes logoFlash {
    0%   { opacity: 0;   transform: scale(0.15); }
    8%   { opacity: 1;   transform: scale(0.55); }
    25%  { opacity: 0.9; transform: scale(0.85); }
    60%  { opacity: 0.4; transform: scale(1.05); }
    100% { opacity: 0;   transform: scale(1.2); }
  }

  /* Section titles: glitch on hover. Three layered copies (r / c / main) */
  .glitch-title { position: relative; display: inline-block; }
  .glitch-title > .gt-main  { position: relative; display: inline-block; transition: transform 0.2s; }
  .glitch-title > .gt-ghost {
    position: absolute; left: 0; top: 0; pointer-events: none;
    color: inherit; font: inherit; letter-spacing: inherit; text-transform: inherit;
    white-space: pre-wrap; opacity: 0;
  }
  .glitch-title > .gt-ghost.gt-r { color: #c6311a; mix-blend-mode: multiply; }
  .glitch-title > .gt-ghost.gt-c { color: #1da0c3; mix-blend-mode: multiply; }

  @keyframes gtMainSkew {
    0%   { transform: translate(0, 0) skewX(0); }
    25%  { transform: translate(-2px, 0) skewX(-1.5deg); }
    50%  { transform: translate(2px, 0) skewX(1deg); }
    75%  { transform: translate(-1px, 0) skewX(0); }
    100% { transform: translate(0, 0) skewX(0); }
  }
  @keyframes gtR {
    0%, 100% { opacity: 0; transform: translate(0, 0); }
    20%      { opacity: 0.7; transform: translate(-4px, 1px); }
    45%      { opacity: 0.5; transform: translate(3px, -1px); }
    70%      { opacity: 0.3; transform: translate(-2px, 0); }
  }
  @keyframes gtC {
    0%, 100% { opacity: 0; transform: translate(0, 0); }
    20%      { opacity: 0.6; transform: translate(4px, -1px); }
    45%      { opacity: 0.4; transform: translate(-3px, 1px); }
    70%      { opacity: 0.25; transform: translate(2px, 0); }
  }
  .glitch-title:hover > .gt-main,
  .glitch-title.auto-glitch > .gt-main  { animation: gtMainSkew 0.6s ease-out; }
  .glitch-title:hover > .gt-ghost.gt-r,
  .glitch-title.auto-glitch > .gt-ghost.gt-r { animation: gtR 0.6s steps(2, end); }
  .glitch-title:hover > .gt-ghost.gt-c,
  .glitch-title.auto-glitch > .gt-ghost.gt-c { animation: gtC 0.6s steps(2, end); }

  @media (prefers-reduced-motion: reduce) {
    .logo-glitch:hover::before, .logo-glitch:hover::after, .logo-glitch:hover .logo-scan,
    .glitch-title:hover > .gt-main, .glitch-title:hover > .gt-ghost,
    .glitch-title.auto-glitch > .gt-main, .glitch-title.auto-glitch > .gt-ghost { animation: none !important; }
  }