/* ==========================================================
   TOKENS
   ========================================================== */
:root {
  --bg: #0a0a0d;
  --bg-elevated: #121216;
  --bg-card: #15151a;
  --border: #232329;
  --border-soft: #1a1a1f;

  --text: #f3f0e9;
  --text-dim: #9c988f;
  --text-faint: #605c56;

  --accent: #e3b04b;       /* warm gold */
  --accent-soft: #f2cd7d;
  --accent-2: #7c8cff;      /* cool periwinkle, secondary */
  --accent-2-deep: #4b3f91;

  --font-display: "Space Grotesk", "Segoe UI", sans-serif;
  --font-body: "Plus Jakarta Sans", "Segoe UI", sans-serif;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);

  --nav-h: 76px;
  --max-w: 1160px;
}

/* ==========================================================
   RESET
   ========================================================== */
*, *::before, *::after { box-sizing: border-box; }
html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-h);
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
h1, h2, h3 { margin: 0; font-family: var(--font-display); }
p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button {
  font-family: inherit;
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
}
img, svg { display: block; max-width: 100%; }

::selection {
  background: var(--accent);
  color: #14120a;
}

/* Custom scrollbar: a quiet gold thumb, no visible track or arrows.
   Keep native scrolling so dragging, touch, and keyboard controls still work. */
html {
  scrollbar-width: thin;
  scrollbar-color: #756344 var(--bg);
}
/* Let WebKit styling control the shape in browsers that support it. */
@supports selector(::-webkit-scrollbar) {
  html {
    scrollbar-width: auto;
    scrollbar-color: auto;
  }
}
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg);
}
::-webkit-scrollbar-thumb {
  background-color: #756344;
  background-clip: padding-box;
  border-radius: 100px;
  border: 3px solid var(--bg);
  min-height: 48px;
}
::-webkit-scrollbar-thumb:hover {
  background-color: var(--accent);
}
::-webkit-scrollbar-thumb:active {
  background-color: var(--accent-soft);
}
::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}
::-webkit-scrollbar-corner {
  background: var(--bg);
}
/* Respect high-contrast system settings. */
@media (forced-colors: active) {
  html {
    scrollbar-width: auto;
    scrollbar-color: auto;
  }
  ::-webkit-scrollbar-thumb {
    background-color: ButtonText;
    border-color: Canvas;
  }
  ::-webkit-scrollbar-track,
  ::-webkit-scrollbar-corner {
    background: Canvas;
  }
}

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #14120a;
  padding: 10px 16px;
  z-index: 999;
  border-radius: 0 0 8px 0;
  font-weight: 600;
}
.skip-link:focus {
  left: 0;
}

/* ==========================================================
   AMBIENT LAYERS — grain + cursor aura
   ========================================================== */
.grain {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.05;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

.aura {
  position: fixed;
  top: 0;
  left: 0;
  width: 640px;
  height: 640px;
  margin-left: -320px;
  margin-top: -320px;
  z-index: 0;
  pointer-events: none;
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(227, 176, 75, 0.16), rgba(124, 140, 255, 0.10) 45%, transparent 72%);
  filter: blur(10px);
  transform: translate3d(50vw, 30vh, 0);
  opacity: var(--aura-opacity, 1);
  transition: opacity 0.6s var(--ease);
  will-change: transform;
}
.aura::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(ellipse at 45% 55%, rgba(124, 140, 255, 0.22), rgba(227, 176, 75, 0.08) 48%, transparent 72%);
  opacity: var(--aura-mix, 0);
}

