[hidden] { display: none !important; }

/* Toppmeny */
.topnav { display: flex; align-items: center; gap: 18px; }
.topnav a { font-family: "Raleway", sans-serif; font-weight: 600; color: var(--heading); text-decoration: none; }
.topnav a:hover { color: var(--brand); }
.cart-link { position: relative; display: inline-flex; padding: 6px; }
.cart-count {
  position: absolute; top: -4px; right: -8px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 999px; background: var(--brand); color: #fff; font: 700 .75rem/20px "Open Sans", sans-serif; text-align: center;
}

/* Framside med bakgrunnsbilete */
.hero-page main.wrap { padding-top: 0; }
.hero {
  min-height: 62vh; display: grid; place-items: center;
  margin: 0 -16px; padding: 32px 16px;
  background: url("../img/bakgrunn.jpg") center / cover no-repeat;
}
.hero-card { background: rgba(255, 255, 255, .94); }

/* Butikk */
.shop-layout { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 20px; align-items: start; }
.picker { position: sticky; top: 12px; }
.stage { position: relative; display: flex; align-items: center; justify-content: center; background: #f3f1ee; border-radius: 10px; min-height: 320px; }
.stage img { max-width: 100%; max-height: 62vh; width: auto; height: auto; display: block; border-radius: 6px; }
.stage .nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 1;
  width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.9); color: var(--ink); font-size: 1.1rem; box-shadow: 0 1px 4px rgba(0,0,0,.15);
}
.stage .prev { left: 8px; }
.stage .next { right: 8px; }
.stage-label { text-align: center; margin: 8px 0; font-weight: 600; color: var(--heading); }
.thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 6px; scroll-snap-type: x mandatory; }
.thumb { flex: none; padding: 0; border: 2px solid transparent; border-radius: 8px; background: none; cursor: pointer; scroll-snap-align: center; }
.thumb img { width: 60px; height: 90px; object-fit: cover; border-radius: 6px; display: block; }
.thumb.is-active { border-color: var(--brand); }

.product-card {
  display: grid; grid-template-columns: 96px minmax(0, 1fr) auto; gap: 12px 16px; align-items: center;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.product-card:last-of-type { border-bottom: 0; }
.product-img { width: 96px; height: 96px; display: grid; place-items: center; background: #f6f4f1; border-radius: 8px; overflow: hidden; }
.product-img img { max-width: 100%; max-height: 100%; object-fit: contain; transition: opacity .2s; }
.product-img img.loading { opacity: .3; }
.product-info h3 { font-size: 1.02rem; margin: 0 0 2px; }
.product-desc { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.4; }
.product-price { margin: 4px 0 0; font-weight: 700; }
.product-buy { display: flex; align-items: center; gap: 10px; }
.qty-label { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 500; font-size: .85rem; }
.product-buy .qty { width: 64px; padding: 8px; text-align: center; }
.product-buy .btn { padding: 10px 16px; white-space: nowrap; }

/* Smalt produktkort: kjøpsfeltet på eigen rad, så namnet slepp å brytast. */
.products { container-type: inline-size; }
@container (max-width: 640px) {
  .product-card { grid-template-columns: 96px minmax(0, 1fr); }
  .product-buy { grid-column: 1 / -1; justify-content: flex-end; }
}

.cartbar {
  position: sticky; bottom: 0; z-index: 5; margin: 16px -16px 0; padding: 12px 16px;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -6px 16px rgba(0,0,0,.06);
}
.toast {
  position: fixed; left: 50%; bottom: 80px; transform: translateX(-50%); z-index: 10;
  background: var(--yes); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 600; box-shadow: var(--shadow);
}
.toast.error { background: var(--err); }

.extras { margin-top: 20px; display: grid; gap: 12px; }
.extras details summary { cursor: pointer; }
.share-form { margin-top: 14px; }

/* Kasse */
.checkout-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.cart-table { width: 100%; border-collapse: collapse; font-size: .95rem; }
.cart-table th, .cart-table td { padding: 10px 6px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.cart-table .num { text-align: right; white-space: nowrap; }
.cart-table tfoot th { border-bottom: 0; font-size: 1.05rem; }
.cart-table tr.muted td { color: var(--muted); }
.cart-item { display: flex; gap: 10px; align-items: center; }
.cart-item img { width: 40px; height: 60px; object-fit: cover; border-radius: 4px; flex: none; }

.terms-page h1 { margin-bottom: .6em; }
.terms-page h3 { font-size: 1rem; margin: 1.2em 0 .3em; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
textarea.input { resize: vertical; }

@media (max-width: 860px) {
  .shop-layout, .checkout-layout { grid-template-columns: 1fr; }
  .picker { position: static; }
  .stage { min-height: 240px; }
  .stage img { max-height: 48vh; }
}
@media (max-width: 520px) {
  .product-card { grid-template-columns: 72px minmax(0, 1fr); }
  .product-img { width: 72px; height: 72px; }
  .product-buy { grid-column: 1 / -1; justify-content: space-between; }
  .product-buy .btn { flex: 1; }
  .topnav { gap: 12px; }
  .cart-table .cart-item img { display: none; }
}
