/* =====================================================
   GOOGLE FONTS
   "DM Sans" for regular body text, "Space Grotesk" for
   headings and bold titles.
   ===================================================== */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap');

/* =====================================================
   DESIGN SYSTEM (CSS VARIABLES)

   Every color, radius, and transition speed used anywhere
   in this file is defined once here. If you ever want to
   change the brand color, you only need to edit ONE line
   below, instead of hunting through the whole file.

   This block holds the LIGHT MODE (default) values.
   The dark mode values are in the next block down.
   ===================================================== */
:root {
  /* ---- Text & background colors ---- */
  --color-text: #162033;            /* main text color */
  --color-text-muted: #66728a;      /* lighter text, used for paragraphs */
  --color-background: #ffffff;      /* page background */
  --color-background-soft: #f5f7fc; /* soft background for alternating sections */
  --color-border: #e6eaf1;          /* light border color */
  --color-card-background: #ffffff; /* background for cards (timeline, project, skill) */

  /* ---- Brand colors ---- */
  --color-primary: #5b58e8;         /* main brand color, used for buttons and links */
  --color-primary-hover: #4742d0;   /* primary color on hover */
  --color-primary-tint: #eeedff;    /* very light brand tint, used behind icons/tags */
  --color-primary-border: #cfcdf7;  /* light brand border, used on outline buttons */
  --color-primary-ring: #e4e3ff;    /* ring around the timeline dot */
  --color-primary-line: #d9ddf5;    /* the vertical timeline line */
  --color-selection: #deddff;       /* background of highlighted/selected text */
  --color-accent: #32bdb7;          /* teal accent, used for the contact button */
  --color-accent-hover: #58d9d3;    /* teal accent on hover */

  /* ---- Specific surface colors ---- */
  --color-navbar-background: rgba(255, 255, 255, 0.88);
  --color-footer-background: #101725;
  --color-footer-text: #aab4c7;
  --color-contact-background: #162033;
  --color-contact-text: #b6c0d3;

  /* ---- Shadows ---- */
  --shadow-soft: 0 18px 45px rgba(23, 32, 51, 0.09);
  --shadow-navbar: 0 4px 24px rgba(23, 32, 51, 0.06);
  --shadow-button: 0 10px 22px rgba(91, 88, 232, 0.2);
  --shadow-back-to-top: 0 8px 20px rgba(91, 88, 232, 0.3);
  --shadow-mobile-menu: 20px 0 45px rgba(23, 32, 51, 0.12);

  /* ---- Border radius scale ---- */
  --radius-small: 4px;   /* tags */
  --radius-medium: 8px;  /* buttons */
  --radius-large: 12px;  /* timeline card, project icon box */
  --radius-xlarge: 16px; /* project card, about photo */
  --radius-round: 50%;   /* circles */

  /* ---- Section spacing ---- */
  --spacing-section: 98px;
  --spacing-section-mobile: 76px;

  /* ---- Transition speeds ---- */
  --transition-fast: 0.2s ease;
  --transition-medium: 0.3s ease;
  --transition-slow: 0.6s ease;

  /* ---- Fonts ---- */
  --font-body: 'DM Sans', sans-serif;
  --font-heading: 'Space Grotesk', sans-serif;
}

/* =====================================================
   DARK MODE COLORS

   When script.js adds data-theme="dark" to the <html>
   element, every variable below OVERRIDES the light mode
   value above. Because every component in this file reads
   its colors from these variables (instead of hardcoding
   colors), the entire site re-colors itself automatically.
   No component-specific dark mode rules are needed anywhere
   else in this file.
   ===================================================== */
