/*
    JP Wales IT - Main Stylesheet
    Color Scheme
    --color-1: #19183B; Dark Navy
    --color-2: #708993; Slate Blue
    --color-3: #A1C2BD; Light Teal
    --color-4: #E7F2EF; Very Light Grey-Green
*/

:root {
  --color-1: #19183b;
  --color-2: #708993;
  --color-3: #68aed4;
  --color-4: #ffffff;
  --bg-color: #fafcfc; /* A very soft, pristine friendly white */
}

html {
  scroll-behavior: smooth;
  /* Optional: offset if you want nav to permanently take up space, but since nav is sticky, 0 works great */
  scroll-padding-top: 0;
}

body {
  margin: 0;
  padding: 0;
  font-family: "Outfit", sans-serif;
  background-color: var(--color-4); /* Soft slate/ice background canvas */
  color: var(--color-1);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ------------------- */
/*   Layout Flow       */
/* ------------------- */
.hero-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ------------------- */
/*    Scroll Reveals   */
/* ------------------- */
.reveal {
  opacity: 0;
  transform: translateY(40px);
  transition: all 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}
.reveal.active {
  opacity: 1;
  transform: translateY(0);
}
.delay-1 {
  transition-delay: 0.2s;
}

/* ------------------- */
/*    Friendly Nav     */
/* ------------------- */
.navbar {
  padding: clamp(1rem, 2vw + 1rem, 1.5rem) clamp(1.5rem, 5vw, 5rem);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(25, 24, 59, 0.95); /* Navy background */
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05); /* Subtle light border */
}

.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 30px;
  height: 21px;
  background: transparent;
  border: none;
  cursor: pointer;
  z-index: 101;
}
.menu-toggle .bar {
  height: 3px;
  width: 100%;
  background-color: var(--color-4); /* White bars for navy nav */
  border-radius: 10px;
  transition:
    transform 0.3s ease,
    opacity 0.3s ease,
    background-color 0.3s ease;
}
.menu-toggle.active .bar:nth-child(1) {
  transform: translateY(9px) rotate(45deg);
  background-color: var(--color-3);
}
.menu-toggle.active .bar:nth-child(2) {
  opacity: 0;
}
.menu-toggle.active .bar:nth-child(3) {
  transform: translateY(-9px) rotate(-45deg);
  background-color: var(--color-3);
}

.navbar-brand {
  color: #ffffff; /* White text */
  font-size: 1.6rem;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.navbar-brand span {
  color: var(--color-3);
  font-weight: 500;
}

.nav-links {
  list-style: none;
  display: flex;
  gap: 3rem;
  margin: 0;
  padding: 0;
}
.nav-links a {
  text-decoration: none;
  color: var(--color-4); /* Soft Slate/White text */
  font-weight: 500;
  font-size: 1.05rem;
  transition: all 0.3s;
}
.nav-links a.active,
.nav-links a:hover {
  color: #ffffff; /* Bright White on hover */
}

.btn-contact {
  background: var(--color-3);
  color: var(--color-1);
  padding: 0.7rem 1.8rem;
  border-radius: 12px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s;
  box-shadow: 0 4px 15px rgba(25, 24, 59, 0.15);
}
.btn-contact:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(25, 24, 59, 0.25);
  background: var(--color-2);
}

/* ------------------- */
/*   Friendly Hero     */
/* ------------------- */
.hero {
  flex: 1; /* Takes up the remainder of the 100vh after the navbar */
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: clamp(3rem, 6vw, 5rem) clamp(2rem, 6vw, 6rem); /* Increased padding */
  gap: clamp(3rem, 5vw, 5rem);
  position: relative;
  overflow: hidden;
  /* FLOATING CARD AESTHETIC */
  background: #e8eded; /* Restored to pristine white */
  margin: clamp(1.5rem, 3vw, 3rem) clamp(1.5rem, 3vw, 3rem) 0
    clamp(1.5rem, 3vw, 3rem); /* Adjusted horizontal margin */
  border-radius: clamp(20px, 4vw, 40px);
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.04);
}

