/* Katalog Aplikasi Diperma
   Palette: kertas biru (cool paper), tinta indigo, kunyit (turmeric) satellite accent.
   Signature: orbital map — each app is a satellite on a category ring. */

:root {
  --paper: #ECEFF4;
  --paper-2: #F7F8FB;
  --card: #FFFFFF;
  --ink: #141A33;
  --ink-2: #4A5170;
  --ink-3: #7B829D;
  --line: #D5DAE6;
  --indigo: #2D3E9C;
  --indigo-soft: #DDE2F7;
  --kunyit: #E3A21A;
  --kunyit-ink: #8A5A00;
  --danger: #B3261E;
  --focus: #2D3E9C;
  --shadow: 0 1px 0 rgba(20, 26, 51, .04), 0 10px 30px -18px rgba(20, 26, 51, .35);
  --shadow-hover: 0 1px 0 rgba(20, 26, 51, .05), 0 22px 40px -20px rgba(45, 62, 156, .45);

  --f-display: "Avenir Next", "Segoe UI Variable Display", "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
  --f-body: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  --f-mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --r-lg: 22px;
  --r-md: 14px;
  --r-pill: 999px;
  --wrap: 1180px;
  --gutter: clamp(1.1rem, 4vw, 2.5rem);
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0B1022;
    --paper-2: #10162D;
    --card: #131A35;
    --ink: #EEF0F8;
    --ink-2: #B3B9D3;
    --ink-3: #8188A8;
    --line: #262E52;
    --indigo: #9AA9FF;
    --indigo-soft: #1D2650;
    --kunyit: #F2B53A;
    --kunyit-ink: #F2B53A;
    --danger: #FF8A80;
    --focus: #B9C4FF;
    --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 14px 32px -20px rgba(0, 0, 0, .8);
    --shadow-hover: 0 1px 0 rgba(0, 0, 0, .3), 0 24px 44px -20px rgba(80, 100, 230, .45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0B1022;
  --paper-2: #10162D;
  --card: #131A35;
  --ink: #EEF0F8;
  --ink-2: #B3B9D3;
  --ink-3: #8188A8;
  --line: #262E52;
  --indigo: #9AA9FF;
  --indigo-soft: #1D2650;
  --kunyit: #F2B53A;
  --kunyit-ink: #F2B53A;
  --danger: #FF8A80;
  --focus: #B9C4FF;
  --shadow: 0 1px 0 rgba(0, 0, 0, .3), 0 14px 32px -20px rgba(0, 0, 0, .8);
  --shadow-hover: 0 1px 0 rgba(0, 0, 0, .3), 0 24px 44px -20px rgba(80, 100, 230, .45);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 85% -10%, var(--indigo-soft), transparent 60%),
    var(--paper);
  color: var(--ink);
  font: 400 1rem/1.6 var(--f-body);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }
