/* Modern portfolio — semantic, themeable, no framework */

:root {
  color-scheme: dark light;
  --bg: #070a0f;
  --bg-elevated: #0f141c;
  --bg-card: #121a24;
  --text: #e9eef5;
  --text-muted: #9aa8b8;
  --accent: #5b9cff;
  --accent-2: #7cf0d6;
  --border: rgba(255, 255, 255, 0.09);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --radius: 14px;
  --font-sans: "IBM Plex Sans", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-display: "DM Sans", var(--font-sans);
  --step--1: clamp(0.875rem, 0.82rem + 0.2vw, 0.95rem);
  --step-0: clamp(1rem, 0.95rem + 0.25vw, 1.1rem);
  --step-1: clamp(1.2rem, 1.05rem + 0.6vw, 1.45rem);
  --step-2: clamp(1.5rem, 1.2rem + 1vw, 2rem);
  --step-3: clamp(2rem, 1.5rem + 1.8vw, 2.75rem);
  --step-4: clamp(2.5rem, 1.8rem + 2.5vw, 3.5rem);
  --space: clamp(1rem, 0.6rem + 1.5vw, 2rem);
  --maxw: 72rem;
}

[data-theme="light"] {
  --bg: #f4f6fa;
  --bg-elevated: #ffffff;
  --bg-card: #ffffff;
  --text: #0f1722;
  --text-muted: #4b5c6f;
  --border: rgba(15, 23, 34, 0.1);
  --shadow: 0 20px 60px rgba(15, 23, 34, 0.12);
}

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

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(1200px 600px at 10% -10%, rgba(91, 156, 255, 0.18), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(124, 240, 214, 0.1), transparent 50%);
  min-height: 100vh;
}

a {
  color: var(--accent);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent-2);
}

.skip-link {
  position: absolute;
  left: -9999px;
  z-index: 999;
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: #041018;
  font-weight: 600;
  border-radius: 8px;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

.wrap {
  width: min(100% - 2 * var(--space), var(--maxw));
  margin-inline: auto;
}

/* Nav */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid var(--border);
}

/* Nav layout: brand left, nav right, toggle hidden on desktop */
.nav-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 0;
}

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step--1);
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
  margin-right: auto;
}

.brand:hover {
  color: var(--accent);
}

#primary-nav {
  display: flex;
  align-items: center;
}

.nav-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font: inherit;
}

.nav-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 1.25rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  font-size: var(--step--1);
}

.nav-links a:hover,
.nav-links a[aria-current="true"] {
  color: var(--text);
}

.theme-toggle {
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  border-radius: 999px;
  padding: 0.4rem 0.75rem;
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  line-height: 1;
  display: inline-flex;
  align-items: center;
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Dark mode (default): show sun to switch to light */
.theme-icon-light { display: none; }
.theme-icon-dark  { display: inline; }

/* Light mode: show moon to switch back to dark */
[data-theme="light"] .theme-icon-dark  { display: none; }
[data-theme="light"] .theme-icon-light { display: inline; }

@media (max-width: 768px) {
  /* Wrap nav to second row; toggle shows on the first row, right-aligned */
  .nav-inner {
    flex-wrap: wrap;
  }

  /* brand stays col 1 row 1, toggle is col 2 row 1 (auto because margin-right:auto on brand) */
  .nav-toggle {
    display: inline-flex;
  }

  /* nav wraps to its own full-width row */
  #primary-nav {
    width: 100%;
    order: 3;
  }

  .nav-links {
    display: none;
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    padding: 0.5rem 0;
    border-top: 1px solid var(--border);
  }

  .nav-links.is-open {
    display: flex;
  }

  .nav-links a {
    padding: 0.6rem 0.25rem;
  }

  .nav-links li:last-child {
    padding-top: 0.25rem;
  }
}

/* Hero */
.hero {
  padding: clamp(3rem, 8vw, 6rem) 0 clamp(3rem, 6vw, 5rem);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 2rem;
  align-items: center;
}

@media (min-width: 900px) {
  .hero-grid {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  }
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: var(--step--1);
  margin: 0 0 1rem;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: var(--step-4);
  line-height: 1.1;
  letter-spacing: -0.03em;
  margin: 0 0 0.75rem;
}

