/* =====================================================
   Rayyan Adam Alfatih — Portfolio
   Tema: hitam · abu-abu · putih (light & dark mode)
   ===================================================== */

/* ===== Reset & Base ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Light mode (default) */
  --bg: #ffffff;
  --fg: #0a0a0a;
  --muted: #6b6b6b;
  --line: #e3e3e3;
  --surface: #f3f3f3;

  /* Section kontras (menggantikan blok biru di reference) */
  --inv-bg: #0b0b0b;
  --inv-fg: #ffffff;
  --inv-muted: #a6a6a6;
  --inv-line: rgba(255, 255, 255, 0.16);

  --pill-bg: #ffffff;
  --pill-fg: #0a0a0a;

  --btn-bg: #0a0a0a;
  --btn-fg: #ffffff;
  --btn-bg-hover: #2b2b2b;
  --inv-btn-bg: #ffffff;
  --inv-btn-fg: #0a0a0a;

  --radius: 20px;
  --font-sans: 'Inter Tight', 'Inter', 'Helvetica Neue', Arial, sans-serif;
  --font-serif: 'Instrument Serif', 'Playfair Display', Georgia, 'Times New Roman', serif;
  --pad-x: clamp(1.25rem, 4.5vw, 4rem);
  --max: 1200px;
}

:root[data-theme="dark"] {
  --bg: #0b0b0b;
  --fg: #f5f5f5;
  --muted: #9b9b9b;
  --line: #262626;
  --surface: #151515;

  --inv-bg: #efefef;
  --inv-fg: #0a0a0a;
  --inv-muted: #555555;
  --inv-line: rgba(0, 0, 0, 0.16);

  --pill-bg: #0b0b0b;
  --pill-fg: #f5f5f5;

  --btn-bg: #f5f5f5;
  --btn-fg: #0a0a0a;
  --btn-bg-hover: #d9d9d9;
  --inv-btn-bg: #0a0a0a;
  --inv-btn-fg: #ffffff;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
}

img { max-width: 100%; display: block; }
a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--fg);
  outline-offset: 3px;
}

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

/* Tipografi campuran khas reference: sans tebal + serif italic */
.h-bold {
  font-family: var(--font-sans);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: -0.04em;
  line-height: 0.9;
}

.h-serif {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 400;
  letter-spacing: -0.02em;
  line-height: 0.9;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.95rem 1.9rem;
  border-radius: 999px;
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
}

.btn-primary {
  background: var(--btn-bg);
  color: var(--btn-fg);
}

.btn-primary:hover {
  background: var(--btn-bg-hover);
  transform: translateY(-2px);
}

.btn-light {
  background: var(--inv-btn-bg);
  color: var(--inv-btn-fg);
}

.btn-light:hover {
  transform: translateY(-2px);
  opacity: 0.88;
}

.btn-ghost {
  background: transparent;
  color: var(--fg);
  border-color: var(--fg);
}

.btn-ghost:hover {
  background: var(--fg);
  color: var(--bg);
}

.btn-lg {
  padding: 1.15rem 2.4rem;
  font-size: 0.9rem;
}

/* ===== Nav ===== */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 1.25rem var(--pad-x);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  transition: background 0.3s ease;
}

.logo {
  justify-self: start;
  font-family: var(--font-sans);
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--fg);
  text-decoration: none;
  letter-spacing: -0.03em;
}

.logo span { color: var(--muted); }

.mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.1rem;
  border: 1px solid var(--fg);
  border-radius: 999px;
  background: transparent;
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease;
}

.mode-toggle:hover {
  background: var(--fg);
  color: var(--bg);
}

.mode-icon {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1.5px solid currentColor;
  background: linear-gradient(90deg, currentColor 50%, transparent 50%);
}

.nav-toggle {
  justify-self: end;
  background: none;
  border: none;
  cursor: pointer;
  width: 38px;
  height: 20px;
  position: relative;
}

.nav-toggle span {
  display: block;
  width: 100%;
  height: 1.5px;
  background: var(--fg);
  position: absolute;
  left: 0;
  transition: 0.3s;
}

.nav-toggle span:first-child { top: 4px; }
.nav-toggle span:last-child { bottom: 4px; }

