html,
body {
  margin: 0;
  padding: 0;
  color: white;
  overflow-x: hidden;
  /* prevent stray horizontal scroll */
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Layout variables for consistent proportions */
:root {
  --container-max: 1100px;
  --gutter: min(4vw, 24px);
  --section-gap: clamp(2rem, 4vw, 3rem);
}

/* Polished defaults */
html {
  scroll-behavior: smooth;
}

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

/* Consistent focus outlines for accessibility */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
#menu-toggle:focus-visible {
  outline: 3px solid #174EA6;
  outline-offset: 2px;
}

/* Subtle hover states */
a:hover {
  opacity: 0.9;
}

.topnav a:hover {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
}

.header-nav a.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -6px;
  height: 3px;
  background: #fff;
  opacity: 0.85;
  border-radius: 3px;
}

.topnav #myLinks a.is-active {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 8px;
}

/* Images behave responsively */
img {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Ensure padding and border don't cause overflow issues */
*,
*::before,
*::after {
  box-sizing: border-box;
}

header {
  background-image: url(image/macbook_mouse.jpg);
  background-size: cover;
}

.header-nav {
  display: flex;
  flex-direction: row;
  justify-content: center;
  padding: 2rem;
  margin: 1rem;
  margin-top: 0;
  margin-bottom: 3rem;
}

.header-nav a {
  margin: 0.5rem;
  color: white;
  font-size: 1.25rem;
  text-decoration: none;
  position: relative;
}

/* Topnav tweaks moved from inline */
/* Avoid large gutters around the mobile dropdown by default */
.topnav #myLinks {
  margin: 0;
}

.topnav .icon i {
  margin: 1rem;
  color: white;
}

.topnav .icon {
  background: none;
  border: 0;
  color: white;
  cursor: pointer;
  padding: 14px 16px;
  display: block;
}

.header-list {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-content: center;
  margin-bottom: 0;
  padding-bottom: 1rem;
}

ul {
  list-style-type: none;
  margin: 1rem;
  padding: 0;
}

.header-list li {
  margin: 1rem;
}

a i {
  color: white;
}

.header-profile {
  object-fit: cover;
  border-radius: 50%;
  height: 15rem;
  width: 15rem;
  border: 3px solid white;
  margin: auto;
  margin-bottom: 2rem;
  padding: 0.5rem;
  background-color: beige;
}

.name-img {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-content: center;
  margin-bottom: 2rem;
}

.name-img h1 {
  text-align: center;
  color: white;
  font-weight: bold;
  font-size: 3rem;
  margin: 0.67em 0;
}

.name-img p {
  text-align: center;
}

.header-para {
  width: min(850px, 90%);
  color: #1b1b1b;
  margin: 2rem auto;
  /* equal top/bottom spacing */
  text-align: center;
  font-size: 1.2rem;
}

/* Tighter, bolder paragraph styling */
.header-para p {
  margin: 0 auto;
  /* remove default <p> margins */
  max-width: 68ch;
  /* comfortable reading measure */
  line-height: 1.55;
  /* natural reading rhythm */
  font-weight: 400;
  /* normal weight */
}

.skills {
  background-color: aliceblue;
  margin-top: 2rem;
  /* equals header-para bottom spacing via collapse */
  margin-bottom: 5rem;
  padding-bottom: 3rem;
}

.skills-text {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-content: center;
}

.skills-text i {
  padding: 0;
  margin-right: 1.25rem;
}

.skills-text h1,
.skills-text h2 {
  padding: 0;
  margin: 0;
  margin-left: 1rem;
  margin-top: 3rem;
  font-size: 3.5rem;
  color: #174EA6;
}

.skills-text h1 i,
.skills-text h2 i {
  color: #174EA6;
}

.cards-styled {
  display: flex;
  flex-direction: row;
  justify-content: space-evenly;
  flex-wrap: wrap;
}

.cards-div {
  margin-top: 5rem;
}

.card {
  background: #6d6d6d;
  /* Filled color, override for each skill if you want */
  color: #fff;
  padding: 0.75rem;
  width: 10rem;
  border-radius: 4rem;
  margin: 1rem;
  box-shadow: 0 2px 12px rgba(32, 32, 32, 0.1);
}

.card::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  border-radius: 0 2.5rem 2.5rem 0;
  z-index: 0;
  /* Default 50% unfilled, customize per skill below */
  width: 45%;
  background: #dddddd;
}

/* Text on top */
.card {
  position: relative;
  z-index: 1;
  text-align: left;
  padding-left: 2rem;
  letter-spacing: 1px;
}

/* --- Custom Progress for each skill --- */
.li1 {
  background: #295cb4;
}

/* C++ Blue */
.li2 {
  background: #ff5f14;
}

/* HTML Orange */
.li3 {
  background: #a389ac;
}

