/* 
  Modern portfolio styles
  - Outfit for headings, Inter for body
  - Light/Dark themes with CSS variables
  - Smooth micro-interactions and reveal animations
  - Mobile-first responsive
*/

:root {
  --header-height: 72px;

  /* Light theme tokens */
  --bg: #ffffff;
  --text: #0d1220;
  --muted: #5b6378;
  --surface: #ffffff;
  --surface-2: #f3f5f8;
  --ring: #7cc4ff;

  /* Accent system */
  --accent-solid: #4f46e5; /* fallback solid */
  --accent-2: #8b5cf6;
  --accent: linear-gradient(135deg, #0ea5ff 0%, #4f46e5 50%, #8b5cf6 100%);

  /* Typography scale (mobile-first) */
  --font-sans: "Inter", system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue",
    Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
  --font-display: "Outfit", "Inter", system-ui, -apple-system, Segoe UI, Roboto,
    "Helvetica Neue", Arial, "Noto Sans";

  --fs-hero: clamp(2rem, 4vw + 1.25rem, 3.5rem);
  --fs-h2: clamp(1.5rem, 2vw + 1rem, 2.25rem);
  --fs-h3: clamp(1.125rem, 1vw + 1rem, 1.375rem);
  --fs-body: clamp(1rem, 0.4vw + 0.95rem, 1.125rem);

  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.16);
}

/* Dark theme override */
html[data-theme="dark"] {
  --bg: #0b0d12;
  --text: #e6e9ef;
  --muted: #98a2b3;
  --surface: #11151c;
  --surface-2: #0f131a;
  --ring: #4ea8ff;
  --accent-solid: #60a5fa;
  --accent-2: #7c3aed;
  --accent: linear-gradient(135deg, #0ea5ff 0%, #7c3aed 50%, #22d3ee 100%);
}

/* Base reset and defaults */
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
}
body {
  margin: 0;
  font-family: var(--font-sans);
  font-optical-sizing: auto;
  line-height: 1.6;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 300ms ease, color 300ms ease;
}

/* Utilities */
.container {
  width: min(1120px, 92vw);
  margin-inline: auto;
}
.muted {
  color: var(--muted);
}
.surface {
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}
.surface-2 {
  background: var(--surface-2);
  border-radius: var(--radius-lg);
}
.text-gradient {
  background: var(--accent);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.btn {
  --btn-bg: var(--surface);
  --btn-text: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--text) 14%, transparent);
  background: var(--btn-bg);
  color: var(--btn-text);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: 0.2px;
  transition: transform 180ms ease, background-color 220ms ease,
    border-color 220ms ease, box-shadow 220ms ease;
  will-change: transform;
}
.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}
.btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 65%, transparent);
}
.btn-primary {
  border: none;
  background: var(--accent);
  color: white;
}
.btn-secondary {
  background: transparent;
  border: 1.5px solid color-mix(in srgb, var(--text) 24%, transparent);
  color: var(--text);
}

/* Header */
header.header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(160%) blur(14px);
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  border-bottom: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
  height: var(--header-height);
}
.nav-wrap {
  height: 100%;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}
.logo {
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: 0.5px;
  font-size: 1.25rem;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
}
.logo-badge {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  box-shadow: var(--shadow-md);
  display: grid;
  place-items: center;
  color: white;
  font-weight: 800;
  transform: translateZ(0);
}

nav {
  justify-self: center;
  display: flex;
  gap: clamp(8px, 2.5vw, 22px);
}
nav a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.98rem;
  padding: 8px 10px;
  border-radius: 8px;
  transition: background-color 180ms ease, color 180ms ease;
}
nav a:hover,
nav a:focus-visible {
  background: color-mix(in srgb, var(--text) 10%, transparent);
  outline: none;
}

.actions {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 8px;
}
.theme-toggle {
  height: 40px;
  width: 40px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--text) 14%, transparent);
  background: var(--surface);
  display: inline-grid;
  place-items: center;
  cursor: pointer;
  transition: transform 180ms ease, background-color 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}
