/* =====================================
   TOKENS
===================================== */
:root {
  --bg: #0b0c0e;
  --text: #f2f5f8;
  --muted: #b8c1cc;
  --line: rgba(120, 170, 210, 0.25);
  --blue: #1b8fd0;
  --blue-deep: #0a4a7a;
  --panel: rgba(30, 50, 70, 0.35);

  /* CHANGE THIS TO TEST DIFFERENT FONTS */
  --heading-font: "Manrope", sans-serif;

  --sans: "DM Sans", sans-serif;
  --display: var(--heading-font);

  /* Side padding that scales with the screen and respects phone notches */
  --gutter: clamp(1.25rem, 5vw, 2rem);
  --pad-l: max(var(--gutter), env(safe-area-inset-left, 0px));
  --pad-r: max(var(--gutter), env(safe-area-inset-right, 0px));
  --section-y: clamp(3.5rem, 9vw, 5.5rem);
}

/* =====================================
   RESET & BASE
===================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: clip;
}

body {
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  font-size: 16px;
  min-height: 100vh;
  overflow-x: clip;
  overflow-wrap: break-word;
}

a {
  color: inherit;
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

/* =====================================
   BACKGROUND GLOW
===================================== */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(27, 143, 208, .9) 0%, rgba(14, 70, 115, .7) 18%, rgba(11, 12, 14, 0) 48%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, .025) 0 1px, transparent 1px 90px);
  opacity: var(--glow, 1);
  transform: translateX(calc(var(--shift, 0) * -12%));
  will-change: opacity, transform;
  animation: glow-in 1.6s ease-out backwards;
}

@keyframes glow-in {
  from {
    opacity: 0;
  }
}

/* =====================================
   TOP BAR & NAVIGATION
===================================== */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: calc(1.3rem + env(safe-area-inset-top, 0px)) var(--pad-r) 1.3rem var(--pad-l);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(1rem, 2vw, 2.2rem);
  padding: 0.7rem clamp(1rem, 2vw, 2.2rem);
  border: 1px solid var(--line);
  background: rgba(8, 20, 32, .5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  white-space: nowrap;
}

.nav a {
  color: var(--text);
  font-family: var(--heading-font);
  font-size: .88rem;
  font-weight: 500;
  transition: color .2s;
}

.nav a:hover,
.nav a.active {
  color: var(--blue);
}

.topbar .resume {
  position: absolute;
  right: var(--pad-r);
  top: calc(50% + env(safe-area-inset-top, 0px) / 2);
  transform: translateY(-50%);
  padding: 0.35rem 0.9rem;
  font-size: 0.8rem;
}

/* =====================================
   BUTTONS
===================================== */
.btn {
  display: inline-block;
  max-width: 100%;
  white-space: nowrap;
  font-family: var(--sans);
  font-size: .95rem;
  font-weight: 600;
  padding: .7rem 1.5rem;
  transition: filter .2s, background .2s;
}

