:root {
  /*
    The :root pseudo-class selects the <html> element, making these variables
    globally available throughout the document. We are defining our 'light'
    theme values here as the default theme.
  */

  /* ========================================
     COLOR PALETTE - LIGHT THEME
     ======================================== */

  /* A vibrant, accessible blue for primary interactive elements like links and buttons.*/
  --primary-color: #0054AD;

  /* A muted gray for secondary text or less important elements. */
  --secondary-color: #6c757d;

  /* A very light gray for the main page background, which is softer on the eyes than pure white. */
  --background-color: #f8f9fa;

  /* White for surfaces that should stand out from the background, like cards, headers, and forms. */
  --surface-color: #ffffff;

  /* A dark, highly readable color for main text content. We use a dark gray instead of pure black for better readability. */
  --text-color: #212529;

  /* A slightly lighter text color for subtitles, placeholders, or less emphasized text. */
  --text-color-light: #495057;

  /* A subtle border color for elements like cards and form inputs. */
  --border-color: #dee2e6;

  /* A subtle shadow color to give elements depth. */
  --shadow-color: rgba(0, 0, 0, 0.1);

  /* ========================================
     TYPOGRAPHY
     ======================================== */
  /* A clean, modern, and system-agnostic sans-serif font stack. The browser will try each font from left to right. */
  --font-family-base:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;

  /* The base font size for the document. Using 'rem' units allows for better accessibility and scalability. */
  --font-size-base: 1rem; /*equals to 16px*/

  /* Base line height for improved readability. It's unitless, meaning it's a multiplier of the font size. */
  --line-height-base: 1.5;
  --font-weight-normal: 400;
  --font-weight-bold: 700;

  /* ========================================
     SPACING & LAYOUT
     ======================================== */
  /* A base unit for consistent spacing (margins, padding). We can use multiples of this unit. */
  --spacing-unit: 1rem;

  /* Max width for our .container class to ensure content is readable on wide screens. */
  --container-width: 1140px;

  /* A consistent border-radius for rounded corners on buttons, cards, and inputs. */
  --border-radius: 0.25rem;
}


/* 
   NEW CODE STARTS HERE:
   Define the color variables for the Dark Theme.
   This entire block of rules will only apply when the <html> element
   has the attribute data-theme="dark".
*/
html[data-theme='dark'] {
  /* =======================================
     COLOR PALETTE - DARK THEME
     ======================================== */
  
  /* The primary color can often stay the same, or you might want a slightly less saturated version. We'll keep it for now. */
  --primary-color: #58A6FF;
  
  /* For secondary elements, a lighter gray works well on a dark background. */
  --secondary-color: #adb5bd;

  /* The main page background. A very dark gray is often preferred over pure black as it's less harsh on the eyes. */
  --background-color: #121212;
  
  /* The color for "surfaces" like cards and headers. This should be slightly lighter than the main background to create separation. */
  --surface-color: #121212;
  
  /* The main text color. We use a light, off-white for readability, avoiding pure white which can cause eye strain. */
  --text-color: #e9ecef;
  
  /* A slightly dimmer text color for subtitles or less important information. */
  --text-color-light: #ced4da;
  
  /* Borders should be subtle. A slightly lighter gray than the surface color works well. */
  --border-color: #343a40;
  
  /* Shadows are tricky on dark backgrounds. A common technique is to use a very light, almost invisible white shadow to simulate depth. */
  --shadow-color: rgba(255, 255, 255, 0.05);
}



/*
  ========================================
  CSS RESET
  ========================================
  This reset removes inconsistent browser default styles, providing a clean
  and predictable baseline to build our own design upon.
*/

/*
  1. Use a more intuitive box-sizing model on all elements.
     This makes layout work more predictable, as padding and border
     are included in the element's total width and height.
*/
*,
*::before,
*::after {
  box-sizing: border-box;
}

/*
  2. Remove default margin and padding from all elements.
     This gives us full control over spacing.
*/
* {
  margin: 0;
  padding: 0;
}

/*
  3. Allow percentage-based heights in the application.
*/
html,
body {
  height: 100%;
  width: 100%;
  overflow-x: hidden;
}

