/* ===== Tema: Krem hangat + Teal + Koral ===== */
:root {
  --bg: #f6f1e7;
  --bg-2: #efe7d6;
  --ink: #1f2a2e;
  --muted: #5d6b6f;
  --card: #fffaf0;
  --line: #d9cfba;
  --accent: #0f8b8d;
  --accent-2: #ff6b57;
  --accent-soft: rgba(15, 139, 141, 0.12);
  --mx: 50vw;
  --my: 50vh;
  --radius: 18px;
  --on-accent: #ffffff;
  --dots: rgba(31, 42, 46, 0.09);
  --spot-1: rgba(255, 107, 87, 0.22);
  --spot-2: rgba(15, 139, 141, 0.16);
  --blend: multiply;
  --ring: rgba(15, 139, 141, 0.38);
  --glow: rgba(255, 107, 87, 0.45);
  color-scheme: light;
}

/* ===== Tema gelap ===== */
:root[data-theme="dark"] {
  --bg: #0b1519;
  --bg-2: #14232a;
  --ink: #eaf1ef;
  --muted: #97a9ad;
  --card: #111e24;
  --line: #263a43;
  --accent: #34c9c6;
  --accent-2: #ff7a66;
  --accent-soft: rgba(52, 201, 198, 0.14);
  --on-accent: #0b1519;
  --dots: rgba(234, 241, 239, 0.07);
  --spot-1: rgba(255, 122, 102, 0.16);
  --spot-2: rgba(52, 201, 198, 0.14);
  --blend: screen;
  --ring: rgba(52, 201, 198, 0.4);
  --glow: rgba(52, 201, 198, 0.55);
  color-scheme: dark;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: "DM Sans", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  transition: background 0.4s, color 0.4s;
}

/* Pola titik halus di latar */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: radial-gradient(var(--dots) 1px, transparent 1px);
  background-size: 22px 22px;
  pointer-events: none;
  z-index: 0;
}

/* ===== Efek mengikuti mouse ===== */
.spotlight {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(420px circle at var(--mx) var(--my), var(--spot-1), transparent 60%),
    radial-gradient(700px circle at var(--mx) var(--my), var(--spot-2), transparent 65%);
  mix-blend-mode: var(--blend);
}

.cursor-dot,
.cursor-ring {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 100;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  opacity: 0;
  transition: opacity 0.3s, width 0.2s, height 0.2s, background 0.2s;
}
.cursor-dot { width: 8px; height: 8px; background: var(--accent-2); }
.cursor-ring { width: 36px; height: 36px; border: 1.5px solid var(--accent); }
body.mouse-active .cursor-dot,
body.mouse-active .cursor-ring { opacity: 1; }
body.hovering .cursor-ring { width: 56px; height: 56px; background: var(--accent-soft); }

/* ===== Layout ===== */
.layout {
  position: relative;
  z-index: 2;
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 4rem;
  padding: 0 2rem;
}

/* ===== KIRI: tetap di tempat ===== */
.left {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  align-items: center;
}
.left-inner { width: 100%; padding: 2rem 0; }

.badge {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  margin-bottom: 1.2rem;
}

