:root {
  --bg: #ffffff;
  --text: #0f172a;
  --muted: #475569;
  --ring: rgba(15, 23, 42, 0.08);
  --shadow: 0 10px 30px rgba(2, 6, 23, 0.08), 0 2px 6px rgba(2, 6, 23, 0.06);
  --wall-w: min(680px, 88vw);
  --wall-h: clamp(160px, 28vh, 260px);
  --wall-aspect: 0.5625;
  --avatar-size: 144px;
  --avatar-shift: calc(var(--avatar-size) / 2);
  --content-gutter: 16px;
  --album-max-h: clamp(220px, 60vh, 520px);
}
img, video { max-width: 100%; height: auto; }
svg { display: block; }

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  padding-top: 64px;
  font-family: 'Ubuntu Mono', ui-monospace, SFMono-Regular, Menlo, Monaco,
    Consolas, 'Liberation Mono', 'Courier New', monospace;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html { scroll-behavior: smooth; }
.site-nav {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border-bottom: 1px solid #e5e7eb;
}

.nav__inner {
  width: min(100% - 32px, 1000px);
  margin-inline: auto;
  padding: 12px 16px;
}

.nav__right { display: flex; align-items: center; justify-content: center; }
.nav__buttons { display: flex; gap: 8px; }
.nav__btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: 8px;
  color: #6b7280;
  text-decoration: none;
  border: 1px solid transparent;
  transition: color 300ms ease, background-color 300ms ease, border-color 300ms ease;
}
.nav__btn:hover, .nav__btn:focus-visible {
  background: #f9fafb;
  color: #374151;
  border-color: #e5e7eb;
  outline: none;
}

.nav__btn--active {
  background: #f3f4f6;
  color: #374151;
  border-color: #e5e7eb;
}
.hero {
  position: relative;
  min-height: calc(var(--wall-h) + var(--avatar-size) + 64px);
  display: block;
  overflow: visible;
  isolation: isolate;
  color: #ffffff;
}

.hero__bg {
  position: absolute;
  left: 50%;
  top: 0;
  transform: translate(-50%, 0);
  width: var(--wall-w);
  height: var(--wall-h);
  background-color: #000;
  background-image: url('assets/wallpaper.gif'), url('assets/wallpaper.jpg');
  background-position: center, center;
  background-size: cover, cover;
  background-repeat: no-repeat, no-repeat;
  border-radius: 24px;
  z-index: -1;
  box-shadow: var(--shadow);
}
.hero__bg .hero__video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 24px;
  display: block;
  pointer-events: none;
}

/* desktop uses cover as well; remove contain override */

.hero::after {
  content: '';
  position: absolute;
  inset: 0;
  background: none;
  pointer-events: none;
}

.hero__content {
  position: relative;
  z-index: 1;
  margin-left: calc(50% - (var(--wall-w) / 2) + var(--content-gutter));
  margin-top: calc(var(--wall-h));
  text-align: left;
  color: var(--text);
  padding: 0 24px 0 0;
  max-width: 960px;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
}

.avatar {
  width: var(--avatar-size);
  height: var(--avatar-size);
  border-radius: 50%;
  display: inline-block;
  object-fit: cover;
  background: transparent;
  border: none;
  box-shadow: var(--shadow);
  transform: translateY(calc(-1 * var(--avatar-shift)));
}

.name {
  margin: calc(-1 * var(--avatar-shift) + 8px) 0 0 0;
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.2;
  color: #44444E;
}
.username {
  margin: 4px 0 0 0;
  color: var(--muted);
  font-size: clamp(13px, 2.3vw, 16px);
}
.verified-badge { display: inline-flex; vertical-align: middle; margin-left: 8px; line-height: 0; color: #6b7280; user-select: none; }
.verified-badge svg { width: 0.9em; height: 0.9em; }

.tagline {
  margin: 8px 0 0 0;
  color: var(--muted);
  font-size: clamp(14px, 2.5vw, 18px);
}
.social {
  display: inline-flex;
  gap: 12px;
  margin-top: 12px;
  margin-bottom: 16px;
}

.social__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  border-radius: 8px;
  background: transparent;
  color: #6b7280;
  text-decoration: none;
  cursor: pointer;
  transition: color 300ms ease, background-color 300ms ease;
}

.social__btn svg { width: 20px; height: 20px; display: block; }
.social__btn:hover,
.social__btn:focus-visible {
  background: #f3f4f6;
  color: #374151;
}
@media (max-width: 480px) {
  :root {
    --wall-w: 94vw;
    --wall-h: clamp(120px, 24vh, 200px);
    --avatar-size: 112px;
    --content-gutter: 12px;
  }
  .social { gap: 8px; }
  .container { padding-block: 24px 40px; }
}
@media (min-width: 768px) {
  :root {
    --wall-w: min(900px, 90vw);
    --wall-h: calc(var(--wall-w) * var(--wall-aspect));
    --avatar-size: 152px;
    --content-gutter: 18px;
  }
}
@media (min-width: 1024px) {
  :root {
    --wall-w: min(1000px, 80vw);
    --wall-h: calc(var(--wall-w) * var(--wall-aspect));
    --avatar-size: 160px;
    --content-gutter: 20px;
  }
}

.social__btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--ring);
}

.container {
  width: min(100% - 32px, calc(var(--wall-w) - (var(--content-gutter) * 2)));
  margin-left: calc(50% - (var(--wall-w) / 2) + var(--content-gutter));
  margin-right: auto;
  padding-block: 24px 24px;
}

.container h2 {
  font-size: 22px;
  margin: 0 0 12px 0;
}