/* Soft ambient background blob */
.hero::before {
  content: "";
  position: absolute;
  top: -20%;
  right: -10%;
  width: 60%;
  height: 80%;
  background: radial-gradient(
    circle,
    rgba(161, 194, 189, 0.1) 0%,
    transparent 70%
  );
  border-radius: 50%;
  z-index: 0;
  pointer-events: none;
}

.hero-content {
  flex: 1;
  z-index: 10;
  max-width: 650px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  color: var(--color-2);
  padding: 0.6rem 1.2rem;
  border-radius: 50px;
  font-size: 0.9rem;
  font-weight: 600;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03);
  margin-bottom: 2rem;
}
.hero-badge .dot {
  width: 8px;
  height: 8px;
  background: var(--color-3);
  border-radius: 50%;
}

.hero-content h1 {
  font-size: clamp(3rem, 6vw, 5rem);
  font-weight: 300;
  line-height: 1.05;
  color: black; /* Restored to Navy */
  margin: 0 0 1.5rem 0;
  letter-spacing: -2px;
}

.hero-content h1 strong {
  font-weight: 800;
  display: block;
  background: black;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-content p {
  font-size: 1.25rem;
  line-height: 1.7;
  color: black;
  margin: 0 0 3rem 0;
}

.hero-content p strong {
  color: black;
  font-weight: 600;
}

.hero-buttons {
  display: flex;
  gap: 1.5rem;
}

.btn-primary {
  background: var(--color-1);
  color: #ffffff;
  padding: 1.2rem 2.5rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1.1rem;
  text-decoration: none;
  transition: all 0.3s;
  box-shadow: 0 10px 25px rgba(25, 24, 59, 0.15);
}

.btn-primary:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px rgba(25, 24, 59, 0.25);
  background: var(--color-2);
}

.btn-secondary {
  background: #ffffff;
  color: var(--color-1);
  padding: 1.2rem 2.5rem;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1.1rem;
  text-decoration: none;
  transition: all 0.3s;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
}

.btn-secondary:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.1);
  color: var(--color-3);
}

.hero-image {
  flex: 1;
  z-index: 10;
  display: flex;
  justify-content: center;
  align-items: center; /* Center vertically within the flex column */
  position: relative;
  width: 100%;
  max-width: 50%; /* Constrain to exactly half the container to lock centering */
  min-height: 400px;
}

.hero-carousel {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-img {
  position: absolute;
  top: 50%;
  left: 50%;
  /* Use -50% to perfectly align the geometric center of the image to the 50% mark of the parent container */
  transform: translate(-50%, -50%) scale(0.95);
  max-width: 90%; /* Let it breathe slightly inside the column */
  height: auto;
  max-height: 500px; /* Prevent it from blowing out vertically */
  object-fit: contain;
  filter: drop-shadow(0 30px 40px rgba(112, 137, 147, 0.15));
  opacity: 0;
  transition:
    opacity 1s ease-in-out,
    transform 1s ease-in-out;
  z-index: 1;
}

.carousel-img.active {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  z-index: 2;
}

/* ----------------------------- */
/* MINIMALIST PROJECTS GRID      */
/* ----------------------------- */

.projects-grid-section {
  padding: clamp(4rem, 8vw, 8rem) clamp(3rem, 10vw, 8rem); /* Match horizontal padding */
  background-color: var(--color-1); /* Deep Navy Inversion */
  position: relative;
  overflow: hidden; /* Contains the glowing background blob */
  /* FLOATING CARD AESTHETIC */
  margin: clamp(1.5rem, 3vw, 3rem) clamp(1.5rem, 3vw, 3rem); /* Match horizontal margin */
  border-radius: clamp(20px, 4vw, 40px);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.15); /* Stronger shadow for the dark block */
}

/* Massive ambient glow to stop the navy from feeling too flat */
.projects-grid-section::before {
  content: "";
  position: absolute;
  top: 20%;
  left: -20%;
  width: 60vw;
  height: 60vw;
  background: radial-gradient(
    circle,
    rgba(161, 194, 189, 0.08) 0%,
    transparent 60%
  );
  border-radius: 50%;
  filter: blur(100px);
  z-index: 0;
  pointer-events: none;
}

.projects-grid-header {
  max-width: 600px;
  margin-bottom: 6rem;
  position: relative;
  z-index: 10;
}

