/* ---------- Brand / logo ---------- */
.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
}

.brand-title {
  font-size: inherit;
  line-height: 0;
}

.brand-link {
  display: block;
  max-width: 13.5rem;
}

.brand-logo {
  width: 100%;
  height: auto;
}

/* ---------- Mobile nav toggle ---------- */
.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 2.5rem;
  height: 2.5rem;
  padding: var(--space-xs);
}

.nav-toggle-bar {
  display: block;
  height: 1.5px;
  background-color: var(--color-forest);
  transition: transform var(--transition), opacity var(--transition);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(1) {
  transform: translateY(6.5px) rotate(45deg);
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}

.nav-toggle[aria-expanded="true"] .nav-toggle-bar:nth-child(3) {
  transform: translateY(-6.5px) rotate(-45deg);
}

@media (min-width: 64em) {
  .nav-toggle {
    display: none;
  }
}

/* ---------- Sidebar navigation ---------- */
.site-nav {
  display: none;
  padding: var(--space-lg) 0 var(--space-md);
  border-bottom: 1px solid var(--color-cream);
}

.site-nav.is-open {
  display: block;
}

@media (min-width: 64em) {
  .site-nav {
    display: block;
    padding: var(--space-xl) 0 0;
    border-bottom: 0;
  }
}

.nav-list {
  display: grid;
  gap: var(--space-2xs);
}

.nav-link {
  display: inline-block;
  font-size: var(--text-sm);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  color: var(--color-link);
  transition: color var(--transition);
}

.nav-link:hover,
.nav-link:focus-visible {
  color: var(--color-link-hover);
}

.nav-link--active {
  color: var(--color-forest);
}

/* ---------- Product grid ----------
   17 products with one featured tile, so every row is full:
   phones   — 2 columns, featured spans 2 columns  (18 cells = 9 rows of 2)
   tablet + — 4 columns, featured spans 2 x 2       (20 cells = 5 rows of 4) */
.product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--grid-gap);
  list-style: none;
}

.product-grid > li {
  display: flex;
}

.product-grid-item--featured {
  grid-column: span 2;
}

@media (min-width: 48em) {
  .product-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .product-grid-item--featured {
    grid-row: span 2;
  }
}

/* ---------- Product card ---------- */
.product-card {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  color: var(--color-forest);
}

.product-card-media {
  display: block;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background-color: var(--color-cream);
}

/* Featured tile: the image fills whatever height the two spanned rows give it,
   so its edges line up exactly with the neighbouring tiles. */
@media (min-width: 48em) {
  .product-card--featured .product-card-media {
    position: relative;
    flex: 1;
    aspect-ratio: auto;
    min-height: 0;
  }

  .product-card--featured .product-card-img {
    position: absolute;
    inset: 0;
  }
}

.product-card--featured .product-card-title {
  font-size: var(--text-sm);
}

.product-card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 400ms ease;
}

/* Caption: below the tile on small screens, overlay on hover for larger */
.product-card-info {
  display: flex;
  justify-content: space-between;
  gap: var(--space-xs);
  padding-top: var(--space-xs);
  font-size: var(--text-xs);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.product-card-text {
  display: grid;
  gap: 0.125rem;
  min-width: 0;
}

.product-card-ref {
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  letter-spacing: var(--tracking-wide);
  color: var(--color-text-muted);
}

.product-card-price {
  color: var(--color-copper-dark);
  white-space: nowrap;
}

@media (hover: hover) and (min-width: 40em) {
  .product-card {
    position: relative;
  }

  .product-card-info {
    position: absolute;
    inset: auto 0 0;
    padding: var(--space-sm);
    background-color: rgb(255 255 255 / 0.94);
    border-top: 2px solid var(--color-copper);
    transform: translateY(100%);
    opacity: 0;
    transition: transform var(--transition), opacity var(--transition);
  }

  .product-card {
    overflow: hidden;
  }

  .product-card:hover .product-card-info,
  .product-card:focus-visible .product-card-info {
    transform: translateY(0);
    opacity: 1;
  }

  .product-card:hover .product-card-img,
  .product-card:focus-visible .product-card-img {
    transform: scale(1.05);
  }
}

.product-card:active .product-card-media {
  filter: brightness(0.95);
}

/* ---------- Button ---------- */
.button {
  display: inline-block;
  padding: var(--space-sm) var(--space-lg);
  border: 1px solid var(--color-forest);
  background-color: var(--color-forest);
  color: var(--color-cream);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  transition: background-color var(--transition), border-color var(--transition), color var(--transition);
}

.button:hover,
.button:focus-visible {
  border-color: var(--color-copper);
  background-color: var(--color-copper);
  color: var(--color-white);
}

.button:active {
  background-color: var(--color-copper-dark);
  border-color: var(--color-copper-dark);
}

/* ---------- Forms ---------- */
.form {
  display: grid;
  gap: var(--space-xl);
}

.form[hidden] {
  display: none;
}

.form-group {
  display: grid;
  gap: var(--space-lg);
  border: 0;
  min-width: 0;
}

.form-legend {
  margin-bottom: var(--space-md);
  padding-bottom: var(--space-xs);
  width: 100%;
  border-bottom: 1px solid var(--color-sand);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-copper-dark);
}

.field {
  display: grid;
  gap: var(--space-xs);
}

.field-label {
  font-size: 0.9375rem;
  color: var(--color-forest);
}

.field-optional {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.field-input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--color-sand);
  border-radius: 0;
  background-color: var(--color-white);
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--color-forest);
  transition: border-color var(--transition), box-shadow var(--transition);
}

.field-input:hover {
  border-color: var(--color-copper);
}