.btn-primary {
  background: linear-gradient(90deg, #1b9be0, #0b5d96);
  color: #fff;
}

.btn-primary:hover {
  filter: brightness(1.15);
}

.btn-ghost {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: .65rem 1.7rem;
}

.btn-ghost:hover {
  background: rgba(27, 143, 208, .35);
}

/* =====================================
   SOCIAL ICONS
===================================== */
.socials {
  position: fixed;
  left: 1.5rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  z-index: 10;
}

.socials a {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  background: rgba(11, 12, 14, 0.9);
  transition: background .2s, border-color .2s;
}

.socials a:hover {
  background: rgba(27, 143, 208, .4);
  border-color: var(--blue);
}

.socials svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: #dbe9f5;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* =====================================
   HERO
===================================== */
.hero {
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6rem var(--pad-r) 4rem var(--pad-l);
  position: relative;
}

.hero h1 {
  font-family: var(--heading-font);
  font-size: clamp(2.4rem, 5vw, 4.2rem);
  font-weight: 500;
  letter-spacing: -2px;
  line-height: 1.12;
  max-width: 100%;
}

.hero p {
  max-width: 620px;
  margin: 1.8rem 0 2rem;
  color: #c3ccd6;
  font-size: clamp(1rem, .95rem + .25vw, 1.08rem);
  line-height: 1.8;
  font-weight: 400;
}

/* Professional title slider */
.role-line {
  --role-height: 1.25em;

  display: block;
  position: relative;
  height: var(--role-height);
  line-height: var(--role-height);
  overflow: hidden;
  overflow: clip;
  isolation: isolate;
  contain: paint;
  color: var(--blue);
}

.role-track {
  display: flex;
  flex-direction: column;
  width: max-content;
  max-width: 100%;
  animation: roleSlideUp 8s infinite;
  will-change: transform;
  transform: translate3d(0, 0, 0);
}

.role-track span {
  display: block;
  flex: 0 0 var(--role-height);
  height: var(--role-height);
  line-height: var(--role-height);
  white-space: nowrap;
  overflow: hidden;
}

@keyframes roleSlideUp {

  0%,
  22% {
    transform: translate3d(0, 0, 0);
  }

  30%,
  52% {
    transform: translate3d(0, -1.25em, 0);
  }

  60%,
  82% {
    transform: translate3d(0, -2.5em, 0);
  }

  90%,
  100% {
    transform: translate3d(0, -3.75em, 0);
  }
}

/* Scroll hint */
.scroll-hint {
  position: absolute;
  right: 2rem;
  bottom: 2rem;
  display: flex;
  align-items: center;
  gap: .1rem;
  text-align: right;
  font-size: .95rem;
  line-height: 1.3;
  color: var(--text);
  opacity: .5;
}

.scroll-text {
  transition: color .2s;
}

.scroll-hint:hover .scroll-text {
  color: var(--blue);
}

.polygon {
  width: 56px;
  height: 56px;
  animation: bob 2.4s ease-in-out infinite;
}

.polygon polygon {
  fill: none;
  stroke: var(--blue);
  stroke-width: 2;
  stroke-linejoin: round;
}

.polygon .inner {
  stroke: #dbe9f5;
  stroke-width: 2;
  transform-origin: 50px 45px;
}

@keyframes bob {

  0%,
  100% {
    transform: translateY(-4px);
  }

  50% {
    transform: translateY(6px);
  }
}

/* =====================================
   SECTIONS
===================================== */
.section {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: var(--section-y) var(--pad-r) var(--section-y) var(--pad-l);
}

.section h2 {
  font-family: var(--heading-font);
  font-size: clamp(1.8rem, 1.2rem + 2vw, 2.65rem);
  font-weight: 500;
  letter-spacing: -1.2px;
  line-height: 1.2;
  margin-bottom: clamp(1.25rem, 3vw, 2rem);
}

.blue-theme {
  color: var(--blue);
  font-weight: 500;
}

/* ABOUT */
#about>p {
  max-width: 950px;
  width: 100%;
  font-size: clamp(1rem, .95rem + .2vw, 1.08rem);
  line-height: 1.7;
  opacity: 0.8;
}

#about>p:first-of-type {
  margin-bottom: 1.5rem;
}

.skills {
  margin-top: clamp(2rem, 5vw, 3rem);
}

.skills>h3 {
  font-family: var(--heading-font);
  font-size: clamp(1rem, .95rem + .3vw, 1.1rem);
  font-weight: 500;
  line-height: 1.5;
  margin-bottom: 1.2rem;
}

.skills-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.skills-list span {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.9rem;
  border: 1px solid rgba(150, 160, 175, 0.2);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.88rem;
  font-weight: 500;
  transition: all 0.3s ease;
}

.skills-list span:hover {
  color: var(--blue);
  border-color: var(--blue);
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-3px);
}

/* =====================================
   EDUCATION & EXPERIENCE TIMELINE
===================================== */
.simple-timeline {
  display: flex;
  flex-direction: column;
  margin-top: 1rem;
}

.timeline-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 2rem;
  padding: 2.2rem 0;
  border-bottom: 1px dashed rgba(120, 170, 210, 0.3);
}

