/* ============================================================
   PEBS — designsystem
   ============================================================ */
:root {
  --cream: #faf7f1;
  --cream-2: #f3eee4;
  --paper: #ffffff;
  --ink: #1a1d1a;
  --ink-soft: #41463f;
  --muted: #757a6f;
  --line: #e6e0d4;
  --line-soft: #efeae0;
  --green: #1c5d3f;
  --green-deep: #134430;
  --green-tint: #e7f0e9;
  --brass: #b0894f;
  --danger: #b23a3a;
  --shadow-sm: 0 1px 2px rgba(26, 29, 26, .04), 0 2px 8px rgba(26, 29, 26, .05);
  --shadow-md: 0 6px 18px rgba(26, 29, 26, .08), 0 2px 6px rgba(26, 29, 26, .05);
  --shadow-lg: 0 24px 60px rgba(19, 35, 26, .18);
  --radius: 16px;
  --radius-sm: 10px;
  --r-pill: 999px;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --sans: 'Inter', system-ui, -apple-system, Segoe UI, sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  line-height: 1.6;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.08; letter-spacing: -.01em; margin: 0; }
em { font-style: italic; }

.container { width: min(1180px, 92vw); margin-inline: auto; }
.eyebrow {
  font-size: .74rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--green); font-weight: 600; margin: 0 0 1rem;
}

/* ---------- Knappar ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .85rem 1.6rem; border-radius: var(--r-pill); border: 1px solid transparent;
  font-weight: 500; font-size: .98rem; letter-spacing: .01em;
  transition: transform .18s var(--ease), background .2s, box-shadow .2s, color .2s, border-color .2s;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--green); color: #fff; box-shadow: var(--shadow-sm); }
.btn--primary:hover { background: var(--green-deep); box-shadow: var(--shadow-md); }
.btn--ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--ink); }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ---------- Topbar ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--cream) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, background .3s, box-shadow .3s;
}
.nav.is-stuck { border-color: var(--line); box-shadow: var(--shadow-sm); }
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.brand { display: inline-flex; align-items: center; gap: .6rem; }
.brand__word { font-family: var(--serif); font-weight: 700; font-size: 1.5rem; letter-spacing: .04em; }
.brand__mark {
  width: 26px; height: 26px; border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, #3a8a63, var(--green) 55%, var(--green-deep));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18), var(--shadow-sm);
  position: relative;
}
.brand__mark::after {
  content: ''; position: absolute; top: 5px; left: 6px; width: 7px; height: 7px;
  border-radius: 50%; background: rgba(255,255,255,.35);
}
.nav__links { display: flex; gap: 2rem; }
.nav__links a { font-size: .95rem; color: var(--ink-soft); position: relative; padding: .25rem 0; }
.nav__links a::after {
  content: ''; position: absolute; left: 0; bottom: -2px; width: 0; height: 1.5px;
  background: var(--green); transition: width .25s var(--ease);
}
.nav__links a:hover { color: var(--ink); }
.nav__links a:hover::after { width: 100%; }

.cart-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink); transition: border-color .2s, transform .15s;
}
.cart-btn:hover { border-color: var(--ink); }
.cart-btn:active { transform: scale(.94); }
.cart-btn__count {
  position: absolute; top: -4px; right: -4px; min-width: 19px; height: 19px; padding: 0 5px;
  border-radius: var(--r-pill); background: var(--brass); color: #fff;
  font-size: .7rem; font-weight: 600; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 0 2px var(--cream);
}

.nav__actions { display: flex; align-items: center; gap: .7rem; }
.account-btn {
  display: inline-flex; align-items: center; gap: .5rem; height: 44px; padding: 0 1.05rem 0 .9rem;
  border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--paper); color: var(--ink);
  font-size: .92rem; font-weight: 500; transition: border-color .2s, transform .15s;
}
.account-btn:hover { border-color: var(--ink); }
.account-btn:active { transform: scale(.97); }
.account-btn__label { white-space: nowrap; max-width: 9rem; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 520px) {
  .account-btn { width: 44px; padding: 0; justify-content: center; }
  .account-btn__label { display: none; }
}

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: clamp(3.5rem, 9vw, 7rem) 0 clamp(3rem, 7vw, 5.5rem); }
.hero__inner { position: relative; z-index: 2; max-width: 760px; }
.hero__title { font-size: clamp(2.6rem, 7vw, 5rem); letter-spacing: -.025em; }
.hero__title em { color: var(--green); font-weight: 500; }
.hero__lede { font-size: clamp(1.05rem, 2vw, 1.28rem); color: var(--ink-soft); max-width: 56ch; margin: 1.6rem 0 2.2rem; }
.hero__actions { display: flex; gap: .9rem; flex-wrap: wrap; }
.hero__orb {
  position: absolute; z-index: 1; top: -12%; right: -8%; width: min(46vw, 560px); aspect-ratio: 1;
  border-radius: 50%;
  background:
    radial-gradient(circle at 34% 30%, #4f9d77, var(--green) 46%, var(--green-deep) 78%);
  box-shadow: inset 0 0 80px rgba(255,255,255,.12), var(--shadow-lg);
  opacity: .14;
  filter: blur(2px);
}

/* ---------- Datan-band ---------- */
.specsband { padding: clamp(2.5rem, 6vw, 4.5rem) 0; }
.specsband__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
.specfeat {
  background: var(--paper); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 2rem 1.75rem; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.specfeat__unit {
  position: absolute; top: 1.1rem; right: 1.3rem; font-family: var(--serif); font-style: italic;
  font-size: 2.4rem; color: var(--green-tint); font-weight: 600;
}
.specfeat h3 { font-size: 1.5rem; margin-bottom: .5rem; }
.specfeat p { margin: 0; color: var(--muted); font-size: .96rem; }

/* ---------- Sektionshuvuden ---------- */
.section-head { margin-bottom: 2.4rem; }
.section-title { font-size: clamp(2rem, 4vw, 2.8rem); }
.section-sub { color: var(--muted); margin: .6rem 0 0; }
.shop { padding: clamp(1rem, 3vw, 2rem) 0 clamp(3.5rem, 8vw, 6rem); }

/* ---------- Produktrutnät ---------- */
.grid {
  display: grid; gap: 1.5rem;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
}
.card {
  background: var(--paper); border: 1px solid var(--line-soft); border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm); cursor: pointer;
  display: flex; flex-direction: column;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-md); border-color: var(--line); }
