/* Hina — a glowing spirit companion who guides you down the page.
   Soft anime: pastel sky/pink, glow, sparkles. Palette from the logo. */

:root {
  --bg1: #eef6ff;
  --bg2: #ffeef7;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --line: #e7dcf0;
  --ink: #2a2740;
  --muted: #6f6a8a;
  --blue: #1f6fe0;
  --blue-deep: #0a55b8;
  --pink: #e23f8e;
  --pink-deep: #c11f70;
  --green: #1fae77;
  --code-bg: #16122b;
  --code-tx: #cfe3ff;
  --shadow: 0 24px 60px rgba(70, 50, 120, 0.16);
  --shadow-sm: 0 10px 26px rgba(70, 50, 120, 0.12);
  --glow: 226, 63, 142;
}
html[data-theme="dark"] {
  --bg1: #070611;
  --bg2: #0c0918;
  --surface: rgba(19, 17, 32, 0.86);
  --surface-solid: #12101e;
  --line: #241f3b;
  --ink: #e9e7f4;
  --muted: #948fb4;
  --blue: #2f7fe6;
  --blue-deep: #6aa6ff;
  --pink: #d83f8c;
  --pink-deep: #ff6fb0;
  --green: #2bbd84;
  --code-bg: #0a0816;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  --shadow-sm: 0 10px 26px rgba(0, 0, 0, 0.45);
  --glow: 180, 60, 130;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 70px; }
body {
  margin: 0;
  background: linear-gradient(160deg, var(--bg1), var(--bg2));
  color: var(--ink);
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  line-height: 1.65;
  overflow-x: hidden;
}
h1, h2, h3, h4 { font-family: "Baloo 2", sans-serif; font-weight: 800; letter-spacing: -0.01em; margin: 0 0 0.5rem; }
a { color: var(--blue-deep); text-decoration: none; }
a:hover { color: var(--pink-deep); }
code { font-family: "JetBrains Mono", monospace; }