.name {
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 800;
  font-size: clamp(2.4rem, 4.6vw, 3.8rem);
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.role {
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  margin-top: 0.8rem;
  color: var(--accent);
}
.role { min-height: 1.8rem; }
.caret {
  display: inline-block;
  width: 2px;
  height: 1.1em;
  margin-left: 3px;
  vertical-align: -0.15em;
  background: var(--accent-2);
  animation: blink 0.8s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.school {
  font-weight: 700;
  color: var(--accent-2);
  margin-top: 0.1rem;
}
.tagline {
  margin-top: 1.1rem;
  color: var(--muted);
  max-width: 24rem;
}

.nav { margin-top: 2.2rem; display: flex; flex-direction: column; gap: 0.7rem; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: fit-content;
  text-decoration: none;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transition: color 0.25s;
}
.nav-link .line {
  display: block;
  width: 32px;
  height: 2px;
  background: var(--line);
  transition: width 0.3s, background 0.3s;
}
.nav-link:hover, .nav-link.active { color: var(--ink); }
.nav-link:hover .line, .nav-link.active .line { width: 64px; background: var(--accent-2); }

.socials { list-style: none; display: flex; gap: 0.6rem; margin-top: 2.2rem; flex-wrap: wrap; }
.socials a {
  width: 42px; height: 42px;
  display: grid; place-items: center;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink);
  transition: transform 0.25s, background 0.25s, color 0.25s, border-color 0.25s;
}
.socials svg { width: 20px; height: 20px; }
.socials a:hover {
  transform: translateY(-4px) rotate(-4deg);
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}

/* ===== KANAN: bisa digeser ===== */
.right { padding: 6rem 0 4rem; }

.section { margin-bottom: 5.5rem; scroll-margin-top: 4rem; }
.section p { color: var(--muted); margin-bottom: 1rem; }
.section p strong { color: var(--ink); }

.section-title {
  font-family: "Bricolage Grotesque", sans-serif;
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 1.4rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}
.section-title::after {
  content: "";
  flex: 1;
  height: 2px;
  background: linear-gradient(90deg, var(--line), transparent);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.8rem;
  margin-top: 1.6rem;
}
.info {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.8rem 1rem;
  display: flex; flex-direction: column;
  transition: transform 0.25s, border-color 0.25s;
}
.info:hover { transform: translateY(-3px); border-color: var(--accent); }
.info span { font-size: 0.75rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.info strong { font-size: 0.95rem; }

/* Timeline */
.timeline { list-style: none; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li { position: relative; padding: 0 0 1.8rem 1.6rem; }
.timeline li::before {
  content: "";
  position: absolute;
  left: -8px; top: 6px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--bg);
  border: 3px solid var(--accent-2);
}
.timeline .year { font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; color: var(--accent); text-transform: uppercase; }
.timeline h4 { font-family: "Bricolage Grotesque", sans-serif; font-size: 1.2rem; margin: 0.1rem 0 0.3rem; }
.timeline p { margin: 0; }

/* Keahlian */
.skills { display: grid; gap: 1.1rem; }
.skill-head { display: flex; justify-content: space-between; font-weight: 700; margin-bottom: 0.35rem; }
.skill-head em { font-style: normal; color: var(--accent); }
.bar { height: 10px; background: var(--bg-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--line); }
.bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 1.3s cubic-bezier(.2, .8, .2, 1);
}

.sub { font-family: "Bricolage Grotesque", sans-serif; margin: 2rem 0 0.8rem; font-size: 1.1rem; }
.chips { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chips li {
  padding: 0.4rem 1rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 0.85rem;
  transition: background 0.25s, color 0.25s, transform 0.25s;
}
.chips li:hover { background: var(--accent); color: var(--on-accent); transform: translateY(-3px); }

/* Proyek */
.projects { display: grid; gap: 1rem; }
.project {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.3rem 1.4rem;
  transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
}
.project:hover {
  transform: translateY(-5px);
  border-color: var(--accent-2);
  box-shadow: 0 14px 30px -14px rgba(255, 107, 87, 0.45);
}
.project-top { display: flex; justify-content: space-between; align-items: center; }
.tag {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--accent-2);
  background: rgba(255, 107, 87, 0.12);
  padding: 0.2rem 0.7rem; border-radius: 999px;
}
.arrow { font-size: 1.3rem; color: var(--muted); transition: transform 0.3s, color 0.3s; }
.project:hover .arrow { transform: translate(4px, -4px); color: var(--accent-2); }
.project h4 { font-family: "Bricolage Grotesque", sans-serif; font-size: 1.2rem; margin: 0.7rem 0 0.3rem; }
.project p { margin-bottom: 0.6rem; }
.project small { color: var(--accent); font-weight: 700; }

/* Kontak */
.contact-list { display: grid; gap: 0.7rem; margin-top: 1.2rem; }
.contact-list a {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  text-decoration: none;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem 1.2rem;
  transition: transform 0.25s, background 0.25s, color 0.25s;
}
.contact-list a span { color: var(--muted); font-weight: 500; }
.contact-list a:hover { transform: translateX(6px); background: var(--ink); color: var(--bg); }
.contact-list a:hover span { color: var(--line); }

.footer { margin-top: 3.5rem; font-size: 0.85rem; color: var(--muted); }

/* Animasi muncul */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity 0.8s, transform 0.8s; }
.reveal.visible { opacity: 1; transform: none; }

