/* ============================================
   DIGITALT MAGASIN (homepage)
============================================ */
.mag {
  padding: 0 2.5rem 9rem;
  background: #fff;
}

.mag__header {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  max-width: 1000px;
  margin: 0 auto 1rem;
}

.mag__intro {
  text-align: center;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  color: var(--text-mid);
  margin-bottom: 3rem;
}

/* ---------- Book ---------- */
.mag__stage {
  position: relative;
  perspective: 2600px;
  display: flex;
  justify-content: center;
}

.mag__side {
  position: absolute;
  top: 50%;
  margin-top: -23px;
  z-index: 5;
}

.mag__side--prev { left: max(0px, calc(50% - min(470px, 46vw) - 66px)); }
.mag__side--next { right: max(0px, calc(50% - min(470px, 46vw) - 66px)); }

.mag__book {
  position: relative;
  width: min(940px, 92vw);
  aspect-ratio: 3 / 2;
  transform-style: preserve-3d;
  outline: none;
}

.mag__book::before {
  content: '';
  position: absolute;
  inset: 0;
  box-shadow: 0 30px 50px rgba(28, 25, 23, 0.2);
  transform: translateZ(-4px);
  pointer-events: none;
}

.mag__base,
.mag__leaf {
  position: absolute;
  top: 0;
  height: 100%;
  width: 50%;
}

.mag__base--left { left: 0; }
.mag__base--right { left: 50%; }

.mag__leaf {
  left: 50%;
  transform-origin: left center;
  transform-style: preserve-3d;
  transform: translateZ(var(--tz, 0px)) rotateY(0deg);
  transition: transform 0.95s cubic-bezier(0.55, 0.05, 0.25, 1);
}


.mag--no-anim .mag__leaf { transition: none !important; }

.mag__leaf.is-flipped { transform: translateZ(var(--tz, 0px)) rotateY(-180deg); }

.mag__face,
.mag__base {
  background: #fbfaf7;
  overflow: hidden;
}

.mag__face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.mag__face--back { transform: rotateY(180deg); }

/* spine shading */
.mag__face--front::after,
.mag__base--right::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(to right, rgba(0,0,0,0.16), rgba(0,0,0,0) 9%);
}

.mag__face--back::after,
.mag__base--left::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(to left, rgba(0,0,0,0.16), rgba(0,0,0,0) 9%);
}

/* ---------- Page contents ---------- */
.mag__photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mag__page-text {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(1.4rem, 4.2vw, 3.4rem) clamp(1.4rem, 4.6vw, 3.6rem);
}

.mag__num {
  font-family: var(--font-display);
  font-size: clamp(2.2rem, 6vw, 4.4rem);
  font-weight: 300;
  line-height: 1;
  color: var(--accent-gold);
  opacity: 0.35;
  margin-bottom: clamp(0.6rem, 1.6vw, 1.4rem);
}

.mag__cat {
  font-size: clamp(7.5px, 1vw, 9.5px);
  letter-spacing: 0.26em;
  text-transform: uppercase;
  color: var(--accent-gold);
  margin-bottom: clamp(0.4rem, 1vw, 0.9rem);
}

.mag__title {
  font-family: var(--font-display);
  font-size: clamp(1.3rem, 3.2vw, 2.5rem);
  font-weight: 300;
  line-height: 1.15;
  color: var(--text);
  margin-bottom: clamp(0.6rem, 1.4vw, 1.2rem);
}

.mag__rule {
  width: 36px;
  height: 1px;
  background: var(--accent-gold);
  opacity: 0.6;
  margin-bottom: clamp(0.6rem, 1.4vw, 1.2rem);
}

.mag__text {
  font-size: clamp(10px, 1.25vw, 13px);
  line-height: 1.8;
  color: var(--text-mid);
  max-width: 300px;
  margin-bottom: clamp(0.8rem, 2vw, 1.6rem);
}

