/*
 * polish.css — UX compliance from skills:
 *   - focus-visible rings (ui-ux-pro-max: accessibility CRITICAL)
 *   - touch targets 44px minimum (ui-ux-pro-max: CRITICAL)
 *   - prefers-reduced-motion (ui-ux-pro-max: HIGH)
 *   - smooth transitions 150-300ms (ui-ux-pro-max: MEDIUM)
 *   - line-height 1.5-1.75 body text (ui-ux-pro-max: MEDIUM)
 *   - section stagger entrance (frontend-design: staggered reveals)
 *   - spatial breathing room (frontend-design: generous negative space)
 * Loaded absolutely last.
 */

/* ── Focus-visible: keyboard users get a visible ring, mouse users don't ─ */
*:focus { outline: none; }
*:focus-visible {
  outline: 2px solid rgba(255,255,255,0.9);
  outline-offset: 3px;
  border-radius: 3px;
}
button:focus-visible,
a:focus-visible,
[role="button"]:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 3px;
}

/* ── Body text: proper line-height and readable sizes ──────────────────── */
/* (html base = 62.5%, 1rem = 10px, body = 1.6rem = 16px) */
body {
  line-height: 1.65;
}
p, li, .about-paragraph, .project-desc, .conn-value,
.signal-about-line, .analyzer-intro p {
  line-height: 1.68;
  max-width: 72ch; /* 65-75 char line length — ui-ux-pro-max guideline */
}

/* Section containers — ensure content doesn't touch edges */
#page-wrapper > section:not(#hero) > .container {
  /* Slightly extra top padding so text clears the HUD hairline comfortably */
  padding-top: 1rem !important;
}

