:root {
  --bg: #ffffff;
  --bg-alt: #f6f7f8;
  --text: #1a1d21;
  --muted: #5d6670;
  --border: #e3e6e9;
  --accent: #1f6feb;
  --accent-hover: #1858bd;
  --radius: 8px;
  --maxw: 1040px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101214;
    --bg-alt: #16191c;
    --text: #eceef0;
    --muted: #9aa3ac;
    --border: #262b30;
    --accent: #5b9bff;
    --accent-hover: #86b5ff;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 64px; }
body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }
.narrow { max-width: 720px; }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.nav { display: flex; align-items: center; justify-content: space-between; height: 56px; }
.brand { font-weight: 600; color: var(--text); }
.nav nav { display: flex; gap: 20px; }
.nav nav a { color: var(--muted); font-size: 0.92rem; }
.nav nav a:hover { color: var(--text); }

/* Hero */
.hero { padding: 96px 0 80px; }
.eyebrow { color: var(--accent); font-weight: 500; font-size: 0.9rem; margin: 0 0 12px; }
h1 { font-size: clamp(2rem, 6vw, 3.25rem); line-height: 1.15; margin: 0 0 12px; letter-spacing: -0.02em; }
.tagline { font-size: clamp(1.05rem, 2.5vw, 1.3rem); color: var(--muted); margin: 0 0 32px; }

/* Buttons */
.cta { display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  display: inline-block; padding: 11px 20px; border-radius: var(--radius);
  font-weight: 500; font-size: 0.95rem; border: 1px solid transparent;
  transition: background .15s, border-color .15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); color: #fff; }
.btn-secondary { border-color: var(--border); color: var(--text); }
.btn-secondary:hover { border-color: var(--muted); color: var(--text); }

/* Sections */
.section { padding: 72px 0; }
.section.alt { background: var(--bg-alt); }
h2 { font-size: 1.6rem; margin: 0 0 24px; letter-spacing: -0.01em; }
h3 { font-size: 1.05rem; margin: 0; }
.section p { margin: 0 0 16px; color: var(--muted); }

