/* ============================================================
   AVISHKAARI PORTFOLIO — BASE STYLES
   Reset, typography, global utilities
   ============================================================ */

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

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
  font-size: 16px;
}

body {
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.6;
  overflow-x: hidden;
  cursor: auto;
  transition: background-color 0.5s var(--ease-out), color 0.5s var(--ease-out);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--accent3);
  border-radius: 2px;
}

/* --- Selection --- */
::selection {
  background: rgba(var(--accent-rgb), 0.25);
  color: var(--text);
}

/* --- Noise texture overlay --- */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.72' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 800;
  opacity: 0.028;
  mix-blend-mode: overlay;
}

/* --- Progress bar --- */
#progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent3), var(--accent), var(--accent2));
  z-index: calc(var(--z-nav) + 1);
  transition: width 0.1s linear;
  box-shadow: 0 0 12px var(--glow);
}

/* --- Typography scale --- */
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 700; line-height: 1.1; }
h1 { font-size: clamp(40px, 7vw, 88px); }
h2 { font-size: clamp(28px, 4vw, 52px); }
h3 { font-size: clamp(20px, 2.5vw, 28px); }
p  { font-family: var(--font-body); font-weight: 300; }

/* --- Links --- */
a {
  color: inherit;
  text-decoration: none;
  cursor: auto;
}

/* --- Buttons base --- */
button {
  font-family: var(--font-head);
  cursor: auto;
  border: none;
  background: none;
}

/* --- Images --- */
img {
  display: block;
  max-width: 100%;
  height: auto;
}

/* --- Section wrapper --- */
.section-wrap {
  padding: var(--section-py) var(--section-px);
}
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  width: 100%;
}

/* --- Section label --- */
.section-label {
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-label::before {
  content: '';
  display: block;
  width: 24px;
  height: 1px;
  background: var(--accent);
  flex-shrink: 0;
}

/* --- Section title --- */
.section-title {
  font-family: var(--font-head);
  font-size: clamp(30px, 4vw, 52px);
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-head);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
  padding: 15px 34px;
  border-radius: 5px;
  cursor: auto;
  text-decoration: none;
  transition:
    transform var(--t-fast) var(--ease-out),
    box-shadow var(--t-med) ease,
    background var(--t-med) ease,
    border-color var(--t-med) ease;
  position: relative;
  overflow: hidden;
}
.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,255,255,0.07);
  opacity: 0;
  transition: opacity var(--t-fast);
}
.btn:hover::after { opacity: 1; }
.btn:hover { transform: translateY(-2px); }
.btn:active { transform: translateY(0); }

.btn-primary {
  background: var(--accent);
  color: var(--bg);
  border: 1.5px solid var(--accent);
}
.btn-primary:hover {
  box-shadow: 0 0 40px var(--glow), 0 8px 32px rgba(var(--accent-rgb), 0.25);
}

.btn-secondary {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border2);
}
.btn-secondary:hover {
  border-color: var(--border3);
  background: var(--surface2);
}

.btn-ghost {
  background: transparent;
  color: var(--text2);
  border: none;
  padding: 12px 0;
}
.btn-ghost:hover { color: var(--text); }

/* --- Magnetic button wrapper --- */
.magnetic {
  display: inline-block;
  position: relative;
}

/* --- Tag / Badge --- */
.tag {
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 5px 12px;
  border-radius: 100px;
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--text2);
  white-space: nowrap;
}

/* --- Social links row --- */
.social-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.social-icon {
  width: 38px; height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text2);
  cursor: auto;
  text-decoration: none;
  transition:
    background var(--t-med) ease,
    border-color var(--t-med) ease,
    color var(--t-med) ease,
    transform var(--t-fast) var(--ease-out);
}
.social-icon:hover {
  background: var(--surface2);
  border-color: var(--border2);
  color: var(--text);
  transform: translateY(-3px);
}

