/* juansah.com: gelap, tenang, satu nama besar. Gerak hanya dari CSS + sedikit JS (jam, panel proyek, jeda gerak). */

@font-face {
  font-family: "Archivo";
  src: url("/fonts/archivo-latin-wdth-normal.woff2") format("woff2-variations");
  font-weight: 100 900; font-stretch: 62% 125%; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Archivo";
  src: url("/fonts/archivo-latin-wdth-italic.woff2") format("woff2-variations");
  font-weight: 100 900; font-stretch: 62% 125%; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/geist-mono-latin-wght-normal.woff2") format("woff2-variations");
  font-weight: 100 900; font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #111010;
  --fg: #edeae4;
  --mute: #8c8984;
  --dim: #3a3836;
  --line: #2a2928;
  --accent: #a9bfff;
  --on-accent: #0c1226;
  --pad: clamp(1rem, 3vw, 2.8rem);
  --sans: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }
@media (prefers-reduced-motion: no-preference) { html:not(.still) { scroll-behavior: smooth; } }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body { font: 400 1rem/1.55 var(--sans); overflow-x: clip; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
:focus-visible { outline: 2px dashed var(--accent); outline-offset: 4px; border-radius: 2px; }
::selection { background: var(--accent); color: var(--on-accent); }

.mono, .meta, .eyebrow, .bar nav, .clock, .foot-row { font: 500 .74rem/1.4 var(--mono); letter-spacing: .06em; text-transform: uppercase; }

.skip { position: absolute; left: var(--pad); top: -4rem; background: var(--accent); color: var(--on-accent); padding: .6rem 1rem; z-index: 20; }
.skip:focus { top: 1rem; }

/* ---------- bar atas ---------- */
.bar {
  position: fixed; inset: 0 0 auto; z-index: 10;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1rem;
  padding: .9rem var(--pad);
  background: linear-gradient(var(--bg) 55%, transparent);
}
.logo { justify-self: start; font: 900 1.02rem/1 var(--sans); font-stretch: 100%; text-decoration: none; letter-spacing: -.01em; text-transform: uppercase; }
.logo i { font-weight: 300; text-transform: none; letter-spacing: 0; }
.clock { color: var(--mute); text-align: center; white-space: nowrap; }
.clock b { font-weight: 500; color: var(--fg); }
.bar nav { display: flex; justify-content: flex-end; align-items: center; gap: clamp(.9rem, 2vw, 1.8rem); }
.bar nav a { text-decoration: none; }
.bar nav a:hover { color: var(--accent); }
.pill { background: var(--accent); color: var(--on-accent); padding: .6rem 1rem; border-radius: 99px; }
.bar nav a.pill:hover { color: var(--on-accent); background: var(--fg); }

/* ---------- hero ---------- */
.hero { min-height: 100svh; display: grid; grid-template-rows: auto 1fr auto; padding: 5.2rem var(--pad) 1.6rem; }
.meta { display: flex; justify-content: space-between; gap: 1rem; color: var(--mute); }
.name {
  margin: 0; align-self: center;
  font: 900 clamp(3.6rem, 15.4vw, 16rem)/.86 var(--sans); font-stretch: 92%;
  letter-spacing: -.025em; text-transform: uppercase;
}
.name .row { display: block; overflow: hidden; padding: .02em 0 .04em; }
.name .r2 { text-align: right; }
.name .ch { display: inline-block; }
.hero-foot { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 1.5rem; }
.lede { margin: 0; max-width: 31ch; font-size: clamp(1rem, 1.25vw, 1.15rem); line-height: 1.45; }
.hint { color: var(--mute); text-align: center; }
.ghost { justify-self: end; border: 1px solid var(--mute); border-radius: 99px; padding: .8rem 1.3rem; text-decoration: none; white-space: nowrap; }
.ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- pita teknologi ---------- */
.band { border-block: 1px solid var(--line); overflow: hidden; padding: .7rem 0; }
.band-track { display: flex; width: max-content; }
.band p { margin: 0; padding-right: 2.2rem; white-space: nowrap; font: italic 400 clamp(2rem, 4.6vw, 4.4rem)/1.1 var(--sans); font-stretch: 112%; }
.band i { font-style: normal; color: var(--accent); font-size: .4em; vertical-align: .55em; margin: 0 .9em; }

/* ---------- pekerjaan ---------- */
.work { padding: clamp(6rem, 14vh, 10rem) var(--pad) 4rem; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 25rem); column-gap: 3rem; }
.work-head { grid-column: 1 / -1; display: flex; justify-content: space-between; gap: 1rem; color: var(--mute); padding-bottom: 1.1rem; }
.work-head button { all: unset; cursor: pointer; }
.work-head button:hover { color: var(--accent); }
.work-head button:focus-visible { outline: 2px dashed var(--accent); outline-offset: 4px; }
.list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.item { display: grid; grid-template-columns: 3.5rem minmax(0, 1fr) auto; column-gap: 1rem; padding: clamp(3rem, 9vh, 5.5rem) 0; border-bottom: 1px solid var(--line); }
.item .no { color: var(--mute); padding-top: 1.6em; }
.item h3 { margin: 0; font: 500 clamp(2.4rem, 5.6vw, 5.2rem)/1 var(--sans); font-stretch: 100%; letter-spacing: -.02em; }
.item .where { color: var(--mute); text-align: right; padding-top: 1.6em; }
.item .sub { grid-column: 2 / -1; margin: 1rem 0 0; color: var(--mute); }
.item .sub em { font-style: normal; color: var(--accent); margin-left: .6rem; }
.item .what { grid-column: 2 / -1; margin: 1.2rem 0 0; max-width: 58ch; color: #b9b5ae; }
.item .fact-inline { grid-column: 2 / -1; margin: 1.2rem 0 0; color: var(--accent); }
.item .credit { grid-column: 2 / -1; margin: .6rem 0 0; color: var(--mute); font-size: .9rem; }
.item.on .no { color: var(--accent); }

.peek { position: relative; }
.peek-in { position: sticky; top: 22vh; }
.panel {
  aspect-ratio: 4 / 5; border: 1px solid var(--line); border-radius: 6px; padding: 1.4rem;
  display: grid; grid-template-rows: auto 1fr auto; overflow: hidden;
  background:
    linear-gradient(#ffffff08 1px, transparent 1px) 0 0 / 100% 2.2rem,
    linear-gradient(90deg, #ffffff08 1px, transparent 1px) 0 0 / 2.2rem 100%,
    #161515;
}
.panel[hidden] { display: none; }
.panel .k { color: var(--mute); }
.panel .big { align-self: center; margin: 0; font: 900 clamp(3.4rem, 7vw, 6.4rem)/.9 var(--sans); font-stretch: 80%; letter-spacing: -.02em; color: var(--accent); text-transform: uppercase; }
.panel .big small { display: block; margin-top: 1rem; font: 400 1rem/1.45 var(--sans); font-stretch: 100%; letter-spacing: 0; color: var(--fg); text-transform: none; max-width: 24ch; }
.panel .stack { margin: 0; color: var(--mute); }
.peek-foot { display: flex; justify-content: space-between; margin-top: .8rem; color: var(--mute); }
.peek-foot b { color: var(--accent); font-weight: 500; }
.meter { height: 2px; background: var(--line); margin-top: .5rem; }
.meter span { display: block; height: 100%; width: calc(var(--p, 1) / 6 * 100%); background: var(--accent); transition: width .5s cubic-bezier(.2,.7,.2,1); }

/* ---------- halo ---------- */
.hello { padding: clamp(8rem, 26vh, 16rem) var(--pad); view-timeline: --hello block; }
.eyebrow { color: var(--accent); margin: 0 0 1.6rem; }
.say { margin: 0; max-width: 21ch; font: 700 clamp(2.2rem, 5.2vw, 5rem)/1.06 var(--sans); font-stretch: 96%; letter-spacing: -.02em; }
.say em { font-weight: 300; font-stretch: 110%; }
.say .hi { color: var(--accent); }

/* ---------- yang dikerjakan ---------- */
.do { padding: 2rem var(--pad) clamp(6rem, 16vh, 10rem); }
.do-head { display: flex; justify-content: space-between; color: var(--mute); padding-bottom: 1.1rem; }
.tiles { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); }
.tiles li { padding: 1.4rem 1.5rem 2.2rem; border-left: 1px solid var(--line); }
.tiles li:first-child { border-left: 0; }
.tiles .mono { color: var(--accent); }
.tiles h3 { margin: 2.6rem 0 .6rem; font: 700 clamp(1.5rem, 2.2vw, 2rem)/1.05 var(--sans); letter-spacing: -.015em; }
.tiles p { margin: 0; color: #b9b5ae; max-width: 30ch; }

/* ---------- penutup ---------- */
.end { border-top: 1px solid var(--line); padding: clamp(5rem, 14vh, 9rem) var(--pad) 2rem; }
.end .eyebrow { color: var(--mute); }
.talk {
  display: block; margin: 0 0 clamp(2.5rem, 7vh, 4.5rem); text-decoration: none;
  font: 900 clamp(3.4rem, 13.6vw, 14rem)/.86 var(--sans); font-stretch: 78%; letter-spacing: -.01em; text-transform: uppercase;
}
.talk:hover { color: var(--accent); }
.foot-row { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 1rem 2rem; color: var(--mute); }
.foot-row a { text-decoration: none; }
.foot-row a:hover { color: var(--accent); }
.foot-row .links { display: flex; gap: 1.4rem; flex-wrap: wrap; }
.foot-row .me { color: var(--fg); }

/* ---------- layar kecil ---------- */
@media (max-width: 900px) {
  .work { grid-template-columns: minmax(0, 1fr); }
  .peek { display: none; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .tiles li:nth-child(3) { border-left: 0; }
  .tiles li:nth-child(n+3) { border-top: 1px solid var(--line); }
}
/* di layar lebar angka proyek tampil di panel kanan (aria-hidden), jadi baris ini disembunyikan secara visual saja agar tetap dibaca pembaca layar */
@media (min-width: 901px) { .item .fact-inline { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; } }
@media (max-width: 720px) {
  .bar { grid-template-columns: 1fr auto; }
  .clock { display: none; }
  .bar nav .opt { display: none; }
  .meta span:nth-child(2) { display: none; }
  .hero-foot { grid-template-columns: 1fr; }
  .hint { display: none; }
  .ghost { justify-self: start; }
  .name { font-size: 21.5vw; font-stretch: 68%; line-height: .88; }
  .item { grid-template-columns: 2.2rem minmax(0, 1fr); }
  .item .where { grid-column: 2; text-align: left; padding-top: .6rem; order: 3; }
  .item .no { padding-top: .9em; }
  .tiles { grid-template-columns: 1fr; }
  .tiles li { border-left: 0; }
  .tiles li + li { border-top: 1px solid var(--line); }
  .tiles h3 { margin-top: 1.4rem; }
}

/* ---------- hover: satu pola untuk baris proyek dan kotak kerja (nomor jadi aksen + garis tipis di bawah) ---------- */
@media (hover: hover) {
  .item, .tiles li { position: relative; }
  .item::after, .tiles li::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px;
    background: var(--accent); transform: scaleX(0); transform-origin: left;
  }
  .item:hover::after, .tiles li:hover::after { transform: scaleX(1); }
  .item:hover .no { color: var(--accent); }
}

/* ---------- gerak ---------- */
@media (prefers-reduced-motion: no-preference) {
  html:not(.still) .name .ch { animation: rise 1.1s cubic-bezier(.7, 0, .2, 1) both; animation-delay: calc(var(--d) * 45ms + 150ms); }
  html:not(.still) .meta, html:not(.still) .hero-foot { animation: fade 1s .9s both; }
  html:not(.still) .band-track { animation: slide 38s linear infinite; }
  @keyframes rise { from { transform: translateY(108%); } }
  @keyframes fade { from { opacity: 0; } }
  @keyframes slide { to { transform: translateX(-50%); } }
  @media (hover: hover) {
    html:not(.still) .item::after, html:not(.still) .tiles li::after { transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
    html:not(.still) .item .no { transition: color .3s; }
  }

  @supports (animation-timeline: view()) {
    /* nama naik dan baris kedua tertinggal sedikit saat hero digulir */
    html:not(.still) .name .r1 { animation: up1 linear both; animation-timeline: scroll(root); animation-range: 0 100vh; }
    html:not(.still) .name .r2 { animation: up2 linear both; animation-timeline: scroll(root); animation-range: 0 100vh; }
    @keyframes up1 { to { transform: translateY(-38%); } }
    @keyframes up2 { to { transform: translateY(-14%); } }

    /* judul proyek terang hanya saat berada di tengah layar */
    html:not(.still) .item h3 { animation: lit linear both; animation-timeline: view(); animation-range: cover 0% cover 100%; }
    @keyframes lit { 0%, 100% { color: var(--dim); } 38%, 62% { color: var(--fg); } }

    /* kalimat halo menyala kata demi kata */
    html:not(.still) .say .w { animation: word linear both; animation-timeline: --hello; animation-range: cover calc(18% + var(--k) * 1.1%) cover calc(22% + var(--k) * 1.1%); }
    @keyframes word { from { opacity: .16; } to { opacity: 1; } }

    /* kata penutup melebar saat masuk */
    html:not(.still) .talk { animation: wide linear both; animation-timeline: view(); animation-range: entry 0% entry 100%; }
    @keyframes wide { from { font-stretch: 62%; letter-spacing: -.04em; } }
  }

  /* browser tanpa animation-timeline (Firefox, Safari lama): judul menyala lewat kelas .on dari main.js; kalimat halo tetap tampil penuh */
  @supports not (animation-timeline: view()) {
    html:not(.still) .item h3 { color: var(--dim); transition: color .6s ease; }
    html:not(.still) .item.on h3 { color: var(--fg); }
  }
}

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- 404 ---------- */
.bar.plain { grid-template-columns: 1fr auto; }
.lost .name { font-size: clamp(8rem, 38vw, 30rem); line-height: .8; }
.lost-foot { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)) auto; align-items: end; gap: 1.5rem; }
.lost-foot .lede + .lede { color: var(--mute); }
.lost-links { display: flex; flex-wrap: wrap; gap: .8rem; margin: 0; }
@media (max-width: 720px) {
  .lost .name { font-size: 60vw; }
  .lost-foot { grid-template-columns: 1fr; }
  .lost .meta span:nth-child(2) { display: inline; }
  .lost .meta span:nth-child(3) { display: none; }
}
