/* ==========================================================================
   GILANG ROZAN — PORTFOLIO
   Core Stylesheet — Phase 1
   ========================================================================== */

:root {
  /* ---- Neo-Futuristic Premium — sitewide Design Bible (Sprint 2) ----
     Promoted from the Hero, which is now the reference for every
     section: Apple-level spacing, Linear-style product UI, Vercel
     elegance, subtle glassmorphism, soft gradients, restrained color. */
  --bg-main: #0B0F1A;
  --bg-surface: #10141F;
  --bg-elevated: #161B28;
  --stone: #93A0B4;
  --marble: #E7E9EE;
  --soft-white: #F5F6FA;
  --shadow: rgba(0, 0, 0, 0.6);

  --aurora-blue: #4C82FF;
  --aurora-violet: #8B5CF6;
  --aurora-teal: #2DD4BF;
  --gradient-accent: linear-gradient(100deg, var(--aurora-blue) 10%, var(--aurora-violet) 55%, var(--aurora-teal) 100%);
  --gradient-accent-2: linear-gradient(100deg, var(--aurora-blue), var(--aurora-violet));

  --glass-bg: rgba(255, 255, 255, 0.045);
  --glass-bg-strong: rgba(255, 255, 255, 0.075);
  --glass-border: rgba(255, 255, 255, 0.09);
  --glass-border-strong: rgba(255, 255, 255, 0.16);

  --border-hairline: rgba(255, 255, 255, 0.07);
  --border-hairline-strong: rgba(255, 255, 255, 0.14);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-full: 999px;

  --shadow-card: 0 24px 60px -28px rgba(0, 0, 0, 0.55);

  /* Typography — Space Grotesk (product-native, geometric) is now the
     sitewide display face, carried over from the Hero. Inter stays the
     body face throughout. */
  --font-display: 'Space Grotesk', 'Inter', sans-serif;
  --font-body: 'Inter', sans-serif;

  /* Spacing scale */
  --space-xs: 0.5rem;
  --space-sm: 1.1rem;
  --space-md: 2.4rem;
  --space-lg: 4.8rem;
  --space-xl: 8.5rem;
  --space-2xl: 13rem;

  /* Layout */
  --container-max: 1320px;
  --nav-height: 88px;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-in-out: cubic-bezier(0.65, 0, 0.35, 1);
  --dur-fast: 240ms;
  --dur-med: 560ms;
  --dur-slow: 1100ms;
  --ease-cinematic: cubic-bezier(0.22, 1, 0.36, 1);
  --dur-cinematic: 1400ms;

  /* Aliases kept for backward compatibility with anything still
     referencing the old metal/glass names from Sprint 1 — same values,
     new names, nothing else needs to change. */
  --metal: #9AA2AD;
  --metal-dim: rgba(154, 162, 173, 0.18);
}

/* ==========================================================================
   RESET
   ========================================================================== */

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Set by js/ambient.js (Page Visibility API) — pauses every continuous
   decorative animation site-wide the instant the tab isn't visible, and
   resumes exactly where it left off when it's shown again. */
html.is-tab-hidden *,
html.is-tab-hidden *::before,
html.is-tab-hidden *::after {
  animation-play-state: paused !important;
}

