/* ==========================================================================
   MindCrack — Base
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  background: var(--black);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: 'Josefin Sans', sans-serif;
  overflow-x: hidden;
  position: relative;
  color: var(--text);
  transition: background 0.6s var(--ease);
}

/* Body-level phase flags swap the ambient palette without re-theming every
   rule individually — see components.css for what reads these. */
body.phase-return { background: #050301; }

::selection { background: var(--deep-crimson); color: #fff; }

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

/* Visible, deliberate focus ring for keyboard users everywhere in the app */
:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ── BACKGROUND ── */
.bg-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}
.bg-layer::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 55% 40% at 50% 30%, rgba(100,10,10,0.22) 0%, transparent 65%),
    radial-gradient(ellipse 90% 50% at 50% 105%, rgba(50,5,5,0.4) 0%, transparent 65%);
  transition: background 0.8s var(--ease);
}
body.phase-return .bg-layer::before {
  background:
    radial-gradient(ellipse 55% 40% at 50% 30%, rgba(180,120,30,0.16) 0%, transparent 65%),
    radial-gradient(ellipse 90% 50% at 50% 105%, rgba(60,35,5,0.35) 0%, transparent 65%);
}
.bg-layer::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  opacity: 0.35;
}

/* ── HEADER ── */
.header-band {
  width: 100%;
  padding: 20px 24px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  z-index: 2;
  position: relative;
  border-bottom: 1px solid var(--border);
}
.header-band::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%);
  width: 70px;
  height: 1px;
  background: var(--gold);
  opacity: 0.35;
}
.brand-mark {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-line {
  width: 36px;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold-dim));
}
.brand-line.r { background: linear-gradient(to left, transparent, var(--gold-dim)); }

.app-title {
  font-family: 'Cinzel Decorative', serif;
  font-size: clamp(16px, 4.5vw, 26px);
  letter-spacing: 0.3em;
  color: var(--text);
  text-shadow: 0 0 18px var(--glow-red);
  animation: titleGlow var(--dur-slow) ease-in-out infinite;
}
.app-subtitle {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-weight: 300;
  font-size: clamp(9px, 2vw, 11px);
  letter-spacing: 0.32em;
  color: var(--text-dim);
}

/* Corner utility buttons live inside the header without disturbing the
   centred brand mark */
.header-utility {
  position: absolute;
  top: 14px;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
}
.header-utility.left { left: 14px; }
.header-utility.right { right: 14px; }

/* ── MAIN ── */
.main {
  flex: 1;
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 26px 20px 18px;
  z-index: 2;
  position: relative;
}

/* ── FOOTER ── */
footer {
  width: 100%; z-index: 2; position: relative;
  padding: 12px 24px 14px;
  border-top: 1px solid var(--border);
  display: flex; flex-direction: column;
  align-items: center; gap: 4px;
}
.footer-inner {
  display: flex; align-items: center; gap: 10px;
}
.footer-dot { width: 3px; height: 3px; border-radius: 50%; background: var(--gold-dim); }
.footer-text {
  font-family: 'Cormorant Garamond', serif;
  font-size: 12px; letter-spacing: 0.22em; color: var(--text-dim);
}
.footer-copy {
  font-size: 8px; letter-spacing: 0.4em;
  color: var(--text-muted); text-transform: uppercase; opacity: 0.45;
}
