/* ═══════════════════════════════════════════════════════════════
   Puzzles Time — Shared shell styles
   Design tokens, reset, custom cursor, preloader, nav, footer
   ═══════════════════════════════════════════════════════════════ */

:root {
  --ink:        #0a0908;
  --ink-2:      #15130f;
  --ink-3:      #1d1a14;
  --bone:       #ede7dd;
  --bone-2:     #d7d0c3;
  --bone-muted: #8a8375;
  --bone-dim:   #5a544a;
  --line:       rgba(237, 231, 221, 0.09);
  --line-2:     rgba(237, 231, 221, 0.16);
  --amber:      #d4a373;
  --amber-soft: rgba(212, 163, 115, 0.12);
  --ember:      #c2410c;
  --emerald:    #84cc16;

  --font-serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-sans:  'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:  'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --ease:      cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-snap: cubic-bezier(0.2, 0.9, 0.25, 1.15);
}

/* ═════════════════ RESET / BASE ═════════════════ */
*          { margin: 0; padding: 0; box-sizing: border-box; }
html       { scroll-behavior: smooth; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  font-family: var(--font-sans);
  background: var(--ink);
  color: var(--bone);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
  font-feature-settings: "ss01", "cv11", "kern";
  cursor: none;
}

a                   { color: inherit; text-decoration: none; cursor: none; }
button, input, summary { cursor: none; font: inherit; }
::selection         { background: var(--amber); color: var(--ink); }

/* ═════════════════ DOT GRID TEXTURE ═════════════════ */
body::before {
  content: '';
  position: fixed; inset: 0; z-index: -2;
  background-color: var(--ink);
  background-image: radial-gradient(circle at 1px 1px, rgba(237, 231, 221, 0.04) 1px, transparent 0);
  background-size: 24px 24px;
  pointer-events: none;
}
body::after {
  content: '';
  position: fixed; inset: 0; z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1000px 700px at 20% 0%, rgba(212, 163, 115, 0.08), transparent 65%),
    radial-gradient(800px 600px at 85% 40%, rgba(194, 65, 12, 0.05), transparent 60%);
}

/* ═════════════════ CUSTOM CURSOR ═════════════════ */
.cursor {
  position: fixed; top: 0; left: 0;
  width: 8px; height: 8px;
  background: var(--amber);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  mix-blend-mode: exclusion;
  transition: width 0.2s var(--ease), height 0.2s var(--ease), background 0.2s var(--ease);
  will-change: transform;
}
.cursor.hover {
  width: 36px; height: 36px;
  background: var(--amber);
  opacity: 0.3;
}
.cursor-ring {
  position: fixed; top: 0; left: 0;
  width: 36px; height: 36px;
  border: 1px solid rgba(212, 163, 115, 0.4);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  transition: transform 0.35s var(--ease), width 0.3s, height 0.3s, border-color 0.3s;
  will-change: transform;
}
@media (hover: none) {
  .cursor, .cursor-ring { display: none; }
  body, a, button, input, summary { cursor: auto; }
}

/* ═════════════════ PRELOADER ═════════════════ */
.preloader {
  position: fixed; inset: 0;
  background: var(--ink);
  z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  transition: opacity 0.8s ease, visibility 0.8s;
}
.preloader.done { opacity: 0; visibility: hidden; }
.preloader-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: 44px; height: 44px;
}
.preloader-grid span {
  width: 100%; height: 100%;
  background: var(--amber);
  border-radius: 2px;
  opacity: 0;
  animation: snapIn 1.6s var(--ease-snap) forwards;
}
.preloader-grid span:nth-child(1) { animation-delay: 0.00s; }
.preloader-grid span:nth-child(2) { animation-delay: 0.08s; }
.preloader-grid span:nth-child(3) { animation-delay: 0.16s; }
.preloader-grid span:nth-child(6) { animation-delay: 0.24s; }
.preloader-grid span:nth-child(9) { animation-delay: 0.32s; }
.preloader-grid span:nth-child(8) { animation-delay: 0.40s; }
.preloader-grid span:nth-child(7) { animation-delay: 0.48s; }
.preloader-grid span:nth-child(4) { animation-delay: 0.56s; }
.preloader-grid span:nth-child(5) { animation-delay: 0.64s; background: var(--ember); }
@keyframes snapIn {
  0%   { opacity: 0; transform: scale(0); }
  60%  { opacity: 1; transform: scale(1.2); }
  100% { opacity: 1; transform: scale(1); }
}