button, input { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
.mono { font-family: var(--f-mono); letter-spacing: 0; }

:focus-visible {
  outline: 2.5px solid var(--focus);
  outline-offset: 3px;
  border-radius: 6px;
}

.skip {
  position: absolute; left: 1rem; top: -4rem; z-index: 10;
  background: var(--ink); color: var(--paper);
  padding: .6rem 1rem; border-radius: var(--r-md); text-decoration: none;
}
.skip:focus { top: 1rem; }

/* ---------- top bar ---------- */
.topbar {
  max-width: var(--wrap); margin: 0 auto;
  padding: 1.25rem var(--gutter);
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand { display: inline-flex; align-items: center; gap: .7rem; text-decoration: none; }
.brand__mark { width: 36px; height: 36px; flex: none; }
.brand__tile { fill: var(--indigo); }
:root[data-theme="dark"] .brand__tile { fill: #2D3E9C; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand__tile { fill: #2D3E9C; } }
.brand__orbit { fill: none; stroke: #8EA0FF; stroke-width: 1; opacity: .7; }
.brand__glyph { fill: none; stroke: #F8F9FC; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.brand__sat { fill: var(--kunyit); }
.brand__text { display: grid; line-height: 1.1; }
.brand__name { font: 700 1.05rem/1.1 var(--f-display); letter-spacing: -.01em; }
.brand__sub { font-size: .78rem; color: var(--ink-3); }

.theme {
  display: inline-flex; align-items: center; gap: .5rem;
  border: 1px solid var(--line); background: var(--paper-2);
  border-radius: var(--r-pill); padding: .45rem .85rem .45rem .6rem;
  font-size: .82rem; color: var(--ink-2); cursor: pointer;
  transition: border-color .2s var(--ease), color .2s var(--ease);
}
.theme:hover { border-color: var(--indigo); color: var(--ink); }
.theme svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.theme svg path { fill: currentColor; stroke: none; }

/* ---------- hero ---------- */
main { max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  gap: clamp(1.5rem, 5vw, 4rem);
  align-items: center;
  padding: clamp(1.5rem, 6vw, 4.5rem) 0 clamp(2rem, 5vw, 3.5rem);
}
.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .8rem; color: var(--ink-3);
  margin-bottom: 1.25rem;
}
.eyebrow::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%;
  background: var(--kunyit);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--kunyit) 22%, transparent);
}
.display {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(2.4rem, 6.2vw, 4.6rem);
  line-height: .98;
  letter-spacing: -.035em;
  max-width: 12ch;
  text-wrap: balance;
}
.display__accent { color: var(--indigo); font-weight: 500; font-style: italic; letter-spacing: -.04em; }
.lede {
  margin-top: 1.4rem;
  max-width: 46ch;
  font-size: clamp(1.02rem, 1.4vw, 1.15rem);
  color: var(--ink-2);
  text-wrap: pretty;
}

/* search */
.search { margin-top: 2.2rem; max-width: 560px; }
.search__label {
  display: block; font-size: .8rem; font-weight: 600; color: var(--ink-2);
  margin-bottom: .5rem; letter-spacing: .01em;
}
.search__field { position: relative; }
.search__icon {
  position: absolute; left: 1.05rem; top: 50%; translate: 0 -50%;
  width: 20px; height: 20px; fill: none; stroke: var(--ink-3); stroke-width: 1.8; stroke-linecap: round;
  pointer-events: none;
}
.search input {
  width: 100%;
  appearance: none;
  border: 1.5px solid var(--line);
  background: var(--card);
  border-radius: var(--r-md);
  padding: 1rem 3rem 1rem 3rem;
  font-size: 1.05rem;
  box-shadow: var(--shadow);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.search input::placeholder { color: var(--ink-3); }
.search input:focus { outline: none; border-color: var(--indigo); box-shadow: 0 0 0 4px color-mix(in srgb, var(--indigo) 22%, transparent); }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search__kbd {
  position: absolute; right: .9rem; top: 50%; translate: 0 -50%;
}
.search input:not(:placeholder-shown) ~ .search__kbd,
.search input:focus ~ .search__kbd { opacity: 0; }
kbd {
  font-family: var(--f-mono); font-size: .75rem;
  border: 1px solid var(--line); border-bottom-width: 2px;
  border-radius: 6px; padding: .05rem .4rem;
  background: var(--paper-2); color: var(--ink-2);
}
.search__hint { margin-top: .6rem; font-size: .8rem; color: var(--ink-3); }
@media (hover: none) { .search__hint, .search__kbd { display: none; } }

/* filters */
.filters { border: 0; padding: 0; margin: 1.6rem 0 0; min-width: 0; }
.filters__legend {
  font-size: .8rem; font-weight: 600; color: var(--ink-2); padding: 0; margin-bottom: .6rem;
}
.filters__list { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip {
  display: inline-flex; align-items: center; gap: .45rem;
  border: 1px solid var(--line);
  background: var(--paper-2);
  border-radius: var(--r-pill);
  padding: .42rem .9rem;
  font-size: .88rem; color: var(--ink-2);
  cursor: pointer;
  transition: background .2s var(--ease), color .2s var(--ease), border-color .2s var(--ease);
}
.chip:hover { border-color: var(--indigo); color: var(--ink); }
.chip[aria-pressed="true"] {
  background: var(--ink); color: var(--paper); border-color: var(--ink);
}
.chip__count { font-family: var(--f-mono); font-size: .74rem; opacity: .7; }
.chip__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--dot, var(--ink-3)); }

/* ---------- orbit signature ---------- */
.orbit { margin: 0; position: relative; justify-self: center; width: min(100%, 440px); }
.orbit__svg { width: 100%; height: auto; display: block; overflow: visible; }
.orbit__ring { fill: none; stroke: var(--line); stroke-width: 1; }
.orbit__ring:nth-child(2) { stroke-dasharray: 2 6; }
.orbit__coreplate { fill: #2D3E9C; }
.orbit__glyph { fill: none; stroke: #F8F9FC; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; }
.orbit__sats { transform-origin: 0 0; }
.sat { transition: opacity .35s var(--ease); }
.sat circle { fill: var(--dot, var(--indigo)); transition: r .3s var(--ease); }
.sat--featured circle { stroke: var(--kunyit); stroke-width: 3; paint-order: stroke; }
.sat--dim { opacity: .14; }
.sat--hot circle { r: 11; }
.orbit__caption {
  text-align: center; font-size: .78rem; color: var(--ink-3); margin-top: .5rem;
}
@media (prefers-reduced-motion: no-preference) {
  .orbit__sats { animation: spin 140s linear infinite; }
  .orbit:hover .orbit__sats { animation-play-state: paused; }
  @keyframes spin { to { rotate: 360deg; } }
}

/* ---------- catalog ---------- */
.catalog { padding-bottom: 4rem; }
.section-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  padding: 1.6rem 0 1.1rem;
  border-top: 1px solid var(--line);
}
.section-title {
  font: 700 1.35rem/1.2 var(--f-display); letter-spacing: -.02em;
}
.section-note { color: var(--ink-3); font-size: .9rem; }
.featured { margin-bottom: 2.5rem; }
.results:focus { outline: none; }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 290px), 1fr));
  gap: 1rem;
}
.grid--featured { grid-template-columns: repeat(auto-fill, minmax(min(100%, 360px), 1fr)); }

