/* ==========================================================================
   krayna.id — satu file CSS untuk semua halaman.
   1. Token (warna, font, radius) — ubah di sini, seluruh situs ikut berubah
   2. Dasar   3. Header & nav   4. Komponen umum   5. Per halaman
   ========================================================================== */

/* 1. Token ---------------------------------------------------------------- */
:root {
  --bg: #0A0F14;            /* latar halaman */
  --surface: #111820;       /* kartu, panel */
  --border: #1E2833;        /* garis pemisah */
  --border-input: #2A3644;  /* border kolom form */
  --text: #E6EDF3;          /* teks utama */
  --muted: #9AA7B4;         /* teks sekunder */
  --nav: #C9D3DD;           /* teks nav & link sekunder */
  --accent: #4ADE80;        /* hijau aksen */
  --accent-hover: #86EFAC;  /* hijau saat hover */
  --accent-bg: #0F2A1B;     /* latar hijau gelap */
  --error: #FCA5A5;         /* teks error */
  --error-border: #F87171;  /* border kolom error */

  --sans: "Inter", ui-sans-serif, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --max: 1100px;
}

@font-face { font-family: "Inter"; src: url("../fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("../fonts/jetbrains-mono.woff2") format("woff2"); font-weight: 100 800; font-display: swap; }

/* 2. Dasar ---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { background: var(--bg); color-scheme: dark; }
body {
  display: flex; flex-direction: column; min-height: 100vh;
  background: var(--bg); color: var(--text);
  font-family: var(--sans); line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
ul, ol { list-style: none; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); }
.accent { color: var(--accent); }
.muted { color: var(--muted); }

/* Fokus keyboard: outline hijau 2px */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* Hover/press halus; dimatikan untuk pengguna reduced-motion */
a, button, input, textarea { transition: color .15s ease, background-color .15s ease, border-color .15s ease; }
a:active, button:active { opacity: .85; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Elemen yang hanya berguna dengan JS disembunyikan saat JS mati */
html:not(.js) .js-only { display: none; }

.skip-link {
  position: absolute; left: -9999px; top: 16px; z-index: 100;
  padding: 12px 16px; border-radius: var(--radius-sm);
  background: var(--accent); color: var(--bg); font-family: var(--mono);
}
.skip-link:focus { left: 16px; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 20px; }
main { flex: 1; }
@media (min-width: 768px) { .container { padding: 0 24px; } }

/* 3. Header & nav --------------------------------------------------------- */
.site-header { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 16px; padding-bottom: 16px; }
@media (min-width: 768px) { .site-header { padding-top: 24px; padding-bottom: 24px; } }

.logo {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border: 2px solid var(--accent); border-radius: var(--radius-md);
  font-family: var(--mono); font-size: 20px; color: var(--accent);
}
.logo:hover { background: var(--accent-bg); }

.nav { font-family: var(--mono); }
.nav ul { display: flex; flex-direction: column; }
.nav a {
  display: flex; align-items: center; min-height: 56px;
  border-bottom: 1px solid var(--border); font-size: 18px; color: var(--nav);
}
.nav li:last-child a { border-bottom: 0; }
.nav a:hover, .nav a[aria-current="page"] { color: var(--accent); }

.menu-toggle {
  display: none; align-items: center; justify-content: center;
  width: 48px; height: 48px; background: transparent; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--radius-md); color: var(--accent);
}
.menu-toggle:hover { background: var(--accent-bg); }
.menu-toggle .icon-close { display: none; }
.menu-toggle[aria-expanded="true"] .icon-open { display: none; }
.menu-toggle[aria-expanded="true"] .icon-close { display: block; }

/* Mobile: tanpa JS nav tampil sebagai daftar; dengan JS jadi menu hamburger */
@media (max-width: 767px) {
  .site-header { flex-wrap: wrap; }
  .nav { width: 100%; }
  .js .menu-toggle { display: inline-flex; }
  .js .nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0; z-index: 20;
    padding: 8px 20px 20px; background: var(--surface);
    border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  }
  .js .nav.is-open { display: block; }
}
@media (min-width: 768px) {
  .nav ul { flex-direction: row; gap: 4px; }
  .nav a { min-height: 44px; padding: 0 14px; border: 0; font-size: 14px; }
}

.site-footer { padding: 32px 24px; text-align: center; font-family: var(--mono); font-size: 13px; color: var(--muted); }

/* 4. Komponen umum -------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: 0 24px;
  border: 1px solid var(--accent); border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: 14px; color: var(--accent); background: transparent; cursor: pointer;
}
.btn:hover { background: var(--accent-bg); }
.btn-sm { min-height: 44px; padding: 0 18px; }
.link {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 18px;
  font-family: var(--mono); font-size: 14px; color: var(--nav);
  text-decoration: underline; text-underline-offset: 4px;
}
.link:hover { color: var(--accent-hover); }

.page { display: flex; flex-direction: column; gap: 32px; padding: 40px 0 80px; }
@media (min-width: 768px) { .page { padding-top: 56px; } }

.page-title { display: flex; align-items: center; gap: 16px; font-size: 30px; font-weight: 700; line-height: 1.2; }
.page-title::after { content: ""; flex: 1; max-width: 300px; height: 1px; background: var(--border); }
.section-title { display: flex; align-items: center; gap: 16px; font-size: 28px; font-weight: 700; line-height: 1.2; }
.section-title::after { content: ""; flex: 1; max-width: 300px; height: 1px; background: var(--border); }

.panel { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.tags { display: flex; flex-wrap: wrap; gap: 4px 16px; font-family: var(--mono); font-size: 13px; color: var(--muted); }

/* 5. Per halaman ---------------------------------------------------------- */

/* Beranda */
.hero { display: grid; gap: 48px; align-items: start; padding: 40px 0 64px; }
@media (min-width: 768px) { .hero { grid-template-columns: 1.1fr 1fr; gap: 56px; padding: 80px 0 96px; } }
.hero-label { margin-bottom: 16px; font-family: var(--mono); font-size: 14px; color: var(--accent); }
.hero h1 { margin-bottom: 20px; font-size: clamp(2.4rem, 7vw, 3.75rem); line-height: 1.03; font-weight: 800; letter-spacing: -0.035em; }
.hero-lead { max-width: 34rem; margin-bottom: 16px; font-size: 18px; line-height: 1.65; color: var(--muted); }
.hero-lead strong { font-weight: 600; color: var(--text); }
.hero-text { max-width: 34rem; margin-bottom: 32px; line-height: 1.65; color: var(--muted); }
.hero-cta { display: flex; flex-direction: column; gap: 12px; }
@media (min-width: 640px) { .hero-cta { flex-direction: row; align-items: center; } }
.hero-side { display: flex; flex-direction: column; gap: 16px; }

.terminal { font-family: var(--mono); font-size: 13px; }
.terminal-bar { display: flex; justify-content: space-between; gap: 16px; padding: 10px 16px; border-bottom: 1px solid var(--border); color: var(--muted); }
.terminal-body { padding: 16px; line-height: 1.9; }
.service { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; column-gap: 16px; }
.service a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; word-break: break-all; }
.service a:hover { color: var(--accent-hover); }
.dot { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.dot.down { background: var(--error-border); }
.status-live { color: var(--accent); }
.status-down { color: var(--error); }
.specs { display: grid; grid-template-columns: 3rem 1fr; column-gap: 16px; }
.specs dt { color: var(--muted); }
.specs dd { text-align: right; }
.me { display: flex; align-items: center; gap: 14px; }
.avatar { width: 64px; height: 64px; border-radius: 50%; border: 2px solid var(--accent); object-fit: cover; }

/* Tentang */
.about { display: flex; flex-direction: column-reverse; gap: 48px; }
@media (min-width: 768px) { .about { flex-direction: row; align-items: flex-start; } }
.about-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; font-size: 17px; line-height: 1.75; color: var(--muted); }
.about-text strong { font-weight: 400; color: var(--accent); }
.about-photo { width: 100%; max-width: 300px; aspect-ratio: 1; border-radius: var(--radius-md); border: 2px solid var(--accent); object-fit: cover; }
.tech { display: grid; max-width: 28rem; gap: 8px 24px; font-family: var(--mono); font-size: 14px; color: var(--text); }
@media (min-width: 640px) { .tech { grid-template-columns: 1fr 1fr; } }
.tech li::before { content: "▹ "; color: var(--accent); }
.timeline li { display: flex; flex-direction: column; gap: 8px; padding: 20px 0; }
@media (min-width: 768px) { .timeline li { flex-direction: row; gap: 32px; } }
.timeline .period { flex-shrink: 0; padding-top: 2px; font-family: var(--mono); font-size: 13px; color: var(--muted); }
@media (min-width: 768px) { .timeline .period { width: 11rem; } }
.timeline .role { font-size: 17px; font-weight: 600; }
.timeline .desc { margin-top: 8px; line-height: 1.65; color: var(--muted); }

