*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0c0c0c;
  --surface: #161616;
  --border: rgba(255, 255, 255, 0.08);
  --border-hover: rgba(255, 255, 255, 0.22);
  --text-primary: #f0ede8;
  --text-secondary: rgba(240, 237, 232, 0.45);
  --accent: #e8dcc8;
  --accent-hover: #ffffff;
  --tag-bg: rgba(255, 255, 255, 0.05);

  /* Spacing tokens */
  --page-pad-x: 24px;
  --page-pad-top: 80px;
  --page-pad-bottom: 120px;
  --header-mb: 72px;
  --grid-gap: 12px;
  --card-pad: 18px 20px;
  --grid-cols: 2;
  --max-width: 680px;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: "DM Sans", sans-serif;
  font-weight: 300;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-text-size-adjust: 100%;
}

/* ── Noise Overlay ── */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

/* ── Layout ── */
.page {
  position: relative;
  z-index: 1;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: var(--page-pad-top) var(--page-pad-x) var(--page-pad-bottom);
  width: 100%;
}

/* ── Header ── */
.header {
  margin-bottom: var(--header-mb);
  animation: fadeUp 0.8s ease both;
}

.avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border-hover);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "DM Serif Display", serif;
  font-size: 22px;
  color: var(--accent);
  margin-bottom: 28px;
  letter-spacing: 0.5px;
}

.header h1 {
  font-family: "DM Serif Display", serif;
  font-weight: 400;
  font-size: clamp(26px, 5vw, 48px);
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 14px;
}

.header h1 em {
  font-style: italic;
  color: var(--accent);
}

.header p {
  font-size: clamp(13px, 1.5vw, 15px);
  color: var(--text-secondary);
  line-height: 1.7;
  max-width: 400px;
}

/* ── Divider ── */
.divider {
  height: 1px;
  background: var(--border);
  margin-bottom: 48px;
  animation: fadeUp 0.9s ease both;
  animation-delay: 0.1s;
}

/* ── Section Label ── */
.section-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-secondary);
  margin-bottom: 16px;
  animation: fadeUp 1s ease both;
  animation-delay: 0.15s;
}

/* ── Link Grid ── */
.link-grid {
  display: grid;
  grid-template-columns: repeat(var(--grid-cols), 1fr);
  gap: var(--grid-gap);
  margin-bottom: 40px;
}

/* ── Link Card ── */
.link-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--card-pad);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  text-decoration: none;
  color: var(--text-primary);
  transition:
    border-color 0.25s ease,
    background 0.25s ease,
    transform 0.2s ease;
  position: relative;
  overflow: hidden;
  animation: fadeUp 0.9s ease both;
  /* Touch tap highlight */
  -webkit-tap-highlight-color: transparent;
}

.link-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at var(--mx, 50%) var(--my, 50%),
    rgba(255, 255, 255, 0.04) 0%,
    transparent 60%
  );
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.link-card:hover {
  border-color: var(--border-hover);
  background: #1c1c1c;
  transform: translateY(-2px);
}

.link-card:hover::after {
  opacity: 1;
}

.link-card:active {
  transform: translateY(0) scale(0.99);
}

/* staggered animation */
.link-card:nth-child(1) {
  animation-delay: 0.2s;
}

.link-card:nth-child(2) {
  animation-delay: 0.25s;
}

.link-card:nth-child(3) {
  animation-delay: 0.3s;
}

.link-card:nth-child(4) {
  animation-delay: 0.35s;
}

.link-card:nth-child(5) {
  animation-delay: 0.4s;
}

.link-card:nth-child(6) {
  animation-delay: 0.45s;
}

.link-card:nth-child(7) {
  animation-delay: 0.5s;
}

.link-card:nth-child(8) {
  animation-delay: 0.55s;
}

.link-card-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  flex: 1;
}

.link-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--tag-bg);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  transition: background 0.25s ease;
}

.link-card:hover .link-icon {
  background: rgba(255, 255, 255, 0.07);
}

.link-info {
  min-width: 0;
  flex: 1;
}