.card { position: relative; }
.card__link {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto 1fr auto;
  column-gap: 1rem; row-gap: .7rem;
  height: 100%;
  padding: 1.25rem 1.25rem 1.1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease), border-color .25s var(--ease);
}
.card__link:hover { border-color: color-mix(in srgb, var(--indigo) 45%, var(--line)); box-shadow: var(--shadow-hover); }
.card__link:focus-visible { outline-offset: 4px; border-radius: var(--r-lg); }
@media (prefers-reduced-motion: no-preference) {
  .card__link:hover { transform: translateY(-3px); }
}

.icon {
  grid-row: 1 / span 2;
  width: 52px; height: 52px; border-radius: 16px;
  display: grid; place-items: center;
  background: var(--tile, var(--indigo-soft));
  color: #fff;
  font: 700 1.05rem/1 var(--f-display); letter-spacing: -.02em;
  position: relative;
  flex: none;
}
.icon::after {
  content: ""; position: absolute; inset: -5px; border-radius: 50%;
  border: 1px solid var(--tile, var(--indigo)); opacity: .35;
  clip-path: polygon(50% 0, 100% 0, 100% 100%, 50% 100%);
}
.icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.card__head { min-width: 0; align-self: center; }
.card__name {
  font: 700 1.12rem/1.25 var(--f-display); letter-spacing: -.015em; color: var(--ink);
  overflow-wrap: anywhere;
}
.card__host { font-family: var(--f-mono); font-size: .78rem; color: var(--ink-3); overflow-wrap: anywhere; }
.card__desc {
  grid-column: 2; align-self: start; color: var(--ink-2); font-size: .94rem; line-height: 1.55;
  display: -webkit-box; -webkit-line-clamp: 3; line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  max-height: calc(1.55em * 3);
}
.card__foot {
  grid-column: 1 / -1;
  display: flex; align-items: center; justify-content: space-between; gap: .75rem;
  padding-top: .8rem; border-top: 1px dashed var(--line);
}
.tags { display: flex; flex-wrap: wrap; gap: .35rem; min-width: 0; }
.tag {
  white-space: nowrap;
  font-size: .74rem; color: var(--ink-2);
  background: var(--paper-2); border: 1px solid var(--line);
  padding: .1rem .5rem; border-radius: var(--r-pill);
}
.tag--cat { color: var(--ink); border-color: transparent; background: color-mix(in srgb, var(--dot, var(--indigo)) 16%, transparent); }
.badge-lock, .lock-inline {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .74rem; color: var(--kunyit-ink);
}
.lock-inline { font-weight: 600; }
.badge-lock svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 2; }
.card__open {
  display: inline-flex; align-items: center; gap: .6rem; flex: none;
  font-size: .85rem; font-weight: 600; color: var(--indigo); white-space: nowrap;
}
.card__open svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s var(--ease); }
.card__link:hover .card__open svg { transform: translate(2px, -2px); }
.card__star {
  position: absolute; top: 1rem; right: 1rem;
  width: 10px; height: 10px; border-radius: 50%; background: var(--kunyit);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--kunyit) 22%, transparent);
}
.grid--featured .card__link { padding: 1.5rem; background: linear-gradient(160deg, color-mix(in srgb, var(--indigo-soft) 70%, var(--card)), var(--card) 55%); }
.grid--featured .icon { width: 60px; height: 60px; border-radius: 18px; font-size: 1.2rem; }


