:root {
  --void: #07070d;
  --ink: #121217;
  --cream: #fff7dc;
  --acid: #d7ff39;
  --hot: #ff3d7f;
  --aqua: #18f0ff;
  --orange: #ff8a00;
  --violet: #7a5cff;
  --line: rgba(255, 247, 220, 0.2);
  --font: "Space Grotesk", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --display: "Syne", "Space Grotesk", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  overflow-x: hidden;
  background: var(--void);
  color: var(--cream);
  font-family: var(--font);
}

main {
  overflow: hidden;
}

a,
button {
  color: inherit;
  font: inherit;
}

a {
  text-decoration: none;
}

button {
  cursor: pointer;
}

.scanlines {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  opacity: 0.12;
  background:
    linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    radial-gradient(circle at 14% 18%, rgba(215, 255, 57, 0.12), transparent 24%),
    radial-gradient(circle at 84% 24%, rgba(24, 240, 255, 0.12), transparent 20%);
  background-size: 100% 7px, 100% 100%, 100% 100%;
  mix-blend-mode: screen;
}

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px clamp(16px, 4vw, 54px);
  mix-blend-mode: difference;
}

.brand {
  font-family: var(--display);
  font-size: clamp(1.5rem, 3vw, 3rem);
  font-weight: 800;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: clamp(10px, 1.8vw, 24px);
  font-size: clamp(0.68rem, 0.9vw, 0.78rem);
  font-weight: 800;
  text-transform: uppercase;
}

.memory-hero {
  position: relative;
  min-height: 118svh;
  overflow: hidden;
  display: grid;
  align-items: start;
  padding: 112px clamp(16px, 4vw, 54px) 38px;
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 61, 127, 0.16), transparent 22%),
    radial-gradient(circle at 74% 32%, rgba(24, 240, 255, 0.14), transparent 26%),
    radial-gradient(circle at 58% 86%, rgba(215, 255, 57, 0.13), transparent 24%),
    var(--void);
}

#memory-canvas {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  top: clamp(310px, 38vh, 430px);
  width: 100%;
  height: auto;
  cursor: crosshair;
}

.memory-shell {
  position: relative;
  z-index: 4;
  width: min(1080px, calc(100vw - 32px));
  min-width: 0;
  pointer-events: none;
}

.kicker {
  margin: 0 0 14px;
  color: var(--acid);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.memory-shell h1,
.section-intro h2,
.relationship-reader h2 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(3.4rem, 8vw, 8.4rem);
  font-weight: 800;
  line-height: 0.78;
  text-transform: uppercase;
  white-space: nowrap;
  text-shadow:
    0.03em 0.02em 0 rgba(255, 61, 127, 0.88),
    -0.028em -0.02em 0 rgba(24, 240, 255, 0.78);
}

.memory-shell h1 {
  max-width: min(1040px, calc(100vw - 32px));
  font-size: clamp(2.9rem, 6.4vw, 6.65rem);
  line-height: 0.86;
  white-space: normal;
  overflow-wrap: normal;
}

.memory-shell p:not(.kicker) {
  max-width: 690px;
  margin: 18px 0 0;
  color: rgba(255, 247, 220, 0.78);
  font-size: clamp(0.98rem, 1.2vw, 1.08rem);
  line-height: 1.5;
}

.inspector {
  position: absolute;
  top: auto;
  bottom: 38px;
  right: clamp(16px, 4vw, 54px);
  z-index: 5;
  width: min(320px, calc(100% - 32px));
  padding: 12px;
  border: 1px solid var(--line);
  background: rgba(7, 7, 13, 0.24);
  backdrop-filter: blur(12px);
  box-shadow: 0 24px 74px rgba(0, 0, 0, 0.24);
  transition: opacity 220ms ease, transform 220ms ease;
  pointer-events: auto;
}

.inspector.is-hidden {
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
}

