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

:root {
  --bg: #070814;
  --surface: #11182b;
  --accent: #5a7bff;
  --accent2: #1ae3c9;
  --text: #f0f3ff;
  --text-bright: #ffffff;
  --body-copy: #aab5d4;
  --muted: #7b85a8;
  --border: rgba(79, 110, 247, 0.22);
  --font-display: 'Syne', system-ui, sans-serif;
  --font-mono: 'Space Mono', ui-monospace, monospace;
}

html, body {
  height: 100%;
}

html {
  scrollbar-gutter: stable;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-mono);
  min-height: 100vh;
  line-height: 1.6;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:visited:not(.nav-link):not(.footer-icons a) {
  color: var(--accent2);
}

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--text-bright);
}

h1 { font-size: 2rem; margin-bottom: 1rem; }
h2 { font-size: 1.4rem; margin-bottom: 1rem; }


/* Shared */

.body-copy {
  font-size: 0.82rem;
  line-height: 1.85;
  color: var(--body-copy);
  margin-bottom: 0.85rem;

  &:last-child { margin-bottom: 0; }
}


/* Layout */

.wrapper {
  position: relative;
  z-index: 1;
  max-width: 680px;
  width: 92vw;
  margin: 0 auto;
  padding-top: 100px;
  padding-bottom: 160px;

  @media (max-width: 599px) {
    padding-top: 28px;
    padding-bottom: 48px;
  }
}

.container {
  padding: 40px 0;
}


/* Animations */

@keyframes fall {
  0%   { transform: translateY(0); opacity: 0; }
  10%  { opacity: 0.5; }
  90%  { opacity: 0.2; }
  100% { transform: translateY(105vh); opacity: 0; }
}


/* Background layers */

.grid-bg {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(rgba(79, 110, 247, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 110, 247, 0.04) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
  z-index: 0;
}

.glow-bg {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 50% -10%, rgba(79, 110, 247, 0.18) 0%, transparent 70%),
    radial-gradient(ellipse 40% 40% at 85% 90%, rgba(0, 212, 170, 0.08) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  top: -130px;
  width: 1px;
  background: linear-gradient(to bottom, transparent, var(--accent));
  opacity: 0;
  animation: fall linear infinite;
}


/* Header */

.site-header {
  position: relative;
  width: 100%;
  padding: 12px 20px;
  background: transparent;
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: hidden;

  &::before {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    backdrop-filter: blur(12px);
    background: rgba(11, 13, 30, 0.55);
    -webkit-backdrop-filter: blur(12px);
    mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, black 40%, transparent 100%);
  }

  @media (min-width: 600px) {
    position: fixed;
    top: 0;
    left: 0;
    padding: 8px 0 12px;
  }
}

.hamburger {
  cursor: pointer;
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
  width: 24px;
  height: 18px;
  position: relative;
  z-index: 6;
  background: none;
  border: none;
  padding: 0;

  & span {
    display: block;
    width: 100%;
    height: 2px;
    background: var(--text);
    transition: transform 0.3s, opacity 0.3s;
  }

  &.open span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
  &.open span:nth-child(2) { opacity: 0; }
  &.open span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

  @media (min-width: 600px) {
    display: none;
  }
}

#mobile-nav {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  justify-content: center;
  align-items: center;
  background: transparent;
  backdrop-filter: blur(0);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, backdrop-filter 0.3s ease, background 0.3s ease;
  z-index: 5;

  &.open {
    opacity: 1;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(10px);
    pointer-events: auto;

    & a { opacity: 1; transform: translateY(0); }
    & a:nth-child(1) { transition-delay: 0.05s; }
    & a:nth-child(2) { transition-delay: 0.10s; }
    & a:nth-child(3) { transition-delay: 0.15s; }
  }

  & a {
    display: block;
    width: 100%;
    text-align: center;
    color: var(--text);
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
  }

  @media (min-width: 600px) {
    position: static;
    inset: auto;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 24px;
    font-size: 0.82rem;
    letter-spacing: 0.12em;
    opacity: 1;
    pointer-events: auto;
    background: transparent !important;
    backdrop-filter: none !important;

    & a {
      opacity: 1;
      transform: none;
      transition: none;
      width: auto;
    }
  }
}

.nav-link {
  color: var(--text);
  text-decoration: none;
  position: relative;

  &::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width 0.3s;
  }

  &:visited { color: var(--text); }

  @media (min-width: 600px) {
    &.active::after { width: 100%; }
    &:hover::after { width: 100%; }
  }

  @media (max-width: 599px) {
    &.active,
    &.active:visited {
      color: var(--accent);
      text-decoration: none;
    }

    &.active::after { width: 0; }
  }
}

