:root {
  --bg: #0f0f10;
  --panel: #151517;
  --text: #e9e9ea;
  --muted: #bdbdc2;
  --line: #2a2a2f;
  --shadow: 0 10px 30px rgba(0,0,0,.45);
  /* cover-størrelse */
  --cover-w: 170px;
  --cover-gap: 14px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
}

.container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.intro h1 {
  margin: 0 0 .5rem;
  font-size: 1.9rem;
  letter-spacing: .2px;
}

.intro p {
  margin: 0;
  max-width: 80ch;
  line-height: 1.65;
  color: var(--muted);
}

/* =========================
   NAV-KNAPPER (FAILSAFE)
   - Styler .nav-btn direkte (ikke avhengig av nav)
   - Treffer :link/:visited også
   - Bruker !important på kritiske props for å vinne mot reset/overstyring
========================= */

.menu {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
}

/* Viktig: ta alle link-tilstander */
a.nav-btn:link,
a.nav-btn:visited {
  display: inline-flex !important;
  align-items: center !important;
  gap: .55rem !important;

  padding: .65rem .9rem !important;
  border-radius: 12px !important;

  text-decoration: none !important;
  color: var(--text) !important;

  border: 1px solid rgba(255,255,255,.14) !important;
  background: rgba(255,255,255,.06) !important;
  box-shadow: var(--shadow) !important;

  font-weight: 700 !important;
  line-height: 1 !important;

  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

a.nav-btn:hover {
  border-color: rgba(255,255,255,.26) !important;
  background: rgba(255,255,255,.085) !important;
  transform: translateY(-1px);
}

a.nav-btn:active { transform: translateY(0); }

a.nav-btn:focus-visible {
  outline: 2px solid rgba(255,255,255,.35);
  outline-offset: 2px;
}

/* Primær */
a.nav-btn.nav-btn--primary:link,
a.nav-btn.nav-btn--primary:visited {
  background: rgba(255,255,255,.10) !important;
  border-color: rgba(255,255,255,.22) !important;
}

/* Ikon-chip */
.nav-btn__icon {
  display: inline-grid !important;
  place-items: center !important;
  width: 26px !important;
  height: 26px !important;
  border-radius: 10px !important;
  border: 1px solid rgba(255,255,255,.14) !important;
  background: rgba(0,0,0,.25) !important;
  font-size: 14px !important;
}

/* =========================
   Series + grid
========================= */

.series { margin-top: 2.5rem; }

.series h2 {
  margin: 0 0 1rem;
  padding-bottom: .35rem;
  border-bottom: 2px solid var(--line);
  font-size: 1.5rem;
}

/* Luft inni scrolleområdet (hindrer at kanter klippes) */
.grid-wrap{
  overflow-x: auto;
  overflow-y: visible;
  padding: 14px 18px;                 /* ← mer luft i sidene */
  scroll-padding-left: 18px;
  scroll-padding-right: 18px;
}

/* 5 kolonner som KAN krympe/vokse, men ikke blåser opp cover */
.book-grid{
  --cover-max: 170px;                 /* ← maks størrelse på cover */
  --cover-min: 130px;                 /* ← min størrelse på cover */

  display: grid;
  grid-template-columns: repeat(5, minmax(var(--cover-min), 1fr));
  gap: 14px;

  /* viktig: grid må få litt egen “inner margin” også */
  padding: 2px;                       /* liten buffer mot clipping */
}

/* Card får ikke strekke cover utover maks-bredde */
.book-card{
  justify-self: center;               /* ← sentrer inne i cella */
  width: 100%;
  max-width: var(--cover-max);        /* ← stopper "for store" */
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .45rem;
}

/* Matte/ramme rundt bildet (gir luft + ingen clipping) */
.book-card button{
  all: unset;
  cursor: pointer;
  display: block;
  width: 100%;

  padding: 10px;                /* luft rundt bildet */
  background: var(--panel);
  border: 1px solid var(--line);
}

.book-card img{
  width: 100%;
  height: 100%;
  aspect-ratio: 2 / 3;

  object-fit: contain;          /* ← HELE COVERET ALLTID SYNLIG */
  background: var(--panel);     /* “luft” rundt bildet */

  display: block;
}


.book-card h3{
  margin: 0;
  font-size: .85rem;
  font-weight: 600;
  text-align: center;
  color: var(--text);
}

/* Fokus uten at det klippes */
.book-card button:focus-visible{
  outline: 2px solid rgba(255,255,255,.25);
  outline-offset: 2px;
}


/* Noscript */
.noscript {
  margin-top: 2rem;
  color: var(--muted);
}

/* =========================
   LIGHTBOX (dialog)
========================= */

.no-scroll { overflow: hidden; }

.lightbox{
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 12px;
  background: rgba(15, 17, 21, 0.92);
  color: var(--text);

  width: min(980px, calc(100vw - 24px));
  max-height: calc(100vh - 24px);
}

.lightbox::backdrop{
  background: rgba(0, 0, 0, 0.72);
}

.lightbox-close{
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;

  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto; /* i header */
}

.lightbox-close:hover{
  border-color: rgba(215,162,74,0.7);
}

.lightbox-img{
  display: block;
  margin: 10px auto 0;
  max-width: 100%;
  max-height: calc(100vh - 160px);
  width: auto;
  height: auto;

  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0f1115;
}

.lightbox-caption{
  margin: 10px 4px 0;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}
/* To-delt bildeområde i kortet */
.book-card .book-photos{
  display: grid;
  grid-template-columns: 1fr 1fr; /* cover + back */
  gap: 10px;
  width: 100%;
}

/* Hvis back mangler: kun én kolonne */
.book-card .book-photos.is-single{
  grid-template-columns: 1fr;
}

/* Hver halvdel er en knapp */
.book-card .photo-btn{
  all: unset;
  cursor: pointer;
  display: block;
  width: 100%;
  -webkit-tap-highlight-color: transparent;
}

.book-card .photo-btn img{
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: contain;     /* hele bilde synlig */
  border-radius: 0;        /* ingen avrunding */
  display: block;
  background: var(--panel);
  outline: 1px solid rgba(255,255,255,.06);
}

/* Fokus */
.book-card .photo-btn:focus-visible img{
  outline: 2px solid rgba(255,255,255,.25);
  outline-offset: 2px;
}

/* Tittel under begge, sentrert */
.book-card h3{
  margin: 0;
  font-size: .92rem;
  font-weight: 600;
  text-align: center;
  color: var(--text);
}
