/* --- 1. Global & Utility Styles --- */

:root {
  /* Define Color Palette - Pure Black & White Theme */
  --color-primary: #000; /* Pure Black (Used for Header, Footers, Main Headings) */
  --color-accent: #333; /* Dark Gray (Used for subtle highlights and borders) */
  --color-secondary: #333; /* Dark Gray (Used for CTAs/Buttons, to be styled with border) */
  --color-background: #fff; /* Pure White Background */
  --color-text: #333; /* Dark Gray Text (Pure black text is too harsh) */
  --color-light-text: #fff; /* White Text (For use on black backgrounds) */
  --color-shadow: rgba(0, 0, 0, 0.15); /* Slightly darker shadow for contrast */
}

* {
  box-sizing: border-box;
}

body {
  font-family: "Roboto", "Open Sans", sans-serif; /* Professional Sans-Serif Font */
  margin: 0;
  padding: 0;
  color: var(--color-text);
  background-color: var(--color-background);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  margin-top: 70px; /* Added for sticky header */
}

/* Main Content Area Styling */
main {
  flex: 1;
  padding: 40px 20px;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

h1,
h2,
h3 {
  color: var(--color-primary); /* Changed to primary charcoal */
  line-height: 1.2;
}

p {
  line-height: 1.6;
}

/* --- 2. Header & Navigation --- */

header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;

  background-color: var(--color-primary); /* Changed to primary charcoal */
  color: var(--color-light-text);
  padding: 15px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  transition: background-color 0.3s, padding 0.3s; /* Added padding to transition */
}

/* Adjust logo size when header is scrolled */
header.scrolled {
  padding: 10px 40px; /* Make it slightly thinner when sticky/scrolled */
}

/* Update the logo container to allow inline elements */
.logo a {
  display: flex; /* Aligns the image and text horizontally */
  align-items: center;
  text-decoration: none; /* Remove underline from the link */
  color: var(--color-light-text);
}

.logo img {
  height: 60px; /* NEW: Larger size for the default desktop header */
  width: auto;
  vertical-align: middle;
  transition: height 0.3s ease;
}

header.scrolled .logo img {
  height: 40px; /* NEW: Size when the header is sticky/scrolled */
}

nav a {
  color: var(--color-light-text);
  text-decoration: none;
  margin-left: 25px;
  font-weight: 500;
  padding-bottom: 5px;
  transition: color 0.3s, border-bottom 0.3s;
}

nav a:hover,
nav a.active {
  color: #ccc; /* This is the desired color for active links */
  border-bottom: 2px solid #ccc;
}

/* --- 3. Buttons and Call-to-Actions (CTAs) --- */

.cta-button,
.read-more {
  display: inline-block;
  background-color: var(--color-secondary); /* Changed to secondary orange */
  color: var(--color-light-text);
  padding: 10px 20px;
  border-radius: 5px;
  text-decoration: none;
  font-weight: bold;
  transition: background-color 0.3s;
  border: none;
  cursor: pointer;
}

.cta-button:hover,
.read-more:hover {
  background-color: #d1701e; /* Slightly darker secondary orange */
}

/* --- 4. Articles Page Specific Styles --- */
.article-content {
  max-width: 900px;
  width: 90%; /* Use a percentage for fluid sizing */
  margin: 0 auto;
}
.articles-content h1 {
  text-align: center;
  margin-bottom: 10px;
}

.articles-content .intro {
  text-align: center;
  margin-bottom: 40px;
  font-size: 1.1em;
  color: #555;
}

/* Category Buttons */
.article-categories {
  text-align: center;
  margin-bottom: 40px;
  padding: 15px;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 1px 3px var(--color-shadow);
}

.category-btn {
  padding: 8px 15px;
  margin: 5px;
  border: 1px solid var(--color-primary); /* Changed to primary charcoal */
  background-color: #fff;
  color: var(--color-primary); /* Changed to primary charcoal */
  border-radius: 20px;
  cursor: pointer;
  transition: background-color 0.3s, color 0.3s;
}

.category-btn:hover,
.category-btn.active {
  background-color: var(--color-primary); /* Changed to primary charcoal */
  color: var(--color-light-text);
}

/* Article Cards */
.article-card {
  background-color: #fff;
  padding: 25px;
  margin-bottom: 20px;
  border-radius: 8px;
  box-shadow: 0 4px 6px var(--color-shadow);
  transition: transform 0.2s;
}