.theme-toggle:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}
.menu-toggle {
  display: none;
  height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--text) 14%, transparent);
  background: var(--surface);
  font-weight: 700;
}

/* Mobile nav drawer */
.mobile-nav {
  display: none;
  position: fixed;
  inset: calc(var(--header-height)) 0 auto 0;
  background: color-mix(in srgb, var(--bg) 90%, transparent);
  backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
  z-index: 40;
}
.mobile-nav.open {
  display: block;
  animation: slideDown 220ms ease-out;
}
.mobile-nav ul {
  list-style: none;
  margin: 0;
  padding: 14px 20px;
  display: grid;
  gap: 8px;
}
.mobile-nav a {
  display: block;
  padding: 12px 14px;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
}
.mobile-nav a:hover,
.mobile-nav a:focus-visible {
  background: color-mix(in srgb, var(--text) 10%, transparent);
  outline: none;
}

/* Sections */
section {
  scroll-margin-top: calc(var(--header-height) + 12px);
}
#hero {
  padding: clamp(28px, 4vw, 44px) 0 clamp(44px, 6vw, 72px);
}
.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
  align-items: center;
}
@media (min-width: 900px) {
  .hero-grid {
    grid-template-columns: 1.05fr 0.95fr;
    gap: 36px;
  }
}
.hero-kicker {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.hero-title {
  font-family: var(--font-display);
  font-size: var(--fs-hero);
  font-weight: 800;
  line-height: 1.08;
  margin: 0 0 10px;
}
.hero-sub {
  font-size: clamp(1rem, 0.6vw + 1rem, 1.2rem);
  color: var(--muted);
  margin: 0 0 20px;
  max-width: 56ch;
}
.hero-cta {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.visual-card {
  position: relative;
  isolation: isolate;
  border-radius: var(--radius-lg);
  padding: 18px;
  overflow: hidden;
  background:
    radial-gradient(80% 80% at 20% 0%, rgba(255, 255, 255, 0.08), transparent 60%),
    var(--surface);
  border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  box-shadow: var(--shadow-md);
  min-height: 320px;
  will-change: transform;
  transform-style: preserve-3d;
}
.gloss {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.02));
  mix-blend-mode: screen;
  z-index: 2;
}
.blob {
  position: absolute;
  width: 520px;
  height: 520px;
  left: -120px;
  top: -160px;
  background: var(--accent);
  filter: blur(30px) saturate(140%);
  opacity: 0.45;
  z-index: 0;
  border-radius: 60% 40% 55% 45% / 55% 40% 60% 45%;
  animation: blobMorph 14s ease-in-out infinite alternate;
  will-change: border-radius, transform;
}
.floating {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 8px;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
  transform: translateZ(40px);
  will-change: transform;
}
.badge small {
  font-weight: 800;
  font-size: 0.75rem;
  opacity: 0.9;
}

/* Section shells */
.section {
  padding: clamp(44px, 8vw, 96px) 0;
}
.section-header {
  margin-bottom: clamp(18px, 3vw, 28px);
  text-align: center;
}
.section-header h2 {
  font-family: var(--font-display);
  font-size: var(--fs-h2);
  line-height: 1.15;
  margin: 0 0 8px;
  font-weight: 800;
}
.section-header p {
  margin: 0 auto;
  max-width: 60ch;
  color: var(--muted);
  font-size: var(--fs-body);
}

