/* apart from me creating code myself, I used course notes and Murach's HTML & CSS 6th edition as a baseline for help */
:root {
  --main-color: #02271E;
}

html {
  background: rgb(217, 244, 217);
}

body {
  width: min(95%, 1300px);
  margin: auto;
}

header {
  display: flex; /* float only has left/right, flexbox used to centre logo */
  flex-direction: column; 
  align-items: center;    /* Centers horizontally in the column*/
  padding-top: 1em;
  border-bottom: 2px solid var(--main-color);
  padding-bottom: 1em;
}

#header-logo {
  width:25%;
  & img {
    width:100%;
    height: auto;
  }
}

header p {
  font-size: 2em; /* want We h1 to be visible in SEO not this*/
  font-weight: bold; 
}
#mobilemenu {
  display: none;
}
#nav_menu {
  background-color: var(--main-color);
  padding: 0.25em;  /*stops white block touching edges of nav bar on hovering, padding relevant to font size*/
  border-radius: 10px;

  & ul { 
    display:flex; /*see note below about how submenu display is overriden by using class*/
    list-style-type: none;
    gap: 1em;
    margin: 0;
    padding: 0;
   }
  & a {
    text-decoration: none;
    color:white;
    display: block;
    padding: 0.5em;
    border-radius: 10px;
  }
  & a:hover , & a:focus {
    background-color: white;
    color: var(--main-color); 
    & .star {
      color:var(--main-color);
    }
  }
  & .star {
    color: yellow;
  }

  li:has(.submenu) {
    position: relative;
    & small {   /*some space for the down arrow*/
      margin-left: .25em;
    }
    &:hover > .submenu, &:focus-within > .submenu { /*focus-within allows keyboard users to access submenus using the Tab key. found this gem on https://css-tricks.com/solved-with-css-dropdown-menus/ */
      display: block;
    }
  }
  .submenu {
    display: none;  /*class is more specific than nav ul, so it will override the nav ul styles */
    position: absolute; 
    white-space: nowrap;  /* got this from https://generatepress.com/forums/topic/submenu-auto-width/ */
    top: 100%;
    left: 0;
    background-color: var(--main-color);
    padding: 0.5em;
    border-radius: 10px;
  }
}

.main-body {
  display: flex;
  padding: 1em 2.5%;
  gap: 5%;
}

#product-phone {
  font-size: 160%;
}

main {
  flex-basis: 57.5%;
  padding: 1em 2.5%;
}

aside {
  flex-basis: 27.5%;
  background-color: var(--main-color);
  padding: 1em 2.5%;
  border-radius: 10px;
  color: #e6e6fa;

  & a {
    color: #f56506; /* assignment says mint green or orange, chosen orange as more distinguishable from cyan */
    text-decoration: none;
  }

  & a:visited{
    color: violet;
  } 

  & a:hover , & a:focus {
    color: cyan;
  }
}
figure {
  border: 1px var(--main-color);
  width: 100;
  padding:1 em;
}
figcaption {
  display: block;
  font-weight: bold;
  text-align: center;
  font-size: 160%;
  padding-bottom: .5em;
}
table {
  margin: .5em auto;
  border-collapse: collapse;
}
th {
  border: 1px solid var(--main-color);
  background-color: var(--main-color);
  color: white;
  padding: 0.5em;
  &:nth-child(1), &:nth-child(2) {
    border-right-color: white;
  }
}
td {
  border: 1px solid var(--main-color);
  padding: 0.5em;
  text-align: left;
}
td:nth-child(3) {
  text-align: right;
}


footer {
  text-align: center;
  background-color: var(--main-color); /* lavender as a requirement text, on webAIM this background is  13.01:1 as a pass AAA */
  padding: 1em 2.5%;
  border-radius: 10px;
}

footer p {
  color: lavender;
  font-size: 0.8em;
  font-weight: bold; /* easier to read */
}

@media only screen and (max-width: 950px) {
  body {
    font-size: 85%;
  }
}

@media only screen and (max-width: 700px){
  #header-logo {
    width: 50%;
  }
  #nav_menu {
    display: none;
  }
  #mobilemenu {
    display: block;
    & li small {
      display: none;  /* hides down arrow on mobile menu */
    }
    & .star {
      color: yellow;
    }

    /*
    Once I got slicknav running I noticed that slicknav seems to have its own css, with its own classes,
    so I had to create css for classes inside slicknav that I was not familiar with. I was stuck when it 
    came to how to modify these classes so I asked Claude AI to guide me, but as a tutor; not creating code 
    for me. It helped me to learn how to use Developer mode to find which classes to modify using the element 
    selector. It was quite useful and I learnt a new skill, and now I can fully see how useful Developer mode 
    is in a browser, not just for changing screen sizes. Then I could write and test the CSS myself. I learnt the 
    importance of still formatting css for small screens even in mobile view; when the user zooms into the 
    screen on a desktop view, the page width in css pixels decreases and it triggers the @media query 
    for a smaller screen size. So the user would still be using a mouse, not a touch screen.
    I did find the documentation for slicknav a bit lacking and vague, which made me appreciate how important 
    it is to document code properly.
    Given the choice, I would have probably preferred using the navigation menu
    on Murach HTML and CSS 6th edition on pages 256-265 instead of slicknav, but slicknav was a requirement
    for the assignment. 
    */
    & .slicknav_nav {
      & a:hover, & a:focus {
        color: var(--main-color);
        background-color: white;
        & .star {
          color: var(--main-color);
        }
      }
    }
    & .slicknav_menu {
      background-color: var(--main-color);
      border-radius: 10px;
    }
    & .slicknav_btn {
      background-color: var(--main-color);
      border-radius: 10px;
      &:hover, &:focus {
        background-color: white;
        & .slicknav_menutxt {
          color: var(--main-color);
        }
        & .slicknav_icon-bar {
          background-color: var(--main-color);
        }
      }
    }
    & .slicknav_item.slicknav_row {   /*changing the background colours and link text on hover/focus same as desktop site. This took a lot of hit and miss and Developer mode investigation, and finally sorted again by focus-within*/
      &:hover , &:focus-within {
        color: var(--main-color);
        background-color: white;
        & a {
          color: var(--main-color);
        }
      }
    } 
  }
  .main-body {
    flex-direction: column;
  }
}