/* Projects */
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; }
.card {
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 22px; display: flex; flex-direction: column;
}
.card p { flex: 1; font-size: 0.95rem; margin: 12px 0 16px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.badge {
  font-size: 0.72rem; font-weight: 600; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--muted); white-space: nowrap;
}
.badge-done, .badge-live { color: #1a7f37; border-color: #1a7f3755; }
.badge-active { color: var(--accent); border-color: var(--accent); }
@media (prefers-color-scheme: dark) { .badge-done, .badge-live { color: #56d364; border-color: #56d36455; } }
.tags { list-style: none; padding: 0; margin: 0 0 16px; display: flex; flex-wrap: wrap; gap: 6px; }
.tags li { font-size: 0.78rem; background: var(--bg-alt); color: var(--muted); padding: 2px 9px; border-radius: 4px; }
.card-link { font-size: 0.9rem; font-weight: 500; }
.card-link.muted { color: var(--muted); font-weight: 400; }

/* Skills */
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 32px; }
.skills h3 { padding-bottom: 10px; margin-bottom: 12px; border-bottom: 2px solid var(--accent); display: inline-block; }
.skills ul { list-style: none; padding: 0; margin: 0; }
.skills li { padding: 6px 0; color: var(--muted); border-bottom: 1px solid var(--border); font-size: 0.95rem; }

/* Footer */
.site-footer { padding: 28px 0; border-top: 1px solid var(--border); color: var(--muted); font-size: 0.88rem; }
.site-footer p { margin: 0; }

@media (max-width: 520px) {
  .nav nav { gap: 14px; }
  .hero { padding: 64px 0 56px; }
  .section { padding: 56px 0; }
  .btn { width: 100%; text-align: center; }
}

/* ---------- Polish ---------- */
::selection { background: var(--accent); color: #fff; }

.skip {
  position: absolute; left: 12px; top: -48px; z-index: 20;
  background: var(--accent); color: #fff; padding: 8px 14px; border-radius: var(--radius);
}
.skip:focus { top: 8px; color: #fff; }

.site-header {
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
}
.nav nav a { position: relative; padding: 4px 0; }
.nav nav a::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 2px;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
  transition: transform .2s ease;
}
.nav nav a.active { color: var(--text); }
.nav nav a.active::after, .nav nav a:hover::after { transform: scaleX(1); }

/* Hero */
.hero { border-bottom: 1px solid var(--border); }
.hero .container { max-width: var(--maxw); }
.hero h1, .tagline { max-width: 18ch; }
.tagline { max-width: 34ch; line-height: 1.45; }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; }
.eyebrow::before {
  content: ""; width: 8px; height: 8px; border-radius: 50%; background: #1a7f37;
  box-shadow: 0 0 0 3px #1a7f3722;
}

/* Section headings */
h2 { display: flex; align-items: center; gap: 14px; }
h2::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.narrow h2 { max-width: 100%; }
#tentang p { font-size: 1.05rem; color: var(--text); opacity: .85; }

/* Cards */
.card { transition: border-color .2s, box-shadow .2s, transform .2s; }
.card:hover {
  border-color: var(--accent);
  box-shadow: 0 6px 20px -10px rgba(16, 24, 40, .25);
  transform: translateY(-2px);
}
.card h3 { font-size: 1.12rem; letter-spacing: -0.01em; }
.card-link { margin-top: auto; align-self: flex-start; }
.card-link:not(.muted)::after { content: ""; }
.badge-progress { color: #9a6700; border-color: #9a670055; }
@media (prefers-color-scheme: dark) { .badge-progress { color: #e3b341; border-color: #e3b34155; } }

/* Skills */
.skills > div { padding: 4px 0; }
.skills li { position: relative; padding-left: 16px; }
.skills li::before {
  content: ""; position: absolute; left: 0; top: 1.05em; width: 6px; height: 1px; background: var(--accent);
}

/* Buttons */
.btn { transition: background .15s, border-color .15s, transform .15s; }
.btn:active { transform: translateY(1px); }

/* Reveal animation */
.js-reveal .reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.js-reveal .reveal.in { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

@media (max-width: 520px) {
  .hero h1, .tagline { max-width: none; }
  h2 { font-size: 1.4rem; }
}

@media print {
  .site-header, .cta, .skip { display: none; }
  .section, .hero { padding: 24px 0; }
  .card { break-inside: avoid; }
}

/* ---------- Content depth ---------- */
.lead { font-size: 1.05rem; margin-bottom: 28px !important; }

.pillars { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 24px; margin-top: 36px; padding-top: 28px; border-top: 1px solid var(--border); }
.pillars h3 { margin-bottom: 6px; }
.pillars p { font-size: 0.92rem; margin: 0; }
#tentang .pillars p { font-size: 0.92rem; opacity: 1; color: var(--muted); }

.services { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 20px; }
.service { padding: 20px 0 0; border-top: 2px solid var(--accent); }
.service h3 { margin-bottom: 8px; }
.service p { font-size: 0.93rem; margin: 0; }

.detail { margin: 0 0 16px; font-size: 0.9rem; display: grid; gap: 4px; }
.detail dt { font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text); margin-top: 8px; }
.detail dd { margin: 0; color: var(--muted); }
.detail ul { margin: 0; padding-left: 18px; }
.detail li { padding: 1px 0; }
.card > p { flex: 0 0 auto; }

/* 2x2 layout for 4 items */
@media (min-width: 720px) {
  .services, .grid { grid-template-columns: repeat(2, 1fr); }
}
.grid { align-items: stretch; }

/* ---------- Experience ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline > li { display: grid; grid-template-columns: 150px 1fr; gap: 24px; padding: 0 0 32px; margin: 0 0 32px; border-bottom: 1px solid var(--border); }
.timeline .when { font-size: 0.85rem; color: var(--muted); padding-top: 3px; }
.timeline .org { margin: 2px 0 12px; color: var(--accent); font-weight: 500; font-size: 0.95rem; }
.timeline ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 0.95rem; }
.timeline ul li { padding: 3px 0; }
.edu-title { margin-top: 8px; }
.edu { margin-top: 8px; color: var(--muted); }
.edu strong { color: var(--text); font-weight: 600; }

@media (max-width: 640px) {
  .timeline > li { grid-template-columns: 1fr; gap: 6px; }
  .brand { display: none; }
  .nav { justify-content: center; }
  .nav nav { gap: 12px; overflow-x: auto; }
  .nav nav a { font-size: 0.85rem; white-space: nowrap; }
}

/* Mobile nav: hide scrollbar, keep swipeable, avoid clipping last item */
@media (max-width: 640px) {
  .nav nav { scrollbar-width: none; -ms-overflow-style: none; max-width: 100%; padding: 0 4px; }
  .nav nav::-webkit-scrollbar { display: none; }
  .nav nav a::after { display: none; }
  .nav nav a.active { color: var(--accent); font-weight: 600; }
}

/* Cards without links: keep spacing consistent */
.card .tags { margin-top: auto; margin-bottom: 0; }
.card .detail { margin-bottom: 18px; }