/* CSS Purple */
.li4 {
  background: #109085;
}

/* JS Teal */
.li5 {
  background: #295cb4;
}

/* NodeJs Blue */
.li6 {
  background: #a389ac;
}

/* MongoDB Purple */

/* Progress fill % for each (adjust width as you like) */
.li1::after {
  width: 50%;
}

/* C++ */
.li2::after {
  width: 22%;
}

/* HTML */
.li3::after {
  width: 28%;
}

/* CSS */
.li4::after {
  width: 40%;
}

/* JS */
.li5::after {
  width: 38%;
}

/* NodeJs */
.li6::after {
  width: 26%;
}

/* MongoDB */

.card-header {
  width: 100%;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  padding: 0;
  margin: 0;
  align-items: center;
  gap: 1rem;
}

.card-header img {
  margin: 0;
  padding: 0;
  width: 5.5rem;
  height: 5.5rem;
  object-fit: contain;
  border-radius: 0.5rem;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.12));
  transition: transform 120ms ease;
}

.card-header img:hover {
  transform: scale(1.04);
}

/* Upsize specific marks that need extra presence */
.card-header img.logo-xl {
  width: 6.5rem;
  height: 6.5rem;
}

/* Extra emphasis for ICSE logo */
.card-header img.logo-xxl {
  width: 7.5rem;
  height: 7.5rem;
}

/* For logos that need contrast on beige backgrounds (e.g., ICSE) */
/* No longer needed since we swapped to a transparent ICSE logo */

.card-header .card-title {
  margin: 0;
  padding: 0;
  color: #295cb4;
  font-size: 1.3rem;
  line-height: 1.2;
}

.card-header .card-subtitle {
  margin: 0;
  padding: 0;
  color: orangered;
  font-weight: 600;
}

.card-header .card-meta {
  margin: 0;
  padding: 0;
  color: #295cb4;
  display: inline-block;
  background: #eaf1ff;
  border: 1px solid #d6e3ff;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  font-weight: 600;
  font-size: 0.85rem;
}

/* Subtle hover polish for timeline items */
.timeline1-item {
  border-radius: 0.75rem;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

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

#experience {
  margin-top: 4rem;
  padding-bottom: 1rem;
}

.skills-text h1,
.skills-text h2 {
  margin-bottom: 2rem;
}

.timeline {
  position: absolute;
  width: 75%;
}

.card-item {
  position: relative;
  min-height: 150px;
  width: 50%;
  margin: auto;
}

.card-item:nth-child(2n) {
  left: 57%;
}

#experience p {
  /* Allow paragraphs to use available width; height reduces naturally */
  color: #6d6d6d;
}

.dotted-line {
  position: absolute;
  top: 2%;
  left: 68%;
  height: 92.5vh;
  width: 0;
  border-left: 3px dotted #295cb4;
  z-index: -1;
}

.topnav {
  display: none;
}

.timeline1 {
  position: relative;
  /* border: 2px solid black; */
  width: 75%;
  margin: auto;
  overflow: visible;
  /* avoid creating nested scrollbars */
}

.timeline1-item {
  position: relative;
  width: 40%;
  left: 5%;
  min-height: 150px;
  /* border: 2px solid black; */
  margin: 1rem;
  overflow: visible;
}

.timeline1-item:nth-child(2n) {
  position: relative;
  left: 53%;
}

.timeline1-item p {
  color: #6d6d6d;
  max-width: 54ch;
  line-height: 1.6;
  margin-top: 0.5rem;
}

/* Add extra space under the timeline headings only here */
#experience .skills-text h2,
#education .skills-text h2 {
  margin-bottom: 4rem;
}

.timeline-divider {
  position: absolute;
  height: 100%;
  width: 0;
  border: 3px dashed #295cb4;
  left: 50%;
  top: 0;
  z-index: 1;
  pointer-events: none;
  /* make divider non-interactive for smooth scroll */
}

.timeline-traveller {
  position: absolute;
  /* JS will translateY this element */
  left: 0;
  /* align to the dashed border */
  top: .5rem;
  color: #295cb4;
  z-index: 2;
  transform: translate(-50%, 0) rotate(90deg);
  /* center on the line */
  will-change: transform;
  pointer-events: none;
}

.fa-circle {
  color: lightgray;
  z-index: -1;
  left: 50%;
  transform: translateX(-50%);
}

.timeline-dots .fa-circle {
  z-index: 1;
}

.circle-1 {
  position: absolute;
  top: 0;
}

.circle-2 {
  position: absolute;
  top: 25%;
}

.circle-3 {
  position: absolute;
  top: 60%;
}

.circle-4 {
  position: absolute;
  top: 90%;
}

.images-box {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: space-between;
  align-content: center;
  margin: auto;
  /* border: 2px solid black; */
  padding: 4rem;
}

