/* ==========================================================================
   Mahakarya Batu Nusantara — Editorial Magazine theme
   Palet: terang paper-like, serif elegan. Semua warna dari variabel.
   ========================================================================== */

:root {
  --paper: #F7F3EA;
  --paper-deep: #EFE7D5;
  --ink: #2B2118;
  --muted: #6B5D4B;
  --accent: #9C4A2B;
  --do-green: #3F6212;
  --rule: #E0D6C2;
  --white: #FFFFFF;
  --serif: 'Playfair Display', Georgia, serif;
  --body: 'Source Serif 4', Georgia, serif;
  --max-read: 72ch;
  --nav-h: 48px;
}

/* ---------- Reset & dasar ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: 4.5rem;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero-slide { transition: none; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: clamp(1.0625rem, 0.95rem + 0.55vw, 1.1875rem);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1.5px; }
a:hover { color: var(--ink); }

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.15;
  margin: 0 0 0.75em;
  text-wrap: balance;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Progress bar ---------- */
.progress {
  position: fixed;
  top: 0;
  inset-inline: 0;
  height: 4px;
  z-index: 50;
  pointer-events: none;
  background: transparent;
}
.progress-bar {
  height: 100%;
  width: 100%;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left;
}

/* ---------- Top nav ---------- */
.topnav {
  position: fixed;
  top: 4px;
  inset-inline: 0;
  z-index: 40;
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  padding: 0.4rem 1rem;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--rule);
}
.topnav a {
  font-family: var(--serif);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--muted);
  padding: 0.15rem 0.25rem;
}
.topnav a:hover { color: var(--accent); }

@media (max-width: 640px) {
  .topnav {
    flex-wrap: wrap;
    gap: 0.25rem 0.9rem;
    padding: 0.35rem 0.6rem;
  }
  .topnav a { font-size: 0.74rem; letter-spacing: 0.03em; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 82svh;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
}
.hero-slides {
  position: absolute;
  inset: 0;
}
.hero-slide {
  position: absolute;
  inset: 0;
  margin: 0;
  opacity: 0;
  transition: opacity 0.9s ease;
}
.hero-slide.is-active {
  opacity: 1;
}
.hero-slide img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 62%;
  z-index: 0;
}
.hero-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 3;
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  border: 1.5px solid rgba(247, 243, 234, 0.75);
  border-radius: 50%;
  background: rgba(20, 14, 8, 0.35);
  color: var(--white);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, background-color 0.18s ease, border-color 0.18s ease;
}
/* Desktop: panah muncul saat kursor masuk hero / fokus keyboard masuk hero */
.hero:hover .hero-btn,
.hero:focus-within .hero-btn,
.hero-btn:focus-visible {
  opacity: 1;
  pointer-events: auto;
}
.hero-btn:hover { background: rgba(20, 14, 8, 0.65); }
.hero-prev { left: 0.9rem; }
.hero-next { right: 0.9rem; }
/* Auto-hide panah di layar sentuh / sempit: swipe + dots sudah cukup, panah menutupi teks hero */
@media (max-width: 640px), (hover: none) {
  .hero-btn { display: none; }
}
.hero-dots {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  display: flex;
  gap: 0.55rem;
  padding: 0.35rem 0.6rem;
  border-radius: 1rem;
  background: rgba(20, 14, 8, 0.3);
}
.hero-dot {
  width: 0.7rem;
  height: 0.7rem;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: rgba(247, 243, 234, 0.55);
  cursor: pointer;
  transition: background-color 0.18s ease, transform 0.18s ease;
}
.hero-dot[aria-current="true"] {
  background: var(--white);
  transform: scale(1.2);
}
.hero-overlay {
  position: relative;
  z-index: 2;
  width: 100%;
  padding: 3rem 1.5rem 3rem;
  background: linear-gradient(
    to top,
    rgba(17, 11, 5, 0.94) 0%,
    rgba(17, 11, 5, 0.75) 30%,
    rgba(17, 11, 5, 0.52) 60%,
    rgba(17, 11, 5, 0.26) 85%,
    rgba(17, 11, 5, 0) 100%
  );
  color: var(--white);
}
/* Bayangan tipis di balik teks => tetap terbaca di foto terang */
.hero-kicker,
.hero h1,
.hero-sub {
  text-shadow: 0 1px 3px rgba(20, 14, 8, 0.7), 0 0 1px rgba(20, 14, 8, 0.5);
}
.hero-kicker {
  margin: 0 0 0.5rem;
  font-family: var(--serif);
  font-size: 0.9rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(247, 243, 234, 0.92);
}
.hero h1 {
  font-size: clamp(1.9rem, 1.15rem + 3.6vw, 3.5rem);
  max-width: 22ch;
  margin-bottom: 0.6em;
}
.hero-sub {
  font-size: clamp(1.05rem, 0.95rem + 0.6vw, 1.3rem);
  max-width: 62ch;
  margin: 0 0 1.25rem;
  color: rgba(247, 243, 234, 0.95);
}
.btn {
  display: inline-block;
  background: var(--accent);
  color: var(--white);
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.03em;
  padding: 0.7rem 1.6rem;
  border-radius: 2px;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.18s ease;
  border: none;
}
.btn:hover { background: #7e3a20; color: var(--white); }

/* ---------- Layout artikel: rail outline + kolom baca ---------- */
.article-layout {
  display: grid;
  grid-template-columns: 1fr;
  max-width: 1100px;
  margin-inline: auto;
  padding-inline: 1.25rem;
}

.outline {
  display: none;
}

.article-body {
  max-width: var(--max-read);
  margin-inline: auto;
}

.chapter {
  padding-block: 2.5rem;
  border-bottom: 1px solid var(--rule);
}
.chapter > h2 {
  font-size: clamp(1.6rem, 1.3rem + 1.5vw, 2.2rem);
  color: var(--ink);
  position: relative;
  padding-bottom: 0.4em;
}
.chapter > h2::after {
  content: "";
  display: block;
  width: 3.2rem;
  height: 3px;
  background: var(--accent);
  margin-top: 0.5em;
}

blockquote {
  margin: 2rem 0;
  padding: 1.2rem 1.5rem;
  border-left: 4px solid var(--accent);
  background: color-mix(in srgb, var(--rule) 40%, transparent);
  font-size: 1.05em;
}
blockquote p:first-child::first-letter {
  font-family: var(--serif);
  font-size: 2.6em;
  font-weight: 700;
  float: left;
  line-height: 0.85;
  padding-right: 0.12em;
  color: var(--accent);
}
blockquote p { margin: 0; }

/* ---------- Bab 2: perbandingan ---------- */
.compare-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}
.compare-card {
  border-left: 3px solid var(--accent);
  background: var(--paper-deep);
  padding: 1rem 1.25rem 1.4rem;
}
.compare-card img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  margin-bottom: 1rem;
}
.compare-card h3 {
  font-size: 1.4rem;
  margin-bottom: 0.4em;
}
.compare-card dl { margin: 1rem 0 0; }
.compare-card dt {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.6rem;
}
.compare-card dd { margin: 0.1rem 0 0; }

