:root {
  --navy: #0B1E3D;
  --heading: var(--navy);
  --gold: #FFC72C;
  --gold-dark: #E6B020;
  --white: #FFFFFF;
  --pure-white: #FFFFFF; /* always white, does NOT change in dark mode. Use for text/icons/badges that sit on the fixed navy/dark backgrounds (navbar, hero overlay, footer, buttons). --white is the adaptive "surface" color used for card/panel backgrounds and DOES change in dark mode. */
  --cream: #FAF8F5;
  --gray-100: #F5F5F5;
  --gray-200: #E0E0E0;
  --gray-400: #999;
  --gray-600: #666;
  --gray-800: #333;
  --danger: #E74C3C;
  --success: #2ECC71;
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans: 'Inter', -apple-system, sans-serif;
  --shadow: 0 2px 8px rgba(0,0,0,0.08);
  --radius: 12px;

}

[data-theme="dark"] {
  --white: #1A1A2E;
  --cream: #16213E;
  --gray-100: #1F2940;
  --gray-200: #2A3550;
  --gray-600: #B0B0B0;
  --gray-800: #E0E0E0;
  --heading: #F2C744;
  --shadow: 0 2px 8px rgba(0,0,0,0.3);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

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

button, input, select, textarea { font: inherit; color: inherit; }

body {
  font-family: var(--font-sans);
  background: var(--cream);
  color: var(--gray-800);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--heading); text-decoration: none; }
a:hover { color: var(--gold-dark); }

/* Navbar */
.navbar {
  background: var(--navy);
  padding: 0.75rem 2rem;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-left {
  display: flex;
  align-items: center;
}

.navbar-center {
  display: flex;
  justify-content: center;
}

.navbar-right {
  display: flex; align-items: center; justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.75rem;
  row-gap: 0.5rem;
}

.logo-circle {
  width: 40px; height: 40px; min-width: 40px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--navy);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem;
  flex-shrink: 0;
}

.logo-circle[style*="background-image"] {
  background-color: var(--pure-white);
  background-size: 75% !important;
  background-repeat: no-repeat !important;
}

.brand-text {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1.4rem;
  color: var(--pure-white);
  font-weight: 700;
  white-space: nowrap;
}

.navbar-extra-logo {
  width: 36px; height: 36px; min-width: 36px;
  border-radius: 50%;
  object-fit: contain;
  padding: 4px;
  background: var(--pure-white);
  flex-shrink: 0;
  display: block;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.search-form {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.1);
  border-radius: 20px;
  overflow: hidden;
}

.search-input {
  background: transparent;
  border: none;
  color: var(--pure-white);
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  width: 160px;
  outline: none;
}

.search-input::placeholder { color: rgba(255,255,255,0.5); }

.search-btn {
  background: none;
  border: none;
  color: var(--gold);
  padding: 0.4rem;
  cursor: pointer;
}

.nav-pill {
  background: var(--gold);
  color: var(--navy);
  padding: 0.4rem 1.2rem;
  border-radius: 20px;
  font-weight: 600;
  font-size: 0.85rem;
  transition: background 0.2s;
}

.nav-pill:hover { background: var(--gold-dark); color: var(--navy); }

/* Main */
.main-content { max-width: 1400px; margin: 0 auto; padding: 1.5rem; }

/* Home Layout */
.home-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 2rem;
}

.home-sidebar {
  position: sticky;
  top: 80px;
  align-self: start;
}

.sidebar-section { margin-bottom: 1rem; }

.accordion {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.accordion summary {
  padding: 0.75rem 1rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--navy);
  color: var(--pure-white);
}

.accordion-content { padding: 1rem; }

.category-list { list-style: none; }
.category-list li { padding: 0.3rem 0; }
.category-list a { font-size: 0.9rem; }

.theme-toggle-btn {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  background: var(--white);
  color: var(--gray-800);   /* <- baris baru, ini fix utamanya */
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
}

[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="light"] .theme-icon-dark,
:root:not([data-theme="dark"]) .theme-icon-dark { display: none; }