/* Portofolio */
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters button {
  min-height: 44px; padding: 0 16px; cursor: pointer; background: transparent;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: 14px; color: var(--nav);
}
.filters button:hover { border-color: var(--accent); color: var(--accent); }
.filters button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-bg); color: var(--accent); }
.projects { display: flex; flex-direction: column; gap: 24px; }
.project { display: flex; flex-direction: column; gap: 32px; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
@media (min-width: 768px) { .project { flex-direction: row; padding: 28px; } }
.project img { width: 100%; aspect-ratio: 16 / 10; border: 1px solid var(--border); border-radius: var(--radius-sm); object-fit: cover; }
@media (min-width: 768px) { .project img { max-width: 420px; } }
.project-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.project-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.project-cat { font-family: var(--mono); font-size: 13px; color: var(--accent); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; background: var(--accent-bg); font-family: var(--mono); font-size: 12px; color: var(--accent-hover); }
.badge .dot { width: 6px; height: 6px; }
.project h2 { font-size: 24px; font-weight: 700; line-height: 1.25; }
.case { display: grid; gap: 8px 16px; font-size: 15px; line-height: 1.65; }
@media (min-width: 640px) { .case { grid-template-columns: 5rem 1fr; } }
.case dt { padding-top: 2px; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.case dd { color: var(--nav); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

/* Homelab */
.article { max-width: 900px; margin: 0 auto; display: flex; flex-direction: column; gap: 56px; padding: 24px 0 80px; }
.article header { display: flex; flex-direction: column; gap: 16px; }
.back { display: inline-flex; align-items: center; align-self: flex-start; min-height: 44px; font-family: var(--mono); font-size: 14px; color: var(--muted); }
.back:hover { color: var(--accent); }
.article h1 { font-size: clamp(2.1rem, 6vw, 3rem); line-height: 1.15; font-weight: 800; letter-spacing: -0.03em; }
.article h2 { font-size: 26px; font-weight: 700; }
.article h2 .num { font-family: var(--mono); font-weight: 400; color: var(--accent); }
.article section { display: flex; flex-direction: column; gap: 14px; }
.prose { font-size: 17px; line-height: 1.75; color: var(--muted); }
.steps { display: flex; flex-direction: column; gap: 10px; color: var(--nav); }
.steps li { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.steps .n { font-family: var(--mono); color: var(--accent); }
code { padding: 2px 8px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface); font-family: var(--mono); color: var(--accent); }

.diagram { display: flex; flex-direction: column; align-items: center; padding: 20px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); font-family: var(--mono); font-size: 14px; }
@media (min-width: 768px) { .diagram { padding: 32px; } }
.node { padding: 14px 24px; border: 1px solid var(--border-input); border-radius: var(--radius-sm); text-align: center; }
.node.hl { border-color: var(--accent); color: var(--accent); }
.node small, .box small { display: block; font-size: 12px; color: var(--muted); }
.wire { width: 2px; height: 28px; background: var(--accent); }
.wire.short { height: 16px; align-self: center; }
.host { width: 100%; display: flex; flex-direction: column; gap: 16px; padding: 16px; border: 1px dashed var(--accent); border-radius: var(--radius-md); }
@media (min-width: 768px) { .host { padding: 20px; } }
.host > p { font-size: 13px; color: var(--accent); }
.vm { display: flex; flex-direction: column; gap: 12px; padding: 16px; border: 1px solid var(--border-input); border-radius: var(--radius-sm); background: var(--bg); }
.vm > p { font-size: 13px; color: var(--muted); }
.box { padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); font-size: 13px; word-break: break-all; }
.box.hl { border-color: var(--accent); background: var(--accent-bg); color: var(--accent-hover); }
.containers { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.diagram figcaption { margin-top: 16px; text-align: center; font-family: var(--sans); font-size: 13px; color: var(--muted); }

/* Kontak */
.contact { display: flex; flex-direction: column; gap: 56px; padding: 40px 0 64px; }
@media (min-width: 768px) { .contact { flex-direction: row; padding-top: 56px; } }
.contact > section { flex: 1; display: flex; flex-direction: column; gap: 18px; }
.contact h1 { font-size: clamp(2.25rem, 6vw, 3.25rem); line-height: 1.08; font-weight: 800; letter-spacing: -0.03em; }
.contact-list { margin-top: 16px; font-family: var(--mono); font-size: 14px; }
.contact-list a, .contact-list .row { display: flex; align-items: center; gap: 16px; min-height: 44px; word-break: break-all; }
.contact-list a:hover { color: var(--accent); }
.contact-list .row { color: var(--muted); }
.contact-list .label { width: 80px; flex-shrink: 0; color: var(--accent); }
.form-card { padding: 24px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
@media (min-width: 768px) { .form-card { padding: 36px; } }
.form-card h2 { font-family: var(--mono); font-size: 15px; font-weight: 400; color: var(--muted); }
.form-note { font-size: 13px; color: var(--muted); }
.req { color: var(--error); }
form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 8px; }
.field label { font-size: 14px; font-weight: 500; color: var(--nav); }
.field input, .field textarea {
  width: 100%; min-height: 48px; padding: 0 14px; font-size: 16px;
  background: var(--bg); border: 1px solid var(--border-input); border-radius: var(--radius-sm);
}
.field textarea { padding: 14px; resize: vertical; }
.field ::placeholder { color: var(--muted); }
.field [aria-invalid="true"] { border-color: var(--error-border); }
.field-error { font-size: 13px; color: var(--error); }
form .btn { min-height: 52px; }
form .btn:disabled { cursor: wait; opacity: .6; }
.msg { padding: 14px 16px; border: 1px solid; border-radius: var(--radius-sm); }
.msg:empty { padding: 0; border: 0; }
.msg-status[data-result="sent"] { border-color: var(--accent); background: var(--accent-bg); color: var(--accent-hover); }
.msg-status[data-result="inactive"] { border-color: var(--border-input); color: var(--nav); }
.msg-error { border-color: var(--error-border); color: var(--error); }
.noscript-note { padding: 14px 16px; border: 1px solid var(--border-input); border-radius: var(--radius-sm); color: var(--nav); }
.noscript-note a { color: var(--accent); text-decoration: underline; text-underline-offset: 4px; }

/* 404 */
.notfound { display: flex; flex-direction: column; align-items: flex-start; gap: 24px; padding: 80px 0; }
.notfound .terminal-body { width: 100%; max-width: 36rem; }
.notfound h1 { font-size: 30px; font-weight: 700; }
