/* ==========================================================================
   Theme tokens. Change these to restyle the whole site.
   ========================================================================== */
:root {
  --bg: #fffaf5;
  --bg-alt: #f6f0ff;
  --surface: #ffffff;
  --text: #2a2340;
  --text-muted: #6b6485;
  --primary: #7c5cff;
  --primary-ink: #ffffff;
  --accent: #ff7aa8;
  --accent-2: #ffc861;
  --border: #ebe4f7;
  --shadow: 0 10px 30px -12px rgba(76, 52, 160, 0.25);
  --radius: 20px;
  --font-display: "Fredoka", system-ui, sans-serif;
  --font-body: "Nunito", system-ui, sans-serif;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #15121f;
  --bg-alt: #1c1830;
  --surface: #221d36;
  --text: #f2eeff;
  --text-muted: #b2abcc;
  --primary: #9d85ff;
  --primary-ink: #15121f;
  --accent: #ff8db6;
  --accent-2: #ffd27a;
  --border: #322b4d;
  --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15121f;
    --bg-alt: #1c1830;
    --surface: #221d36;
    --text: #f2eeff;
    --text-muted: #b2abcc;
    --primary: #9d85ff;
    --primary-ink: #15121f;
    --accent: #ff8db6;
    --accent-2: #ffd27a;
    --border: #322b4d;
    --shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
    color-scheme: dark;
  }
}

/* ==========================================================================
   Base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  transition: background-color 0.3s, color 0.3s;
}

h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 0.5em; }
p { margin: 0 0 1em; }
a { color: var(--primary); }
img { max-width: 100%; display: block; }
ul { list-style: none; margin: 0; padding: 0; }

.container { width: min(1120px, 100% - 32px); margin-inline: auto; }

.skip-link {
  position: absolute; left: 16px; top: -100px;
  background: var(--primary); color: var(--primary-ink);
  padding: 8px 16px; border-radius: 8px; z-index: 100;
}
.skip-link:focus { top: 16px; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 14px 26px;
  font: 600 1rem var(--font-display);
  border-radius: 999px; border: 2px solid transparent;
  text-decoration: none; cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary { background: var(--primary); color: var(--primary-ink); box-shadow: var(--shadow); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--primary); }

/* ==========================================================================
   Header / nav
   ========================================================================== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s, background-color 0.3s;
}
.site-header.is-scrolled { border-bottom-color: var(--border); }

.nav { display: flex; align-items: center; justify-content: space-between; height: 68px; }

.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.logo-mark {
  display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: 12px; font: 700 1.25rem var(--font-display);
  color: #fff; background: linear-gradient(135deg, var(--primary), var(--accent));
  transform: rotate(-6deg);
}
.logo-text { font: 600 1.3rem var(--font-display); }

.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a {
  color: var(--text); text-decoration: none; font-weight: 700;
  position: relative; padding: 4px 0;
}
.nav-links a::after {
  content: ""; position: absolute; left: 0; bottom: -2px; height: 3px; width: 0;
  border-radius: 3px; background: var(--accent); transition: width 0.25s;
}
.nav-links a:hover::after, .nav-links a.is-active::after { width: 100%; }

.theme-toggle {
  display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer;
}
.theme-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}

.nav-toggle {
  display: none; width: 44px; height: 44px; padding: 10px;
  background: none; border: 0; cursor: pointer;
  flex-direction: column; justify-content: center; gap: 5px;
}
.nav-toggle span {
  display: block; height: 3px; border-radius: 3px; background: var(--text);
  transition: transform 0.25s, opacity 0.25s;
}
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(8px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

@media (max-width: 720px) {
  .nav-toggle { display: flex; }
  .nav-links {
    position: absolute; top: 68px; left: 0; right: 0;
    flex-direction: column; gap: 4px; padding: 12px 16px 20px;
    background: var(--bg); border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    transform: translateY(-8px); opacity: 0; visibility: hidden;
    transition: transform 0.25s, opacity 0.25s, visibility 0.25s;
  }
  .nav-links.is-open { transform: none; opacity: 1; visibility: visible; }
  .nav-links li { width: 100%; text-align: center; }
  .nav-links a { display: block; padding: 12px; }
  .nav-links a::after { display: none; }
  .theme-toggle { margin: 8px auto 0; }
}

/* ==========================================================================
   Hero
   ========================================================================== */
