/* Book page (/books/{id}/{slug}) */

:root {
  --green: #009c5d;
  --green-dark: #026d42;
  --green-hover: #03bb71;
  --green-tint: #eef8f3;
  --amber: #c26a05;
  --amber-tint: #fdf6ea;
  --ink: #0f172a;
  --muted: #5b6472;
  --line: #e5e7eb;
  --card: #fff;
  --page: #fbfbfb;
}

@font-face {
  font-family: "Inter Variable";
  src: url('/font/InterVariable.woff2') format('woff2');
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html {
  line-height: 1.15;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: "Inter Variable", sans-serif;
  background-color: var(--page);
  min-height: 100vh;
  padding-bottom: 90px;
  position: relative;
  color: var(--ink);
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  border-style: none;
}

button,
input,
textarea {
  font-family: inherit;
  font-size: 100%;
  line-height: 1.15;
  margin: 0;
}

[hidden] {
  display: none !important;
}

/* Feedback modal inputs (the modal itself is styled in footer-header.css) */
.text-input,
textarea {
  display: block;
  outline: 0;
  padding: 10px 15px;
  border: 1px solid rgb(139, 140, 141);
  border-radius: 6px;
  box-shadow: rgb(209, 213, 219) 0px 0px 0px 1px inset, rgba(202, 202, 202, 0.05) 0px 1px 2px 0px;
  transition: all .3s ease;
  resize: none;
}

.text-input:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: rgb(255, 255, 255) 0px 0px 0px 0px inset, var(--green) 0px 0px 0px 2px inset;
}

/* Page layout */

.book-page {
  display: block;
  max-width: 1000px;
  margin: 0 auto;
  padding: 28px 40px 60px;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: nowrap;
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 14px;
  color: var(--muted);
}

.breadcrumbs li {
  display: flex;
  align-items: center;
  min-width: 0;
}

/* Home and Popular Books keep their width; only the current page's title shrinks and gets an ellipsis */
.breadcrumbs li:not(:last-child) {
  flex-shrink: 0;
  white-space: nowrap;
}

.breadcrumbs li + li::before {
  content: "/";
  margin: 0 8px;
  color: #b0b6bf;
}

.breadcrumbs a:hover {
  color: var(--green-dark);
  text-decoration: underline;
}

