/* ============================================================
   GLOBAL STYLES
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;900&display=swap');
@import 'tokens.css';

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-color: var(--color-bg);
  background-image: url('../images/hero-bg.jpg');
  background-size: cover;
  background-attachment: fixed;
  background-position: center top;
}

html[data-theme="dark"] {
  background-image: url('../images/hero-bg-dark.jpg');
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  font-weight: var(--weight-regular);
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  background-color: transparent;
  overflow-x: hidden;
}

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

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

ul, ol { list-style: none; }

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

/* ── Typography Utilities ──────────────────────────────── */
.label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-muted);
}

.display-xl {
  font-size: var(--text-hero);
  font-weight: var(--weight-black);
  line-height: var(--leading-tight);
  letter-spacing: -0.04em;
}

.display-lg {
  font-size: var(--text-6xl);
  font-weight: var(--weight-black);
  line-height: var(--leading-tight);
  letter-spacing: -0.03em;
}

.display-md {
  font-size: var(--text-5xl);
  font-weight: var(--weight-bold);
  line-height: var(--leading-tight);
  letter-spacing: -0.025em;
}

.heading-xl {
  font-size: var(--text-4xl);
  font-weight: var(--weight-bold);
  line-height: var(--leading-snug);
  letter-spacing: -0.02em;
}

.heading-lg {
  font-size: var(--text-3xl);
  font-weight: var(--weight-bold);
  line-height: var(--leading-snug);
  letter-spacing: -0.015em;
}

.heading-md {
  font-size: var(--text-2xl);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
}

.body-lg {
  font-size: var(--text-lg);
  line-height: var(--leading-relaxed);
  color: var(--color-text-muted);
}

.body-base {
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--color-text-muted);
}

/* ── Layout Utilities ──────────────────────────────────── */
.container {
  width: 100%;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.section {
  padding: var(--space-20) 0;
}

@media (max-width: 768px) {
  .section { padding: var(--space-12) 0; }
}

@media (max-width: 375px) {
  .section { padding: var(--space-8) 0; }
}

/* ── Navigation ────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  padding: var(--space-3) var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: background var(--dur-base) var(--ease-out),
              backdrop-filter var(--dur-base) var(--ease-out),
              box-shadow var(--dur-base) var(--ease-out);
}

.nav.scrolled {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 1px 0 var(--color-border);
}

[data-theme="dark"] .nav.scrolled {
  background: rgba(17, 17, 17, 0.92);
}

.nav__logo {
  font-size: var(--text-lg);
  font-weight: var(--weight-black);
  letter-spacing: -0.02em;
  color: var(--color-accent);
  transition: opacity var(--dur-fast);
}

.nav__logo:hover { opacity: 0.7; }

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

.nav__links a {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  transition: color var(--dur-fast);
  position: relative;
}

.nav__links a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 1.5px;
  background: var(--color-accent);
  transition: width var(--dur-base) var(--ease-out);
}

.nav__links a:hover { color: var(--color-text-primary); }
.nav__links a:hover::after { width: 100%; }
.nav__links a.active { color: var(--color-text-primary); }
.nav__links a.active::after { width: 100%; }

.nav__cta {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  padding: 10px 20px;
  background: var(--color-text-primary);
  color: var(--color-white);
  border-radius: var(--radius-full);
  transition: background var(--dur-fast), transform var(--dur-fast);
}

.nav__cta:hover {
  background: var(--color-accent);
  transform: translateY(-1px);
}

[data-theme="dark"] .nav__cta {
  background: var(--color-accent);
  color: var(--color-white);
}

.nav__hamburger {
  display: none;
  flex-direction: column;
  gap: 5px;
  padding: 4px;
  cursor: pointer;
}

.nav__hamburger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-text-primary);
  transition: transform var(--dur-base) var(--ease-out),
              opacity var(--dur-base);
}

.nav__hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav__hamburger.open span:nth-child(2) { opacity: 0; }
.nav__hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (max-width: 768px) {
  .nav {
    padding: var(--space-2) var(--gutter-sm);
  }

  .nav__links {
    position: fixed;
    top: 0;
    right: -100%;
    height: 100vh;
    width: 280px;
    background: var(--color-bg);
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    padding: var(--space-12) var(--space-8);
    gap: var(--space-4);
    box-shadow: var(--shadow-xl);
    transition: right var(--dur-slow) var(--ease-out);
  }

  .nav__links.open { right: 0; }

  .nav__links a {
    font-size: var(--text-xl);
    font-weight: var(--weight-semibold);
    color: var(--color-text-primary);
  }

  .nav__cta { display: none; }
  .nav__hamburger { display: flex; }
  /* Keep toggle visible in mobile nav row */
  .theme-toggle { order: -1; }
}

/* ── Theme Toggle ──────────────────────────────────────── */
.theme-toggle {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  flex-shrink: 0;
}

.theme-toggle__track {
  width: 44px;
  height: 24px;
  border-radius: var(--radius-full);
  background: #b0b0ac;
  border: 1.5px solid #b0b0ac;
  transition: background var(--dur-base) var(--ease-out),
              border-color var(--dur-base) var(--ease-out);
  position: relative;
  flex-shrink: 0;
}

.theme-toggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-text-secondary);
  transition: transform var(--dur-base) var(--ease-out),
              background var(--dur-base) var(--ease-out);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  line-height: 1;
}