.nav-toggle.open span:first-child {
  top: 9px;
  transform: rotate(45deg);
}

.nav-toggle.open span:last-child {
  bottom: 9px;
  transform: rotate(-45deg);
}

.mobile-menu {
  position: fixed;
  inset: 0;
  background: var(--bg);
  z-index: 99;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s, visibility 0.3s;
}

.mobile-menu.open {
  opacity: 1;
  visibility: visible;
}

.mobile-menu a {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: clamp(2.4rem, 7vw, 3.6rem);
  line-height: 1.15;
  color: var(--muted);
  text-decoration: none;
  transition: color 0.2s;
}

.mobile-menu a:hover,
.mobile-menu a.active {
  color: var(--fg);
}

/* ===== Hero ===== */
.hero {
  --photo: clamp(240px, 33vw, 480px);
  --photo-h: calc(var(--photo) * 1.0980);
  /* posisi dagu pada foto (0-1 dari tinggi foto); ubah jika foto diganti */
  --chin: 0.4;
  --word: clamp(2.7rem, 12.2vw, 11.5rem);
  --im: clamp(3.6rem, 10vw, 9rem);

  position: relative;
  overflow: hidden;
  padding: 5.5rem var(--pad-x) 0;
  background: var(--bg);
}

.hero-stage {
  position: relative;
  max-width: var(--max);
  margin: 0 auto;
  min-height: var(--photo-h);
}

.hero-title {
  position: relative;
  z-index: 1;
  text-align: center;
  color: var(--fg);
  /* dagu berada di sekitar bagian atas kata PROGRAMMER */
  padding-top: max(0px, calc(var(--photo-h) * var(--chin) - var(--im) * 0.95 - var(--word) * 0.4));
}

.hero-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 0 clamp(0rem, 3vw, 2rem);
}

.hero-top .h-serif {
  font-size: var(--im);
  line-height: 0.95;
  display: block;
}

.hero-word {
  display: block;
  font-size: var(--word);
  white-space: nowrap;
  margin-top: clamp(0.1rem, 0.8vw, 0.7rem);
}

.hero-photo {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 0;
  width: var(--photo);
  height: var(--photo-h);
  transform: translateX(-50%);
}

.hero-photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
  filter: grayscale(1) contrast(1.08);
  transition: transform 0.25s ease-out;
  will-change: transform;
}

.hero-note {
  position: absolute;
  z-index: 3;
  bottom: clamp(1.5rem, 4vw, 3.2rem);
  font-size: 0.72rem;
  line-height: 1.5;
}

.hero-note-left {
  left: clamp(0rem, 3vw, 2rem);
  max-width: 230px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--fg);
}

.hero-note-left::before {
  content: '';
  display: block;
  width: 40px;
  height: 1.5px;
  background: var(--fg);
  margin-bottom: 0.8rem;
}

.hero-note-right {
  right: clamp(0rem, 3vw, 2rem);
  max-width: 240px;
  font-size: 0.8rem;
  color: var(--muted);
}

.hero-cta {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: clamp(1.2rem, 3vw, 2.6rem);
  transform: translateX(-50%);
}

.hero-cta .btn {
  padding: 1.1rem 3.2rem;
  font-size: 0.82rem;
}

/* ===== Sections common ===== */
.section {
  padding: clamp(4rem, 9vw, 7rem) var(--pad-x);
}

.section-inner {
  max-width: var(--max);
  margin: 0 auto;
}

.section-inv {
  background: var(--inv-bg);
  color: var(--inv-fg);
  transition: background 0.3s ease, color 0.3s ease;
}

.eyebrow {
  display: block;
  margin-bottom: 1rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-inv .eyebrow { color: var(--inv-muted); }

.section-title {
  font-size: clamp(2.6rem, 8.2vw, 7rem);
}

.section-title .h-bold { display: block; }

.section-title .h-serif {
  display: block;
  font-size: 1.08em;
  margin-top: 0.04em;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 2rem;
  margin-bottom: clamp(2.5rem, 6vw, 4.5rem);
}

.section-side {
  max-width: 260px;
  padding-top: 0.6rem;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--muted);
}

.section-inv .section-side { color: var(--inv-muted); }