:root[data-theme="dark"] {
  --color-text: #eef1f8;
  --color-text-muted: #9aa5bd;
  --color-background: #0f1420;
  --color-background-soft: #161d2e;
  --color-border: #2a3348;
  --color-card-background: #161d2e;

  --color-primary: #8481ff;
  --color-primary-hover: #a19eff;
  --color-primary-tint: #232a45;
  --color-primary-border: #3a4468;
  --color-primary-ring: #2c3358;
  --color-primary-line: #2a3358;
  --color-selection: #34306b;
  --color-accent: #3ddad2;
  --color-accent-hover: #63e6df;

  --color-navbar-background: rgba(15, 20, 32, 0.88);
  --color-footer-background: #090c14;
  --color-footer-text: #7f8aa3;
  --color-contact-background: #090c14;
  --color-contact-text: #97a2ba;

  --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.45);
  --shadow-navbar: 0 4px 24px rgba(0, 0, 0, 0.35);
  --shadow-button: 0 10px 22px rgba(132, 129, 255, 0.25);
  --shadow-back-to-top: 0 8px 20px rgba(132, 129, 255, 0.35);
  --shadow-mobile-menu: 20px 0 45px rgba(0, 0, 0, 0.5);
}

/* =====================================================
   RESET & GLOBAL DEFAULTS
   ===================================================== */

* {
  box-sizing: border-box; /* padding/border are included in an element's width */
  margin: 0;
  padding: 0;

  /* Smoothly fade colors when the theme changes, instead of
     switching instantly. This one rule handles the whole
     site's dark mode transition — no need to repeat it on
     every single component below. */
  transition: background-color var(--transition-medium),
              color var(--transition-medium),
              border-color var(--transition-medium);
}

html {
  scroll-behavior: smooth; /* smooth scrolling when jumping to a section */
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.7;
  color: var(--color-text);
  background: var(--color-background);
  overflow-x: hidden; /* prevents an accidental horizontal scrollbar */
}

/* Links look like normal text unless a specific class says otherwise */
a {
  color: inherit;
  text-decoration: none;
}

/* Prevent the page from scrolling behind the open mobile menu */
body.menu-open {
  overflow: hidden;
}

::selection {
  background: var(--color-selection);
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-thumb {
  background: var(--color-primary);
  border-radius: 99px;
}

/* Shared "centered row, max 1100px wide" layout used by the
   navbar, the hero section, and every other section. Written
   as one shared rule instead of three separate ones so the
   width never accidentally drifts out of sync between them. */
.navbar-container,
.hero-container,
.section-container {
  width: min(1100px, 90%);
  margin: auto;
}

section {
  padding: var(--spacing-section) 0;
}

/* =====================================================
   REUSABLE BUTTON STYLES
   .button holds the shared shape (padding, radius, font).
   .button-primary / .button-outline / .button-accent add
   the color on top. This means adding a 4th button color
   in the future only needs one small new class.
   ===================================================== */

.button {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 12px 19px;
  border: 1px solid transparent;
  border-radius: var(--radius-medium);
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 0.92rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.button-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

.button-primary:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-button);
}

.button-outline {
  background: transparent;
  border-color: var(--color-primary-border);
  color: var(--color-primary);
}

.button-outline:hover {
  background: var(--color-primary-tint);
  border-color: var(--color-primary-hover);
  transform: translateY(-2px);
  box-shadow: none;
}

.button-accent {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: #102d36;
}

.button-accent:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
  transform: translateY(-2px);
  box-shadow: var(--shadow-button);
}

.button-group {
  display: flex;
  gap: 12px;
  flex-wrap: wrap; /* buttons wrap onto a new line on small screens */
}

/* =====================================================
   SECTION TITLES
   Shared heading style used at the top of every section.
   ===================================================== */

.section-title {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
  margin-bottom: 48px;
  text-align: center;
  font: 700 clamp(2rem, 4vw, 2.55rem) var(--font-heading);
  letter-spacing: -0.06em;
}

/* Small colored underline below each section title.
   This is a decorative-only pseudo-element: it is a single
   flat-color bar with no complex shape, so keeping it as
   ::after (instead of adding an extra empty <span> to every
   section in the HTML) keeps the markup cleaner. */
.section-title::after {
  content: '';
  width: 38px;
  height: 3px;
  border-radius: 9px;
  background: var(--color-primary);
}

.section-description {
  max-width: 620px;
  margin: -33px auto 43px;
  color: var(--color-text-muted);
  text-align: center;
}

/* =====================================================
   NAVIGATION BAR
   ===================================================== */

.navbar {
  position: fixed; /* stays at the top of the screen while scrolling */
  z-index: 10;      /* keeps it above other page content */
  width: 100%;
  padding: 21px 0;
  transition: padding var(--transition-fast), background var(--transition-fast), box-shadow var(--transition-fast);
}