.timeline-row:first-child {
  padding-top: .5rem;
}

.timeline-content {
  min-width: 0;
}

.timeline-content h3 {
  font-family: var(--sans);
  font-size: clamp(1.2rem, 1rem + 1vw, 1.5rem);
  font-weight: 600;
  letter-spacing: -.5px;
  line-height: 1.4;
  color: var(--blue);
  margin-bottom: .4rem;
}

.timeline-role {
  font-family: var(--sans);
  font-size: clamp(1rem, .95rem + .25vw, 1.08rem);
  font-weight: 400;
  color: var(--muted);
  line-height: 1.6;
}

.timeline-date {
  font-family: var(--sans);
  font-size: .9rem;
  font-weight: 500;
  color: var(--blue);
  text-align: right;
  padding-top: .35rem;
  white-space: nowrap;
}

.timeline-detail {
  margin-top: .6rem;
  font-size: .9rem;
  color: #8998a8;
  line-height: 1.8;
}

.timeline-content ul {
  margin-top: 1.2rem;
  padding-left: 1.3rem;
}

.timeline-content li {
  color: var(--muted);
  font-size: clamp(.95rem, .9rem + .25vw, 1.08rem);
  line-height: 1.65;
  padding-left: .3rem;
  margin-bottom: .8rem;
}

.timeline-content li::marker {
  color: var(--muted);
  font-size: 1.2em;
}

.experience-keypoints {
  display: flex;
  flex-wrap: wrap;
  column-gap: 1.2rem;
  row-gap: .5rem;
  margin-top: 1.2rem;
  color: var(--blue);
  font-size: clamp(.9rem, .85rem + .2vw, 1rem);
  opacity: 0.8;
}

.experience-keypoints span::before {
  content: "•";
  margin-right: 7px;
  color: var(--blue);
}

/* =====================================
   PROJECT ACCORDION
===================================== */
.project-list {
  width: 100%;
  margin-top: 2rem;
}

.project-item {
  border-bottom: 1px dashed rgba(120, 170, 210, 0.3);
}

.project-item:first-child {
  border-top: 1px dashed rgba(120, 170, 210, 0.3);
}

.project-header {
  position: relative;
}

.project-toggle {
  width: 100%;
  display: grid;
  grid-template-columns: 55px 1fr 30px;
  align-items: center;
  gap: 1rem;
  padding: 1.8rem 0;
  background: transparent;
  border: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.project-number {
  font-family: var(--sans);
  font-size: 0.85rem;
  color: var(--muted);
}

.project-name {
  font-family: var(--heading-font);
  font-size: clamp(1.15rem, 1rem + 1.2vw, 1.7rem);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.6px;
  transition: color 0.3s ease;
  opacity: 0.8;
}

.project-icon {
  font-size: 1.6rem;
  font-weight: 300;
  color: var(--blue);
  text-align: right;
  transition: transform 0.4s ease;
}

.project-toggle:hover .project-name,
.project-item.active .project-name {
  color: var(--blue);
}

.project-item.active .project-icon {
  transform: rotate(45deg);
}

.project-content {
  display: grid;
  grid-template-rows: 1fr;
  opacity: 1;
  transition: opacity 0.4s ease;
}

.project-content[hidden] {
  display: none;
}

.project-details {
  padding: 0 3rem 2rem 4.1rem;
  animation: projectReveal 0.5s ease both;
}

.project-details p {
  margin-bottom: 1rem;
  line-height: 1.8;
}

.project-meta {
  font-size: 0.9rem;
  color: var(--blue);
  font-weight: 500;
}

.project-description {
  max-width: 750px;
  font-size: clamp(.95rem, .9rem + .2vw, 1rem);
  color: var(--text);
  opacity: 0.7;
  line-height: 1.8;
}

.project-description span {
  display: block;
}

.project-stack {
  margin-bottom: 0.8rem;
  font-size: 0.95rem;
  color: var(--muted);
}

.project-tech-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 0.5rem;
}

