/* ─────────────────────────────────────────────────────────────
   Reed's Raghouse — shared site details
   Loaded on every page after the page's own styles.
   ───────────────────────────────────────────────────────────── */

:root {
  --rr-purple: #9050d0;
  --rr-black: #0a0a0a;


  /* Shared rhythm used across pages */
  --rr-space-section: clamp(64px, 9vw, 120px);
  --rr-gutter: 24px;
}

/* ── CONSISTENT BASE SIZING ── */
html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

/* ── TEXT SELECTION ── */
::selection { background: var(--rr-purple); color: #fff; }
::-moz-selection { background: var(--rr-purple); color: #fff; }

/* ── SLIM PURPLE SCROLLBAR ── */
html {
  scrollbar-width: thin;
  scrollbar-color: var(--rr-purple) var(--rr-black);
}
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--rr-black); }
::-webkit-scrollbar-thumb { background: var(--rr-purple); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #a46ae0; }

/* ── FILM GRAIN (static, very low opacity) ──
   Kept still on purpose: a full-screen layer that moves every frame
   makes scrolling stutter, especially on phones. */
html body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.07'/%3E%3C/svg%3E");
  background-repeat: repeat;
  opacity: 0.5;
}

/* ── SECTION FADE-UP ── */
.rr-fade {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1), transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}
.rr-fade.rr-in { opacity: 1; transform: none; }

/* ── CUSTOM CURSOR (desktop with a mouse only) ── */
.rr-cursor { display: none; }

@media (hover: hover) and (pointer: fine) {
  html.rr-cursor-on,
  html.rr-cursor-on *:not(textarea):not(input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]):not([type="button"])) { cursor: none !important; }

  html.rr-cursor-on .rr-cursor {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10000;
    width: 10px;
    height: 10px;
    margin: -5px 0 0 -5px;
    border-radius: 50%;
    background: var(--rr-purple);
    border: 1.5px solid var(--rr-purple);
    pointer-events: none;
    opacity: 0;
    transition: width 0.22s ease, height 0.22s ease, margin 0.22s ease,
                background-color 0.22s ease, opacity 0.2s ease;
  }
  html.rr-cursor-on .rr-cursor.rr-visible { opacity: 1; }
  html.rr-cursor-on .rr-cursor.rr-ring {
    width: 38px;
    height: 38px;
    margin: -19px 0 0 -19px;
    background: transparent;
  }
  /* Typing fields keep the normal text cursor */
  html.rr-cursor-on .rr-cursor.rr-hide { opacity: 0; }
}


/* ── INTRO SCREEN ── */
/* Covers the page until the intro is built (with a safety fade if scripts fail) */
html.rr-intro-on::after {
  content: '';
  position: fixed; inset: 0; z-index: 10050;
  background: #0a0a0a;
  animation: rr-intro-failsafe 0.3s ease 2.5s forwards;
}
html.rr-intro-ready::after { display: none; }
@keyframes rr-intro-failsafe { to { opacity: 0; visibility: hidden; } }

.rr-intro {
  position: fixed; inset: 0; z-index: 10060;
  background: #0a0a0a;
  overflow: hidden;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}
.rr-intro-swing {
  position: absolute; top: 0; left: 50%;
  display: flex; flex-direction: column; align-items: center;
  transform-origin: 50% 0;
  margin-left: -80px; width: 160px;
  transform: translateY(-110%) rotate(-12deg);
}
.rr-intro-go .rr-intro-swing {
  animation: rr-tag-drop 1.15s cubic-bezier(0.3, 0.7, 0.4, 1) both;
}
.rr-intro-string {
  display: block; width: 2px; height: calc(50vh - 120px);
  background: linear-gradient(#f4f0e8 0 0) center / 2px 100% no-repeat;
  opacity: 0.75;
}
.rr-intro-tag {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 160px; height: 200px; margin-top: -6px;
  padding: 40px 14px 18px;
  background: #9050d0;
  border-radius: 10px;
  clip-path: polygon(50% 0, 100% 16%, 100% 100%, 0 100%, 0 16%);
  box-shadow: 0 20px 40px rgba(0,0,0,0.5);
}
.rr-intro-hole {
  position: absolute; top: 14px; left: 50%;
  width: 14px; height: 14px; margin-left: -7px; border-radius: 50%;
  background: #0a0a0a;
}
.rr-intro-label {
  display: flex; align-items: center; justify-content: center;
  width: 132px; height: 74px;
  overflow: hidden;
}
/* Logo sits right on the tag; a soft dark outline keeps the gray letters and purple hanger readable */
.rr-intro-tag img {
  display: block; width: 136px; height: 136px; flex-shrink: 0;
  object-fit: contain;
  filter: drop-shadow(0 0 1px rgba(10,10,10,0.9)) drop-shadow(0 1px 2px rgba(10,10,10,0.6));
}
.rr-intro-skip {
  position: absolute; left: 0; right: 0; bottom: max(28px, env(safe-area-inset-bottom));
  text-align: center;
  font-family: 'Space Mono', monospace; font-size: 0.62rem; letter-spacing: 0.2em; text-transform: uppercase;
  color: #77747e;
  animation: rr-fade-in 0.4s ease 0.4s both;
}
@keyframes rr-fade-in { from { opacity: 0; } }

/* Drop in, then swing back and forth on the string and settle */
@keyframes rr-tag-drop {
  0%   { transform: translateY(-110%) rotate(-12deg); }
  38%  { transform: translateY(0) rotate(9deg); }
  56%  { transform: translateY(0) rotate(-6deg); }
  72%  { transform: translateY(0) rotate(3.5deg); }
  86%  { transform: translateY(0) rotate(-1.5deg); }
  100% { transform: translateY(0) rotate(0); }
}
.rr-intro.rr-intro-out { animation: rr-intro-up 0.5s cubic-bezier(0.7, 0, 0.2, 1) forwards; }
.rr-intro.rr-intro-out-fast { animation: rr-intro-up 0.3s cubic-bezier(0.7, 0, 0.2, 1) forwards; }
@keyframes rr-intro-up { to { transform: translateY(-100%); } }


/* ── BACK TO TOP ── */
.rr-top {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: calc(max(18px, env(safe-area-inset-bottom)) + var(--rr-top-lift, 0px));
  z-index: 150;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  width: 54px; height: 54px;
  padding: 0;
  border: 1.5px solid var(--rr-purple);
  border-radius: 50%;
  background: rgba(10, 10, 10, 0.88);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  color: #f4f0e8;
  font-family: 'Space Mono', monospace;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.9);
  transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0s linear 0.3s, background-color 0.2s ease, bottom 0.2s ease;
}
.rr-top.rr-top-show {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity 0.25s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0s, background-color 0.2s ease, bottom 0.2s ease;
}
.rr-top-label { font-size: 0.5rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; line-height: 1; }
.rr-top svg { display: block; margin-top: 2px; }
.rr-top:hover { background: var(--rr-purple); }
.rr-top:active { transform: scale(0.94); }
.rr-top:focus-visible { outline: 2px solid #f4f0e8; outline-offset: 3px; }
@media (max-width: 768px) {
  .rr-top { width: 48px; height: 48px; right: max(14px, env(safe-area-inset-right)); }
}
body:has(.nav-links.open) .rr-top { opacity: 0; visibility: hidden; }

/* ── REDUCED MOTION ── */
@media (prefers-reduced-motion: reduce) {
  .rr-fade { opacity: 1; transform: none; transition: none; }
  .rr-cursor { transition: none !important; }
  .rr-top { transition: none; transform: none; }
}
