/* ============================================================
   Arif — Karya & Portofolio
   Gaya: Premium Utilitarian Minimalism / Editorial UI
   Palet: warm monochrome + aksen pastel lembut
   ============================================================ */

:root {
  /* Warna dasar */
  --canvas: #FBFBFA;
  --surface: #FFFFFF;
  --surface-alt: #F9F9F8;
  --ink: #111111;
  --body: #2F3437;
  --muted: #787774;
  --border: #EAEAEA;

  /* Aksen pastel (latar) + warna teks pendampingnya */
  --pastel-red: #FDEBEC;      --pastel-red-ink: #9F2F2D;
  --pastel-blue: #E1F3FE;     --pastel-blue-ink: #1F6C9F;
  --pastel-green: #EDF3EC;    --pastel-green-ink: #346538;
  --pastel-yellow: #FBF3DB;   --pastel-yellow-ink: #956400;
  --pastel-gray: #F1F1EF;     --pastel-gray-ink: #5B5B57;

  /* Tipografi */
  --font-serif: "Newsreader", Georgia, "Times New Roman", serif;
  --font-sans: "Geist", "Helvetica Neue", -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Geist Mono", "SF Mono", "JetBrains Mono", Consolas, monospace;

  /* Ritme ruang */
  --radius-card: 12px;
  --radius-btn: 6px;
  --section-gap: 96px;

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* ---------- Reset ringan ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
img { max-width: 100%; display: block; }
button { font: inherit; cursor: pointer; background: none; border: none; color: inherit; }
a { color: inherit; text-decoration: none; }

/* Atribut [hidden] harus selalu menang atas aturan display lain */
[hidden] { display: none !important; }

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--body);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Tekstur titik sangat halus supaya kanvas tidak datar */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(rgba(0, 0, 0, 0.035) 1px, transparent 1px);
  background-size: 22px 22px;
}

main, .nav { position: relative; z-index: 1; }

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 24px;
}

::selection { background: var(--ink); color: #fff; }

/* ---------- Ikon ---------- */
.icon {
  width: 16px;
  height: 16px;
  flex: none;
}

/* ============================================================
   NAVBAR
   ============================================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251, 251, 250, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: 64px;
}

.nav-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  color: var(--ink);
}

.logo-mark {
  display: block;
  height: 30px;
  width: auto;
}

.logo-text { font-size: 15px; letter-spacing: -0.01em; }

.nav-links {
  display: flex;
  gap: 28px;
  font-size: 14px;
  color: var(--muted);
}

.nav-links a { transition: color 200ms var(--ease-out); }
.nav-links a:hover { color: var(--ink); }

@media (max-width: 560px) {
  .nav-links { display: none; }
}

/* ============================================================
   TOMBOL
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 18px;
  border-radius: var(--radius-btn);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  transition: background 200ms var(--ease-out),
              color 200ms var(--ease-out),
              transform 150ms var(--ease-out);
  user-select: none;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--ink);
  color: #fff;
}
.btn-primary:hover { background: #333333; }

.btn-outline {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
}
.btn-outline:hover { background: var(--surface-alt); }

.btn-sm { padding: 9px 14px; font-size: 13px; }

/* ============================================================
   HERO
   ============================================================ */
.hero {
  padding: 96px 0 88px;
}

.hero-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 440px);
  gap: 48px;
  align-items: stretch; /* figure ikut meregang setinggi kolom teks */
  margin-bottom: 56px;
}

.hero-photo {
  margin: 0;
  position: relative;
  min-height: 320px;
}

/* Triptik: 3 foto tampil berdampingan, tinggi = tinggi blok teks hero.
 * Foto di-absolute agar TIDAK ikut menentukan tinggi baris grid —
 * jadi tingginya selalu pas dengan teks, tidak pernah melampaui. */
.hero-triptych {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.hero-triptych img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
  border-radius: 12px;
  border: 1px solid var(--border);
}

