/* ------------------------------
   Base
------------------------------ */

body {
  margin: 0;
  padding: 0;
  font-family: system-ui, sans-serif;
  line-height: 1.6;
  background-color: #f5f5f5;
  color: #222;
}

body:has(#special-element) {
  background-image: url("/images/hbd.png");
  background-size: cover;
  background-repeat: no-repeat;
  background-position: center;
  background-attachment: fixed;
}

/* ------------------------------
   Search + Dropdown (fixed)
------------------------------ */

section {
  padding-left: 20px;
  text-align: center; /* center inline-block children */
}

#searchBox,
#sort {
  display: inline-block;      /* sit side-by-side when possible */
  vertical-align: top;
  width: 330px;
  margin: 0 0.5rem 1rem;      /* spacing */
  border-radius: 10px;
  padding: 10px;
  font-size: 1rem;
}

/* ------------------------------
   Header  (NOW STICKY)
------------------------------ */

header {
  background: #2e2e2e;
  padding: 0 1rem;
  height: 80px;

  display: flex;
  align-items: center;
  justify-content: space-between;

  position: sticky;   /* <-- makes it stick */
  top: 0;             /* <-- stick to top */
  z-index: 9999;      /* <-- stay above everything */
}

ver {
  color: whitesmoke;
  margin-right: 20px;
}

/* App title (hidden on desktop) */
.app-title {
  display: none;
}

/* ------------------------------
   Navigation (desktop)
------------------------------ */

nav ul {
  display: flex;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

nav a {
  text-decoration: none;
  font-weight: 800;
  color: rgb(221, 221, 221);
}

nav a:hover {
  color: #eeea18;
}

/* ------------------------------
   Hamburger (hidden on desktop)
------------------------------ */

.hamburger {
  display: none;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  padding: 1rem;
  background: none;
  border: none;
}

.hamburger span {
  width: 28px;
  height: 3px;
  background: white;
  border-radius: 2px;
}

/* ------------------------------
   Submenu (desktop hover)
------------------------------ */

.has-sub {
  position: relative;
}

.about-link {
  display: inline-block;
}

.sub-toggle {
  display: none;
  background: none;
  border: none;
  color: rgb(221, 221, 221);
  font-weight: 800;
  cursor: pointer;
}

.sub-menu {
  display: none;
}

/* Desktop hover dropdown */
@media (min-width: 701px) {
  .has-sub:hover .sub-menu {
    display: block;
    position: absolute;
    top: 100%;
    background: #3a3a3a;
    padding: 0.5rem 1rem;
    z-index: 30;
  }

  .sub-menu li {
    padding: 0.25rem 0;
  }
}

/* ------------------------------
   Mobile
------------------------------ */

@media (max-width: 700px) {
  body:has(#special-element) {
    background-image: url("/images/hbm.png");
    background-size: cover;
    background-repeat: no-repeat;
    background-position: center;
    background-attachment: fixed;
  }

  .hamburger {
    display: flex;
  }

  .app-title {
    display: block;
    font-size: 1.25rem;
    font-weight: 800;
    color: white;
    margin-left: 0.75rem;
    line-height: 80px;
  }

  nav ul {
    display: none;
    flex-direction: column;
    background: #2e2e2e;
    width: 100%;
    min-height: 100vh;
    position: absolute;
    top: 80px;
    left: 0;
    margin: 0;
    padding: 0;
    z-index: 20;
  }

  nav ul.open {
    display: flex;
  }

  nav li {
    margin: 0;
    padding: 0;
    list-style: none;
    border: 0;
  }

  .about-link {
    display: none;
  }

  nav a,
  .sub-toggle,
  .sub-menu li a {
    display: block;
    padding: 0.5rem 0 0.5rem 20px;
    font-family: inherit;
    font-size: inherit;
    font-weight: 800;
    line-height: 1.2;
    letter-spacing: inherit;
    color: rgb(221, 221, 221);
    text-decoration: none;
    text-align: left;

    background: none;
    border: 0;
    appearance: none;
    -webkit-appearance: none;
    box-sizing: border-box;
  }

  .sub-toggle {
    cursor: pointer;
  }

  .has-sub {
    display: block;
  }

  .sub-menu {
    display: none;
    background: #3a3a3a;
    margin: 0;
    padding: 0;
  }

  .sub-menu.open {
    display: block;
  }
}

/* ------------------------------
   Showcase Grid
------------------------------ */

section > section {
  max-width: 1300px;
  margin: 0 auto;
  padding: 1rem;

  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));

  row-gap: 2rem;
  column-gap: 1rem;
}

/* ------------------------------
   Article cards
------------------------------ */

article {
  box-shadow: 0 2px 6px rgba(0, 0, 0, .5);
  background: white;
  border-radius: 6px;
  padding: 1.25rem;

  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}

.money {
  font-weight: bold;
}

.title {
  font-weight: bold;
  color: #360da8;
}

.company {
  font-weight: bold;
  color: rgb(0, 102, 22);
}

.specs {
  margin: 0;
  padding: 0;
  color: #333;
}

.extras {
  margin-top: 0.5em;
  font-size: 0.9em;
  color: #444;
}

.extras div {
  margin-left: 1em;
}

.delete-btn {
  padding: 10px 20px;
  background: #EF8354;
  color: #000000;
  font-weight: bold;
  text-decoration: none;
  border-radius: 4px;

  display: inline-block;
  margin-top: auto;
  align-self: flex-end;
}

article {
  width: 330px;
}

/* ------------------------------
   Icons
------------------------------ */

.fa-trash-can,
.fa-upload,
.fa-pen-to-square {
  color: #000;
  cursor: pointer;
  transition: color 0.2s, transform 0.2s;
}

.fa-trash-can:hover {
  color: red;
  transform: scale(1.1);
}

.fa-upload:hover {
  color: #360da8;
  transform: scale(1.1);
}

.fa-pen-to-square:hover {
  color: rgb(0, 102, 22);
  transform: scale(1.1);
}