.section-side .btn { margin-top: 1.2rem; }

/* ===== Tools (menggantikan "All your design needs") ===== */
.tools { overflow: hidden; padding-bottom: 0; }

.pill-pile {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-end;
  gap: 0;
  max-width: 1040px;
  margin: 0 auto;
  padding: 1rem 0 0;
}

.pill {
  --r: 0deg;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  margin: -0.35rem -0.4rem;
  padding: 0.85rem 2rem;
  border-radius: 999px;
  background: var(--pill-bg);
  color: var(--pill-fg);
  font-family: var(--font-serif);
  font-size: clamp(1.15rem, 2.4vw, 1.8rem);
  line-height: 1.1;
  white-space: nowrap;
  transform: rotate(var(--r));
  transition: transform 0.35s cubic-bezier(.2,.8,.3,1.2), box-shadow 0.3s ease;
  border: 1px solid transparent;
}

:root[data-theme="dark"] .pill { border-color: #333; }

.pill:hover {
  transform: rotate(0deg) translateY(-6px) scale(1.04);
  z-index: 2;
}

.pill img {
  width: 1.15em;
  height: 1.15em;
  object-fit: contain;
  filter: grayscale(1) contrast(1.15);
}

:root[data-theme="dark"] .pill img { filter: grayscale(1) invert(1) contrast(1.05); }

/* Efek jatuh saat muncul */
.reveal-pill {
  opacity: 0;
  transform: translateY(-60px) rotate(calc(var(--r) * 2.5));
}

.reveal-pill.visible {
  opacity: 1;
  transform: rotate(var(--r));
}

.reveal-pill.visible:hover {
  transform: rotate(0deg) translateY(-6px) scale(1.04);
}

.tools-foot {
  padding: 2.2rem 0 2.6rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--inv-muted);
}

/* ===== Certificates ===== */
.cert-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.5rem;
  list-style: none;
}

.cert-card {
  display: flex;
  flex-direction: column;
  height: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease;
}

.cert-card:hover {
  transform: translateY(-5px);
  border-color: var(--fg);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
}

.cert-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--surface);
  padding: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* contain: sertifikat tidak terpotong */
.cert-thumb img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.4s ease;
}

.cert-card:hover .cert-thumb img { transform: scale(1.03); }

.cert-zoom {
  position: absolute;
  right: 0.8rem;
  bottom: 0.8rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 0.25s, transform 0.25s;
}

.cert-card:hover .cert-zoom,
.cert-card:focus-visible .cert-zoom {
  opacity: 1;
  transform: none;
}

.cert-body {
  padding: 1.15rem 1.3rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
}

.cert-meta {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.cert-title {
  font-family: var(--font-serif);
  font-size: 1.55rem;
  font-weight: 400;
  line-height: 1.12;
  letter-spacing: -0.01em;
}

.cert-desc {
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--muted);
}

.certs-note {
  margin-top: 2.2rem;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  background: rgba(8, 8, 8, 0.92);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s, visibility 0.25s;
}

.lightbox.open {
  opacity: 1;
  visibility: visible;
}

.lightbox-figure {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  max-width: min(1100px, 100%);
  max-height: 100%;
}

.lightbox-figure img {
  max-width: 100%;
  max-height: calc(100vh - 8.5rem);
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
}

.lightbox-caption {
  text-align: center;
  color: #fff;
  font-size: 0.85rem;
  line-height: 1.4;
}

.lightbox-caption strong {
  display: block;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.5rem;
}

.lightbox-caption span { color: #a6a6a6; }

.lb-btn {
  position: absolute;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  background: transparent;
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.lb-btn:hover { background: #fff; color: #0a0a0a; }
.lb-close { top: 1rem; right: 1rem; }
.lb-prev { left: 1rem; top: 50%; transform: translateY(-50%); }
.lb-next { right: 1rem; top: 50%; transform: translateY(-50%); }

/* ===== About ===== */
.about-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
}

.about-text p {
  color: var(--muted);
  font-size: 1.08rem;
  margin-bottom: 1.2rem;
}

.about-text strong { color: var(--fg); font-weight: 600; }

.about-note {
  margin-top: 1.5rem;
  font-size: 0.78rem !important;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg) !important;
}

.about-cards {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.info-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem;
  transition: border-color 0.25s, transform 0.25s;
}

.info-card:hover {
  border-color: var(--fg);
  transform: translateX(6px);
}

.info-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.3rem;
}