@media (max-width: 900px) {
  .hero { padding-top: 72px; }
  .hero-inner {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .hero-photo {
    order: -1; /* foto tampil dulu di layar kecil */
    max-width: 420px;
    min-height: 0;
  }
  /* Satu kolom: tidak ada teks di samping, kembali ke rasio tetap */
  .hero-triptych { position: static; }
  .hero-triptych img { height: auto; aspect-ratio: 2 / 3; }
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 20px;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(40px, 6.5vw, 64px);
  font-weight: 500;
  line-height: 1.08;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin-bottom: 24px;
}

.hero-title em {
  font-style: italic;
  font-weight: 400;
}

/* Wadah kata typewriter: lebar DICADANGKAN sebesar kata terpanjang
 * ("eksperimen.") + nowrap, supaya baris tidak pernah pindah & konten
 * di bawahnya tidak naik-turun selama animasi ketik/hapus. */
.typed-wrap {
  display: inline-block;
  min-width: 12ch;
  white-space: nowrap;
  text-align: left;
}

/* Kursor typewriter — batang tipis berkedip ala mesin ketik */
.typed-caret {
  display: inline-block;
  width: 3px;
  height: 0.82em;
  margin-left: 5px;
  background: var(--ink);
  vertical-align: -0.06em;
  animation: caret-blink 1.05s steps(1) infinite;
}

@keyframes caret-blink {
  50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .typed-caret { animation: none; }
}

.hero-sub {
  font-size: 17px;
  color: var(--muted);
  max-width: 560px;
  margin-bottom: 36px;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 40px;
  padding-top: 28px;
  border-top: 1px solid var(--border);
}

.hero-stats > div { min-width: 90px; }

.hero-stats dt {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.hero-stats dd {
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 500;
  line-height: 1;
  color: var(--ink);
}

/* ============================================================
   SECTION UMUM
   ============================================================ */
.divider {
  border: none;
  border-top: 1px solid var(--border);
}

.section { padding: var(--section-gap) 0; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 40px;
}

.section-title {
  font-family: var(--font-serif);
  font-size: clamp(30px, 4vw, 40px);
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink);
}

.section-sub {
  font-size: 14px;
  color: var(--muted);
  max-width: 300px;
  text-align: right;
}

@media (max-width: 720px) {
  .section-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .section-sub { text-align: left; max-width: none; }
}

/* ============================================================
   FILTER — satu baris: pill media di kiri, dropdown topik di kanan
   ============================================================ */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 36px;
}

.filter-bar .filters { margin-bottom: 0; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* Dropdown topik */
.topic-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.topic-select-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.topic-select select {
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  padding: 8px 12px;
  cursor: pointer;
  max-width: 220px;
  transition: border-color 200ms var(--ease-out);
}

.topic-select select:hover { border-color: #d5d5d2; }
.topic-select select:focus { outline: none; border-color: var(--ink); }

@media (max-width: 720px) {
  .filter-bar { flex-direction: column; align-items: stretch; }
  .topic-select { width: 100%; }
  .topic-select select { flex: 1; max-width: none; }
}

.filter-btn {
  padding: 8px 16px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  transition: all 200ms var(--ease-out);
}

.filter-btn:hover { color: var(--ink); border-color: #d5d5d2; }

.filter-btn.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.filter-btn .count {
  font-family: var(--font-mono);
  font-size: 11px;
  margin-left: 6px;
  opacity: 0.65;
}

/* Chip topik pada kartu — beda visual dari tag kategori */
.work-topics {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.topic-chip {
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: var(--surface);
}

/* ============================================================
   GRID KARYA
   ============================================================ */
.works-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 900px) { .works-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 580px) { .works-grid { grid-template-columns: 1fr; } }

.work-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  text-align: left;
  transition: box-shadow 250ms var(--ease-out),
              border-color 250ms var(--ease-out),
              transform 250ms var(--ease-out);
}

.work-card:hover {
  border-color: #dcdcda;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  transform: translateY(-2px);
}

/* Sampul generatif: blok warna pastel + inisial serif */
.work-cover {
  position: relative;
  aspect-ratio: 4 / 3;
  display: grid;
  place-items: center;
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}

.work-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.82);
}

.cover-initial {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 72px;
  line-height: 1;
  user-select: none;
}

.work-cover.cat-buku    { background: var(--pastel-blue); }
.work-cover.cat-buku .cover-initial    { color: var(--pastel-blue-ink); }
.work-cover.cat-desain  { background: var(--pastel-red); }
.work-cover.cat-desain .cover-initial  { color: var(--pastel-red-ink); }
.work-cover.cat-audio   { background: var(--pastel-green); }
.work-cover.cat-audio .cover-initial   { color: var(--pastel-green-ink); }
.work-cover.cat-video   { background: var(--pastel-yellow); }
.work-cover.cat-video .cover-initial   { color: var(--pastel-yellow-ink); }
.work-cover.cat-tulisan { background: var(--pastel-gray); }
.work-cover.cat-tulisan .cover-initial { color: var(--pastel-gray-ink); }

/* Ikon kecil di pojok sampul, menandai tipe media */
.cover-type {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(0, 0, 0, 0.05);
  color: var(--ink);
}

.cover-type .icon { width: 14px; height: 14px; }

.work-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 20px;
  flex: 1;
}

.work-tag {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 9999px;
}

.work-tag.cat-buku    { background: var(--pastel-blue);   color: var(--pastel-blue-ink); }
.work-tag.cat-desain  { background: var(--pastel-red);    color: var(--pastel-red-ink); }
.work-tag.cat-audio   { background: var(--pastel-green);  color: var(--pastel-green-ink); }
.work-tag.cat-video   { background: var(--pastel-yellow); color: var(--pastel-yellow-ink); }
.work-tag.cat-tulisan { background: var(--pastel-gray);   color: var(--pastel-gray-ink); }

.work-title {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.3;
  color: var(--ink);
}