.inspector span,
.motif-grid span {
  color: var(--aqua);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.inspector-links span {
  text-transform: none;
}

.inspector h2 {
  margin: 10px 0 0;
  font-family: var(--display);
  font-size: clamp(1.08rem, 1.75vw, 1.72rem);
  line-height: 0.95;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.inspector p {
  margin: 14px 0 0;
  color: rgba(255, 247, 220, 0.72);
  font-size: 0.92rem;
  line-height: 1.45;
}

.inspector-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.inspector-links span,
.inspector-links a {
  border: 1px solid rgba(255, 247, 220, 0.26);
  border-radius: 999px;
  padding: 8px 10px;
  color: var(--cream);
  background: rgba(255, 247, 220, 0.05);
}

.inspector-links a {
  border-color: rgba(215, 255, 57, 0.56);
  color: var(--acid);
}

.memory-controls {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  overflow-x: hidden;
  max-width: 100vw;
  padding: 12px clamp(16px, 4vw, 54px);
  border-block: 1px solid var(--line);
  background: rgba(7, 7, 13, 0.76);
  backdrop-filter: blur(20px);
}

.view-toggle,
.filter-toggle {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.view-toggle {
  padding-right: 10px;
  border-right: 1px solid var(--line);
}

.memory-controls button {
  min-height: 42px;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 14px;
  background: rgba(255, 247, 220, 0.06);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

.memory-controls button.is-active {
  border-color: var(--acid);
  background: var(--acid);
  color: var(--ink);
}

.view-toggle button.is-active {
  border-color: var(--hot);
  background: var(--hot);
  color: var(--cream);
}

.resurfacing,
.relationship-reader {
  padding: clamp(72px, 10vw, 140px) clamp(16px, 4vw, 54px);
  text-align: center;
}

.section-intro {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(22px, 6vw, 90px);
  margin-bottom: clamp(36px, 7vw, 80px);
  justify-items: center;
  text-align: center;
}

.section-intro .kicker {
  text-align: center;
}

.section-intro h2,
.relationship-reader h2 {
  max-width: 980px;
  font-size: clamp(2.35rem, 5.8vw, 5.9rem);
  line-height: 0.9;
  text-align: center;
  white-space: normal;
  overflow-wrap: anywhere;
  margin-left: auto;
  margin-right: auto;
}

.motif-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
  gap: 1px;
  background: var(--line);
  overflow-x: hidden;
  max-width: 100%;
}

.motif-grid article {
  min-height: 330px;
  padding: 22px;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(255, 247, 220, 0.08), rgba(255, 247, 220, 0.02)),
    var(--ink);
}

.motif-grid h3 {
  max-width: 14ch;
  margin: 70px auto 0;
  font-family: var(--display);
  font-size: clamp(1.18rem, 1.75vw, 1.82rem);
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

.motif-grid p,
.relationship-reader p {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  color: rgba(255, 247, 220, 0.72);
  line-height: 1.55;
}

.relationship-reader {
  min-height: 70svh;
  background: var(--cream);
  color: var(--ink);
}

.relationship-reader .kicker {
  color: var(--hot);
}

.relationship-reader h2 {
  text-shadow:
    0.025em 0.018em 0 rgba(255, 61, 127, 0.42),
    -0.022em -0.016em 0 rgba(24, 240, 255, 0.5);
}

.relationship-reader p {
  margin-left: auto;
  margin-right: auto;
  color: rgba(18, 18, 23, 0.72);
  font-size: 1.1rem;
}

@media (max-width: 900px) {
  .inspector {
    position: absolute;
    right: 16px;
    bottom: 24px;
    margin-top: 0;
  }

  .memory-hero {
    align-items: start;
    min-height: 128svh;
  }

  #memory-canvas {
    top: 430px;
  }

  .section-intro {
    grid-template-columns: 1fr;
  }

  .motif-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .site-header {
    align-items: flex-start;
  }

  .nav {
    max-width: 230px;
    gap: 10px 14px;
    font-size: 0.64rem;
  }

  .memory-shell h1 {
    font-size: clamp(2.45rem, 11.5vw, 3.9rem);
    line-height: 0.9;
  }

  .memory-shell {
    max-width: calc(100vw - 32px);
  }
}
