/* ============================================
   HERTHA METALS PRESS FLIPBOOK
   VERSION 1.2 - NORMAL FEATURED IMAGE
============================================ */

.hpf-book {
  --hpf-bg: #09070E;
  --hpf-cover: #110E17;
  --hpf-white: #F2F0F5;
  --hpf-muted: #A8A4B5;
  --hpf-orange: #FF6A1F;

  width: 100%;
  padding: 24px 0;
  color: var(--hpf-white);
  font-family: 'IBM Plex Sans', Arial, sans-serif;
  box-sizing: border-box;
}

.hpf-book,
.hpf-book * {
  box-sizing: border-box;
}

/* ============================================
   BOOK MAIN LAYOUT
============================================ */

.hpf-spread {
  max-width: 1120px;
  height: 600px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  perspective: 2400px;
  isolation: isolate;
}

.hpf-left,
.hpf-right {
  position: relative;
  min-width: 0;
  background: var(--hpf-cover);
  border: 1px solid #29232F;
}

/* ============================================
   LEFT BOOK COVER
============================================ */

.hpf-left {
  padding: 36px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  z-index: 1;
}

.hpf-brand {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.42em;
  color: var(--hpf-white);
}

.hpf-cover-title {
  position: relative;
  z-index: 1;
}

.hpf-kicker,
.hpf-instruction,
.hpf-small {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  letter-spacing: 0.16em;
}

.hpf-kicker {
  color: var(--hpf-orange);
  font-weight: 700;
}

.hpf-book .hpf-cover-title h2 {
  font-size: clamp(38px, 4.4vw, 67px);
  line-height: 0.98;
  margin: 20px 0 0;
  padding: 0;
}

.hpf-instruction {
  color: #777089;
}


/* ============================================
   RIGHT BOOK PAGES
============================================ */

.hpf-right {
  z-index: 3;
  perspective: 2400px;
  transform-style: preserve-3d;
}

.hpf-leaf {
  position: absolute;
  inset: 1px;
  transform-style: preserve-3d;
  transform-origin: left center;
  transition: transform 0.85s cubic-bezier(
    0.23,
    0.75,
    0.2,
    1
  );
  cursor: pointer;
  outline-offset: 4px;
}

.hpf-leaf.hpf-flipped {
  transform: rotateY(-180deg);
}

.hpf-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #0D0A12;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.hpf-front {
  transform: translateZ(0.5px);
  background: #0D0A12;
}

/* ============================================
   NORMAL FEATURED IMAGE
   NO OVERLAY / NO FILTER
============================================ */

.hpf-book .hpf-image {
  width: 100%;
  height: 300px;
  flex: 0 0 300px;
  display: block;
  position: relative;
  overflow: hidden;
  background: #15101C;
  padding: 0;
  margin: 0;
}

/* Real HTML image from WordPress Featured Image */

.hpf-book .hpf-image img,
.hpf-book .hpf-image .hpf-featured-img {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 100%;
  max-height: none;
  object-fit: cover;
  object-position: center center;
}

/* ============================================
   ARTICLE DETAILS
============================================ */

.hpf-article {
  flex: 1;
  min-height: 0;
  padding: 22px 26px 25px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 14px;
  overflow: hidden;
}

.hpf-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  color: var(--hpf-muted);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px;
  line-height: 1.5;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.hpf-meta span:last-child {
  text-align: right;
}

.hpf-meta .hpf-orange {
  color: var(--hpf-orange);
}

/* ============================================
   ARTICLE HEADLINE
============================================ */

.hpf-book .hpf-article h3 {
  font-size: clamp(19px, 2.15vw, 31px);
  line-height: 1.12;
}

/* ============================================
   ARTICLE LINKS
============================================ */

.hpf-face a {
  display: inline-block;
  width: fit-content;
  position: relative;
  z-index: 4;
  color: #FFFFFF;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  line-height: 1.4;
  letter-spacing: 0.14em;
  text-decoration: none;
}