.mag__link {
  align-self: flex-start;
  font-size: clamp(8px, 1vw, 10px);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-gold);
  padding-bottom: 3px;
  border-bottom: 1px solid var(--accent-gold);
  transition: opacity 0.2s;
}

.mag__link:hover { opacity: 0.6; }

/* cover */
.mag__cover {
  position: relative;
  height: 100%;
}

.mag__cover::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(to top, rgba(10, 8, 8, 0.78), rgba(10, 8, 8, 0.1) 60%);
}

.mag__cover-text {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  padding: clamp(1.2rem, 3.5vw, 2.8rem);
  color: #fff;
}

.mag__cover-text small {
  display: block;
  font-size: clamp(7px, 0.95vw, 9.5px);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  opacity: 0.8;
  margin-bottom: 0.6rem;
}

.mag__cover-text strong {
  display: block;
  font-family: var(--font-display);
  font-weight: 300;
  font-size: clamp(1.5rem, 3.6vw, 2.8rem);
  line-height: 1.1;
  margin-bottom: 0.9rem;
}

.mag__cover-text span {
  font-size: clamp(8px, 1vw, 10px);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  opacity: 0.85;
}

/* intro (left, closed) and end pages */
.mag__center {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}

.mag__center .mag__title { margin-bottom: 0.8rem; }

.mag__center .mag__text { margin-left: auto; margin-right: auto; }

.mag__btn {
  display: inline-block;
  font-size: clamp(8px, 1vw, 10px);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: #fff;
  background: var(--accent-gold);
  padding: 0.9em 1.8em;
  transition: background 0.2s;
}

.mag__btn:hover { background: var(--accent-gold-dark); }

/* ---------- Controls ---------- */
.mag__controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.8rem;
  margin-top: 2.6rem;
}

.mag__arrow {
  width: 46px;
  height: 46px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 1.1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, border-color 0.2s, opacity 0.2s;
}

.mag__arrow:hover:not(:disabled) {
  color: var(--accent-gold);
  border-color: var(--accent-gold);
}

.mag__arrow:disabled { opacity: 0.3; cursor: default; }

.mag__count {
  min-width: 140px;
  text-align: center;
  font-size: 10.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---------- Mobile fallback ---------- */
.mag__mobile { display: none; }

@media (max-width: 760px) {
  .mag { padding: 0 0 6rem; }
  .mag__header { padding: 0 1.5rem; }
  .mag__stage,
  .mag__controls { display: none; }

  .mag__mobile {
    display: flex;
    gap: 1rem;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    padding: 0 1.5rem 1rem;
    -webkit-overflow-scrolling: touch;
  }

  .mag-card {
    flex: 0 0 82%;
    scroll-snap-align: center;
    background: #fbfaf7;
    box-shadow: 0 14px 30px rgba(28, 25, 23, 0.12);
    display: flex;
    flex-direction: column;
  }

  .mag-card img {
    width: 100%;
    aspect-ratio: 4 / 4.6;
    object-fit: cover;
    display: block;
  }

  .mag-card .mag__page-text {
    padding: 1.4rem 1.4rem 1.8rem;
    height: auto;
    justify-content: flex-start;
  }

  .mag-card .mag__num { font-size: 2.2rem; }
  .mag-card .mag__title { font-size: 1.5rem; }
  .mag-card .mag__text { font-size: 12px; }
  .mag-card .mag__link { font-size: 9px; }
}

@media (prefers-reduced-motion: reduce) {
  .mag__leaf { transition-duration: 0.01s; }
}

/* MOBILE SPACING */
@media (max-width: 680px) {
  .mag { padding-bottom: 5rem; }
}

/* Mer luft mellan portfolio-rutnätet och magasinet */
.mag { margin-top: 5rem; }
@media (max-width: 760px) { .mag { margin-top: 3rem; } }

/* Siffror: tydligare bordeaux */
.mag__num { color: #6b3038; opacity: 0.5; }