/* Hero */
.hero { margin-bottom: 2rem; }

.hero-bg {
  border-radius: var(--radius);
  background-size: cover;
  background-position: center;
  min-height: 300px;
  position: relative;
  overflow: hidden;
}

.hero-overlay {
  background: rgba(11, 30, 61, 0.75);
  padding: 3rem 2rem;
  min-height: 300px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  color: var(--pure-white);
  margin-bottom: 0.5rem;
}

.hero-subtitle {
  color: rgba(255,255,255,0.85);
  max-width: 600px;
  font-size: 1rem;
}

.hero-watermark {
  position: absolute;
  bottom: 1rem;
  right: 1.5rem;
  color: rgba(255,255,255,0.3);
  font-size: 0.8rem;
  letter-spacing: 2px;
  text-transform: uppercase;
}

/* Sections */
.section { margin-bottom: 2.5rem; }

.section-title { color: var(--heading); }

/* Story Grid */
.story-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
}

.story-card {
  background: var(--gold);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: transform 0.2s;
}

.story-card:hover { transform: translateY(-4px); }

.story-card-img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.story-card-body { padding: 1rem; }

.story-card-category {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--navy);
  opacity: 0.7;
}

.story-card-title {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  margin: 0.3rem 0;
  color: var(--navy);
}

.story-card-synopsis {
  font-size: 0.85rem;
  color: var(--navy);
  opacity: 0.8;
  margin-bottom: 0.75rem;
}

/* Highlight */
.highlight-section {
  background: var(--navy);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.highlight-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.highlight-title {
  font-family: var(--font-serif);
  color: var(--gold);
  font-size: 1.3rem;
}

.highlight-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}

.highlight-card {
  background: rgba(255,255,255,0.08);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  gap: 1rem;
  /* FIX: don't let the body stretch to the image's height */
  align-items: flex-start;
}

.highlight-card-img {
  width: 120px;
  height: 100px;
  object-fit: cover;
  flex-shrink: 0;
}

.highlight-card-body {
  flex: 1;
  min-width: 0;
  padding: 0.75rem 0.75rem 0.75rem 0;
  color: var(--pure-white);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.highlight-card-body h3 {
  font-size: 0.95rem;
  margin-bottom: 0.3rem;
}

.highlight-card-body p {
  font-size: 0.8rem;
  opacity: 0.7;
  margin-bottom: 0.5rem;
}

.highlight-card-body .btn {
  align-self: flex-start;
  /* FIX: was `margin-top: auto`, which pushed the button to the
     bottom of a stretched flex container instead of right under
     the text, making it look like it was floating on its own. */
  margin-top: 0.25rem;
  margin-left: 0;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.5rem 1.2rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.btn-accent { background: var(--gold); color: var(--navy); }
.btn-accent:hover { background: var(--gold-dark); color: var(--navy); }
.btn-outline { background: transparent; border: 1px solid var(--gray-200); color: var(--gray-800); }
.btn-outline-light { background: transparent; border: 1px solid var(--gold); color: var(--gold); }
.btn-sm { padding: 0.3rem 0.8rem; font-size: 0.8rem; }
.btn-lg { padding: 0.85rem 2rem; font-size: 1.05rem; }
.btn-block { width: 100%; }

/* Story Detail */
.story-detail { max-width: 800px; margin: 0 auto; }

.story-detail-header { margin-bottom: 1.5rem; }

.story-detail-category a {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gold-dark);
}

.story-detail-title { color: var(--heading); }

.story-detail-author { color: var(--gray-600); font-size: 0.9rem; }

.story-detail-cover {
  width: 100%;
  max-height: 400px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
}

.story-detail-synopsis {
  font-style: italic;
  color: var(--gray-600);
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: var(--white);
  border-left: 4px solid var(--gold);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.story-detail-content {
  background: var(--white);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  line-height: 1.8;
}

.story-detail-content p { margin-bottom: 1rem; }
.story-detail-content h2, .story-detail-content h3 { font-family: var(--font-serif); margin: 1.5rem 0 0.75rem; }

.story-detail-actions { margin: 1.5rem 0; }

.story-navigation {
  display: flex;
  justify-content: space-between;
  padding: 1rem 0;
  border-top: 1px solid var(--gray-200);
  margin-top: 2rem;
}

.nav-prev, .nav-next {
  font-size: 0.85rem;
  max-width: 45%;
}

/* Book Reader (topbar dipakai oleh reader vertikal) */
.reader-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.reader-back, .reader-pdf-link {
  font-size: 0.85rem;
  color: var(--gold-dark);
  white-space: nowrap;
}

.reader-title {
  font-family: var(--font-serif);
  color: var(--heading);
  font-size: 1.3rem;
  text-align: center;
  flex: 1;
  margin: 0;
}

@media (max-width: 640px) {
  .reader-title { font-size: 1.1rem; }
}

/* Category Page */
.page-header { margin-bottom: 2rem; }
.page-header h1 { color: var(--heading); }

.category-list-vertical { display: flex; flex-direction: column; gap: 1rem; }

.category-story-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--white);
  padding: 1rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.story-number {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--gold);
  min-width: 30px;
  text-align: center;
}