.images img {
  height: 30vh;
  width: 25vw;
  border-radius: 1.5rem;
  transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1), box-shadow 0.3s,
    filter 0.3s;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  object-fit: cover;
  margin: 1rem;
}

/* Make all img elements responsive by default */
img {
  max-width: 100%;
  height: auto;
}

/* Consistent content width + side padding for major blocks */
.header-para,
.skills .skills-text,
.skills .cards-div,
#experience .timeline1,
#education .timeline1,
#portfolio .images-box,
.footer-div .skills-text,
.footer-div .bottom-footer {
  max-width: var(--container-max);
  padding-left: var(--gutter);
  padding-right: var(--gutter);
  margin-left: auto;
  margin-right: auto;
}

/* Ensure timeline uses the full container width on desktop */
#experience .timeline1,
#education .timeline1 {
  width: 100%;
}

/* Section rhythm: compact but even spacing */
section#experience,
section#education,
section#portfolio,
section.skills {
  padding-top: var(--section-gap);
  padding-bottom: var(--section-gap);
}

.images img:hover {
  filter: brightness(90%) contrast(1.1);
  transform: scale(1.06) rotate(-1deg);
  box-shadow: 0 10px 32px rgba(30, 144, 255, 0.25),
    0 1.5px 8px rgba(0, 0, 0, 0.13);
  cursor: pointer;
}

.timeline-traveller .fa-car {
  transform: rotate(-90deg);
}

.footer-div {
  background-image: linear-gradient(to right, #295cb4, indigo);
}

.bottom-footer {
  display: flex;
  flex-direction: row;
  margin: auto;
  padding: 2rem;
}

.footer-form {
  display: flex;
  flex-direction: column;
  color: white;
  margin: 1rem;
}

/* Button styling */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.1rem;
  border-radius: 0.65rem;
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  transition: transform 100ms ease, box-shadow 150ms ease, background 150ms ease;
  width: fit-content;
  margin: 0.5rem 1rem 0;
}

