/* ============================================================
   DEVRO — The Hunter's Dossier
   Luxury editorial × hacker terminal
   Paper white · Ink · Vermilion · Instrument Serif + Space Grotesk
   ============================================================ */

:root {
  --paper: #faf9f6;
  --paper-2: #f3f1ec;
  --ink: #0e0e0c;
  --ink-60: rgba(14, 14, 12, .62);
  --ink-40: rgba(14, 14, 12, .40);
  --line: rgba(14, 14, 12, .14);
  --accent: #e8442e;
  --serif: "Instrument Serif", Georgia, serif;
  --sans: "Space Grotesk", ui-sans-serif, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(.16, 1, .3, 1);
  --gutter: clamp(20px, 4vw, 56px);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { scroll-behavior: auto; }
html.lenis, html.lenis body { height: auto; }
.lenis.lenis-smooth { scroll-behavior: auto !important; }
body {
  font-family: var(--sans);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
::-webkit-scrollbar { width: 0; height: 0; }
html { scrollbar-width: none; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; padding: 0; }
::selection { background: var(--accent); color: var(--paper); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ---------- grain ---------- */
.grain {
  position: fixed; inset: -50%; z-index: 200; pointer-events: none; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 9s steps(6) infinite;
}
@keyframes grain {
  0%,100% { transform: translate(0,0); } 20% { transform: translate(-4%,3%); }
  40% { transform: translate(3%,-5%); } 60% { transform: translate(-5%,-2%); } 80% { transform: translate(4%,4%); }
}

/* ---------- preloader ---------- */
.preloader {
  position: fixed; inset: 0; z-index: 300; background: var(--ink); color: var(--paper);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: var(--gutter); transition: transform 1s var(--ease);
}
.preloader.done { transform: translateY(-101%); }
.pre-meta { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: rgba(250,249,246,.6); display: flex; justify-content: space-between; }
.pre-count { font-family: var(--serif); font-size: clamp(6rem, 22vw, 18rem); line-height: .85; align-self: flex-end; font-feature-settings: "tnum"; }
.pre-count sup { font-size: .25em; color: var(--accent); }

/* ---------- cursor ---------- */
.cursor, .cursor-tag { position: fixed; top: 0; left: 0; z-index: 250; pointer-events: none; }
.cursor { width: 10px; height: 10px; border-radius: 50%; background: var(--ink); transform: translate(-50%,-50%); transition: width .3s var(--ease), height .3s var(--ease), background .3s, opacity .3s; }
.cursor.grow { width: 56px; height: 56px; background: var(--accent); mix-blend-mode: multiply; }
.cursor-tag {
  font-family: var(--mono); font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--paper); background: var(--ink); padding: 7px 12px; border-radius: 999px;
  transform: translate(-50%,-140%); opacity: 0; transition: opacity .25s;
}
.cursor-tag.show { opacity: 1; }
@media (hover: none), (pointer: coarse) { .cursor, .cursor-tag { display: none; } }

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

/* ---------- header ---------- */
.header {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  display: flex; justify-content: space-between; align-items: center;
  padding: 22px var(--gutter);
  mix-blend-mode: normal;
}
.brand { font-family: var(--sans); font-weight: 700; font-size: 19px; letter-spacing: -.02em; }
.brand sup { font-size: .5em; color: var(--accent); }
.menu-btn {
  font-family: var(--mono); font-size: 12px; letter-spacing: .16em; text-transform: uppercase;
  background: none; border: 1px solid var(--line); border-radius: 999px; padding: 11px 20px;
  cursor: pointer; color: var(--ink); display: flex; align-items: center; gap: 8px;
  transition: background .3s, color .3s, border-color .3s;
}
.menu-btn:hover { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.menu-btn .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); animation: blink 2.2s infinite; }
@keyframes blink { 50% { opacity: .25; } }

/* ---------- overlay menu ---------- */
.menu {
  position: fixed; inset: 0; z-index: 140; background: var(--ink); color: var(--paper);
  display: flex; flex-direction: column; justify-content: space-between;
  padding: calc(var(--gutter) + 40px) var(--gutter) var(--gutter);
  clip-path: inset(0 0 100% 0); transition: clip-path .8s var(--ease);
  visibility: hidden;
}
.menu.open { clip-path: inset(0 0 0% 0); visibility: visible; }
.menu-links a {
  display: flex; align-items: baseline; gap: 18px; padding: 10px 0;
  font-family: var(--serif); font-size: clamp(2.6rem, 8vw, 5.5rem); line-height: 1.05;
  border-bottom: 1px solid rgba(250,249,246,.12);
  transition: color .3s, padding-left .4s var(--ease);
}
.menu-links a:hover { color: var(--accent); padding-left: 20px; }
.menu-links a .idx { font-family: var(--mono); font-size: 12px; color: rgba(250,249,246,.5); }
.menu-foot { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: rgba(250,249,246,.55); flex-wrap: wrap; gap: 10px; }
.menu-close { position: absolute; top: 22px; right: var(--gutter); }

/* ---------- fixed side meta ---------- */
.side-meta {
  position: fixed; bottom: 18px; left: var(--gutter); right: var(--gutter); z-index: 90;
  display: flex; justify-content: space-between; pointer-events: none;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-40);
  opacity: 0; transform: translateY(8px); transition: opacity .6s var(--ease), transform .6s var(--ease);
}
body.scrolled .side-meta { opacity: 1; transform: none; }