.article-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 10px var(--color-shadow);
}

.article-card h3 a {
  color: var(--color-primary); /* Changed to primary charcoal */
  text-decoration: none;
  font-size: 1.4em;
}

.article-card h3 a:hover {
  text-decoration: underline;
  color: var(--color-accent); /* Changed to accent blue */
}

.article-card .metadata {
  font-size: 0.9em;
  color: #666;
  margin: 10px 0;
}

.category-tag {
  background-color: var(--color-accent); /* Changed to accent blue */
  color: var(--color-light-text);
  padding: 3px 8px;
  border-radius: 3px;
  font-weight: 500;
}

/* --- 5. Contact Widget (Footer) Styles --- */

footer {
  background-color: var(--color-primary); /* Changed to primary charcoal */
  color: var(--color-light-text);
  padding: 30px 20px;
  text-align: center;
  margin-top: 40px;
}

.footer-logo {
  /* Footer logo styling */
  height: 40px; /* Example size */
  margin-bottom: 15px;
  filter: brightness(200%); /* Makes it white/light for dark footer */
}

.contact-widget h3 {
  color: var(--color-accent); /* Changed to accent blue */
  margin-top: 0;
  font-size: 1.5em;
}

.contact-widget p {
  font-size: 1.1em;
  margin-bottom: 20px;
  color: #eee;
}

.contact-links a {
  color: var(--color-light-text);
  text-decoration: none;
  font-weight: bold;
  margin: 0 15px;
  transition: color 0.3s;
}

.contact-links a:hover {
  /* NEW: Set hover color to a subtle light gray */
  color: #ccc;
  text-decoration: underline;
}

.copyright {
  margin-top: 20px;
  font-size: 0.8em;
  color: #aaa;
}

/* --- 6. Videos Page Specific Styles --- */

.video-category h2 {
  /* Uses the dark gray accent color for separation */
  border-bottom: 2px solid var(--color-accent);
  padding-bottom: 10px;
  margin-top: 40px;
  margin-bottom: 25px;
}

.video-gallery {
  /* Creates the responsive grid layout */
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 30px;
}

.video-item {
  /* Uses a white background with a subtle border for separation */
  background-color: #fff;
  border-radius: 0;
  border: 1px solid #eee;
  box-shadow: 0 4px 6px var(--color-shadow);
  padding-bottom: 15px;
  overflow: hidden;
}

.video-item iframe {
  display: block;
  width: 100%;
  height: 200px;
}

.video-item h3 {
  padding: 10px 15px 0;
  margin: 0;
  font-size: 1.2em;
}

.video-item p {
  padding: 0 15px;
  font-size: 0.9em;
  color: #666;
}

/* Horizontal Rule Styling for separation */
hr {
  border: 0;
  height: 1px;
  background-image: linear-gradient(
    to right,
    rgba(0, 0, 0, 0),
    var(--color-primary),
    rgba(0, 0, 0, 0)
  ); /* Changed to primary charcoal */
  margin: 60px 0;
}

/* --- 7. About Page Specific Styles (Bio and Form) --- */

.profile-card {
  display: flex;
  gap: 30px;
  align-items: flex-start;
  padding: 30px;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 6px var(--color-shadow);
}

.profile-photo {
  width: 200px;
  height: 200px;
  border-radius: 50%;
  object-fit: cover;
  border: 4px solid var(--color-accent); /* Changed to accent blue */
  flex-shrink: 0;
}

.bio-text {
  flex-grow: 1;
}

.social-links {
  margin-top: 20px;
}

.social-btn {
  display: inline-block;
  padding: 8px 15px;
  margin-right: 10px;
  border-radius: 5px;
  text-decoration: none;
  font-weight: bold;
  color: var(--color-light-text);
  transition: opacity 0.3s;
}

.social-btn:hover {
  opacity: 0.9;
}

.linkedin-btn {
  background-color: #0077b5; /* Retaining specific brand colors */
}

.github-btn {
  background-color: #333; /* Retaining specific brand colors */
}

.resume-btn {
  background-color: var(--color-primary); /* Changed to primary charcoal */
}

/* Contact Form Styling */
.contact-form {
  max-width: 600px;
  margin: 30px auto;
  padding: 30px;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 6px var(--color-shadow);
}

.contact-form label {
  display: block;
  margin-bottom: 5px;
  font-weight: bold;
  color: var(--color-primary); /* Changed to primary charcoal */
}