/* Added by script.js once the user scrolls down more than 30px */
.navbar.navbar-sticky {
  padding: 12px 0;
  background: var(--color-navbar-background);
  box-shadow: var(--shadow-navbar);
  backdrop-filter: blur(14px); /* blurs whatever is behind the navbar */
}

.navbar-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-logo {
  font: 700 1.45rem var(--font-heading);
  letter-spacing: -0.07em;
}

.navbar-links {
  display: flex;
  align-items: center;
  gap: 25px;
  list-style: none; /* removes the bullet points from the <ul> */
}

.navbar-link {
  color: var(--color-text-muted);
  font-size: 0.91rem;
  font-weight: 700;
}

.navbar-link:hover {
  color: var(--color-primary);
}

/* Hidden by default. Only shown on small screens (see the
   media query near the bottom of this file). */
.navbar-close-button {
  display: none;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.navbar-social-links {
  display: flex;
  gap: 10px;
}

.navbar-social-links a {
  display: grid;
  place-items: center; /* centers the icon inside the circle */
  width: 31px;
  height: 31px;
  border-radius: var(--radius-round);
  background: var(--color-background-soft);
  font-size: 0.85rem;
  transition: var(--transition-fast);
}

.navbar-social-links a:hover {
  color: #fff;
  background: var(--color-primary);
  transform: translateY(-2px); /* small "lift up" effect on hover */
}

/* DARK MODE TOGGLE BUTTON */
.theme-toggle-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: var(--radius-round);
  background: var(--color-background-soft);
  color: var(--color-text);
  font-size: 0.95rem;
  cursor: pointer;
  transition: var(--transition-fast);
}

.theme-toggle-button:hover {
  background: var(--color-primary);
  color: #fff;
}

/* Show the moon icon by default (light mode), hide the sun icon.
   NOTE: We write this as ".theme-toggle-button .theme-icon-sun"
   (two classes) instead of just ".theme-icon-sun" (one class).
   Font Awesome's own CSS also sets "display" on its icons using
   a single class, and because the Font Awesome stylesheet is
   linked AFTER style.css in index.html, a tie in specificity
   would let Font Awesome win and the sun icon would stay visible.
   Using two classes here makes our rule more specific, so it
   wins no matter what order the stylesheets load in. */
.theme-toggle-button .theme-icon-sun {
  display: none;
}

/* In dark mode, swap which icon is visible */
:root[data-theme="dark"] .theme-toggle-button .theme-icon-moon {
  display: none;
}

:root[data-theme="dark"] .theme-toggle-button .theme-icon-sun {
  display: block;
}

/* Hidden by default. Only shown on small screens. */
.navbar-menu-button {
  display: none;
}

/* =====================================================
   HERO SECTION
   ===================================================== */

.hero-section {
  min-height: 100vh; /* fills at least the full height of the screen */
  display: flex;
  align-items: center;
  background: linear-gradient(135deg, var(--color-background-soft), var(--color-background) 55%, var(--color-background-soft));
}

.hero-content {
  max-width: 760px;
  padding-top: 74px; /* leaves room so the fixed navbar doesn't overlap the text */
}

.hero-label {
  color: var(--color-primary);
  margin-bottom: 15px;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.13em;
}

.hero-title {
  max-width: 680px;
  /* clamp(min, preferred, max) makes the heading size responsive:
     it will never go below 3.2rem or above 6rem, and scales
     smoothly with the browser width in between. */
  font: 700 clamp(3.2rem, 7vw, 6rem)/1 var(--font-heading);
  letter-spacing: -0.075em;
}

.hero-name {
  color: var(--color-primary);
}

.hero-description {
  max-width: 590px;
  margin: 22px 0 30px;
  color: var(--color-text-muted);
  font-size: 1.13rem;
}

/* =====================================================
   ABOUT SECTION
   ===================================================== */

.about-content {
  display: grid;
  /* Two columns: the photo takes up less space (0.78fr)
     than the text (1.22fr) */
  grid-template-columns: 0.78fr 1.22fr;
  align-items: center;
  gap: clamp(42px, 8vw, 100px);
}

