body {
    font-family: Arial, sans-serif;
    padding: 1.25rem;
    color: #222;
    background-color: #f4f2ed;
    }

    .skip-link {
        /* Places the link above the screen until it receives keyboard focus. 
        position: absolute; lets us place the skip link using top and left, without taking up space in the normal page layout.
         */
        position: absolute;
        top: -5rem;
        left: 1rem;
        
        /* Makes the link readable and keeps it visible above other content */
        padding: 0.75rem 1rem;
        background-color: white;
        color: #222;
        border: 2px solid #222;
        
        /* Controls the stacking order where elements overlap. Higher numbers appear in front of lower numbers within the same stacking context. 10 is a chosen value to keep the skip link above the other content. Works here because the link uses position: absolute. 
        position: absolute; lets us place the skip link using top and left, without taking up space in the normal page layout.
        z-index: 10; controls whether it appears in front of other content when they overlap.
        So, position lets us move it above the screen and bring it back on focus. z-index helps keep it visible when it comes back.
        Absolute positioning alone doesn’t guarantee it will appear in front. */
        z-index: 10;
    }

    .skip-link:focus {
        /* Shows the link when a keyboard user tabs to it. */
        top: 1rem;
    }

    /* Gives ordinary links a chosen colour instead of browser blue. */
    a {
        color: #005655;
        text-decoration: underline;
    }

    /* Uses a muted brown for links to previously visited pages. */
    a:visited {
        color: rgb(76, 0, 134);
    }

      /* Makes the underline thicker when the mouse is over a link. */
      a:hover {
        color: #008d52;
        text-decoration-thickness: 3px;
      }




    /* Selects the shared parent with class="page-layout". 
    The dot in .page-layout means select an element with this class.*/
    .page-layout {
        /* Flexbox arranges the child elements in a row.  */
        display: flex;

        /* Adds space between the child elements. */
        gap: 1.25rem;
        /*  I applied Flexbox to the parent element to arrange the header and main beside each other. */
       }


        .sidebar {
            /* In order: do not grow, do not shrink, set initial width, start at 11.25rem. */
            flex: 0 0 11.25rem;
        }
        .main-content {
            /* Grow to fill the remaining space. */
            flex: 1;
            Display: flex;
            /*  I applied Flexbox to the main content area to allow its child elements to be arranged in a column. */
            gap: 1.25rem;
            flex-direction: column;
            /* Allow this column to become narrower than it's content's default minimum width. */
            min-width: 0;
            /* Lets the main column shrink when space is limited. */
            
        }
        /*  I applied Flexbox to the parent element to arrange the header and main beside each other. */
        /*  The sidebar is set to a fixed width, while the main content area is set to grow and fill the remaining space. */
        
        .main-menu {
            /* Flexbox arranges the child elements in a row.  */
            display: flex;
            /* Adds space between the child elements. */
            gap: 0.5rem;
            /* Stacks those items from top to bottom */
            flex-direction: column;
            /*  I applied Flexbox to the menu parent and used column to stack its heading and links vertically. */
        }
        .main-menu a {
            /* Adds padding around the link text. */
            padding: 0.75rem;
            /*Adds a thin, solid border around the link. */
            border: 1px solid #c6cfca;
            /* Rounds the corners of the border. */
            border-radius: 0.35rem;
            background-color: white;  
            color: #222;
            /* Removes the underline from the link text. */
            text-decoration: none;
        }
        /* selects the h2 heading inside the main-menu class. */
        .main-menu h2 {
            /* Removes the default margin around the heading. */
            margin: 0;

            /* Sets the heading's font size to 1.25rem. */
            font-size: 1.25rem;

            /* Centers the heading text horizontally within its container. */
            text-align: center;
        }

            /*  this rule styles only the h2 headings inside the main menu. I removed the default margin around the heading, set its font size to 1.25rem, and centered the text horizontally. */

            /* Selects the menu link marked aria-current="page" to indicate the current page. The square brackets mean select an element with this attribute and value. */
            .main-menu a[aria-current="page"] {
                /* Changes the background color of the current page link to a darker shade. */
                background-color: #fff;

                /* Changes the text color of the current page link. */
                color: #433500;
                /* Makes the text of the current page link bold with border. */     
                font-weight: bold;
                border: 2px solid #6f3b00;
            }

        /* Highlights a link when someone reaches it using the keyboard. */
        a:focus-visible {
            /* Adds a visible outline around the focused link for accessibility. */
            outline: 3px solid #222;

            /* Adds a slight offset to the outline to prevent it from overlapping the link text. */
            outline-offset: 2px;    
        }

        /* Underlines a menu link while the mouse hovers over it. */
        .main-menu a:hover {
            /* Adds an underline to the link text when hovered. */
            text-decoration: underline;
            text-decoration-thickness: 4px;
            text-decoration-color: #a09a94;
            text-underline-offset: 3px;
        }
        /*  I added a hover effect to the menu links to provide visual feedback when users interact with them. */
        /* Shared appearance for any element with the class="box". */
        .box {  
            /* Adds padding inside the box for spacing. */
            padding: 1.25rem;

            /* Adds a thin, solid border around the box. */
            border: 1px solid #c6cfca;

            /* Rounds the corners of the box. */
            border-radius: 0.3125rem;

            /* Sets the background color of the box to a light shade. */
            background-color: white;
        }
        /*  I created a shared class, I can reuse, called "box" to style elements with a consistent appearance, including padding, border, rounded corners, and background color. */

    .shoe-row {
        /* Flexbox arranges the child elements in a row.  */
        display: flex;

        /* Adds space between the child elements. */
        gap: 1.25rem;

        /* Allows the row to wrap onto multiple lines if needed. */
        flex-wrap: wrap;

        /* Centres the cards in each row, including a lone wrapped card. */
        justify-content: center;
    }

    /*Gives each shoe card the ability to grow and shrink within the row, while also setting a minimum width to prevent them from becoming too small. Gives each shoe card equal space to fill the available width. */

    .shoe-card {
        /* Shares the available space equally among all shoe cards. */
        /* flex: 1; */

        /* Changed from flex: 1 to flex: 1 1 12rem so cards wrap before becoming too narrow and overlapping prices. */
        /* Changed it to 0 grow so it allows shrinking and wrapping, but prevents a lone card growing wider, although lone card does sit the left side, not centered. Adding justify-content to .shoe-row to centre it. The shoes now appear smaller, don't grow and sit more in the middle of the space together. I made it 16rem so shoes are a bit bigger */
        flex: 0 1 16rem;
        min-width: 0;

        /* Adds space inside each card and a border around it for visual separation. Padding creates space inside each card. The gap on shoe-row creates space between the cards */ 
        /* padding: 1rem; */
        /* Smaller top padding; keeps the other sides unchanged. */ 
        padding: 0.25rem 1rem 1rem;
    }
    /* Selects images inside the shoe-card class. */
    .shoe-card img {
        /* Makes the image fill the width of its container while maintaining its aspect ratio. */
        width: 100%;

        /* Ensures the image height adjusts automatically to maintain its aspect ratio. */
        height: auto;

        /* Stops shoe images becoming too large when a card wraps and grows to fill the extra space on the next row. note: didn't seem to work */
        min-width: 16rem;

        /* Removes the small baseline space below the image that can cause layout issues. */  
        display: block;

        /* Sets a fixed aspect ratio for the image, ensuring it maintains a 4:3 width-to-height ratio. */
        /* aspect-ratio: 4 / 3; */
        /* Makes the image area wider and shorter. */
        aspect-ratio: 16 / 9;

        /* Ensures the entire image is visible within its container without cropping, while maintaining its aspect ratio.  */
        /* Aspect-ratio and object-fit are used together to create a consistent image size and shape for all shoe cards, regardless of the original image dimensions. */
        object-fit: contain;  
    }
    .logo-link {
        /* block makes the link a block element, allowing it to take up the full width of its container. */
        display: block;
        /* Adds space below the logo link to separate it from other elements. */
        margin-bottom: 1rem;
    }
    .logo-link img {
        /* Sets relative width fo the logo image. 100% makes it fill the width of its container. */
        width: 100%;

        /* Ensures the logo height adjusts automatically to maintain its aspect ratio.Preserves the image's original proportions. */    
        height: auto;

        /* Removes the baseline gap below an inline image. */  
        display: block;
        /* The logo is inside a link so visitors can click it to return home. width: 100% fits it to the sidebar, and height: auto preserves its proportions.
         The link controls the spacing below the logo. The image rule controls its size and proportions.
          HTML makes the logo a link to Home.
         CSS gives that link space below it and makes the image fit inside it. */
    }

    .banner img {
        /* Makes the banner image fill the width of its container while maintaining its aspect ratio. */
        width: 100%;

        /* Ensures the banner image height adjusts automatically to maintain its aspect ratio. */
        height: auto;

        /* Removes the small baseline space below the image that can cause layout issues. */  
        display: block;

        /*Limits its width on larger screens. */
        max-width: 25rem;

        /* The photograph fits the banner on narrow screens, but max-width stops it becoming too large on wider screens.*/  
    }

    .social-links {
        /* Flexbox arranges the child elements in a row.  */
        display: flex;

        /* Adds space between the child elements. */
        gap: 1rem;
        margin-top: 1rem;

        /* Centers the social links horizontally within their container. */
        justify-content: center;
    }
    .social-links img {
        /* Sets a fixed width for the social media icons. */
        width: 2rem;

        /* Ensures the icon height adjusts automatically to maintain its aspect ratio. */
        height: auto;

        /* Removes the small baseline space below the image that can cause layout issues. */  
        display: block;

        /* Each icon is inside a link. Its alt text gives the link a name that screen readers can announce. The link's href points to the social media page. The image inside the link is sized to 2rem wide, and height: auto preserves its proportions. */
    }

    .site-footer {
        /* Adds space above the footer to separate it from the main content. */
        margin-top: 1.25rem;

        /* Adds padding inside the footer for spacing. */
        padding: 1rem;

        /* Adds a thin, solid border at the top of the footer for visual separation. */
        border-top: 1px solid #c6cfca;

        /* Sets the background color of the footer to a light shade. */
        background-color: #fdfdfc;
    }

    .social-links a {
        background-color:#422d2d;
        padding: 0.3rem;
        border-radius: 0.3125rem;
        /* I added a background color, padding, and border radius to the social links container to make it visually distinct and improve its appearance. */
    }

    .site-footer nav {
        /* Flexbox arranges the child elements in a row.  */
        display: flex;

        /* Adds space between the child elements. */
        gap: 1rem;

        /* Centers the navigation links horizontally within the footer. */
        justify-content: center;

        flex-wrap: wrap;
        /* Allows the navigation links to wrap onto multiple lines if needed. */
        /* I used gap to separate the footer links and flex-wrap so they can fit on narrower screens.*/
    }

    .site-footer p {
        /* Separates the copyright text from the navigation links. */
        margin-top: 1.5rem;
        /* Removes extra space below the copyright text. */ 
        margin-bottom: 0;
        /* Centers the copyright text horizontally within the footer. */
        text-align: center;
    }
    .banner {
        /* Flexbox arranges the child elements in a row.  */
        display: flex;

        /* Adds space between the child elements. */
        gap: 1.25rem;

        /* Allows the banner content to wrap onto multiple lines if needed. */
        flex-wrap: wrap;

        /* Centers the banner content horizontally within its container. */
        /* justify-content: center; */

        /* Aligns the banner content vertically in the center of the container. */
        align-items: center;
    }
    .banner .walking-image {
        /* Sets a fixed width for the walking image. */
        width: 100%;

        /* Ensures the walking image height adjusts automatically to maintain its aspect ratio. */
        height: auto;

        /* Removes the small baseline space below the image that can cause layout issues. */  
        display: block;

        /* Removes the earlier banner image max-width rule so it can grow larger than 25rem on wider screens. */
        max-width: none;
    }

    .banner-content {
        /* Uses the remaining space in the banner for the content. */
        flex: 1;
        min-width: 0;
    }

    /* Gives the left group in the banner more of the available width */
    .banner-lifestyle {
        flex: 75;
    }

    /* Gives the right group in the banner a smaller share */
    .banner-product {
        flex: 25;
        /* Adds space above Gary's image, heading and description so that it aligns more with the bottom edge of the lifestyle image */
        padding-top: 4rem;
    }

    .welcome {
        /* Reduces the space inside the Welcome box */
        padding: 0.75rem 1rem
    }
    .welcome p {
        /* Removes the paragraph's default outer spacing. */
        margin: 0;
    }
    .welcome h1 {
        /* Makes the heading smaller and removes its top margin. */
        font-size: 1.5rem;
        margin: 0 0 0.5rem;
    }
    .featured h2 {
        /* Removes the heading's default space above it. */
        margin-top: 0;

        /* Keeps a small gap between the heading and the cards */
        margin-bottom: 0.75rem;
    }

    .button-link {
        /* Allows padding around the link while keeping it inline*/
        display: inline-block;
        padding: 0.75rem 1.25rem;

        /* background-color: #222;
        color: #fff; */
        /* White background with the dark text and border. */
        background-color: #fff;
        color: #222;
        border: 1px solid #222;
        border-radius: 0.3125rem;

        /* Removes the usual link underline. */
        text-decoration: none;
    }
    .products-link {
        /* Centres the button inside it's paragraph. .products-link centres the paragraph’s contents; .button-link styles the link.*/
        text-align: center;
    }

    .gary-images {
        /* Aligns Gary's shoe cards to the left, above the product information. */
        justify-content: flex-start;
    }

    /* Applies when the viewport is 50rem, 50rem x 16px = 800px, or narrower. */
    @media (max-width: 50rem) {
        .page-layout {
            /* Places the header above the main content. */

            flex-direction: column;
        }

        .logo-link {
            /* Grow Shrink Flex basis. Gives the logo a smaller width and removes its bottom gap. */
            flex: 0 0 6rem;
            margin-bottom: 0;
        }

        .main-menu {
            /* Uses the space beside the logo. */
            flex: 1;
            min-width: 0;
            display: flex;

            /* Arranges links in rows that can wrap when needed. */
            flex-direction: row;
            flex-wrap: wrap;
            gap: 0.75rem;
            align-items: center;
        }

        .main-menu h2 {
            /* Hides the visible Main Menu heading in mobile view. */
            display: none;
        }

        .main-menu a {
            /* Makes the links look like the text instead of buttons. */
            background-color: transparent;
            border: none;
            padding: 0;
            color: #222;
            align-self: center;


        }

        .main-menu a[aria-current="page"] {
            /* Marks the current page with bold text instead of a dark button. */
            background-color: transparent;
            color: #543f00;
            font-weight: bold;
            border: 1px solid #958a19;

            /* Adds space inside the border: top/bottom, then left/right. */
            padding: 0.25rem 0.4rem;
        }
        .sidebar {
            /* Removes the sidebar's fixed flex basis. */
            flex: auto;

            /* Arranges the logo and menu beside each other. */
            display: flex;
            flex-direction: row;
            align-items: center;
            gap: 1rem;
        }
        .logo-link img {
            /* Keeps the logo from becoming too large. */
            max-width: 12rem;
        }

        .banner {
            /* Stacks the walking section above the Gary section. */
            flex-direction: column;
            align-items: stretch;
        }

        .banner-product {
            /* Removes the extra space above Gary used in the desktop. */
            padding-top: -0;
        }



        .banner-lifestyle,
        .banner-product {
            /* Removes the desktop proportions when stacked. */
            flex: auto;
        }

        /* .shoe-card { */
            /* I tried this so on a tablet widths keep cards at half width so the third one doesn't stretch full width when it wraps, but it just made all the cards smaller and to the left. */
            /* flex: 1 1 calc(50% - 0.7rem); */
            /* max-width: calc(50% - 0.7rem); */
        /* } */

        
    }


    @media (max-width: 30rem) {

        .shoe-row {
            /* Stacks the shoe cards on screens 480px wide or narrower */
            flex-direction: column;
            flex-wrap: nowrap;
        }

        .shoe-card {

            /* By default a flex container is nowrap, but I earlier set .shoe-row to flex-wrap: wrap so the cards can drop to new lines on narrower screens.*/ 
            /*flex-wrap: nowrap forces the three cards to stay in a single vertical column. Combined with flex: none on each card, they simply stack one under the other and cannot grow, shrink, or wrap beside each other. */

            /* Uses the content's height and prevents the card from shrinking. */
            flex: none;

            /* Lets the card grow tall enough for its image and price. */
            height: auto;
            min-height: min-content;
        }   

        }