.contact-form input[type="text"],
.contact-form input[type="email"],
.contact-form textarea {
  width: 100%;
  padding: 10px;
  margin-bottom: 20px;
  border: 1px solid #ccc;
  border-radius: 5px;
  font-size: 1em;
}

.contact-form textarea {
  resize: vertical;
}

/* Ensure the submit button uses the standard CTA style */
.contact-form .cta-button {
  width: auto;
  float: right;
}

/* Media Query for responsiveness */
@media (max-width: 768px) {
  .profile-card {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .profile-photo {
    margin-bottom: 15px;
  }
  .social-links {
    margin-top: 20px;
  }
}

/* --- 8. Single Article Page Readability Styles --- */

.article-detail-content {
  max-width: 800px;
  padding-top: 20px;
}

.article-post {
  background-color: #fff;
  padding: 40px;
  border-radius: 8px;
  box-shadow: 0 4px 10px var(--color-shadow);
}

.article-title {
  font-size: 2.2em;
  margin-bottom: 10px;
  color: #1a1a1a;
}

.article-meta {
  font-size: 0.9em;
  color: #666;
  margin-bottom: 20px;
}

.article-meta .category-tag {
  font-size: 0.8em;
  padding: 2px 6px;
}

.article-intro {
  font-size: 1.15em;
  font-style: italic;
  margin: 30px 0;
  padding-left: 15px;
  border-left: 4px solid var(--color-accent); /* Changed to accent blue */
  color: #444;
}

.article-post section h2 {
  font-size: 1.8em;
  margin-top: 40px;
  margin-bottom: 15px;
  color: var(--color-primary); /* Changed to primary charcoal */
  border-bottom: 1px dashed #eee;
  padding-bottom: 5px;
}

.article-post p,
.article-post ul {
  line-height: 1.75;
  font-size: 1.05em;
  margin-bottom: 20px;
}

.article-post ul {
  margin-left: 20px;
}

.share-buttons {
  margin: 20px 0;
  font-size: 0.9em;
  padding: 10px 0;
  border-top: 1px solid #eee;
  border-bottom: 1px solid #eee;
}

.share-buttons .share-link {
  color: var(--color-secondary); /* Changed to secondary orange */
  text-decoration: none;
  margin-left: 10px;
  font-weight: bold;
}

.author-bio-cta {
  text-align: center;
  padding: 30px;
  background-color: var(--color-background);
  border-radius: 6px;
  margin-top: 40px;
}

.author-bio-cta p {
  font-size: 1.1em;
  color: var(--color-text);
}

/* --- 9. Article Navigation Link --- */

.article-navigation {
  margin-bottom: 20px;
}

.back-link {
  color: var(--color-primary); /* Changed to primary charcoal */
  text-decoration: none;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 4px;
  transition: background-color 0.3s;
  font-size: 1em;
}

.back-link:hover {
  background-color: rgba(
    44,
    62,
    80,
    0.1
  ); /* Light Primary Charcoal background on hover */
  text-decoration: underline;
}

/* --- 10. Home Page Quote Area Styling --- */

.quote-area {
  text-align: center;
  padding: 30px;
  margin: 40px 0;
  background-color: #fff;
  border-left: 5px solid var(--color-secondary); /* Changed to secondary orange */
  box-shadow: 0 2px 4px var(--color-shadow);
  font-style: italic;
}

.dynamic-quote {
  font-size: 1.2em;
  color: var(--color-primary); /* Changed to primary charcoal */
  margin: 0;
}

/* --- 11. Mobile Navigation (Hamburger Menu) Styles --- */

/* Style the hamburger button (visible only on mobile) */
.menu-toggle {
  display: none; /* Hidden by default */
  background: none;
  border: none;
  color: var(--color-light-text);
  font-size: 1.8em;
  cursor: pointer;
  z-index: 1001; /* Must be above the header */
}

/* Media Query: Apply these styles only for screen widths 768px and smaller (typical tablet/mobile cutoff) */
@media (max-width: 768px) {
  /* 1. Show the hamburger button */
  .menu-toggle {
    display: block;
  }

  /* 2. Style the navigation for mobile view */
  nav {
    /* Position the menu as a full-screen overlay */
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: 250px; /* Width of the menu panel */
    background-color: var(--color-primary);
    box-shadow: -4px 0 8px rgba(0, 0, 0, 0.5);

    /* Arrange links vertically */
    display: flex;
    flex-direction: column;
    padding: 80px 20px 20px;

    /* KEY: Hide the menu by default (off-screen) */
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out;
    z-index: 999;
  }

  /* 3. Style the links inside the mobile menu */
  nav a {
    margin: 15px 0;
    padding: 10px 0;
    text-align: left;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 1.2em;
    width: 100%;
  }

  /* 4. State for when the menu is active/open (triggered by JS) */
  nav.active {
    transform: translateX(0); /* Bring the menu onto the screen */
  }

  /* Adjust header padding since the nav is removed from flow */
  header {
    padding: 15px 20px;
  }
}

/* --- 12. Home Page Hero Section Styling --- */

.hero-section {
  display: flex;
  align-items: center;
  gap: 40px;
  padding: 20px 0;
  margin-bottom: 40px;
}

.hero-text {
  flex: 1; /* Allows text to take available space */
}

.hero-image-placeholder {
  flex: 1; /* Allows image to take available space */
  min-height: 350px; /* Ensures the placeholder has a minimum height */
  background-color: #ecf0f1; /* Light gray background for placeholder */
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2em;
  color: var(--color-primary);
  text-align: center;
  overflow: hidden; /* Important for containing future images */
}

/* Ensure image content scales within the placeholder */
.hero-image-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Mobile Responsiveness for Hero Section */
@media (max-width: 900px) {
  .hero-section {
    flex-direction: column; /* Stack image and text vertically on small screens */
    text-align: center;
    gap: 20px;
  }
  .hero-image-placeholder {
    min-height: 250px;
    width: 100%; /* Image takes full width */
  }
}

/* --- 13. Back to Top Button Styles --- */

#back-to-top {
  /* Fixed Position */
  display: none; /* Hidden by default (JS will show it) */
  position: fixed;
  bottom: 30px;
  right: 30px;

  /* Styling */
  background-color: var(--color-secondary); /* Muted Orange CTA color */
  color: var(--color-light-text);
  padding: 10px 15px;
  border-radius: 50%; /* Makes it circular */
  text-decoration: none;
  font-size: 1.5em;
  line-height: 1; /* Centers the arrow */
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4);

  /* Z-Index to ensure it's on top of everything */
  z-index: 999;

  /* Smooth transition for appearance/disappearance */
  opacity: 0;
  transition: opacity 0.3s, background-color 0.3s;
}

