/* ---------- Tokens ---------- */
:root {
  --bg: #131313;
  --surface: #1b1b1b;
  --text: #e8e6e3;
  --muted: #9c9893;
  --border: #2b2b2b;
  --accent: #d19a66;

  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --width: 44rem;

  color-scheme: dark;
}

:root[data-theme="light"] {
  --bg: #faf9f7;
  --surface: #f1efeb;
  --text: #1d1b19;
  --muted: #66615b;
  --border: #e0ddd7;
  --accent: #8f5428;

  color-scheme: light;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p, ul, ol, dl, dd, blockquote { margin: 0; }
ul, ol { padding: 0; list-style: none; }

a {
  color: inherit;
  text-decoration-line: underline;
  text-decoration-color: var(--border);
  text-underline-offset: 0.25em;
  transition: color 0.15s, text-decoration-color 0.15s;
}
a:hover { color: var(--accent); text-decoration-color: currentColor; }

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

.container {
  width: 100%;
  max-width: var(--width);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  min-height: 3.5rem;
}

.brand {
  font-weight: 600;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.site-nav {
  display: flex;
  gap: 1.25rem;
  margin-left: auto;
  font-size: 0.9rem;
  color: var(--muted);
}
.site-nav a { text-decoration: none; }
.site-nav a:hover { color: var(--text); }

/* ---------- Theme toggle ---------- */
.theme-toggle {
  position: relative;
  flex: none;
  width: 2.75rem;
  height: 1.5rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s;
}
.theme-toggle:hover { border-color: var(--muted); }

.theme-toggle__thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  display: grid;
  place-items: center;
  width: 1.125rem;
  height: 1.125rem;
  border-radius: 50%;
  background: var(--text);
  color: var(--bg);
  transition: transform 0.2s ease;
}

:root[data-theme="dark"] .theme-toggle__thumb { transform: translateX(1.25rem); }

.theme-toggle .icon { grid-area: 1 / 1; transition: opacity 0.15s; }
:root[data-theme="dark"] .icon-sun,
:root[data-theme="light"] .icon-moon { opacity: 0; }

/* ---------- Hero ---------- */
.hero { padding: 4.5rem 0 3.5rem; }

.eyebrow {
  margin-bottom: 1rem;
  font-size: 0.9rem;
  color: var(--accent);
}

.hero h1 {
  max-width: 20ch;
  font-size: clamp(2rem, 6vw, 2.75rem);
  font-weight: 650;
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.lead {
  max-width: 38rem;
  margin-top: 1.5rem;
  font-size: 1.0625rem;
  color: var(--muted);
}

/* ---------- Sections ---------- */
.section {
  display: grid;
  grid-template-columns: 8rem 1fr;
  gap: 1rem 2rem;
  padding: 2.75rem 0;
  border-top: 1px solid var(--border);
  scroll-margin-top: 3.5rem;
}

.section > h2 {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.65;
}

.section__body { min-width: 0; }

h3 {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}

/* Skills */
.skill-group + .skill-group { margin-top: 2.25rem; }
.skill-group > h3 { margin-bottom: 0.75rem; }

.skill-list > div { padding: 0.5rem 0; }
.skill-list dt { font-weight: 500; }
.skill-list dd { color: var(--muted); font-size: 0.95rem; }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}
.tags li {
  padding: 0.125rem 0.625rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
}

/* Projects */
.project + .project {
  margin-top: 1.75rem;
  padding-top: 1.75rem;
  border-top: 1px solid var(--border);
}
.project p {
  margin-top: 0.375rem;
  font-size: 0.95rem;
  color: var(--muted);
}
.project .tags { margin-top: 0.875rem; }

/* Philosophy */
.quote {
  padding-left: 1.25rem;
  border-left: 2px solid var(--accent);
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--text);
}

.principles {
  margin-top: 2rem;
  display: grid;
  gap: 1.5rem;
  counter-reset: principle;
}
.principles li {
  position: relative;
  padding-left: 2rem;
  counter-increment: principle;
}
.principles li::before {
  content: counter(principle, decimal-leading-zero);
  position: absolute;
  left: 0;
  top: 0.15rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
}
.principles p {
  margin-top: 0.25rem;
  font-size: 0.95rem;
  color: var(--muted);
}

/* Contact */
.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.5rem;
  margin-top: 1rem;
}

.ext::after {
  content: "\2197";
  display: inline-block;
  margin-left: 0.25em;
  font-size: 0.85em;
  text-decoration: none;
}

/* ---------- Footer ---------- */
.site-footer {
  padding: 2rem 0 3rem;
  border-top: 1px solid var(--border);
  font-size: 0.875rem;
  color: var(--muted);
}

/* ---------- Small screens ---------- */
@media (max-width: 40rem) {
  .container { padding-inline: 1rem; }
  .site-header__inner { gap: 0.75rem; }
  .site-nav { gap: 0.75rem; font-size: 0.8rem; }

  .hero { padding: 3rem 0 2.5rem; }

  .section {
    grid-template-columns: 1fr;
    gap: 1rem;
    padding: 2.25rem 0;
  }
  .section > h2 {
    font-size: 1.25rem;
    letter-spacing: -0.01em;
    line-height: 1.3;
  }
}

/* Di layar sangat sempit, nama diberi jalan agar navigasi tidak terjepit. */
@media (max-width: 22.5rem) {
  .brand { display: none; }
  .site-nav { margin-left: 0; }
}

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