/* asterisk spin di hero */
.hero-spin {
  position: absolute; right: var(--gutter); bottom: clamp(180px, 30vh, 300px);
  font-size: clamp(40px, 5vw, 72px); color: var(--accent); line-height: 1;
  animation: spin 14s linear infinite; user-select: none;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 900px) { .hero-spin { display: none; } }

/* ---------- layout ---------- */
.section { padding: clamp(90px, 14vh, 160px) var(--gutter); position: relative; }
.sec-tag {
  font-family: var(--mono); font-size: 11px; letter-spacing: .18em; text-transform: uppercase;
  color: var(--accent); display: flex; align-items: center; gap: 12px; margin-bottom: 34px;
}
.sec-tag::after { content: ""; height: 1px; flex: 1; background: var(--line); }

/* ---------- hero ---------- */
.hero { min-height: 100svh; display: flex; flex-direction: column; justify-content: flex-end; padding: 120px var(--gutter) 110px; position: relative; }
.hero-meta { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-60); margin-bottom: auto; padding-top: 70px; flex-wrap: wrap; gap: 8px; }
.hero-title { font-family: var(--serif); font-weight: 400; font-size: clamp(4.2rem, 15.5vw, 15rem); line-height: .88; letter-spacing: -.02em; text-transform: uppercase; }
.hero-title .it { font-style: italic; color: var(--accent); text-transform: none; letter-spacing: 0; }
.hero-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; flex-wrap: wrap; margin-top: 26px; border-top: 1px solid var(--line); padding-top: 26px; }
.hero-role { font-family: var(--mono); font-size: clamp(13px, 1.6vw, 16px); letter-spacing: .06em; color: var(--ink-60); }
.hero-role #scramble { color: var(--ink); font-weight: 600; }
.hero-role .caret { display: inline-block; width: .55em; height: 1.1em; background: var(--accent); vertical-align: text-bottom; margin-left: 4px; animation: blink 1.1s steps(1) infinite; }
.hero-cta { display: flex; gap: 12px; }

/* ---------- buttons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; gap: 10px; overflow: hidden;
  font-family: var(--mono); font-size: 12px; letter-spacing: .14em; text-transform: uppercase;
  padding: 16px 28px; border-radius: 999px; border: 1px solid var(--ink); cursor: pointer;
  transition: color .35s var(--ease);
}
.btn::before { content: ""; position: absolute; inset: 0; background: var(--ink); border-radius: inherit; transform: translateY(101%); transition: transform .45s var(--ease); z-index: -1; }
.btn:hover { color: var(--paper); }
.btn:hover::before { transform: translateY(0); }
.btn-solid { background: var(--ink); color: var(--paper); }
.btn-solid::before { background: var(--accent); }
.btn-solid:hover { border-color: var(--accent); }

/* ---------- marquee ---------- */
.marquee { border-block: 1px solid var(--line); padding: 22px 0; overflow: hidden; white-space: nowrap; }
.marquee-track { display: inline-flex; gap: 0; will-change: transform; }
.marquee-item { font-family: var(--serif); font-size: clamp(1.6rem, 3.4vw, 2.8rem); font-style: italic; padding: 0 28px; }
.marquee-item:nth-child(even) { -webkit-text-stroke: 1px var(--ink); color: transparent; font-style: normal; }
.marquee-item .sep { color: var(--accent); font-style: normal; margin-right: 56px; }