.field-input:focus-visible {
  outline: none;
  border-color: var(--color-copper);
  box-shadow: 0 0 0 3px rgb(185 120 90 / 0.25);
}

.field-input:user-invalid {
  border-color: var(--color-error);
}

.field-input--select {
  appearance: none;
  padding-right: var(--space-2xl);
  background-image: linear-gradient(45deg, transparent 50%, var(--color-copper) 50%),
                    linear-gradient(135deg, var(--color-copper) 50%, transparent 50%);
  background-position: calc(100% - 1.25rem) 50%, calc(100% - 0.9rem) 50%;
  background-size: 0.375rem 0.375rem;
  background-repeat: no-repeat;
}

.field-input--textarea {
  min-height: 9rem;
  resize: vertical;
  line-height: 1.6;
}

.field-hint {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.field-hint--warning {
  color: var(--color-error);
}

.form-actions {
  padding-top: var(--space-xs);
}

.form-error {
  margin-top: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--color-error);
}

.form-error[hidden] {
  display: none;
}

/* ---------- Button variant ---------- */
.button--outline {
  background-color: transparent;
  color: var(--color-forest);
}

/* ---------- Form success message ---------- */
.form-success {
  align-self: start;
  padding: var(--space-xl) var(--space-lg);
  border-top: 2px solid var(--color-copper);
  background-color: var(--color-cream);
  line-height: 1.7;
}

.form-success[hidden] {
  display: none;
}

.form-success-title {
  margin-bottom: var(--space-sm);
  font-size: 1.75rem;
  font-weight: 400;
  line-height: 1.2;
}

.form-success-title:focus {
  outline: none;
}

.form-success-title::before {
  content: "";
  display: block;
  width: 2.5rem;
  height: 2.5rem;
  margin-bottom: var(--space-md);
  border-radius: 50%;
  background: var(--color-forest) center / 1.1rem no-repeat;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23f6eee5' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E");
}

.form-success-note {
  margin-top: var(--space-sm);
  margin-bottom: var(--space-lg);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* ---------- Sidebar secondary links (Privacy / Cookie settings) ---------- */
.nav-list--meta {
  margin-top: var(--space-lg);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--color-cream);
}

.nav-link--small {
  font-family: var(--font-sans);
  font-size: 0.6875rem;
  letter-spacing: var(--tracking-wider);
}

.nav-button {
  padding: 0;
  text-align: left;
}

/* ---------- Form note ---------- */
.form-note {
  margin-top: var(--space-sm);
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

.form-note a,
.cookie-banner-link {
  color: var(--color-copper-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.form-note a:hover,
.cookie-banner-link:hover {
  color: var(--color-forest);
}

/* ---------- Cookie banner ---------- */
.cookie-banner {
  position: fixed;
  inset: auto 0 0;
  z-index: 100;
  max-height: 85vh;
  overflow-y: auto;
  border-top: 2px solid var(--color-copper);
  background-color: var(--color-cream);
  box-shadow: 0 -0.5rem 2rem rgb(44 69 64 / 0.12);
}

.cookie-banner[hidden] {
  display: none;
}

.cookie-banner-inner {
  display: grid;
  gap: var(--space-md);
  max-width: 60rem;
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md);
}

.cookie-banner-title {
  font-size: var(--text-lg);
  font-weight: 400;
}

.cookie-banner-title:focus {
  outline: none;
}

.cookie-banner-text {
  max-width: 44rem;
  font-size: 0.9375rem;
  line-height: 1.6;
}

.cookie-options {
  display: grid;
  gap: var(--space-sm);
  border: 0;
}

.cookie-options[hidden] {
  display: none;
}

.cookie-options-legend {
  margin-bottom: var(--space-xs);
  font-family: var(--font-sans);
  font-size: var(--text-xs);
  font-weight: 500;
  letter-spacing: var(--tracking-wider);
  text-transform: uppercase;
  color: var(--color-copper-dark);
}

.cookie-option {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm);
  background-color: var(--color-white);
  cursor: pointer;
}

.cookie-option-input {
  flex: 0 0 auto;
  width: 1.125rem;
  height: 1.125rem;
  margin-top: 0.15rem;
  accent-color: var(--color-forest);
}

.cookie-option-input:disabled {
  cursor: not-allowed;
}

.cookie-option-text {
  display: grid;
  gap: 0.125rem;
}

.cookie-option-name {
  font-size: 0.9375rem;
}

.cookie-option-desc {
  font-size: var(--text-sm);
  color: var(--color-text-muted);
}

/* Accept and Reject share the same style so neither is pushed over the other. */
.cookie-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.cookie-banner-actions .button {
  flex: 1 1 10rem;
}

.cookie-banner-actions .button[hidden] {
  display: none;
}

/* Keep the end of the page reachable above the banner */
.has-cookie-banner {
  padding-bottom: 14rem;
}

/* Tablet and up: a floating card in the corner, so it never has to line up
   with the sidebar or the product grid behind it. */
@media (min-width: 48em) {
  .cookie-banner {
    inset: auto var(--space-lg) var(--space-lg) auto;
    width: min(30rem, calc(100vw - 2 * var(--space-lg)));
    border: 1px solid var(--color-sand);
    border-top: 2px solid var(--color-copper);
    box-shadow: 0 1rem 2.5rem rgb(44 69 64 / 0.18);
  }

  .cookie-banner-inner {
    max-width: none;
    padding: var(--space-lg);
  }

  .cookie-banner-text {
    font-size: var(--text-sm);
  }

  .cookie-banner-actions .button {
    flex: 1 1 auto;
  }

  /* The card no longer spans the page, so less clearance is needed */
  .has-cookie-banner {
    padding-bottom: 0;
  }
}