/* ==========================================================
   NAV
   ========================================================== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  border-bottom: 1px solid transparent;
  transition: background-color 0.4s var(--ease-soft), border-color 0.4s var(--ease-soft), backdrop-filter 0.4s var(--ease-soft);
}
.nav.is-scrolled {
  background: rgba(10, 10, 13, 0.72);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom-color: var(--border-soft);
}
.nav-inner {
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.nav-mark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
}
.nav-mark-dot { color: var(--accent); }

.nav-links {
  position: relative;
  display: flex;
  gap: 32px;
  margin: 0 auto;
}
.nav-links a {
  position: relative;
  font-size: 0.92rem;
  color: var(--text-dim);
  padding: 6px 2px;
  transition: color 0.25s var(--ease-soft);
}
.nav-links a:hover,
.nav-links a.is-active {
  color: var(--text);
}
.nav-indicator {
  position: absolute;
  bottom: -1px;
  height: 1.5px;
  background: var(--accent);
  border-radius: 2px;
  opacity: 0;
  transition: left 0.4s var(--ease), width 0.4s var(--ease), opacity 0.3s ease;
}

.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
  font-weight: 600;
  padding: 9px 18px;
  border: 1px solid var(--border);
  border-radius: 100px;
  color: var(--text);
  transition: border-color 0.3s var(--ease-soft), background-color 0.3s var(--ease-soft);
}
.nav-cta:hover {
  border-color: var(--accent);
  background: rgba(227, 176, 75, 0.08);
}

@media (max-width: 640px) {
  .nav-links { display: none; }
  .nav-inner { padding: 0 20px; }
}

/* ==========================================================
   SHARED SECTION LAYOUT
   ========================================================== */