.projects-grid-header h2 {
  font-size: clamp(2.5rem, 5vw, 4rem);
  font-weight: 300;
  margin: 0 0 1rem 0;
  letter-spacing: -1px;
  color: #ffffff; /* Flipped to white */
}

.projects-grid-header h2 span {
  font-weight: 800;
  color: var(--color-3);
}

.projects-grid-header p {
  font-size: 1.25rem;
  color: rgba(255, 255, 255, 0.7); /* Flipped to light slate */
  line-height: 1.6;
}

/* The Core Asymmetrical Grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6rem 4rem;
}

/* Stagger every second column downward infinitely */
.project-card:nth-child(even) {
  margin-top: 8rem;
}

.project-card {
  display: flex;
  flex-direction: column;
  gap: 2rem;
}

/* Image Thumbnails with Zoom Hover */
.card-image-wrapper {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  aspect-ratio: 16/9;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.05); /* Very soft drop shadow */
  cursor: pointer;
}

.card-image-wrapper img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Frosty Black Overlay on Hover */
.card-overlay {
  position: absolute;
  inset: 0;
  background: rgba(25, 24, 59, 0.4); /* Navy tinted alpha */
  backdrop-filter: blur(2px); /* Very slight blur to draw focus to button */
  -webkit-backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.4s ease;
}

/* Hover States Triggering */
.project-card:hover .card-image-wrapper img {
  transform: scale(1.05);
}

.project-card:hover .card-overlay {
  opacity: 1;
}

.btn-case-study {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50px;
  padding: 0.8rem 1.5rem 0.8rem 2rem;
  color: #ffffff;
  font-size: 1.1rem;
  font-family: inherit;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 15px;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transform: translateY(15px);
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.project-card:hover .btn-case-study {
  transform: translateY(0);
  background: var(--color-3);
  border-color: var(--color-3);
  color: var(--color-1);
}

.btn-case-study .arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  color: inherit;
  transition: all 0.4s;
}

.project-card:hover .btn-case-study .arrow {
  border-color: var(--color-1);
  transform: translateX(5px);
}

/* Card Typography */
.card-content {
  display: flex;
  flex-direction: column;
}

.card-num {
  font-family: monospace;
  font-size: 1.1rem;
  color: var(--color-3);
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 1rem;
}

.card-num::after {
  content: "";
  display: block;
  width: 30px;
  height: 1px;
  background: var(--color-3);
}

.card-title {
  font-size: 2.2rem;
  font-weight: 600;
  color: #ffffff; /* Dark Mode Flipped */
  margin: 0 0 1rem 0;
  letter-spacing: -1px;
}

.card-desc {
  font-size: 1.1rem;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.7); /* Dark Mode Flipped */
  margin: 0 0 1.5rem 0;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.card-meta span {
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 0.3rem 0.8rem;
  border-radius: 50px;
  font-size: 0.8rem;
  color: var(--color-4);
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ----------------------------- */
/*   Tech News Feed Segment      */
/* ----------------------------- */
.news-section {
  padding: clamp(3rem, 6vw, 6rem) clamp(3rem, 10vw, 8rem); /* Match horizontal padding */
  background-color: var(--color-4);
  color: var(--color-1);
  position: relative;
  margin: 0 clamp(1.5rem, 3vw, 3rem) 2rem clamp(1.5rem, 3vw, 3rem); /* Match horizontal margin */
  border-radius: 40px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.03);
}

.news-header {
  max-width: 600px;
  margin-bottom: 3rem;
}

.news-header h2 {
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 300;
  margin: 0 0 0.5rem 0;
  letter-spacing: -1px;
}

.news-header h2 span {
  font-weight: 800;
  color: var(--color-2);
}

.news-feed-container {
  max-width: 900px;
  background: #ffffff;
  border-radius: 24px;
  padding: 2rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.02);
}

/* Base styles for the injected news items */
.news-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.news-item {
  padding: 1.5rem 0;
  border-bottom: 1px solid rgba(25, 24, 59, 0.08);
}

.news-item:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.news-link {
  text-decoration: none;
  color: var(--color-1);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  transition: transform 0.3s;
}

.news-link:hover {
  transform: translateX(10px);
}