body {
  background: var(--bg-main);
  color: var(--soft-white);
  font-family: var(--font-body);
  font-weight: 300;
  line-height: 1.6;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.no-scroll {
  overflow: hidden;
}

img, svg, canvas {
  display: block;
  max-width: 100%;
}

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

button {
  font-family: inherit;
  background: none;
  border: none;
  cursor: pointer;
  color: inherit;
}

ul, ol {
  list-style: none;
}

/* ==========================================================================
   UTILITIES
   ========================================================================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  background: var(--soft-white);
  color: var(--bg-main);
  padding: 0.75rem 1.25rem;
  z-index: 999;
  font-family: var(--font-body);
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  transition: top var(--dur-fast) var(--ease-out);
  border-radius: 2px;
}

.skip-link:focus {
  top: 1rem;
}

:focus-visible {
  outline: 1.5px solid var(--aurora-blue);
  outline-offset: 3px;
}

/* ==========================================================================
   CURSOR GLOW
   A soft, low-intensity light that trails the cursor — an ambient cue,
   never a spotlight. Interpolated in script.js; this file only sets
   the visual treatment.
   ========================================================================== */

.cursor-glow {
  position: fixed;
  top: 0;
  left: 0;
  width: 760px;
  height: 760px;
  margin-left: -380px;
  margin-top: -380px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(76, 130, 255, 0.05) 0%, rgba(139, 92, 246, 0.025) 42%, transparent 72%);
  pointer-events: none;
  z-index: 40;
  opacity: 0;
  transition: opacity 900ms var(--ease-out);
  will-change: transform;
}

.cursor-glow.is-active {
  opacity: 0.6;
}

@media (hover: none), (pointer: coarse) {
  .cursor-glow {
    display: none;
  }
}

/* ==========================================================================
   AMBIENT FIELD
   The sitewide "living background" — four slow, independently-timed
   blurred light blobs plus a faint animated grain, fixed behind every
   section so the page never goes visually dead once entrance animations
   finish. z-index: -1 keeps it behind all normal-flow content while still
   painting in front of the flat body background (see body { background }
   above). Pure opacity/transform — no layout, no paint of real content —
   so it costs nothing on the actual page it sits behind.
   ========================================================================== */

.ambient-field {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  /* Driven by js/ambient.js: a soft scene tint that eases as the visitor
     scrolls from section to section — Hero's blue/violet slowly warming
     toward Work's teal, then settling for Contact/Footer. Inert (0deg)
     until the scroll-scene observer assigns a value. */
  filter: hue-rotate(var(--scene-hue, 0deg));
  transition: filter 1400ms var(--ease-out);
}

.ambient-field__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(120px);
  opacity: 0.5;
  will-change: transform, opacity;
}

.ambient-field__blob--1 {
  width: 52vw;
  height: 52vw;
  max-width: 780px;
  max-height: 780px;
  top: -12%;
  left: -14%;
  background: radial-gradient(circle at 40% 40%, rgba(76, 130, 255, 0.30), transparent 68%);
  animation: fieldDriftA 34s ease-in-out infinite;
}

.ambient-field__blob--2 {
  width: 44vw;
  height: 44vw;
  max-width: 660px;
  max-height: 660px;
  top: 30%;
  right: -16%;
  background: radial-gradient(circle at 60% 40%, rgba(139, 92, 246, 0.24), transparent 68%);
  animation: fieldDriftB 41s ease-in-out infinite;
}

.ambient-field__blob--3 {
  width: 38vw;
  height: 38vw;
  max-width: 560px;
  max-height: 560px;
  bottom: -10%;
  left: 18%;
  background: radial-gradient(circle at 50% 50%, rgba(45, 212, 191, 0.16), transparent 70%);
  animation: fieldDriftC 47s ease-in-out infinite;
}

.ambient-field__blob--4 {
  width: 30vw;
  height: 30vw;
  max-width: 460px;
  max-height: 460px;
  top: 62%;
  right: 16%;
  background: radial-gradient(circle at 45% 55%, rgba(76, 130, 255, 0.18), transparent 70%);
  animation: fieldDriftD 39s ease-in-out infinite;
}

.ambient-field__grain {
  position: absolute;
  inset: -10%;
  opacity: 0.035;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 240px 240px;
  animation: fieldGrainDrift 22s linear infinite;
}

/* Pausing rather than removing keeps the exact same visual state ready
   to resume — used when the tab is hidden (js/ambient.js) and as the
   reduced-motion fallback below. */
.ambient-field.is-paused .ambient-field__blob,
.ambient-field.is-paused .ambient-field__grain {
  animation-play-state: paused;
}

@media (prefers-reduced-motion: reduce) {
  .ambient-field__blob,
  .ambient-field__grain {
    animation: none;
  }
}

