/* =========================================================
   0. TOKENS
   Dark mode is the default; light mode overrides via
   [data-theme="light"] on <html>, toggled in script.js and
   persisted to localStorage.
   ========================================================= */
:root {
  /* accents stay identical across themes — only surfaces/text shift */
  --purple: #8b5cf6;
  --teal: #2dd4bf;
  --gradient: linear-gradient(135deg, var(--purple), var(--teal));

  --bg: #0e1013;
  --bg-soft: #121519;
  --surface: #191d23;
  --surface-2: #20242b;
  --border: rgba(255, 255, 255, 0.08);
  --text: #eef0f3;
  --text-muted: #9aa1ac;
  --shadow: 0 20px 60px -20px rgba(0, 0, 0, 0.6);

  --font-body: "Inter", system-ui, -apple-system, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;

  --container: 1120px;
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 24px;

  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  --bg: #f6f7f9;
  --bg-soft: #eef0f3;
  --surface: #ffffff;
  --surface-2: #f2f3f6;
  --border: rgba(15, 18, 22, 0.09);
  --text: #14171c;
  --text-muted: #565d68;
  --shadow: 0 20px 50px -24px rgba(20, 23, 28, 0.18);
  /* slightly deeper accents so they keep enough contrast on a light surface */
  --purple: #7c3aed;
  --teal: #0d9488;
}

/* =========================================================
   1. RESET
   ========================================================= */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background-color 0.35s var(--ease), color 0.35s var(--ease);
}

img { max-width: 100%; display: block; }
ul { list-style: none; margin: 0; padding: 0; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }

.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: clamp(1.25rem, 4vw, 2.5rem);
}

.section { padding-block: clamp(4rem, 9vw, 7.5rem); }

/* Respect reduced-motion preference: kill smooth scroll + heavy animation */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* Accessible focus ring, visible on keyboard nav only */
:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--surface);
  color: var(--text);
  padding: 0.75rem 1.25rem;
  border-radius: 0 0 8px 0;
  z-index: 999;
}
.skip-link:focus { left: 0; }

/* =========================================================
   2. TYPE HELPERS
   ========================================================= */
.eyebrow {
  font-family: var(--font-mono);
  font-size: 1.50rem; /* 0.78rem */
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--teal);
  margin-bottom: 0.9rem;
  display: inline-block;
}

.section__title {
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  max-width: 20ch;
  margin-bottom: 1.1rem;
}

.section__lead {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 46ch;
  margin-bottom: 1rem;
}

/* =========================================================
   3. HEADER / NAV
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.nav__logo {
  font-weight: 800;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}
.nav__logo-dot { color: var(--purple); }

.nav__links {
  display: flex;
  gap: 2.2rem;
  font-size: 0.92rem;
  font-weight: 500;
}

.nav__links a {
  position: relative;
  color: var(--text-muted);
  transition: color 0.2s var(--ease);
}
.nav__links a:hover { color: var(--text); }
.nav__links a::after {
  content: "";
  position: absolute;
  left: 0; bottom: -6px;
  width: 0; height: 2px;
  background: var(--gradient);
  transition: width 0.25s var(--ease);
}
.nav__links a:hover::after { width: 100%; }

.nav__controls { display: flex; align-items: center; gap: 0.5rem; }

.theme-toggle {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  color: var(--text);
  transition: border-color 0.2s, transform 0.2s;
}
.theme-toggle:hover { border-color: var(--purple); transform: translateY(-1px); }
.icon--sun { display: none; }
[data-theme="light"] .icon--sun { display: block; }
[data-theme="light"] .icon--moon { display: none; }

.nav__menu-btn {
  display: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.nav__menu-btn span {
  width: 18px; height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.25s var(--ease), opacity 0.2s;
}
.nav__menu-btn[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.nav__menu-btn[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav__menu-btn[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.nav-mobile {
  display: none;
  flex-direction: column;
  padding: 0.5rem 1.25rem 1.25rem;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.nav-mobile.is-open { display: flex; }
.nav-mobile a {
  padding: 0.75rem 0.25rem;
  font-weight: 500;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.nav-mobile li:last-child a { border-bottom: none; }

@media (max-width: 720px) {
  .nav__links { display: none; }
  .nav__menu-btn { display: flex; }
}

/* =========================================================
   4. HERO
   ========================================================= */
.hero {
  position: relative;
  min-height: min(92vh, 820px);
  display: grid;
  place-items: center;
  overflow: hidden;
  padding-top: 72px;
}

/* Signature element: a soft drifting aurora gradient behind the hero copy,
   built from two blurred radial blobs (purple + teal) that slowly orbit. */
.hero__aurora {
  position: absolute;
  inset: -20%;
  z-index: 0;
  background:
    radial-gradient(38% 32% at 28% 32%, color-mix(in srgb, var(--purple) 55%, transparent), transparent 70%),
    radial-gradient(34% 30% at 74% 62%, color-mix(in srgb, var(--teal) 50%, transparent), transparent 70%);
  filter: blur(60px);
  opacity: 0.55;
  animation: aurora-drift 22s ease-in-out infinite alternate;
}

@keyframes aurora-drift {
  0%   { transform: translate3d(0, 0, 0) scale(1); }
  100% { transform: translate3d(3%, -4%, 0) scale(1.08); }
}

