/* ═══════════════════════════════════════════
   Portfolio v2 — developer minimal
   JetBrains Mono, one narrow column, terminal green
   ═══════════════════════════════════════════ */

:root {
  /* charcoal / off-black, bukan hitam pekat */
  --bg: #121212;
  --ink: #d6d8d6;
  --dim: #767c76;
  --green: #4ade80;
  --glow: rgba(74, 222, 128, 0.45);
  --line: #272727;
  --col: 720px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #fdfdfb;
  --ink: #212722;
  --dim: #7c837c;
  --green: #166534; /* forest green — kontras kuat di putih */
  --glow: rgba(22, 101, 52, 0.35);
  --line: #e6e8e4;
  color-scheme: light;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: clamp(13px, 12px + 0.25vw, 14px);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--green); color: var(--bg); }

a { color: inherit; text-decoration: none; }
em { font-style: italic; color: var(--green); }
img { max-width: 100%; }
ul { list-style: none; }

.dim { color: var(--dim); }
.prompt { color: var(--green); }
.sep { color: var(--dim); margin: 0 10px; }

.link {
  color: var(--ink);
  border-bottom: 1px solid var(--dim);
  transition: color 0.2s, border-color 0.2s;
}
.link:hover { color: var(--green); border-color: var(--green); }

.dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  margin-right: 8px;
  vertical-align: 1px;
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--glow); }
  50% { box-shadow: 0 0 0 6px transparent; }
}

body, .nav { transition: background-color 0.25s, color 0.25s, border-color 0.25s; }

.theme-btn {
  font: inherit;
  color: var(--dim);
  background: none;
  border: 0;
  cursor: pointer;
  transition: color 0.2s;
}
.theme-btn:hover { color: var(--green); }

:focus-visible {
  outline: 1px dashed var(--green);
  outline-offset: 3px;
}

/* ── scroll progress ── */
.progress {
  position: fixed;
  top: 0; left: 0;
  height: 2px;
  width: 100%;
  background: var(--green);
  transform: scaleX(0);
  transform-origin: left;
  z-index: 20;
}

/* ── nav ── */
.nav {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  max-width: var(--col);
  margin: 0 auto;
  padding: 20px 24px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav__logo { font-weight: 700; white-space: nowrap; }
.nav nav { display: flex; flex-wrap: wrap; gap: 18px; }
.nav nav a { color: var(--dim); transition: color 0.2s; }
.nav nav a:hover, .nav nav a.active { color: var(--green); }

/* ── layout ── */
main { max-width: var(--col); margin: 0 auto; padding: 0 24px 40px; }

.hero { padding: 96px 0 72px; }
.hero__cmd { margin-bottom: 28px; }
.cursor {
  display: inline-block;
  width: 8px; height: 1.1em;
  background: var(--green);
  vertical-align: text-bottom;
  margin-left: 2px;
  animation: blink 1.1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.cursor--sm { width: 7px; height: 1em; margin-left: 4px; }

.hero h1 { font-size: 22px; font-weight: 700; }
.hero__tagline { margin: 20px 0 4px; font-size: 17px; }
.hero__out > p + p, .hero__out > p + h1 { margin-top: 4px; }
.hero__stats { margin-top: 24px; }
.hero__stats span:not(.sep) { display: inline-block; }
.hero__stats i { font-style: normal; color: var(--dim); }
.status { margin-top: 24px; color: var(--dim); }

/* ── sections ── */
.section {
  border-top: 1px solid var(--line);
  padding: 56px 0;
}
.section h2 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 28px;
}
.comment { font-weight: 400; }
.hash { color: var(--dim); transition: color 0.2s; }
h2:hover .hash, .hash:hover { color: var(--green); }
.section > p + p { margin-top: 14px; }
.section p { max-width: 62ch; }

/* ── photo (1-bit dither, hover reveals real) ── */
.photo {
  float: right;
  width: auto; /* mengikuti lebar intrinsik ASCII art */
  margin: 6px 0 20px 32px;
}
.photo__frame {
  position: relative;
  border: 1px solid var(--line);
  overflow: hidden;
}
.photo__ascii {
  display: block;
  font-family: inherit;
  font-size: 5.4px;
  line-height: 1.2;
  letter-spacing: 0;
  color: var(--ink);
  user-select: none;
  position: relative;
  z-index: 1;
  transition: opacity 0.3s, color 0.2s;
}
/* fallback tanpa JS: fade biasa; dengan JS, scramble jalan duluan */
.photo__frame:hover .photo__ascii { opacity: 0; transition-delay: 0.8s; }
.photo__frame:hover .photo__ascii,
.photo__ascii.is-decrypting { color: var(--green); }
.photo__real {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.05);
  opacity: 0;
  transition: opacity 0.8s ease 0.2s; /* selesai bareng scramble 1000ms */
}
.photo__frame:hover .photo__real { opacity: 1; }
.photo figcaption {
  font-size: 11px;
  margin-top: 8px;
}

