:root {
  --accent: #2fd27a;
  --accent-2: #b6f36a;
  --accent-3: #1eb163;
  --accent-ink: #04210f;
  --bg: #06130d;
  --bg-2: #0b2418;
  --glass: rgba(10, 32, 22, 0.72);
  --glass-2: rgba(255, 255, 255, 0.06);
  --line: rgba(182, 243, 106, 0.16);
  --text: #eafbf1;
  --muted: rgba(234, 251, 241, 0.62);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
  --radius: 16px;
}

[data-theme="light"] {
  --bg: #e8f6ee;
  --bg-2: #cdebd9;
  --glass: rgba(255, 255, 255, 0.78);
  --glass-2: rgba(6, 60, 34, 0.05);
  --line: rgba(6, 80, 44, 0.14);
  --text: #0a2a1a;
  --muted: rgba(10, 42, 26, 0.62);
  --shadow: 0 30px 70px rgba(10, 60, 34, 0.2);
  --accent: #12a457;
}

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

html, body {
  height: 100%;
  font-family: "Space Grotesk", system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 50% 120%, var(--bg-2), transparent 70%),
    var(--bg);
  overflow: hidden;
  transition: background-color 0.4s, color 0.4s;
}

button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; }
img { display: block; width: 100%; height: 100%; object-fit: cover; user-select: none; }