#back-to-top:hover {
  background-color: #d1701e; /* Slightly darker secondary orange */
}

/* Class added by JavaScript to make it visible */
#back-to-top.show {
  display: block;
  opacity: 1;
}

/* --- 14. Portfolio Page Styles (Case Studies) --- */

.portfolio-content {
  /* Ensure content is centered and readable, similar to main pages */
  max-width: 1200px;
}

.case-study-card {
  display: flex;
  background-color: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 10px var(--color-shadow);
  margin-bottom: 40px;
  overflow: hidden;
  transition: transform 0.3s;
}

.case-study-card:hover {
  transform: translateY(-5px);
}

.case-study-image {
  flex: 1;
  min-width: 300px;
  background-color: #f1f1f1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
  font-size: 1.1em;
}

.case-study-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.case-study-details {
  flex: 2;
  padding: 30px;
}

.case-study-details h2 {
  color: var(--color-primary);
  margin-top: 0;
  font-size: 1.6em;
}

.project-summary h3 {
  font-size: 1.1em;
  color: var(--color-accent); /* Use accent color for section headings */
  border-bottom: 1px dashed #eee;
  padding-bottom: 5px;
  margin-top: 20px;
  margin-bottom: 5px;
}

.impact-metric {
  color: var(--color-secondary); /* Highlight impact with the CTA color */
  font-size: 1.1em;
  font-weight: bold;
}

/* Tech Stack Tags */
.tech-stack-tags {
  margin-bottom: 15px;
}

.tech-tag {
  display: inline-block;
  background-color: rgba(
    52,
    152,
    219,
    0.1
  ); /* Light background using the accent color */
  color: var(--color-primary);
  padding: 4px 10px;
  margin-right: 8px;
  border-radius: 4px;
  font-size: 0.85em;
  font-weight: 500;
  border: 1px solid rgba(52, 152, 219, 0.3);
}