.card__media {
  position: relative; aspect-ratio: 4 / 3; background: var(--cream-2);
  display: grid; place-items: center; overflow: hidden;
}
.card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s var(--ease); }
.card:hover .card__media img { transform: scale(1.04); }
.card__badge {
  position: absolute; top: .85rem; left: .85rem; z-index: 2;
  background: rgba(255,255,255,.92); color: var(--ink); font-size: .72rem; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase; padding: .3rem .65rem; border-radius: var(--r-pill);
  box-shadow: var(--shadow-sm);
}
.card__badge--out { background: var(--ink); color: #fff; }
.card__body { padding: 1.25rem 1.35rem 1.4rem; display: flex; flex-direction: column; gap: .15rem; flex: 1; }
.card__brand { font-size: .74rem; letter-spacing: .14em; text-transform: uppercase; color: var(--green); font-weight: 600; }
.card__name { font-size: 1.32rem; margin: .15rem 0 .35rem; }
.card__price { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; color: var(--ink); margin-bottom: .5rem; }
.card__stock { display: flex; align-items: center; gap: .4rem; font-size: .78rem; color: var(--muted); margin-bottom: .9rem; }
.card__stock .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex: none; }
.card__stock.low { color: var(--brass); }
.card__stock.low .dot { background: var(--brass); }
.card__stock.out { color: var(--danger); }
.card__stock.out .dot { background: var(--danger); }

.specrow { display: flex; gap: .5rem; margin-top: auto; }
.spec {
  flex: 1; text-align: center; background: var(--cream); border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm); padding: .55rem .3rem;
}
.spec__val { font-family: var(--serif); font-size: 1.12rem; font-weight: 600; line-height: 1; }
.spec__val small { font-size: .62em; font-weight: 500; color: var(--muted); margin-left: 1px; }
.spec__label { font-size: .64rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: .25rem; }