.btn-primary {
  background: #174EA6;
  color: #fff;
  box-shadow: 0 4px 14px rgba(23, 78, 166, 0.25);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(23, 78, 166, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 10px rgba(23, 78, 166, 0.22);
}

.second-element-footer {
  margin: 1rem;
}

.footer-div .skills-text {
  height: auto;
  /* avoid reserving vertical space */
}

.footer-div .skills-text h1,
.footer-div .skills-text h2,
.footer-div .skills-text h1 i,
.footer-div .skills-text h2 i {
  color: white;
}

/* Skip link accessibility */
.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.skip-link:focus {
  position: static;
  width: auto;
  height: auto;
  padding: 0.5rem 1rem;
  background: #000;
  color: #fff;
  z-index: 9999;
}

.footer-form input,
textarea {
  color: #111;
  background: #fff;
  width: min(520px, 100%);
  height: 2.75rem;
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 1rem;
  margin: 0.5rem 1rem 1rem;
  padding: 0.5rem 1rem;
  font-size: 1rem;
  font-weight: 500;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
  transition: border-color 120ms ease, box-shadow 120ms ease, transform 100ms ease;
}

.footer-form input:focus,
textarea:focus {
  outline: none;
  border-color: #d6e3ff;
  box-shadow: 0 0 0 3px rgba(23, 78, 166, 0.25), 0 4px 18px rgba(0, 0, 0, 0.18);
}

.footer-form input::placeholder,
textarea::placeholder {
  color: #999;
}

/* Textarea-specific tweaks for better writing experience */
textarea {
  min-height: 6.5rem;
  line-height: 1.4;
  padding-top: 0.75rem;
  resize: vertical;
}

.footer-form label {
  margin: 0.25rem 1rem 0.35rem;
  font-weight: 650;
  font-size: 1.125rem;
}

.bottom-footer>div {
  width: 50%;
}

.second-element-footer i {
  color: white;
  margin: 1rem;
}

/* Footer heading spacing override */
.footer-div .skills-text h1,
.footer-div .skills-text h2 {
  margin: 1.5rem 0 1.25rem;
}

/* Compact social row at the very bottom */
.footer-div .header-list {
  margin: 0.25rem 0;
  padding-bottom: 0.5rem;
}

.footer-div .header-list li {
  margin: 0.5rem;
}

/* Mobile-first refinements */
@media screen and (width <=700px) {

  /* General type scaling */
  .name-img h1 {
    font-size: 3rem;
    /* revert to original scale on mobile */
  }

  .skills-text h1,
  .skills-text h2 {
    font-size: 2rem;
    margin-top: 2rem;
    margin-bottom: 2.5rem;
    margin-left: 0;
    /* avoid left shift on small screens */
  }

  .header-para {
    font-size: 1.05rem;
    margin: 1.25rem auto;
    /* equal spacing */
    width: 92%;
  }

  .skills {
    margin-top: 1.25rem;
  }

  .header-profile {
    height: 15rem;
    /* revert */
    width: 15rem;
  }

  .card-header img.logo-xl {
    width: 5.5rem;
    height: 5.5rem;
  }

  .card-header img.logo-xxl {
    width: 6rem;
    height: 6rem;
  }

  .card-header img {
    width: 3.75rem;
    height: 3.75rem;
  }

  .card-header .card-title {
    font-size: 1.1rem;
  }

  .card-header .card-subtitle {
    font-size: 0.95rem;
  }

  .card-header .card-meta {
    font-size: 0.8rem;
  }

  .header-nav {
    display: none;
  }

  .topnav {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
  }

  /* Style the navigation menu */
  .topnav {
    overflow: hidden;
    /* background-color: #333; */
    position: relative;
  }

  /* Hide the links inside the navigation menu (except for logo/home) */
  .topnav #myLinks {
    display: none;
    margin: 0;
    /* override desktop margin */
    padding: 0.5rem 0;
    /* tighter dropdown */
    background: rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(2px);
  }

  /* Style navigation menu links */
  .topnav a {
    color: white;
    padding: 14px 16px;
    text-decoration: none;
    font-size: 17px;
    display: block;
  }

  .cn-icon {
    display: block;
    height: 4rem;
    /* revert */
  }

  /* Style the active link */
  .active {
    background-color: #04aa6d;
    color: white;
  }

  .timeline1 {
    position: relative;
    width: 100%;
    margin: 0 auto;
    padding: 0 1rem 0 2.5rem;
    /* a bit more breathing room from the divider */
    overflow-x: hidden;
    /* guard against accidental overflow */
    overflow-y: visible;
    /* no inner vertical scrollbars */
  }

  .timeline1-item {
    position: relative;
    width: 100%;
    left: 0;
    min-height: 150px;
    margin: 1.5rem 0;
    /* add vertical space between items */
    padding-left: 0.5rem;
    /* keep text away from divider */
    box-sizing: border-box;
  }

  .timeline1-item:nth-child(n) {
    position: relative;
    left: 0;
    width: 100%;
  }

  .timeline1-item p {
    color: #6d6d6d;
    font-size: 0.95rem;
    line-height: 1.55;
  }

  .timeline-divider {
    position: absolute;
    height: 100%;
    width: 0;
    border: 3px dashed #295cb4;
    left: 1rem;
    /* fixed position inside the left padding */
    top: 0;
    /* align with container top to avoid overflow and visual gap */
  }

  .timeline-traveller {
    position: absolute;
    left: 0;
    top: .5rem;
    color: #295cb4;
    transform: translate(-50%, 0) rotate(90deg);
  }

  .fa-circle {
    color: lightgray;
    z-index: -1;
    left: 50%;
    transform: translateX(-50%);
  }

  .timeline-dots .fa-circle {
    z-index: 1;
  }

  .circle-1 {
    position: absolute;
    top: 0;
  }

  .circle-2 {
    position: absolute;
    top: 25%;
  }

  .circle-3 {
    position: absolute;
    top: 60%;
  }

  .circle-4 {
    position: absolute;
    top: 90%;
  }

  /* Skills cards: allow wrapping and comfortable tap targets */
  .card {
    width: auto;
    min-width: 8rem;
    padding: 0.6rem 1rem;
  }

  /* Let paragraphs use full width on phones */
  .timeline1-item p {
    max-width: 100%;
    font-size: 0.95rem;
    line-height: 1.55;
  }

  /* Project gallery stacks */
  .images-box {
    justify-content: center;
    padding: 1rem;
    gap: 0.5rem;
  }

  .images img {
    width: 90vw;
    height: auto;
    margin: 0.5rem 0;
  }

  /* Footer stacks into a single column */
  .bottom-footer {
    flex-direction: column;
    padding: 1rem;
    gap: 1.5rem;
  }

  .bottom-footer>div {
    width: 100%;
  }

  .footer-form input,
  textarea {
    width: 100%;
  }

  /* Tighten footer header and ensure centering */
  .footer-div {
    padding-top: 0.5rem;
    padding-bottom: 1rem;
  }

  .footer-div .skills-text {
    justify-content: center;
  }

  .footer-div .skills-text h2 {
    font-size: 1.6rem;
    margin: 0.75rem 0 1rem;
  }

  .footer-form label {
    font-size: 1rem;
    margin: 0.25rem 0.75rem 0.25rem;
  }

  .footer-form input,
  .footer-form textarea {
    height: 2.5rem;
    border-radius: 0.75rem;
  }

  .footer-div .header-list li {
    margin: 0.25rem 0.5rem;
  }
}

/* Education section styles moved from inline */
#education {
  padding-bottom: 1rem;
  background-color: beige;
}