.hero-lead {
  font-size: var(--step-1);
  color: var(--text-muted);
  max-width: 42ch;
  margin: 0 0 1.5rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.65rem 1.15rem;
  border-radius: 10px;
  font-weight: 600;
  font-size: var(--step--1);
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #3d7ee8);
  color: #041018;
  border-color: transparent;
}

.btn-primary:hover {
  filter: brightness(1.06);
  color: #041018;
}

.btn-ghost {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--border);
}

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

.hero-photo {
  justify-self: start;
  width: min(200px, 100%);
  aspect-ratio: 1;
  border-radius: 20px;
  object-fit: cover;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  background: var(--bg-card);
}

/* Sections */
section {
  padding: clamp(3rem, 6vw, 5rem) 0;
}

section:nth-of-type(even) {
  background: color-mix(in srgb, var(--bg-elevated) 88%, transparent);
  border-block: 1px solid var(--border);
}

.section-head {
  max-width: 52ch;
  margin-bottom: 2rem;
}

.section-head h2 {
  font-family: var(--font-display);
  font-size: var(--step-3);
  letter-spacing: -0.02em;
  margin: 0 0 0.5rem;
}

.section-head p {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--step-1);
}

/* Cards grid */
.cards {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 768px) {
  .cards.cols-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.35rem 1.25rem;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

.card h3 {
  font-family: var(--font-display);
  font-size: var(--step-1);
  margin: 0 0 0.25rem;
}

.card .sub {
  font-size: var(--step--1);
  color: var(--accent-2);
  margin: 0 0 0.75rem;
}

.card p {
  margin: 0 0 1rem;
  color: var(--text-muted);
  font-size: var(--step--1);
}

.card ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-muted);
  font-size: var(--step--1);
}

.card li + li {
  margin-top: 0.45rem;
}

/* Experience */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.exp-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem 1.35rem 1.15rem;
}

.exp-card header {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  margin-bottom: 0.75rem;
}

.exp-card h3 {
  font-family: var(--font-display);
  font-size: var(--step-1);
  margin: 0;
}

.exp-role {
  font-size: var(--step--1);
  color: var(--text-muted);
  margin: 0;
}

.exp-dates {
  font-size: var(--step--1);
  color: var(--text-muted);
  margin: 0;
  opacity: 0.7;
}

.exp-card ul {
  margin: 0;
  padding-left: 1.1rem;
  color: var(--text-muted);
  font-size: var(--step--1);
}

.exp-card li + li {
  margin-top: 0.45rem;
}

/* Skills */
.skill-grid {
  display: grid;
  gap: 1rem;
}

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

@media (min-width: 960px) {
  .skill-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.skill-block h3 {
  font-family: var(--font-display);
  font-size: var(--step--1);
  margin: 0 0 0.65rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.tag {
  font-size: var(--step--1);
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 70%, var(--accent));
  color: var(--text);
}

/* FAQ */
.faq details {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
  margin-bottom: 0.65rem;
}

.faq summary {
  cursor: pointer;
  font-weight: 600;
  font-family: var(--font-display);
}

.faq details[open] summary {
  margin-bottom: 0.5rem;
}

.faq p {
  margin: 0;
  color: var(--text-muted);
  font-size: var(--step--1);
}

/* Contact */
.contact-links {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-width: 36rem;
}

.contact-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s, color 0.15s;
}

.contact-item:hover {
  border-color: var(--accent);
  color: var(--accent-2);
}

.contact-label {
  font-weight: 600;
  font-size: var(--step--1);
  color: var(--text);
}

.contact-arrow {
  font-size: var(--step--1);
  color: var(--text-muted);
  transition: color 0.15s, transform 0.15s;
  display: inline-block;
}

.contact-item:hover .contact-arrow {
  color: var(--accent-2);
  transform: translate(2px, -2px);
}

form .field {
  margin-bottom: 0.85rem;
}

form label {
  display: block;
  font-size: var(--step--1);
  font-weight: 600;
  margin-bottom: 0.35rem;
}

form input,
form textarea {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
}

form input:focus-visible,
form textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

form button[type="submit"] {
  margin-top: 0.25rem;
}

.honeypot {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* Footer */
.site-footer {
  padding: 2rem 0 2.5rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: var(--step--1);
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  justify-content: space-between;
  align-items: center;
}