/* skelett */
.card--skeleton { min-height: 380px; cursor: default; pointer-events: none; }
.card--skeleton::after {
  content: ''; display: block; height: 100%;
  background: linear-gradient(100deg, var(--cream-2) 30%, #fff 50%, var(--cream-2) 70%);
  background-size: 200% 100%; animation: shimmer 1.3s infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }

.empty { text-align: center; color: var(--muted); padding: 3rem 0; font-size: 1.05rem; }

/* placeholder för boll utan bild */
.ballph {
  width: 64%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 34% 30%, #cfe0d4, #9fc1ad 55%, #6f9c83);
  box-shadow: inset -8px -10px 24px rgba(0,0,0,.12), inset 6px 8px 18px rgba(255,255,255,.5);
  opacity: .9;
}

/* ---------- Om / Footer ---------- */
.about { padding: clamp(2rem, 5vw, 4rem) 0 clamp(3rem, 7vw, 5rem); }
.about__inner { max-width: 680px; }
.about p { color: var(--ink-soft); font-size: 1.1rem; margin-top: 1rem; }
.footer { background: var(--green-deep); color: #d8e4dc; padding: 3rem 0; }
.footer__inner { display: flex; flex-direction: column; gap: .5rem; align-items: center; text-align: center; }
.footer .brand__word { color: #fff; }
.footer a { color: #fff; text-decoration: underline; text-underline-offset: 3px; }
.footer__admin { font-size: .85rem; opacity: .7; }
.footer__admin a { text-decoration: none; opacity: .8; }

/* ============================================================
   Produktdetalj-modal
   ============================================================ */
.modal, .drawer { position: fixed; inset: 0; z-index: 100; }
.modal[hidden], .drawer[hidden] { display: none; }
.modal__backdrop, .drawer__backdrop {
  position: absolute; inset: 0; background: rgba(20, 30, 24, .42);
  backdrop-filter: blur(3px); animation: fade .25s var(--ease);
}
@keyframes fade { from { opacity: 0; } }
.modal__panel {
  position: relative; width: min(960px, 94vw); max-height: 92vh; overflow: auto; margin: 4vh auto;
  background: var(--paper); border-radius: 22px; box-shadow: var(--shadow-lg);
  animation: pop .32s var(--ease);
}
@keyframes pop { from { opacity: 0; transform: translateY(18px) scale(.98); } }
.modal__close, .drawer__close {
  position: absolute; top: 1rem; right: 1rem; z-index: 5; width: 40px; height: 40px; border-radius: 50%;
  border: none; background: rgba(255,255,255,.85); color: var(--ink); font-size: 1.5rem; line-height: 1;
  display: grid; place-items: center; box-shadow: var(--shadow-sm); transition: background .2s, transform .15s;
}
.modal__close:hover, .drawer__close:hover { background: #fff; transform: rotate(90deg); }

.pd { display: grid; grid-template-columns: 1.05fr 1fr; }
.pd__gallery { background: var(--cream-2); padding: 1.5rem; display: flex; flex-direction: column; gap: 1rem; }
.pd__main {
  aspect-ratio: 1; border-radius: var(--radius); overflow: hidden; background: var(--paper);
  display: grid; place-items: center; box-shadow: var(--shadow-sm);
}
.pd__main img { width: 100%; height: 100%; object-fit: cover; }
.pd__thumbs { display: flex; gap: .6rem; flex-wrap: wrap; }
.pd__thumb {
  width: 62px; height: 62px; border-radius: 10px; overflow: hidden; border: 2px solid transparent;
  background: var(--paper); padding: 0; transition: border-color .2s;
}
.pd__thumb img { width: 100%; height: 100%; object-fit: cover; }
.pd__thumb.is-active { border-color: var(--green); }

.pd__info { padding: 2.4rem 2.2rem; display: flex; flex-direction: column; }
.pd__brand { font-size: .76rem; letter-spacing: .16em; text-transform: uppercase; color: var(--green); font-weight: 600; }
.pd__name { font-size: clamp(1.8rem, 3.5vw, 2.5rem); margin: .4rem 0 .6rem; }
.pd__price { font-family: var(--serif); font-size: 1.6rem; font-weight: 600; }
.pd__desc { color: var(--ink-soft); margin: 1.1rem 0 1.4rem; }
.pd__specs { display: grid; grid-template-columns: repeat(3, 1fr); gap: .7rem; margin-bottom: 1.6rem; }
.pd__specs .spec { padding: .9rem .4rem; }
.pd__specs .spec__val { font-size: 1.5rem; }
.pd__stock { font-size: .9rem; color: var(--muted); margin-bottom: 1.2rem; display: flex; align-items: center; gap: .5rem; }
.pd__stock .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.pd__stock.out .dot { background: var(--danger); }

.qty { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: var(--r-pill); overflow: hidden; }
.qty button { width: 42px; height: 44px; border: none; background: var(--paper); font-size: 1.3rem; color: var(--ink); }
.qty button:hover { background: var(--cream); }
.qty input { width: 46px; height: 44px; border: none; text-align: center; font-size: 1rem; font-weight: 600; -moz-appearance: textfield; }
.qty input::-webkit-outer-spin-button, .qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.pd__buy { display: flex; gap: .8rem; align-items: center; margin-top: auto; }
.pd__buy .btn { flex: 1; }

/* ============================================================
   Kundvagn-drawer
   ============================================================ */
.drawer__panel {
  position: absolute; top: 0; right: 0; height: 100%; width: min(440px, 100vw);
  background: var(--cream); box-shadow: var(--shadow-lg); display: flex; flex-direction: column;
  animation: slidein .35s var(--ease);
}
@keyframes slidein { from { transform: translateX(100%); } }
.drawer__head { display: flex; align-items: center; justify-content: space-between; padding: 1.5rem 1.6rem 1rem; border-bottom: 1px solid var(--line); }
.drawer__head h2 { font-size: 1.5rem; }
.drawer__close { position: static; box-shadow: none; background: transparent; }
.drawer__close:hover { background: var(--cream-2); transform: none; }
.drawer__body { flex: 1; overflow: auto; padding: 1.2rem 1.6rem; }
.drawer__foot { border-top: 1px solid var(--line); padding: 1.3rem 1.6rem; background: var(--paper); }

.cart-line { display: grid; grid-template-columns: 60px 1fr auto; gap: .9rem; padding: .9rem 0; border-bottom: 1px solid var(--line-soft); align-items: center; }
.cart-line__img { width: 60px; height: 60px; border-radius: 10px; overflow: hidden; background: var(--cream-2); display: grid; place-items: center; }
.cart-line__img img { width: 100%; height: 100%; object-fit: cover; }
.cart-line__name { font-weight: 600; font-size: .98rem; }
.cart-line__meta { font-size: .82rem; color: var(--muted); }
.cart-line__price { font-family: var(--serif); font-weight: 600; }
.cart-line .qty { transform: scale(.82); transform-origin: left; margin-top: .4rem; }
.cart-line__remove { background: none; border: none; color: var(--muted); font-size: .8rem; text-decoration: underline; padding: .2rem 0; }
.cart-line__remove:hover { color: var(--danger); }
.cart-empty { text-align: center; color: var(--muted); padding: 3rem 1rem; }
.cart-empty svg { opacity: .35; margin-bottom: 1rem; }

.cart-sum { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 1rem; }
.cart-sum .label { color: var(--muted); }
.cart-sum .total { font-family: var(--serif); font-size: 1.7rem; font-weight: 600; }

/* Kassaformulär */
.checkout { display: grid; gap: .8rem; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field label { font-size: .82rem; font-weight: 600; color: var(--ink-soft); }
.field input, .field textarea {
  font-family: inherit; font-size: .95rem; padding: .7rem .85rem; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--paper); color: var(--ink); transition: border-color .2s, box-shadow .2s;
}
.field input:focus, .field textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--green-tint); }
.field textarea { resize: vertical; min-height: 70px; }
.field--row { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.checkout__back { background: none; border: none; color: var(--muted); font-size: .9rem; text-decoration: underline; padding: 0; margin-bottom: .3rem; justify-self: start; }
.form-error { color: var(--danger); font-size: .88rem; }

.success { text-align: center; padding: 2rem 1rem; }
.success__check { width: 64px; height: 64px; margin: 0 auto 1.2rem; border-radius: 50%; background: var(--green-tint); color: var(--green); display: grid; place-items: center; }
.success h3 { font-size: 1.6rem; margin-bottom: .5rem; }
.success p { color: var(--ink-soft); }

/* ============================================================
   Konto-modal
   ============================================================ */
.modal__panel--narrow { width: min(460px, 94vw); }
.acct { padding: 2.5rem 2.2rem 2.2rem; }
.acct__title { font-size: 1.8rem; margin-bottom: .35rem; }
.acct__sub { color: var(--muted); margin: 0 0 1.5rem; }
.acct__tabs { display: flex; gap: .3rem; background: var(--cream-2); padding: .25rem; border-radius: var(--r-pill); margin-bottom: 1.5rem; }
.acct__tab { flex: 1; border: none; background: transparent; padding: .6rem; border-radius: var(--r-pill); font-weight: 500; color: var(--ink-soft); font-size: .92rem; cursor: pointer; transition: background .2s, color .2s; }
.acct__tab.is-active { background: var(--paper); color: var(--ink); box-shadow: var(--shadow-sm); }
.acct form { display: grid; gap: .8rem; }
.acct form .btn { margin-top: .4rem; }
.acct__switch { text-align: center; font-size: .9rem; color: var(--muted); margin-top: 1.1rem; }
.acct__switch button { background: none; border: none; color: var(--green); font-weight: 600; cursor: pointer; text-decoration: underline; font-size: .9rem; }

.acct__user { display: flex; align-items: center; gap: 1rem; margin-bottom: 1rem; }
.acct__avatar { width: 50px; height: 50px; border-radius: 50%; background: var(--green-tint); color: var(--green); display: grid; place-items: center; font-family: var(--serif); font-weight: 700; font-size: 1.3rem; flex: none; }
.acct__user h3 { font-size: 1.3rem; }
.acct__user p { margin: .1rem 0 0; color: var(--muted); font-size: .9rem; }
.acct__row { display: flex; gap: .6rem; }
.acct__row .btn { flex: 1; }
.acct__section-title { font-size: .76rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin: 1.6rem 0 .7rem; }

.order-hist { display: flex; flex-direction: column; gap: .6rem; max-height: 46vh; overflow: auto; margin: 0 -.3rem; padding: 0 .3rem; }
.order-hist__item { border: 1px solid var(--line-soft); border-radius: var(--radius-sm); padding: .8rem 1rem; }
.order-hist__top { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.order-hist__id { font-family: var(--serif); font-weight: 600; }
.order-hist__date { font-size: .8rem; color: var(--muted); }
.order-hist__items { font-size: .86rem; color: var(--ink-soft); margin-top: .35rem; }
.order-hist__foot { display: flex; justify-content: space-between; align-items: center; margin-top: .55rem; }
.order-hist__total { font-weight: 600; font-family: var(--serif); }
.acct__empty { color: var(--muted); font-size: .92rem; padding: .8rem 0; }
.badge-status { font-size: .68rem; font-weight: 600; padding: .22rem .55rem; border-radius: var(--r-pill); text-transform: uppercase; letter-spacing: .04em; }
.badge-status.new { background: #efe6d4; color: #8a6d2e; }
.badge-status.paid { background: var(--green-tint); color: var(--green); }
.badge-status.cancelled { background: #f6e3e0; color: var(--danger); }
.acct__note { background: var(--green-tint); color: var(--green-deep); border-radius: var(--radius-sm); padding: .65rem .9rem; font-size: .86rem; margin-bottom: 1rem; display: flex; justify-content: space-between; align-items: center; gap: .5rem; }
.acct__note button { background: none; border: none; color: var(--green-deep); text-decoration: underline; cursor: pointer; font-size: .82rem; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: .85rem 1.4rem; border-radius: var(--r-pill);
  box-shadow: var(--shadow-lg); font-size: .95rem; z-index: 200; opacity: 0;
  transition: opacity .3s, transform .3s var(--ease); pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Responsivt ---------- */
@media (max-width: 860px) {
  .pd { grid-template-columns: 1fr; }
  .pd__info { padding: 1.8rem 1.6rem 2rem; }
  .specsband__grid { grid-template-columns: 1fr; }
  .nav__links { display: none; }
}
@media (max-width: 520px) {
  .field--row { grid-template-columns: 1fr; }
  .hero__actions { flex-direction: column; align-items: stretch; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto; }
}