@media (min-width: 600px) {
  #mobile-nav:hover .nav-link.active:not(:hover)::after {
    width: 0;
  }
}


/* Footer */

.site-footer {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 20px 0 28px;
  color: rgba(221, 226, 255, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: transparent;
  overflow: hidden;

  &::before {
    content: '';
    position: absolute;
    inset: -18px 0 0 0;
    pointer-events: none;
    z-index: -1;
    backdrop-filter: blur(12px);
    background: rgba(11, 13, 30, 0.55);
    -webkit-backdrop-filter: blur(12px);
    mask-image: linear-gradient(to top, black 40%, rgba(0,0,0,0.85) 55%, rgba(0,0,0,0.6) 70%, rgba(0,0,0,0.35) 80%, transparent 100%);
    -webkit-mask-image: linear-gradient(to top, black 40%, rgba(0,0,0,0.85) 55%, rgba(0,0,0,0.6) 70%, rgba(0,0,0,0.35) 80%, transparent 100%);
  }

  @media (min-width: 600px) {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
  }
}

.domain {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  color: var(--muted);

  & span { color: var(--accent2); }
}

.footer-icons {
  display: flex;
  gap: 16px;
  align-items: center;

  & a {
    color: var(--text);
    font-size: 1.25rem;
    transition: color 0.3s;

    &:hover,
    &:focus { color: var(--accent); }
  }
}


/* Home page */

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;

  @media (max-width: 599px) {
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: 24px;
  }
}

.portrait {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 2px solid var(--border);
  object-fit: cover;
  flex-shrink: 0;
  filter: grayscale(0.2);
  transition: filter 0.4s, border-color 0.4s;

  &:hover {
    filter: grayscale(0);
    border-color: var(--accent);
  }

  @media (max-width: 599px) {
    width: 100px;
    height: 100px;
  }
}

.name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.6rem, 7vw, 4.2rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: var(--text-bright);

  & span {
    display: block;
    background: linear-gradient(90deg, #7b95ff, var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
}

.role {
  margin-top: 14px;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.divider {
  margin: 36px 0;
  height: 1px;
  background: linear-gradient(to right, var(--accent), var(--accent2), transparent);
  opacity: 0.3;
}

.body-text {
  max-width: 520px;
}

.tag-groups {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 40px;
}

.tag-group-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.tag-group-icon {
  color: var(--accent);
  font-size: 0.9rem;
}

.tag-group-label {
  display: block;
  font-size: 0.62rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tag {
  font-size: 0.65rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 2px;
  color: var(--muted);
  transition: border-color 0.3s, color 0.3s;

  &:hover {
    border-color: rgba(79, 110, 247, 0.5);
    color: var(--accent);
    cursor: default;
  }
}

.cta-group {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-top: 36px;
}

.cta {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  position: relative;
  transition: color 0.3s;

  &::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width 0.3s;
  }

  &:hover::after { width: 100%; }
  &:visited { color: var(--accent); }
}

.cta--outline {
  color: var(--muted);

  &::after { background: var(--muted); }
  &:hover { color: var(--accent); }
  &:hover::after { background: var(--accent); }
  &:visited { color: var(--muted); }
}


/* About page */

.about-lead {
  font-size: 0.9rem;
  color: var(--text);
  max-width: 540px;
}

.about-stats {
  display: flex;
  margin: 32px 0;
  border: 1px solid var(--border);
  border-radius: 4px;
  overflow: hidden;
}

.about-stat {
  flex: 1;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.about-stat + .about-stat {
  border-left: 1px solid var(--border);
}

.about-stat-num {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}

.about-stat-label {
  font-size: 0.6rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.about-journey {
  margin-top: 8px;
  padding-left: 20px;
  border-left: 2px solid var(--border);
}

.about-step {
  position: relative;
  padding: 0 0 26px 24px;

  &:last-child { padding-bottom: 0; }

  &::before {
    content: '';
    position: absolute;
    left: -5px;
    top: 5px;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent);
    border: 2px solid var(--bg);
  }
}

.about-step-year {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.18em;
  color: var(--accent2);
  margin-bottom: 6px;
}


/* Timeline */

.timeline {
  position: relative;
  padding-left: 20px;
  margin-top: 20px;

  &::before {
    content: '';
    position: absolute;
    left: 8px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
  }
}

.timeline-item {
  position: relative;
  margin-bottom: 28px;
  padding-left: 20px;

  & h3 {
    font-size: 1rem;
    margin-bottom: 2px;
  }

  & p { margin-top: 6px; }
}

.at { color: var(--muted); }

.meta {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-top: 2px;
}


/* Education & Courses */

#education-list,
#courses-list {
  list-style: none;
  margin-top: 16px;

  & li { margin-bottom: 12px; }
  & h3 { font-size: 0.95rem; }
}

#courses-list h3 .cert-link {
  color: var(--text-bright);
  text-decoration: none;
  transition: color 0.3s;

  &:hover { color: var(--accent2); }
}

.cert-arrow {
  font-size: 0.75em;
  color: var(--accent);
  transition: color 0.3s;
  margin-left: 4px;

  .cert-link:hover & { color: var(--accent2); }
}

.cert-sub {
  list-style: none;
  margin-top: 8px;
  padding-left: 12px;
  border-left: 1px solid var(--border);

  & li {
    font-size: 0.68rem;
    color: var(--muted);
    letter-spacing: 0.04em;
    margin-bottom: 4px;

    &:last-child { margin-bottom: 0; }
  }
}


/* Languages & Interests */

.info-list {
  list-style: none;
  margin-top: 16px;

  & li { margin-bottom: 8px; }
}


/* Projects */

.page-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.2rem, 6vw, 3.2rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--text-bright);

  & span {
    display: block;
    background: linear-gradient(90deg, #7b95ff, var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
}

.project-card {
  position: relative;
  padding: 24px 28px;
  margin: 40px 0;
  background: var(--surface);
  border-radius: 6px;
  border-left: 3px solid var(--border);

  & h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
    letter-spacing: -0.02em;
    color: var(--text-bright);
  }

  & .meta {
    font-size: 0.7rem;
    letter-spacing: 0.1em;
    color: var(--muted);
    display: block;
    margin-bottom: 12px;
    font-family: var(--font-mono);
  }

  & .body-copy {
    font-size: 0.8rem;
    line-height: 1.7;
    color: var(--body-copy);
  }

  & .tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
  }

  & .tag {
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 2px;
    color: var(--muted);
    transition: all 0.2s;
    font-family: var(--font-mono);
  }

  & .tag:hover {
    border-color: var(--accent2);
    color: var(--accent2);
  }

  & > div {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 16px;
  }
}