.project-tech-list span {
  padding: 5px 9px;
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 0.75rem;
  font-weight: 500;
  letter-spacing: 0.5px;
}

.project-github-row {
  position: absolute;
  right: 3.5rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
}

.project-github-row svg {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.project-github-row:hover {
  color: var(--blue);
  border-color: var(--blue);
}

@keyframes projectReveal {
  from {
    opacity: 0;
    transform: translateY(15px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =====================================
   CONTACT
===================================== */
#contact>p {
  font-size: clamp(1rem, .95rem + .25vw, 1.08rem);
  opacity: 0.65;
}

.contact-form {
  max-width: 750px;
  width: 100%;
  margin-top: 2.5rem;
}

.form-group {
  margin-bottom: 1.2rem;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 0.9rem 1.1rem;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(150, 160, 175, 0.2);
  border-radius: 6px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.95rem;
  outline: none;
  transition: border-color 0.3s ease, background 0.3s ease;
}

.form-group input {
  height: 50px;
}

.form-group textarea {
  height: 90px;
  min-height: 90px;
  max-height: 90px;
  resize: none;
  overflow-y: auto;
  line-height: 1.6;
}

.form-group input::placeholder,
.form-group textarea::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--blue);
  background: rgba(255, 255, 255, 0.04);
}

.contact-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  padding: 0.8rem 1.6rem;
  border: none;
  cursor: pointer;
  font-family: var(--sans);
}

.form-status {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--blue);
  min-height: 1.3rem;
}

/* Staggered reveal */
.contact-form .form-group,
.contact-form .contact-submit {
  opacity: 0;
  transform: translateY(20px);
}

.contact-form.visible .form-group,
.contact-form.visible .contact-submit {
  animation: contactFieldReveal 0.35s ease forwards;
}

.contact-form.visible .form-group:nth-of-type(1) {
  animation-delay: 0.1s;
}

.contact-form.visible .form-group:nth-of-type(2) {
  animation-delay: 0.3s;
}

.contact-form.visible .form-group:nth-of-type(3) {
  animation-delay: 0.5s;
}

.contact-form.visible .form-group:nth-of-type(4) {
  animation-delay: 0.7s;
}

.contact-form.visible .contact-submit {
  animation-delay: 0.9s;
}

@keyframes contactFieldReveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* =====================================
   FOOTER
===================================== */
.footer {
  /* Clips the sliding lines so they never add extra scroll height */
  overflow: hidden;
  text-align: center;
  padding: 2rem var(--pad-r) 2rem var(--pad-l);
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: clamp(.78rem, .74rem + .2vw, .85rem);
  line-height: 1.9;
}

/* Short travel so the lines reveal even at the very bottom of the page */
.footer p.reveal {
  transform: translateY(16px);
}

.footer p.reveal.visible {
  transform: translateY(0);
}

/* =====================================
   REVEAL ANIMATIONS
===================================== */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: opacity 1.5s ease, transform 1.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

.line-reveal {
  display: block;
  overflow: hidden;
  padding-bottom: 0.08em;
}