/* Skills */
.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (min-width: 640px) {
  .skills-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (min-width: 900px) {
  .skills-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}
.skill {
  display: grid;
  place-items: center;
  padding: 14px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  font-weight: 700;
  box-shadow: var(--shadow-sm);
  transition: transform 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
  will-change: transform;
  transform-style: preserve-3d;
}
.skill:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* Projects */
.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}
@media (min-width: 720px) {
  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (min-width: 1060px) {
  .cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
.card {
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  border-radius: var(--radius-lg);
  overflow: clip;
  box-shadow: var(--shadow-sm);
  transition: transform 220ms ease, box-shadow 220ms ease;
  will-change: transform;
  transform-style: preserve-3d;
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}
.card-figure {
  aspect-ratio: 16 / 9;
  background:
    radial-gradient(80% 60% at 20% 0%, rgba(255, 255, 255, 0.1), transparent 60%),
    linear-gradient(135deg, color-mix(in srgb, var(--text) 8%, transparent), transparent);
  display: grid;
  place-items: center;
}
.card-figure svg {
  width: 72%;
  height: auto;
}
.card-body {
  padding: 14px 16px 8px;
}
.card-body h3 {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: var(--fs-h3);
  margin: 6px 0;
}
.card-body p {
  margin: 0;
  color: var(--muted);
}
.card-actions {
  padding: 12px 12px 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Blog */
.blog-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 720px) {
  .blog-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.blog {
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: transform 180ms ease, box-shadow 180ms ease;
  box-shadow: var(--shadow-sm);
  will-change: transform;
}
.blog:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.blog h3 {
  margin: 0 0 6px;
  font-size: var(--fs-h3);
  font-family: var(--font-display);
}
.blog p {
  margin: 0;
  color: var(--muted);
}

/* Contact */
.contact-card {
  padding: 18px;
  background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  max-width: 840px;
  margin-inline: auto;
}
form .row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 720px) {
  form .row {
    grid-template-columns: 1fr 1fr;
  }
}
label {
  display: block;
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 6px;
}
input,
textarea {
  width: 100%;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--text) 18%, transparent);
  background: var(--surface-2);
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}
input::placeholder,
textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 70%, transparent);
}
input:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: color-mix(in srgb, var(--ring) 70%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--ring) 50%, transparent);
}
textarea {
  min-height: 160px;
  resize: vertical;
}
.submit-row {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
}
.btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Footer */
footer {
  padding: 20px 0 40px;
  border-top: 1px solid color-mix(in srgb, var(--text) 10%, transparent);
  margin-top: 20px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: center;
}
@media (min-width: 720px) {
  .footer-grid {
    grid-template-columns: 1fr auto;
  }
}
.socials {
  display: inline-flex;
  gap: 10px;
}
.socials a {
  height: 40px;
  width: 40px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--text) 14%, transparent);
  background: var(--surface);
  display: inline-grid;
  place-items: center;
  text-decoration: none;
  color: var(--text);
  transition: transform 160ms ease, background-color 160ms ease;
  will-change: transform;
}
.socials a:hover {
  transform: translateY(-2px) scale(1.03);
  background: color-mix(in srgb, var(--text) 6%, var(--surface));
}

/* Reveal animations */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 500ms ease, transform 500ms ease;
  will-change: opacity, transform;
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Toast */
.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--text) 12%, transparent);
  padding: 10px 14px;
  border-radius: 12px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

/* Optional Figma iframe when enabled */
.figma-embed {
  position: absolute;
  inset: 6px;
  width: calc(100% - 12px);
  height: calc(100% - 12px);
  border: 0;
  border-radius: calc(var(--radius-lg) - 6px);
  z-index: 3;
}

/* Keyframes */
@keyframes blobMorph {
  0% {
    border-radius: 60% 40% 55% 45% / 55% 40% 60% 45%;
    transform: translate3d(0, 0, 0) rotate(0deg);
  }
  50% {
    border-radius: 40% 60% 45% 55% / 45% 60% 40% 55%;
    transform: translate3d(6px, -8px, 0) rotate(8deg);
  }
  100% {
    border-radius: 58% 42% 60% 40% / 50% 50% 45% 55%;
    transform: translate3d(-6px, 4px, 0) rotate(-6deg);
  }
}
@keyframes slideDown {
  from {
    transform: translateY(-8px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* Reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  .reveal {
    transition: none;
    opacity: 1;
    transform: none;
  }
  .card,
  .skill,
  .btn,
  .blog,
  .visual-card,
  .badge {
    transition: none !important;
  }
  .blob {
    animation: none;
  }
}

/* Responsive tweaks */
@media (max-width: 900px) {
  nav {
    display: none;
  }
  .menu-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
  }
}

/* Typography polish for headings */
h1,
h2,
h3 {
  font-family: var(--font-display);
  letter-spacing: -0.01em;
}