/* ========================================
   MOBILE BOOKS DESIGN SYSTEM
   Shared styles for books section mobile optimization
   Created: January 2026
   ======================================== */

/* ========================================
   MOBILE ONLY STYLES (max-width: 1023px)
   ======================================== */
@media (max-width: 1023px) {

  /* === HIDE MAIN NAV AND FOOTER ON BOOK PAGES === */
  body:has(.mobile-book-wrapper) #nav-placeholder,
  body:has(.mobile-book-wrapper) #mobileFooterNav,
  body:has(.mobile-book-wrapper) #footer-placeholder,
  body:has(.mobile-book-wrapper) .mobile-nav-bar,
  body:has(.mobile-book-wrapper) .pull-handle-area {
    display: none !important;
  }

  /* === WRAPPER === */
  .mobile-book-wrapper {
    display: block;
  }

  /* === BREADCRUMB ===
     Base styles now centralized in brand.css
     (mobile-book-breadcrumb, mobile-book-breadcrumb-inner)
     Only page-specific overrides should go here */

  /* === HEADER (Icon + Title Row) === */
  .mobile-book-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem 1rem;
    background: #F9F7F2;
  }
  .mobile-book-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: white;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
  }
  /* Icon shine animation */
  .mobile-book-icon::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255, 255, 255, 0.4) 50%, transparent 100%);
    background-size: 200% 100%;
    animation: iconShine 4s ease-in-out infinite;
    pointer-events: none;
    border-radius: inherit;
  }
  @keyframes iconShine {
    0%, 100% { background-position: -100% 0; }
    50% { background-position: 200% 0; }
  }
  .mobile-book-header-text {
    flex: 1;
    min-width: 0;
  }
  .mobile-book-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.25rem;
    font-weight: 700;
    color: #1C1D37;
    line-height: 1.2;
  }
  .mobile-book-subtitle {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.125rem;
  }

  /* === DESCRIPTION CARD === */
  .mobile-book-description {
    margin: 0 1rem 1rem;
    padding: 0.75rem;
    border-radius: 12px;
  }
  .mobile-book-description p {
    font-size: 0.75rem;
    line-height: 1.6;
    color: #4b5563;
    margin: 0;
  }

  /* === STATS ROW (3 columns) === */
  .mobile-book-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    margin: 0 1rem 1rem;
  }
  .mobile-book-stat {
    text-align: center;
    padding: 0.5rem 0.25rem;
    border-radius: 8px;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.06);
  }
  .mobile-book-stat-value {
    font-size: 1rem;
    font-weight: 700;
    color: #1C1D37;
  }
  .mobile-book-stat-label {
    font-size: 0.6875rem;
    color: #6b7280;
    margin-top: 0.125rem;
  }

  /* === CTA BUTTON === */
  .mobile-book-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin: 0 1rem 1.5rem;
    padding: 14px 28px;
    border-radius: 12px;
    color: white;
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 600;
    transition: transform 0.1s ease;
  }
  .mobile-book-cta:active {
    transform: scale(0.98);
  }
  .mobile-book-cta svg {
    width: 16px;
    height: 16px;
  }

  /* === SECTION LABEL === */
  .mobile-book-section-label {
    padding: 0 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #6b7280;
  }

  /* === CHAPTER/ITEM LIST === */
  .mobile-book-list {
    padding: 0 1rem 1rem;
  }
  .mobile-book-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 4px -1px rgba(28, 29, 55, 0.08), 0 2px 8px -2px rgba(28, 29, 55, 0.06);
    text-decoration: none;
    transition: transform 0.1s ease;
  }
  .mobile-book-item:active {
    transform: scale(0.98);
  }
  .mobile-book-item:last-child {
    margin-bottom: 0;
  }
  .mobile-book-item-num {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.6875rem;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 0 0 2px rgba(203, 163, 120, 0.3);
  }
  .mobile-book-item-content {
    flex: 1;
    min-width: 0;
  }
  .mobile-book-item-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 0.8125rem;
    color: #1C1D37;
    line-height: 1.3;
  }
  .mobile-book-item-meta {
    font-size: 0.6875rem;
    color: #9ca3af;
    margin-top: 0.125rem;
  }
  .mobile-book-item-arrow {
    width: 16px;
    height: 16px;
    color: #CBA378;
    flex-shrink: 0;
  }

  /* === HORIZONTAL SCROLL SECTION === */
  .mobile-book-scroll-section {
    padding: 1rem 0 1.5rem;
    background: #F9F7F2;
  }
  .mobile-book-scroll-section .mobile-book-section-label {
    color: #CBA378;
    letter-spacing: 0.05em;
  }
  .mobile-book-scroll-container {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding: 0 1rem;
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .mobile-book-scroll-container::-webkit-scrollbar {
    display: none;
  }
  .mobile-book-scroll-card {
    flex-shrink: 0;
    width: 200px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px -2px rgba(28, 29, 55, 0.1);
    text-decoration: none;
  }
  .mobile-book-scroll-card:active {
    transform: scale(0.97);
  }
  .mobile-book-scroll-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    flex-shrink: 0;
  }
  .mobile-book-scroll-text {
    flex: 1;
    min-width: 0;
  }
  .mobile-book-scroll-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 0.875rem;
    font-weight: 500;
    color: #1C1D37;
    line-height: 1.2;
  }
  .mobile-book-scroll-meta {
    font-size: 0.75rem;
    color: #9ca3af;
    margin-top: 0.125rem;
  }

  /* === BACK LINK === */
  .mobile-book-back {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1.5rem 1rem;
    font-size: 0.75rem;
    color: #9ca3af;
    text-decoration: none;
    background: #F9F7F2;
  }
  .mobile-book-back:hover {
    color: #CBA378;
  }
  .mobile-book-back svg {
    width: 14px;
    height: 14px;
  }

  /* ========================================
     CHAPTER/CONTENT PAGE SPECIFIC
     ======================================== */

  /* Sticky Header (44px) */
  .mobile-book-sticky-header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    height: 44px;
    padding: 0 1rem;
    background: #1C1D37;
    color: white;
  }
  .mobile-book-sticky-back {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    font-size: 0.75rem;
    margin-right: auto;
  }
  .mobile-book-sticky-back svg {
    width: 16px;
    height: 16px;
  }
  .mobile-book-sticky-title {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Title Section */
  .mobile-book-title-section {
    padding: 1rem;
    background: white;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  }
  .mobile-book-chapter-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.375rem;
    font-weight: 700;
    color: #1C1D37;
    line-height: 1.3;
  }

  /* View Toggle (Content | PDF) */
  .mobile-book-toggle {
    display: flex;
    justify-content: center;
    gap: 2rem;
    padding: 0.75rem 1rem;
    background: white;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  }
  .mobile-book-toggle-btn {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 0.875rem;
    color: #9ca3af;
    background: none;
    border: none;
    padding: 0.25rem 0;
    cursor: pointer;
    position: relative;
  }
  .mobile-book-toggle-btn.active {
    color: #CBA378;
  }
  .mobile-book-toggle-btn.active::after {
    content: '';
    position: absolute;
    bottom: -2px;
    left: 0;
    right: 0;
    height: 2px;
    background: #CBA378;
    border-radius: 1px;
  }

  /* Content Area */
  .mobile-book-content {
    padding: 1.5rem 1rem 6rem;
    background: white;
    min-height: calc(100vh - 200px);
  }
  .mobile-book-content-inner {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.0625rem;
    line-height: 1.8;
    color: #1C1D37;
  }
  .mobile-book-content-inner h2 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.25rem;
    font-weight: 600;
    margin: 2rem 0 1rem;
    color: #1C1D37;
  }
  .mobile-book-content-inner h3 {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1.125rem;
    font-weight: 600;
    margin: 1.5rem 0 0.75rem;
    color: #1C1D37;
  }
  .mobile-book-content-inner p {
    margin-bottom: 1.25rem;
  }
  .mobile-book-content-inner blockquote {
    margin: 1.25rem 0;
    padding: 0.875rem 1rem;
    background: rgba(203, 163, 120, 0.1);
    border-left: 3px solid #CBA378;
    font-style: italic;
    border-radius: 0 8px 8px 0;
  }
  .mobile-book-content-inner blockquote p {
    margin-bottom: 0;
  }
  .mobile-book-content-inner ul,
  .mobile-book-content-inner ol {
    margin: 1rem 0;
    padding-left: 1.5rem;
  }
  .mobile-book-content-inner li {
    margin-bottom: 0.5rem;
  }

  /* PDF View Panel */
  .mobile-book-pdf-panel {
    display: none;
    padding: 2rem 1rem 6rem;
    background: white;
    min-height: calc(100vh - 200px);
  }
  .mobile-book-pdf-panel.active {
    display: block;
  }
  .mobile-book-pdf-card {
    max-width: 280px;
    margin: 0 auto;
    text-align: center;
  }
  .mobile-book-pdf-icon {
    width: 70px;
    height: 90px;
    margin: 0 auto 1rem;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    color: white;
    background: linear-gradient(135deg, #dc2626, #b91c1c);
  }
  .mobile-book-pdf-name {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1rem;
    color: #1C1D37;
    margin-bottom: 1rem;
  }
  .mobile-book-pdf-actions {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
  }
  .mobile-book-pdf-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    text-decoration: none;
    transition: transform 0.1s ease;
  }
  .mobile-book-pdf-btn:active {
    transform: scale(0.98);
  }
  .mobile-book-pdf-btn.primary {
    background: #1C1D37;
    color: white;
  }
  .mobile-book-pdf-btn.secondary {
    background: rgba(28, 29, 55, 0.1);
    color: #1C1D37;
  }

  /* Bottom Navigation (Fixed, 56px) */
  .mobile-book-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    display: flex;
    height: 56px;
    background: white;
    border-top: 1px solid rgba(0, 0, 0, 0.1);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.05);
  }
  .mobile-book-nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 0.625rem;
    color: #6b7280;
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    transition: color 0.15s ease;
  }
  .mobile-book-nav-btn:active {
    background: rgba(0, 0, 0, 0.02);
  }
  .mobile-book-nav-btn.active {
    color: #CBA378;
  }
  .mobile-book-nav-btn svg {
    width: 20px;
    height: 20px;
  }
  .mobile-book-nav-btn.disabled {
    opacity: 0.3;
    pointer-events: none;
  }

  /* ========================================
     CHAPTER DRAWER
     ======================================== */
  .mobile-book-drawer {
    position: fixed;
    top: 0;
    right: -100%;
    width: 85%;
    max-width: 320px;
    height: 100%;
    z-index: 1000;
    background: #F9F7F2;
    transition: right 0.3s ease;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
  }
  .mobile-book-drawer.open {
    right: 0;
  }
  .mobile-book-drawer-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    background: white;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  }
  .mobile-book-drawer-icon {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    color: white;
    flex-shrink: 0;
  }
  .mobile-book-drawer-title {
    flex: 1;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 1rem;
    font-weight: 600;
    color: #1C1D37;
    line-height: 1.2;
  }
  .mobile-book-drawer-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    color: #6b7280;
    cursor: pointer;
    border-radius: 8px;
  }
  .mobile-book-drawer-close:active {
    background: rgba(0, 0, 0, 0.05);
  }
  .mobile-book-drawer-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  }
  .mobile-book-drawer-action {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.375rem;
    padding: 0.625rem;
    background: white;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 8px;
    font-size: 0.6875rem;
    font-weight: 500;
    color: #1C1D37;
    text-decoration: none;
  }
  .mobile-book-drawer-action:active {
    background: #F9F7F2;
  }
  .mobile-book-drawer-action svg {
    width: 14px;
    height: 14px;
  }
  .mobile-book-drawer-list {
    flex: 1;
    padding: 1rem;
    overflow-y: auto;
  }
  .mobile-book-drawer-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    margin-bottom: 0.5rem;
    background: white;
    border-radius: 8px;
    text-decoration: none;
    border: 1px solid transparent;
  }
  .mobile-book-drawer-item:active {
    background: #F9F7F2;
  }
  .mobile-book-drawer-item.current {
    border-color: #CBA378;
    background: rgba(203, 163, 120, 0.05);
  }
  .mobile-book-drawer-item-num {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.625rem;
    font-weight: 600;
    color: white;
    flex-shrink: 0;
  }
  .mobile-book-drawer-item-title {
    flex: 1;
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 0.8125rem;
    color: #1C1D37;
    line-height: 1.3;
  }
  .mobile-book-drawer-item.current .mobile-book-drawer-item-title {
    color: #CBA378;
  }

  /* Drawer Overlay */
  .mobile-book-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
  }
  .mobile-book-overlay.open {
    opacity: 1;
    pointer-events: auto;
  }

  /* ========================================
     AUTHOR HUB SPECIFIC
     ======================================== */
  .mobile-book-author-photo {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid white;
    box-shadow: 0 4px 12px rgba(28, 29, 55, 0.15);
  }
  .mobile-book-author-dates {
    font-size: 0.75rem;
    color: #6b7280;
    margin-top: 0.25rem;
  }
  .mobile-book-quick-facts {
    margin: 0 1rem 1rem;
    padding: 1rem;
    background: white;
    border-radius: 12px;
    border: 1px solid rgba(0, 0, 0, 0.06);
  }
  .mobile-book-quick-facts-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 0.875rem;
    font-weight: 600;
    color: #1C1D37;
    margin-bottom: 0.75rem;
  }
  .mobile-book-quick-facts-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }
  .mobile-book-quick-fact {
    text-align: center;
  }
  .mobile-book-quick-fact-value {
    font-size: 0.875rem;
    font-weight: 600;
    color: #1C1D37;
  }
  .mobile-book-quick-fact-label {
    font-size: 0.625rem;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  /* ========================================
     WORKS/BOOKS GRID (Author Hub)
     ======================================== */
  .mobile-book-works-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    padding: 0 1rem 1rem;
  }
  .mobile-book-work-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px -2px rgba(28, 29, 55, 0.1);
    text-decoration: none;
    transition: transform 0.1s ease;
  }
  .mobile-book-work-card:active {
    transform: scale(0.98);
  }
  .mobile-book-work-header {
    padding: 0.75rem;
    color: white;
  }
  .mobile-book-work-title {
    font-family: 'Playfair Display', Georgia, serif;
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.2;
  }
  .mobile-book-work-meta {
    font-size: 0.6875rem;
    opacity: 0.8;
    margin-top: 0.25rem;
  }
  .mobile-book-work-body {
    padding: 0.75rem;
  }
  .mobile-book-work-desc {
    font-size: 0.6875rem;
    color: #6b7280;
    line-height: 1.4;
  }

}

/* ========================================
   HIDE MOBILE ON DESKTOP
   ======================================== */
@media (min-width: 1024px) {
  .mobile-book-wrapper {
    display: none !important;
  }
}

/* ========================================
   UTILITY CLASSES
   ======================================== */
.view-panel {
  display: none;
}
.view-panel.active {
  display: block;
}
