:root {
  --bg: #0d1217;
  --bg-deep: #151c24;
  --ink: #e9f0f7;
  --muted: #9cb1c6;
  --accent: #f58a4b;
  --accent-2: #38c2b2;
  --card: rgba(20, 29, 38, 0.8);
  --line: rgba(233, 240, 247, 0.12);
  --shadow: 0 14px 38px rgba(0, 0, 0, 0.35);
  --header-bg: rgba(13, 18, 23, 0.84);
  --nav-hover-bg: rgba(255, 255, 255, 0.08);
  --mobile-nav-bg: #1a232d;
  --glow-1: #1f2a36;
  --glow-2: #14363d;
}

body.theme-light {
  --bg: #f5f1e8;
  --bg-deep: #ead8ba;
  --ink: #1f1a17;
  --muted: #3f3832;
  --accent: #e86a33;
  --accent-2: #0f8b8d;
  --card: rgba(255, 250, 242, 0.82);
  --line: rgba(31, 26, 23, 0.14);
  --shadow: 0 12px 40px rgba(52, 36, 22, 0.12);
  --header-bg: rgba(245, 241, 232, 0.92);
  --nav-hover-bg: rgba(31, 26, 23, 0.08);
  --mobile-nav-bg: rgba(255, 250, 242, 0.98);
  --glow-1: #fff6e9;
  --glow-2: #d7f3ef;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: clip;
}

section[id] {
  scroll-margin-top: 92px;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at 20% 15%, var(--glow-1) 0%, transparent 40%),
    radial-gradient(circle at 84% 8%, var(--glow-2) 0%, transparent 35%),
    linear-gradient(170deg, var(--bg), var(--bg-deep));
  min-height: 100vh;
  line-height: 1.6;
}

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

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

.bg-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.18;
  background-image: radial-gradient(rgba(255, 255, 255, 0.1) 0.5px, transparent 0.5px);
  background-size: 3px 3px;
}

.container {
  width: min(1120px, 92%);
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(8px);
  background: var(--header-bg);
  border-bottom: 1px solid var(--line);
}

.nav-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 72px;
}

.logo {
  font-family: "Fraunces", serif;
  text-decoration: none;
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--ink);
  font-size: 1.45rem;
}

.site-nav {
  display: flex;
  gap: 1rem;
  align-items: center;
}

.site-nav a {
  text-decoration: none;
  color: var(--muted);
  font-weight: 600;
  padding: 0.45rem 0.7rem;
  border-radius: 10px;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.ni {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  opacity: 0.7;
  transition: opacity 0.2s ease;
}

.ni svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.site-nav a:hover .ni,
.site-nav a.active .ni {
  opacity: 1;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--ink);
  background: var(--nav-hover-bg);
}

@media (min-width: 941px) {
  .site-nav a.active {
    box-shadow: inset 0 -2px 0 var(--accent);
  }
}

.menu-btn {
  display: none;
  border: 1px solid var(--line);
  background: var(--nav-hover-bg);
  padding: 0.5rem 0.8rem;
  border-radius: 8px;
  font-weight: 600;
  color: var(--ink);
}

.theme-btn {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  border: 1px solid var(--line);
  background: var(--header-bg);
  color: var(--ink);
  padding: 0.52rem 0.82rem;
  border-radius: 999px;
  font-weight: 700;
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
}

.theme-btn:hover {
  background: var(--nav-hover-bg);
}

.section {
  padding: 4.6rem 0;
}

.hero {
  padding-top: 5.2rem;
  position: relative;
  overflow: clip;
}

.hero-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(72px);
  pointer-events: none;
  animation: orb-float 9s ease-in-out infinite alternate;
  z-index: 0;
}

.hero-orb-1 {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, var(--accent), transparent 70%);
  opacity: 0.11;
  top: -100px;
  right: -60px;
}

.hero-orb-2 {
  width: 300px;
  height: 300px;
  background: radial-gradient(circle, var(--accent-2), transparent 70%);
  opacity: 0.09;
  bottom: 0;
  left: -60px;
  animation-delay: -4.5s;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 2.2rem;
  align-items: center;
  position: relative;
  z-index: 1;
}

.eyebrow {
  margin: 0;
  color: var(--accent-2);
  font-weight: 700;
  letter-spacing: 1.5px;
}

.hero-title,
.page-title,
.section-title {
  font-family: "Fraunces", serif;
  line-height: 1.1;
}