.about-image {
  display: block;
  width: 100%;
  max-width: 365px;
  aspect-ratio: 1 / 1.1; /* keeps the photo's shape consistent at any size */
  object-fit: cover;     /* crops the photo neatly instead of stretching it */
  border-radius: var(--radius-xlarge);
  box-shadow: var(--shadow-soft);
}

.about-heading,
.contact-heading {
  font: 700 1.38rem/1.3 var(--font-heading);
  letter-spacing: -0.04em;
  margin-bottom: 13px;
}

.about-description,
.contact-description {
  color: var(--color-text-muted);
}

.about-stats {
  display: flex;
  gap: 26px;
  margin: 27px 0;
}

.stat-item {
  display: grid;
  gap: 1px;
}

.stat-number {
  color: var(--color-primary);
  font: 700 1.55rem var(--font-heading);
}

.stat-label {
  color: var(--color-text-muted);
  font-size: 0.78rem;
}

/* =====================================================
   EXPERIENCE SECTION (TIMELINE)
   ===================================================== */

.experience-section {
  background: var(--color-background-soft);
}

.timeline {
  max-width: 800px;
  margin: auto;
  border-left: 2px solid var(--color-primary-line); /* the vertical timeline line */
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: 180px 1fr; /* date column + card column */
  gap: 34px;
  padding: 0 0 40px 31px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

/* The small circle ("dot") that sits on the timeline for each job.
   This is a single flat-color circle with no interactive behavior,
   so a pseudo-element keeps the HTML clean without losing anything. */
.timeline-item::before {
  content: '';
  position: absolute;
  width: 11px;
  height: 11px;
  left: -6.5px;
  top: 7px;
  border-radius: var(--radius-round);
  background: var(--color-primary);
  box-shadow: 0 0 0 5px var(--color-primary-ring); /* light ring around the dot */
}

.timeline-date {
  color: var(--color-primary);
  font-size: 0.82rem;
  font-weight: 700;
}

.timeline-card {
  padding: 22px 24px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-large);
  background: var(--color-card-background);
}

.job-title {
  margin-bottom: 8px;
  font: 700 1.1rem var(--font-heading);
}

.job-company {
  color: var(--color-primary);
}

.job-responsibilities {
  margin-left: 12px;
  color: var(--color-text-muted);
  font-size: 15px;
}

/* =====================================================
   PROJECTS SECTION
   ===================================================== */

.projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr); /* 3 equal columns */
  gap: 19px;
}

.project-card {
  position: relative;
  padding: 27px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xlarge);
  background: var(--color-card-background);
  transition: transform var(--transition-medium), border-color var(--transition-medium), box-shadow var(--transition-medium);
}

.project-card:hover {
  transform: translateY(-6px); /* card lifts up slightly on hover */
  border-color: transparent;
  box-shadow: var(--shadow-soft);
}

.project-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 23px;
  border-radius: var(--radius-large);
  background: var(--color-primary-tint);
  color: var(--color-primary);
}

.project-number {
  position: absolute;
  top: 30px;
  right: 27px;
  color: var(--color-text-muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.project-title {
  font: 700 1.18rem var(--font-heading);
  letter-spacing: -0.04em;
  margin-bottom: 10px;
}

.project-description {
  color: var(--color-text-muted);
  font-size: 0.91rem;
}

.project-highlights {
  margin: 17px 0 19px;
  padding-left: 17px;
  color: var(--color-text-muted);
  font-size: 0.86rem;
}

/* Adds space above every list item except the first one,
   using the "+" adjacent-sibling selector: "any <li> that
   comes right after another <li>". */
.project-highlights li + li {
  margin-top: 7px;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 3px 8px;
  border-radius: var(--radius-small);
  color: var(--color-primary);
  background: var(--color-primary-tint);
  font-size: 0.72rem;
  font-weight: 700;
}

/* =====================================================
   SKILLS SECTION
   ===================================================== */

.skills-section {
  background: var(--color-background-soft);
}

.skills-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr); /* 2 equal columns */
  border-top: 1px solid var(--color-border);
  border-left: 1px solid var(--color-border);
}

