/* ==========================================================================
   Japakeh Post - Modern Indonesian News Portal Stylesheet
   PT Japakeh Media Nusantara
   Brand Concept: Ruby Crimson (#C8102E), Putih Bersih (#FFFFFF), Slate Black (#0F172A)
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=Merriweather:ital,wght@0,300;0,400;0,700;1,300&display=swap');

:root {
  --japakeh-black: #0F172A;
  --japakeh-red: #C8102E;
  --japakeh-red-hover: #991B1B;
  --japakeh-dark: #1E293B;
  --japakeh-light: #F1F5F9;
  --japakeh-rose-soft: #FFF1F2;
  --buser-black: #0F172A;
  --buser-red: #C8102E;
  --buser-red-hover: #991B1B;
  --buser-dark: #1E293B;
  --buser-light: #F1F5F9;
  --buser-gray-border: #E2E8F0;
  --font-sans: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-serif: 'Merriweather', Georgia, Cambria, serif;
}

/* Base resets & typography */
html {
  scroll-behavior: smooth;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--buser-light);
  color: var(--buser-black);
  overflow-x: hidden;
}

/* Custom scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: #F1F1F1;
}
::-webkit-scrollbar-thumb {
  background: #C1C1C1;
  border-radius: 2px;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--buser-red);
}

/* Horizontal Category Navigation Scrollbar (Hidden for clean mobile UX) */
.no-scrollbar::-webkit-scrollbar {
  display: none;
}
.no-scrollbar {
  -ms-overflow-style: none;
  scrollbar-width: none;
}

/* Headline clamps */
.line-clamp-1 {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.line-clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.line-clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Breaking News Ticker Animation */
.ticker-wrapper {
  overflow: hidden;
  white-space: nowrap;
  position: relative;
  width: 100%;
}
.ticker-track {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  will-change: transform;
}
.ticker-track.css-marquee {
  animation: tickerSlide 35s linear infinite;
}
.ticker-wrapper:hover .ticker-track.css-marquee {
  animation-play-state: paused;
}

@keyframes tickerSlide {
  0% {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(-50%, 0, 0);
  }
}

/* Flashing Pulse for Breaking Badge */
@keyframes pulseDot {
  0%, 100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.3;
    transform: scale(1.3);
  }
}
.pulse-badge {
  animation: pulseDot 1.4s ease-in-out infinite;
}

/* Reading Progress Bar on Article Details (Brand Red) */
#reading-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 3.5px;
  background: var(--buser-red, #DC2626);
  width: 0%;
  z-index: 100;
  transition: width 0.1s ease-out;
}

/* Brand Stripe Signature (Merah & Hitam) */
.brand-accent-stripe {
  display: flex;
  height: 4px;
  width: 100%;
}
.brand-accent-stripe > .stripe-red {
  background-color: var(--buser-red);
  flex: 7;
}
.brand-accent-stripe > .stripe-black {
  background-color: var(--buser-black);
  flex: 3;
}

/* Article Body Typography Variations */
.article-text-sm {
  font-size: 1.0rem !important;
  line-height: 1.8 !important;
}
.article-text-md {
  font-size: 1.15rem !important;
  line-height: 1.95 !important;
}
.article-text-lg {
  font-size: 1.3rem !important;
  line-height: 2.1 !important;
}

/* Editorial Blockquote */
.editorial-quote {
  position: relative;
  padding: 1.25rem 1.5rem;
  border-left: 4px solid var(--buser-red);
  background: #FFF1F2;
  border-radius: 0 0.75rem 0.75rem 0;
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.15rem;
  line-height: 1.7;
}

/* Card Hover Shadows & Micro-interactions */
.news-card-hover {
  transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
}
.news-card-hover:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px -6px rgba(15, 23, 42, 0.09);
  border-color: #FECDD3 !important;
}
.news-card-hover:hover .news-headline {
  color: var(--buser-red);
}