.work-desc {
  font-size: 14px;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.work-meta {
  margin-top: auto;
  padding-top: 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.empty-state {
  padding: 64px 0;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* ============================================================
   TENTANG
   ============================================================ */
.about-grid {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 56px;
}

@media (max-width: 720px) {
  .about-grid { grid-template-columns: 1fr; gap: 24px; }
}

.about-body p { margin-bottom: 18px; max-width: 520px; }

.muted-note { font-size: 13px; color: var(--muted); }

.about-body code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--pastel-yellow);
  color: var(--pastel-yellow-ink);
  padding: 2px 6px;
  border-radius: 4px;
}

/* ============================================================
   FOOTER / KONTAK
   ============================================================ */
.footer { padding: var(--section-gap) 0 64px; }

.footer-title {
  font-family: var(--font-serif);
  font-size: clamp(34px, 5vw, 52px);
  font-weight: 500;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin-bottom: 32px;
}

.socials {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 48px;
}

.social-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--surface);
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  transition: all 200ms var(--ease-out);
}

.social-link:hover { background: var(--surface-alt); border-color: #d5d5d2; }

.social-link .icon { color: var(--muted); }

.footer-note {
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--border);
  padding-top: 24px;
}

/* ============================================================
   MODAL DETAIL
   ============================================================ */
.modal, .lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  visibility: hidden;
  opacity: 0;
  transition: opacity 250ms var(--ease-out), visibility 250ms;
}

.modal.open, .lightbox.open { visibility: visible; opacity: 1; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(17, 17, 17, 0.4);
}

.modal-card {
  position: relative;
  width: 100%;
  max-width: 640px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  transform: translateY(12px);
  transition: transform 300ms var(--ease-out);
}

.modal.open .modal-card { transform: translateY(0); }

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-btn);
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
  transition: all 200ms var(--ease-out);
}

.modal-close:hover { color: var(--ink); background: var(--surface-alt); }

.modal-media { border-bottom: 1px solid var(--border); }

.modal-media .work-cover { border-bottom: none; aspect-ratio: 16 / 9; }
.modal-media img { width: 100%; max-height: 380px; object-fit: cover; filter: saturate(0.82); }
.modal-media video, .modal-media iframe { width: 100%; aspect-ratio: 16 / 9; border: none; display: block; background: #000; }

.modal-body { padding: 28px; }

.modal-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--ink);
  margin-bottom: 12px;
}

.modal-desc { color: var(--body); margin-bottom: 16px; }

.modal-content { margin-bottom: 20px; }

/* Isi tulisan di dalam modal */
.modal-content .article-body {
  font-family: var(--font-serif);
  font-size: 17px;
  line-height: 1.75;
  color: var(--body);
}
.modal-content .article-body p { margin-bottom: 16px; }

/* Pemutar audio */
.audio-player {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
}

.audio-play {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex: none;
  border-radius: 9999px;
  background: var(--ink);
  color: #fff;
  transition: background 200ms var(--ease-out);
}
.audio-play:hover { background: #333; }

.audio-track {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.audio-progress {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  cursor: pointer;
  overflow: hidden;
}

.audio-progress > div {
  height: 100%;
  width: 0%;
  background: var(--ink);
}

.audio-time {
  display: flex;
  justify-content: space-between;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 28px;
}

/* Pembaca PDF (PDF.js) — satu halaman per tampilan */
.pdf-viewer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--surface-alt);
}

.pdf-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.pdf-nav {
  padding: 6px 16px;
  font-size: 16px;
  line-height: 1;
}

.pdf-nav[disabled] {
  opacity: 0.4;
  cursor: default;
  pointer-events: none;
}

.pdf-pos {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  min-width: 64px;
  text-align: center;
}

.pdf-pos b { color: var(--ink); font-weight: 600; }

.pdf-stage {
  display: flex;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  min-height: 240px;
  overflow: hidden;
}

.pdf-stage canvas {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  box-shadow: 0 2px 12px rgba(17, 17, 17, 0.08);
}

.pdf-msg {
  margin: 0;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}

.pdf-msg a { color: var(--ink); }

/* Kotak berbagi */
.share-box {
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

.share-label {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 12px;
}

.share-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--surface);
  font-size: 13px;
  font-weight: 500;
  color: var(--body);
  transition: all 200ms var(--ease-out);
}

.share-btn:hover { background: var(--surface-alt); border-color: #d5d5d2; color: var(--ink); }
.share-btn .icon { width: 14px; height: 14px; }

.share-btn.native {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.share-btn.native:hover { background: #333; }

/* ============================================================
   LIGHTBOX
   ============================================================ */
.lightbox img {
  position: relative;
  max-width: min(100%, 1100px);
  max-height: calc(100vh - 60px);
  border-radius: var(--radius-card);
  border: 1px solid var(--border);
  background: var(--surface);
}

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  z-index: 200;
  transform: translate(-50%, 16px);
  padding: 10px 18px;
  border-radius: var(--radius-btn);
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 250ms var(--ease-out), transform 250ms var(--ease-out);
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ============================================================
   SCROLL REVEAL (halus, hampir tak terasa)
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out);
  transition-delay: calc(var(--i, 0) * 80ms);
}

.reveal.in { opacity: 1; transform: translateY(0); }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
}