.line-reveal>span {
  display: block;
  opacity: 0;
  transform: translateY(110%);
  transition: opacity 1.3s ease, transform 1.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.line-reveal.visible>span {
  opacity: 1;
  transform: translateY(0);
}

.reveal.delay-1 {
  transition-delay: 0.2s;
}

.reveal.delay-2 {
  transition-delay: 0.4s;
}

.reveal.delay-3 {
  transition-delay: 0.6s;
}

.reveal.delay-4 {
  transition-delay: 0.8s;
}

/* =====================================
   LARGE DESKTOP (1400px and up)
===================================== */
@media (min-width: 801px) {
  body {
    font-size: 17px;
  }

  /* Leave room for the fixed social column on the left */
  .section {
    padding-left: 6.5rem;
    padding-right: 2rem;
  }
}

@media (min-width: 1400px) {
  .section {
    max-width: 1350px;
    padding-left: 7rem;
    padding-right: 3rem;
  }
}

/* =====================================
   TABLET & MOBILE (800px and below)
===================================== */
@media (max-width: 800px) {
  html {
    scroll-padding-top: 80px;
  }

  /* No navigation menu on small screens - only the CV button */
  .nav {
    display: none;
  }

  .topbar {
    position: absolute;
    justify-content: flex-end;
    padding: calc(1rem + env(safe-area-inset-top, 0px)) var(--pad-r) 1rem var(--pad-l);
  }

  .topbar .resume {
    position: static;
    transform: none;
    padding: 0.4rem 1rem;
    font-size: 0.85rem;
  }

  /* Social icons become a bottom bar */
  .socials {
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    flex-direction: row;
    justify-content: center;
    gap: 1rem;
    padding: .6rem var(--pad-r) calc(.6rem + env(safe-area-inset-bottom, 0px)) var(--pad-l);
    background: rgba(11, 12, 14, .88);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--line);
  }

  .socials a {
    width: 42px;
    height: 42px;
  }

  /* Room at the bottom so the bar never covers content */
  .footer {
    padding-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px));
  }

  .scroll-hint {
    display: none;
  }

  .hero {
    padding-top: calc(6rem + env(safe-area-inset-top, 0px));
    padding-bottom: 6rem;
  }

  /* Timeline stacks: date first, then content */
  .timeline-row {
    grid-template-columns: minmax(0, 1fr);
    gap: .4rem;
    padding: 1.7rem 0;
  }

  .timeline-date {
    grid-row: 1;
    text-align: left;
    font-size: .85rem;
    padding-top: 0;
  }

  .timeline-content {
    grid-row: 2;
  }

  /* Projects */
  .project-toggle {
    grid-template-columns: 32px 1fr 24px;
    gap: .7rem;
    padding: 1.5rem 0;
  }

  .project-name {
    padding-right: 3.4rem;
  }

  .project-github-row {
    right: 2.6rem;
    padding: 8px;
  }

  .project-github-row span {
    display: none;
  }

  .project-details {
    padding: 0 .25rem 1.6rem 2.6rem;
  }

  /* 16px inputs stop iOS from zooming in on focus */
  .form-group input,
  .form-group textarea {
    font-size: 1rem;
  }

  .contact-form {
    margin-top: 2rem;
  }
}

/* =====================================
   PHONES (600px and below)
===================================== */
@media (max-width: 600px) {
  .hero h1 {
    font-size: clamp(2rem, 10vw, 2.8rem);
    letter-spacing: -1px;
  }

  /* Role text is longer than the name, so it is set a little smaller */
  .role-line {
    font-size: .62em;
  }

  .hero p {
    margin: 1.4rem 0 1.6rem;
  }

  .section h2 {
    letter-spacing: -.8px;
  }

  .skills-list {
    gap: .5rem;
  }

  .skills-list span {
    padding: .5rem .85rem;
    font-size: .82rem;
  }

  .timeline-content ul {
    padding-left: 1.1rem;
  }

  .experience-keypoints {
    column-gap: 1rem;
  }

  .project-details {
    padding-left: 2.4rem;
  }

  .project-tech-list span {
    font-size: .72rem;
  }

  .contact-submit {
    width: 100%;
  }
}

/* =====================================
   VERY SMALL PHONES (380px and below)
===================================== */
@media (max-width: 380px) {
  :root {
    --gutter: 1.1rem;
  }

  .role-line {
    font-size: .56em;
  }

  .topbar .resume {
    padding: 0.35rem 0.8rem;
    font-size: 0.78rem;
  }

  .project-name {
    padding-right: 3rem;
  }
}

/* =====================================
   REDUCED MOTION
===================================== */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
  }

  .reveal,
  .line-reveal>span,
  .contact-form .form-group,
  .contact-form .contact-submit {
    opacity: 1;
    transform: none;
  }
}

#about > p.reveal {
  opacity: 0;
  transform: translateY(20px);
}

#about > p.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

#contact > p.reveal {
  opacity: 0;
  transform: translateY(20px);
}

#contact > p.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}