:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-muted: #e7ece8;
  --ink: #17201b;
  --muted: #5f6c65;
  --line: #d7ded8;
  --accent: #176b5b;
  --accent-strong: #0f4f43;
  --accent-soft: #d9eee8;
  --warm: #c98333;
  --grid-line: rgba(23, 107, 91, 0.12);
  --grid-accent: rgba(201, 131, 51, 0.12);
  --shadow: 0 24px 60px rgba(23, 32, 27, 0.12);
}

:root.dark-theme {
  --bg: #101613;
  --surface: #18211d;
  --surface-muted: #22302a;
  --ink: #edf3ee;
  --muted: #aab8b0;
  --line: #2c3a33;
  --accent: #66d1b8;
  --accent-strong: #a3ead8;
  --accent-soft: #203d36;
  --warm: #f0b96f;
  --grid-line: rgba(102, 209, 184, 0.1);
  --grid-accent: rgba(240, 185, 111, 0.12);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, var(--accent-soft), transparent 28rem),
    var(--bg);
  line-height: 1.6;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px),
    linear-gradient(var(--grid-accent) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-accent) 1px, transparent 1px);
  background-position:
    0 0,
    0 0,
    12px 12px,
    12px 12px;
  background-size:
    44px 44px,
    44px 44px,
    176px 176px,
    176px 176px;
  -webkit-mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.58) 58%, transparent);
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.95), rgba(0, 0, 0, 0.58) 58%, transparent);
}

.site-header,
main,
.site-footer {
  position: relative;
  z-index: 1;
}

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

p,
h1,
h2,
h3 {
  margin-top: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(246, 247, 244, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.dark-theme .site-header {
  background: rgba(16, 22, 19, 0.88);
}

.nav {
  width: min(1120px, calc(100% - 40px));
  min-height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand-group {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.brand {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0;
}

.theme-toggle {
  position: relative;
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 0;
  color: var(--accent-strong);
  background: transparent;
  box-shadow: none;
  cursor: pointer;
  transition: color 160ms ease, transform 160ms ease;
}

.dark-theme .theme-toggle {
  box-shadow: none;
}

.theme-toggle:hover {
  transform: translateY(-2px);
  color: var(--warm);
}

.theme-icon {
  position: absolute;
  transition: opacity 160ms ease, transform 160ms ease;
}

.moon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  box-shadow: -5px 2px 0 0 currentColor;
  transform: translateX(3px);
}

.sun {
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 50%;
  opacity: 0;
  transform: scale(0.72) rotate(45deg);
}

.sun::before,
.sun::after {
  content: "";
  position: absolute;
  inset: -7px 6px;
  border-top: 3px solid currentColor;
  border-bottom: 3px solid currentColor;
}

.sun::after {
  transform: rotate(90deg);
}

.dark-theme .moon {
  opacity: 0;
  transform: translateX(3px) scale(0.72) rotate(-35deg);
}

.dark-theme .sun {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 600;
}

.nav-links a:hover,
.project-links a:hover {
  color: var(--accent);
}

.section {
  position: relative;
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 92px 0;
}

.section::before {
  content: "";
  position: absolute;
  top: 66px;
  left: -22px;
  width: 3px;
  height: 38px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), var(--warm));
  opacity: 0;
  transform: scaleY(0.45);
  transform-origin: top;
  transition: opacity 520ms ease, transform 520ms ease;
}

.section.is-visible::before {
  opacity: 0.55;
  transform: scaleY(1);
}

.hero {
  min-height: calc(100vh - 72px);
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr);
  align-items: center;
  gap: 48px;
}

.hero-content {
  max-width: 780px;
}

.eyebrow {
  margin-bottom: 14px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  max-width: 760px;
  margin-bottom: 24px;
  font-size: clamp(2.35rem, 4.5vw, 3.75rem);
  line-height: 1.02;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 18px;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 10px;
  font-size: 1.15rem;
  line-height: 1.25;
}