/*
  4. Create a root stacking context. This is a modern best practice to prevent
     z-index issues with elements like modals or dropdowns.
*/
#root,
#__next {
  isolation: isolate;
}

/*
  ========================================
  BASE STYLES
  ========================================
  These are the foundational styles for the entire site. We apply them
  to the body, and they will be inherited by most other elements.
*/

body {
  /* 
    Set the default font family for the entire page using our variable.
    This "font stack" provides modern, readable, and system-agnostic fonts.
  */
  font-family: var(--font-family-base);

  /*
    Set the base font size. Using 'rem' units makes our site more accessible,
    as it respects the user's default font size settings in their browser.
  */
  font-size: var(--font-size-base);

  /*
    Set a comfortable line height for better readability. A unitless value
    acts as a multiplier of the font-size, which scales gracefully.
  */
  line-height: var(--line-height-base);

  /*
    Set the default text color for all content. We use our dark gray variable
    for a softer, more professional look than pure black.
  */
  color: var(--text-color);

  /*
    Set the main background color for the page. This light gray is less harsh
    on the eyes than pure white.
  */
  background-color: var(--background-color);

  /*transition for animate*/
  transition: background-color 0.3s ease-in-out, color 0.3s ease-in-out;
}

/*
  ========================================
  HEADER & NAVIGATION
  ========================================
  These styles control the layout and appearance of the main site header
  and the primary navigation menu within it.
*/

header {
  /* Use our --surface-color to make the header's background distinct from the page body. */
  background-color: var(--surface-color);

  /* Add a subtle shadow to lift the header off the page, giving it depth. */
  box-shadow: 0 2px 4px var(--shadow-color);

  /* Give the header some vertical padding so content isn't flush against the top/bottom edges. */
  padding: var(--spacing-unit) 0;

  /* 
    This is the magic for a "sticky" header. 
    - 'position: sticky' makes the element behave like a normal element until it hits 
      the top of the viewport during a scroll.
    - 'top: 0' tells the browser where to "stick" it (0px from the top).
    - 'z-index' ensures the header stays on top of other content when scrolling.
  */
  position: sticky;
  top: 0;
  z-index: 100;

  /* 
  Target the .container inside the header to apply our layout rules.
  This is a good practice to ensure our header content aligns with the
  rest of the page content.
*/

/*transition for animate*/
transition: background-color 0.3s ease-in-out, box-shadow 0.3s ease-in-out;
}
header .container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  /* We also apply our max-width and centering here. */
  max-width: var(--container-width);
  margin: 0 auto; /* Centers the container horizontally */
  padding: 0 var(--spacing-unit); /* Adds padding on the sides for smaller screens */
}

/*
  Now we style the navigation itself. We target the <ul> directly to
  turn it into a flex container as well.
*/
header nav ul {
  display: flex;

  /* This creates a consistent space between each of the navigation links. */
  gap: calc(var(--spacing-unit) * 2);

  /* This removes the default bullet points from the unordered list. */
  list-style: none;
}

/*
  Finally, we style the navigation links themselves.
*/

header nav ul li a {
  text-decoration: none;

  /* Use our theme's text color, overriding the browser's default blue. */
  color: var(--text-color);

  /* Make the font bold to signify importance. */
  font-weight: var(--font-weight-bold);

  /* Add padding to increase the clickable area, making it more user-friendly. */
  padding: 0.5rem;

  /* transition for animate*/
  transition: color 0.3s ease-in-out;
}

/*style for the hover state.*/

header nav ul li a:hover {
  color: var(--primary-color);
}


/*
  ========================================
  MENU TOGGLE (HAMBURGER)
  ========================================
  Styles for the mobile navigation toggle button.
*/
#logo {
  font-family: monospace;
  font-size: calc(var(--font-size-base)*1.4);
  font-weight: var(--font-weight-bold);
  display: none;
}
.menu-toggle {
  /* Hide the hamburger button by default on larger (desktop) screens. */
  display: none !important;

  /* Basic button styling */
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;   /* remove the default padding*/

  /* Use flexbox to center the bars and manage their stacking */
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  width: 30px;
  height: 24px;
}