/* Drawer Transitions */
.drawer-backdrop {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.drawer-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.drawer-panel {
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.drawer-panel.active {
  transform: translateX(0);
}

/* Right-side Modal/Drawer for Bookmarks */
.bookmark-panel {
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.bookmark-panel.active {
  transform: translateX(0);
}

/* Category Tab Active Indicator */
.category-tab.active {
  color: #FFFFFF;
  background-color: var(--buser-red);
  font-weight: 700;
  border-radius: 9999px;
}

/* Section Bar Heading Accents */
.section-heading-bar {
  position: relative;
  display: flex;
  align-items: center;
  border-bottom: 1.5px solid #E2E8F0;
  padding-bottom: 0.5rem;
}
.section-heading-bar::after {
  content: '';
  position: absolute;
  bottom: -1.5px;
  left: 0;
  width: 32px;
  height: 2px;
  border-radius: 9999px;
  background-color: var(--buser-red);
}
.section-heading-bar.accent-black::after {
  background-color: var(--buser-black);
}

#category-scroll-nav {
  justify-content: safe center;
}

/* Modern Top Slider (Carousel Berita Utama) */
#top-slider {
  outline: none;
}
#top-slider:focus-visible {
  box-shadow: 0 0 0 2px var(--buser-red);
}
.top-slider-track {
  will-change: transform;
}
.top-slider-dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background-color: rgba(255, 255, 255, 0.5);
  border: none;
  padding: 0;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.top-slider-dot:hover {
  background-color: #FFFFFF;
  transform: scale(1.2);
}
.top-slider-dot.active {
  width: 24px;
  background-color: var(--buser-red, #C8102E);
  border-radius: 9999px;
  box-shadow: 0 0 12px rgba(200, 16, 46, 0.8);
}

/* Print styles */
@media print {
  header, footer, .ticker-wrapper, .share-box, #reading-progress-bar, #mobile-drawer, #bookmark-modal {
    display: none !important;
  }
  body {
    background: #FFF;
    color: #000;
  }
}

/* ==========================================================================
   Mobile-First Adaptations (< 1024px)
   ========================================================================== */
@media (max-width: 1023.98px) {
  html {
    font-size: 14px;
  }
}

@media (min-width: 1024px) {
  html {
    font-size: 16px;
  }
  .max-w-7xl {
    max-width: 80rem;
  }
}

/* Modal Popup & Fade Animations */
@keyframes scaleUp {
  0% { transform: scale(0.94); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.animate-scaleUp {
  animation: scaleUp 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}
.animate-fadeIn {
  animation: fadeIn 0.2s ease-out forwards;
}

/* Mobile Hero Carousel Pill Dots */
.hero-dot-indicator {
  height: 6px;
  width: 6px;
  border-radius: 9999px;
  background-color: rgba(255, 255, 255, 0.5);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}
.hero-dot-indicator:hover {
  background-color: #FFFFFF;
}
.hero-dot-indicator.active {
  width: 18px;
  background-color: #E60000;
  border-radius: 9999px;
  box-shadow: 0 0 8px rgba(230, 0, 0, 0.8);
}

/* Harmonized Video, Foto & Editorial Card Dimensions (Horizontal Landscape Orientation for Mobile) */
.special-media-thumb {
  position: relative !important;
  aspect-ratio: 16 / 10 !important;
  width: 100% !important;
  overflow: hidden !important;
  border-radius: 0.375rem !important;
  background-color: #0f172a !important;
}

@media (min-width: 640px) {
  .special-media-thumb {
    aspect-ratio: 16 / 9 !important;
  }
}

.special-media-thumb > img {
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  display: block !important;
}

#home-foto-grid,
#home-video-grid,
#home-foto-video-editorial-grid {
  width: 100% !important;
  display: grid !important;
  max-width: 42rem !important;
}

/* Video & Foto Modal Dialogs (Long / Tall Architecture) */
#video-modal .modal-dialog-tall,
#foto-modal .modal-dialog-tall,
#video-modal > div.relative,
#foto-modal > div.relative {
  height: 94vh !important;
  min-height: 90vh !important;
  max-height: 97vh !important;
  display: flex !important;
  flex-direction: column !important;
}