/* ===== Responsif ===== */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; gap: 0; padding: 0 1.4rem; }
  .left { position: static; height: auto; padding: 4rem 0 1rem; }
  .nav { display: none; }
  .right { padding-top: 2rem; }
  .info-grid { grid-template-columns: 1fr; }
}

@media (hover: none) {
  .cursor-dot, .cursor-ring { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
}


/* ===== Tombol tema ===== */
.theme-toggle {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 60;
  width: 46px; height: 46px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  cursor: pointer;
  transition: transform 0.3s, background 0.3s, color 0.3s, border-color 0.3s;
}
.theme-toggle svg { width: 21px; height: 21px; }
.theme-toggle:hover { transform: rotate(18deg) scale(1.06); background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.theme-toggle:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ===== Hero orbit ===== */
.hero { margin-bottom: 4.5rem; }

.hero-banner {
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 1.6rem !important;
  padding: 0.7rem 1.4rem;
  border: 1px solid var(--accent-2);
  border-radius: 16px;
  background: var(--card);
  font-family: "Bricolage Grotesque", sans-serif;
  font-weight: 700;
  font-size: clamp(0.85rem, 1.7vw, 1.02rem);
  text-align: center;
  color: var(--accent-2) !important;
}
.hero-banner .spark { display: inline-block; animation: spin 8s linear infinite; }

.orbit {
  position: relative;
  width: 100%;
  max-width: 540px;
  aspect-ratio: 1;
  margin: 0 auto;
}
.orbit::before {
  content: "";
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-soft), transparent 70%);
  animation: pulse 5s ease-in-out infinite;
}

.ring {
  position: absolute;
  top: 50%; left: 50%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid var(--ring);
  translate: -50% -50%;
  animation: spin var(--dur) linear infinite;
  animation-direction: var(--dir, normal);
}
.r1 { width: 96%; --dur: 70s; }
.r2 { width: 78%; --dur: 46s; --dir: reverse; }
.r3 { width: 60%; --dur: 30s; }
.r4 { width: 44%; --dur: 20s; --dir: reverse; }

.planet {
  position: absolute;
  translate: -50% -50%;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px 2px var(--accent);
}
.planet.alt { background: var(--accent-2); box-shadow: 0 0 12px 2px var(--accent-2); }
.p-lg { width: 14px; height: 14px; }
.p-md { width: 11px; height: 11px; }
.p-sm { width: 8px; height: 8px; }
.p-xs { width: 5px; height: 5px; }

.twinkle {
  position: absolute;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--ink);
  opacity: 0.2;
  animation: twinkle 3.2s ease-in-out infinite;
}
.t1 { top: 18%; left: 30%; }
.t2 { top: 70%; left: 78%; animation-delay: 0.8s; }
.t3 { top: 30%; left: 88%; animation-delay: 1.6s; }
.t4 { top: 82%; left: 22%; animation-delay: 2.2s; }

.diamond {
  position: absolute;
  top: 50%; left: 50%;
  width: 46%;
  aspect-ratio: 1;
  border: 1.5px solid var(--accent-2);
  box-shadow: 0 0 22px -6px var(--accent-2), inset 0 0 22px -10px var(--accent-2);
  translate: -50% -50%;
  rotate: 45deg;
  animation: spin 40s linear infinite;
}

.orbit-core {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  transition: translate 0.25s ease-out;
}
.orbit-letter {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 800;
  font-size: clamp(4.5rem, 16vw, 8rem);
  line-height: 1;
  color: var(--ink);
  text-shadow: 0 0 30px var(--glow), 0 0 70px var(--glow);
  animation: breathe 4.5s ease-in-out infinite;
}