[data-theme="dark"] .theme-toggle__track {
  background: var(--color-surface);
  border-color: var(--color-surface);
}

[data-theme="dark"] .theme-toggle__thumb {
  transform: translateX(20px);
  background: var(--color-white);
}

.theme-toggle__icon {
  font-size: var(--text-sm);
  line-height: 1;
  user-select: none;
  transition: opacity var(--dur-base);
}

.theme-toggle__icon--sun  { opacity: 1; }
.theme-toggle__icon--moon { opacity: 0.4; }

[data-theme="dark"] .theme-toggle__icon--sun  { opacity: 0.4; }
[data-theme="dark"] .theme-toggle__icon--moon { opacity: 1; }

/* Also keep page bg/text transitions smooth when theme flips */
html {
  transition: background-color var(--dur-base) var(--ease-out),
              color var(--dur-base) var(--ease-out);
}

/* ── Buttons ───────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  border-radius: var(--radius-full);
  transition: all var(--dur-base) var(--ease-out);
  cursor: pointer;
  text-decoration: none;
}

.btn--primary {
  padding: 14px 32px;
  background: var(--color-text-primary);
  color: var(--color-white);
}

.btn--primary:hover {
  background: var(--color-accent);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 87, 255, 0.3);
}

[data-theme="dark"] .btn--primary {
  background: var(--color-accent);
  color: var(--color-white);
}

[data-theme="dark"] .btn--primary:hover {
  background: var(--color-accent-dark);
}

.btn--outline {
  padding: 13px 31px;
  border: 1.5px solid var(--color-white);
  color: var(--color-text-primary);
  background: transparent;
}

.btn--outline:hover {
  border-color: var(--color-text-primary);
  background: var(--color-text-primary);
  color: var(--color-white);
  transform: translateY(-2px);
}

.btn--ghost {
  padding: 14px 0;
  color: var(--color-text-primary);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: var(--weight-semibold);
  font-size: var(--text-base);
  border-bottom: 1.5px solid var(--color-text-primary);
  border-radius: 0;
}

.btn--ghost:hover { color: var(--color-accent); border-color: var(--color-accent); }

.btn__arrow {
  display: inline-flex;
  transition: transform var(--dur-base) var(--ease-out);
}

.btn:hover .btn__arrow { transform: translateX(4px); }

/* ── Divider ───────────────────────────────────────────── */
.divider {
  height: 1px;
  background: var(--color-border);
  width: 100%;
}

/* ── Tag / Chip ────────────────────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  letter-spacing: 0.05em;
  background: var(--color-accent-light);
  color: var(--color-accent);
}

/* ── Reveal animations ─────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(32px);
  transition: opacity var(--dur-slower) var(--ease-out),
              transform var(--dur-slower) var(--ease-out);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.reveal-delay-1 { transition-delay: 0.1s; }
.reveal-delay-2 { transition-delay: 0.2s; }
.reveal-delay-3 { transition-delay: 0.3s; }
.reveal-delay-4 { transition-delay: 0.4s; }
.reveal-delay-5 { transition-delay: 0.5s; }

/* ── Page transition ───────────────────────────────────── */
.page-enter {
  animation: pageEnter 0.6s var(--ease-out) forwards;
}

@keyframes pageEnter {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Footer ────────────────────────────────────────────── */
.footer {
  padding: var(--space-8) 0;
  border-top: 1px solid var(--color-border);
}

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.footer__copy {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.footer__links {
  display: flex;
  gap: var(--space-4);
}

.footer__links a {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
  transition: color var(--dur-fast);
}

.footer__links a:hover { color: var(--color-text-primary); }

@media (max-width: 375px) {
  .footer__inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ── Cursor ────────────────────────────────────────────── */
.cursor {
  position: fixed;
  width: 8px;
  height: 8px;
  background: var(--color-accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
  transform: translate(-50%, -50%);
  transition: transform 0.1s, width 0.2s var(--ease-out), height 0.2s var(--ease-out);
}

.cursor-ring {
  position: fixed;
  width: 36px;
  height: 36px;
  border: 1.5px solid var(--color-accent);
  border-radius: 50%;
  pointer-events: none;
  z-index: 9998;
  transform: translate(-50%, -50%);
  transition: all 0.15s var(--ease-out);
  opacity: 0.6;
}

.cursor--hover { width: 48px; height: 48px; opacity: 0.15; background: var(--color-accent); }
.cursor-ring--hover { width: 0; height: 0; opacity: 0; }

@media (hover: none) {
  .cursor, .cursor-ring { display: none; }
}

/* ── Real image containers ─────────────────────────────── */
.img-wrap {
  overflow: hidden;
  display: block;
  position: relative;
}

.img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform var(--dur-slow) var(--ease-out);
}

/* Zoom on hover when inside a card/link */
a:hover .img-wrap img,
.work__card:hover .img-wrap img,
.portfolio-item:hover .img-wrap img {
  transform: scale(1.04);
}

/* ── Image placeholder ─────────────────────────────────── */
.img-placeholder {
  background: var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  overflow: hidden;
  position: relative;
}

.img-placeholder::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.4) 50%, transparent 60%);
  transform: translateX(-100%);
  animation: shimmer 1.8s infinite;
}

@keyframes shimmer {
  100% { transform: translateX(100%); }
}
