/* Base reset / tokens */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  text-decoration: none;
  border: none;
  scroll-behavior: smooth;
  font-family: 'Poppins', sans-serif;
}

:root {
  --bg-color: #081b29;
  --second-bg-color: #112e42;
  --text-color: #ededed;
  --main-color: #00abf0;
  --skill-size: 7rem;
}

html { font-size: 62.5%; overflow-x: hidden; }
body { background: var(--bg-color); color: var(--text-color); }

/* Preloader */
.preloader {
  position: fixed; inset: 0;
  background: var(--bg-color);
  display: flex; justify-content: center; align-items: center;
  z-index: 1000;
}
.spinner {
  width: 50px; height: 50px;
  border: 5px solid var(--text-color);
  border-top-color: var(--main-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

section {
  min-height: 100vh;
  padding: 10rem 9% 2rem;
  scroll-margin-top: 8rem; /* anchor targets visible under sticky header */
}

/* Header / Nav */
.header {
  position: fixed; top: 0; left: 0; width: 100%;
  padding: 2rem 9%;
  background: transparent;
  display: flex; justify-content: space-between; align-items: center;
  z-index: 100; transition: .3s;
}
.header.sticky { background: rgba(0,0,0,.3); backdrop-filter: blur(10px); }
.logo { font-size: 2.5rem; color: var(--text-color); font-weight: 600; cursor: default; }

.navbar a {
  font-size: 1.7rem; color: var(--text-color);
  margin-left: 4rem; transition: .3s;
}
.navbar a:hover, .navbar a.active { color: var(--main-color); }

#menu-icon { font-size: 3.6rem; color: var(--text-color); display: none; background: transparent; }

/* Home */
.home { display: flex; justify-content: space-between; align-items: center; position: relative; }
#particles-js { position: absolute; inset: 0; z-index: -1; }

.home-content { max-width: 60rem; }
.home-content h3 { font-size: 3.2rem; font-weight: 700; }
.home-content h3:nth-of-type(2) { margin-bottom: 2rem; }
span { color: var(--main-color); }
.home-content h1 { font-size: 5.6rem; font-weight: 700; line-height: 1.3; }
.home-content p { font-size: 1.6rem; }

.home-img img {
  width: 35vw;
  border-radius: 50%;
  box-shadow: 0 0 2rem var(--main-color);
  animation: floatImage 4s ease-in-out infinite;
}
@keyframes floatImage { 0%{transform:translateY(0)} 50%{transform:translateY(-2.4rem)} 100%{transform:translateY(0)} }

/* Buttons / Social */
.social-media a {
  display: inline-flex; justify-content: center; align-items: center;
  width: 4rem; height: 4rem;
  background: transparent;
  border: .2rem solid var(--main-color); border-radius: 50%;
  font-size: 2rem; color: var(--main-color);
  margin: 3rem 1.5rem 3rem 0; transition: .5s ease;
}
.social-media a:hover { background: var(--main-color); color: var(--second-bg-color); box-shadow: 0 0 1rem var(--main-color); }

.btn {
  display: inline-block; padding: 1rem 2.8rem;
  background: var(--main-color); border-radius: 4rem;
  box-shadow: 0 0 1rem var(--main-color);
  font-size: 1.6rem; color: var(--second-bg-color);
  letter-spacing: .1rem; font-weight: 600; transition: .5s ease;
}
.btn:hover { box-shadow: none; }

/* About */
.about { display: flex; justify-content: center; align-items: center; gap: 2rem; background: var(--second-bg-color); }
.heading { text-align: center; font-size: 4.5rem; }
h3.heading { padding-bottom: 20px; }

.about-content h2 { text-align: left; line-height: 1.2; }
.about-content h3 { font-size: 2.6rem; }
.about-content p { font-size: 1.6rem; margin: 2rem 0 3rem; }

/* About image frame + gentle float */
.about-img { position: relative; isolation: isolate; }
.about-img::before {
  content:""; position:absolute; inset:-8px;
  border-radius: 28px 28px 80px 28px;
  background: linear-gradient(135deg, rgba(0,171,240,.7), rgba(0,171,240,0));
  filter: blur(10px); z-index:0; pointer-events:none;
}
.about-img img {
  width: clamp(400px, 50vw, 1024px);
  max-width: 100%;
  aspect-ratio: 4/5;
  object-fit: cover;
  border-radius: 24px 24px 72px 24px;
  box-shadow: 0 10px 30px rgba(0,0,0,.35);
  transform: translateZ(0);
  animation: floatImageAbout 3s ease-in-out infinite;
  position: relative; z-index: 1;
}
@keyframes floatImageAbout { 0%{transform:translateY(0)} 50%{transform:translateY(-1.6rem)} 100%{transform:translateY(0)} }

/* Skills */
.skills { margin-top: 5rem; }
.skills-container { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 2rem; }
.skill-box { background: var(--bg-color); padding: 2rem; border-radius: 1rem; text-align: center; }
.skill-title { font-size: 1.8rem; font-weight: 600; margin-bottom: 1rem; display: block; }
.skill-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--second-bg-color);
    padding: 2rem;
    border-radius: 1rem;
    text-align: center;
    transition: transform 0.3s ease;
    border: 2px solid var(--main-color);
}

