/* The Drift — tristynloy.com */

:root {
  --ink: #eaf6ff;
  --ink-dim: rgba(234, 246, 255, 0.55);
  --accent: #c8ff3d;
  --accent-2: #ff5fb7;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
  --display: "Didot", "Bodoni 72", "Bodoni MT", "Playfair Display", Georgia, serif;
}

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

html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #04060d;
  color: var(--ink);
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

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

canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  display: block;
}

#water {
  background: radial-gradient(ellipse at 50% 60%, #0d2a3a 0%, #04060d 70%);
}

#life {
  cursor: crosshair;
  outline: none;
}

/* ---------- Rotating mandala text ---------- */

.mandala {
  position: fixed;
  left: 50%;
  top: 50%;
  width: min(92vmin, 760px);
  aspect-ratio: 1;
  translate: -50% -50%;
  pointer-events: none;
  mix-blend-mode: screen;
  opacity: 0.55;
}

.mandala svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.mandala text {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 2px;
  fill: var(--ink);
  text-transform: uppercase;
}

.ring {
  transform-origin: 200px 200px;
  transform-box: view-box;
}

.ring-a {
  animation: spin 80s linear infinite;
}

.ring-b {
  animation: spin 55s linear infinite reverse;
}

.ring-b text {
  fill: var(--accent);
  opacity: 0.7;
  font-size: 9px;
  letter-spacing: 3px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Title ---------- */

.title {
  position: fixed;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  text-align: center;
  pointer-events: none;
  transition: opacity 2.5s ease, filter 2.5s ease;
}

.title.is-faded {
  opacity: 0.12;
  filter: blur(2px);
}

.title-kicker {
  font-size: 0.68rem;
  letter-spacing: 0.5em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin-bottom: 0.8rem;
}

.title-main {
  position: relative;
  font-family: var(--display);
  font-size: clamp(3rem, 11vw, 9rem);
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 0.9;
  color: transparent;
  background: linear-gradient(100deg, #ffffff 10%, var(--accent) 35%, #7fe7ff 55%, var(--accent-2) 80%, #ffffff 95%);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  animation: sheen 9s ease-in-out infinite alternate, breathe 8s ease-in-out infinite;
  filter: drop-shadow(0 0 30px rgba(127, 231, 255, 0.35));
}

.title-main::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  color: transparent;
  -webkit-text-stroke: 1px rgba(234, 246, 255, 0.35);
  transform: scale(1.06);
  opacity: 0;
  animation: echo 8s ease-out infinite;
}

@keyframes sheen {
  from { background-position: 0% 50%; }
  to   { background-position: 100% 50%; }
}

@keyframes breathe {
  0%, 100% { transform: scale(0.985); }
  50%      { transform: scale(1.02); }
}

@keyframes echo {
  0%   { opacity: 0.6; transform: scale(1); }
  60%  { opacity: 0; transform: scale(1.35); }
  100% { opacity: 0; transform: scale(1.35); }
}

.title-sub {
  margin-top: 1.2rem;
  font-size: 0.7rem;
  letter-spacing: 0.4em;
  text-transform: lowercase;
  color: var(--accent);
  animation: blink 3.2s ease-in-out infinite;
}

@keyframes blink {
  0%, 100% { opacity: 0.35; }
  50%      { opacity: 1; }
}

/* ---------- HUD ---------- */

.hud,
.mood,
.credit {
  position: fixed;
  z-index: 5;
  font-size: 0.66rem;
  letter-spacing: 0.22em;
  text-transform: lowercase;
}

.hud-left {
  left: max(1.2rem, env(safe-area-inset-left));
  bottom: max(1.2rem, env(safe-area-inset-bottom));
  display: grid;
  gap: 0.45rem;
  pointer-events: none;
}

.hud-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.hud-link {
  color: var(--ink);
  text-decoration: none;
  pointer-events: auto;
}

.hud-link:hover #river-line,
.hud-link:focus-visible #river-line {
  color: var(--accent);
}

.hud-dim {
  color: var(--ink-dim);
}

.hud-dim #takes {
  color: var(--accent);
}

.hud-sep {
  opacity: 0.4;
}

.hud-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #6d7a85;
}

.hud-dot.is-live {
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  animation: pulse 2s ease-in-out infinite;
}

.hud-dot.is-stale {
  background: #ffb347;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

.mood {
  right: max(1.2rem, env(safe-area-inset-right));
  top: max(1.2rem, env(safe-area-inset-top));
  display: grid;
  justify-items: end;
  gap: 0.25rem;
  padding: 0.55rem 0.8rem;
  background: rgba(4, 6, 13, 0.35);
  border: 1px solid rgba(234, 246, 255, 0.18);
  border-radius: 999px;
  color: var(--ink);
  font-family: var(--mono);
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: border-color 0.3s ease;
}

.mood:hover,
.mood:focus-visible {
  border-color: var(--accent);
  outline: none;
}

.mood-label {
  font-size: 0.56rem;
  color: var(--ink-dim);
}

.mood-name {
  color: var(--accent);
}

.credit {
  right: max(1.2rem, env(safe-area-inset-right));
  bottom: max(1.2rem, env(safe-area-inset-bottom));
  color: var(--ink-dim);
}

.credit a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid rgba(234, 246, 255, 0.3);
}

.credit a:hover {
  color: var(--accent);
}

/* ---------- Take flash ---------- */

.take-flash {
  position: fixed;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  pointer-events: none;
  opacity: 0;
  background: radial-gradient(circle at var(--x, 50%) var(--y, 50%), rgba(200, 255, 61, 0.35), transparent 45%);
}

.take-flash span {
  font-family: var(--display);
  font-size: clamp(2.5rem, 9vw, 7rem);
  letter-spacing: 0.15em;
  color: #fff;
  text-shadow: 0 0 40px var(--accent), 0 0 80px var(--accent-2);
}

.take-flash.is-on {
  animation: take 1.6s ease-out;
}

@keyframes take {
  0%   { opacity: 0; transform: scale(1.3); }
  12%  { opacity: 1; transform: scale(1); }
  70%  { opacity: 0.8; }
  100% { opacity: 0; transform: scale(0.96); }
}

@media (max-width: 600px) {
  .hud,
  .mood,
  .credit {
    font-size: 0.58rem;
    letter-spacing: 0.14em;
  }

  .credit {
    bottom: auto;
    top: max(1.2rem, env(safe-area-inset-top));
    right: auto;
    left: max(1.2rem, env(safe-area-inset-left));
  }
}

@media (prefers-reduced-motion: reduce) {
  .ring-a,
  .ring-b,
  .title-main,
  .title-main::after,
  .title-sub,
  .hud-dot.is-live {
    animation: none;
  }
}