@media (min-width: 640px) {
  #video-modal .modal-dialog-tall,
  #foto-modal .modal-dialog-tall,
  #video-modal > div.relative,
  #foto-modal > div.relative {
    height: 88vh !important;
    min-height: 85vh !important;
    max-height: 95vh !important;
  }
}

#video-modal-player-container,
.foto-display-container {
  height: 40vh !important;
  min-height: 230px !important;
  max-height: 45vh !important;
  width: 100% !important;
  background-color: #000000 !important;
  flex-shrink: 0 !important;
}

@media (min-width: 640px) {
  #video-modal-player-container,
  .foto-display-container {
    height: 48vh !important;
    min-height: 300px !important;
    max-height: 52vh !important;
  }
}

#video-modal-player-container iframe {
  width: 100% !important;
  height: 100% !important;
  border: 0 !important;
  display: block !important;
}

.foto-display-container img {
  max-width: 100% !important;
  max-height: 100% !important;
  object-fit: contain !important;
  margin: auto !important;
  display: block !important;
}

/* ==========================================================================
   Article Photo Gallery & Lightbox Styles (Slider & Grid Synchronized)
   ========================================================================== */
.gallery-thumb-item {
  transition: transform 0.2s ease, opacity 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.gallery-thumb-item.active {
  border-color: #C8102E !important;
  box-shadow: 0 0 0 2px rgba(200, 16, 46, 0.45);
  transform: scale(1.03);
  opacity: 1 !important;
}

#gallery-main-img {
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

#gallery-main-img.slide-fade {
  opacity: 0.35;
}

#gallery-lightbox-modal {
  animation: fadeInLightbox 0.25s ease-out;
}

@keyframes fadeInLightbox {
  from {
    opacity: 0;
    transform: scale(0.985);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ==========================================================================
   Tabaca Editorial Layout Elements (Client Article View)
   ========================================================================== */

/* Block Title with Left Accent Bar */
.block-title-tabaca {
  position: relative;
  display: flex;
  align-items: center;
  border-left: 4px solid var(--buser-red);
  padding: 2px 0 2px 10px;
  margin-bottom: 16px;
  line-height: 1.3;
}

.block-title-tabaca .title {
  font-size: 16px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--buser-black);
  letter-spacing: -0.01em;
}

/* Widget Title with Dashed Line Separator */
.widget-title-dashed {
  font-size: 15px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  margin-bottom: 16px;
  position: relative;
  display: flex;
  gap: 12px;
  align-items: center;
  white-space: nowrap;
  color: var(--buser-black);
}

.widget-title-dashed::after {
  content: "";
  height: 1px;
  display: inline-block;
  width: 100%;
  border-top: 1px dashed #CBD5E1;
}

/* Sidebar Popular News with Ranked Counter (1 to 5, Tabaca Style) */
.list-popular-tabaca {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 10px 4px;
  border-radius: 8px;
  transition: background-color 0.15s ease;
}

.list-popular-tabaca:hover {
  background-color: #F8FAFC;
}

.list-popular-tabaca + .list-popular-tabaca {
  border-top: 1px dashed #E2E8F0;
}

.popular-counter {
  display: block;
  flex-shrink: 0;
  font-family: 'Outfit', 'Inter', -apple-system, sans-serif;
  font-size: 20px;
  font-weight: 900;
  line-height: 1.1;
  width: 24px;
  text-align: center;
  color: var(--buser-red);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  padding-top: 1px;
}

.popular-counter.rank-other {
  color: #94A3B8;
}

/* Sidebar Thumbnail List (Thumb on Left, Title + Meta on Right) */
.list-thumb-item {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  column-gap: 12px;
  align-items: center;
  padding: 11px 4px;
  border-radius: 8px;
  transition: background-color 0.15s ease;
}

.list-thumb-item:hover {
  background-color: #F8FAFC;
}

.list-thumb-item + .list-thumb-item {
  border-top: 1px dashed #E2E8F0;
}

/* Recent News Horizontal List (Berita Terkini bawah artikel) */
.recent-post-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  column-gap: 14px;
  align-items: center;
  padding: 13px 6px;
  border-bottom: 1px solid #F1F5F9;
  border-radius: 12px;
  transition: background-color 0.15s ease;
}