.hpf-face a:hover {
  color: var(--hpf-orange);
}

/* ============================================
   BACK PAGE
============================================ */

.hpf-back {
  transform: rotateY(180deg) translateZ(0.5px);
  padding: 36px;
  justify-content: space-between;
  opacity: 1;
}

.hpf-small {
  color: var(--hpf-muted);
}

.hpf-back-title {
  font-family: Arial, Helvetica, sans-serif;
  font-size: clamp(30px, 3.5vw, 52px);
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
  margin-top: 20px;
  overflow-wrap: break-word;
}

.hpf-back a {
  color: var(--hpf-orange);
}

/* Prevent old cover text showing beneath turned pages */

.hpf-book.hpf-has-turned .hpf-left > .hpf-brand,
.hpf-book.hpf-has-turned .hpf-left > .hpf-cover-title,
.hpf-book.hpf-has-turned .hpf-left > .hpf-instruction {
  visibility: hidden;
}

/* ============================================
   NAVIGATION
============================================ */

.hpf-nav {
  max-width: 1120px;
  margin: 22px auto 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.hpf-nav button {
  background: transparent;
  color: var(--hpf-white);
  border: 1px solid #483B54;
  border-radius: 0;
  padding: 12px 20px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  cursor: pointer;
}

.hpf-nav button:hover:not(:disabled) {
  background: #6B3FA8;
}

.hpf-nav button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.hpf-counter {
  color: var(--hpf-muted);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  letter-spacing: 0.1em;
}

.hpf-empty {
  padding: 16px;
  border: 1px solid #777;
}

/* ============================================
   TABLET
============================================ */

@media (max-width: 1024px) {

  .hpf-spread {
    height: 630px;
  }

  .hpf-left {
    padding: 28px;
  }

  .hpf-book .hpf-image {
    height: 270px;
    min-height: 270px;
    max-height: 270px;
    flex-basis: 270px;
  }

  .hpf-article {
    padding: 20px;
  }

  .hpf-book .hpf-cover-title h2 {
    font-size: clamp(36px, 5vw, 54px);
  }

  .hpf-book .hpf-article h3 {
    font-size: clamp(18px, 2.5vw, 27px);
  }
}

/* ============================================
   MOBILE
============================================ */

@media (max-width: 767px) {

  .hpf-book {
    padding: 14px 0;
  }

  .hpf-spread {
    height: auto;
    display: flex;
    flex-direction: column;
    perspective: none;
  }

  .hpf-left {
    min-height: 260px;
    padding: 24px;
    gap: 30px;
  }

  .hpf-book .hpf-cover-title h2 {
    font-size: clamp(35px, 10vw, 49px);
  }

  .hpf-right {
    height: 500px;
    perspective: 1400px;
  }

  .hpf-leaf {
    transform-origin: center center;
    transition:
      transform 0.55s ease,
      opacity 0.55s ease;
  }

  .hpf-leaf.hpf-flipped {
    transform: rotateY(-90deg);
    opacity: 0;
    pointer-events: none;
  }

  .hpf-book .hpf-image {
    height: 230px;
    min-height: 230px;
    max-height: 230px;
    flex-basis: 230px;
  }

  .hpf-article {
    padding: 18px 20px;
    gap: 10px;
  }

  .hpf-book .hpf-article h3 {
    font-size: clamp(18px, 5vw, 26px);
    line-height: 1.14;
  }

  .hpf-meta {
    font-size: 9px;
  }

  .hpf-nav button {
    padding: 10px;
    font-size: 10px;
  }

  .hpf-book.hpf-has-turned .hpf-left > .hpf-brand,
  .hpf-book.hpf-has-turned .hpf-left > .hpf-cover-title,
  .hpf-book.hpf-has-turned .hpf-left > .hpf-instruction {
    visibility: visible;
  }
}

/* ============================================
   ACCESSIBILITY
============================================ */

@media (prefers-reduced-motion: reduce) {

  .hpf-leaf {
    transition: none;
  }

}