.hero-title {
  font-size: clamp(2.1rem, 5vw, 4.2rem);
  margin: 0.7rem 0 1rem;
}

.hero-sub,
.page-subtitle {
  color: color-mix(in srgb, var(--ink) 74%, var(--bg));
  max-width: 65ch;
}

.hero-actions {
  display: flex;
  gap: 0.9rem;
  margin-top: 1.4rem;
}

.btn {
  text-decoration: none;
  color: #0d1217;
  background: #e9f0f7;
  border: 1px solid #e9f0f7;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  font-weight: 700;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.3) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.5s ease;
  pointer-events: none;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.btn:hover::after {
  transform: translateX(120%);
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
}

.hero-card,
.card,
.panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 1.2rem;
  transition: transform 0.28s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.28s ease, border-color 0.28s ease;
}

.card:hover {
  transform: translateY(-5px) scale(1.01);
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.45);
  border-color: rgba(56, 194, 178, 0.4);
}

.hero-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 24px 56px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(56, 194, 178, 0.25);
}

.panel:hover {
  transform: translateX(5px);
  border-left: 3px solid var(--accent);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.4);
}

.hero-card h2 {
  margin-top: 0;
  font-family: "Fraunces", serif;
}

.hero-card ul {
  margin: 0;
  padding-left: 1.2rem;
}

.cards {
  display: grid;
  gap: 1rem;
}

.cards.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card h3 {
  margin-top: 0;
}

.project-card {
  max-height: 430px;
  overflow: auto;
  padding-right: 0.75rem;
}

.project-card::-webkit-scrollbar {
  width: 7px;
}

.project-card::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 999px;
}

.page-head {
  margin-bottom: 2rem;
}

.page-title {
  margin: 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
}

.list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.85rem;
}

.list li {
  padding: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.timeline {
  display: grid;
  gap: 1rem;
}

.timeline-item h3,
.timeline-item p {
  margin: 0.2rem 0;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.1rem 0 2.2rem;
  color: var(--muted);
}

/* Contact Form Styles */
.contact-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 2rem;
  margin-top: 2rem;
}

.contact-form {
  display: grid;
  gap: 1rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  padding: 2rem;
  box-shadow: var(--shadow);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.contact-form label {
  font-weight: 600;
  color: var(--ink);
}

.contact-form input,
.contact-form textarea {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink);
  padding: 0.8rem;
  border-radius: 10px;
  font-family: inherit;
  font-size: 1rem;
  transition: border-color 0.2s ease;
}

body.theme-light .contact-form input,
body.theme-light .contact-form textarea {
  background: rgba(255, 255, 255, 0.55);
}

body.theme-light .resume-tags span {
  background: rgba(31, 26, 23, 0.05);
}

.contact-form input:focus,
.contact-form textarea:focus {
  outline: none;
  border-color: var(--accent-2);
  background: rgba(255, 255, 255, 0.07);
}

.contact-form textarea {
  resize: vertical;
  min-height: 120px;
}

.contact-info {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  padding: 2rem;
  box-shadow: var(--shadow);
  height: fit-content;
}

.contact-info h2 {
  margin: 0 0 0.5rem;
  font-family: "Fraunces", serif;
  color: var(--ink);
}

.info-group {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.info-group h4 {
  margin: 0;
  color: var(--accent-2);
  font-weight: 700;
  font-size: 0.9rem;
}

.info-group p {
  margin: 0;
  color: var(--muted);
}

/* Resume Cards */
.resume-grid {
  max-width: 600px;
  margin: 2rem auto 0;
}

.resume-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
  padding: 2rem;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  position: relative;
  overflow: hidden;
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.3s ease;
}

.resume-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.resume-card:hover {
  transform: translateY(-7px);
  box-shadow: 0 32px 64px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(56, 194, 178, 0.35);
}

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

.resume-badge {
  display: inline-flex;
  align-items: center;
  background: rgba(245, 138, 75, 0.14);
  border: 1px solid rgba(245, 138, 75, 0.32);
  color: var(--accent);
  padding: 0.22rem 0.75rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  animation: badge-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) 0.5s both;
}

.resume-year {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 500;
}

.resume-icon-row {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.resume-icon {
  width: 54px;
  height: 54px;
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(56, 194, 178, 0.14), rgba(245, 138, 75, 0.08));
  border: 1px solid rgba(56, 194, 178, 0.22);
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-2);
}