.orb-card {
  position: absolute;
  max-width: 48%;
  padding: 0.65rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: color-mix(in srgb, var(--card) 84%, transparent);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex; flex-direction: column;
  line-height: 1.35;
  transition: translate 0.25s ease-out, border-color 0.3s;
  animation: float 6s ease-in-out infinite;
}
.orb-card:hover { border-color: var(--accent); }
.orb-card strong { font-family: "Bricolage Grotesque", sans-serif; font-size: 0.95rem; }
.orb-card small { font-size: 0.78rem; color: var(--accent); font-weight: 500; }
.c-top { top: 12%; right: 0; }
.c-right { bottom: 15%; right: 3%; animation-delay: -2s; }
.c-left { bottom: 5%; left: 0; animation-delay: -4s; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes float { 50% { transform: translateY(-8px); } }
@keyframes twinkle { 50% { opacity: 1; transform: scale(1.8); } }
@keyframes pulse { 50% { opacity: 0.55; transform: scale(1.08); } }
@keyframes breathe { 50% { transform: scale(1.04); } }

@media (max-width: 520px) {
  .orb-card { padding: 0.5rem 0.75rem; }
  .orb-card strong { font-size: 0.82rem; }
  .orb-card small { font-size: 0.7rem; }
  .theme-toggle { width: 42px; height: 42px; top: 0.7rem; right: 0.7rem; }
}

@media (prefers-reduced-motion: reduce) {
  .ring, .diamond, .twinkle, .orb-card, .orbit::before, .orbit-letter, .hero-banner .spark { animation: none; }
}

/* ===== Penyesuaian posisi saat pertama dibuka (desktop) ===== */
@media (min-width: 901px) {
  /* Beranda mengisi satu layar dan berada tepat di tengah */
  .right { padding-top: 0; }
  .hero {
    min-height: 100vh;
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    margin-bottom: 2rem;
    padding: 1.5rem 0;
  }
  /* Orbit mengecil otomatis supaya selalu muat di layar pendek */
  .orbit { width: min(100%, 540px, calc(100svh - 10rem)); }
  .hero-banner { margin-bottom: 1.2rem !important; }

  /* Sisi kiri tidak terpotong di layar pendek */
  .left-inner { padding: 1.5rem 0; }
  .name { font-size: clamp(2.2rem, min(4.6vw, 7.4vh), 3.8rem); }
}

@media (min-width: 901px) and (max-height: 780px) {
  .badge { margin-bottom: 0.8rem; }
  .role { margin-top: 0.5rem; font-size: 1.15rem; }
  .tagline { margin-top: 0.7rem; font-size: 0.92rem; line-height: 1.55; }
  .nav { margin-top: 1.3rem; gap: 0.4rem; }
  .socials { margin-top: 1.3rem; }
}

/* ===== Tampilan HP & tablet ===== */
@media (max-width: 900px) {
  .layout { padding: 0 1.2rem; }

  /* Bagian perkenalan: beri ruang untuk tombol tema di atas */
  .left { padding: 4.5rem 0 0.5rem; }
  .left-inner { padding: 0; }
  .name { font-size: clamp(2.3rem, 10.5vw, 3.2rem); }
  .tagline { max-width: 100%; }
  .socials { margin-top: 1.6rem; }

  /* Beranda: banner + orbit pas di lebar layar */
  .right { padding: 1rem 0 7rem; }
  .hero { min-height: 0; padding: 0; margin: 2rem 0 3.5rem; }
  .hero-banner { margin-bottom: 1.1rem !important; padding: 0.6rem 1rem; font-size: 0.85rem; }
  .orbit { width: 100%; max-width: 440px; }

  /* Menu jadi bilah melayang di bawah layar */
  .nav {
    display: flex;
    flex-direction: row;
    position: fixed;
    left: 50%;
    bottom: max(0.8rem, env(safe-area-inset-bottom));
    translate: -50% 0;
    z-index: 60;
    max-width: calc(100vw - 1.2rem);
    margin: 0;
    padding: 0.3rem;
    gap: 0.1rem;
    overflow-x: auto;
    scrollbar-width: none;
    background: color-mix(in srgb, var(--card) 90%, transparent);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border: 1px solid var(--line);
    border-radius: 999px;
    box-shadow: 0 12px 30px -14px rgba(0, 0, 0, 0.45);
  }
  .nav::-webkit-scrollbar { display: none; }
  .nav-link {
    font-size: 0.64rem;
    letter-spacing: 0.06em;
    padding: 0.55rem 0.8rem;
    border-radius: 999px;
    white-space: nowrap;
  }
  .nav-link .line { display: none; }
  .nav-link.active { background: var(--accent); color: var(--on-accent); }

  /* Teks panjang tidak keluar dari layar */
  .contact-list a strong { overflow-wrap: anywhere; text-align: right; }
  .section-title { font-size: 1.55rem; }
  .section { margin-bottom: 4rem; }
}

@media (max-width: 400px) {
  .orb-card { max-width: 52%; }
  .c-top { top: 8%; }
  .c-right { bottom: 12%; right: 0; }
  .c-left { bottom: 2%; }
  .info-grid { gap: 0.6rem; }
}

/* Layar sentuh: tidak ada mouse, jadi cahaya kursor dimatikan */
@media (hover: none) {
  .spotlight { display: none; }
}

/* ===== HP kecil: kartu dipindah ke bawah orbit supaya tidak menutupi huruf J ===== */
@media (max-width: 600px) {
  .orbit { margin-bottom: 10.4rem; }
  .orb-card {
    max-width: none;
    width: calc(50% - 0.35rem);
    padding: 0.5rem 0.7rem;
  }
  .orb-card strong { font-size: 0.8rem; }
  .orb-card small { font-size: 0.7rem; }
  .c-top, .c-right { top: calc(100% + 0.9rem); bottom: auto; }
  .c-top { left: 0; right: auto; }
  .c-right { right: 0; left: auto; }
  .c-left { top: calc(100% + 5.4rem); bottom: auto; left: 25%; right: auto; width: 50%; }
}

/* ===== Tombol ombak kecil di paling bawah ===== */
.wave-wrap { display: flex; justify-content: center; margin-top: 2.5rem; }
.wave-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--accent);
  cursor: pointer;
  transition: transform 0.3s, background 0.3s, color 0.3s, border-color 0.3s;
}
.wave-btn svg { width: 20px; height: 20px; }
.wave-btn:hover { transform: translateY(-3px); background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.wave-btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 3px; }
.wave-btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.wave-btn.busy svg { animation: bobwave 1s ease-in-out infinite; }
@keyframes bobwave { 50% { transform: translateY(-3px); } }

