/* Color palette and reusable tokens */
:root {
  --bg: #07161b;
  --bg-soft: #0b242c;
  --surface: rgba(13, 44, 55, 0.85);
  --surface-strong: rgba(18, 64, 78, 0.95);
  --accent: #25d0a6;
  --accent-strong: #18a3ff;
  --text: #f2fbfd;
  --muted: #b4d9e2;
  --border: rgba(255, 255, 255, 0.12);
  --shadow: 0 28px 60px -45px rgba(0, 0, 0, 0.7);
  --toggle-text: #031114;
  --card-hover: translateY(-4px);
}

body.light-theme {
  --bg: #f7fcfb;
  --bg-soft: #eaf6f3;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-strong: rgba(255, 255, 255, 0.98);
  --accent: #139d85;
  --accent-strong: #1a78d6;
  --text: #132629;
  --muted: #2b4a4f;
  --border: rgba(19, 38, 41, 0.12);
  --shadow: 0 22px 50px -38px rgba(8, 29, 33, 0.22);
  --toggle-text: #ffffff;
}

/* Base reset for consistent sizing */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* Smooth scrolling for in-page navigation */
html {
  scroll-behavior: smooth;
}

/* Global body typography and background */
body {
  min-height: 100vh;
  font-family: "Manrope", "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #0f3b45 0%, var(--bg) 55%);
  color: var(--text);
  line-height: 1.6;
  position: relative;
  overflow-x: hidden;
}

body.light-theme {
  background: radial-gradient(circle at top, #dff6ef 0%, #f7fcfb 55%);
}

body::before,
body::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  opacity: 0.35;
  pointer-events: none;
}

body::before {
  top: -120px;
  right: -120px;
  background: radial-gradient(circle, rgba(37, 208, 166, 0.55), transparent 70%);
}

body::after {
  bottom: -140px;
  left: -120px;
  background: radial-gradient(circle, rgba(24, 163, 255, 0.45), transparent 70%);
}

body.light-theme::before {
  background: radial-gradient(circle, rgba(19, 157, 133, 0.12), transparent 70%);
}

body.light-theme::after {
  background: radial-gradient(circle, rgba(26, 120, 214, 0.1), transparent 70%);
}

/* Basic media elements */
img {
  max-width: 100%;
  display: block;
}

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

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

/* Centered content wrapper */
.container {
  width: min(1100px, 92vw);
  margin: 0 auto;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 16px;
  padding: 8px 16px;
  background: var(--accent);
  color: #031114;
  border-radius: 999px;
  z-index: 999;
}

.skip-link:focus {
  left: 16px;
}

.site-header {
  padding-bottom: 70px;
}

.social-bar {
  position: fixed;
  left: 24px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  gap: 14px;
  z-index: 12;
}

.social-bar::after {
  content: "";
  width: 1px;
  height: 56px;
  margin: 2px auto 0;
  background: var(--border);
}

.social-link {
  width: 46px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.social-link:hover,
.social-link:focus-visible {
  transform: translateY(-2px);
  color: var(--accent);
  border-color: rgba(37, 208, 166, 0.45);
  background: var(--surface-strong);
}

.social-icon {
  width: 20px;
  height: 20px;
}

/* Top navigation layout */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 0 12px;
  gap: 12px;
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
}

.logo {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.nav-links a {
  padding: 6px 12px;
  border-radius: 999px;
  transition: background 0.2s ease;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  background: rgba(255, 255, 255, 0.12);
}

.theme-toggle {
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--accent);
  color: var(--toggle-text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.theme-toggle:hover {
  transform: translateY(-2px);
  opacity: 0.95;
}

/* Hero layout using CSS Grid */
.hero {
  margin-top: 32px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 36px;
  align-items: center;
}

.hero-text {
  animation: fadeUp 0.8s ease forwards;
}

.eyebrow,
.panel-eyebrow {
  text-transform: uppercase;
  letter-spacing: 3px;
  font-size: 0.75rem;
  color: var(--accent);
  margin-bottom: 12px;
}

h1,
h2,
h3,
h4,
h5 {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  line-height: 1.2;
}

h1 {
  font-size: clamp(2.6rem, 4vw, 3.4rem);
  margin-bottom: 12px;
}

.tagline {
  font-size: 1.1rem;
  color: var(--muted);
  margin-bottom: 18px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 24px;
}

body.light-theme .tagline,
body.light-theme .personalize-note,
body.light-theme .section-description,
body.light-theme .repo-status,
body.light-theme .contact-details,
body.light-theme .achievement-list,
body.light-theme .repo-card p,
body.light-theme .repo-meta,
body.light-theme .empty-state,
body.light-theme .entry-subtitle,
body.light-theme .entry-text,
body.light-theme .detail-list,
body.light-theme .hero-panel-list,
body.light-theme .mini-card p,
body.light-theme .highlight-label {
  color: #355257;
}

/* Personalized greeting input */
.personalize {
  display: grid;
  gap: 8px;
  max-width: 320px;
}

.personalize label {
  font-weight: 600;
}

.personalize-note {
  color: var(--muted);
  font-size: 0.9rem;
}

.personalize input {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-family: inherit;
}

.personalize input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 208, 166, 0.2);
}