.news-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 0;
}

.news-meta {
  font-size: 0.85rem;
  color: var(--color-2);
  font-family: monospace;
}

.news-loading {
  font-family: monospace;
  color: var(--color-2);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 2rem 0;
}

/* Creating an infinite pulsing dot for loading */
.news-loading::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color-3);
  animation: pulse 1.5s infinite;
}

@keyframes pulse {
  0% {
    transform: scale(0.9);
    opacity: 1;
  }
  50% {
    transform: scale(1.5);
    opacity: 0.5;
  }
  100% {
    transform: scale(0.9);
    opacity: 1;
  }
}

/* ----------------------------- */
/*   Ultra-Premium Case Study    */
/* ----------------------------- */
/* Redesigned into a sleek, frosted glass off-canvas drawer from right */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(25, 24, 59, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  justify-content: flex-end; /* Align drawer to right edge */
  opacity: 0;
  visibility: hidden;
  transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-overlay.open {
  opacity: 1;
  visibility: visible;
}

.modal-content-wrapper {
  background: rgba(15, 15, 30, 0.95); /* Deep frosted glass */
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  width: 100%;
  max-width: 900px; /* Big expansive drawer */
  height: 100vh;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  overflow-y: auto;
  position: relative;
  transform: translateX(100%); /* Start completely off-screen mapped right */
  transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: -20px 0 100px rgba(0, 0, 0, 0.8);
  color: var(--color-4);
}

.modal-overlay.open .modal-content-wrapper {
  transform: translateX(0); /* Slides gracefully in */
}

/* Close button modern float */
.modal-close {
  position: sticky; /* Stuck to the top corner of the drawer while scrolling text */
  top: 30px;
  left: calc(100% - 80px); /* Anchor perfectly aligned in drawer */
  margin-bottom: -50px; /* offset the physical space */
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  font-size: 2rem;
  cursor: pointer;
  z-index: 50;
  transition: all 0.3s;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(10px);
}
.modal-close:hover {
  background: var(--color-3);
  color: var(--color-1);
  transform: rotate(90deg) scale(1.1);
}

/* Modal Injected HTML Styles */
.project-details img {
  width: 100%;
  height: 450px;
  object-fit: cover;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.project-details-body {
  padding: 4rem;
}

.project-details h2 {
  font-size: 3rem;
  margin: 0 0 1rem;
  color: #ffffff;
  letter-spacing: -1px;
}

.project-details .tech-tag {
  display: inline-block;
  background: rgba(161, 194, 189, 0.15);
  padding: 0.5rem 1.2rem;
  border-radius: 50px;
  color: var(--color-3);
  margin-bottom: 2rem;
  font-family: monospace;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.project-details p {
  font-size: 1.15rem;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 1.5rem;
}

/* ------------------- */
/*   Responsive        */
/* ------------------- */
@media (max-width: 1024px) {
  .menu-toggle {
    display: flex;
  }
  .nav-links {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(25, 24, 59, 0.98);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 2rem;
    z-index: 100;
    opacity: 0;
    visibility: hidden;
    transition: all 0.4s ease;
  }
  .nav-links.active {
    opacity: 1;
    visibility: visible;
  }
  .nav-links li a {
    font-size: 2rem;
    color: #ffffff;
  }
  .btn-contact {
    display: none;
  } /* Hide the default right button on small res if needed, or flex it down */

  .hero {
    flex-direction: column;
    text-align: center;
  }
  .hero-content {
    margin: 0 auto;
  }
  .hero-badge {
    margin: 0 auto 2rem auto;
  }
  .hero-buttons {
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
  }

  .projects-grid {
    grid-template-columns: 1fr;
    gap: 4rem;
  }
  .project-card:nth-child(even) {
    margin-top: 0;
  } /* Remove stagger */

  .project-details-body {
    padding: 2rem;
  }
  .project-details img {
    height: 250px;
  }
}

@media (max-width: 768px) {
  .modal-content-wrapper {
    max-width: 100%;
    border-radius: 0;
  }
  .hero-buttons {
    flex-direction: column;
    width: 100%;
  }
  .hero-buttons a {
    width: 100%;
    box-sizing: border-box;
    text-align: center;
  }
}