.skill-box:hover {
    transform: translateY(-10px);
}

.skill-box i {
    font-size: 7rem;
    margin-bottom: 1rem;
}

.skill-box img {
    height: 7rem;
    margin-bottom: 1rem;
}

.skill-title {
    font-size: 1.8rem;
    font-weight: 600;
}

/* Unified skill icon sizing */

.skill-box > i,
.skill-box > img,
.skill-box > svg {
  display: block;
  margin: 0 auto 1rem;          /* center + spacing */
}

/* Boxicons */
.skill-box > i {
  font-size: var(--skill-size);
  line-height: 1;
}

/* Raster/SVG images */
.skill-box > img {
  width: var(--skill-size);
  height: var(--skill-size);
  object-fit: contain;           /* no cropping, keeps logos sharp */
}

/* Inline SVGs (override width/height attributes or inline styles) */
.skill-box > svg,
.skill-box > svg[width],
.skill-box > svg[height] {
  width: var(--skill-size) !important;
  height: var(--skill-size) !important;
}

/* Optional: subtle backdrop so light logos remain readable */
.skill-box > i,
.skill-box > img,
.skill-box > svg {
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  padding: 0.8rem;
}

/* Projects */
.projects { background: var(--bg-color); }
.projects h2 { margin-bottom: 5rem; }

.projects-container {
  display: grid; gap: 2.5rem;
  grid-template-columns: repeat(3, 1fr);
}

.project-item { margin-bottom: 2.5rem; display: flex; flex-direction: column; }

.projects-box {
  position: relative; border-radius: 2rem; overflow: hidden;
  box-shadow: 0 0 1rem rgba(0,0,0,.5);
  transform-style: preserve-3d; transition: transform .5s, box-shadow .5s;
}
.projects-box::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  opacity: .9; transition: opacity .35s ease; z-index: 1;
}
.projects-box:hover { transform: perspective(1000px) rotateY(5deg) rotateX(5deg) scale(1.05); box-shadow: 0 2rem 3rem rgba(0,0,0,.35); }
.projects-box img { width: 100%; aspect-ratio: 16/9; object-fit: cover; display: block; transition: .5s ease; position: relative; z-index: 0; }
.projects-box:hover img { transform: scale(1.1); }

/* Slide-up info layer */
.project-layer {
  position: absolute; left: 0; bottom: 0; width: 100%; height: 100%;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: flex-start;
  padding: 1.2rem 1.6rem;
  background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(8,27,41,.60) 35%, rgba(8,27,41,.85) 75%);
  transform: translateY(calc(100% - 64px)); transition: transform .4s ease; z-index: 2;
}
.projects-box:hover .project-layer { transform: translateY(0); }
.project-layer h4 { margin: 0; font-size: 2rem; line-height: 1.2; text-shadow: 0 2px 6px rgba(0,0,0,.4); }
.project-layer p { margin: .5rem 0 1rem; font-size: 1.4rem; opacity: .95; }

.project-links a {
  display: inline-flex; justify-content: center; align-items: center;
  width: 5rem; height: 5rem; background: var(--text-color); border-radius: 50%;
}
.project-links a i { font-size: 2rem; color: var(--second-bg-color); }