.hero-panel {
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 26px;
  background: linear-gradient(180deg, rgba(13, 44, 55, 0.92) 0%, rgba(7, 22, 27, 0.92) 100%);
  box-shadow: var(--shadow);
  animation: fadeUp 1s ease forwards;
}

body.light-theme .hero-panel {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(234, 246, 243, 0.98) 100%);
}

.hero-panel h2 {
  font-size: clamp(1.5rem, 2.8vw, 2rem);
  margin-bottom: 18px;
}

.highlight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.highlight-card {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.06);
  transition: transform 0.2s ease;
}

body.light-theme .highlight-card {
  background: rgba(19, 157, 133, 0.06);
}

.highlight-value {
  font-family: "Space Grotesk", "Segoe UI", sans-serif;
  font-size: clamp(1.15rem, 2.1vw, 1.55rem);
  font-weight: 700;
  line-height: 1.2;
}

.highlight-label {
  color: var(--muted);
  margin-top: 4px;
  font-size: 0.95rem;
  line-height: 1.35;
}

.hero-panel-list {
  list-style: none;
  display: grid;
  gap: 10px;
  margin-top: 20px;
  color: var(--muted);
}

.hero-panel-list li {
  padding-left: 18px;
  position: relative;
}

.hero-panel-list li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 10px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

body.light-theme .personalize input,
body.light-theme input,
body.light-theme textarea,
body.light-theme .sort-select,
body.light-theme .filter-button {
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
}

body.light-theme .personalize input::placeholder,
body.light-theme input::placeholder,
body.light-theme textarea::placeholder {
  color: #6d8488;
}

/* Shared section spacing */
.section {
  padding: 70px 0;
}

.section-alt {
  background: linear-gradient(180deg, rgba(7, 22, 27, 0) 0%, rgba(7, 22, 27, 0.7) 100%);
}

body.light-theme .section-alt {
  background: linear-gradient(180deg, rgba(247, 252, 251, 0) 0%, rgba(223, 246, 239, 0.95) 100%);
}

.section h2 {
  font-size: clamp(1.8rem, 3vw, 2.4rem);
  margin-bottom: 24px;
}

.section-description {
  max-width: 620px;
  color: var(--muted);
  margin-bottom: 20px;
}

/* Two-column layout that collapses on small screens */
.section-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 28px;
  align-items: start;
}

.section-stack {
  display: grid;
  gap: 24px;
}

/* Project cards grid */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.card {
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease;
}

.project-card img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.card:hover,
.highlight-card:hover,
.info-card:hover,
.timeline-card:hover,
.repo-card:hover {
  transform: var(--card-hover);
}

.card-body {
  padding: 20px;
}

.info-card,
.timeline-card {
  border: 1px solid var(--border);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease;
}

.info-card {
  padding: 26px;
}

.entry-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.entry-subtitle {
  color: var(--muted);
  margin-top: 6px;
}

.entry-date {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(37, 208, 166, 0.08);
  font-weight: 600;
  white-space: nowrap;
}

.detail-list {
  list-style: none;
  display: grid;
  gap: 12px;
  color: var(--muted);
}

.detail-list li {
  padding-left: 16px;
  border-left: 2px solid rgba(37, 208, 166, 0.35);
}

.coursework-block {
  margin-top: 26px;
}

.coursework-block h4 {
  font-size: 1.1rem;
  margin-bottom: 16px;
}

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.mini-card {
  padding: 18px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.05);
}