.hero-text {
  max-width: 620px;
  color: var(--muted);
  font-size: 1.13rem;
}

.hero-actions,
.contact-actions,
.project-links {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.button {
  display: inline-flex;
  min-height: 46px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 18px;
  font-weight: 800;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button.primary {
  color: #ffffff;
  background: var(--accent);
}

.button.primary:hover {
  background: var(--accent-strong);
}

.button.secondary {
  color: var(--accent-strong);
  background: transparent;
  border-color: var(--line);
}

.button.secondary:hover {
  border-color: var(--accent);
}

.hero-panel {
  display: grid;
  gap: 12px;
}

.hero-panel > div,
.skill-card,
.project-card,
.timeline-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.hero-panel > div {
  padding: 22px;
  box-shadow: var(--shadow);
}

.hero-panel p {
  margin-bottom: 0;
  color: var(--muted);
}

.metric {
  display: block;
  margin-bottom: 8px;
  color: var(--accent-strong);
  font-size: 1.45rem;
  font-weight: 800;
}

.split-section {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.2fr);
  gap: 56px;
  border-top: 1px solid var(--line);
}

.text-stack p,
.section-heading p,
.project-card p,
.timeline-item p,
.contact-section p {
  color: var(--muted);
}

.text-stack p:last-child,
.project-card p:last-child,
.timeline-item p:last-child,
.contact-section p:last-child {
  margin-bottom: 0;
}

.section-heading {
  max-width: 760px;
  margin-bottom: 34px;
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.skill-card {
  padding: 24px;
}

.skill-card h3 {
  color: var(--accent-strong);
}

.skill-card p {
  margin-bottom: 0;
  color: var(--muted);
}

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

.project-card {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.hero-panel > div,
.skill-card,
.project-card,
.timeline-item {
  transition:
    border-color 180ms ease,
    box-shadow 180ms ease,
    transform 180ms ease;
}

.skill-card:hover,
.project-card:hover,
.timeline-item:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
}

.project-image {
  min-height: 180px;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--accent-strong);
  background:
    linear-gradient(135deg, rgba(23, 107, 91, 0.16), rgba(201, 131, 51, 0.16)),
    var(--surface-muted);
  font-weight: 800;
}

.project-content {
  padding: 24px;
  display: flex;
  flex: 1;
  flex-direction: column;
}

.project-type {
  margin-bottom: 8px;
  color: var(--warm);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.tag-list {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: auto 0 20px;
  padding: 16px 0 0;
}

.tag-list li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  border-radius: 999px;
  padding: 5px 11px 5px 8px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 0.78rem;
  font-weight: 800;
}

.tag-list img,
.tech-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.tag-list img {
  object-fit: contain;
}

.tech-icon {
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: var(--accent);
  font-size: 0.68rem;
  line-height: 1;
}

.project-links {
  padding-top: 4px;
}

.project-links a {
  color: var(--accent-strong);
  font-weight: 800;
}

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

.icon-link img,
.button-icon img {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.contact-section .button-icon img {
  filter: invert(1);
}

.mail-icon {
  position: relative;
  width: 18px;
  height: 14px;
  flex: 0 0 auto;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.mail-icon::before,
.mail-icon::after {
  content: "";
  position: absolute;
  top: 1px;
  width: 10px;
  height: 2px;
  background: currentColor;
  transform-origin: left center;
}

.mail-icon::before {
  left: 1px;
  transform: rotate(35deg);
}

.mail-icon::after {
  right: 1px;
  transform: rotate(145deg);
}

.timeline {
  --timeline-line-x: 8px;
  --timeline-dot-size: 18px;
  --timeline-dot-border: 4px;
  --timeline-dot-total: calc(var(--timeline-dot-size) + (var(--timeline-dot-border) * 2));
  position: relative;
  display: grid;
  gap: 24px;
  padding-left: 34px;
}

.timeline::before {
  content: "";
  position: absolute;
  top: 10px;
  bottom: 10px;
  left: var(--timeline-line-x);
  width: 2px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), var(--warm));
}

.timeline-item {
  position: relative;
  padding: 24px;
  box-shadow: 0 18px 40px rgba(23, 32, 27, 0.08);
}

.timeline-item::before {
  content: "";
  position: absolute;
  top: 28px;
  left: calc((var(--timeline-line-x) - 34px) - (var(--timeline-dot-total) / 2) + 1px);
  width: var(--timeline-dot-size);
  height: var(--timeline-dot-size);
  border: var(--timeline-dot-border) solid var(--bg);
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.timeline-item:nth-child(even)::before {
  background: var(--warm);
  box-shadow: 0 0 0 1px var(--warm);
}

.timeline-item span {
  display: inline-flex;
  min-height: 28px;
  align-items: center;
  margin-bottom: 12px;
  border-radius: 999px;
  padding: 4px 10px;
  color: var(--warm);
  background: rgba(201, 131, 51, 0.12);
  font-size: 0.85rem;
  font-weight: 800;
}

.contact-section {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto 72px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 32px;
  align-items: center;
  border-radius: 8px;
  padding: 42px;
  color: #ffffff;
  background: var(--ink);
}

.dark-theme .contact-section {
  color: var(--ink);
  background: #edf3ee;
}

.contact-section .eyebrow,
.contact-section h2,
.contact-section p {
  color: #ffffff;
}

.dark-theme .contact-section .eyebrow,
.dark-theme .contact-section h2,
.dark-theme .contact-section p {
  color: #101613;
}

.contact-section p {
  max-width: 680px;
  opacity: 0.78;
}

.contact-section .button.secondary {
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.26);
}

.dark-theme .contact-section .button.secondary {
  color: #101613;
  border-color: rgba(16, 22, 19, 0.2);
}

.dark-theme .contact-section .button-icon img {
  filter: none;
}

.site-footer {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 42px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.92rem;
}

.site-footer p {
  margin-bottom: 0;
}

.scroll-reveal {
  opacity: 0;
  transform: translateY(24px);
  transition:
    opacity 650ms ease var(--reveal-delay, 0ms),
    transform 650ms ease var(--reveal-delay, 0ms);
  will-change: opacity, transform;
}

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

.project-card.scroll-reveal,
.skill-card.scroll-reveal,
.timeline-item.scroll-reveal,
.hero-panel > div.scroll-reveal {
  transform: translateY(22px) scale(0.985);
}

.project-card.scroll-reveal.is-visible,
.skill-card.scroll-reveal.is-visible,
.timeline-item.scroll-reveal.is-visible,
.hero-panel > div.scroll-reveal.is-visible {
  transform: translateY(0) scale(1);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }

  .scroll-reveal {
    opacity: 1;
    transform: none;
  }
}

@media (max-width: 900px) {
  .nav {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
    padding: 16px 0;
  }

  .nav-links {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .hero,
  .split-section,
  .contact-section {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding-top: 70px;
  }

  .skills-grid,
  .projects-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .contact-section {
    align-items: start;
  }
}

@media (max-width: 620px) {
  .section {
    width: min(100% - 28px, 1120px);
    padding: 66px 0;
  }

  .nav,
  .contact-section,
  .site-footer {
    width: min(100% - 28px, 1120px);
  }

  .nav-links {
    gap: 16px;
    font-size: 0.88rem;
  }

  h1 {
    font-size: clamp(2.4rem, 14vw, 3.6rem);
  }

  .hero-text {
    font-size: 1rem;
  }

  .skills-grid,
  .projects-grid {
    grid-template-columns: 1fr;
  }

  .contact-section {
    margin-bottom: 48px;
    padding: 28px;
  }

  .contact-actions .button {
    width: 100%;
  }
}
