/* =========================================================
   Yujan Chalise: portfolio styles
   1 Tokens   2 Base   3 Loader & HUD   4 Header   5 Hero
   6 Sections 7 Marquee 8 Cards   9 Contact  10 Motion & fallbacks
   ========================================================= */

/* ---------- 1. TOKENS: change a colour here, it changes everywhere ---------- */
:root {
  --bg: #05070f;
  --text: #e8ecf5;
  --muted: #8b95ab;
  --line: rgba(255, 255, 255, 0.1);
  --accent: #6ee7ff;   /* cyan   */
  --accent2: #a78bfa;  /* violet */
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --pad: clamp(20px, 5vw, 64px);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- 2. BASE ---------- */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* soft coloured glows that stay fixed while you scroll */
  background:
    radial-gradient(1200px 700px at 85% -10%, rgba(167, 139, 250, 0.18), transparent 60%),
    radial-gradient(900px 600px at -10% 45%, rgba(110, 231, 255, 0.1), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}

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

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

.skip {
  position: fixed; top: -60px; left: 16px; z-index: 200;
  background: var(--accent); color: var(--bg);
  padding: 10px 16px; border-radius: 8px; font-weight: 600; text-decoration: none;
}
.skip:focus { top: 16px; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }

#stage {                         /* the 3D drawing board, behind everything */
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 0; display: block;
}
main, .site-footer { position: relative; z-index: 1; }

/* ---------- 3. LOADER, PROGRESS BAR, CURSOR ---------- */
.loader { display: none; }
.js .loader {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  background: var(--bg);
  transition: opacity 0.7s var(--ease), visibility 0.7s;
}
.loader span {
  font-size: 4rem; font-weight: 800; letter-spacing: -0.05em;
  color: var(--accent);
  animation: pulse 1.2s ease-in-out infinite;
}
.is-ready .loader { opacity: 0; visibility: hidden; }

.progress {
  position: fixed; top: 0; left: 0; right: 0; height: 3px; z-index: 60;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transform: scaleX(0); transform-origin: left;
}

.cursor {
  position: fixed; top: 0; left: 0; z-index: 90;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1.5px solid var(--accent);
  pointer-events: none; opacity: 0;
  transition: opacity 0.3s, width 0.3s var(--ease), height 0.3s var(--ease), background 0.3s;
}
.cursor.on  { opacity: 0.9; }
.cursor.big { width: 64px; height: 64px; background: rgba(110, 231, 255, 0.12); }
@media (pointer: coarse) { .cursor { display: none; } }

/* ---------- 4. HEADER ---------- */
.site-header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; justify-content: space-between; align-items: center;
  padding: 18px var(--pad);
  background: linear-gradient(to bottom, rgba(5, 7, 15, 0.8), transparent);
}
.brand { font-weight: 800; font-size: 1.25rem; letter-spacing: -0.03em; text-decoration: none; }

.site-header nav ul { display: flex; gap: 28px; list-style: none; margin: 0; padding: 0; }
.site-header nav a {
  font-family: var(--mono); font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 0.1em; text-decoration: none; color: var(--muted);
  transition: color 0.3s;
}
.site-header nav a:hover,
.site-header nav a[aria-current] { color: var(--accent); }

/* ---------- 5. HERO ---------- */
.hero {
  position: relative; min-height: 100svh;
  display: flex; flex-direction: column; justify-content: center;
  padding: 120px var(--pad) 90px;
}
.hero-inner { width: 100%; max-width: 1200px; margin: 0 auto; }

.eyebrow {
  font-family: var(--mono); font-size: 0.8rem; text-transform: uppercase;
  letter-spacing: 0.18em; color: var(--accent); margin: 0 0 1.2rem;
}

.title {
  margin: 0; font-weight: 800;
  font-size: clamp(3.4rem, 13vw, 10.5rem);
  letter-spacing: -0.05em; line-height: 1;
}
.line { display: block; overflow: hidden; padding: 0.04em 0; }

.lead { max-width: 34ch; margin: 1.6rem 0 2rem; color: var(--muted); font-size: clamp(1.05rem, 1.6vw, 1.35rem); }

.actions { display: flex; flex-wrap: wrap; gap: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 14px 28px; border-radius: 999px;
  background: var(--text); color: var(--bg);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.3s var(--ease), background 0.3s, color 0.3s, box-shadow 0.3s, border-color 0.3s;
}
.btn:hover { transform: translateY(-3px); background: var(--accent); box-shadow: 0 12px 40px -12px rgba(110, 231, 255, 0.7); }
.btn.ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--accent); color: var(--accent); background: rgba(110, 231, 255, 0.06); box-shadow: none; }

.scroll-hint {
  position: absolute; bottom: 28px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-family: var(--mono); font-size: 0.65rem; text-transform: uppercase;
  letter-spacing: 0.2em; color: var(--muted); text-decoration: none;
}
.scroll-hint i {
  width: 1px; height: 46px; background: linear-gradient(var(--accent), transparent);
  animation: drop 1.8s var(--ease) infinite; transform-origin: top;
}

/* ---------- 6. SECTIONS ---------- */
.section { padding: clamp(90px, 16vh, 180px) var(--pad); }
.wrap { max-width: 1200px; margin: 0 auto; }