.breadcrumbs [aria-current] {
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Hero */

.page-hero {
  display: flex;
  align-items: center;
  column-gap: 28px;
  margin: 28px 0 40px;
}

.page-hero .hero-cover {
  width: 120px;
  height: 180px;
  min-width: 120px;
  object-fit: cover;
  border-radius: 4px;
  box-shadow: 0 10px 24px -8px rgba(15, 23, 42, 0.35), 0 2px 4px rgba(15, 23, 42, 0.12);
}

.page-hero .hero-eyebrow {
  display: inline-block;
  margin: 0 0 10px;
  padding: 4px 10px;
  border-radius: 999px;
  background-color: var(--green-tint);
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.page-hero h1 {
  margin: 0 0 14px;
  font-size: 36px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.page-hero .hero-intro {
  margin: 0;
  font-size: 17px;
  line-height: 1.6;
  color: #334155;
}

/* Book list */

.book-list {
  display: flex;
  flex-direction: column;
  row-gap: 24px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.book-card {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  column-gap: 36px;
  padding: 28px;
  background-color: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  scroll-margin-top: 20px;
}

.book-media {
  display: flex;
  flex-direction: column;
  row-gap: 16px;
}

.book-cover {
  position: relative;
  width: 180px;
  aspect-ratio: 2 / 3;
  border-radius: 6px;
  overflow: hidden;
  background-color: #f3f4f6;
  box-shadow: 0 10px 22px -10px rgba(15, 23, 42, 0.45), 0 1px 3px rgba(15, 23, 42, 0.12);
  display: flex;
  justify-content: center;
  align-items: center;
}

.book-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background-color: #fff;
}

.book-rank {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  border-radius: 999px;
  background-color: var(--green);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  line-height: 30px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.cover-not-available {
  display: none;
  width: 100%;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #f3f4f6;
}

.cover-not-available svg {
  width: 45%;
  height: auto;
}

.cover-not-available p {
  margin: 12px 0 0;
  text-transform: uppercase;
  text-align: center;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: #6b7280;
}

.store-links {
  display: flex;
  flex-direction: column;
  row-gap: 10px;
}

.store-btn {
  display: block;
  padding: 10px 12px;
  border: 2px solid var(--green);
  border-radius: 8px;
  color: var(--green-dark);
  font-size: 15px;
  font-weight: 600;
  line-height: 20px;
  text-align: center;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.store-btn:hover {
  background-color: var(--green-tint);
}

.store-btn-primary {
  background-color: var(--green);
  color: #fff;
}

.store-btn-primary:hover {
  background-color: var(--green-hover);
  border-color: var(--green-hover);
}

.store-btn:focus-visible,
.cta-btn:focus-visible,
.read-more-btn:focus-visible {
  outline: 3px solid rgba(0, 156, 93, 0.35);
  outline-offset: 2px;
}

.book-content {
  min-width: 0;
}

.book-heading .book-title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.book-heading .book-author {
  margin: 6px 0 0;
  font-size: 16px;
  color: var(--muted);
}

.book-heading .book-author span {
  color: var(--ink);
  font-weight: 500;
}

.book-details {
  margin-top: 16px;
}

.book-description {
  margin: 0;
  font-size: 16px;
  line-height: 1.65;
  color: #1e293b;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 5;
  line-clamp: 5;
  overflow: hidden;
}

.book-description.expanded {
  display: block;
  -webkit-line-clamp: unset;
  line-clamp: none;
}

.read-more-btn {
  margin-top: 6px;
  padding: 0;
  border: none;
  background: none;
  color: var(--green-dark);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.read-more-btn:hover {
  text-decoration: underline;
}

.book-note {
  margin-top: 16px;
  padding: 14px 16px;
  border-left: 3px solid var(--green);
  border-radius: 0 8px 8px 0;
  background-color: var(--green-tint);
}

.book-note h3 {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--green-dark);
}

.book-note p {
  margin: 0;
  font-size: 15px;
  line-height: 1.6;
  color: #1e293b;
}

.book-note.note-different {
  border-left-color: var(--amber);
  background-color: var(--amber-tint);
}

.book-note.note-different h3 {
  color: var(--amber);
}

/* Call to action */

.cta {
  margin-top: 48px;
  padding: 36px 28px;
  border-radius: 14px;
  background-color: var(--green-tint);
  text-align: center;
}

.cta h2 {
  margin: 0 0 8px;
  font-size: 24px;
  font-weight: 700;
}

.cta p {
  margin: 0 0 20px;
  font-size: 16px;
  line-height: 1.5;
  color: #334155;
}

.cta-btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 8px;
  background-color: var(--green);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}

.cta-btn:hover {
  background-color: var(--green-hover);
}

/* Share */

.share-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 48px;
  text-align: center;
}

.share-section p {
  margin: 0 0 20px;
}

.share-section .share-title {
  margin: 0 0 8px;
  font-size: 18px;
  font-weight: 600;
}

.social-btns {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.social-share-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.14), 0 1px 4px rgba(0, 0, 0, 0.28);
  transition: all .2s ease;
}

.social-share-btn:hover {
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 0, 0, 0.4);
}

.social-share-btn svg {
  display: block;
  width: 16px;
  height: 16px;
  backface-visibility: hidden;
}

.social-share-btn.facebook-share-btn { background-color: #3e68c0; }
.social-share-btn.x-share-btn { background-color: #3e3e3e; }
.social-share-btn.reddit-share-btn { background-color: #ff5c1f; }
.social-share-btn.linkedin-share-btn { background-color: #0275b6; }
.social-share-btn.whatsapp-share-btn { background-color: #13d25a; }
.social-share-btn.email-share-btn { background-color: #f3cd0e; }

.social-share-btn.facebook-share-btn svg,
.social-share-btn.reddit-share-btn svg {
  width: 19px;
  height: 19px;
}

.social-share-btn.linkedin-share-btn svg,
.social-share-btn.whatsapp-share-btn svg {
  width: 25px;
  height: 25px;
}

/* Responsive */

@media (max-width: 800px) {
  .book-page {
    padding: 24px 24px 48px;
  }

  .page-hero h1 {
    font-size: 30px;
  }

  .book-card {
    grid-template-columns: 150px minmax(0, 1fr);
    column-gap: 24px;
    padding: 22px;
  }

  .book-cover {
    width: 150px;
  }

  .store-btn {
    font-size: 14px;
    padding: 9px 8px;
  }
}

/* Mobile: cover, then title and author, then the store buttons, then the rest */
@media (max-width: 640px) {
  .book-page {
    padding: 20px 16px 40px;
  }

  .page-hero {
    column-gap: 18px;
    align-items: flex-start;
    margin: 20px 0 28px;
  }

  .page-hero .hero-cover {
    width: 84px;
    height: 126px;
    min-width: 84px;
  }

  .page-hero h1 {
    font-size: 24px;
  }

  .page-hero .hero-intro {
    font-size: 15px;
  }

  .book-list {
    row-gap: 18px;
  }

  .book-card {
    display: flex;
    flex-direction: column;
    padding: 22px 18px;
  }

  .book-media,
  .book-content {
    display: contents;
  }

  .book-cover {
    order: 1;
    width: 160px;
    align-self: center;
  }

  .book-heading {
    order: 2;
    margin-top: 18px;
    text-align: center;
  }

  .store-links {
    order: 3;
    flex-direction: row;
    column-gap: 10px;
    margin-top: 16px;
  }

  .store-links .store-btn {
    flex: 1 1 0;
  }

  .book-details {
    order: 4;
    margin-top: 18px;
  }

  .book-heading .book-title {
    font-size: 21px;
  }

  .book-description {
    font-size: 15px;
  }

  .cta {
    padding: 28px 18px;
  }

  .cta h2 {
    font-size: 21px;
  }
}

@media (max-width: 360px) {
  .store-links {
    flex-direction: column;
    row-gap: 10px;
  }
}