/* ── All interactive elements: minimum 44×44px touch target ──────────── */
.social-link,
.project-btn,
.filter-btn,
.contact-link,
[role="button"],
.ig-social-btn {
  min-height: 4.4rem;
  min-width: 4.4rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Transition timing: 150-300ms for micro-interactions ───────────────── */
a, button, .project-card, .analyzer-card, .dc-panel,
.hud-nav-link, .page-arrow-btn, .social-link {
  transition-duration: 0.2s !important;
  transition-timing-function: ease !important;
}

/* ── Spatial composition: section header more room ─────────────────────── */
.section-header {
  padding-top: 0.8rem;
}
.section-title {
  font-size: 1.0rem !important;    /* 10px — film credit label at uppercase */
}

/* Project cards: readable description */
.project-title { font-size: 1.8rem !important; }
.project-desc  { font-size: 1.35rem !important; }

/* About section: proper readable sizes */
.signal-about-line {
  font-size: 1.7rem !important;
  line-height: 1.7;
}
.sig-name {
  font-size: clamp(2.8rem, 5vw, 4.4rem) !important;
}

/* ── prefers-reduced-motion — disable all animations/transitions ─────── */
@media not all and (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  /* Cursor: hide the custom cursor entirely, show system cursor */
  #ink-cursor-dot,
  #ink-cursor-ring { display: none !important; }
  * { cursor: auto !important; }

  /* Shader: blur-out to static */
  #shader-bg { display: none !important; }

  /* Grain / vignette: still show, they're static */
  #grain-overlay, #vignette-overlay { opacity: 0.03 !important; }
}

/* ── Mobile responsive: readable font sizes (floor at 16px effective) ─── */
@media (max-width: 768px) {
  body { font-size: 1.6rem; }

  .cine-title {
    font-size: clamp(3rem, 13vw, 8rem) !important;
  }

  /* About: stack vertically on mobile */
  .about-merged-content {
    flex-direction: column !important;
    gap: 2.4rem !important;
  }
  .about-sig-card, .about-text {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Projects grid: single column */
  .projects-grid {
    grid-template-columns: 1fr !important;
  }

  /* Stats grid */
  .analyzer-cards {
    grid-template-columns: 1fr 1fr !important;
  }
  .analyzer-lower {
    flex-direction: column !important;
  }

  /* Contact: stack */
  .discord-layout {
    flex-direction: column !important;
    gap: 2rem !important;
  }
  .dc-card, .dc-panels {
    width: 100% !important;
  }

  /* Nav: tighter */
  .hud-nav-link {
    padding: 0.5rem 0.7rem !important;
    font-size: 0.9rem !important;
    letter-spacing: 0.1em !important;
  }
}

@media (max-width: 480px) {
  /* Stats: single column on very small screens */
  .analyzer-cards {
    grid-template-columns: 1fr !important;
  }
  /* Hide some HUD items on tiny screens */
  .hud-nav-link:not(.active):nth-child(n+4) {
    display: none;
  }
}

/* ── No horizontal scroll guarantee ─────────────────────────────────────── */
body, html {
  overflow-x: hidden !important;
  max-width: 100vw;
}

/* ── Section entrance animation override from creative.css ─────────────── */
.stagger-item {
  will-change: opacity, transform;
}

/* ── High-contrast text on dark for readability ─────────────────────────── */
.conn-value,
.dc-tag,
.project-title,
.analyzer-card .card-value {
  color: #ffffff !important;
}
.conn-label,
.project-lang,
.dc-status-label,
.analyzer-card .card-label {
  color: rgba(255,255,255,0.52) !important;
}

/* ── Loading spinners: make sure they're visible against shader ──────────── */
.weave-spinner {
  opacity: 0.7;
}

/* ── Performance: skip rendering offscreen sections ────────────────────────
   content-visibility lets the browser skip layout+paint for sections that
   are nowhere near the viewport. contain-intrinsic-size reserves space so
   the scrollbar doesn't jump. */
#page-wrapper > section,
body > section {
  content-visibility: auto;
  contain-intrinsic-size: 1px 900px;
}
/* Hero must render immediately for LCP */
#hero {
  content-visibility: visible;
  contain-intrinsic-size: auto;
}

/* ── Mobile: drop expensive filters + static background ───────────────────── */
@media (max-width: 820px), (pointer: coarse) {
  /* Heavy GPU filters — cap or disable */
  .hud, .dc-card, .dc-panel, .analyzer-card,
  .pc-card, .project-card, .contact-hub-card,
  #ig-modal-overlay, .terminal-block, .contrib-graph-wrap {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }
  /* Disable the perspective floor grid on mobile (scroll parallax cost) */
  .cine-floor-grid { display: none !important; }
  /* Kill the noise overlay animation */
  .noise-overlay, #grain-overlay { animation: none !important; }
  /* Nothing should will-change unless transitioning */
  .stagger-item { will-change: auto; }
  /* Disable expensive text-shadow glows */
  .cine-title, .name-glitch, .sig-name { text-shadow: none !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════
   CINEMATIC CLEANUP — strip chalk doodles, sketched underlines, scene tags
   and marginalia from the ink.css layer. Keep only the essential editorial
   typography + the WebGL shader background.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Hero: remove the radar/compass diagram (::before) and the marginalia
   squiggle + "scroll" doodle (::after). */
.hero-section::before,
.hero-section::after {
  display: none !important;
  content: none !important;
  background: none !important;
}

/* The giant "ND" monogram behind the hero title — clutter */
.cine-hero-content::before {
  display: none !important;
  content: none !important;
}

/* "00 — THE QUAZAR / v4" scene-tag above the title */
.cine-hero-content::after {
  display: none !important;
  content: none !important;
}

/* Wavy hand-drawn underline under "The Quazar" — replace with a clean rule */
.cine-title::after {
  background: none !important;
  height: 2px !important;
  width: min(220px, 34%) !important;
  background-color: rgba(255,255,255,0.85) !important;
  margin-top: 0.55em !important;
  opacity: 0.9;
}

/* Wavy scribble under the nav links (Work / Reach out) — clean underline */
.cine-link {
  background: none !important;
  border-bottom: 1px solid rgba(255,255,255,0.35) !important;
  padding-bottom: 4px !important;
  transition: border-color 200ms ease, color 200ms ease, transform 200ms ease !important;
}
.cine-link:hover {
  border-bottom-color: #fff !important;
}

/* Scribbled section separators → clean hairline */
.section-line {
  background: rgba(255,255,255,0.25) !important;
  height: 1px !important;
}
.section-line::before { display: none !important; content: none !important; }
/* ::after is used by fx.css for the traveling glow — keep it alive */

/* Any residual marginalia on other sections */
section::before[class*="doodle"],
section::after[class*="doodle"],
.marginalia, .doodle, .chalk-sketch { display: none !important; }

/* ── Reduced motion: disable every animation/transition ──────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .cine-floor-grid, .noise-overlay, #grain-overlay,
  #shader-bg, .avatar-glitch::before, .avatar-glitch::after { display: none !important; }
}