.hero { position: relative; overflow-x: clip; padding: 72px 0 96px; }

.blob {
  position: absolute; border-radius: 50%; filter: blur(60px); opacity: 0.45; z-index: -1;
  animation: float 14s ease-in-out infinite;
}
.blob-1 { width: 420px; height: 420px; background: var(--accent); top: -120px; right: -80px; }
.blob-2 { width: 360px; height: 360px; background: var(--primary); bottom: -140px; left: -100px; animation-delay: -7s; }

.hero-inner {
  display: grid; grid-template-columns: 1.2fr 1fr; align-items: center; gap: 48px;
}

.eyebrow { font: 600 1.15rem var(--font-display); color: var(--text-muted); margin-bottom: 0.25em; }

.hero h1 {
  font-size: clamp(2.8rem, 8vw, 5rem);
  background: linear-gradient(120deg, var(--primary), var(--accent));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.tagline { font-size: clamp(1.15rem, 2.4vw, 1.4rem); color: var(--text-muted); max-width: 34ch; }

.highlight {
  color: var(--text); font-weight: 700;
  background: linear-gradient(transparent 60%, color-mix(in srgb, var(--accent-2) 70%, transparent) 60%);
  padding: 0 2px;
  display: inline-block; transition: opacity 0.3s, transform 0.3s;
}
.highlight.is-swapping { opacity: 0; transform: translateY(6px); }

.hero-actions { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 28px; }

.hero-art { position: relative; justify-self: center; }
.avatar {
  width: clamp(220px, 32vw, 340px); aspect-ratio: 1;
  border-radius: 42% 58% 55% 45% / 48% 42% 58% 52%;
  background: linear-gradient(145deg, var(--accent-2), var(--accent) 55%, var(--primary));
  display: grid; place-items: center; object-fit: cover;
  box-shadow: var(--shadow);
  animation: morph 10s ease-in-out infinite;
}
.avatar span { font-size: clamp(4rem, 9vw, 6.5rem); }

.sticker {
  position: absolute; display: grid; place-items: center;
  width: 64px; height: 64px; font-size: 1.9rem;
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow);
  animation: bob 4s ease-in-out infinite;
}
.sticker-1 { top: 4%; left: -6%; transform: rotate(-10deg); }
.sticker-2 { top: 42%; right: -10%; animation-delay: -1.3s; }
.sticker-3 { bottom: 0; left: 8%; animation-delay: -2.6s; }

@media (max-width: 820px) {
  .hero { padding: 40px 0 72px; }
  .hero-inner { grid-template-columns: 1fr; text-align: center; }
  .tagline { margin-inline: auto; }
  .hero-actions { justify-content: center; }
  .hero-art { grid-row: 1; margin: 12px 0 8px; }
  .sticker { width: 52px; height: 52px; font-size: 1.5rem; }
  .sticker-2 { right: -6%; }
}

/* ==========================================================================
   Sections
   ========================================================================== */
.section { padding: 96px 0; }
.section-alt { background: var(--bg-alt); }

.section-title {
  font-size: clamp(2rem, 5vw, 2.75rem); text-align: center; margin-bottom: 0.4em;
}
.section-title::after {
  content: ""; display: block; width: 64px; height: 6px; margin: 14px auto 0;
  border-radius: 6px; background: linear-gradient(90deg, var(--primary), var(--accent));
}
.section-intro { text-align: center; color: var(--text-muted); margin-bottom: 32px; }

@media (max-width: 720px) { .section { padding: 72px 0; } }

/* About ------------------------------------------------------------------ */
.about-grid {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: start; margin-top: 40px;
}
.lead { font-size: 1.25rem; font-weight: 600; }

.fact-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.fact {
  display: flex; flex-direction: column; gap: 2px;
  padding: 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  transition: transform 0.25s;
}
.fact:hover { transform: translateY(-4px) rotate(-1deg); }
.fact-emoji { font-size: 1.8rem; margin-bottom: 6px; }
.fact strong { font-family: var(--font-display); font-size: 1.1rem; }
.fact span:last-child { color: var(--text-muted); font-size: 0.95rem; }

