/* ==========================================================================
   Reset & Konfigurasi Dasar (PDF / Academic Paper-Style)
   ========================================================================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  background-color: #FAF0E6; /* Linen / Bookpaper luar */
  color: #333333;            /* Teks abu-abu sangat gelap */
  font-family: Georgia, "Times New Roman", Times, serif;
  line-height: 1.75;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a {
  color: #333333;
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:hover {
  color: #000000;
}

code {
  font-family: "Courier New", Courier, monospace;
  font-size: 0.92em;
  background-color: #F3E8D2;
  padding: 0.1em 0.35em;
  border: 1px solid #DFD3BC;
  border-radius: 2px;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

/* ==========================================================================
   Menu Bar Sticky (Selalu Berada di Paling Atas Layar)
   ========================================================================== */
.sticky-menubar {
  position: sticky;
  top: 0;
  z-index: 1000;
  width: 100%;
  background-color: #FDF6E3;
  border-bottom: 2px solid #333333;
  box-shadow: 0 2px 6px rgba(51, 51, 51, 0.08);
}

.menubar-inner {
  max-width: 800px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.menubar-brand {
  font-weight: bold;
  font-size: 1.05rem;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  text-decoration: none;
  color: #333333;
}

.menubar-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.65rem;
  list-style: none;
  font-size: 0.92rem;
}

.menubar-nav a,
.btn-action {
  display: inline-block;
  text-decoration: none;
  padding: 0.3rem 0.75rem;
  border: 1px solid #333333;
  background-color: #FAF0E6;
  color: #333333;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 0.88rem;
  line-height: 1.4;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.menubar-nav a:hover,
.btn-action:hover,
.menubar-nav a.active {
  background-color: #333333;
  color: #FDF6E3;
}

/* ==========================================================================
   Kontainer Utama (Lebar Maksimal 800px di Tengah Layar)
   ========================================================================== */
.paper-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

.paper-sheet {
  background-color: #FDF6E3; /* Kertas Bookpaper utama */
  border: 1px solid #D6CBB5;
  box-shadow: 0 4px 18px rgba(51, 51, 51, 0.08);
  padding: 3rem 3.25rem;
}

/* ==========================================================================
   Blok Lampiran Gambar di Paling Atas Halaman Baca (Tepat di Bawah Menu Bar)
   ========================================================================== */
.top-image-attachment-section {
  max-width: 800px;
  margin: 1.5rem auto 0;
  padding: 0 1.5rem;
}

.top-image-wrapper {
  background-color: #FDF6E3;
  border: 1px solid #333333;
  padding: 1.25rem 1.5rem;
  box-shadow: 0 3px 10px rgba(51, 51, 51, 0.06);
}

.top-image-label {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: bold;
  border-bottom: 1px solid #333333;
  padding-bottom: 0.4rem;
  margin-bottom: 1rem;
  color: #333333;
}

.top-image-figure {
  margin-bottom: 1.25rem;
  text-align: center;
}

.top-image-figure:last-child {
  margin-bottom: 0;
}

.top-image-figure img {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border: 1px solid #C8BCA6;
  background-color: #FAF0E6;
}

.top-image-caption {
  margin-top: 0.55rem;
  font-size: 0.88rem;
  font-style: italic;
  color: #333333;
  text-align: center;
}

/* ==========================================================================
   Tipografi Paper Akademik (Halaman Baca - baca.php)
   ========================================================================== */
.paper-header {
  text-align: center;
  border-bottom: 2px double #333333;
  padding-bottom: 1.5rem;
  margin-bottom: 1.75rem;
}

.paper-category {
  display: inline-block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 0.6rem;
  border: 1px solid #333333;
  padding: 0.15rem 0.6rem;
  background-color: #FAF0E6;
}

.paper-title {
  font-size: 1.75rem;
  line-height: 1.3;
  font-weight: bold;
  color: #333333;
  margin-bottom: 0.85rem;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.paper-meta {
  font-size: 0.9rem;
  font-style: italic;
  color: #333333;
}

.paper-abstract {
  background-color: #FAF0E6;
  border-left: 3px solid #333333;
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  font-size: 0.94rem;
  text-align: justify;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.paper-abstract-title {
  font-weight: bold;
  text-transform: uppercase;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  display: block;
  margin-bottom: 0.3rem;
}

.paper-body {
  font-size: 1.05rem;
  text-align: justify;
  color: #333333;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.paper-body p {
  margin-bottom: 1.25rem;
  text-indent: 2em;
}

.paper-body p:first-of-type {
  text-indent: 0;
}

.paper-body p:first-of-type::first-letter {
  font-size: 2.5rem;
  font-weight: bold;
  float: left;
  line-height: 1;
  padding-right: 0.45rem;
  padding-top: 0.1rem;
  color: #333333;
}

.paper-footer {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid #333333;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.paper-footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ==========================================================================
   Daftar Catatan / Artikel (Halaman Utama - index.php)
   ========================================================================== */
.index-header {
  text-align: center;
  border-bottom: 2px double #333333;
  padding-bottom: 1.5rem;
  margin-bottom: 2rem;
}

.index-title {
  font-size: 1.85rem;
  margin-bottom: 0.4rem;
  color: #333333;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.index-subtitle {
  font-size: 0.95rem;
  font-style: italic;
  color: #333333;
}

.filter-bar {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
  padding: 0.5rem 0.75rem;
  border: 1px solid #333333;
  background-color: #FAF0E6;
  color: #333333;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 0.95rem;
}

.notes-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.note-card {
  background-color: #FAF0E6;
  border: 1px solid #C8BCA6;
  padding: 1.5rem 1.75rem;
  transition: border-color 0.15s ease;
}

.note-card:hover {
  border-color: #333333;
}

.note-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.82rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px dotted #B8AC96;
  padding-bottom: 0.4rem;
}

.badge-attachment {
  font-style: italic;
  background-color: #FDF6E3;
  border: 1px solid #333333;
  padding: 0.05rem 0.45rem;
  font-size: 0.76rem;
}

.note-card-title {
  font-size: 1.3rem;
  margin-bottom: 0.6rem;
  line-height: 1.35;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.note-card-title a {
  text-decoration: none;
}

.note-card-title a:hover {
  text-decoration: underline;
}

.note-card-excerpt {
  font-size: 0.95rem;
  text-align: justify;
  margin-bottom: 1rem;
  overflow-wrap: break-word;
  word-wrap: break-word;
}

.note-card-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ==========================================================================
   Formulir Penulisan Catatan Baru (tulis.php)
   ========================================================================== */
.form-section-standalone {
  margin-top: 0.5rem;
}

.form-title {
  font-size: 1.25rem;
  margin-bottom: 1rem;
}

.form-group {
  margin-bottom: 1.2rem;
}

.form-label {
  display: block;
  font-weight: bold;
  font-size: 0.9rem;
  margin-bottom: 0.35rem;
}

.form-control {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border: 1px solid #333333;
  background-color: #FAF0E6;
  color: #333333;
  font-family: Georgia, "Times New Roman", Times, serif;
  font-size: 0.95rem;
}

textarea.form-control {
  min-height: 220px;
  resize: vertical;
  line-height: 1.65;
}

.alert-box {
  border: 1px solid #333333;
  background-color: #FAF0E6;
  padding: 0.75rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.92rem;
}

/* ==========================================================================
   Mode Cetak & Responsif Layar Mobile
   ========================================================================== */
@media (max-width: 640px) {
  /* Margin tipis di tepi layar perangkat mobile */
  .paper-container {
    padding: 0.45rem 0.35rem 1.25rem;
  }

  .top-image-attachment-section {
    margin: 0.45rem auto 0;
    padding: 0 0.35rem;
  }

  .top-image-wrapper {
    padding: 0.85rem 0.75rem;
  }

  .top-image-label {
    font-size: 0.72rem;
    margin-bottom: 0.75rem;
  }

  .top-image-caption {
    font-size: 0.8rem;
  }

  .paper-sheet {
    padding: 1.15rem 0.9rem;
  }

  /* Menu bar ringkas & rapi pada layar sempit */
  .menubar-inner {
    padding: 0.5rem 0.55rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.45rem;
  }

  .menubar-brand {
    font-size: 0.92rem;
    text-align: center;
    padding-bottom: 0.25rem;
    border-bottom: 1px dotted #C8BCA6;
  }

  .menubar-nav {
    justify-content: center;
    gap: 0.35rem;
  }

  .menubar-nav a,
  .btn-action {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
  }

  /* Header & judul pada layar mobile */
  .index-header,
  .paper-header {
    padding-bottom: 1rem;
    margin-bottom: 1.2rem;
  }

  .index-title,
  .paper-title {
    font-size: 1.32rem;
    line-height: 1.3;
  }

  .index-subtitle,
  .paper-meta {
    font-size: 0.82rem;
    line-height: 1.45;
  }

  /* Kolom pencarian pada halaman indeks */
  .filter-bar {
    gap: 0.4rem;
    margin-bottom: 1.2rem;
  }

  .search-input {
    min-width: 0;
    flex: 1 1 100%;
    font-size: 0.9rem;
    padding: 0.45rem 0.65rem;
  }

  .filter-bar .btn-action {
    flex: 1;
    text-align: center;
    padding: 0.45rem 0.65rem;
  }

  /* Daftar kartu artikel di mobile */
  .notes-list {
    gap: 0.9rem;
  }

  .note-card {
    padding: 0.95rem 0.85rem;
  }

  .note-card-meta {
    font-size: 0.76rem;
  }

  .note-card-title {
    font-size: 1.1rem;
    margin-bottom: 0.45rem;
  }

  .note-card-excerpt {
    font-size: 0.9rem;
    line-height: 1.6;
    text-align: left;
    margin-bottom: 0.85rem;
  }

  /* Tipografi halaman baca di mobile */
  .paper-abstract {
    padding: 0.75rem 0.85rem;
    margin-bottom: 1.35rem;
    font-size: 0.88rem;
    text-align: left;
  }

  .paper-body {
    font-size: 0.96rem;
    line-height: 1.68;
    text-align: left;
  }

  .paper-body p {
    text-indent: 1.25em;
    margin-bottom: 1rem;
  }

  .paper-body p:first-of-type::first-letter {
    font-size: 2.15rem;
    padding-right: 0.35rem;
  }

  /* Tombol navigasi bawah artikel di mobile */
  .paper-footer {
    margin-top: 1.75rem;
    padding-top: 1rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .paper-footer .btn-action {
    text-align: center;
    width: 100%;
  }

  .paper-footer-nav {
    flex-direction: column;
    width: 100%;
    gap: 0.45rem;
  }
}

@media print {
  .sticky-menubar,
  .paper-footer,
  .form-section-standalone,
  .filter-bar {
    display: none;
  }

  body,
  .paper-sheet {
    background-color: #FDF6E3;
    box-shadow: none;
    border: none;
  }
}