/* ---------- Background ---------- */
.bg-grid {
  position: fixed; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse at center, #000 10%, transparent 70%);
  -webkit-mask-image: radial-gradient(ellipse at center, #000 10%, transparent 70%);
  opacity: 0.5;
}
.bg-glow { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.bg-glow i {
  position: absolute; border-radius: 50%; filter: blur(100px); opacity: 0.28;
  animation: drift 18s ease-in-out infinite alternate;
}
.bg-glow i:nth-child(1) { width: 460px; aspect-ratio: 1; background: #10b981; top: -12%; left: -6%; }
.bg-glow i:nth-child(2) { width: 380px; aspect-ratio: 1; background: #b6f36a; bottom: -14%; right: 4%; animation-delay: -6s; opacity: 0.18; }
.bg-glow i:nth-child(3) { width: 320px; aspect-ratio: 1; background: #14b8a6; top: 38%; left: 46%; animation-delay: -12s; }
[data-theme="light"] .bg-glow i { opacity: 0.35; }

@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(60px, 40px) scale(1.2); }
}

/* ---------- Menu bar ---------- */
.menubar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 60;
  display: flex; justify-content: space-between; align-items: center;
  height: 40px; padding: 0 14px;
  font-size: 0.85rem;
  background: var(--glass);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
}
.menubar-left, .menubar-right { display: flex; align-items: center; gap: 12px; }
.logo { color: var(--accent); }
.menubar-status { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.clock { font-family: "JetBrains Mono", monospace; font-size: 0.8rem; color: var(--muted); min-width: 4.5ch; }

.lang-switch { display: flex; padding: 3px; border-radius: 999px; background: var(--glass-2); border: 1px solid var(--line); }
.lang-btn { padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; opacity: 0.6; transition: all 0.2s; }
.lang-btn:hover { opacity: 1; }
.lang-btn.active { opacity: 1; background: var(--accent); color: var(--accent-ink); }

.theme-toggle { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--glass-2); border: 1px solid var(--line); }
.theme-toggle .fa-sun { display: none; }
[data-theme="light"] .theme-toggle .fa-sun { display: inline; }
[data-theme="light"] .theme-toggle .fa-moon { display: none; }

.dot {
  width: 8px; aspect-ratio: 1; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 rgba(47, 210, 122, 0.7); animation: pulse 2s infinite;
}
@keyframes pulse {
  70% { box-shadow: 0 0 0 9px rgba(47, 210, 122, 0); }
  100% { box-shadow: 0 0 0 0 rgba(47, 210, 122, 0); }
}

/* ---------- Hero ---------- */
.home { position: relative; height: 100vh; display: grid; place-items: center; }
.hero { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding: 0 20px 90px; }
.hero-badge {
  display: inline-flex; align-items: center; gap: 10px; padding: 6px 14px;
  font-size: 0.85rem; border-radius: 999px;
  background: var(--glass-2); border: 1px solid var(--line);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  animation: rise 0.9s ease both;
}
.hero-title {
  font-size: clamp(3.4rem, 13vw, 9rem); line-height: 1; font-weight: 700; letter-spacing: -0.04em;
  background: linear-gradient(180deg, var(--accent-2) 25%, var(--accent) 75%, var(--accent-3));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 10px 40px rgba(16, 185, 129, 0.25));
  animation: rise 0.9s ease 0.1s both;
}
.hero-role { font-size: clamp(1rem, 2vw, 1.4rem); color: var(--muted); animation: rise 0.9s ease 0.2s both; }
.hero-typed {
  font-family: "JetBrains Mono", monospace; font-size: 0.95rem;
  padding: 8px 14px; border-radius: 10px; background: var(--glass-2); border: 1px solid var(--line);
  min-height: 2.4em; animation: rise 0.9s ease 0.3s both;
}
.prompt { color: var(--accent); }
.caret { display: inline-block; width: 8px; height: 1em; margin-left: 2px; vertical-align: -2px; background: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero-hint { margin-top: 6px; font-size: 0.85rem; color: var(--muted); animation: rise 0.9s ease 0.4s both; }
.hero-hint i { animation: bob 1.6s ease-in-out infinite; display: inline-block; }
@keyframes bob { 50% { transform: translateY(4px); } }
@keyframes rise { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }

/* ---------- Dock ---------- */
.dock {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 55;
  display: flex; align-items: flex-end; gap: 10px; padding: 10px 12px;
  background: var(--glass); border: 1px solid var(--line); border-radius: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.dock-sep { width: 1px; align-self: stretch; background: var(--line); margin: 4px 2px; }
.dock-item {
  position: relative; width: 50px; height: 50px; border-radius: 14px;
  display: grid; place-items: center; font-size: 1.3rem; color: #fff;
  background: linear-gradient(145deg, color-mix(in srgb, var(--c) 100%, #fff 18%), color-mix(in srgb, var(--c) 80%, #000 30%));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35), 0 6px 14px rgba(0, 0, 0, 0.25);
  transition: transform 0.2s cubic-bezier(0.3, 1.6, 0.5, 1), margin 0.2s;
}
.dock-item:hover { transform: translateY(-10px) scale(1.18); margin: 0 6px; }
.dock-item.open::after {
  content: ""; position: absolute; bottom: -7px; width: 4px; height: 4px; border-radius: 50%; background: var(--text);
}
.tip {
  position: absolute; bottom: calc(100% + 12px); left: 50%; transform: translateX(-50%) translateY(4px);
  white-space: nowrap; font-size: 0.75rem; font-weight: 500; padding: 4px 10px; border-radius: 8px;
  background: var(--glass); color: var(--text); border: 1px solid var(--line);
  opacity: 0; pointer-events: none; transition: all 0.2s;
}
.dock-item:hover .tip { opacity: 1; transform: translateX(-50%); }

/* ---------- Windows ---------- */
.window {
  position: fixed; left: 50%; top: 50%; z-index: 40;
  width: min(880px, calc(100vw - 24px)); max-height: calc(100vh - 150px);
  display: flex; flex-direction: column;
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(26px) saturate(1.2); -webkit-backdrop-filter: blur(26px) saturate(1.2);
  transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% - 20px + var(--dy, 0px))) scale(0.94);
  opacity: 0; visibility: hidden;
  transition: opacity 0.25s, transform 0.3s cubic-bezier(0.2, 0.9, 0.3, 1.1), visibility 0.25s, width 0.3s, max-height 0.3s;
}
.window.open { opacity: 1; visibility: visible; transform: translate(calc(-50% + var(--dx, 0px)), calc(-50% - 20px + var(--dy, 0px))); }
.window.minimizing { opacity: 0; transform: translate(-50%, 40vh) scale(0.1); }
.window.max {
  --dx: 0px !important; --dy: 0px !important;
  width: calc(100vw - 24px); max-height: calc(100vh - 150px); height: calc(100vh - 150px);
}
.window.dragging { transition: none; }

.window-header {
  position: relative; display: flex; align-items: center; justify-content: center;
  padding: 12px 14px; border-bottom: 1px solid var(--line); cursor: grab; user-select: none; flex-shrink: 0;
}
.window.dragging .window-header { cursor: grabbing; }
.window-title { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.lights { position: absolute; left: 14px; display: flex; gap: 8px; }
.light {
  width: 13px; height: 13px; border-radius: 50%; display: grid; place-items: center;
  font-size: 0.5rem; color: transparent; transition: color 0.15s;
}
.lights:hover .light { color: rgba(0, 0, 0, 0.6); }
.light.red { background: #ff5f57; }
.light.yellow { background: #febc2e; }
.light.green { background: #28c840; }

.window-body { padding: 28px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.window-body h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); letter-spacing: -0.02em; margin-bottom: 6px; }
.lead { color: var(--muted); margin-bottom: 22px; line-height: 1.55; }

.card-ic {
  flex-shrink: 0; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center;
  color: #fff; background: var(--c);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3), 0 6px 16px color-mix(in srgb, var(--c) 40%, transparent);
}

.cta {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 12px; font-weight: 600; font-size: 0.92rem;
  background: var(--glass-2); border: 1px solid var(--line); transition: transform 0.2s, background 0.2s;
}
.cta:hover { transform: translateY(-2px); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.cta.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-ink); border-color: transparent; }
.cta.wide { width: 100%; margin-top: 18px; }

/* About */
.about { display: grid; grid-template-columns: 240px 1fr; gap: 34px; align-items: center; }
.avatar-col { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.avatar-wrap { position: relative; width: 200px; aspect-ratio: 1; }
.avatar-ring {
  position: absolute; inset: -6px; border-radius: 50%;
  background: conic-gradient(var(--accent), var(--accent-2), #14b8a6, var(--accent));
  animation: spin 8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.avatar {
  position: absolute; inset: 0; border-radius: 50%; overflow: hidden;
  border: 5px solid var(--bg); background: linear-gradient(145deg, #0f5132, #06130d);
  display: grid; place-items: center;
}
.avatar img { position: absolute; inset: 0; z-index: 1; }
.avatar span { font-size: 5rem; font-weight: 700; color: var(--accent-2); }
.stack-bar { display: flex; gap: 10px; font-size: 1.35rem; padding: 8px 14px; border-radius: 999px; background: var(--glass-2); border: 1px solid var(--line); }
.eyebrow { font-family: "JetBrains Mono", monospace; font-size: 0.8rem; color: var(--accent); }
.about-content h2 { font-size: clamp(2.2rem, 4vw, 3rem); margin: 4px 0 0; }
.role { display: block; color: var(--muted); margin-bottom: 14px; }
.about-content p { line-height: 1.65; margin-bottom: 10px; }
.about-facts { display: flex; gap: 12px; margin: 18px 0; flex-wrap: wrap; }
.about-facts li { flex: 1; min-width: 110px; padding: 12px 14px; border-radius: 12px; background: var(--glass-2); border: 1px solid var(--line); }
.about-facts b { display: block; font-size: 1.4rem; color: var(--accent); }
.about-facts span { font-size: 0.8rem; color: var(--muted); }
.cta-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* Skills */
.skill-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.skill-card, .service-card { padding: 18px; border-radius: 14px; background: var(--glass-2); border: 1px solid var(--line); }
.card-head { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }
.card-head h3 { font-size: 1.05rem; }
.card-head p { font-size: 0.8rem; color: var(--muted); }
.skill-card ul { display: grid; gap: 8px; }
.skill-card li { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 10px; transition: background 0.2s; }
.skill-card li:hover { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.skill-card li > i { font-size: 1.5rem; width: 28px; text-align: center; color: var(--text); }
.skill-card li b { display: block; font-size: 0.92rem; }
.skill-card li small { color: var(--muted); font-size: 0.78rem; }

/* Projects */
.tabs { display: flex; gap: 6px; margin-bottom: 16px; flex-wrap: wrap; }
.tab { padding: 6px 14px; border-radius: 999px; font-size: 0.85rem; border: 1px solid var(--line); background: var(--glass-2); transition: all 0.2s; }
.tab.active { background: var(--accent); color: var(--accent-ink); border-color: transparent; font-weight: 600; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.project-card {
  position: relative; padding: 14px; border-radius: 14px; overflow: hidden;
  background: var(--glass-2); border: 1px solid var(--line);
  transition: transform 0.25s, box-shadow 0.25s, opacity 0.25s;
}
.project-card:hover { transform: translateY(-4px); box-shadow: 0 16px 40px color-mix(in srgb, var(--c1) 30%, transparent); }
.project-card.hide { display: none; }
.pc-banner {
  height: 96px; border-radius: 10px; margin-bottom: 12px; display: grid; place-items: center;
  font-size: 2.2rem; color: rgba(255, 255, 255, 0.92);
  background: radial-gradient(circle at 30% 20%, rgba(255, 255, 255, 0.3), transparent 50%), linear-gradient(135deg, var(--c1), var(--c2));
}
.badge {
  position: absolute; top: 22px; right: 22px; font-size: 0.68rem; font-weight: 600;
  padding: 3px 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.45); color: #fff;
}
.badge.live { background: var(--accent-2); color: var(--accent-ink); }
.project-card h3 { font-size: 1rem; margin-bottom: 4px; }
.project-card p { font-size: 0.82rem; color: var(--muted); line-height: 1.5; margin-bottom: 10px; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags span { font-size: 0.7rem; font-family: "JetBrains Mono", monospace; padding: 3px 8px; border-radius: 6px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }

/* Services */
.service-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.service-card h3 { margin: 14px 0 6px; font-size: 1rem; }
.service-card p { font-size: 0.85rem; color: var(--muted); line-height: 1.5; }
.process { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-top: 18px; }
.process li { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 12px; border: 1px dashed var(--line); font-size: 0.88rem; }
.process b { font-family: "JetBrains Mono", monospace; color: var(--accent); }

/* Contact */
.contact { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.contact-links { display: grid; gap: 10px; }
.contact-link {
  display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px;
  background: var(--glass-2); border: 1px solid var(--line); transition: border-color 0.2s, transform 0.2s;
}
.contact-link:hover { border-color: var(--accent); transform: translateX(3px); }
.contact-link > a, .contact-link > span:not(.card-ic) { flex: 1; min-width: 0; }
.contact-link small { display: block; font-size: 0.72rem; color: var(--muted); }
.contact-link b { font-size: 0.9rem; word-break: break-all; }
.contact-link .ext, .copy { color: var(--muted); }
.copy { width: 32px; height: 32px; border-radius: 8px; }
.copy:hover { background: var(--glass-2); color: var(--accent); }

.contact-form { display: grid; gap: 12px; align-content: start; }
.contact-form label { display: grid; gap: 6px; font-size: 0.82rem; color: var(--muted); }
.contact-form input, .contact-form textarea {
  font: inherit; color: var(--text); padding: 11px 13px; border-radius: 10px;
  background: var(--glass-2); border: 1px solid var(--line); outline: none; resize: vertical;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.contact-form input:focus, .contact-form textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.contact-form button:disabled { opacity: 0.6; cursor: wait; }
.hidden-field { position: absolute; left: -9999px; }
.form-status { font-size: 0.85rem; min-height: 1.2em; }
.form-status.ok { color: var(--accent); }
.form-status.err { color: #ff6b6b; }

/* Toast */
.toast {
  position: fixed; top: 54px; left: 50%; transform: translate(-50%, -20px); z-index: 70;
  padding: 8px 16px; border-radius: 10px; font-size: 0.85rem;
  background: var(--accent); color: var(--accent-ink); font-weight: 600;
  opacity: 0; pointer-events: none; transition: all 0.25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .menubar-status { display: none; }
  .window { max-height: calc(100vh - 140px); top: calc(50% - 10px); }
  .window-header { cursor: default; }
  .window-body { padding: 20px; }
  .about, .contact { grid-template-columns: 1fr; text-align: left; }
  .avatar-wrap { width: 150px; }
  .dock { gap: 6px; padding: 8px; max-width: calc(100vw - 16px); }
  .dock-item { width: 42px; height: 42px; font-size: 1.1rem; border-radius: 12px; }
  .dock-item:hover { transform: translateY(-4px); margin: 0; }
  .tip { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
