/* ============================================================
   MELVIN MATHEW — Design System
   main.css
   ============================================================ */

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap");

/* ── Custom Properties ─────────────────────────────────────── */
:root {
  /* Colors */
  --bg-base: #09090b;
  --bg-surface: #111113;
  --bg-elevated: #18181b;
  --bg-overlay: #1e1e23;
  --border: #27272a;
  --border-subtle: #1f1f22;

  --text-primary: #fafafa;
  --text-secondary: #a1a1aa;
  --text-muted: #52525b;

  --accent: #5858f7; /* zinc-100 */
  --accent-dim: #d4d4d8; /* zinc-300 */
  --accent-glow: rgba(255, 255, 255, 0.08);

  /* Typography */
  --font-sans:
    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  /* Spacing */
  --section-padding: 120px 0;
  --container-max: 1140px;
  --container-pad: 0 24px;

  /* Radii */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  /* Transitions */
  --t-fast: 0.15s ease;
  --t-base: 0.25s ease;
  --t-slow: 0.4s ease;
  --t-spring: 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ── Reset & Base ──────────────────────────────────────────── */
*,
*::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;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-base);
  color: var(--text-primary);
  line-height: 1.7;
  overflow-x: hidden;
}

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

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

ul,
ol {
  list-style: none;
}

/* ── Typography Scale ──────────────────────────────────────── */
.text-display {
  font-size: clamp(48px, 7vw, 88px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.04em;
}

.text-h1 {
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.text-h2 {
  font-size: clamp(28px, 3.5vw, 44px);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

.text-h3 {
  font-size: clamp(20px, 2.5vw, 26px);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.text-h4 {
  font-size: 18px;
  font-weight: 600;
  line-height: 1.4;
}

.text-body-lg {
  font-size: clamp(17px, 2vw, 20px);
  font-weight: 400;
  line-height: 1.75;
}

.text-body {
  font-size: 16px;
  font-weight: 400;
  line-height: 1.7;
}

.text-sm {
  font-size: 14px;
  font-weight: 400;
  line-height: 1.6;
}

.text-xs {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* ── Colour Utilities ──────────────────────────────────────── */
.text-primary {
  color: var(--text-primary);
}
.text-secondary {
  color: var(--text-secondary);
}
.text-muted {
  color: var(--text-muted);
}
.text-accent {
  color: var(--accent);
}

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

.section {
  padding: var(--section-padding);
}

.section-sm {
  padding: 80px 0;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── Section Labels ────────────────────────────────────────── */
.section-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 20px;
}

.section-label::before {
  content: "";
  display: block;
  width: 20px;
  height: 1px;
  background: var(--accent);
}

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

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-md);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-base);
  border: 1px solid transparent;
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent);
  color: var(--bg-base);
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-dim);
  border-color: var(--accent-dim);
  transform: translateY(-1px);
  box-shadow: 0 8px 30px var(--accent-glow);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--bg-overlay);
  border-color: #3f3f46;
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: transparent;
  padding: 12px 16px;
}

.btn-ghost:hover {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 13px;
}

.btn-lg {
  padding: 16px 32px;
  font-size: 16px;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px;
  transition: all var(--t-base);
}

.card:hover {
  border-color: #3f3f46;
  transform: translateY(-3px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
}

.card-hover-accent:hover {
  border-color: var(--accent-dim);
  box-shadow: 0 20px 60px rgba(99, 102, 241, 0.12);
}

/* ── Badges ────────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid transparent;
}

.badge-accent {
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent);
  border-color: rgba(255, 255, 255, 0.15);
}

.badge-gray {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border-color: var(--border);
}

/* ── Tech Tags ─────────────────────────────────────────────── */
.tag {
  display: inline-flex;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-overlay);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: all var(--t-fast);
}

.tag:hover {
  color: var(--text-primary);
  border-color: #3f3f46;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ── Gradient Text ─────────────────────────────────────────── */
.gradient-text {
  background: linear-gradient(135deg, #fff 0%, #a1a1aa 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ── Link Arrow ────────────────────────────────────────────── */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 14px;
  font-weight: 500;
  transition: gap var(--t-base);
}

.link-arrow:hover {
  gap: 10px;
}

.link-arrow svg {
  width: 14px;
  height: 14px;
  transition: transform var(--t-base);
}

.link-arrow:hover svg {
  transform: translateX(3px);
}

/* ── Noise Overlay ─────────────────────────────────────────── */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.03'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: 0.4;
}

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-base);
}

::-webkit-scrollbar-thumb {
  background: #3f3f46;
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: #52525b;
}

/* ── Selection ─────────────────────────────────────────────── */
::selection {
  background: rgba(255, 255, 255, 0.2);
  color: var(--text-primary);
}

/* ── Focus ─────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

/* ── Navigation ────────────────────────────────────────────── */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  padding: 0 24px;
  height: 64px;
  display: flex;
  align-items: center;
  transition: all var(--t-base);
}

.nav.scrolled {
  background: rgba(9, 9, 11, 0.85);
  backdrop-filter: blur(20px) saturate(1.5);
  -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border-bottom: 1px solid var(--border-subtle);
}

.nav-inner {
  width: 100%;
  max-width: var(--container-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-logo {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  text-decoration: none;
  transition: opacity var(--t-fast);
}

.nav-logo:hover {
  opacity: 0.8;
}

.nav-logo span {
  color: var(--accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 450;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: all var(--t-fast);
  text-decoration: none;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
  background: var(--bg-elevated);
}

.nav-cta {
  margin-left: 12px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 500;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--t-base);
  text-decoration: none;
}

.nav-cta:hover {
  background: var(--bg-overlay);
  border-color: #3f3f46;
}

/* ── Mobile Menu ───────────────────────────────────────────── */
.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  padding: 8px;
  border: none;
  background: none;
}

.nav-toggle span {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: all var(--t-base);
}

.nav-toggle.open span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.nav-toggle.open span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.open span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-mobile {
  display: none;
  position: fixed;
  inset: 64px 0 0 0;
  background: rgba(9, 9, 11, 0.97);
  backdrop-filter: blur(20px);
  z-index: 99;
  padding: 24px;
  flex-direction: column;
  gap: 8px;
}

.nav-mobile.open {
  display: flex;
}

.nav-mobile .nav-link {
  font-size: 18px;
  padding: 14px 16px;
}

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

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 24px;
}

.footer-link {
  font-size: 14px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color var(--t-fast);
}

.footer-link:hover {
  color: var(--text-secondary);
}

/* ── Responsive Breakpoints ────────────────────────────────── */
@media (max-width: 1024px) {
  :root {
    --section-padding: 96px 0;
  }

  .grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  :root {
    --section-padding: 72px 0;
    --container-pad: 0 20px;
  }

  .nav-links,
  .nav-cta {
    display: none;
  }

  .nav-toggle {
    display: flex;
  }

  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  :root {
    --container-pad: 0 16px;
  }
}