/* key-value lists */
.kv { margin-top: 28px; }
.kv div {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 16px;
  padding: 8px 0;
  border-top: 1px dashed var(--line);
}
.kv div:last-child { border-bottom: 1px dashed var(--line); }
.kv dt { color: var(--dim); }
.kv dt::after { content: ":"; }
.kv--stack dd { color: var(--ink); }

/* ── work ── */
.project { margin-bottom: 44px; }
.project:last-of-type { margin-bottom: 28px; }
.project h3 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 10px;
}
.project h3 > .dim { transition: color 0.25s; }
.project:hover h3 > .dim { color: var(--green); }

.copy-btn {
  font: inherit;
  font-size: 12px;
  color: var(--dim);
  background: none;
  border: 0;
  cursor: pointer;
  margin-left: 10px;
  transition: color 0.2s;
}
.copy-btn:hover { color: var(--green); }
.copy-btn.copied { color: var(--green); }
.tag {
  font-weight: 400;
  font-size: 12px;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1px 8px;
  margin-left: 8px;
  white-space: nowrap;
}
.tag--classified { color: var(--green); border-color: color-mix(in srgb, var(--green) 40%, transparent); }
.stack-line { margin-top: 10px; font-size: 12px; }

/* ── experience ── */
.job { margin-bottom: 44px; }
.job:last-of-type { margin-bottom: 0; }
.job h3 { font-size: 14px; font-weight: 700; }
.job .meta { font-size: 12px; margin: 6px 0 14px; }
.job ul li {
  position: relative;
  padding-left: 20px;
  color: var(--ink);
  max-width: 68ch;
}
.job ul li + li { margin-top: 10px; }
.job ul li::before {
  content: "-";
  position: absolute;
  left: 0;
  color: var(--green);
}

/* ── footer ── */
.footer {
  border-top: 1px solid var(--line);
  padding: 28px 0;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}
.footer .status { margin-top: 0; }
.footer__built {
  flex-basis: 100%;
  font-size: 12px;
}

/* ── reveal defaults (JS animates in) ── */
.js .reveal { opacity: 0; transform: translateY(14px); }

/* ── responsive ── */
@media (max-width: 640px) {
  /* nav jadi dua baris rapi: logo di atas, links merata di bawah */
  .nav { flex-wrap: wrap; padding-top: 14px; padding-bottom: 14px; row-gap: 6px; }
  .nav nav { width: 100%; justify-content: space-between; gap: 6px; }
  .nav nav a, .theme-btn { font-size: 12px; }
}

@media (max-width: 560px) {
  /* stats hero: satu item per baris, tanpa separator menggantung */
  .hero__stats .sep { display: none; }
  .hero__stats span:not(.sep) { display: block; margin-top: 4px; }
  .photo { width: auto; margin: 4px 0 12px 18px; }
  .photo__ascii { font-size: 3.4px; }
  .photo__hint { display: none; }
  .hero { padding: 64px 0 56px; }
  .kv div { grid-template-columns: 1fr; gap: 2px; }
  .sep { margin: 0 6px; }
}

/* ── reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .js .reveal { opacity: 1; transform: none; }
  .cursor { animation: none; }
}