/* ===== Ombak layar penuh: naik dari bawah ke atas selama 10 detik ===== */
.tide {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 90;
  overflow: hidden;
  pointer-events: none;
  --hat: clamp(64px, 9vw, 92px);
}
.tide.run { display: block; }

.tide-sheet {
  position: absolute;
  top: 0; left: 0;
  width: 100%;
  height: calc(100vh + 140px);
  height: calc(100dvh + 140px);
  transform: translateY(100%);
}
.tide.run .tide-sheet { animation: tide-cycle 20s linear forwards; }
/* 0-5 dtk naik pelan | 5-15 dtk diam di dekat puncak layar (10 detik) | 15-20 dtk surut ke bawah */
@keyframes tide-cycle {
  0%   { transform: translateY(100%); animation-timing-function: cubic-bezier(0.4, 0.1, 0.4, 1); }
  25%  { transform: translateY(100px); }
  75%  { transform: translateY(100px); animation-timing-function: cubic-bezier(0.55, 0, 0.45, 1); }
  100% { transform: translateY(100%); }
}

.crest {
  position: absolute;
  top: 0; left: 0;
  width: 200%;
  height: 140px;
}
.crest-back { top: -14px; fill: color-mix(in srgb, var(--accent) 35%, transparent); animation: drift 5s linear infinite reverse; }
.crest-front { animation: drift 3.2s linear infinite; }
.crest-front .fill { fill: color-mix(in srgb, var(--accent) 76%, transparent); }
.crest-front .foam { fill: none; stroke: #fff; stroke-opacity: 0.85; stroke-width: 3; stroke-linecap: round; vector-effect: non-scaling-stroke; }
@keyframes drift { to { transform: translateX(-50%); } }

.tide-body {
  position: absolute;
  top: 140px; left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--accent) 76%, transparent),
    color-mix(in srgb, var(--accent-2) 62%, transparent));
}