.hero__inner {
  position: relative;
  z-index: 1;
  text-align: center;
  max-width: 780px;
}

.hero__name {
  font-size: clamp(2.6rem, 8vw, 5rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.05;
  margin-bottom: 1.1rem;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero__tagline {
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  color: var(--text-muted);
  max-width: 52ch;
  margin-inline: auto;
  margin-bottom: 2.2rem;
}
.hero__tagline em { color: var(--text); font-style: normal; font-weight: 600; }

.hero__actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.85rem 1.6rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease), border-color 0.2s;
}
.btn--primary {
  background: var(--gradient);
  color: #06070a;
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 12px 30px -10px color-mix(in srgb, var(--purple) 60%, transparent); }

.btn--ghost {
  border: 1px solid var(--border);
  color: var(--text);
}
.btn--ghost:hover { border-color: var(--teal); transform: translateY(-2px); }

.scroll-cue {
  position: absolute;
  bottom: 2.2rem;
  left: 50%;
  transform: translateX(-50%);
  width: 26px; height: 42px;
  border: 2px solid var(--border);
  border-radius: 999px;
  z-index: 1;
}
.scroll-cue span {
  position: absolute;
  top: 8px; left: 50%;
  width: 4px; height: 8px;
  margin-left: -2px;
  border-radius: 999px;
  background: var(--gradient);
  animation: scroll-cue-move 1.8s ease-in-out infinite;
}
@keyframes scroll-cue-move {
  0%   { transform: translateY(0); opacity: 1; }
  70%  { transform: translateY(14px); opacity: 0; }
  100% { transform: translateY(14px); opacity: 0; }
}

/* =========================================================
   5. ABOUT
   ========================================================= */
.about__grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}

.about__grid p + p { margin-top: 1rem; color: var(--text-muted); }

.skills {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.75rem;
}
.skills__title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 1.1rem;
}
.skills__list { display: flex; flex-direction: column; gap: 0.9rem; }
.skills__list li {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}
.skills__list li:last-child { border-bottom: none; padding-bottom: 0; }
.skills__tag {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

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

/* =========================================================
   6. PROJECTS
   ========================================================= */
.projects__grid {
  margin-top: 2.5rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.card {
  position: relative;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), border-color 0.35s;
}

/* Gradient glow that fades in behind the card border on hover — ties the
   purple/teal accent directly to the interactive moment instead of a
   generic scale/shadow-only hover. */
.card__glow {
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: var(--gradient);
  opacity: 0;
  transition: opacity 0.35s var(--ease);
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow);
}
.card:hover .card__glow { opacity: 1; }

.card__body { position: relative; padding: 1.9rem; }

.card__index {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--purple);
}

.card__title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 0.6rem;
  margin-bottom: 0.6rem;
}

.card__desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.2rem;
}

.card__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.4rem;
}
.card__tags li {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
}

.card__link {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--teal);
  transition: gap 0.2s;
}
.card__link:hover { text-decoration: underline; }

@media (max-width: 980px) {
  .projects__grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .projects__grid { grid-template-columns: 1fr; }
}

/* =========================================================
   7. CONTACT
   ========================================================= */
.contact__grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}

.contact__list { margin-top: 1.6rem; display: flex; flex-direction: column; gap: 0.9rem; }
.contact__label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--teal);
  display: block;
  margin-bottom: 0.15rem;
}

.form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: clamp(1.5rem, 3vw, 2.2rem);
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.form__row { display: flex; flex-direction: column; gap: 0.45rem; }
.form__row label { font-size: 0.85rem; font-weight: 600; }

.form__row input,
.form__row textarea {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  color: var(--text);
  resize: vertical;
  transition: border-color 0.2s;
}
.form__row input::placeholder,
.form__row textarea::placeholder { color: var(--text-muted); opacity: 0.7; }
.form__row input:focus,
.form__row textarea:focus { border-color: var(--purple); }

.form__row.has-error input,
.form__row.has-error textarea { border-color: #f87171; }

.form__error {
  min-height: 1.1em;
  font-size: 0.8rem;
  color: #f87171;
}

.form__submit { align-self: flex-start; margin-top: 0.25rem; }

.form__success {
  display: none;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--teal);
  background: color-mix(in srgb, var(--teal) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--teal) 35%, transparent);
  border-radius: var(--radius-sm);
  padding: 0.8rem 1rem;
}
.form__success.is-visible { display: block; }

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

/* =========================================================
   8. FOOTER
   ========================================================= */
.site-footer { border-top: 1px solid var(--border); }
.footer__inner {
  padding-block: 1.75rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  color: var(--text-muted);
  font-size: 0.85rem;
}
.footer__back { font-weight: 600; color: var(--text); }
.footer__back:hover { color: var(--teal); }

/* =========================================================
   9. SCROLL-TRIGGERED FADE-IN
   Elements start slightly translated + transparent; script.js
   adds .in-view via IntersectionObserver to reveal them.
   ========================================================= */
.fade-in {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}
.fade-in.in-view { opacity: 1; transform: translateY(0); }

/* Small screens down to 320px: tighten paddings a touch further */
@media (max-width: 360px) {
  .container { padding-inline: 1rem; }
  .hero__actions { flex-direction: column; width: 100%; }
  .hero__actions .btn { width: 100%; justify-content: center; }
}