.menu-toggle .bar {
  /* Style each of the three bars */
  display: block; /* ensure span behave like block elements */
  width: 100%;
  height: 3px;
  background-color: var(--text-color);
  border-radius: 3px;

  /* We will add a transition here for a future animation when the menu is toggled. */
  transition: all 0.3s ease-in-out;
}


/*
  ========================================
  THEME SWITCHER
  ========================================
  Styles for the light/dark mode toggle switch.
*/

.theme-switcher {
  /* Aligns the switcher nicely with the navigation links */
  display: flex;
  align-items: center;
}

.switch-label {
  /* This makes the label the positioning container for the elements inside. */
  position: relative;
  display: inline-block;
  width: 50px;
  height: 26px;
  cursor: pointer;
}

.switch-checkbox {
  /* 
    This is a common accessibility-friendly technique to hide an element visually
    but keep it available to screen readers and the browser's form submission logic.
    We hide it because we're creating our own custom visual representation.
  */
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  /* This is the track of our switch. */
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  border-radius: 26px;
  transition: background-color 0.4s;
}

.slider::before {
  /* This pseudo-element is the "thumb" or the movable part of the switch. */
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: #fff;
  border-radius: 50%;
  transition: transform 0.4s;
}

/* 
  This is the magic! The :checked pseudo-class targets the input WHEN it is checked.
  The adjacent sibling combinator (+) selects the .slider that immediately follows it.
*/

.switch-checkbox:checked + .slider {
  /* When checked, we change the background of the track to our primary color. */
  background-color: var(--primary-color);
}

.switch-checkbox:checked + .slider::before {
  /* When checked, we move the thumb to the right using a transform. */
  transform: translateX(24px);
}

/*
  ========================================
  HERO SECTION
  ========================================
  Styles for the main introductory "hero" block of the page.
*/

#hero {
  /* 
    To make the hero section feel significant, we give it a minimum height.
    '90vh' means 90% of the viewport's height. This ensures it fills most
    of the screen on any device, creating an immersive first impression.
  */
  min-height: 90vh;

  /* 
    We use Flexbox again, this time for vertical centering.
    - 'display: flex' turns #hero into a flex container.
    - 'align-items: center' vertically centers its child (the .container) in the middle.
    - 'justify-content: center' horizontally centers the child.
  */
  display: flex;
  align-items: center;
  justify-content: center;

  padding: calc(var(--spacing-unit) * 2) 0;
}

#hero .container {
  /* 
    This centers the text *inside* our container. Flexbox centered the container
    itself, and text-align centers the content within it.
  */
  text-align: center;
}

#hero h1 {
  /* Make the main heading large and impactful. */
  font-size: 3.5rem; /* ~56px */
  font-weight: var(--font-weight-bold);
  margin-bottom: var(--spacing-unit); /* Add space below the heading */
}

#hero .hero-subtitle {
  /* Style the subtitle to be prominent but secondary to the main heading. */
  font-size: 1.5rem; /* ~24px */
  margin-bottom: calc(
    var(--spacing-unit) * 2
  ); /* Add more space below the subtitle */
  color: var(--text-color-light); /* Use our lighter text color variable */
  word-break: break-all;
}

#hero p:last-of-type {
  /*
    Constrain the width of the final introductory paragraph to ensure it
    remains easily readable on very wide screens.
  */
  max-width: 600px;
  /* margin: 0 auto; will center the paragraph block if its max-width is met. */
  margin: 0 auto;
}

/*
  ========================================
  ABOUT SECTION
  ========================================
  Styles for the "About Me" section, featuring a two-column layout.
*/

#about {
  /* Add significant vertical padding to give the section breathing room. */
  padding: calc(var(--spacing-unit) * 4) 0;
}

#about h2 {
  /* Center the section title and give it space from the content below. */
  text-align: center;
  margin-bottom: calc(var(--spacing-unit) * 3);
}

#about .container {
  margin: 0 80px;
}

.about-content {
  /* This is where the magic happens! We create our two-column layout here. */
  display: flex;

  /* Vertically align the image and the text block to their centers. */
  align-items: center;

  /* Create a sizable gap between the image column and the text column. */
  gap: calc(var(--spacing-unit) * 4);
}

