/* ============================================================
   STYLE — frosted glass over an open sky, Apple-flavored squircles
   ============================================================ */

:root {
  --ink: #ffffff;
  --ink-soft: rgba(255, 255, 255, 0.82);
  --ink-faint: rgba(255, 255, 255, 0.6);
  --glass: rgba(255, 255, 255, 0.14);
  --glass-strong: rgba(255, 255, 255, 0.2);
  --line: rgba(255, 255, 255, 0.42);
  --line-soft: rgba(255, 255, 255, 0.24);
  --accent: #38bdf8;
  --amber: #ffc107;
  --shadow: 0 24px 70px rgba(2, 32, 71, 0.35);
  --radius: 30px;
  /* Apple-style squircle radii */
  --squircle-lg: 34px;
  --squircle-md: 22px;
  --squircle-sm: 16px;
  /* springy easing for interactions */
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }
html, body { height: 100%; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: #1c63b7;
  overflow-x: hidden;
}

::selection { background: rgba(56, 189, 248, 0.45); }

/* ---------- background layers ---------- */

.bg, .bg-img, .bg-vignette, #ambient-canvas {
  position: fixed;
  inset: 0;
}

/* CSS fallback sky, visible until/unless the image loads */
.bg {
  z-index: -4;
  background:
    radial-gradient(120% 70% at 50% 110%, rgba(134, 239, 172, 0.5), transparent 55%),
    radial-gradient(90% 60% at 78% 8%, rgba(255, 255, 255, 0.75), transparent 60%),
    linear-gradient(180deg, #0e57ad 0%, #2f83d8 45%, #7cc4ef 78%, #bfe6f7 100%);
}

.bg-img {
  z-index: -3;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 42%;
  opacity: 0;
  transition: opacity 1.2s ease;
}
.bg-img.is-loaded { opacity: 1; animation: kenburns 46s ease-in-out infinite alternate; }

/* gentle vignette so white glass pops against bright clouds */
.bg-vignette {
  z-index: -2;
  background: radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(6, 42, 90, 0.28) 100%);
}

#ambient-canvas { z-index: -1; pointer-events: none; }

@keyframes kenburns {
  from { transform: scale(1.02) translateY(0); }
  to   { transform: scale(1.1) translateY(-1.5%); }
}

/* ---------- scene / card ---------- */

.scene {
  min-height: 70svh;
  display: grid;
  place-items: center;
  padding: clamp(16px, 4vw, 48px);
}

.card {
  position: relative;
  width: min(680px, 100%);
  padding: clamp(30px, 5vw, 54px) clamp(22px, 5vw, 56px) clamp(26px, 4vw, 44px);
  text-align: center;
  border-radius: var(--squircle-lg);
  background: var(--glass);
  border: 1px solid var(--line);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  animation: cardIn 0.9s var(--ease-out) both;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(26px) scale(0.97); }
  to   { opacity: 1; transform: none; }
}

/* staggered entrance for card children */
.reveal { animation: rise 0.7s var(--ease-out) both; animation-delay: calc(0.12s + var(--i) * 0.09s); }
@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- language switch (top-right of card) ---------- */

.lang-switch {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 3;
  display: flex;
  gap: 3px;
  padding: 4px;
  border-radius: 999px;
  background: var(--glass);
  border: 1px solid var(--line-soft);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.lang-switch button {
  border: 0;
  padding: 5px 12px;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-faint);
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.2px;
  cursor: pointer;
  transition: color 0.25s ease, background 0.3s var(--ease-out), transform 0.3s var(--spring), box-shadow 0.3s ease;
}
.lang-switch button:hover { color: var(--ink); transform: translateY(-1px); }
.lang-switch button:active { transform: scale(0.92); }
.lang-switch button.is-active {
  color: var(--ink);
  background: var(--glass-strong);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 4px 12px rgba(2, 32, 71, 0.25);
}
.lang-switch button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- avatar + fire ring ---------- */