.recent-post-row:hover {
  background-color: #F8FAFC;
}

@media (min-width: 640px) {
  .recent-post-row {
    grid-template-columns: 148px minmax(0, 1fr);
    column-gap: 18px;
    padding: 14px 8px;
  }
}

.recent-post-row:last-child {
  border-bottom: none;
}

/* Post Category Soft Pill */
.post-category-pill {
  background-color: #FFF1F2;
  color: var(--buser-red);
  padding: 2.5px 8px;
  font-size: 10px;
  font-weight: 800;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: inline-block;
  line-height: 1.2;
}

/* --------------------------------------------------------------------------
   Media Embeds in Article Body Content (Image & Video)
   -------------------------------------------------------------------------- */
#article-body-content figure {
  margin: 1.5rem auto;
  text-align: center;
}
#article-body-content figure img,
#article-body-content img {
  max-width: 100%;
  height: auto;
  border-radius: 0.5rem;
  margin: 0 auto;
  display: block;
}
#article-body-content figcaption {
  font-size: 0.8125rem;
  color: #64748b;
  margin-top: 0.5rem;
  font-style: italic;
  text-align: center;
}
#article-body-content .aspect-video {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 1.5rem 0;
  border-radius: 0.5rem;
  overflow: hidden;
  background-color: #000;
}
#article-body-content .aspect-video iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

/* --------------------------------------------------------------------------
   Japakeh Post Link Card (FR-13) — unfurl preview di isi berita
   -------------------------------------------------------------------------- */
#article-body-content a:not(.jp-link-card) {
  color: #E60000;
  text-decoration: underline;
  text-underline-offset: 2px;
}
#article-body-content a:not(.jp-link-card):hover {
  color: #991B1B;
}
.jp-link-card {
  display: flex;
  gap: 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 12px;
  margin: 16px 0;
  text-decoration: none !important;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  overflow: hidden;
  min-height: 44px;
}
.jp-link-card:hover,
.jp-link-card:focus-visible {
  border-color: #E60000;
  box-shadow: 0 4px 14px -4px rgba(230, 0, 0, 0.18);
  outline: none;
}
.jp-link-card__img {
  width: 112px;
  height: 76px;
  object-fit: cover;
  border-radius: 8px;
  flex-shrink: 0;
  background: #f1f5f9;
  display: block;
}
.jp-link-card.no-img .jp-link-card__img {
  display: none;
}
.jp-link-card__body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
  justify-content: center;
}
.jp-link-card__site {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #64748b;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 2px;
}
.jp-link-card__site img {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  object-fit: contain;
  flex-shrink: 0;
}
.jp-link-card__title {
  font-weight: 800;
  color: #0f172a;
  font-size: 0.95rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.jp-link-card__desc {
  font-size: 13px;
  color: #475569;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 2px;
}
@media (max-width: 420px) {
  .jp-link-card {
    gap: 10px;
    padding: 10px;
  }
  .jp-link-card__img {
    width: 88px;
    height: 64px;
  }
}

/* Editor admin: kartu tampil sebagai blok agar mudah diklik/diedit */
#editor-body .jp-link-card {
  cursor: pointer;
}
#editor-body .jp-link-card.jp-link-selected {
  outline: 2px solid #D71920;
  outline-offset: 2px;
}

/* Circular Social Share Buttons (Refined & Balanced) */
.post-share-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #FFFFFF !important;
  transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.18s ease, opacity 0.15s ease;
  flex-shrink: 0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.12);
}

@media (max-width: 640px) {
  .post-share-circle {
    width: 28px;
    height: 28px;
  }
  .post-share-circle svg {
    width: 13px;
    height: 13px;
  }
}

.post-share-circle:hover {
  transform: translateY(-2px);
  box-shadow: 0 3px 8px rgba(15, 23, 42, 0.2);
  opacity: 0.95;
}