.about-image {
  /* Define the width for the image column. flex: 1; would make it share space equally. */
  /* Here, we give it a fixed proportion of the layout. */
  flex: 1;
  max-width: 300px; /* Optional: cap the max size of the image container */
}

.about-image img {
  /* Make the image responsive, ensuring it never overflows its container. */
  max-width: 100%;

  /* This maintains the image's aspect ratio. */
  height: auto;

  /* A popular and modern design choice: make the profile picture a circle. */
  border-radius: 50%;

  /* Add a subtle shadow to make the image "pop" from the background. */
  box-shadow: 0 4px 15px var(--shadow-color);
}

.about-text {
  /* Let the text column take up more space. 'flex: 2;' makes it twice as wide as the image column. */
  flex: 2;
}

.about-text p {
  /* Add space between the paragraphs for better readability. */
  margin-bottom: var(--spacing-unit);
  word-break: break-all;
}

/* Remove the margin from the last paragraph to avoid extra space at the bottom. */
.about-text p:last-child {
  margin-bottom: 0;
}

/*
  ========================================
  PROJECTS SECTION
  ========================================
  Styles for the project showcase, including the individual project cards.
*/

#projects {
  /* Give the projects section ample breathing room from the 'About' section. */
  padding: calc(var(--spacing-unit) * 4) 0;
  /* Use our main background color, as the cards will have the surface color. */
  background-color: var(--background-color);
}

#projects h2 {
  /* Center the section title and give it space from the cards below. */
  text-align: center;
  margin-bottom: calc(var(--spacing-unit) * 3);
}

/* Projects Gallery using Grid*/

.projects-container {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: calc(var(--spacing-unit) * 2);
  margin: 0 80px;
}

/* === The Project Card Component === */

.project-card {
  /* Use the lighter --surface-color so the card stands out from the page background. */
  background-color: var(--surface-color);

  /* Add our consistent rounded corners and a subtle border. */
  border-radius: var(--border-radius);
  border: 1px solid var(--border-color);

  /* 
    This is the key to the card's "lifted" feel.
    box-shadow: [horizontal-offset] [vertical-offset] [blur-radius] [color];
    We use a small vertical offset, a soft blur, and our semi-transparent shadow color.
  */
  box-shadow: 0 4px 8px var(--shadow-color);

  /* 
    Crucial for design: This clips anything that tries to "spill out" of the card.
    This ensures that the sharp corners of our <img> are clipped to match the
    card's rounded corners.
  */
  overflow: hidden;

  /*transition for animate*/
  transition: box-shadow 0.3s ease-in-out, border-color 0.3s ease-in-out background-color 0.3s ease-in-out;
}

.project-image {
  /* Ensures the image is responsive and fills the width of the card. */
  width: 100%;

  /* 'display: block' removes any potential extra space below the image. */
  display: block;
}

.project-info {
  /* Use our spacing variable for consistent padding inside the card. */
  padding: calc(var(--spacing-unit) * 1.5);
}

.project-info h3 {
  /* Add space below the card's title. */
  margin-bottom: var(--spacing-unit);
}
.project-info p {
  word-break: break-all;
}

.project-links {
  /* We add padding to the link area as well. */
  padding: 0 calc(var(--spacing-unit) * 1.5) calc(var(--spacing-unit) * 1.5);
  display: flex;
  gap: var(--spacing-unit);
}

.project-links a {
  /* Style the links to look like buttons for a clear call to action. */
  display: inline-block;
  padding: 0.5rem 1rem;
  text-decoration: none;
  font-weight: var(--font-weight-bold);
  border-radius: var(--border-radius);

  /* Style for the primary link (e.g., Live Demo) */
  background-color: var(--primary-color);
  color: var(--surface-color);

  /* transition for animate*/
  transition: background-color 0.3s ease-in-out, color 0.3s ease-in-out;
}

.project-links a:hover {
  filter: brightness(90%)
}

/* A secondary style for the 'View Code' link to create visual hierarchy. */
.project-links a:last-child {
  background-color: transparent;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);

  /* transition for animate*/
  transition: background-color 0.3s ease-in-out, color 0.3s ease-in-out, border-color 0.3s ease-in-out;
}

