/* ==========================================================================
   TULISAN — arsip: laci kartu katalog, peta keterhubungan, berkas bertumpuk
   ========================================================================== */

.archive-bar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  border-block: 1px solid var(--line);
  margin-bottom: clamp(28px, 4vw, 48px);
}
.archive-bar .wrap { display: grid; grid-template-columns: auto minmax(180px, 280px) minmax(0, 1fr); gap: 12px 20px; align-items: center; padding-block: 12px; }
.archive-search { display: flex; border-bottom: 1.5px solid var(--graphite); }
.archive-search input { width: 100%; border: 0; background: none; outline: none; padding: 4px 0; font-family: var(--display); font-style: italic; font-size: 20px; color: var(--ink); }
.archive-search input::placeholder { color: var(--muted); opacity: .7; }
.tag-chips { gap: 6px; }
.tag-chips .chip { font-size: 12px; padding: 4px 10px; }
.tag-chips .chip::before { content: "#"; opacity: .5; margin-right: 1px; }
@media (max-width: 900px) { .archive-bar .wrap { grid-template-columns: 1fr; } .archive-bar { position: static; } .archive-bar .seg { justify-self: start; } }

/* ---------- laci ---------- */

.drawer-year { margin-bottom: clamp(48px, 7vw, 96px); }
.year-tab {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 20px;
  border-bottom: 1.5px solid var(--graphite); padding-bottom: 10px; margin-bottom: 28px;
  position: relative;
}
.year-tab::before {
  /* label laci kuningan */
  content: ""; position: absolute; right: 0; top: -2px; width: 120px; height: 34px;
  border: 1px solid rgb(35 33 29 / .25); border-radius: 3px;
  background: linear-gradient(180deg, rgb(255 255 255 / .5), rgb(0 0 0 / .03));
  display: none;
}
.year-tab .year { font-family: var(--display); font-weight: 300; font-style: italic; font-size: clamp(64px, 8vw, 120px); line-height: .82; color: var(--ink); letter-spacing: -.02em; }
.year-tab .mono { font-size: 13px; color: var(--muted); text-align: right; }

.catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr)); gap: clamp(18px, 2.4vw, 32px); }
.card-note {
  position: relative; display: flex; flex-direction: column; gap: 12px;
  text-align: left; border: 0; padding: 18px 22px 34px; min-height: 280px;
  background-color: var(--sheet);
  background-image:
    linear-gradient(180deg, transparent 0 52px, rgb(196 70 60 / .5) 52px 53px, transparent 53px),
    repeating-linear-gradient(180deg, transparent 0 27px, var(--rule) 27px 28px);
  background-position: 0 0, 0 54px;
  box-shadow: var(--shadow-paper);
  transform: rotate(var(--tilt, 0deg));
  transition: transform .5s var(--ease), box-shadow .5s var(--ease);
  color: var(--graphite);
}
.card-note::after {
  /* lubang kartu katalog */
  content: ""; position: absolute; bottom: 10px; left: 50%; width: 14px; height: 14px; margin-left: -7px;
  border-radius: 50%; background: var(--paper); box-shadow: inset 0 1px 2px rgb(0 0 0 / .22);
}
.card-note:hover, .card-note:focus-visible { transform: translateY(-8px) rotate(calc(var(--tilt, 0deg) * -1)); box-shadow: var(--shadow-lift); }
.card-note .top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; min-height: 30px; }
.acc { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; color: var(--stamp); border: 1.5px solid currentColor; padding: 2px 7px 1px; transform: rotate(-2deg); display: inline-block; opacity: .85; }
.card-note .d { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.card-note h3 { font-family: var(--display); font-weight: 400; font-size: clamp(25px, 2.2vw, 31px); line-height: 1.08; margin: 6px 0 0; }
.card-note p { margin: 0; font-size: 16px; line-height: 1.75; color: #4b4740; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.card-note .foot { margin-top: auto; display: flex; flex-wrap: wrap; gap: 4px 10px; font-family: var(--mono); font-size: 12px; color: var(--muted); }
.card-note .foot .links { color: var(--ink); margin-left: auto; }
.card-note .draft { font-family: var(--mono); font-size: 11px; color: var(--sodium); }
.card-note.is-dim { opacity: .28; }
.no-result { font-family: var(--hand); font-size: 34px; color: var(--ink); opacity: .6; padding: 60px 0; }

/* ---------- peta ---------- */

.graph {
  position: relative; height: min(78vh, 820px); min-height: 520px;
  background: var(--sheet); box-shadow: var(--shadow-paper);
  background-image: radial-gradient(rgb(31 45 115 / .12) 1px, transparent 1.2px);
  background-size: 22px 22px;
  overflow: hidden; touch-action: none;
}
.graph canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.graph-legend {
  position: absolute; left: 16px; bottom: 14px; display: flex; flex-wrap: wrap; gap: 6px 18px;
  font-family: var(--mono); font-size: 12px; color: var(--muted); pointer-events: none;
}
.graph-legend i { display: inline-block; width: 10px; height: 10px; margin-right: 6px; vertical-align: -1px; }
.graph-legend .n i { border-radius: 50%; background: var(--ink); }
.graph-legend .k i { background: var(--kraft-deep); }
.graph-legend .t i { border-radius: 50%; border: 1.5px solid var(--sodium); }
.graph-help { position: absolute; right: 16px; top: 14px; font-family: var(--hand); font-size: 24px; color: var(--ink); opacity: .7; pointer-events: none; text-align: right; }
.graph-tip {
  position: absolute; z-index: 2; pointer-events: none; max-width: 260px;
  background: var(--graphite); color: var(--sheet); padding: 8px 12px; font-size: 14px; line-height: 1.35;
  transform: translate(-50%, calc(-100% - 16px)); opacity: 0; transition: opacity .15s;
}
.graph-tip small { display: block; font-family: var(--mono); font-size: 11px; opacity: .7; margin-top: 2px; }
.graph-tip.is-on { opacity: 1; }

/* ---------- pembaca berkas: dokumen arsip di tengah meja baca ----------
   Berkas yang dibuka muncul di tengah seperti kertas yang ditarik dari map.
   Membuka berkas terkait menumpuknya di atas; berkas sebelumnya tetap terlihat
   di belakang dan bisa diklik untuk kembali. */

.panes-back {
  position: fixed; inset: 0; z-index: 60;
  background: rgb(28 26 22 / .55);
  backdrop-filter: blur(3px) saturate(.8); -webkit-backdrop-filter: blur(3px) saturate(.8);
  animation: fadeIn .35s ease both;
}
@keyframes fadeIn { from { opacity: 0; } }
.panes { position: fixed; inset: 0; z-index: 61; pointer-events: none; }
.reader-trail {
  position: fixed; left: 50%; top: 14px; z-index: 62; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px; max-width: calc(100vw - 24px); overflow-x: auto; scrollbar-width: none;
  font-family: var(--mono); font-size: 12px; color: rgb(251 248 241 / .8);
}
.reader-trail button { border: 1px solid rgb(251 248 241 / .3); background: rgb(28 26 22 / .35); color: inherit; border-radius: 999px; padding: 4px 11px; white-space: nowrap; font: inherit; letter-spacing: .06em; }
.reader-trail button:hover { border-color: #f2c47c; color: #f2c47c; }
.reader-trail button[aria-current="true"] { background: var(--sheet); color: var(--graphite); border-color: var(--sheet); }
.reader-trail .sep { opacity: .5; }
.reader-trail .all { margin-left: 8px; }

.pane {
  --d: 0;
  pointer-events: auto; position: absolute; left: 50%; top: calc(50% + 18px);
  width: min(780px, calc(100vw - 24px)); height: min(86vh, 1040px);
  background-color: #f8f4ea; background-image: var(--grain);
  box-shadow: 0 2px 2px rgb(0 0 0 / .08), 0 40px 80px -30px rgb(0 0 0 / .6);
  display: grid; grid-template-rows: auto minmax(0, 1fr);
  transform: translate(-50%, -50%) translateY(calc(var(--d) * -26px)) scale(calc(1 - var(--d) * .045)) rotate(calc(var(--d) * -.6deg));
  filter: brightness(calc(1 - var(--d) * .1));
  transition: transform .6s var(--ease), filter .6s var(--ease), opacity .4s;
  animation: pullOut .6s var(--ease) both;
}
.pane[data-d="0"] { z-index: 5; }
.pane[data-d="1"] { z-index: 4; cursor: pointer; }
.pane[data-d="2"] { z-index: 3; cursor: pointer; }
.pane[data-d="3"] { z-index: 2; opacity: .6; }
.pane.is-deep { opacity: 0; pointer-events: none; }
.pane:not([data-d="0"]) .pane-body { overflow: hidden; }
.pane:not([data-d="0"]):hover { filter: brightness(1); }
@keyframes pullOut { from { transform: translate(-50%, -50%) translateY(60px) rotate(1.2deg); opacity: 0; } }

/* kepala berkas: seperti kartu identitas di map arsip */
.pane-head {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 14px 26px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #efe8d8, #f4efe3);
}
.pane-head .acc { font-size: 11px; justify-self: start; }
.pane-head button { border: 0; background: none; font-family: var(--mono); font-size: 13px; color: var(--ink); padding: 4px 0; }
.pane-body { overflow: auto; padding: 34px clamp(24px, 6vw, 72px) 80px; overscroll-behavior: contain; position: relative; }
.pane-body::before {
  /* garis margin merah seperti kertas arsip */
  content: ""; position: absolute; top: 0; bottom: 0; left: clamp(12px, 3vw, 40px); width: 1px; background: var(--margin-red); opacity: .6;
}
.record {
  display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 18px;
  font-family: var(--mono); font-size: 12px; color: var(--muted); margin: 0 0 26px; padding-bottom: 16px;
  border-bottom: 1px dashed var(--line-strong);
}
.record dt { text-transform: uppercase; letter-spacing: .08em; }
.record dd { margin: 0; color: var(--graphite); }
.stamp {
  position: absolute; right: clamp(20px, 5vw, 56px); top: 26px; transform: rotate(-7deg);
  font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--stamp);
  border: 2px solid currentColor; border-radius: 3px; padding: 5px 9px; opacity: .72; pointer-events: none;
  mix-blend-mode: multiply;
}
.pane-body h2 { font-family: var(--display); font-weight: 400; font-size: clamp(36px, 4.4vw, 54px); line-height: 1.02; margin: 0 0 14px; letter-spacing: -.01em; max-width: 16ch; }
.pane-meta { font-family: var(--mono); font-size: 12.5px; color: var(--muted); margin: 0 0 6px; }
.pane-meta i { font-style: italic; }
.pane-tags { display: flex; flex-wrap: wrap; gap: 6px; margin: 16px 0 30px; }
.pane-tags button { border: 1px solid var(--line-strong); background: none; border-radius: 999px; font-family: var(--mono); font-size: 12px; padding: 3px 10px; color: var(--graphite); }
.pane-tags button::before { content: "#"; opacity: .5; }
.pane-tags button:hover { border-color: var(--ink); color: var(--ink); }
.pane .prose { font-size: 19.5px; line-height: 1.72; }
.pane-section { margin-top: 44px; border-top: 1.5px solid var(--graphite); padding-top: 12px; }
.pane-section h3 { font-family: var(--mono); font-weight: 400; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 12px; }
.linked { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 8px; }
.linked button, .linked a {
  display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 12px; align-items: center;
  border: 1px solid var(--line); background: #fffdf8; padding: 8px 10px; text-align: left; text-decoration: none; color: var(--graphite);
  transition: border-color .2s, transform .3s var(--ease);
}
.linked button:hover, .linked a:hover { border-color: var(--ink); transform: translateY(-2px); }
.linked img { width: 56px; height: 56px; object-fit: cover; background: var(--paper-2); }
.linked .ph { width: 56px; height: 56px; display: grid; place-items: center; background: var(--paper-2); font-family: var(--mono); font-size: 10px; color: var(--stamp); }
.linked strong { display: block; font-family: var(--display); font-weight: 400; font-size: 19px; line-height: 1.15; }
.linked small { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.pane .item-tools { margin: 0 0 18px; }
.pane-karya img.cover { width: 100%; max-height: 46vh; object-fit: contain; background: var(--paper-2); margin-bottom: 24px; }
.pane-end { margin-top: 56px; text-align: center; font-family: var(--hand); font-size: 26px; color: var(--ink); opacity: .6; }

@media (max-width: 760px) {
  .pane { top: 50%; width: 100vw; height: 100svh; }
  .pane:not([data-d="0"]) { opacity: 0; pointer-events: none; }
  .reader-trail { top: auto; bottom: 12px; }
  .stamp { display: none; }
}
@media (prefers-reduced-motion: reduce) { .pane { animation: none; } }
