/* ============================================
   TAKEMY.LIFE — Shared Foundation
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&family=Crimson+Pro:ital,wght@0,400;0,700;1,400&display=swap');

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

/* --- Custom Properties --- */
:root {
  --black: #0a0a0a;
  --near-black: #111111;
  --dark-gray: #1a1a1a;
  --mid-gray: #2a2a2a;
  --muted: #3a3a3a;
  --text-dim: #555555;
  --text-faint: #333333;
  --text-subtle: #888888;
  --text-primary: #cccccc;
  --white: #e0e0e0;

  --red-dark: #3a0a0a;
  --red-muted: #661a1a;
  --red-glow: #aa2222;
  --red-bright: #cc3333;

  --green-dark: #0a1a0a;
  --green-muted: #1a331a;
  --green-terminal: #33aa33;

  --blue-dark: #0a0a1a;
  --blue-muted: #1a1a33;

  --font-mono: 'Share Tech Mono', 'Courier New', monospace;
  --font-serif: 'Crimson Pro', 'Georgia', serif;

  --noise-opacity: 0.03;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  background: var(--black);
  color: var(--text-primary);
  font-family: var(--font-mono);
  min-height: 100vh;
  overflow-x: hidden;
  cursor: default;
}

a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: var(--red-muted);
  color: var(--white);
}

/* --- Noise Overlay --- */
.noise::before {
  content: '';
  position: fixed;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  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='1'/%3E%3C/svg%3E");
  opacity: var(--noise-opacity);
  pointer-events: none;
  z-index: 9999;
  animation: noise-drift 0.5s steps(3) infinite;
}

/* --- Scanlines --- */
.scanlines::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(0, 0, 0, 0.08) 2px,
    rgba(0, 0, 0, 0.08) 4px
  );
  pointer-events: none;
  z-index: 9998;
}

/* --- Keyframes --- */
@keyframes noise-drift {
  0% { transform: translate(0, 0); }
  33% { transform: translate(-2px, 1px); }
  66% { transform: translate(1px, -1px); }
  100% { transform: translate(0, 0); }
}

@keyframes flicker {
  0%, 100% { opacity: 1; }
  4% { opacity: 0.9; }
  6% { opacity: 1; }
  12% { opacity: 0.85; }
  14% { opacity: 1; }
  50% { opacity: 1; }
  52% { opacity: 0.7; }
  54% { opacity: 1; }
  78% { opacity: 1; }
  80% { opacity: 0.9; }
  82% { opacity: 1; }
}

@keyframes pulse-dim {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.7; }
}

@keyframes pulse-glow {
  0%, 100% { text-shadow: 0 0 4px currentColor; }
  50% { text-shadow: 0 0 12px currentColor, 0 0 24px currentColor; }
}

@keyframes glitch-shift {
  0%, 100% { transform: translate(0); }
  20% { transform: translate(-2px, 1px); }
  40% { transform: translate(2px, -1px); }
  60% { transform: translate(-1px, -2px); }
  80% { transform: translate(1px, 2px); }
}

@keyframes glitch-clip {
  0% { clip-path: inset(0 0 95% 0); }
  10% { clip-path: inset(40% 0 30% 0); }
  20% { clip-path: inset(80% 0 0 0); }
  30% { clip-path: inset(10% 0 70% 0); }
  40% { clip-path: inset(60% 0 10% 0); }
  50% { clip-path: inset(0 0 50% 0); }
  60% { clip-path: inset(30% 0 40% 0); }
  70% { clip-path: inset(70% 0 5% 0); }
  80% { clip-path: inset(15% 0 60% 0); }
  90% { clip-path: inset(50% 0 20% 0); }
  100% { clip-path: inset(0 0 95% 0); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slow-rotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

@keyframes screen-tear {
  0%, 100% { transform: translateX(0); }
  5% { transform: translateX(40px); }
  6% { transform: translateX(0); }
  35% { transform: translateX(0); }
  36% { transform: translateX(-30px); }
  37% { transform: translateX(0); }
  70% { transform: translateX(0); }
  71% { transform: translateX(20px); }
  72% { transform: translateX(0); }
}

/* --- Utility Classes --- */
.flicker {
  animation: flicker 4s infinite;
}

.pulse-dim {
  animation: pulse-dim 6s ease-in-out infinite;
}

.glitch-text {
  position: relative;
}

.glitch-text::before,
.glitch-text::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.glitch-text::before {
  color: var(--red-glow);
  animation: glitch-clip 3s infinite linear alternate-reverse;
  left: 2px;
}

.glitch-text::after {
  color: var(--green-terminal);
  animation: glitch-clip 2s infinite linear alternate;
  left: -2px;
}

.hidden-link {
  color: var(--text-faint);
  transition: color 0.3s;
}

.hidden-link:hover {
  color: var(--text-dim);
}

.invisible-link {
  color: transparent;
  user-select: none;
}

.invisible-link:hover {
  color: var(--text-faint);
}

.typewriter {
  overflow: hidden;
  white-space: nowrap;
  border-right: 2px solid var(--text-dim);
}

.fade-in {
  animation: fade-in 2s ease-out forwards;
  opacity: 0;
}

.delay-1 { animation-delay: 1s; }
.delay-2 { animation-delay: 2s; }
.delay-3 { animation-delay: 3s; }
.delay-4 { animation-delay: 4s; }
.delay-5 { animation-delay: 5s; }
.delay-8 { animation-delay: 8s; }
.delay-12 { animation-delay: 12s; }

/* --- Scrollbar --- */
::-webkit-scrollbar {
  width: 4px;
}

::-webkit-scrollbar-track {
  background: var(--black);
}

::-webkit-scrollbar-thumb {
  background: var(--muted);
}

/* --- Mobile --- */
@media (max-width: 768px) {
  html { font-size: 14px; }
}

/* --- Seasonal Color Temperature --- */
body[data-season="winter"] {
  --text-primary: #b8c4cc;
}

body[data-season="autumn"] {
  --text-primary: #ccbba8;
}

body[data-season="summer"] {
  --text-primary: #ccc8b8;
}

/* --- Anniversary Mode (May 3rd) --- */
body.anniversary .vignette {
  box-shadow: inset 0 0 150px 60px rgba(0, 30, 0, 0.7) !important;
}

/* --- Time Period Adjustments --- */
body[data-time="dawn"] {
  --noise-opacity: 0.02;
}

body[data-time="latenight"],
body[data-time="witching"] {
  --noise-opacity: 0.05;
}