h2 {
  margin: 0 0 0.6em; font-weight: 700;
  font-size: clamp(2rem, 5vw, 4rem); line-height: 1.05; letter-spacing: -0.03em;
}
.section p { color: var(--muted); font-size: 1.08rem; }

/* About: text sits on the right so the 3D shape can sit on the left */
.about { min-height: 100svh; display: flex; align-items: center; }
.about .wrap { width: 100%; }
.about .inner { max-width: 560px; }
@media (min-width: 900px) { .about .inner { margin-left: auto; } }

.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 2.4rem 0 0; padding-top: 1.6rem; border-top: 1px solid var(--line); }
.facts div { min-width: 0; }
.facts dt { font-family: var(--mono); font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); }
.facts dd { margin: 0.3em 0 0; font-weight: 600; }

/* ---------- 7. MARQUEE (endless scrolling skills) ---------- */
.skills { padding-inline: 0; }
.skills .wrap { padding-inline: var(--pad); margin-bottom: 40px; }

.marquee {
  overflow: hidden;
  border-block: 1px solid var(--line);
  padding: 26px 0;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}
.track { display: flex; width: max-content; animation: marquee 32s linear infinite; }
.marquee:hover .track { animation-play-state: paused; }
.track ul { display: flex; gap: 56px; padding-right: 56px; margin: 0; list-style: none; }
.track li {
  font-size: clamp(1.8rem, 4.5vw, 3.4rem); font-weight: 700; letter-spacing: -0.03em;
  color: transparent; -webkit-text-stroke: 1px var(--muted); white-space: nowrap;
  transition: color 0.3s, -webkit-text-stroke-color 0.3s;
}
.track li:hover { color: var(--accent); -webkit-text-stroke-color: var(--accent); }

/* ---------- 8. CARDS ---------- */
.cards {
  list-style: none; margin: 48px 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px;
}
.card {
  position: relative; overflow: hidden; height: 100%; min-height: 300px;
  display: flex; flex-direction: column; padding: 28px;
  border: 1px solid var(--line); border-radius: 22px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.015));
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: transform 0.25s ease-out, border-color 0.3s;
}
.card::before {                  /* light that follows your mouse */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 50%), rgba(110, 231, 255, 0.16), transparent 45%);
  transition: opacity 0.3s;
}
.card:hover { border-color: rgba(110, 231, 255, 0.45); }
.card:hover::before { opacity: 1; }
.card > * { position: relative; }
.card .num { font-family: var(--mono); font-size: 0.8rem; color: var(--accent); margin-bottom: auto; }
.card h3 { margin: 48px 0 0.4em; font-size: 1.55rem; letter-spacing: -0.02em; }
.card p { margin: 0; font-size: 0.98rem; }
.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 0; padding: 0; }
.tags li { font-family: var(--mono); font-size: 0.7rem; padding: 4px 11px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); }

/* ---------- 9. CONTACT + FOOTER ---------- */
.contact { min-height: 100svh; display: flex; align-items: center; }
.contact .wrap { width: 100%; }
.contact .wrap > * { max-width: 640px; }
.big { font-size: clamp(2.4rem, 7vw, 5.6rem); letter-spacing: -0.04em; }
.status { min-height: 1.6em; margin-top: 14px; color: var(--accent) !important; font-family: var(--mono); font-size: 0.85rem !important; }

.site-footer { padding: 28px var(--pad); border-top: 1px solid var(--line); text-align: center; background: rgba(5, 7, 15, 0.7); }
.site-footer p { margin: 0; color: var(--muted); font-size: 0.85rem; }

/* ---------- 10. MOTION, FALLBACKS, PHONES ---------- */
/* Hidden at first, slide up when scrolled into view. Only if JavaScript works. */
.js .reveal { opacity: 0; transform: translateY(30px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
.js .reveal.in { opacity: 1; transform: none; }

/* Hero name: every letter slides up from behind a mask */
.js .char { display: inline-block; transform: translateY(115%); opacity: 0; transition: transform 1s var(--ease), opacity 1s var(--ease); }
.is-ready .char { transform: none; opacity: 1; }

@keyframes pulse   { 50% { opacity: 0.35; transform: scale(0.94); } }
@keyframes drop    { 0% { transform: scaleY(0); } 60% { transform: scaleY(1); opacity: 1; } 100% { transform: scaleY(1); opacity: 0; } }
@keyframes marquee { to { transform: translateX(-50%); } }

/* If 3D can't run (old phone, blocked), hide the empty board. Page still looks good. */
.no-3d #stage { display: none; }

@media (max-width: 700px) {
  #stage { opacity: 0.5; }                       /* dim the 3D so text stays readable */
  .hero { justify-content: flex-end; }
  .site-header nav ul { gap: 14px; }
  .site-header nav a { font-size: 0.66rem; letter-spacing: 0.06em; }
  .facts { grid-template-columns: 1fr; gap: 14px; }
}

/* Respect people who get dizzy from motion (system setting) */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition-duration: 0.01ms !important; transition-delay: 0s !important; }
  .js .reveal { opacity: 1; transform: none; }
  .loader { display: none !important; }
}