.project-links a:last-child:hover {
  background-color: var(--primary-color);
  color: var(--surface-color);
  filter: none;   /* Reset filter for this specific hover state */
}

/*
  ========================================
  CONTACT SECTION
  ========================================
  Styles for the contact form, ensuring it's visually consistent
  with the rest of the site and provides a great user experience.
*/

#contact {
  /* Add padding to create vertical space around the section. */
  padding: calc(var(--spacing-unit) * 4) 0;
}

#contact .container > h2,
#contact .container > p {
  /* Center the section's introductory text. */
  text-align: center;
}

#contact .container > p {
  /* Add significant space between the intro text and the form itself. */
  margin-bottom: calc(var(--spacing-unit) * 3);
  /* Constrain the intro text width for readability on large screens. */
  max-width: 600px;
  /* Center the constrained paragraph block. */
  margin-left: auto;
  margin-right: auto;
}

/* === Form Element Styling === */

#contact form {
  /* Give the form a max-width to prevent it from becoming too wide on desktops. */
  max-width: 700px;
  /* Center the form within the container. */
  margin: 0 auto;
}

#contact label {
  /* Display labels as blocks to place them on their own line above the input. */
  display: block;
  /* Make labels bold to stand out. */
  font-weight: var(--font-weight-bold);
  /* Add a little space between the label and its input field. */
  margin-bottom: 0.5rem;
}

#contact input[type="text"],
#contact input[type="email"],
#contact textarea {
  /* Make all input fields take up the full width of the form container. */
  width: 100%;

  /* Use our variables for consistent padding. */
  padding: calc(var(--spacing-unit) * 0.75);

  /* Add space between each form field. */
  margin-bottom: calc(var(--spacing-unit) * 1.5);

  /* Apply our consistent border style and color. */
  border: 1px solid var(--border-color);
  border-radius: var(--border-radius);

  /* Use our theme's surface color for the background. */
  background-color: var(--surface-color);

  /* Form elements do not always inherit font properties, so we set them explicitly. */
  font-family: inherit;
  font-size: inherit;
  color: var(--text-color);

  /* Add a smooth transition for when the fields get focus. */
  transition:
    border-color 0.2s ease-in-out,
    box-shadow 0.2s ease-in-out,
    background-color 0.3s ease-in-out,
    color 0.3s ease-in-out
}

/* A useful tweak for the textarea: allow vertical resizing but not horizontal, which can break layouts. */
#contact textarea {
  resize: vertical;
  min-height: 150px;
}

/*
  The :focus pseudo-class is CRUCIAL for accessibility and user experience.
  It provides a clear visual indicator of which field the user is currently editing.
*/
#contact input[type="text"]:focus,
#contact input[type="email"]:focus,
#contact textarea:focus {
  /* Remove the browser's default, often ugly, focus outline. */
  outline: none;

  /* Change the border color to our primary brand color. */
  border-color: var(--primary-color);

  /* Add a subtle "glow" effect (box-shadow) to make the active field pop. */
  box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
}

#contact button[type="submit"] {
  /* Make the button a block element to fill the form's width. */
  display: block;
  width: 100%;

  /* Use our spacing variables for consistent padding. */
  padding: var(--spacing-unit);

  /* Remove the default browser border. */
  border: none;
  border-radius: var(--border-radius);

  /* Style it as a primary action button, just like in our project cards. */
  background-color: var(--primary-color);
  color: var(--surface-color);

  /* Increase font size and weight for emphasis. */
  font-size: 1.1rem;
  font-weight: var(--font-weight-bold);

  /* Change the cursor to a pointer on hover to indicate it's clickable. */
  cursor: pointer;

  /* Add a smooth transition for the hover effect. */
  transition: filter 0.2s ease-in-out, background-color 0.3s ease-in-out;
}

#contact button[type="submit"]:hover {
  /* The filter property is a modern way to change appearance. brightness(90%) slightly darkens the element. */
  filter: brightness(90%);
}