.category-story-img {
  width: 100px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
}

.category-story-body h3 {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
}

.category-story-body p {
  font-size: 0.85rem;
  color: var(--gray-600);
  margin-bottom: 0.5rem;
}

/* Search */
.search-page-form {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
}

.search-page-input {
  flex: 1;
  padding: 0.6rem 1rem;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 1rem;
  background: var(--white);
  color: var(--gray-800);
}

.search-result-count { color: var(--gray-600); margin-bottom: 1.5rem; }

/* Profile */
.profile-section { margin-bottom: 3rem; }

.dosen-card {
  display: flex;
  gap: 2rem;
  background: var(--white);
  padding: 2rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  align-items: center;
}

.dosen-photo {
  width: 200px;
  height: 260px;
  object-fit: cover;
  border-radius: var(--radius);
}

.dosen-info h3 { font-family: var(--font-serif); font-size: 1.3rem; margin-bottom: 0.5rem; }

.team-list { display: flex; flex-direction: column; gap: 2rem; }

.team-member {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.team-right { flex-direction: row-reverse; text-align: right; }

.team-photo {
  width: 150px;
  height: 150px;
  border-radius: 50%;
  object-fit: cover;
}

.team-info {
  background: var(--gold);
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius);
  flex: 1;
}

.team-info h3 { font-family: var(--font-serif); margin-bottom: 0.2rem; }
.team-role { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 1px; opacity: 0.7; }

/* Pagination */
.pagination {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.pagination-link {
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  background: var(--white);
  border: 1px solid var(--gray-200);
  font-size: 0.85rem;
}

.pagination-link.active {
  background: var(--navy);
  color: var(--pure-white);
  border-color: var(--navy);
}

/* Footer */
.footer {
  background: #111;
  color: #aaa;
  padding: 2rem;
  margin-top: 3rem;
}

.footer-inner { max-width: 1400px; margin: 0 auto; text-align: center; }

.footer-top {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 2.5rem;
  margin: 0 auto 1.25rem;
  padding: 0 1.5rem;
  max-width: 900px;
  text-align: left;
}

.footer-nav {
  display: flex;
  align-items: center;
  padding-top: 0.1rem;
}

.footer-partners {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

.footer-partners-logo {
  width: 300px;
  max-width: 80%;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  background: var(--pure-white);
  padding: 8px 12px;
  display: block;
}

.footer-copy { font-size: 0.8rem; text-align: center; }

.footer-dropdown summary { cursor: pointer; color: var(--gold); margin-bottom: 0.5rem; list-style: none; }
.footer-dropdown summary::-webkit-details-marker { display: none; }
.footer-dropdown-content a { color: #aaa; display: block; padding: 0.2rem 0; }

/* Error */
.error-page {
  text-align: center;
  padding: 4rem 2rem;
}

.error-page h1 { color: var(--heading); }

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--gray-600);
}

/* Forms (shared) */
.form-group { margin-bottom: 1.25rem; }
.form-group label { display: block; font-weight: 600; margin-bottom: 0.4rem; font-size: 0.9rem; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--gray-200);
  border-radius: 8px;
  font-size: 0.9rem;
  font-family: var(--font-sans);
  background: var(--white);
  color: var(--gray-800);
}

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.radio-group { display: flex; gap: 1.5rem; }
.radio-group label { font-weight: 400; display: flex; align-items: center; gap: 0.4rem; }