.link-name {
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link-arrow {
  font-size: 18px;
  color: var(--text-secondary);
  transition:
    transform 0.25s ease,
    color 0.25s ease;
  flex-shrink: 0;
  margin-left: 8px;
}

.link-card:hover .link-arrow {
  transform: translate(2px, -2px);
  color: var(--accent-hover);
}

/* ── Wide Card ── */
.link-card.wide {
  grid-column: 1 / -1;
}

/* ── Footer ── */
footer {
  margin-top: auto;
  text-align: center;
  padding: 0 24px 40px;
  position: relative;
  z-index: 1;
  animation: fadeUp 1.2s ease both;
  animation-delay: 0.7s;
}

footer p {
  font-size: 12px;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}

/* ── Keyframes ── */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ════════════════════════════════════════
       RESPONSIVE BREAKPOINTS
       ════════════════════════════════════════

       xs  : < 360px      — HP layar kecil (Galaxy A, iPhone SE)
       sm  : 360–479px    — HP standar (iPhone 14, Pixel)
       md  : 480–767px    — HP besar / phablet (iPhone Pro Max, Galaxy Ultra)
       lg  : 768–1023px   — Tablet portrait (iPad mini, Tab S)
       xl  : 1024–1279px  — Tablet landscape / laptop kecil (iPad Pro, Surface)
       2xl : 1280–1535px  — Laptop standar (MacBook Air, 13")
       3xl : ≥ 1536px     — Monitor besar (MacBook Pro 16", desktop)
    ════════════════════════════════════════ */

/* xs — HP layar kecil < 360px */
@media (max-width: 359px) {
  :root {
    --page-pad-x: 14px;
    --page-pad-top: 40px;
    --page-pad-bottom: 60px;
    --header-mb: 40px;
    --grid-cols: 1;
    --card-pad: 14px 14px;
    --grid-gap: 8px;
  }

  .avatar {
    width: 44px;
    height: 44px;
    font-size: 18px;
    margin-bottom: 18px;
  }

  .link-icon {
    width: 30px;
    height: 30px;
    font-size: 15px;
  }

  .link-name {
    font-size: 13px;
  }

  .link-desc {
    font-size: 11px;
  }

  .divider {
    margin-bottom: 28px;
  }
}

/* sm — HP standar 360–479px */
@media (min-width: 360px) and (max-width: 479px) {
  :root {
    --page-pad-x: 18px;
    --page-pad-top: 48px;
    --page-pad-bottom: 72px;
    --header-mb: 48px;
    --grid-cols: 1;
    --card-pad: 15px 16px;
    --grid-gap: 10px;
  }

  .avatar {
    width: 48px;
    height: 48px;
    font-size: 20px;
    margin-bottom: 20px;
  }

  .divider {
    margin-bottom: 32px;
  }
}

/* md — HP besar / phablet 480–767px */
@media (min-width: 480px) and (max-width: 767px) {
  :root {
    --page-pad-x: 20px;
    --page-pad-top: 56px;
    --page-pad-bottom: 80px;
    --header-mb: 52px;
    --grid-cols: 2;
    --card-pad: 15px 16px;
    --grid-gap: 10px;
  }

  .divider {
    margin-bottom: 36px;
  }
}

/* lg — Tablet portrait 768–1023px */
@media (min-width: 768px) and (max-width: 1023px) {
  :root {
    --max-width: 700px;
    --page-pad-x: 32px;
    --page-pad-top: 72px;
    --page-pad-bottom: 100px;
    --header-mb: 64px;
    --grid-cols: 2;
    --grid-gap: 14px;
    --card-pad: 20px 22px;
  }

  .link-icon {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .link-name {
    font-size: 15px;
  }

  .link-desc {
    font-size: 12px;
  }

  .avatar {
    width: 60px;
    height: 60px;
    font-size: 24px;
  }
}

/* xl — Tablet landscape / laptop kecil 1024–1279px */
@media (min-width: 1024px) and (max-width: 1279px) {
  :root {
    --max-width: 860px;
    --page-pad-x: 40px;
    --page-pad-top: 80px;
    --grid-cols: 3;
    --grid-gap: 14px;
    --card-pad: 18px 20px;
  }

  .link-card.wide {
    grid-column: span 2;
  }
}

/* 2xl — Laptop standar 1280–1535px */
@media (min-width: 1280px) and (max-width: 1535px) {
  :root {
    --max-width: 960px;
    --page-pad-x: 48px;
    --page-pad-top: 88px;
    --grid-cols: 3;
    --grid-gap: 16px;
    --card-pad: 20px 22px;
  }

  .link-icon {
    width: 40px;
    height: 40px;
    font-size: 20px;
  }

  .link-name {
    font-size: 15px;
  }

  .link-card.wide {
    grid-column: span 2;
  }
}

/* 3xl — Monitor besar ≥ 1536px */
@media (min-width: 1536px) {
  :root {
    --max-width: 1080px;
    --page-pad-x: 56px;
    --page-pad-top: 100px;
    --grid-cols: 4;
    --grid-gap: 16px;
    --card-pad: 20px 22px;
    --header-mb: 80px;
  }

  .link-icon {
    width: 42px;
    height: 42px;
    font-size: 20px;
  }

  .link-name {
    font-size: 15px;
  }

  .link-desc {
    font-size: 12px;
  }

  .avatar {
    width: 64px;
    height: 64px;
    font-size: 26px;
  }

  .link-card.wide {
    grid-column: span 2;
  }
}

/* ── Touch device: disable hover lift, use tap feedback ── */
@media (hover: none) and (pointer: coarse) {
  .link-card:hover {
    transform: none;
    border-color: var(--border);
    background: var(--surface);
  }

  .link-card:active {
    background: #1c1c1c;
    border-color: var(--border-hover);
    transform: scale(0.98);
  }

  .link-card:hover .link-arrow {
    transform: none;
    color: var(--text-secondary);
  }
}

/* ── Landscape phone fix ── */
@media (max-height: 480px) and (orientation: landscape) {
  :root {
    --page-pad-top: 32px;
    --header-mb: 32px;
    --grid-cols: 3;
  }

  .avatar {
    margin-bottom: 14px;
  }

  .divider {
    margin-bottom: 24px;
  }
}