/* Form Status Messages */
#form-status {
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
  border-radius: var(--border-radius);
  text-align: center;
  font-weight: var(--font-weight-medium);

  /* Hide the container by default. */
  display: none;

  /* Add a smooth transition for opacity and transform. */
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s ease-in-out, transform 0.3s ease-in-out;
}

/* Success State Styling */
#form-status.success {
  display: block;  /* make the element visible*/
  opacity: 1; 
  transform: translateY(0);  /* Slide it down to its final position */
  background-color: #d1e7dd;
  color: #0f5132;
  border: 1px solid #badbcc;
}

/* Error State Styling */
#form-status.error {
  display: block;
  opacity: 1;
  transform: translateY(0);
  background-color: #f8d7da;
  color: #842029;
  border: 1px solid #f5c2c7;
}

/* Dark Theme Adjustments for Status Messages */
html[data-theme='dark'] #form-status.success {
  background-color: #0f5132;
  color:  #d1e7dd;
  border-color: #146c43;
}

html[data-theme='dark'] #form-status.error {
  background-color: #842029;
  color:  #f8d7da;
  border-color: #9b2a34;
}

/*
  ========================================
  FOOTER SECTION
  ========================================
  Styles for the final site footer, ensuring it's a clean and
  professional closing for the page.
*/

footer {
  /* Use the surface color for the footer background, similar to the header. */
  background-color: var(--surface-color);
  
  /* Use our spacing variable for consistent vertical padding. */
  padding: calc(var(--spacing-unit) * 2) 0;
  
  /* Add a subtle top border to visually separate the footer from the content above. */
  border-top: 1px solid var(--border-color);
  
  /* Ensure the text color is set correctly, especially for the copyright notice. */
  color: var(--text-color-light);
  
  /* Center the text within the footer by default. This will apply to the <p> tag. */
  text-align: center;

  /*transition for animate*/
  transition: color 0.3s ease-in-out, background-color 0.3s ease-in-out, border-top-color 0.3s ease-in-out;
}

/* 
  We target the .container inside the footer to apply our Flexbox layout.
  This ensures our footer content aligns with the main content of the page.
*/
footer .container {
  display: flex;
  
  /*
    This powerful property distributes space between flex items.
    'space-between' pushes the first item (the <p>) to the start (left)
    and the last item (the <ul>) to the end (right).
  */
  justify-content: space-between;
  
  /*
    This property aligns items along the cross-axis (vertically). 'center'
    ensures the copyright text and the social media links are perfectly
    aligned on their horizontal midline.
  */
  align-items: center;

  /* We'll also apply the standard container behavior here. */
  max-width: var(--container-width);
  margin: 0 auto; /* Centers the container horizontally */
  padding: 0 var(--spacing-unit); /* Adds padding on the sides for smaller screens */
}

/* 
  Now we style the list of social media links.
*/
footer ul {
  /* This is a great example of NESTED FLEXBOX. We make the <ul> a flex container
     as well, to arrange its children (the <li> items) in a row. */
  display: flex;
  
  /* The gap property adds a consistent space between each of the social media links. */
  gap: var(--spacing-unit);
  
  /* This is crucial to remove the default bullet points from the list. */
  list-style: none;
}

/*
  Finally, we style the social media links themselves.
*/
footer ul li a {
  /* Remove the default underline from links. */
  text-decoration: none;
  
  /* Use our theme's text color. */
  color: var(--text-color-light);
  
  /* Add a smooth transition for the hover effect. */
  transition: color 0.2s ease-in-out;
}

/*
  A hover effect provides important visual feedback to the user,
  letting them know an element is interactive.
*/
footer ul li a:hover {
  /* Change the link color to our primary brand color on hover. */
  color: var(--primary-color);
}


/*
  ========================================
  RESPONSIVE STYLES - MEDIA QUERIES
  ========================================
  We'll place all our responsive adjustments at the end of the stylesheet.
  This ensures they correctly override the default desktop styles due to the
  nature of the CSS cascade.
*/

/* 
  Breakpoint 1: Tablet Devices
  This media query targets screen sizes up to 768px wide. This is a common
  breakpoint for devices like iPads in portrait mode.
*/