.avatar-wrap {
  position: relative;
  width: 132px;
  height: 132px;
  margin: 0 auto 20px;
}
.avatar-wrap::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: conic-gradient(from 0deg, #7dd3fc, #ffffff, #6366f1, #7dd3fc);
  filter: blur(14px);
  opacity: 0.75;
  animation: spin 9s linear infinite;
}
/* fire.png decoration ring, spinning around the avatar */
.fire-ring {
  position: absolute;
  inset: -34px;
  width: calc(100% + 68px);
  height: calc(100% + 68px);
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 0 12px rgba(255, 140, 0, 0.55));
  animation: spin 14s linear infinite;
  transition: opacity 0.8s ease;
}
.fire-ring.is-hidden { opacity: 0; }
.avatar-wrap img.avatar {
  position: relative;
  z-index: 1;
  display: block;
  width: 132px;
  height: 132px;
  border-radius: var(--squircle-lg);
  object-fit: cover;
  border: 3px solid rgba(255, 255, 255, 0.85);
  box-shadow: 0 10px 30px rgba(2, 32, 71, 0.35);
  transition: transform 0.45s var(--spring);
}
.avatar-wrap:hover img.avatar { transform: scale(1.05) rotate(-2deg); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- name / tagline ---------- */

.name {
  font-size: clamp(2rem, 6vw, 2.9rem);
  font-weight: 700;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 18px rgba(2, 32, 71, 0.35);
}

.tagline {
  margin-top: 8px;
  min-height: 1.6em;
  font-size: clamp(0.95rem, 2.6vw, 1.1rem);
  color: var(--ink-soft);
  text-shadow: 0 1px 10px rgba(2, 32, 71, 0.3);
}
.caret {
  display: inline-block;
  margin-left: 2px;
  width: 2px;
  height: 1.05em;
  vertical-align: text-bottom;
  background: var(--ink);
  animation: blink 1.05s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.divider {
  height: 1px;
  margin: clamp(20px, 4vw, 30px) 0;
  background: linear-gradient(90deg, transparent, var(--line) 18%, var(--line) 82%, transparent);
}

/* ---------- social chips (squircle) ---------- */

.socials {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 14px;
}

.chip {
  position: relative;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: var(--squircle-sm);
  color: var(--ink);
  background: var(--glass);
  border: 1px solid var(--line-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition:
    transform 0.35s var(--spring),
    background 0.25s ease,
    box-shadow 0.3s ease,
    border-color 0.25s ease;
}
.chip svg { width: 22px; height: 22px; fill: currentColor; transition: transform 0.35s var(--spring); }
.chip:hover, .chip:focus-visible {
  transform: translateY(-6px) scale(1.07);
  background: var(--glass-strong);
  border-color: var(--line);
  box-shadow: 0 12px 26px rgba(2, 32, 71, 0.3), 0 0 0 4px rgba(56, 189, 248, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.chip:hover svg { transform: scale(1.1); }
.chip:active { transform: translateY(-2px) scale(0.96); transition-duration: 0.1s; }
.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* tooltip */
.chip::after {
  content: attr(data-label);
  position: absolute;
  bottom: calc(100% + 10px);
  left: 50%;
  translate: -50% 4px;
  padding: 5px 11px;
  border-radius: 9px;
  background: rgba(10, 40, 80, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, translate 0.25s var(--spring);
}
.chip:hover::after, .chip:focus-visible::after { opacity: 1; translate: -50% 0; }

/* ---------- the hub button ---------- */

.hub-btn {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
  margin-top: clamp(22px, 4vw, 32px);
  padding: 17px 26px;
  border-radius: var(--squircle-md);
  overflow: hidden;
  color: var(--ink);
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  text-decoration: none;
  background: linear-gradient(120deg, rgba(56, 189, 248, 0.35), rgba(99, 102, 241, 0.35));
  border: 1px solid var(--line);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5), 0 10px 30px rgba(2, 32, 71, 0.28);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition:
    transform 0.35s var(--spring),
    box-shadow 0.3s ease,
    background 0.3s ease;
}
.hub-btn .hub-arrow { width: 20px; height: 20px; fill: currentColor; transition: transform 0.35s var(--spring); }
.hub-btn:hover, .hub-btn:focus-visible {
  transform: translateY(-4px) scale(1.015);
  background: linear-gradient(120deg, rgba(56, 189, 248, 0.55), rgba(99, 102, 241, 0.55));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6), 0 16px 40px rgba(2, 32, 71, 0.38), 0 0 24px rgba(56, 189, 248, 0.35);
}
.hub-btn:hover .hub-arrow { transform: translateX(7px); }
.hub-btn:active { transform: translateY(-1px) scale(0.985); transition-duration: 0.1s; }
.hub-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* shine sweep */
.hub-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 30%, rgba(255, 255, 255, 0.5) 50%, transparent 70%);
  transform: translateX(-120%);
  transition: transform 0.7s ease;
}
.hub-btn:hover::before { transform: translateX(120%); }

/* ---------- hub page ---------- */

.hub-card { width: min(880px, 100%); }

.hub-head { margin-bottom: clamp(20px, 4vw, 30px); }
.hub-sub { margin-top: 8px; color: var(--ink-soft); font-size: 1rem; text-shadow: 0 1px 10px rgba(2, 32, 71, 0.3); }

/* under-development banner */
.under-dev {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: clamp(16px, 3vw, 24px) 0;
  padding: 14px 18px;
  border-radius: var(--squircle-sm);
  background:
    repeating-linear-gradient(45deg, rgba(255, 193, 7, 0.16) 0 14px, rgba(255, 255, 255, 0.06) 14px 28px);
  border: 1px solid rgba(255, 193, 7, 0.55);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
  font-size: 0.95rem;
  font-weight: 600;
  text-align: center;
  animation: devPulse 3s ease-in-out infinite;
}
.under-dev .dev-icon { flex: none; width: 22px; height: 22px; fill: var(--amber); }
.under-dev .dev-vi { display: block; font-size: 0.82rem; font-weight: 500; color: var(--ink-soft); margin-top: 3px; }
@keyframes devPulse {
  0%, 100% { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 0 0 rgba(255, 193, 7, 0); }
  50%      { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 0 22px rgba(255, 193, 7, 0.25); }
}

.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  text-align: left;
}

.tile {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-radius: var(--squircle-md);
  color: var(--ink);
  text-decoration: none;
  background: var(--glass);
  border: 1px solid var(--line-soft);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition:
    transform 0.35s var(--spring),
    background 0.25s ease,
    border-color 0.25s ease,
    box-shadow 0.3s ease;
}
.tile:hover, .tile:focus-visible {
  transform: translateY(-5px) scale(1.02);
  background: var(--glass-strong);
  border-color: var(--line);
  box-shadow: 0 14px 30px rgba(2, 32, 71, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.tile:active { transform: translateY(-1px) scale(0.98); transition-duration: 0.1s; }
.tile:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.tile-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: var(--squircle-sm);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.45), rgba(99, 102, 241, 0.45));
  border: 1px solid var(--line-soft);
  transition: transform 0.35s var(--spring);
}
.tile:hover .tile-icon { transform: scale(1.08) rotate(-4deg); }
.tile-icon svg { width: 22px; height: 22px; fill: currentColor; }