/* ---------- Bab 3: sebaran wilayah + galeri ---------- */
.region-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}
.region-card {
  background: var(--paper-deep);
  padding: 1.3rem 1.2rem 1.5rem;
  border-top: 3px solid var(--accent);
  border-radius: 4px;
  box-shadow: 0 1px 0 rgba(43, 33, 24, 0.06);
}
.region-head {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1.1rem;
  padding-bottom: 0.8rem;
  border-bottom: 1px dashed var(--rule);
}
.region-num {
  font-family: var(--serif);
  font-style: italic;
  font-size: 2rem;
  font-weight: 600;
  line-height: 1;
  color: var(--accent);
  flex: 0 0 auto;
}
.region-head-text h3 {
  font-size: 1.25rem;
  margin: 0 0 0.15rem;
}
.region-count {
  margin: 0;
  font-size: 0.78rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
}

.temple {
  margin-bottom: 1.4rem;
  padding-bottom: 1.2rem;
  border-bottom: 1px dashed var(--rule);
}
.temple:last-child {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}
.temple-name {
  font-family: var(--serif);
  font-size: 1.12rem;
  font-weight: 700;
  margin: 0.6rem 0 0.3rem;
}
.temple p {
  margin: 0;
  font-size: 0.95em;
}

.photo {
  margin: 0;
  cursor: pointer;
  position: relative;
  border-radius: 4px;
  overflow: hidden;
}
.photo img {
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
  border-radius: 4px;
  transition: filter 0.2s ease;
}
.photo:hover img,
.photo:focus-visible img {
  filter: brightness(0.9);
}
/* Ikon zoom muncul saat hover/fokus — tanpa teks */
.photo::after {
  content: "";
  position: absolute;
  right: 0.7rem;
  bottom: 0.7rem;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  background: rgba(20, 14, 8, 0.55)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.3-4.3'/%3E%3C/svg%3E")
    center / 55% no-repeat;
  opacity: 0;
  transition: opacity 0.18s ease;
  pointer-events: none;
}
.photo:hover::after,
.photo:focus-visible::after {
  opacity: 1;
}