.info-value {
  font-family: var(--font-serif);
  font-size: 1.45rem;
  line-height: 1.2;
}

/* ===== Achievements ===== */
.alt { background: var(--surface); transition: background 0.3s ease; }

.achievements-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
}

.achieve-card {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.9rem;
  transition: transform 0.3s ease, border-color 0.3s ease;
}

.achieve-card:hover {
  transform: translateY(-4px);
  border-color: var(--fg);
}

.achieve-meta {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 1rem;
}

.achieve-year {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.achieve-tag {
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  background: var(--fg);
  color: var(--bg);
}

.achieve-card h3 {
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: 1.85rem;
  line-height: 1.1;
  margin-bottom: 0.65rem;
}

.achieve-card p {
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.55;
}

/* ===== Contact ===== */
.contact { text-align: center; }

.contact .section-title { margin-bottom: 1.8rem; }

.contact-lead {
  max-width: 520px;
  margin: 0 auto 2.2rem;
  color: var(--inv-muted);
  font-size: 1.05rem;
}

.socials {
  display: flex;
  justify-content: center;
  gap: 1.75rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.socials a {
  color: var(--inv-muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-decoration: none;
  border-bottom: 1px solid var(--inv-line);
  padding-bottom: 2px;
  transition: color 0.2s, border-color 0.2s;
}

.socials a:hover {
  color: var(--inv-fg);
  border-color: var(--inv-fg);
}

/* ===== Footer ===== */
.footer {
  text-align: center;
  padding: 2rem var(--pad-x);
  border-top: 1px solid var(--inv-line);
  background: var(--inv-bg);
  color: var(--inv-muted);
  font-size: 0.8rem;
  transition: background 0.3s ease;
}

/* ===== Scroll reveal ===== */
.reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.visible {
  opacity: 1;
  transform: none;
}

/* ===== Responsive ===== */
@media (max-width: 1000px) {
  .cert-grid { grid-template-columns: 1fr 1fr; }
  .about-grid { grid-template-columns: 1fr; }
  .achievements-list { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .hero {
    --photo: clamp(210px, 56vw, 360px);
    padding-top: 5rem;
  }

  .hero-stage {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "stack stack"
      "cta cta"
      "left right";
    column-gap: 1.25rem;
    min-height: 0;
  }

  .hero-title { grid-area: stack; align-self: start; }

  .hero-photo {
    grid-area: stack;
    align-self: end;
    position: relative;
    left: auto;
    bottom: auto;
    transform: none;
    justify-self: center;
    -webkit-mask-image: linear-gradient(to bottom, #000 78%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 78%, transparent 100%);
  }

  .hero-cta {
    grid-area: cta;
    position: relative;
    left: auto;
    bottom: auto;
    transform: none;
    justify-self: center;
    margin-top: calc(var(--photo) * -0.3);
    margin-bottom: 1.8rem;
  }

  .hero-cta .btn { padding: 0.95rem 2.6rem; }

  .hero-note {
    position: static;
    max-width: none;
    padding-bottom: 2rem;
    font-size: 0.66rem;
  }

  .hero-note-left { grid-area: left; }
  .hero-note-right { grid-area: right; font-size: 0.74rem; }

  .section-head {
    flex-direction: column;
    gap: 1.2rem;
  }

  .section-side { max-width: 420px; padding-top: 0; }

  .pill { padding: 0.7rem 1.4rem; margin: -0.3rem -0.25rem; }
}

@media (max-width: 560px) {
  .nav { padding: 1rem var(--pad-x); }

  .mode-toggle { padding: 0.45rem 0.8rem; font-size: 0.6rem; }

  .cert-grid { grid-template-columns: 1fr; }

  .achieve-card { padding: 1.5rem; }
  .lb-prev { left: 0.4rem; }
  .lb-next { right: 0.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .reveal, .reveal-pill { opacity: 1; transform: none; }
  .reveal-pill { transform: rotate(var(--r)); }
}