/* --- Scroll-reveal base --- */
.reveal {
  opacity: 0;
  transform: translateY(44px);
  transition:
    opacity 0.9s var(--ease-out),
    transform 0.9s var(--ease-out);
}
.reveal.visible {
  opacity: 1;
  transform: none;
}
.reveal-delay-1 { transition-delay: 0.08s; }
.reveal-delay-2 { transition-delay: 0.16s; }
.reveal-delay-3 { transition-delay: 0.24s; }
.reveal-delay-4 { transition-delay: 0.32s; }
.reveal-delay-5 { transition-delay: 0.40s; }

/* --- Split text spans (set by JS) --- */
.split-word {
  display: inline-block;
  overflow: hidden;
  vertical-align: bottom;
}
.split-char {
  display: inline-block;
  transform: translateY(110%);
  transition: transform 0.7s var(--ease-out);
}
.split-visible .split-char { transform: translateY(0); }

/* Add staggered delays per char via JS inline style */

/* --- Theme toggle button --- */
#theme-toggle {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: calc(var(--z-nav) - 1);
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: auto;
  transition:
    background var(--t-med) ease,
    border-color var(--t-med) ease,
    transform var(--t-fast) var(--ease-out),
    box-shadow var(--t-med) ease;
  color: var(--text2);
}
#theme-toggle:hover {
  background: var(--surface3);
  border-color: var(--border3);
  transform: scale(1.08) rotate(15deg);
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  color: var(--text);
}

/* --- Availability badge --- */
.avail-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-head);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #4ade80;
  background: rgba(74, 222, 128, 0.08);
  border: 1px solid rgba(74, 222, 128, 0.2);
  padding: 7px 14px;
  border-radius: 100px;
}
.avail-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #4ade80;
  animation: pulse-green 2s infinite;
}
@keyframes pulse-green {
  0%, 100% { box-shadow: 0 0 0 0 rgba(74,222,128,0.5); }
  50%       { box-shadow: 0 0 0 5px rgba(74,222,128,0); }
}

/* ---- Footer shared ---- */
footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 60px var(--section-px) 36px;
}
.footer-inner { max-width: var(--max-w); margin: 0 auto; }
.footer-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 48px;
  margin-bottom: 48px;
  flex-wrap: wrap;
}
.footer-logo {
  font-family: var(--font-display);
  font-size: 30px;
  letter-spacing: 6px;
  color: var(--text);
  text-decoration: none;
  cursor: auto;
}
.footer-logo span { color: var(--accent); }
.footer-tagline {
  font-size: 13px;
  color: var(--text3);
  margin-top: 6px;
}
.footer-links {
  display: flex;
  gap: 48px;
  flex-wrap: wrap;
}
.footer-col h4 {
  font-family: var(--font-head);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 16px;
}
.footer-col ul { list-style: none; }
.footer-col ul li { margin-bottom: 10px; }
.footer-col ul a {
  font-size: 14px;
  color: var(--text2);
  text-decoration: none;
  cursor: auto;
  transition: color var(--t-fast);
}
.footer-col ul a:hover { color: var(--text); }
.footer-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 28px;
  border-top: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 16px;
}
.footer-copy { font-size: 13px; color: var(--text3); }

/* --- Responsive base --- */
@media (max-width: 768px) {
  body { cursor: auto; }
  #theme-toggle { bottom: 20px; right: 20px; }
  .footer-top { flex-direction: column; }
  .footer-bottom { flex-direction: column; text-align: center; }
  .footer-links { gap: 28px; }
}

/* ============================================================
   SCROLL PERFORMANCE OPTIMISATIONS
   ============================================================ */

/* Native smooth scroll for devices where Lenis is disabled */
html {
  scroll-behavior: smooth;
  overscroll-behavior: none;
}

/* Force GPU layer on cards — prevents repaint during scroll */
.project-card,
.service-card,
.testi-card,
.h-scroll-card,
.tool-card {
  will-change: transform;
  transform: translateZ(0);
}

/* Contain layout for major sections */
.section-wrap,
.h-scroll-section,
.clients-section {
  contain: layout style;
}

/* Prevent scroll jank from font rendering */
body {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeSpeed;
}
