/* ==========================================================================
   Cenelwa — style.css
   Palet: hijau WhatsApp + putih (tema terang) / abu-abu gelap (tema gelap).
   ========================================================================== */

:root {
  --brand-400: #34e07a;
  --brand-500: #25d366;
  --brand-600: #128c7e;

  --bg: #f5f8f6;
  --glow-one: rgba(37, 211, 102, 0.24);
  --glow-two: rgba(18, 140, 126, 0.18);

  --surface: rgba(255, 255, 255, 0.82);
  --surface-solid: #ffffff;
  --surface-soft: rgba(37, 211, 102, 0.07);

  --text: #0d1a14;
  --muted: #596a61;
  --border: rgba(13, 26, 20, 0.09);
  --shadow: 0 24px 60px -26px rgba(6, 40, 25, 0.3);

  --radius-lg: 30px;
  --radius-md: 18px;
  --radius-sm: 12px;

  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #08120f;
  --glow-one: rgba(37, 211, 102, 0.2);
  --glow-two: rgba(18, 140, 126, 0.24);

  --surface: rgba(17, 28, 24, 0.78);
  --surface-solid: #111c18;
  --surface-soft: rgba(37, 211, 102, 0.09);

  --text: #e8f3ed;
  --muted: #93a79c;
  --border: rgba(255, 255, 255, 0.09);
  --shadow: 0 24px 60px -26px rgba(0, 0, 0, 0.75);

  color-scheme: dark;
}

/* ------------------------------- Reset ---------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 16px 28px;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1,
p {
  margin: 0;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
  display: block;
}

:focus-visible {
  outline: 2px solid var(--brand-500);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------------------------- Latar dekoratif --------------------------- */

.bg-decor {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  width: 46vmax;
  height: 46vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.85;
  animation: float 18s ease-in-out infinite alternate;
}

.blob--one {
  top: -18vmax;
  left: -12vmax;
  background: var(--glow-one);
}

.blob--two {
  right: -16vmax;
  bottom: -20vmax;
  background: var(--glow-two);
  animation-delay: -7s;
}

.grid-lines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--border) 1px, transparent 1px),
    linear-gradient(to bottom, var(--border) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, #000 20%, transparent 75%);
  opacity: 0.55;
}

@keyframes float {
  from {
    transform: translate3d(0, 0, 0) scale(1);
  }
  to {
    transform: translate3d(3vmax, 2vmax, 0) scale(1.12);
  }
}

/* ------------------------------- Topbar --------------------------------- */

.skip-link {
  position: absolute;
  top: -100px;
  left: 16px;
  z-index: 20;
  padding: 10px 16px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 600;
}

.skip-link:focus {
  top: 12px;
}

.topbar {
  width: 100%;
  max-width: 960px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 6px 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--text);
}

.brand img {
  border-radius: 9px;
  box-shadow: 0 6px 16px -8px rgba(6, 40, 25, 0.6);
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--brand-500);
  transform: translateY(-1px);
}

.theme-toggle .icon--sun {
  display: none;
}

:root[data-theme="dark"] .theme-toggle .icon--sun {
  display: block;
}

:root[data-theme="dark"] .theme-toggle .icon--moon {
  display: none;
}

/* -------------------------------- Kartu --------------------------------- */

.card {
  width: 100%;
  max-width: 560px;
  margin: auto;
  padding: clamp(26px, 6vw, 40px) clamp(20px, 5vw, 36px);
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.1);
  -webkit-backdrop-filter: blur(18px) saturate(1.1);
  animation: rise 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.avatar {
  width: 96px;
  height: 96px;
  margin: 0 auto 14px;
  padding: 4px;
  border-radius: 30px;
  background: linear-gradient(140deg, var(--brand-400), var(--brand-600));
  box-shadow: 0 18px 38px -20px rgba(18, 140, 126, 0.9);
}

.avatar img {
  width: 100%;
  height: 100%;
  border-radius: 26px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.dot {
  position: relative;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand-500);
  box-shadow: 0 0 0 3px rgba(37, 211, 102, 0.18);
}

h1 {
  font-size: clamp(1.5rem, 5.4vw, 1.95rem);
  line-height: 1.25;
  letter-spacing: -0.025em;
  font-weight: 800;
}