/* ---------- about ---------- */
.about-grid { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(30px, 6vw, 90px); align-items: start; }
.about-lede { font-family: var(--serif); font-size: clamp(1.7rem, 3.4vw, 2.9rem); line-height: 1.22; letter-spacing: -.01em; }
.about-lede .it { font-style: italic; color: var(--accent); }
.about-body { margin-top: 30px; color: var(--ink-60); font-size: 16.5px; max-width: 56ch; }
.about-body p + p { margin-top: 16px; }
.facts { margin-top: 44px; border-top: 1px solid var(--line); }
.fact-row { display: grid; grid-template-columns: 110px 1fr; gap: 18px; padding: 16px 0; border-bottom: 1px solid var(--line); align-items: baseline; }
.fact-row dt { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-40); }
.fact-row dd { font-size: 15.5px; }
.about-visual { position: relative; }
.about-visual .frame { overflow: hidden; border-radius: 4px; }
.about-visual img { aspect-ratio: 4/5; object-fit: cover; width: 100%; transform: scale(1.12); will-change: transform; }
.about-visual figcaption { font-family: var(--mono); font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-40); margin-top: 12px; display: flex; justify-content: space-between; }

/* ---------- research list ---------- */
.work-list { border-top: 1px solid var(--line); }
.work-row {
  display: grid; grid-template-columns: 70px 1fr auto 40px; gap: 20px; align-items: center;
  padding: 34px 0; border-bottom: 1px solid var(--line); position: relative; cursor: pointer;
  transition: padding .4s var(--ease);
}
.work-row:hover { padding-left: 18px; }
.work-idx { font-family: var(--mono); font-size: 12px; color: var(--ink-40); }
.work-name { font-family: var(--serif); font-size: clamp(1.9rem, 4.6vw, 3.6rem); line-height: 1; letter-spacing: -.01em; transition: color .3s, font-style .3s; }
.work-row:hover .work-name { color: var(--accent); font-style: italic; }
.work-desc { font-family: var(--mono); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-60); text-align: right; }
.work-arrow { font-size: 22px; transition: transform .4s var(--ease); }
.work-row:hover .work-arrow { transform: translate(6px, -6px); color: var(--accent); }
.work-preview {
  position: fixed; z-index: 80; width: 340px; aspect-ratio: 4/3; border-radius: 6px; overflow: hidden;
  pointer-events: none; opacity: 0; transform: translate(-50%,-50%) scale(.85) rotate(-3deg);
  transition: opacity .35s var(--ease), transform .45s var(--ease);
}
.work-preview.show { opacity: 1; transform: translate(-50%,-50%) scale(1) rotate(0deg); }
.work-preview img { width: 100%; height: 100%; object-fit: cover; }
@media (hover: none), (pointer: coarse) { .work-preview { display: none; } }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); border-block: 1px solid var(--line); }
.stat { padding: 44px 26px; border-right: 1px solid var(--line); }
.stat:last-child { border-right: 0; }
.stat-num { font-family: var(--serif); font-size: clamp(3rem, 7vw, 6rem); line-height: 1; font-feature-settings: "tnum"; }
.stat-num sup { font-size: .35em; color: var(--accent); }
.stat-label { font-family: var(--mono); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-40); margin-top: 12px; }

/* ---------- platforms ---------- */
.plat-row {
  display: flex; justify-content: space-between; align-items: center; gap: 20px;
  padding: 30px 0; border-bottom: 1px solid var(--line); position: relative; overflow: hidden;
}
.plat-row::before { content: ""; position: absolute; inset: 0; background: var(--ink); transform: scaleY(0); transform-origin: bottom; transition: transform .45s var(--ease); z-index: 0; }
.plat-row:hover::before { transform: scaleY(1); }
.plat-row > * { position: relative; z-index: 1; transition: color .35s; }
.plat-row:hover > * { color: var(--paper); }
.plat-name { font-family: var(--serif); font-size: clamp(1.7rem, 4vw, 3rem); line-height: 1; }
.plat-url { font-family: var(--mono); font-size: 12px; letter-spacing: .1em; color: var(--ink-60); }
.plat-arrow { font-size: 22px; }