/* ==========================================================================
   BUTTONS
   Shared component — Neo-Futuristic gradient/glass language, used
   everywhere: Nav's CTA, Hero's actions, the Contact form submit.
   ========================================================================== */

.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1.1rem 2.4rem;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  font-weight: 500;
  overflow: hidden;
  border-radius: var(--radius-md);
  /* --magnet-x/--magnet-y/--magnet-scale are written by js/interactions.js
     (magnetic pointer pull); they default to inert values so the button
     looks and behaves identically with JS disabled. Keeping the composition
     here — rather than JS ever touching `transform` directly — means the
     :active press state below can never be clobbered by the magnetic effect. */
  transform: translate3d(var(--magnet-x, 0px), var(--magnet-y, 0px), 0) scale(var(--magnet-scale, 1));
  transition: color var(--dur-med) var(--ease-out),
              border-color var(--dur-med) var(--ease-out),
              transform var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-med) var(--ease-out),
              opacity var(--dur-fast) var(--ease-out);
}

.btn span {
  position: relative;
  z-index: 2;
}

.btn:active {
  --magnet-scale: 0.98;
}

.btn--primary {
  background: var(--gradient-accent-2);
  border: 1px solid transparent;
  color: #ffffff;
}

.btn--primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, var(--aurora-violet), var(--aurora-blue));
  opacity: 0;
  transition: opacity var(--dur-med) var(--ease-out);
  z-index: 1;
}

.btn--primary:hover {
  color: #ffffff;
  box-shadow: 0 18px 40px -16px rgba(76, 130, 255, 0.5);
  animation-play-state: paused;
}

.btn--primary:hover::before {
  opacity: 1;
}

.btn--ghost {
  color: var(--soft-white);
  border: 1px solid var(--glass-border);
  background: var(--glass-bg);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}

.btn--ghost:hover {
  border-color: var(--glass-border-strong);
  background: var(--glass-bg-strong);
  box-shadow: none;
}

/* ==========================================================================
   LOADING SCREEN
   ========================================================================== */

.loader {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg-main);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  transition: opacity 1100ms var(--ease-in-out), visibility 1100ms var(--ease-in-out);
}

.loader.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loader__mark {
  position: relative;
  width: 84px;
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader__ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--glass-border-strong);
  border-top-color: var(--aurora-blue);
  animation: loaderSpin 1.6s linear infinite;
}

.loader__letter {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--marble);
  letter-spacing: 0.02em;
}

.loader__label {
  overflow: hidden;
  height: 1.2em;
}

.loader__label-text {
  display: block;
  font-family: var(--font-body);
  font-size: 0.78rem;
  letter-spacing: 0.3em;
  color: var(--stone);
  transform: translateY(100%);
  animation: loaderLabelIn 900ms var(--ease-out) 300ms forwards;
}

.loader__bar {
  width: 180px;
  height: 2px;
  border-radius: var(--radius-full);
  background: var(--glass-border);
  overflow: hidden;
}

.loader__bar-fill {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--gradient-accent-2);
  animation: loaderFill 1.8s var(--ease-in-out) forwards;
}

/* ==========================================================================
   NAVIGATION
   ========================================================================== */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  padding: 0 var(--space-lg);
  transition: transform var(--dur-med) var(--ease-in-out), padding var(--dur-med) var(--ease-out);
}

.nav.is-scrolled {
  padding-top: 0.6rem;
}

.nav.is-hidden {
  transform: translateY(-120%);
}

.nav__inner {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 0.75rem var(--space-md);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-radius: var(--radius-full);
  border: 1px solid transparent;
  transition: background var(--dur-med) var(--ease-out),
              border-color var(--dur-med) var(--ease-out),
              box-shadow var(--dur-med) var(--ease-out);
}

