/* ==========================================================
   DECRYPT V4 — BASE
   ========================================================== */

@font-face {
  font-family: 'Agrandir';
  src: url('../assets/fonts/Agrandir-Wide.woff2') format('woff2'),
       url('../assets/fonts/Agrandir-Wide.woff') format('woff');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Agrandir';
  src: url('../assets/fonts/Agrandir-Regular.woff2') format('woff2'),
       url('../assets/fonts/Agrandir-Regular.woff') format('woff');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  position: relative;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--c-text);
  background:
    radial-gradient(circle at 78% 18%, var(--bg-4) 0%, transparent 24%),
    radial-gradient(circle at 18% 82%, var(--bg-5) 0%, transparent 26%),
    radial-gradient(circle at 50% 46%, var(--bg-6) 0%, transparent 20%),
    linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
  overflow-x: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  transition: background var(--t-theme), color var(--t-theme);
  isolation: isolate;
}

html {
  background: var(--c-bg);
}

body.loading { overflow: hidden; }
body.lock-scroll { overflow: hidden; }

html::before,
html::after,
body::before,
body::after,
.page::before {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: 0;
}

html::before {
  inset: -16% -10% 25% -10%;
  background-image:
    linear-gradient(to right, var(--c-border) 1px, transparent 1px),
    linear-gradient(to bottom, var(--c-border) 1px, transparent 1px);
  background-size: 44px 44px;
  background-position: center;
  mask-image: radial-gradient(ellipse at 50% 0%, black 0%, black 36%, transparent 78%);
  opacity: 0.55;
}

html::after {
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' viewBox='0 0 180 180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3CfeComponentTransfer%3E%3CfeFuncA type='table' tableValues='0 0.18'/%3E%3C/feComponentTransfer%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='0.9'/%3E%3C/svg%3E");
  background-size: 180px 180px;
  opacity: 0.5;
  mix-blend-mode: soft-light;
}

body::before {
  top: -10%;
  right: -8%;
  width: 42rem;
  height: 42rem;
  border-radius: 50%;
  background: rgba(18, 128, 58, 0.30);
  filter: blur(90px);
  opacity: 0.9;
}

body::after {
  left: -12%;
  bottom: -12%;
  width: 40rem;
  height: 40rem;
  border-radius: 50%;
  background: rgba(156, 240, 176, 0.24);
  filter: blur(90px);
  opacity: 0.9;
}

.page::before {
  top: 28%;
  left: 50%;
  width: 32rem;
  height: 32rem;
  border-radius: 50%;
  background: rgba(245, 158, 11, 0.10);
  transform: translateX(-50%);
  filter: blur(92px);
  opacity: 0.65;
}

.page {
  position: relative;
  z-index: 1;
}

.header,
main,
footer,
.section,
.chamber,
#egg-toast,
#decrypt-ai-widget {
  position: relative;
  z-index: 1;
}

[data-theme="light"] body::before,
[data-theme="light"] body::after,
[data-theme="light"] .page::before {
  opacity: 0.34;
}

[data-theme="light"] html::before {
  opacity: 0.42;
}

[data-theme="light"] html::after {
  opacity: 0.35;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
img, video { max-width: 100%; display: block; }
ul { list-style: none; }

h1, h2, h3, .display {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 0.98;
  text-transform: uppercase;
}

.label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c-text-secondary);
}

:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 3px; }
::selection { background: var(--c-accent); color: var(--c-black); }

.skip-link {
  position: fixed; top: -100px; left: 16px; z-index: 10000;
  background: var(--c-white); color: var(--c-black);
  padding: 10px 16px; font-family: var(--font-mono); font-size: 0.85rem;
  transition: top var(--t-fast);
}
.skip-link:focus { top: 16px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ---------- Custom cursor (from reference, theme-aware) ---------- */
.cursor {
  position: fixed;
  width: 26px; height: 26px;
  display: none;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--c-accent);
  background: transparent;
  border-radius: 50%;
  pointer-events: none;
  z-index: var(--z-cursor);
  transform: translate(-50%, -50%);
  transition: color var(--t-fast), background var(--t-fast), width 0.25s ease, height 0.25s ease;
  mix-blend-mode: difference;
}
.cursor.expanded {
  width: 44px; height: 44px;
  background: var(--c-accent);
  color: var(--c-black);
  mix-blend-mode: normal;
  opacity: 0.9;
}
@media (pointer: fine) {
  .cursor { display: flex; }
  body, a, button { cursor: none; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  [data-reveal] { opacity: 1; transform: none; }
  .cursor { display: none !important; }
  body, a, button { cursor: auto; }
}