.skills { margin-top: 56px; text-align: center; }
.skills h3 { font-size: 1.4rem; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 16px; }
.chips li {
  padding: 8px 18px; border-radius: 999px; font-weight: 700;
  background: color-mix(in srgb, var(--primary) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
}

@media (max-width: 820px) {
  .about-grid { grid-template-columns: 1fr; gap: 32px; }
}

/* Projects --------------------------------------------------------------- */
.filters { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-bottom: 36px; }
.filter {
  padding: 8px 20px; border-radius: 999px; cursor: pointer;
  font: 600 0.95rem var(--font-display);
  color: var(--text); background: var(--surface); border: 1px solid var(--border);
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.filter:hover { border-color: var(--primary); }
.filter.is-active { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }

.project-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(300px, 100%), 1fr)); gap: 24px;
}
.project-card {
  display: flex; flex-direction: column; overflow: hidden;
  border-radius: var(--radius); background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow);
  transition: transform 0.25s, box-shadow 0.25s;
}
.project-card:hover { transform: translateY(-6px); }
.project-card[hidden] { display: none; }

.project-thumb {
  aspect-ratio: 16 / 10; display: grid; place-items: center; font-size: 3.5rem;
  background: linear-gradient(135deg, var(--c1), var(--c2));
}
.project-thumb img { width: 100%; height: 100%; object-fit: cover; }

.project-body { padding: 22px; display: flex; flex-direction: column; flex: 1; }
.project-body h3 { font-size: 1.3rem; margin-top: 8px; }
.project-body p { color: var(--text-muted); flex: 1; }
.tag {
  align-self: flex-start; padding: 2px 12px; border-radius: 999px;
  font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--primary); background: color-mix(in srgb, var(--primary) 14%, transparent);
}
.project-link { font-weight: 700; text-decoration: none; }
.project-link:hover { text-decoration: underline; }

/* Contact ---------------------------------------------------------------- */
.contact-card {
  display: grid; grid-template-columns: 1fr 1.2fr; gap: 48px;
  margin-top: 40px; padding: clamp(24px, 5vw, 48px);
  border-radius: calc(var(--radius) + 8px);
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.contact-text h3 { font-size: 1.6rem; }
.contact-text p { color: var(--text-muted); }
.contact-email a { font: 600 1.15rem var(--font-display); word-break: break-all; }

.contact-form { display: grid; gap: 16px; }
.contact-form label { display: grid; gap: 6px; font-weight: 700; font-size: 0.95rem; }
.contact-form input, .contact-form textarea {
  width: 100%; padding: 12px 16px; font: inherit; color: var(--text);
  background: var(--bg); border: 2px solid var(--border); border-radius: 14px;
  transition: border-color 0.2s;
}
.contact-form textarea { resize: vertical; }
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--primary); }
.contact-form .is-invalid { border-color: var(--accent); }
.contact-form .btn { justify-self: start; }
.form-status { min-height: 1.5em; margin: 0; font-weight: 600; color: var(--text-muted); }

@media (max-width: 820px) {
  .contact-card { grid-template-columns: 1fr; gap: 28px; }
  .contact-form .btn { justify-self: stretch; }
}

/* Footer ----------------------------------------------------------------- */
.site-footer { padding: 32px 0; border-top: 1px solid var(--border); color: var(--text-muted); }
.footer-inner { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }
.footer-inner p { margin: 0; }
.back-to-top { font-weight: 700; text-decoration: none; }

/* ==========================================================================
   Animation
   ========================================================================== */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 0.6s ease, transform 0.6s ease; }
.reveal.is-visible { opacity: 1; transform: none; }
/* If JS is unavailable, show everything */
.no-js .reveal { opacity: 1; transform: none; }

@keyframes float { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(30px, 40px); } }
@keyframes bob { 0%, 100% { translate: 0 0; } 50% { translate: 0 -10px; } }
@keyframes morph {
  0%, 100% { border-radius: 42% 58% 55% 45% / 48% 42% 58% 52%; }
  50% { border-radius: 58% 42% 45% 55% / 55% 58% 42% 45%; }
}

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

.lang-toggle { display:inline-flex; align-items:center; gap:2px; border:1px solid var(--border, #ddd); border-radius:999px; padding:3px 6px; font-weight:700; }
.lang-toggle button { border:0; background:transparent; color:inherit; font:inherit; cursor:pointer; padding:2px 6px; border-radius:999px; opacity:.55; }
.lang-toggle button[aria-pressed="true"] { opacity:1; background:var(--primary, #7c5cff); color:#fff; }
.lang-toggle span { opacity:.4; }