.tile > span:last-child { display: block; min-width: 0; }
.tile-title { display: block; font-weight: 700; }
.tile-desc { display: block; margin-top: 2px; font-size: 0.85rem; color: var(--ink-soft); }

.back-link {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--squircle-sm);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  background: var(--glass);
  border: 1px solid var(--line-soft);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.35s var(--spring), background 0.25s ease, border-color 0.25s ease;
}
.back-link:hover { transform: translateY(-2px) scale(1.04); background: var(--glass-strong); border-color: var(--line); }
.back-link:active { transform: translateY(0) scale(0.97); transition-duration: 0.1s; }
.back-link svg { width: 16px; height: 16px; fill: currentColor; transition: transform 0.3s var(--spring); }
.back-link:hover svg { transform: translateX(-3px); }

/* ---------- neko (cat following the cursor) ---------- */

#neko {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 6;
  width: 60px;
  height: 52px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.6s ease;
  will-change: transform;
}
#neko.is-visible { opacity: 1; }
#neko .cat {
  width: 100%;
  height: 100%;
  transform-origin: center bottom;
  filter: drop-shadow(0 6px 10px rgba(2, 32, 71, 0.35));
}
#neko.is-left .cat { transform: scaleX(-1); }
#neko.is-walking .cat { animation: nekoBob 0.45s ease-in-out infinite; }
#neko.is-sleeping .cat { animation: nekoDoze 2.6s ease-in-out infinite; }
/* eyes open vs closed are toggled via .eye-open / .eye-closed */
#neko .eye-closed { opacity: 0; }
#neko.is-sleeping .eye-open { opacity: 0; }
#neko.is-sleeping .eye-closed { opacity: 1; }
#neko .zzz { opacity: 0; transition: opacity 0.5s ease; }
#neko.is-sleeping .zzz { opacity: 1; animation: zzzFloat 2s ease-in-out infinite; }

@keyframes nekoBob {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50%      { transform: translateY(-3px) rotate(1.5deg); }
}
@keyframes nekoDoze {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.02, 0.97); }
}
@keyframes zzzFloat {
  0%, 100% { transform: translateY(0); opacity: 0.5; }
  50%      { transform: translateY(-4px); opacity: 1; }
}

/* ---------- responsive / motion ---------- */

@media (max-width: 560px) {
  .avatar-wrap, .avatar-wrap img.avatar { width: 104px; height: 104px; }
  .chip { width: 46px; height: 46px; border-radius: 14px; }
  .chip svg { width: 20px; height: 20px; }
  .socials { gap: 11px; }
  .hub-btn { letter-spacing: 1.6px; }
  .lang-switch { top: 12px; right: 12px; }
  .fire-ring { inset: -26px; width: calc(100% + 52px); height: calc(100% + 52px); }
}

/* MacBook / laptop (13-16" at scaled resolutions) */
@media (min-width: 1200px) {
  .card { width: min(720px, 100%); }
}

/* Big screens: 1440p+ and ultrawide — breathe more */
@media (min-width: 1920px) {
  html { font-size: 17px; }
  .card { width: min(760px, 100%); }
  .hub-card { width: min(960px, 100%); }
  .avatar-wrap, .avatar-wrap img.avatar { width: 144px; height: 144px; }
}
@media (min-width: 2560px) {
  html { font-size: 19px; }
  .card { width: min(820px, 100%); }
  .hub-card { width: min(1040px, 100%); }
  .avatar-wrap, .avatar-wrap img.avatar { width: 160px; height: 160px; }
  .chip { width: 58px; height: 58px; }
}

/* HiDPI displays (Retina / MacBook scaled modes) — keep edges crisp */
@media (-webkit-min-device-pixel-ratio: 1.5), (min-resolution: 144dpi) {
  .card, .chip, .tile, .hub-btn, .lang-switch, .back-link { border-width: 1px; }
  .bg-img { image-rendering: auto; }
  .avatar-wrap::before { filter: blur(12px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  #neko { display: none; }
}
