/* Navigation  
- I'm thinking to extract general styles that's specific for the navigation
  - Padding,borders margins if needed, 
  - color I would put in general.css as main color looks like it will be blue
  - Do I specifically set font family for the navigation?
  - I always thinking about do I use utility or just mix display flex
    in block of elements, it feels like I'm mixing concern's
*/

:root {
  /* --main-color:  */
  --brand-main-color: hsl(217, 90%, 72%);
}

body {
  background-color: var(--main-bg-color);
}

nav {
  color: var(--brand-white);
  background: var(--brand-main-color);
  padding: 0.5em;
  font-family: 'Poppins', sans-serif;
  font-size: var(--font-size-sm);
  line-height: 1.3; /* computed value of font size * 1.3 is the value o line height */
}

nav,
.right,
.personal {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

nav .personal__avatar {
  max-width: 2rem;
  border-radius: 50%;
}

nav .links li {
  list-style: none; /*why this is not reset? */
}

/* 
  I tried to micro manage each section with this gutter, then I 
  remembered css is override first language
  * has low specificity and is easier to override, also is most general 
  way of saying "I want space between elements"
*/
nav .right * + * {
  --links-gutter: 0.5em;
  margin-left: var(--links-gutter);
}

nav .links a {
  color: inherit;
  text-decoration: none;
}

nav .links a:hover {
  text-decoration: underline;
}

.left,
.links,
.personal {
  display: flex;
}

.tile {
  background-color: var(--tile-color);
  padding: var(--tile-padding);
  box-shadow: 0 0.1em 0.2em rgba(0, 0, 0, 0.1);
}

main > * + *,
nav + div {
  margin-top: var(--default-gap);
}

.with-sidebar aside {
  font-size: var(--font-size-xs);
}

/* Sidebar */
.with-sidebar {
  resize: both;
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  gap: var(--default-gap);
}

.with-sidebar > :first-child {
  flex: 45ch;
  align-self: flex-start;
}

.with-sidebar > :last-child {
  flex: 999;
  min-width: 60%;
}

.sidebar-links {
  --threshold: 60ch;
  font-size: var(--font-size-sm);
  color: var(--brand-white);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em;
}

.sidebar-links li {
  margin-left: calc(var(--tile-padding) * -1);
  flex-basis: calc((var(--threshold) - 100%) * 999);
  white-space: nowrap;
}

.sidebar-links li a {
  color: hsl(0deg 0% 76%);
  text-decoration: none;
  border-radius: 0 20px 20px 0;
  padding-left: var(--tile-padding);
  padding-top: 0.5em;
  padding-bottom: 0.5em;
  display: block;
}

.sidebar-links li a:hover {
  color: var(--brand-main-color);
  background-color: hsl(213deg 60% 97%);
}

.top-section__header {
  display: flex;
  margin: 0;
  align-items: center;
  justify-content: space-between;
}

.top-section__header .filter {
  font-size: var(--font-size-xs);
}

.top-seller img {
  border-radius: 50%;
  width: 60px;
  height: 60px; /* why aspect get's messed up if there is no height?*/
}

.top-section__body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1em;
}

.top-section__body .top-seller {
  display: flex;
  gap: 0.5em;
}

.top-seller__img {
  flex-shrink: 0;
}

.top-section__body-text {
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  line-height: 1.2;
}

.top-section__body-text .price {
  font-size: 0.8em;
}

header h4 {
  color: var(--brand-main-color);
}

.top-section .section-body {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 1rem;
}

.top-section .section-body article {
  display: flex;
  gap: 1rem;
}

.top-section .article-image {
  flex-shrink: 0;
}

.top-section .article-image img {
  width: 200px;
  aspect-ratio: 1.33;
  object-fit: cover;
  object-position: center center;
  border-radius: 10px;
}

.search {
  --around-gap: 0.5em;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 1rem;
}

.search-button {
  background-color: var(--brand-main-color);
  color: var(--brand-white);
  border-radius: 200px;
  padding: var(--around-gap);
  min-width: 15ch;
  font-size: var(--font-size-sm);
}

.search-button:hover {
  color: hsl(0 0% 90% / 1);
}

.search-input {
  flex: auto;
  padding-block: var(--around-gap);
  padding-inline: 1rem;
  font-size: var(--font-size-sm);
  border: 1px solid #ccc;
  border-radius: 100px;
  background-color: var(--brand-white);
  color: #999;
  min-width: 20ch;
}

.search-input:focus {
  outline: 2px solid var(--brand-main-color);
}

.last-section .section-body {
  --break-when: 550px;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.last-section .section-body article {
  flex: 1;
  flex-basis: calc((var(--break-when) - 100%) * 9999);
  text-align: center;
}

.last-section .section-body article img {
  aspect-ratio: 1.33;
  object-fit: cover;
  object-position: center center;
  border-radius: 10px;
  margin-inline: auto;
}