/* blobs */
.blobs { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.blobs span { position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.4; }
.blobs span:nth-child(1) { width: 440px; height: 440px; background: #2b6fd0; top: -150px; left: -110px; }
.blobs span:nth-child(2) { width: 400px; height: 400px; background: #c8347f; top: 35%; right: -150px; }
.blobs span:nth-child(3) { width: 420px; height: 420px; background: #5a3fa0; bottom: -170px; left: 35%; }
html[data-theme="dark"] .blobs span { opacity: 0.22; }
html[data-theme="light"] .blobs span:nth-child(1) { background: #bcdcff; }
html[data-theme="light"] .blobs span:nth-child(2) { background: #ffc6e4; }
html[data-theme="light"] .blobs span:nth-child(3) { background: #e3d2ff; }

/* topbar */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.6rem 1.1rem; background: var(--surface); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 0.5rem; color: var(--ink); font-family: "Baloo 2"; font-weight: 800; font-size: 1.2rem; }
.brand img { border-radius: 9px; }
.top-actions { display: flex; align-items: center; gap: 0.5rem; }
.t-btn { padding: 0.4rem 0.9rem; border-radius: 999px; border: 1px solid var(--line); color: var(--ink); font-weight: 600; font-size: 0.88rem; background: var(--surface-solid); transition: all 0.15s ease; }
.t-btn:hover { border-color: var(--pink); color: var(--pink-deep); transform: translateY(-1px); }
.t-btn.icon { width: 38px; padding: 0; display: inline-grid; place-items: center; }
.theme-icon-dark { display: none; }
html[data-theme="dark"] .theme-icon-dark { display: inline; }
html[data-theme="dark"] .theme-icon-light { display: none; }

/* sections */
main { position: relative; z-index: 1; }
.sec { min-height: 100svh; display: grid; place-items: center; padding: 6rem 1.2rem 4rem; }
/* skip rendering work for off-screen sections (perf); intrinsic size avoids scroll jump */
.sec:not(.hero) { content-visibility: auto; contain-intrinsic-size: 1px 760px; }
.sec-inner { width: min(880px, 100%); text-align: center; }
.sec h1 { font-size: clamp(2.4rem, 6vw, 4rem); line-height: 1.04; }
.sec h2 { font-size: clamp(1.9rem, 4vw, 2.8rem); }
.lead { font-size: clamp(1.05rem, 2vw, 1.2rem); color: var(--muted); max-width: 40rem; margin: 0 auto 1.6rem; }
.pill { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 0.82rem; font-weight: 600; color: var(--muted); border: 1px solid var(--line); background: var(--surface-solid); padding: 0.32rem 0.9rem; border-radius: 999px; margin-bottom: 1.3rem; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--pink); box-shadow: 0 0 10px var(--pink); }
.grad { background: linear-gradient(110deg, var(--pink-deep), var(--blue-deep)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.cta { display: flex; gap: 0.7rem; justify-content: center; flex-wrap: wrap; }
.btn { border-radius: 999px; padding: 0.7rem 1.7rem; font-weight: 700; font-family: "Baloo 2"; cursor: pointer; transition: transform 0.15s ease, box-shadow 0.15s ease; border: none; }
.btn-primary { background: linear-gradient(120deg, var(--pink), var(--blue)); color: #fff; box-shadow: 0 12px 26px rgba(226,86,155,0.35); }
.btn-primary:hover { color: #fff; transform: translateY(-3px); box-shadow: 0 18px 34px rgba(226,86,155,0.45); }
.btn-ghost { background: var(--surface-solid); border: 2px solid var(--blue); color: var(--blue-deep); }
.btn-ghost:hover { color: #fff; background: var(--blue); transform: translateY(-3px); }
.scroll-hint { margin-top: 2.4rem; color: var(--muted); font-size: 0.85rem; animation: nudge 1.8s ease-in-out infinite; }
@keyframes nudge { 0%,100% { transform: translateY(0); opacity: 0.6; } 50% { transform: translateY(6px); opacity: 1; } }

/* cards */
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; text-align: left; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.9rem; text-align: left; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 1.5rem; box-shadow: var(--shadow-sm); }
.card.sm { padding: 1.2rem; }
.card .ic { font-size: 1.8rem; margin-bottom: 0.4rem; }
.card h3 { font-size: 1.3rem; } .card h4 { font-size: 1.02rem; margin-bottom: 0.3rem; }
.card p { color: var(--muted); margin: 0; font-size: 0.95rem; }
.card h3.cyan, .card h4 .cyan, .cyan { color: var(--blue-deep); }
.mono { font-family: "JetBrains Mono", monospace; font-size: 0.95rem; color: var(--blue-deep); }
.tag-new { color: #fff; background: var(--pink-deep); font-size: 0.66rem; font-weight: 700; padding: 0.05rem 0.4rem; border-radius: 6px; }
.steps { margin: 0; padding-left: 1.1rem; color: var(--ink); }
.steps li { margin: 0.3rem 0; }
.steps b { color: var(--blue-deep); }

/* install */
.install { max-width: 720px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; padding: 1.4rem; box-shadow: var(--shadow); text-align: left; }
.os-tabs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-bottom: 1rem; }
.os-tab { background: var(--surface-solid); border: 1px solid var(--line); color: var(--muted); font-weight: 600; font-size: 0.85rem; padding: 0.4rem 0.9rem; border-radius: 999px; cursor: pointer; transition: all 0.15s ease; }
.os-tab:hover { color: var(--blue-deep); }
.os-tab.active { color: #fff; background: linear-gradient(120deg, var(--pink), var(--blue)); border-color: transparent; }
.os-panel { display: none; } .os-panel.active { display: block; animation: fade 0.25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; } }
.code { display: flex; align-items: center; gap: 0.5rem; background: var(--code-bg); border-radius: 12px; padding: 0.7rem 0.9rem; overflow-x: auto; }
.code .c { color: #7fd0ff; font-weight: 700; font-family: "JetBrains Mono"; }
.code code { color: var(--code-tx); font-family: "JetBrains Mono"; font-size: 0.85rem; white-space: nowrap; flex: 1; }
.copy { flex: 0 0 auto; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.18); color: #cfe3ff; font: 600 0.74rem "Inter"; padding: 0.2rem 0.6rem; border-radius: 8px; cursor: pointer; }
.copy:hover { background: rgba(255,255,255,0.18); }
.copy.copied { background: var(--green); color: #08291c; border-color: transparent; }
.note { color: var(--muted); font-size: 0.9rem; margin: 0.8rem 0 0; }
.note code, .verify code { background: var(--surface-solid); padding: 0.05rem 0.35rem; border-radius: 5px; color: var(--pink-deep); }
.verify { color: var(--muted); font-size: 0.84rem; margin: 1.1rem 0 0; text-align: center; }

/* docs */
.docs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.6rem; }
.docs a { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 0.85rem; text-align: center; color: var(--ink); font-weight: 700; font-family: "Baloo 2"; transition: all 0.15s ease; }
.docs a:hover { color: #fff; background: linear-gradient(120deg, var(--blue), var(--blue-deep)); border-color: transparent; transform: translateY(-3px); }

/* footer */
.footer .foot-logo { border-radius: 18px; margin-bottom: 0.8rem; box-shadow: var(--shadow-sm); }
.foot-meta { color: var(--muted); font-size: 0.88rem; margin-top: 1.2rem; }

/* ============ DOT NAV ============ */
.dotnav {
  position: fixed; left: 16px; top: 50%; transform: translateY(-50%); z-index: 35;
  display: flex; flex-direction: column; gap: 0.7rem; align-items: flex-start;
}
.dotnav button {
  display: flex; align-items: center; gap: 0.55rem; background: none; border: none; cursor: pointer; padding: 0;
  color: var(--muted); font: 600 0.78rem "Inter"; opacity: 0.65; transition: opacity 0.15s ease, color 0.15s ease;
}
.dotnav .dot-i { width: 10px; height: 10px; border-radius: 50%; background: var(--line); border: 2px solid transparent; transition: all 0.2s ease; flex: 0 0 auto; }
.dotnav .dot-label { opacity: 0; transform: translateX(-4px); transition: opacity 0.15s ease, transform 0.15s ease; white-space: nowrap; }
.dotnav button:hover { opacity: 1; color: var(--ink); }
.dotnav button:hover .dot-label { opacity: 1; transform: none; }
.dotnav button.active { opacity: 1; color: var(--pink-deep); }
.dotnav button.active .dot-i { background: linear-gradient(120deg, var(--pink), var(--blue)); border-color: rgba(var(--glow), 0.5); transform: scale(1.35); box-shadow: 0 0 10px rgba(var(--glow), 0.6); }
.dotnav button.active .dot-label { opacity: 1; transform: none; }
@media (max-width: 900px) { .dotnav { display: none; } }

/* ============ COMPANION ============ */
.companion {
  position: fixed; z-index: 40; right: 18px; bottom: 18px;
  width: min(330px, 78vw); display: flex; flex-direction: column; align-items: flex-end;
  pointer-events: none;
}
.companion > * { pointer-events: auto; }
.companion.hidden { display: none; }
.hina-hide {
  align-self: flex-end; width: 24px; height: 24px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--surface-solid); color: var(--muted); cursor: pointer; font-size: 0.9rem; line-height: 1;
  margin-bottom: 4px; margin-right: 8px;
}
.hina-hide:hover { color: var(--pink-deep); border-color: var(--pink); }
.hina-bubble {
  position: relative; background: var(--surface-solid); border: 1px solid var(--line);
  border-radius: 18px 18px 6px 18px; padding: 0.7rem 0.95rem; box-shadow: var(--shadow);
  max-width: 100%; margin-bottom: 8px; margin-right: 6px;
  animation: pop 0.3s ease;
}
@keyframes pop { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.hina-bubble::after { content: ""; position: absolute; right: 30px; bottom: -9px; border: 9px solid transparent; border-top-color: var(--surface-solid); filter: drop-shadow(0 2px 0 var(--line)); }
.hina-name { display: block; font-family: "Baloo 2"; font-weight: 800; font-size: 0.82rem; color: var(--pink-deep); }
.hina-text { color: var(--ink); font-size: 0.95rem; min-height: 1.3em; }
.hina-stage { position: relative; width: 150px; height: 150px; }
.aura { position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(circle at 50% 55%, rgba(var(--glow), 0.55), rgba(var(--glow), 0) 68%); filter: blur(6px); animation: aura 3.5s ease-in-out infinite; }
@keyframes aura { 0%,100% { transform: scale(1); opacity: 0.85; } 50% { transform: scale(1.12); opacity: 1; } }
.hina-sprite {
  position: absolute; left: 50%; bottom: 4px; transform: translateX(-50%);
  width: 132px; height: auto; max-height: 150px; object-fit: contain;
  filter: drop-shadow(0 10px 16px rgba(70, 50, 120, 0.35));
  animation: bob 4.5s ease-in-out infinite;
}
.hina-sprite.is-logo { border-radius: 16px; width: 110px; }
@keyframes bob { 0%,100% { transform: translateX(-50%) translateY(0); } 50% { transform: translateX(-50%) translateY(-8px); } }
.hina-sprite.talk { animation: bob 4.5s ease-in-out infinite, nod 0.4s ease 2; }
@keyframes nod { 0%,100% { rotate: 0deg; } 50% { rotate: -3deg; } }

/* sparkles */
.sparkles span { position: absolute; font-size: 0.8rem; opacity: 0; animation: spark 2.6s ease-in-out infinite; }
@keyframes spark { 0% { opacity: 0; transform: translateY(6px) scale(0.6); } 35% { opacity: 1; } 70% { opacity: 0; transform: translateY(-14px) scale(1.1); } 100% { opacity: 0; } }

.hina-show {
  position: fixed; z-index: 40; right: 18px; bottom: 18px;
  border: none; border-radius: 999px; padding: 0.5rem 1rem; cursor: pointer; font-weight: 700; font-family: "Baloo 2";
  color: #fff; background: linear-gradient(120deg, var(--pink), var(--blue)); box-shadow: 0 10px 24px rgba(226,86,155,0.4);
}

/* responsive */
@media (max-width: 820px) {
  .two, .grid, .grid.three { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
  .grid, .grid.three { grid-template-columns: 1fr; }
  .two { grid-template-columns: 1fr; }
  .companion { right: 50%; transform: translateX(50%); bottom: 10px; align-items: center; width: min(360px, 92vw); }
  .hina-bubble { border-radius: 18px; margin-right: 0; }
  .hina-bubble::after { right: 50%; transform: translateX(50%); }
  .hina-hide { margin-right: 0; }
  .hina-stage { width: 110px; height: 110px; }
  .hina-sprite { width: 96px; }
  .t-btn:not(.icon) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .blobs span, .aura, .hina-sprite, .scroll-hint, .sparkles span { animation: none; }
}