/* Lapisan belakang air ikut sampai ke bawah supaya warna rata, tanpa garis sambungan */
.tide-body::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: -14px; bottom: 0;
  background: color-mix(in srgb, var(--accent) 35%, transparent);
}

/* Topi: duduk di puncak ombak, ikut naik-turun bersama air, bisa ditarik */
.hat-sail {
  position: absolute;
  left: 50%;
  top: calc(74px - var(--hat) * 1.58);
  width: var(--hat);
  margin-left: calc(var(--hat) / -2);
  z-index: 3;
}
.tide.run .hat-sail { animation: hat-wave 3.2s linear infinite; }
/* mengikuti naik-turun puncak ombak depan (periode 3,2 detik) */
@keyframes hat-wave {
  0%   { transform: translateY(0);     animation-timing-function: cubic-bezier(0.39, 0.575, 0.565, 1); }
  25%  { transform: translateY(30px);  animation-timing-function: cubic-bezier(0.47, 0, 0.745, 0.715); }
  50%  { transform: translateY(0);     animation-timing-function: cubic-bezier(0.39, 0.575, 0.565, 1); }
  75%  { transform: translateY(-30px); animation-timing-function: cubic-bezier(0.47, 0, 0.745, 0.715); }
  100% { transform: translateY(0); }
}

.hat-drag {
  position: relative;
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  translate: 0 0;
  transition: translate 0.7s cubic-bezier(0.34, 1.56, 0.64, 1), rotate 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
}
/* Area sentuh dibuat lebih luas supaya mudah dipegang */
.hat-drag::before { content: ""; position: absolute; inset: -18px; }
.hat-drag.dragging { cursor: grabbing; transition: rotate 0.15s ease-out; }
.hat {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
  transform-origin: 50% 85%;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.25));
  transition: scale 0.25s, filter 0.25s;
  animation: hat-tilt 3.2s linear infinite;
}
.hat-drag.dragging .hat {
  scale: 1.12;
  filter: drop-shadow(0 20px 16px rgba(0, 0, 0, 0.35));
  animation-play-state: paused;
}
/* miring mengikuti kemiringan permukaan ombak */
@keyframes hat-tilt {
  0%   { rotate: 8deg;  animation-timing-function: cubic-bezier(0.47, 0, 0.745, 0.715); }
  25%  { rotate: 0deg;  animation-timing-function: cubic-bezier(0.39, 0.575, 0.565, 1); }
  50%  { rotate: -8deg; animation-timing-function: cubic-bezier(0.47, 0, 0.745, 0.715); }
  75%  { rotate: 0deg;  animation-timing-function: cubic-bezier(0.39, 0.575, 0.565, 1); }
  100% { rotate: 8deg; }
}
@media (prefers-reduced-motion: reduce) {
  .tide.run .hat-sail, .hat { animation: none; }
}

/* ===== HP: halaman tidak boleh melebar / bergeser ke samping ===== */
/* Cincin orbit yang berputar bentuk dasarnya kotak; saat miring sisinya sempat keluar layar
   dan membuat halaman melebar. Bagian yang keluar dipotong supaya tampilan tetap diam. */
html, body { max-width: 100%; overflow-x: clip; }
.hero { overflow-x: clip; }
.tide { max-width: 100vw; }

/* Ukuran topi & ombak untuk HP */
@media (max-width: 600px) {
  .tide { --hat: clamp(52px, 15vw, 68px); }
  .hat-drag::before { inset: -22px; }
}