.section-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 0 32px;
  position: relative;
  z-index: 1;
}
.eyebrow {
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}
.section-title {
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 48px;
}
.word-accent {
  background: linear-gradient(90deg, var(--accent-soft), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

/* ==========================================================
   SCROLL REVEAL
   ========================================================== */
[data-reveal],
[data-reveal-line] .word {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}
[data-reveal].is-visible,
[data-reveal-line].is-visible .word {
  opacity: 1;
  transform: translateY(0);
}
[data-reveal-line] .word {
  display: inline-block;
  transition-delay: calc(var(--w-i, 0) * 55ms);
}
.project-grid [data-reveal],
.about-grid [data-reveal] {
  transition-delay: calc(var(--card-i, 0) * 110ms);
}

@media (prefers-reduced-motion: reduce) {
  [data-reveal],
  [data-reveal-line] .word {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }
  html { scroll-behavior: auto; }
  .aura { display: none; }
}

/* ==========================================================
   HERO
   ========================================================== */
.hero {
  position: relative;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: calc(var(--nav-h) + 40px) 32px 80px;
}
.hero-inner {
  max-width: var(--max-w);
  width: 100%;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}
.headline {
  font-weight: 700;
  font-size: clamp(2.6rem, 7.4vw, 5.4rem);
  line-height: 1.04;
  letter-spacing: -0.03em;
  margin: 6px 0 28px;
}
.headline .line { display: block; }
.headline .word { margin-right: 0.28em; }

.hero-sub {
  max-width: 46ch;
  color: var(--text-dim);
  font-size: clamp(1rem, 1.3vw, 1.15rem);
  margin-bottom: 40px;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  border-radius: 100px;
  font-size: 0.95rem;
  font-weight: 600;
  transition: transform 0.35s var(--ease), background-color 0.3s var(--ease-soft), border-color 0.3s var(--ease-soft), color 0.3s var(--ease-soft);
}
.btn-primary {
  background: var(--accent);
  color: #16130a;
}
.btn-primary:hover { background: var(--accent-soft); }
.btn-arrow { transition: transform 0.35s var(--ease); }
.btn-primary:hover .btn-arrow { transform: translate(2px, -2px); }

.btn-ghost {
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-ghost:hover {
  border-color: var(--text-dim);
  background: var(--bg-elevated);
}

.scroll-cue {
  position: absolute;
  bottom: 36px;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: 100px;
  display: flex;
  justify-content: center;
  padding-top: 8px;
}
.scroll-cue-line {
  width: 3px;
  height: 8px;
  border-radius: 2px;
  background: var(--accent);
  animation: scrollcue 1.8s var(--ease-soft) infinite;
}
@keyframes scrollcue {
  0% { transform: translateY(0); opacity: 1; }
  70% { transform: translateY(14px); opacity: 0; }
  100% { transform: translateY(14px); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .scroll-cue-line { animation: none; }
}

/* ==========================================================
   ABOUT
   ========================================================== */
.about {
  padding: 140px 0;
  position: relative;
  border-top: 1px solid var(--border-soft);
}
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 64px;
  margin-bottom: 56px;
}
.about-lead {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  font-weight: 500;
  line-height: 1.35;
  letter-spacing: -0.01em;
}
.about-body {
  color: var(--text-dim);
  font-size: 1.02rem;
}
.about-body p + p { margin-top: 18px; }

.stack {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.stack li {
  font-size: 0.85rem;
  color: var(--text-dim);
  border: 1px solid var(--border);
  padding: 8px 16px;
  border-radius: 100px;
  transition: border-color 0.3s var(--ease-soft), color 0.3s var(--ease-soft), transform 0.3s var(--ease-soft);
}
.stack li:hover {
  border-color: var(--accent);
  color: var(--text);
  transform: translateY(-2px);
}

@media (max-width: 800px) {
  .about-grid { grid-template-columns: 1fr; gap: 24px; }
}

/* ==========================================================
   WORK / PROJECTS
   ========================================================== */
.work {
  padding: 120px 0 140px;
  border-top: 1px solid var(--border-soft);
}
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.project-card {
  perspective: 1200px;
}
.project-card-inner {
  height: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: translateZ(0);
  transition: transform 0.4s var(--ease), border-color 0.4s var(--ease-soft), box-shadow 0.4s var(--ease-soft);
  will-change: transform;
}
.project-card:hover .project-card-inner {
  border-color: rgba(227, 176, 75, 0.4);
  box-shadow: 0 24px 60px -30px rgba(227, 176, 75, 0.25);
}
.project-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.project-index {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 600;
}
.project-tag {
  font-size: 0.72rem;
  color: var(--text-faint);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.project-name {
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.project-desc {
  color: var(--text-dim);
  font-size: 0.94rem;
  line-height: 1.6;
  flex: 1;
}
.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.project-tags span {
  font-size: 0.72rem;
  color: var(--text-faint);
  border: 1px solid var(--border-soft);
  padding: 5px 10px;
  border-radius: 100px;
}
.project-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text);
  margin-top: 4px;
  width: fit-content;
}
.project-link svg { transition: transform 0.3s var(--ease); }
.project-link:hover svg { transform: translate(2px, -2px); }
.project-link:hover { color: var(--accent); }

@media (max-width: 980px) {
  .project-grid { grid-template-columns: 1fr; }
}

/* ==========================================================
   CONTACT
   ========================================================== */
.contact {
  padding: 140px 0 100px;
  border-top: 1px solid var(--border-soft);
  text-align: center;
}
.contact-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.contact-title {
  font-size: clamp(2.1rem, 5vw, 3.6rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.12;
  margin-bottom: 44px;
}
.contact-email {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 3vw, 1.9rem);
  font-weight: 600;
  padding-bottom: 6px;
  border-bottom: 1.5px solid var(--accent);
  margin-bottom: 36px;
  transition: color 0.3s var(--ease-soft);
}
.contact-email:hover { color: var(--accent); }
.contact-links {
  display: flex;
  gap: 28px;
}
.contact-links a {
  font-size: 0.92rem;
  color: var(--text-dim);
  transition: color 0.3s var(--ease-soft);
}
.contact-links a:hover { color: var(--text); }

/* ==========================================================
   FOOTER
   ========================================================== */
.footer {
  border-top: 1px solid var(--border-soft);
  padding: 28px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-w);
  margin: 0 auto;
  color: var(--text-faint);
  font-size: 0.82rem;
}
.back-to-top {
  width: 38px;
  height: 38px;
  border: 1px solid var(--border);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.3s var(--ease-soft), transform 0.3s var(--ease-soft), color 0.3s var(--ease-soft);
}
.back-to-top:hover {
  border-color: var(--accent);
  color: var(--accent);
}

@media (max-width: 560px) {
  .footer { flex-direction: column; gap: 16px; text-align: center; }
}

/* ==========================================================
   MAGNETIC BUTTON base transition (JS sets transform)
   ========================================================== */
.magnetic {
  transition: transform 0.25s var(--ease-soft);
}
@media (prefers-reduced-motion: reduce) {
  .magnetic { transition: none; }
}