@media (max-width: 768px) {
  /* === Typography Adjustments === */
  /* Reduce the size of the main hero heading to prevent it from being overwhelming on smaller screens. */
  #hero h1 {
    font-size: 2.8rem;  /* Down from 3.5rem */
  }

  /* Also reduce the size of the hero subtitle for better balance. */
  #hero .hero-subtitle {
    font-size: 1.25rem;   /* Down from 1.5rem*/
  }

  /* === Layout Adjustments === */
  
  /* 
    The 'About Me' section: On tablets, the side-by-side layout can feel
    cramped. Stacking the image and text vertically creates a better
    reading flow on a narrower screen.
  */
  .about-content {
    /* Change the flex-direction from the default 'row' to 'column'. */
    flex-direction: column;

    /* Increase the gap to provide vertical space between the stacked items. */
    gap: calc(var(--spacing-unit) * 3);
  }

  /* Ensure the about image doesn't look too small when stacked. */
  .about-image {
    max-width: 250px;
    margin: 0 auto;  /* Center the image container */
  }

  /* Spacing Adjustments */
  #about .container {
  margin: 0 40px;
  }

  .projects-container {
  margin: 0 40px;
  }

  /* 
    The 'Projects' section grid: We switch from a 3-column grid to a 2-column grid.
    This gives each project card more horizontal space, making them larger,
    more prominent, and easier to tap on a touch device.
  */
  .projects-container {
    grid-template-columns: repeat(2, 1fr);
  }

  /* === Header Adjustments for Tablets === */
  header nav {
    display: none;
  }

  /* Show the menu-toggle button. from 'none' to 'flex' */
  .menu-toggle {
    display: flex !important;
  }
  #logo {
    display: block;
  }
}

/* 
  Breakpoint 2: Mobile Devices
  This media query targets screen sizes up to 480px wide. This is a standard breakpoint for most mobile phones in portrait orientation.
*/
@media (max-width: 480px) {
  /* === Layout Adjustments === */
  .projects-container {
    grid-template-columns: repeat(1, 1fr);
  }

  /* header .container {
    flex-direction: column;
    gap: var(--spacing-unit);
  } */

  /* === Typography Adjustments === */
  #hero h1 {
    font-size: 2.2rem;  /* Down from 2.8rem on tablet */
  }

  #hero .hero-subtitle {
    font-size: 1.1rem;  /* Down from 1.25rem on tablet */
  }

  /* === Spacing Adjustments === */
  #hero p:last-of-type {
  /* word-spacing: 2px; */
  margin: 0 6px;
}

  #about .container {
  margin: 0 20px;
  }

  #about, #projects, #contact {
    padding: calc(var(--spacing-unit)*2) 0;
  }

  .projects-container {
  margin: 0 20px;
  }

  

  /* Usability and Tappability Refinements */
  /*
    Enhance the hamburger menu's tappable area. The icon itself is small,
    but adding padding increases the clickable zone around it without
    changing the icon's size. This is a crucial mobile UX improvement.
  */
  /* Adds 8px of tappable space on all sides */
  /* .menu-toggle {
    padding: 0.5rem; 
  } */

  /*
    Increase the size of the project buttons to make them more prominent
    and easier to tap on a touch screen.
  */
  .project-links a {
    padding: 0.75rem 1.25rem; /* Increased from 0.5rem 1rem */
    font-size: 1rem; /* Ensure font size is consistently readable */
  }

  #contact form {
    margin: 0 20px;
  }

  /*
    Increase the tappable area and spacing of footer social media links.
    This prevents users from accidentally tapping the wrong link.
  */
  footer ul {
    gap: calc(var(--spacing-unit)*1.5);  /* Increase the space between links */
  }

  footer ul li a {
    padding: 0.4rem;  /* Add padding to create a larger tap target */
  }

  /* .project-info p{
  word-break: break-all;
  } */

  footer {
    padding: 16px 0;
  }
  footer .container {
    display: flex;
    flex-direction: column;
    gap: calc(var(--spacing-unit));
  }

  footer .container :nth-child(1) {
    order: 2;
  }

  footer .container :nth-child(2) {
    order: 1;
  }
}