.alert {
  padding: 0.75rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.alert-success { background: #d4edda; color: #155724; }
.alert-error { background: #f8d7da; color: #721c24; }

/* Responsive */
@media (max-width: 1024px) {
  .story-grid { grid-template-columns: repeat(2, 1fr); }
  .home-layout { grid-template-columns: 1fr; }
  .home-sidebar { position: static; }
}

@media (max-width: 768px) {
  .navbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    grid-template-columns: unset;
    padding: 0.75rem 1rem;
    gap: 0.5rem 0.75rem;
  }
  .navbar-left { order: 1; }
  .navbar-center { order: 2; justify-content: flex-start; margin-right: auto; }
  .navbar-right {
    order: 3;
    flex: 1 1 100%;
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-end;
    margin-top: 0.5rem;
  }
  .search-form { order: 10; flex: 1 1 100%; margin-top: 0.5rem; }
  .search-input { width: 100%; }
  .story-grid { grid-template-columns: 1fr; }
  .highlight-grid { grid-template-columns: 1fr; }
  /* FIX: moved from the 480px breakpoint so cards stack into a
     column earlier — the 481-768px range was previously left with
     a cramped side-by-side layout that broke on mid-size phones. */
  .highlight-card { flex-direction: column; }
  .highlight-card-img { width: 100%; height: 160px; }
  .highlight-card-body { padding: 0.75rem; }
  .hero-title { font-size: 1.5rem; }
  .form-row { grid-template-columns: 1fr; }
  .dosen-card { flex-direction: column; text-align: center; }
  .team-member, .team-right { flex-direction: column; text-align: center; }
  .category-story-card { flex-direction: column; text-align: center; }
  .footer-partners-logo { width: 320px; }
}

@media (max-width: 480px) {
  .navbar { padding: 0.6rem 0.75rem; }
  .brand-text { font-size: 1.1rem; }
  .logo-circle { width: 34px; height: 34px; min-width: 34px; font-size: 0.75rem; }
  .navbar-extra-logo { width: 28px; height: 28px; min-width: 28px; }
  .navbar-right { gap: 0.4rem; }
  .nav-pill { padding: 0.35rem 0.8rem; font-size: 0.8rem; }
  .main-content { padding: 1rem; }
  .hero-title { font-size: 1.25rem; }
  .hero-overlay { padding: 2rem 1.25rem; }
  .story-detail-content { padding: 1.25rem; }
  .reader-container { padding: 1.5rem 1.25rem; }
  .reader-content-vertical { font-size: 1rem; }
  .dosen-card { padding: 1.25rem; }
  .dosen-photo { width: 140px; height: 180px; }
  .team-photo { width: 110px; height: 110px; }
  .team-info { padding: 1rem; }
  .footer-top { gap: 1.5rem; padding: 0 1rem; }
  .footer-partners-logo { width: 80%; max-width: 300px; padding: 6px 8px; }
}

/* Vertical Story Reader Styles */
.reader-vertical-page {
  max-width: 800px;
  margin: 0 auto;
  padding-bottom: 3rem;
}

.reader-container {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 3rem;
  margin-top: 1rem;
}

.reader-content-vertical {
  font-size: 1.1rem;
  line-height: 1.9;
  color: var(--gray-800);
}

.reader-content-vertical p {
  margin-bottom: 1.5rem;
}

.reader-content-vertical h2, 
.reader-content-vertical h3 {
  font-family: var(--font-serif);
  margin: 2rem 0 1rem;
  color: var(--heading);
}

.reader-content-vertical img {
  max-width: 100%;
  border-radius: 8px;
  display: block;
  margin: 1.5rem auto;
}