/* ═════════════════ NAV ═════════════════ */
nav {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 50;
  padding: 24px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: background 0.3s var(--ease), border-color 0.3s var(--ease), padding 0.3s var(--ease);
  border-bottom: 1px solid transparent;
}
nav.scrolled {
  background: rgba(10, 9, 8, 0.75);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-bottom-color: var(--line);
  padding: 16px 40px;
}
.brand {
  display: flex; align-items: center; gap: 12px;
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 1.08rem;
  letter-spacing: -0.01em;
}
.brand-mark {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2.5px;
  width: 22px; height: 22px;
}
.brand-mark i {
  display: block;
  width: 100%; aspect-ratio: 1;
  background: var(--amber);
  border-radius: 1px;
}
.brand-mark i:nth-child(5) { background: var(--ember); }

.nav-right   { display: flex; align-items: center; gap: 28px; }
.nav-meta {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--bone-muted);
  letter-spacing: 0.02em;
  display: flex; align-items: center; gap: 10px;
}
.nav-meta .live-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 10px var(--emerald);
  animation: blink 2.4s infinite;
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.3; }
}

.nav-links       { display: flex; align-items: center; gap: 28px; list-style: none; }
.nav-links a {
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--bone-muted);
  transition: color 0.2s var(--ease);
  position: relative;
}
.nav-links a:hover  { color: var(--bone); }
.nav-links a.active { color: var(--amber); }
.nav-links a.active::before {
  content: '';
  position: absolute;
  left: -12px; top: 50%;
  width: 5px; height: 5px;
  background: var(--amber);
  border-radius: 50%;
  transform: translateY(-50%);
}

.nav-pill {
  padding: 9px 18px;
  border: 1px solid var(--line-2);
  border-radius: 100px;
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.25s var(--ease);
  display: inline-flex; align-items: center; gap: 8px;
}
.nav-pill:hover {
  background: var(--bone);
  color: var(--ink);
  border-color: var(--bone);
}
.nav-pill svg          { transition: transform 0.25s var(--ease); }
.nav-pill:hover svg    { transform: translate(2px, -2px); }

/* ═════════════════ FOOTER ═════════════════ */
footer {
  border-top: 1px solid var(--line);
  padding: 60px 40px 40px;
  position: relative;
}
.footer-giant {
  font-family: var(--font-serif);
  font-weight: 300;
  font-size: clamp(4rem, 15vw, 12rem);
  line-height: 0.82;
  letter-spacing: -0.05em;
  color: var(--ink);
  -webkit-text-stroke: 1px var(--bone-dim);
  text-align: center;
  padding: 40px 0 60px;
  font-variation-settings: "opsz" 144;
  transition: color 0.4s var(--ease);
  cursor: none;
}
.footer-giant:hover {
  color: var(--amber);
  -webkit-text-stroke: 1px var(--amber);
}
.footer-giant em { font-style: italic; font-weight: 200; }

.footer-grid {
  max-width: 1440px; margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 40px;
  padding-top: 40px;
  border-top: 1px solid var(--line);
}
.footer-col h4 {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  color: var(--bone-muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 18px;
  font-weight: 500;
}
.footer-col ul   { list-style: none; }
.footer-col li   { margin-bottom: 10px; }
.footer-col a {
  color: var(--bone-2);
  font-size: 0.95rem;
  transition: color 0.2s;
}
.footer-col a:hover { color: var(--amber); }

.footer-bottom {
  max-width: 1440px; margin: 40px auto 0;
  padding-top: 32px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--bone-muted);
  letter-spacing: 0.03em;
}

/* ═════════════════ SHARED RESPONSIVE ═════════════════ */
@media (max-width: 1024px) {
  nav          { padding: 20px 28px; }
  nav.scrolled { padding: 14px 28px; }
  .nav-meta    { display: none; }
}
@media (max-width: 720px) {
  .nav-links    { display: none; }
  footer        { padding: 40px 20px 30px; }
  .footer-grid  { grid-template-columns: 1fr 1fr; }
  .footer-bottom { flex-direction: column; gap: 10px; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