/* Responsive adjustment for the case study cards */
@media (max-width: 900px) {
  .case-study-card {
    flex-direction: column; /* Stack vertically */
  }
  .case-study-image {
    min-height: 200px;
    width: 100%;
  }
  .case-study-details {
    padding: 20px;
  }
}

/* --- New Code for Website Name Beside Logo --- */

.site-name {
  font-size: 1.5em; /* Make the text stand out */
  font-weight: 700;
  margin-left: 10px; /* Space between the logo image and the text */
  letter-spacing: 0.5px;
  color: var(--color-light-text);
  transition: font-size 0.3s;
}

/* Adjust size when header is sticky/scrolled */
header.scrolled .site-name {
  font-size: 1.2em; /* Shrink slightly when scrolled */
}

/* Mobile: Hide the name to save space when the logo shrinks (under 768px) */
@media (max-width: 768px) {
  .site-name {
    display: none;
  }
}

/* --- 15. Case Study Detail Page Styles --- */

.case-study-detail-content {
  max-width: 900px;
}

.case-study-title {
  font-size: 2.5em;
  margin-bottom: 10px;
  color: var(--color-primary); /* Black */
}

.case-study-meta {
  font-size: 0.9em;
  color: #666;
  margin-bottom: 20px;
}

.section-heading {
  color: var(--color-primary);
  font-size: 1.8em;
  margin-top: 40px;
  border-bottom: 2px solid var(--color-accent); /* Dark Gray border */
  padding-bottom: 5px;
}

/* Metrics Grid Styling */
.impact-metrics-grid {
  display: flex;
  justify-content: space-around;
  align-items: stretch;
  gap: 20px;
  margin: 40px 0;
}

.metric-box {
  flex: 1;
  text-align: center;
  padding: 20px 10px;
  border: 1px solid #ccc;
  background-color: #f8f8f8; /* Light background to highlight metrics */
  border-radius: 0;
}

.metric-value {
  display: block;
  font-size: 2.5em;
  font-weight: 700;
  color: var(--color-primary); /* Pure Black for impact */
  margin-bottom: 5px;
}

.metric-label {
  font-size: 0.9em;
  color: #555;
  line-height: 1.4;
  text-transform: uppercase;
}

.tech-diagram {
  margin: 30px 0;
  text-align: center;
  padding: 20px;
  background-color: #f8f8f8;
  border: 1px dashed #ccc;
}

.tech-diagram figcaption {
  font-style: italic;
  font-size: 0.9em;
  margin-top: 10px;
  color: #555;
}

/* Mobile Adjustments */
@media (max-width: 600px) {
  .impact-metrics-grid {
    flex-direction: column;
  }
}

/* --- 16. Reading Progress Bar Styles --- */

#progress-bar-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 5px; /* The height of the bar */
  background-color: #eee; /* Light gray background (the empty part) */
  z-index: 1001; /* Must be slightly higher than the header z-index (1000) */
}

#reading-progress-bar {
  height: 100%;
  width: 0%; /* Starts at 0, JS updates this */
  background-color: var(--color-accent); /* Dark Gray accent color */
  transition: width 0.1s linear; /* Smooth fill transition */
}

/* --- 17. About Page Tech Stack Styling --- */

.tech-badges-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 20px 0;
}

.tech-badge {
  display: inline-block;
  padding: 8px 15px;
  /* Inverted B&W style for badges */
  background-color: var(--color-primary); /* Pure Black background */
  color: var(--color-light-text); /* White text */
  border: 1px solid var(--color-primary);
  font-size: 0.9em;
  font-weight: 500;
  transition: background-color 0.3s;
}

.tech-badge:hover {
  /* Subtle hover effect to show interaction */
  background-color: var(--color-accent);
}

/* --- 19. Article Search Bar Styles --- */

.search-bar-container {
  text-align: center;
  margin-bottom: 30px;
}

#article-search {
  width: 100%;
  max-width: 600px;
  padding: 12px 15px;
  font-size: 1em;
  border: 2px solid var(--color-accent);
  background-color: var(--color-background);
  color: var(--color-text);
  border-radius: 0;
  transition: border-color 0.3s;
}

#article-search:focus {
  outline: none;
  border-color: var(--color-primary); /* Darken border on focus */
}
.responsive-article-img {
  max-width: 100%;
  height: auto;

  /* 🔑 Add this rule to make it behave like a structural element */
  display: block;

  /* Center it within the article content */
  margin: 0 auto 20px auto;
}