/* ---------- cv ---------- */
.cv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(30px, 6vw, 90px); align-items: center; }
.cv-title { font-family: var(--serif); font-size: clamp(2.6rem, 6vw, 5rem); line-height: 1; }
.cv-title .it { font-style: italic; color: var(--accent); }
.cv-items { border-top: 1px solid var(--line); margin-top: 40px; }
.cv-item { display: grid; grid-template-columns: 26px 1fr; gap: 14px; padding: 18px 0; border-bottom: 1px solid var(--line); }
.cv-item .n { font-family: var(--mono); font-size: 11px; color: var(--accent); padding-top: 3px; }
.cv-item b { font-size: 15.5px; display: block; }
.cv-item p { font-size: 13.5px; color: var(--ink-60); margin-top: 2px; }

/* ---------- footer ---------- */
.footer { background: var(--ink); color: var(--paper); padding: clamp(90px, 14vh, 150px) var(--gutter) 30px; }
.footer .sec-tag { color: var(--accent); }
.footer .sec-tag::after { background: rgba(250,249,246,.16); }
.footer-cta { display: block; font-family: var(--serif); font-size: clamp(3.4rem, 11vw, 10rem); line-height: .95; text-transform: uppercase; letter-spacing: -.01em; transition: color .4s; }
.footer-cta .it { font-style: italic; text-transform: none; }
.footer-cta:hover { color: var(--accent); }
.footer-mail { display: inline-block; margin-top: 34px; font-family: var(--mono); font-size: clamp(14px, 2vw, 18px); letter-spacing: .06em; border-bottom: 1px solid rgba(250,249,246,.3); padding-bottom: 6px; transition: border-color .3s, color .3s; }
.footer-mail:hover { color: var(--accent); border-color: var(--accent); }
.footer-grid { display: flex; justify-content: space-between; gap: 30px; flex-wrap: wrap; margin-top: 90px; padding-top: 26px; border-top: 1px solid rgba(250,249,246,.14); font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: rgba(250,249,246,.5); }
.footer-grid a:hover { color: var(--accent); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- reveal ---------- */
.line { display: block; overflow: hidden; }
.line > span { display: block; transform: translateY(115%) rotate(3deg); transform-origin: 0 100%; transition: transform 1.1s var(--ease); transition-delay: var(--d, 0s); will-change: transform; }
.in .line > span, .line.in > span { transform: translateY(0) rotate(0); }
.fade { opacity: 0; transform: translateY(26px); transition: opacity .9s var(--ease), transform .9s var(--ease); transition-delay: var(--d, 0s); }
.fade.in { opacity: 1; transform: none; }
.img-reveal { clip-path: inset(0 0 100% 0); transition: clip-path 1.2s var(--ease); transition-delay: var(--d, 0s); }
.img-reveal.in { clip-path: inset(0 0 0% 0); }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .grain, .cursor, .cursor-tag { display: none; }
  .line > span, .fade, .img-reveal { transition: none; transform: none; opacity: 1; clip-path: none; }
  .preloader { display: none; }
  .menu { transition: none; }
}

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .about-grid, .cv-grid { grid-template-columns: 1fr; }
  .about-visual { order: -1; max-width: 420px; }
  .stats { grid-template-columns: 1fr 1fr; }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .work-row { grid-template-columns: 44px 1fr 30px; }
  .work-desc { display: none; }
  .side-meta { display: none; }
}
@media (max-width: 560px) {
  .hero { padding-bottom: 80px; }
  .hero-meta { padding-top: 90px; }
  .work-row { padding: 26px 0; }
  .stats { grid-template-columns: 1fr; }
  .stat { border-right: 0; border-bottom: 1px solid var(--line); padding: 30px 0; }
  .stat:last-child { border-bottom: 0; }
}