.project-link {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent2);
  position: relative;
  transition: all 0.3s;
  font-family: var(--font-mono);

  &::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 0;
    height: 1px;
    background: var(--accent2);
    transition: width 0.3s;
  }

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

  &:hover::after {
    width: 100%;
    background: var(--accent);
  }

  &:visited { color: var(--accent2); }
}

.project-demo {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  position: relative;
  transition: all 0.3s;
  font-family: var(--font-mono);

  &::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -4px;
    width: 0;
    height: 1px;
    background: var(--accent);
    transition: width 0.3s;
  }

  &:hover {
    color: var(--accent2);
  }

  &:hover::after {
    width: 100%;
    background: var(--accent2);
  }

  &:visited { color: var(--accent); }
}


/* Back to top */

.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 88px; /* clears the fixed desktop footer (~70px) */
  z-index: 998;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.78rem;
  cursor: pointer;
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s, color 0.3s, border-color 0.3s;

  &.visible {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }

  &:hover {
    color: var(--accent);
    border-color: rgba(79, 110, 247, 0.5);
  }

  @media (max-width: 599px) {
    /* footer is in-flow on mobile, so sit near the viewport edge */
    bottom: 20px;
    right: 16px;
  }
}


.cert-pdf-btn {
  margin-left: 10px;
  vertical-align: middle;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: 4px 10px;
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.3s, border-color 0.3s;

  &:hover {
    color: var(--accent2);
    border-color: rgba(26, 227, 201, 0.4);
  }

  & i { font-size: 0.8em; }
}


/* PDF modal */

.cert-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;

  &[hidden] { display: none; }
}

.cert-modal-inner {
  position: relative;
  width: 100%;
  max-width: 860px;
  height: min(88vh, 960px);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  display: flex;
  flex-direction: column;
}

.cert-modal-close {
  position: absolute;
  top: -16px;
  right: -16px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.3s, border-color 0.3s;
  z-index: 1;

  &:hover {
    color: var(--text-bright);
    border-color: rgba(79, 110, 247, 0.5);
  }
}

.cert-frame {
  flex: 1;
  width: 100%;
  border: none;
  border-radius: 4px;
}

.cert-img {
  flex: 1;
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 4px;
}


/* Skip link */

.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  z-index: 9999;
  border-radius: 0 0 4px 4px;
  transition: top 0.2s;
  text-decoration: none;
}

.skip-link:focus {
  top: 0;
}


/* Focus ring */

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


/* Scroll reveal */

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.reveal.revealed {
  opacity: 1;
  transform: none;
}


/* Reduced motion */

@media (prefers-reduced-motion: reduce) {
  .particle { animation: none !important; }

  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}