.resume-icon svg {
  width: 26px;
  height: 26px;
}

.resume-card-title {
  margin: 0;
  font-family: "Fraunces", serif;
  font-size: 1.45rem;
  color: var(--ink);
}

.resume-card-sub {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 500;
}

.resume-card-desc {
  color: var(--muted);
  margin: 0;
  line-height: 1.65;
}

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

.resume-tags span {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.resume-tags span:hover {
  color: var(--accent-2);
  border-color: rgba(56, 194, 178, 0.5);
  background: rgba(56, 194, 178, 0.08);
}

.btn-download {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #0d1217 !important;
  border: none;
  padding: 0.9rem 1.6rem;
  font-size: 1rem;
  border-radius: 12px;
  font-weight: 700;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  text-decoration: none;
}

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

.btn-download:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(245, 138, 75, 0.4);
  color: #0d1217 !important;
}

.btn-download::after {
  display: none;
}

#progbar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  z-index: 200;
  transition: width 0.08s linear;
  pointer-events: none;
  border-radius: 0 2px 2px 0;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
}

.panel.reveal {
  transform: translateX(-24px);
}

.reveal.in-view {
  animation: rise 0.65s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.panel.reveal.in-view {
  animation: slide-in-left 0.65s cubic-bezier(0.25, 1, 0.5, 1) forwards;
}

.page-title.reveal,
.section-title.reveal {
  position: relative;
}

.page-title.reveal::after,
.section-title.reveal::after {
  content: "";
  display: block;
  height: 3px;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 2px;
  margin-top: 6px;
  transition: width 0.8s cubic-bezier(0.25, 1, 0.5, 1) 0.5s;
}

.page-title.reveal.in-view::after,
.section-title.reveal.in-view::after {
  width: 52px;
}

@keyframes rise {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slide-in-left {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes orb-float {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(22px, -30px) scale(1.04); }
}

@keyframes badge-pop {
  from { opacity: 0; transform: scale(0.72); }
  to { opacity: 1; transform: scale(1); }
}

@media (max-width: 940px) {
  .hero-orb-1 {
    width: 260px;
    height: 260px;
    top: -60px;
    right: -30px;
  }

  .hero-orb-2 {
    width: 200px;
    height: 200px;
    bottom: 0;
    left: -30px;
  }

  .hero-grid,
  .cards.three,
  .resume-grid,
  .contact-grid {
    grid-template-columns: 1fr;
  }

  .project-card {
    max-height: none;
    overflow: visible;
    padding-right: 1.2rem;
  }

  .site-nav {
    position: absolute;
    left: 12px;
    right: 12px;
    top: 72px;
    flex-direction: column;
    background: var(--mobile-nav-bg);
    padding: 0.7rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    display: none;
    z-index: 50;
  }

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

  .menu-btn {
    display: inline-flex;
  }

  .contact-form,
  .contact-info,
  .resume-card {
    padding: 1.2rem;
  }

  .contact-info {
    height: auto;
  }

  .resume-card .btn {
    width: 100%;
    text-align: center;
  }

  .btn {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .section {
    padding: 3rem 0;
  }

  .hero {
    padding-top: 3.2rem;
  }
}

@media (max-width: 600px) {
  .theme-btn {
    right: 14px;
    bottom: 14px;
    padding: 0.48rem 0.76rem;
  }

  .hero-title {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
  }

  .section-title {
    font-size: 1.6rem;
  }

  .page-title {
    font-size: 1.5rem;
  }

  .contact-form,
  .contact-info {
    padding: 1rem;
  }

  .form-group {
    gap: 0.4rem;
  }

  .contact-form input,
  .contact-form textarea {
    font-size: 16px;
  }

  .btn {
    padding: 0.65rem 0.9rem;
    font-size: 0.95rem;
  }

  .page-head {
    margin-bottom: 1.4rem;
  }

  .section {
    padding: 2.2rem 0;
  }

  .cards,
  .timeline {
    gap: 0.8rem;
  }

  .cards.three {
    gap: 1rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reveal,
  .reveal.in-view,
  .hero-orb {
    opacity: 1;
    transform: none;
    animation: none;
  }

  .page-title.reveal::after,
  .section-title.reveal::after {
    transition: none;
    width: 52px;
  }

  .btn,
  .btn::after,
  .site-nav a,
  .card,
  .panel,
  .hero-card,
  .resume-card,
  .resume-tags span {
    transition: none;
  }
}