/* viewport pendek: kecilkan hero biar muat tanpa overflow (harus SETELAH rule dasar) */
@media (max-height: 760px) and (min-width: 901px) {
  .hero { padding: 84px var(--gutter) 44px; }
  .hero-meta { padding-top: 24px; }
  .hero-title { font-size: clamp(2.6rem, min(12vw, 14vh), 8rem); }
  .hero-row { margin-top: 18px; padding-top: 18px; }
  .btn { padding: 12px 22px; }
  .hero-spin { bottom: 128px; font-size: 40px; }
}

/* ============================================================
   INTERAKSI v3 — terminal, magnetic, particles, tilt, glitch
   ============================================================ */

/* hero letters */
.ltr { display: inline-block; transition: transform .3s var(--ease), color .3s; }
.ltr.jump { transform: translateY(-14%) rotate(-6deg) scale(1.06); color: var(--accent); }

/* magnetic transitions (override base) */
.btn { transition: color .35s var(--ease), transform .25s var(--ease); will-change: transform; }
.menu-btn { transition: background .3s, color .3s, border-color .3s, transform .25s var(--ease); will-change: transform; }

/* tilt pada frame about */
.about-visual .frame { transition: clip-path 1.2s var(--ease), transform .3s var(--ease); will-change: transform; transform-style: preserve-3d; }

/* particles */
.pt { position: fixed; z-index: 240; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); pointer-events: none; transform: translate(-50%,-50%); animation: pt .6s var(--ease) forwards; }
@keyframes pt { to { transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0); opacity: 0; } }

/* glitch easter egg */
@keyframes glitchShake {
  0% { transform: translate(0); } 25% { transform: translate(-6px,3px) skewX(3deg); }
  50% { transform: translate(5px,-2px); } 75% { transform: translate(-3px,2px) skewX(-2deg); } 100% { transform: translate(0); }
}
@keyframes flick { 50% { color: var(--ink); } }
body.glitch .hero-title { animation: glitchShake .1s steps(2) 8; }
body.glitch .hero-title .it { animation: flick .15s steps(1) 5; }
body.glitch .grain { opacity: .25; }

/* terminal */
.term-window {
  background: #121210; border: 1px solid rgba(14,14,12,.9); border-radius: 12px;
  overflow: hidden; box-shadow: 0 30px 80px rgba(14,14,12,.22);
}
.term-bar { display: flex; align-items: center; gap: 8px; padding: 13px 16px; border-bottom: 1px solid rgba(250,249,246,.08); }
.term-bar i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.term-bar i:nth-child(1) { background: #ff5f57; }
.term-bar i:nth-child(2) { background: #febc2e; }
.term-bar i:nth-child(3) { background: #28c840; }
.term-bar span { margin-left: 8px; font-family: var(--mono); font-size: 11px; color: rgba(250,249,246,.45); letter-spacing: .08em; }
.term-body { padding: 20px 18px 8px; height: 300px; overflow-y: auto; font-family: var(--mono); font-size: 13px; line-height: 1.75; color: #e9e7df; }
.term-body::-webkit-scrollbar { width: 4px; }
.term-body::-webkit-scrollbar-thumb { background: rgba(250,249,246,.18); border-radius: 4px; }
.term-line { white-space: pre-wrap; word-break: break-word; }
.term-line a { color: #8fd98f; text-decoration: underline; text-underline-offset: 3px; }
.term-line .tp { color: var(--accent); }
.term-line .dim { color: rgba(233,231,223,.45); }
.term-line.ok { color: #8fd98f; }
.term-in-row { display: flex; align-items: center; gap: 8px; padding: 10px 18px 16px; }
.term-in-row .tp { color: var(--accent); font-family: var(--mono); font-size: 13px; }
#termIn { flex: 1; background: none; border: 0; outline: 0; color: #e9e7df; font-family: var(--mono); font-size: 13px; caret-color: var(--accent); }
#termIn::placeholder { color: rgba(233,231,223,.3); }
.term-hint { margin-top: 14px; font-family: var(--mono); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-40); }

@media (prefers-reduced-motion: reduce) {
  .pt, .ltr.jump { display: none; }
  body.glitch .hero-title, body.glitch .hero-title .it, body.glitch .grain { animation: none; }
  .btn, .menu-btn, .about-visual .frame { transition: none; }
}