.accent {
  background: linear-gradient(120deg, var(--brand-500), var(--brand-600));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.tagline {
  max-width: 36ch;
  margin: 12px auto 0;
  color: var(--muted);
  font-size: 0.95rem;
  text-wrap: pretty;
}

/* ---------------------------- Daftar tautan ----------------------------- */

.links-section {
  margin-top: 24px;
  text-align: left;
}

.links__title {
  margin: 0 0 10px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

.links {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Placeholder singkat sebelum JavaScript selesai merender daftar. */
.links:empty::before {
  content: "Memuat tautan…";
  display: block;
  padding: 18px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.links__empty {
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.link-card {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background-color: var(--surface-solid);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

:root[data-theme="dark"] .link-card {
  background-color: rgba(255, 255, 255, 0.035);
}

.link-card:hover {
  transform: translateY(-2px);
  border-color: rgba(37, 211, 102, 0.55);
  box-shadow: 0 16px 30px -20px rgba(6, 40, 25, 0.6);
}

.link-card:active {
  transform: translateY(0) scale(0.995);
}

.link-card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  background: rgba(37, 211, 102, 0.14);
  color: var(--brand-600);
  font-size: 1.25rem;
  line-height: 1;
  transition: background-color 0.18s ease, transform 0.18s ease;
}

:root[data-theme="dark"] .link-card__icon {
  color: var(--brand-400);
}

.link-card:hover .link-card__icon {
  background: rgba(37, 211, 102, 0.24);
  transform: scale(1.04);
}

.link-card__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
}

.link-card__title {
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.link-card__desc {
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--muted);
  text-wrap: pretty;
}

.link-card__meta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.link-card__count {
  min-width: 30px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  white-space: nowrap;
}

.link-card__count--empty {
  opacity: 0.55;
  font-weight: 600;
}

.link-card__arrow {
  display: inline-flex;
  color: var(--muted);
  transition: transform 0.2s ease, color 0.2s ease;
}

.link-card:hover .link-card__arrow {
  transform: translateX(3px);
  color: var(--brand-600);
}

:root[data-theme="dark"] .link-card:hover .link-card__arrow {
  color: var(--brand-400);
}

/* Kartu utama (tombol paling penting) */
.link-card--primary {
  padding: 15px 16px;
  border-color: transparent;
  background-image: linear-gradient(135deg, #12805f, #075c48);
  color: #fff;
  box-shadow: 0 16px 30px -18px rgba(7, 92, 72, 0.85);
}

.link-card--primary .link-card__title {
  font-size: 1.05rem;
  color: #fff;
}

.link-card--primary .link-card__desc {
  color: rgba(255, 255, 255, 0.95);
}

.link-card--primary .link-card__icon {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.link-card--primary:hover .link-card__icon {
  background: rgba(255, 255, 255, 0.26);
}

.link-card--primary .link-card__count {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.28);
  color: #fff;
}

.link-card--primary .link-card__arrow,
.link-card--primary:hover .link-card__arrow {
  color: #fff;
}

.link-card--primary:hover {
  filter: brightness(1.07);
  box-shadow: 0 20px 36px -18px rgba(7, 92, 72, 0.95);
}

/* ------------------------------ Statistik ------------------------------ */

.stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px dashed var(--border);
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 16px 12px;
  border-radius: var(--radius-md);
  background: var(--surface-soft);
  border: 1px solid var(--border);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.stat:hover {
  transform: translateY(-2px);
  border-color: rgba(37, 211, 102, 0.45);
}

.stat__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  margin-bottom: 6px;
  border-radius: 11px;
  background: rgba(37, 211, 102, 0.14);
  color: var(--brand-600);
}

:root[data-theme="dark"] .stat__icon {
  color: var(--brand-400);
}

.stat__label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.stat__value {
  font-size: clamp(1.5rem, 6vw, 1.8rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}

.stat__hint {
  font-size: 0.68rem;
  color: var(--muted);
  opacity: 0.85;
}

.stats__note {
  margin-top: 12px;
  font-size: 0.76rem;
  color: var(--muted);
  text-align: center;
}

/* ------------------------------- Footer -------------------------------- */

.footer {
  width: 100%;
  max-width: 560px;
  margin-top: 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 6px 18px;
  font-size: 0.8rem;
  color: var(--muted);
}

.footer a {
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.footer a:hover {
  color: var(--text);
  border-bottom-color: var(--brand-500);
}

/* --------------------- Halaman dokumen (privasi/404) -------------------- */

.doc {
  width: 100%;
  max-width: 720px;
  margin: auto;
  padding: clamp(24px, 5vw, 40px);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(1.1);
  -webkit-backdrop-filter: blur(18px) saturate(1.1);
}

.doc h1 {
  margin-bottom: 6px;
  font-size: clamp(1.45rem, 4.6vw, 1.85rem);
}

.doc h2 {
  margin: 28px 0 8px;
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

.doc p,
.doc li {
  color: var(--muted);
  font-size: 0.94rem;
}

.doc p + p {
  margin-top: 10px;
}

.doc ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.doc li + li {
  margin-top: 6px;
}

.doc a {
  color: var(--brand-600);
  text-decoration: underline;
  text-underline-offset: 2px;
}

:root[data-theme="dark"] .doc a {
  color: var(--brand-400);
}

.doc--center {
  text-align: center;
}

.doc__meta {
  margin-top: 4px;
  font-size: 0.8rem;
  color: var(--muted);
}

.doc__back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 28px;
  padding: 11px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
}

.doc__back:hover {
  border-color: var(--brand-500);
}

.doc code {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  font-size: 0.86em;
  font-family: ui-monospace, "Cascadia Code", "Segoe UI Mono", Consolas, monospace;
}

/* ------------------------------ Responsif ------------------------------- */

@media (max-width: 420px) {
  body {
    padding: 14px 12px 22px;
  }

  .avatar {
    width: 88px;
    height: 88px;
    border-radius: 26px;
  }

  .avatar img {
    border-radius: 22px;
  }

  .stat {
    padding: 14px 8px;
  }

  .link-card {
    gap: 11px;
    padding: 12px;
  }

  .link-card__icon {
    width: 38px;
    height: 38px;
    border-radius: 11px;
  }

  .link-card__title {
    font-size: 0.95rem;
  }
}

@media (max-width: 330px) {
  .stats {
    grid-template-columns: 1fr;
  }
}

/* --------------------------- Preferensi user ---------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