/* Project description toggle area */
.project-title {
  font-size: 3rem; font-weight: 700; letter-spacing: .2px;
  margin: .25rem 0 .9rem; color: var(--text-color);
  display: inline-flex; align-items: center; gap: .8rem; position: relative;
}
.project-title::before {
  content: ""; width: .9rem; height: .9rem; border-radius: 999px; background: var(--main-color);
  box-shadow: 0 0 12px var(--main-color);
}
.project-title::after {
  content: ""; position: absolute; left: 1.9rem; bottom: -.5rem; width: 7rem; height: 3px;
  border-radius: 3px; background: linear-gradient(90deg, var(--main-color), transparent); opacity: .9;
}

.project-description {
  max-height: 0; overflow: hidden;
  padding: 0 2rem;
  background: var(--second-bg-color); border-radius: 1rem; margin-top: 1.5rem;
  transition: max-height .5s ease-out, opacity .4s ease, transform .4s ease;
  opacity: 0; transform: translateY(8px);
}
.project-description p { font-size: 1.6rem; line-height: 1.6; padding-bottom: 2rem; }
.show-description { opacity: 1; transform: translateY(0); }

.read-more-btn {
  display: block; padding: .8rem 1.5rem; background: var(--main-color);
  border-radius: 2rem; font-size: 1.4rem; color: var(--second-bg-color);
  font-weight: 600; transition: .5s ease; margin-top: 1rem; cursor: pointer;
}
.read-more-btn:hover { box-shadow: 0 0 1rem var(--main-color); }

/* Contact */
.contact { background: var(--second-bg-color); }
.contact-info { text-align: center; }
.contact-info h3 { font-size: 2rem; margin: 1.5rem 0; }
.contact-info a:not(.btn) { color: var(--main-color); font-weight: 600; }

/* Footer */
.footer {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap;
  padding: 2rem 9%; background: var(--bg-color);
}
.footer-text p { font-size: 1.6rem; }
.footer-iconTop a { display: inline-flex; justify-content: center; align-items: center; padding: .8rem; background: var(--main-color); border-radius: .8rem; transition: .5s ease; }
.footer-iconTop a:hover { box-shadow: 0 0 1rem var(--main-color); }
.footer-iconTop a i { font-size: 2.4rem; color: var(--bg-color); }

/* Focus styles */
.btn:focus-visible,
.read-more-btn:focus-visible,
.navbar a:focus-visible,
.social-media a:focus-visible,
.project-links a:focus-visible,
.footer-iconTop a:focus-visible {
  outline: 2px solid var(--main-color); outline-offset: 3px;
}

/* Responsive */
@media (max-width: 1200px) { html { font-size: 55%; } }

@media (max-width: 991px) {
  .header { padding: 2rem 3%; }
  section { padding: 10rem 3% 2rem; }
  .projects { padding-bottom: 7rem; }
  .footer { padding: 2rem 3%; }
}

@media (max-width: 900px) { .projects-container { grid-template-columns: repeat(2, 1fr); } }

@media (max-width: 768px) {
  #menu-icon { display: block; }
  .navbar {
    position: absolute; top: 100%; left: 0; width: 100%;
    padding: 1rem 3%; background: var(--bg-color);
    border-top: .1rem solid rgba(0,0,0,.2); box-shadow: 0 .5rem 1rem rgba(0,0,0,.2);
    display: none;
  }
  .navbar.active { display: block; }
  .navbar a { display: block; font-size: 2rem; margin: 3rem 0; }

  .home { flex-direction: column; }
  .home-content h3 { font-size: 2.6rem; }
  .home-content h1 { font-size: 5rem; }
  .home-img img { width: 70vw; margin-top: 4rem; }

  .about { flex-direction: column-reverse; }
  .about-img { width: 70vw; margin-top: 4rem; }

  .projects h2 { margin-bottom: 3rem; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  /* Tablet layout: stack About like mobile (image under text) */
  .about { flex-direction: column-reverse; align-items: center; }
  .about-img img { width: min(80vw, 380px); margin-top: 3rem; }
  .home-img img { width: min(80vw, 380px); }
}

@media (max-width: 617px) { .projects-container { grid-template-columns: 1fr; } }

@media (max-width: 450px) { html { font-size: 50%; } }

@media (max-width: 365px) {
  .home-img img, .about-img img { width: 90vw; }
  .footer { flex-direction: column-reverse; }
  .footer p { text-align: center; margin-top: 2rem; }
}