body.light-theme .mini-card {
  background: rgba(19, 157, 133, 0.05);
}

.mini-card h5 {
  font-size: 1rem;
  margin-bottom: 8px;
}

.mini-card p,
.entry-text {
  color: var(--muted);
}

.timeline {
  position: relative;
  display: grid;
  gap: 18px;
  padding-left: 28px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: linear-gradient(180deg, rgba(37, 208, 166, 0.9) 0%, rgba(24, 163, 255, 0.25) 100%);
}

.timeline-item {
  position: relative;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: -28px;
  top: 24px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 6px rgba(37, 208, 166, 0.12);
}

.timeline-card {
  padding: 24px;
}

.achievement-list {
  list-style: disc;
  padding-left: 18px;
  color: var(--muted);
  display: grid;
  gap: 8px;
}

.filter-bar,
.repo-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 20px;
}

.filter-button,
.sort-select {
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}

.filter-button {
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.filter-button:hover,
.filter-button.is-active {
  background: rgba(37, 208, 166, 0.15);
  border-color: rgba(37, 208, 166, 0.45);
  transform: translateY(-2px);
}

.project-card.is-hidden {
  display: none;
}

.empty-state {
  color: var(--muted);
  margin-top: 18px;
}

.sort-label {
  font-weight: 600;
}

.repo-status {
  color: var(--muted);
  margin-bottom: 18px;
}

.repo-status.error {
  color: #ff8d8d;
}

.repo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
}

.repo-card {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  transition: transform 0.2s ease;
}

.repo-card h3 {
  margin-bottom: 10px;
}

.repo-card p {
  color: var(--muted);
  margin-bottom: 14px;
}

.repo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 0.95rem;
}

.repo-link {
  color: var(--accent);
  font-weight: 600;
}

.repo-link:hover {
  color: var(--accent-strong);
}

.contact-details {
  margin-top: 14px;
  display: grid;
  gap: 8px;
}

/* Contact form layout */
.contact-form {
  display: grid;
  gap: 12px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.contact-form label {
  font-weight: 600;
}

input,
textarea {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-family: inherit;
}

input:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37, 208, 166, 0.2);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--accent);
  color: #031114;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  box-shadow: var(--shadow);
}

.button:hover,
.button:focus-visible {
  color: #031114;
  transform: translateY(-2px);
}

.button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.form-note {
  min-height: 20px;
  color: var(--muted);
  font-size: 0.9rem;
}

.form-note.visible {
  color: var(--accent);
}

.form-note.error {
  color: #ff8d8d;
}

.footer-actions {
  display: flex;
  justify-content: center;
  padding: 12px 0 0;
}

.back-to-top {
  width: 54px;
  height: 54px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 1.4rem;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}

.back-to-top:hover,
.back-to-top:focus-visible {
  transform: translateY(-2px);
  color: var(--accent);
  border-color: rgba(37, 208, 166, 0.45);
  background: var(--surface-strong);
}

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

/* Scroll reveal animation */
body.reveal-ready .reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s ease;
  will-change: opacity, transform;
}

body.reveal-ready .reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Mobile tweaks */
@media (max-width: 720px) {
  .nav {
    flex-direction: column;
    align-items: flex-start;
  }

  .social-bar {
    left: 50%;
    top: auto;
    bottom: 18px;
    transform: translateX(-50%);
    grid-auto-flow: column;
    grid-template-columns: repeat(4, auto);
    align-items: center;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    backdrop-filter: blur(10px);
  }

  .social-bar::after {
    width: 42px;
    height: 1px;
    margin: 0 0 0 4px;
  }

  .highlight-grid {
    grid-template-columns: 1fr;
  }

  .timeline {
    padding-left: 22px;
  }

  .timeline-item::before {
    left: -22px;
  }

  .theme-toggle,
  .button {
    width: 100%;
  }

  .sort-select {
    width: 100%;
  }
}

/* Respect reduced motion preference */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }

  body.reveal-ready .reveal {
    opacity: 1;
    transform: none;
  }

  html {
    scroll-behavior: auto;
  }
}

/* Footer */
.site-footer {
  margin-top: 40px;
  padding: 28px 0 40px;
  text-align: center;
  color: var(--muted);
  border-top: 1px solid var(--border);
}