.container p {
  margin: 0 0 16px 0;
  color: var(--muted);
}

.about-title {
  color: #44444E;
  font-size: clamp(22px, 3.5vw, 28px);
}
.container {
  position: relative;
  transition: height 300ms ease;
  overflow: hidden;
}
.content-section {
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 300ms ease, transform 300ms ease;
  pointer-events: none;
}
.content-section.is-active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  .container { transition: none; }
  .content-section { transition: none; }
}
.container .about-card {
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
  margin-top: 12px;
}

#origin .about-card {
  margin-bottom: 16px;
}

#expertise .about-card,
#labs .about-card {
  margin-bottom: 16px;
}

#qris .qris-card { text-align: center; }
#qris .qris-img {
  width: min(100%, 380px);
  height: auto;
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: inline-block;
}

.about-card .about-text {
  color: #475569;
  line-height: 1.75;
}

.about-card .about-text p + p { margin-top: 12px; }

.skills { margin-top: 24px; }
.skills-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 12px 0;
  color: #374151;
}
.skill-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  padding: 4px 12px;
  background: #f3f4f6;
  color: #374151;
  border-radius: 9999px;
  font-size: 0.875rem;
  border: 1px solid #d1d5db;
  transition: border-color 300ms ease;
}
.badge:hover { border-color: #9ca3af; }
.project-card { position: relative; }
.project-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.project-title {
  color: #44444E;
  font-size: 1rem;
}
.project-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 8px;
  color: #6b7280;
  text-decoration: none;
  transition: color 200ms ease, background-color 200ms ease;
}
.project-action:hover, .project-action:focus-visible {
  background: #f3f4f6;
  color: #374151;
  outline: none;
}
.project-desc { color: #475569; line-height: 1.7; }


.story-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
.story-card {
  padding: 16px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: var(--shadow);
}
.story-title { color: #111827; font-weight: 600; margin: 0 0 6px 0; }
.story-date { color: #6b7280; font-size: 0.85rem; margin: 0 0 8px 0; }
.story-media { width: 100%; border-radius: 12px; background: #000; overflow: hidden; }
.story-media img { width: 100%; height: auto; display: block; }
.story-media video { width: 100%; height: auto; display: block; }
.story-media a { color: #374151; text-decoration: underline; }

.story-album { position: relative; }
.story-album .carousel {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 6px;
}

.story-header { display: flex; align-items: center; gap: 8px; margin: 0 0 6px 0; }
.story-header__avatar { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; display: inline-block; box-shadow: var(--shadow); }
.story-header__caption { color: #111827; font-weight: 500; }
.story-album .carousel::-webkit-scrollbar { display: none; }
.story-album .carousel__item {
  flex: 0 0 100%;
  scroll-snap-align: center;
}
.story-album .carousel__item img,
.story-album .carousel__item video {
  width: 100%;
  height: var(--album-max-h);
  border-radius: 12px;
  display: block;
  object-fit: contain;
  background: #000;
  cursor: zoom-in;
}
.carousel__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  border: 1px solid #e5e7eb;
  background: rgba(255,255,255,0.85);
  color: #374151;
  cursor: pointer;
}
.carousel__btn.prev { left: 8px; }
.carousel__btn.next { right: 8px; }
.carousel__btn svg { width: 18px; height: 18px; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0,0,0,0.9);
  display: none;
  align-items: center;
  justify-content: center;
}
.lightbox.is-open { display: flex; }
.lightbox__img, .lightbox__video { max-width: 96vw; max-height: 92vh; width: auto; height: auto; border-radius: 12px; display: none; }
.lightbox.is-open .lightbox__img, .lightbox.is-open .lightbox__video { display: block; }

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  border: 1px solid #e5e7eb;
  background: rgba(255,255,255,0.85);
  color: #374151;
  cursor: pointer;
}
.lightbox__nav.prev { left: 16px; }
.lightbox__nav.next { right: 16px; }
.lightbox__nav svg { width: 18px; height: 18px; }
.lightbox.has-multi .lightbox__nav { display: inline-flex; }

.story-media img, .story-media video { cursor: zoom-in; }

.loading {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(255,255,255,0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 200ms ease;
}
.loading[aria-hidden="true"] {
  opacity: 0;
  pointer-events: none;
}
.loading__inner { display: inline-flex; padding: 12px; border-radius: 12px; color: #374151; }
.loading__icon { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.social-list { display: grid; grid-template-columns: 1fr; gap: 10px; }
.social-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid #e5e7eb; border-radius: 8px; color: #374151; text-decoration: none; background: #ffffff; }
.social-item:hover, .social-item:focus-visible { background: #f9fafb; outline: none; }
.social-item svg { width: 20px; height: 20px; }
.social-sep { color: #9ca3af; }
.social-link-text { color: #374151; word-break: break-all; }

.social-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.social-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid #e5e7eb; border-radius: 12px; background: #ffffff; color: #374151; text-decoration: none; box-shadow: var(--shadow); transition: background-color 200ms ease, border-color 200ms ease, transform 150ms ease; }
.social-card:hover, .social-card:focus-visible { background: #f9fafb; border-color: #d1d5db; transform: translateY(-1px); outline: none; }
.social-card__icon { width: 32px; height: 32px; border-radius: 9999px; background: #f3f4f6; display: inline-flex; align-items: center; justify-content: center; color: #374151; }
.social-card__icon svg { width: 18px; height: 18px; }
.social-card__label { font-weight: 600; flex: 1; }
.social-card__action svg { width: 16px; height: 16px; color: #6b7280; }