/* category tints (white text passes contrast on all) */
.tint-0 { --tile: #2D3E9C; --dot: #2D3E9C; }
.tint-1 { --tile: #0F6E6A; --dot: #0F6E6A; }
.tint-2 { --tile: #8A3B8F; --dot: #8A3B8F; }
.tint-3 { --tile: #B4521F; --dot: #B4521F; }
.tint-4 { --tile: #3D6B1F; --dot: #3D6B1F; }
.tint-5 { --tile: #9C2D4A; --dot: #9C2D4A; }
.tint-6 { --tile: #4B4F9E; --dot: #4B4F9E; }
.tint-7 { --tile: #5E5A2A; --dot: #5E5A2A; }
.icon--emoji { font-size: 1.5rem; }

/* skeleton */
.skeleton {
  height: 178px; border-radius: var(--r-lg); border: 1px solid var(--line);
  background: linear-gradient(90deg, var(--card) 0%, var(--paper-2) 50%, var(--card) 100%) 0 0 / 200% 100%;
}
@media (prefers-reduced-motion: no-preference) {
  .skeleton { animation: shimmer 1.4s linear infinite; }
  @keyframes shimmer { to { background-position: -200% 0; } }
  .card { animation: rise .45s var(--ease) both; animation-delay: 420ms; }
  .card:nth-child(1) { animation-delay: 0ms; }
  .card:nth-child(2) { animation-delay: 35ms; }
  .card:nth-child(3) { animation-delay: 70ms; }
  .card:nth-child(4) { animation-delay: 105ms; }
  .card:nth-child(5) { animation-delay: 140ms; }
  .card:nth-child(6) { animation-delay: 175ms; }
  .card:nth-child(7) { animation-delay: 210ms; }
  .card:nth-child(8) { animation-delay: 245ms; }
  .card:nth-child(9) { animation-delay: 280ms; }
  .card:nth-child(10) { animation-delay: 315ms; }
  .card:nth-child(11) { animation-delay: 350ms; }
  .card:nth-child(12) { animation-delay: 385ms; }
  .card:nth-child(13) { animation-delay: 420ms; }
  @keyframes rise { from { opacity: 0; transform: translateY(8px); } }
}

/* notices */
.notice {
  text-align: center;
  padding: 3rem 1.5rem;
  border: 1.5px dashed var(--line);
  border-radius: var(--r-lg);
  display: grid; justify-items: center; gap: .55rem;
}
.notice__title { font: 700 1.15rem/1.3 var(--f-display); }
.notice__body { color: var(--ink-2); max-width: 48ch; }
.notice--error { border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.notice--error .notice__title { color: var(--danger); }
.btn {
  margin-top: .6rem;
  border: 1.5px solid var(--ink); background: transparent;
  border-radius: var(--r-pill); padding: .6rem 1.2rem;
  font-weight: 600; font-size: .92rem; cursor: pointer;
  transition: background .2s var(--ease), color .2s var(--ease);
}
.btn:hover { background: var(--ink); color: var(--paper); }
.btn--solid { background: var(--ink); color: var(--paper); }
.btn--solid:hover { background: var(--indigo); border-color: var(--indigo); color: #fff; }
.btn[disabled] { opacity: .6; cursor: progress; }

/* footer */
.footer {
  max-width: var(--wrap); margin: 0 auto;
  padding: 2rem var(--gutter) 3rem;
  border-top: 1px solid var(--line);
  color: var(--ink-3); font-size: .86rem;
  display: flex; justify-content: space-between; gap: 1rem 2rem; flex-wrap: wrap;
}
.footer p:first-child { max-width: 62ch; }
.footer__meta { font-size: .78rem; }
.noscript { max-width: var(--wrap); margin: 1rem auto; padding: 0 var(--gutter); color: var(--danger); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; }
  .orbit { order: -1; width: min(62vw, 260px); justify-self: start; margin-bottom: -.5rem; }
  .orbit__caption { text-align: left; }
}
@media (max-width: 520px) {
  .theme__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .theme { padding: .5rem; }
  .orbit { width: 180px; }
  .card__link { padding: 1.05rem; column-gap: .85rem; }
  .card__desc { grid-column: 1 / -1; }
  .icon { grid-row: 1; width: 46px; height: 46px; border-radius: 14px; }
  .card__foot { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation: none !important; scroll-behavior: auto !important; }
}

@media (forced-colors: active) {
  .card__link, .chip, .search input { border: 1px solid CanvasText; }
  .chip[aria-pressed="true"] { outline: 2px solid Highlight; }
}