.skill-category {
  padding: 22px 25px;
  border-right: 1px solid var(--color-border);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-card-background);
  color: var(--color-text-muted);
  font-size: 0.92rem;
}

.skill-category-title {
  margin-bottom: 5px;
  color: var(--color-text);
  font-weight: 700;
}

/* =====================================================
   CONTACT SECTION
   ===================================================== */

.contact-section {
  padding: 86px 0;
  background: var(--color-contact-background); /* dark background for contrast, in both themes */
  color: #fff;
}

.contact-section .section-title {
  color: #fff;
}

.contact-content {
  max-width: 620px;
  margin: auto;
  text-align: center;
}

.contact-heading {
  font-size: 1.55rem;
}

.contact-description {
  margin-bottom: 25px;
  color: var(--color-contact-text);
}

/* =====================================================
   FOOTER
   ===================================================== */

.site-footer {
  padding: 17px;
  color: var(--color-footer-text);
  background: var(--color-footer-background);
  text-align: center;
  font-size: 0.85rem;
}

/* =====================================================
   BACK TO TOP BUTTON
   Hidden by default. script.js adds "is-visible" once the
   user scrolls down past 420px.
   ===================================================== */

.back-to-top-button {
  position: fixed;
  z-index: 9;
  right: 23px;
  bottom: 23px;
  display: none;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-round);
  color: #fff;
  background: var(--color-primary);
  box-shadow: var(--shadow-back-to-top);
}

.back-to-top-button.is-visible {
  display: grid;
}

/* =====================================================
   "REVEAL ON SCROLL" ANIMATION
   Elements start invisible and slightly lower than their
   final position. When script.js adds "is-visible" (because
   the element has scrolled into view), it fades in and
   slides up smoothly.
   ===================================================== */

.reveal-on-scroll {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}

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

/* =====================================================
   RESPONSIVE STYLES (SMALL SCREENS)
   These rules only apply when the browser window is
   760px wide or less (phones and small tablets).
   ===================================================== */

@media (max-width: 760px) {
  .navbar-container {
    width: 90%;
  }

  /* The link list becomes a full-height slide-out panel,
     hidden off-screen to the left by default. */
  .navbar-links {
    position: fixed;
    top: 0;
    left: -100%;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 26px;
    width: min(82vw, 340px);
    height: 100vh;
    padding: 88px 32px;
    background: var(--color-background);
    box-shadow: var(--shadow-mobile-menu);
    transition: left var(--transition-medium);
  }

  /* When script.js adds "is-open", the menu slides into view */
  .navbar-links.is-open {
    left: 0;
  }

  .navbar-link {
    font-size: 1.05rem;
  }

  /* Show the hamburger and "X" icons only on small screens */
  .navbar-menu-button,
  .navbar-close-button {
    display: block;
    cursor: pointer;
    font-size: 1.3rem;
  }

  .navbar-close-button {
    position: absolute;
    top: 24px;
    right: 25px;
  }

  .navbar-social-links {
    display: none;
  }

  .about-content {
    grid-template-columns: 1fr; /* photo and text stack vertically */
  }

  .about-image-wrapper {
    text-align: center;
  }

  .about-image {
    margin: auto;
  }

  .about-stats {
    justify-content: space-between;
  }

  .timeline-item {
    grid-template-columns: 1fr; /* date and card stack vertically */
    gap: 9px;
    padding-left: 25px;
  }

  .projects-grid {
    grid-template-columns: 1fr; /* one project card per row */
  }

  .skills-grid {
    grid-template-columns: 1fr; /* one skill group per row */
  }

  section {
    padding: var(--spacing-section-mobile) 0;
  }
}

/* Extra-small screens (narrow phones) */
@media (max-width: 440px) {
  .hero-title {
    font-size: 3.1rem;
  }

  .about-stats {
    gap: 12px;
  }

  .stat-number {
    font-size: 1.3rem;
  }

  .stat-label {
    font-size: 0.68rem;
  }
}

/* =====================================================
   ACCESSIBILITY: REDUCED MOTION
   Some users set their operating system to reduce motion
   because animations make them uncomfortable or dizzy.
   This turns off smooth scrolling and makes all transitions
   (including the reveal animation and the dark mode fade)
   instant instead of animated.
   ===================================================== */

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