.nav.is-scrolled .nav__inner {
  background: var(--glass-bg);
  border-color: var(--glass-border);
  backdrop-filter: blur(18px) saturate(160%);
  -webkit-backdrop-filter: blur(18px) saturate(160%);
  box-shadow: 0 20px 50px -30px rgba(0, 0, 0, 0.6);
}

.nav__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-family: var(--font-display);
  font-size: 0.92rem;
  letter-spacing: 0.02em;
  color: var(--soft-white);
}

.nav__brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--gradient-accent-2);
  color: #ffffff;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.nav__link {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--stone);
  padding: 0.4rem 0;
  transition: color var(--dur-fast) var(--ease-out);
}

.nav__link::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--aurora-blue);
  opacity: 0;
  transform: scale(0);
  transition: opacity var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}

.nav__link:hover::before {
  opacity: 1;
  transform: scale(1);
}

.nav__link span {
  position: relative;
  display: inline-block;
}

.nav__link:hover {
  color: var(--soft-white);
}

.nav__cta {
  padding: 0.65rem 1.4rem;
  font-size: 0.8rem;
}

.nav__toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  gap: 6px;
  width: 32px;
  height: 24px;
  position: relative;
  z-index: 300;
}

.nav__toggle-bar {
  display: block;
  height: 1.5px;
  border-radius: var(--radius-full);
  background: var(--soft-white);
  transition: transform var(--dur-med) var(--ease-in-out),
              opacity var(--dur-fast) var(--ease-out),
              width var(--dur-med) var(--ease-out);
  width: 100%;
}

.nav__toggle-bar:nth-child(1) { width: 100%; }
.nav__toggle-bar:nth-child(2) { width: 70%; }
.nav__toggle-bar:nth-child(3) { width: 100%; }

.nav__toggle:hover .nav__toggle-bar {
  width: 100%;
}

.nav__toggle.is-open .nav__toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
  width: 100%;
}

.nav__toggle.is-open .nav__toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav__toggle.is-open .nav__toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
  width: 100%;
}

.nav__progress {
  position: absolute;
  left: var(--space-md);
  right: var(--space-md);
  bottom: 0;
  height: 2px;
  border-radius: var(--radius-full);
  width: auto;
  transform: scaleX(0);
  transform-origin: left;
  background: var(--gradient-accent);
  opacity: 0;
  transition: opacity var(--dur-med) var(--ease-out);
}

.nav.is-scrolled .nav__progress {
  opacity: 0.9;
}

/* ==========================================================================
   MOBILE MENU
   ========================================================================== */

.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 250;
  background: rgba(10, 13, 20, 0.97);
  backdrop-filter: blur(24px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--dur-med) var(--ease-in-out), visibility var(--dur-med) var(--ease-in-out);
}

.mobile-menu.is-open {
  opacity: 1;
  visibility: visible;
}

.mobile-menu__links {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}

.mobile-menu__link {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.6rem, 6vw, 2.4rem);
  color: var(--marble);
  display: flex;
  align-items: baseline;
  gap: var(--space-sm);
  opacity: 0;
  transform: translateY(16px);
  transition: color var(--dur-fast) var(--ease-out);
}

.mobile-menu.is-open .mobile-menu__link {
  animation: mobileLinkIn 640ms var(--ease-out) forwards;
}

.mobile-menu.is-open .mobile-menu__link:nth-child(1) { animation-delay: 80ms; }
.mobile-menu.is-open .mobile-menu__link:nth-child(2) { animation-delay: 160ms; }
.mobile-menu.is-open .mobile-menu__link:nth-child(3) { animation-delay: 240ms; }
.mobile-menu.is-open .mobile-menu__link:nth-child(4) { animation-delay: 320ms; }
.mobile-menu.is-open .mobile-menu__link:nth-child(5) { animation-delay: 400ms; }

.mobile-menu__link:hover {
  color: var(--aurora-blue);
}

.mobile-menu__index {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--aurora-blue);
  letter-spacing: 0.1em;
}

/* Section placeholders (Phase 2+) */
#journey, #work, #about, #contact {
  min-height: 1px;
}