/* ---------- Bab 4: do's & don'ts ---------- */
.dos-donts {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}
.do-card, .dont-card {
  padding: 1.2rem 1.4rem;
  border-radius: 2px;
}
.do-card {
  background: color-mix(in srgb, var(--do-green) 8%, var(--paper-deep));
  border-top: 3px solid var(--do-green);
}
.dont-card {
  background: color-mix(in srgb, var(--accent) 8%, var(--paper-deep));
  border-top: 3px solid var(--accent);
}
.do-card h3, .dont-card h3 { font-size: 1.25rem; }
.do-card h3 { color: var(--do-green); }
.dont-card h3 { color: var(--accent); }
.do-card ul, .dont-card ul { list-style: none; padding: 0; margin: 0.5rem 0 0; }
.do-card li, .dont-card li {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  padding: 0.45rem 0;
}
.icon { flex: 0 0 auto; margin-top: 0.22em; }
.do-card .icon { fill: var(--do-green); }
.dont-card .icon { fill: var(--accent); }

/* ---------- Footer ---------- */
.footer {
  background: var(--paper-deep);
  border-top: 4px solid var(--accent);
  padding: 3rem 1.25rem 4rem;
  margin-top: 2rem;
}
.footer > h2 {
  max-width: 1100px;
  margin-inline: auto;
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2rem);
  margin-bottom: 2rem;
}
.footer section {
  max-width: 1100px;
  margin-inline: auto;
  margin-bottom: 2.5rem;
}
.footer h3 {
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}

.share-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.share-btn {
  display: inline-block;
  font-family: var(--serif);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.55rem 1.1rem;
  border: 1.5px solid var(--ink);
  border-radius: 2px;
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease;
}
.share-btn:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}

.refs ul { margin: 0; padding-left: 1.2rem; }
.refs li { margin-bottom: 0.6rem; }

.credits-note { color: var(--muted); font-size: 0.92rem; margin-top: 0; }
.credit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.credit-table th, .credit-table td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
.credit-table th {
  font-family: var(--serif);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.8rem;
  color: var(--muted);
}

.footer-note {
  max-width: 1100px;
  margin: 2rem auto 0;
  color: var(--muted);
  font-size: 0.9rem;
  border-top: 1px solid var(--rule);
  padding-top: 1.5rem;
}

/* ---------- Lightbox dialog ---------- */
.lightbox {
  border: none;
  padding: 0;
  background: transparent;
  color: var(--white);
  max-width: min(96vw, 1100px);
  width: auto;
}
.lightbox::backdrop {
  background: rgba(20, 14, 8, 0.9);
}
.lightbox img {
  width: 100%;
  max-height: 78vh;
  object-fit: contain;
  border-radius: 2px;
  background: #1a130c;
}
.lightbox-caption {
  margin: 0.75rem 0 0;
  font-size: 1rem;
  color: var(--paper);
  text-align: center;
}
.lightbox-close {
  position: absolute;
  top: -2.6rem;
  right: 0;
  width: 2.2rem;
  height: 2.2rem;
  border: 1px solid rgba(247, 243, 234, 0.6);
  border-radius: 50%;
  background: transparent;
  color: var(--paper);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease;
}
.lightbox-close:hover { background: var(--paper); color: var(--ink); }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%) translateY(140%);
  background: var(--ink);
  color: var(--paper);
  padding: 0.7rem 1.3rem;
  border-radius: 4px;
  font-size: 0.95rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  z-index: 60;
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  max-width: min(92vw, 420px);
  text-align: center;
  pointer-events: none;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ---------- Reveal on scroll ---------- */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
}

/* ---------- Responsif: ≥768px ---------- */
@media (min-width: 768px) {
  .compare-grid { grid-template-columns: 1fr 1fr; }
  .dos-donts { grid-template-columns: 1fr 1fr; }
  .region-grid { grid-template-columns: 1fr 1fr; }
  .hero-overlay { padding: 4rem 3rem 3.5rem; }
}

/* ---------- Responsif: ≥1024px (rail outline muncul) ---------- */
@media (min-width: 1024px) {
  .article-layout {
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 3rem;
    align-items: start;
  }
  .outline {
    display: block;
    position: sticky;
    top: 6.5rem;
    align-self: start;
    padding-top: 0.25rem;
  }
  .outline-title {
    font-family: var(--serif);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 0.9rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--rule);
  }
  .outline nav { display: flex; flex-direction: column; gap: 0.45rem; }
  .outline a {
    font-size: 0.95rem;
    text-decoration: none;
    color: var(--muted);
    border-left: 2px solid transparent;
    padding: 0.2rem 0 0.2rem 0.75rem;
    transition: color 0.18s ease, border-color 0.18s ease;
  }
  .outline a:hover { color: var(--ink); border-left-color: var(--rule); }
  .outline a.active {
    color: var(--accent);
    border-left-color: var(--accent);
    font-weight: 600;
  }
  .region-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- Responsif: ≥1280px (4 kolom wilayah) ---------- */
@media (min-width: 1280px) {
  .region-grid { grid-template-columns: repeat(4, 1fr); }
}