/* ===== DARK — Cyber-tech (warm copper) ===== */
:root {
  --bg: #07070c;
  --surface: #0e0e16;
  --text: #dde3ee;
  --muted: #7a8599;
  --border: rgba(210, 148, 74, .08);
  --nav: rgba(7, 7, 12, .88);
  --accent: #d2944a;
  --accent-bg: rgba(210, 148, 74, .08);
  --accent-ring: rgba(210, 148, 74, .22);
  --accent-glow: rgba(210, 148, 74, .14);
  --red: #f43f5e;
  --focus: #ffffff;
  --divider: rgba(210, 148, 74, .06);
  --shadow-sm: 0 4px 14px rgba(0, 0, 0, .35);
  --shadow-md: 0 16px 36px rgba(0, 0, 0, .45);
  --even: #0a0a11;
  --btn-text: #07070c;
  --work-card-size: clamp(220px, 28vw, 340px);
}

/* ===== LIGHT — Warm sand & copper ===== */
[data-theme="light"] {
  --bg: #faf8f5;
  --surface: #ffffff;
  --text: #1c1917;
  --muted: #78716c;
  --border: rgba(180, 122, 43, .10);
  --nav: rgba(250, 248, 245, .92);
  --accent: #b47a2b;
  --accent-bg: rgba(180, 122, 43, .06);
  --accent-ring: rgba(180, 122, 43, .20);
  --accent-glow: rgba(180, 122, 43, .08);
  --red: #dc2626;
  --focus: #1c1917;
  --divider: rgba(180, 122, 43, .06);
  --shadow-sm: 0 4px 14px rgba(28, 25, 23, .06);
  --shadow-md: 0 16px 36px rgba(28, 25, 23, .10);
  --even: #f5f0ea;
  --btn-text: #ffffff;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  -webkit-text-size-adjust: 100%;
}

/* Prevent 300ms tap delay on mobile */
a, button, input, textarea, select { touch-action: manipulation; }

body {
  margin: 0;
  font-family: 'Space Grotesk', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

img, video { max-width: 100%; display: block; }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

h1 {
  font-size: clamp(3rem, 8vw, 5rem);
  line-height: 1.08;
  margin-top: .4rem;
  margin-bottom: 1rem;
}

h2.section-title {
  font-size: clamp(2rem, 4vw, 3rem);
  text-align: center;
  margin: 0 0 24px 0;
}

p { color: var(--muted); }

.hr {
  height: 1px;
  background: var(--divider);
  margin: 24px 0;
}

/* navbar */
.navbar {
  position: fixed;
  top: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--nav);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.nav-link {
  color: var(--text);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 999px;
  line-height: 1;
}

.nav-link:hover,
.nav-link.active {
  outline: 1px solid var(--accent);
  background: transparent;
}

/* theme toggle */
.theme-toggle {
  position: fixed;
  top: 24px;
  right: 24px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--nav);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  cursor: pointer;
  z-index: 2147483000;
  transition: all 0.25s ease;
}

.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

[data-theme="light"] .fa-sun,
[data-theme="dark"]  .fa-moon { display: none; }

/* language toggle */
.lang-toggle {
  position: fixed;
  top: 24px;
  right: 80px;
  height: 48px;
  padding: 0 16px;
  border-radius: 999px;
  display: flex;
  align-items: center;
  background: var(--nav);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  color: var(--text);
  text-decoration: none;
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .04em;
  z-index: 2147483000;
  transition: all 0.25s ease;
}
.lang-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* boot-lock: hide lang toggle too */
body.boot-lock .lang-toggle { opacity: 0; pointer-events: none; transform: translateY(4px); }

/* Hide toggles when popup is open */
body.popup-active .theme-toggle,
body.popup-active .lang-toggle { opacity: 0; pointer-events: none; }

/* buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: 11px 16px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--btn-text);
  border: 1px solid var(--accent);
  text-decoration: none;
}

.btn:hover { filter: brightness(1.02); }
.btn-outline { background: transparent; color: var(--text); border: 1px solid var(--accent); }
.btn-outline:hover { background: var(--accent-bg); }
.btn-small { padding: 8px 12px; font-size: .92rem; }
.btn-danger { background: var(--red); border-color: var(--red); color: #fff; }

/* hero */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding-top: 7rem;
  padding-bottom: 4rem;
  background-color: var(--bg);
  overflow: hidden;
}

.hero .container { position: relative; z-index: 2; }

/* -- Dark: cyber grid overlay -- */
.hero::after {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(210, 148, 74, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(210, 148, 74, .025) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, black 20%, transparent 70%);
  mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, black 20%, transparent 70%);
}

/* -- Light: warm hero -- */
[data-theme="light"] .hero {
  background-color: #f0e6d6;
}
[data-theme="light"] .hero::after {
  background-image: none;
  background: radial-gradient(ellipse 80% 50% at 70% 20%, rgba(180, 122, 43, .04), transparent);
}

/* -- hero terminal background (scrolling) -- */
.hero-bg-term {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
  user-select: none;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,.6) 12%, black 30%, black 55%, rgba(0,0,0,.5) 75%, transparent 95%);
  mask-image: linear-gradient(to bottom, transparent 0%, rgba(0,0,0,.6) 12%, black 30%, black 55%, rgba(0,0,0,.5) 75%, transparent 95%);
}

.hero-bg-scroll {
  animation: termScroll 55s linear infinite;
}

@keyframes termScroll {
  0% { transform: translateY(0); }
  100% { transform: translateY(-50%); }
}

.hero-bg-term pre {
  margin: 0;
  padding: 90px 40px 30px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: clamp(11px, 1.15vw, 14px);
  line-height: 1.85;
  white-space: pre;
  color: rgba(210, 148, 74, .08);
}

/* Dark: copper tints */
.hero-bg-term .bg-ok { color: rgba(210, 148, 74, .18); }
.hero-bg-term .bg-accent { color: rgba(210, 148, 74, .24); }
.hero-bg-term .bg-dim { color: rgba(180, 150, 100, .05); }

/* Light: warm tints */
[data-theme="light"] .hero-bg-term pre { color: rgba(180, 122, 43, .07); }
[data-theme="light"] .hero-bg-term .bg-ok { color: rgba(180, 122, 43, .14); }
[data-theme="light"] .hero-bg-term .bg-accent { color: rgba(180, 122, 43, .18); }
[data-theme="light"] .hero-bg-term .bg-dim { color: rgba(120, 113, 108, .04); }

/* Dark: scan line effect */
.hero-bg-term::after {
  content: "";
  position: absolute;
  left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 5%, var(--accent) 50%, transparent 95%);
  opacity: .08;
  animation: scanLine 8s ease-in-out infinite;
  z-index: 2;
}
@keyframes scanLine {
  0% { top: 15%; }
  100% { top: 85%; }
}
[data-theme="light"] .hero-bg-term::after { display: none; }

@media (max-width: 640px) { .hero-bg-term { display: none; } }

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

.profile-frame { width: 380px; height: 460px; margin: auto; position: relative; }
.profile-pic { width: 100%; height: 100%; object-fit: cover; border-radius: 18px; position: relative; z-index: 1; }
.profile-backdrop {
  position: absolute;
  top: -6px; right: -6px; bottom: -6px; left: -6px;
  border-radius: 22px;
  z-index: 0;
  opacity: .5;
  filter: blur(28px);
  background: radial-gradient(ellipse at 50% 40%, var(--accent), transparent 70%);
  transition: opacity .6s ease;
}
[data-theme="light"] .profile-backdrop {
  background: radial-gradient(ellipse at 50% 40%, rgba(180, 122, 43, .25), transparent 70%);
  opacity: .7;
}

/* hero stats */
.hero-stats {
  display: flex;
  gap: 10px;
  margin-top: 22px;
  flex-wrap: wrap;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: .88rem;
  color: var(--muted);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  transition: border-color .25s ease;
}

.stat-pill:hover { border-color: var(--accent); }
.stat-pill strong { color: var(--text); font-weight: 600; }
.stat-pill i { color: var(--accent); font-size: .95rem; }
.stat-sep { opacity: .4; }

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #1CD66C;
  display: inline-block;
  animation: pulseDot 2s ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(28, 214, 108, .4); }
  50% { opacity: .6; box-shadow: 0 0 0 6px rgba(28, 214, 108, 0); }
}

/* section baseline + backgrounds */
section { position: relative; z-index: 1; transition: background-color .8s ease, color .8s ease; }

/* base backgrounds */
.work { padding-top: 96px; padding-bottom: 96px; background-color: var(--bg); }
.about, .contact, .services { padding-top: 88px; padding-bottom: 88px; background-color: var(--surface); }

/* section backgrounds — solid colors for clean theme transitions */
#about, #skills, #work, #contact {
  position: relative;
  padding-top: 100px;
  padding-bottom: 80px;
}
#contact { overflow: hidden; }

#about  { background-color: var(--even); z-index: 2; }
#work   { background-color: var(--surface); }
#skills { background-color: var(--even); }
/* footer */
footer { background-color: var(--surface); }

/* section title */
.section-title {
  position: relative;
  display: inline-block;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--divider);
}

/* section title line animation */
.section-title::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width .6s cubic-bezier(.16, 1, .3, 1);
}
.section-title.animate::after {
  width: 100%;
}

/* services */
.services .services-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.service-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.service-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm), 0 0 24px var(--accent-glow);
  transform: translateY(-3px);
}
.service-card { transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease; }
.service-card h3 { margin: 8px 0 6px 0; }
.service-card p { margin: 0 0 10px 0; }

.service-link {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px solid var(--divider);
  padding-bottom: 2px;
}
.service-link:hover { border-bottom-color: var(--accent); }
.service-icon { font-size: 22px; color: var(--accent); }

/* work grid */
#work .work-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 0;
  margin: 0;
}

.work-item {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: transform .25s ease;
  font-size: clamp(12px, 1.2vw, 18px);
}

.work-item:hover { transform: translateY(-4px); }

.work-image { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

.work-image h3 {
  position: absolute;
  top: .6em;
  left: .8em;
  margin: 0;
  font-size: 1em;
  line-height: 1;
  font-weight: 700;
  color: var(--text);
  text-shadow: 0 1px 2px rgba(0,0,0,.5);
  z-index: 2;
}

.work-media,
.work-image img,
.work-image video {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.work-overlay {
  position: absolute;
  top: auto; right: 0; bottom: 0; left: 0;
  padding: 1.2em 1em;
  display: flex;
  flex-direction: column;
  gap: .6em;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.85) 0%, rgba(0, 0, 0, 0.55) 60%, rgba(0, 0, 0, 0) 100%);
  opacity: 1;
  transition: opacity .35s ease, transform .35s ease, background .35s ease;
  transform: translateY(0);
  font-size: .9em;
  z-index: 2;
  border-radius: 0 0 16px 16px;
  color: #FFFFFF;
}
.work-overlay p, .work-overlay a { color: #FFFFFF !important; }
.work-item:hover .work-overlay {
  background: linear-gradient(to top, rgba(0, 0, 0, 0.92) 0%, rgba(0, 0, 0, 0.65) 60%, rgba(0, 0, 0, 0) 100%);
}

.video-smartparking { filter: brightness(1.05); }

.work-iframe {
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 16px;
  object-fit: cover;
  overflow: hidden;
}

#work .work-image h3 { color: #FFFFFF !important; text-shadow: 0 2px 4px rgba(0, 0, 0, .4); }

/* about — shared */
.about-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
  max-width: 980px;
  margin: 0 auto;
}
.about-content { text-align: center; }

/* About — Split: Timeline + Stats */
.about-split {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 50px;
  align-items: start;
  max-width: 900px;
  margin: 0 auto;
}
.about-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  position: sticky;
  top: 120px;
}
.stat-card {
  text-align: center;
  padding: 22px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color .3s, box-shadow .3s, transform .3s;
  position: relative;
  cursor: default;
}
.stat-card.has-popup { cursor: pointer; }
.stat-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(210,148,74,.12);
  transform: translateY(-4px);
}
.stat-num {
  display: block;
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 6px;
}
.stat-label {
  font-size: .72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
}

/* Stat card popup */
.stat-card .popup {
  display: none;
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translateX(-50%);
  width: 280px;
  padding: 18px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-md);
  z-index: 100;
  text-align: left;
  color: var(--text);
}
.stat-card .popup.open { display: block; }
.stat-card .popup .popup-arrow {
  position: absolute;
  top: -6px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 12px;
  height: 12px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
}
.stat-card .popup .popup-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.3rem;
  cursor: pointer;
  line-height: 1;
}
.stat-card .popup .popup-close:hover { color: var(--text); }
.stat-card .popup h4 {
  margin: 0 0 4px;
  font-size: .95rem;
  color: var(--accent);
}
.stat-card .popup p {
  font-size: .8rem;
  margin: 0 0 10px;
}
.stat-card .popup ul {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  font-size: .78rem;
}
.stat-card .popup ul li {
  padding: 4px 0;
  border-bottom: 1px solid var(--divider);
}
.stat-card .popup ul li:last-child { border-bottom: none; }

/* Commute loop */
.commute-loop {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 0;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
}
.commute-loop i {
  color: var(--accent);
  font-size: .9rem;
}

/* Popup stat items */
.popup-stat-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0;
}
.popup-stat-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: .8rem;
}
.popup-stat-item strong {
  color: var(--accent);
  font-weight: 700;
}
.popup-stat-item span {
  color: var(--muted);
  font-size: .72rem;
}

@media (max-width: 700px) {
  .about-split { grid-template-columns: 1fr; gap: 32px; }
  .about-stats { position: static; }
  .about-timeline { padding-left: 36px; }
  .stat-card {
    padding: 14px 10px;
  }
  .stat-num {
    font-size: 1.5rem;
  }
  .stat-label {
    font-size: .65rem;
  }
  /* Mobile popup: fixed bottom sheet — must be above theme/lang toggles */
  .stat-card .popup {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    transform: none;
    width: 100%;
    border-radius: 18px 18px 0 0;
    max-height: 70vh;
    max-height: 70dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    z-index: 2147483001;
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }
  .stat-card .popup .popup-arrow { display: none; }
}

/* Timeline */
.about-timeline {
  max-width: 600px;
  margin: 0 auto;
  position: relative;
  padding-left: 40px;
}
.about-timeline::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to bottom, var(--accent), var(--border));
}
.tl-item {
  position: relative;
  margin-bottom: 28px;
  transition-delay: var(--delay, 0s);
}
.tl-item:last-child { margin-bottom: 0; }
.tl-icon {
  position: absolute;
  left: -40px;
  top: 2px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}
.tl-icon i {
  font-size: .75rem;
  color: var(--accent);
}
.tl-content h4 {
  font-size: .9rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 6px;
}
.tl-content p {
  font-size: .84rem;
  line-height: 1.6;
  color: var(--text);
  margin: 0;
}

/* skills */
.skills-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin: 14px 0 16px 0;
}

.skills-controls .btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 12px;
  border-radius: 10px;
  opacity: 0;
  transform: translateY(8px);
}

.skills-controls .btn.active {
  background: var(--accent);
  color: var(--btn-text);
  border-color: var(--accent);
}

.skill-wall {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
}

.skill-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .25s ease, transform .25s ease, border-color .25s ease;
}

.skill-tile.show { opacity: 1; transform: translateY(0); }
.skill-tile:hover { border-color: var(--accent); }

.skill-logo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--accent);
  font-size: 1.2rem;
  font-weight: 700;
  flex: 0 0 auto;
}

.skill-name { font-weight: 600; line-height: 1.25; }

.skill-legend {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-top: 10px;
  flex-wrap: wrap;
}

.skill-legend .legend {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: .95rem;
}

.skill-legend .legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.legend.systems i { background: #60A5FA; }
.legend.network i { background: #34D399; }
.legend.cloud i { background: #F472B6; }
.legend.dev i { background: #F59E0B; }
.legend.services i { background: #8B5CF6; }
.legend.automation i { background: #FACC15; }

/* contact */
.contact .contact-content { max-width: 640px; margin: 0 auto; text-align: center; }

.contact-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin: 14px auto 18px;
  text-align: left;
  box-shadow: var(--shadow-sm);
}

.contact-form .form-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
}

.contact-form label { font-weight: 600; }

.contact-form input,
.contact-form textarea {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px;
  border-radius: 10px;
  outline: none;
}

.contact-form input:focus,
.contact-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.contact-form .hp {
  position: absolute;
  left: -9999px;
  opacity: 0;
  height: 0;
  width: 0;
  pointer-events: none;
}

.form-status { margin-top: .6rem; font-size: .95rem; color: var(--muted); }

/* ===== Animation types ===== */
.fade-in {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .6s cubic-bezier(.16, 1, .3, 1) var(--delay, 0s), transform .6s cubic-bezier(.16, 1, .3, 1) var(--delay, 0s);
}
.fade-in.animate { opacity: 1; transform: none; }

.reveal-up {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity .7s cubic-bezier(.16, 1, .3, 1) var(--delay, 0s), transform .7s cubic-bezier(.16, 1, .3, 1) var(--delay, 0s);
}
.reveal-up.animate { opacity: 1; transform: none; }

.slide-left {
  opacity: 0;
  transform: translateX(-30px);
  transition: opacity .6s cubic-bezier(.16, 1, .3, 1) var(--delay, 0s), transform .6s cubic-bezier(.16, 1, .3, 1) var(--delay, 0s);
}
.slide-left.animate { opacity: 1; transform: none; }

.scale-in {
  opacity: 0;
  transform: scale(.85);
  transition: opacity .6s cubic-bezier(.16, 1, .3, 1) var(--delay, 0s), transform .6s cubic-bezier(.16, 1, .3, 1) var(--delay, 0s);
}
.scale-in.animate { opacity: 1; transform: none; }

/* Hero word split animation */
[data-split-words] .word {
  display: inline-block;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .5s cubic-bezier(.16, 1, .3, 1), transform .5s cubic-bezier(.16, 1, .3, 1);
}
[data-split-words] .word.animate {
  opacity: 1;
  transform: none;
}

/* Stagger grid system */
[data-stagger] > * {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity .5s cubic-bezier(.16, 1, .3, 1), transform .5s cubic-bezier(.16, 1, .3, 1);
}
[data-stagger] > *.animate {
  opacity: 1;
  transform: none;
}

/* 3D tilt on work cards */
.work-item {
  transform-style: preserve-3d;
  perspective: 800px;
}

/* Parallax hero image */
.hero-image {
  will-change: transform;
}

/* Glow pulse */
@keyframes glowPulse {
  0%, 100% { box-shadow: 0 0 0 0 var(--accent-glow); }
  50% { box-shadow: 0 0 20px 4px var(--accent-glow); }
}

/* Theme-switching uniform transitions */
body.theme-switching,
body.theme-switching *,
body.theme-switching *::before,
body.theme-switching *::after {
  transition: background .5s ease, background-color .5s ease, color .5s ease, border-color .5s ease, box-shadow .5s ease, fill .5s ease !important;
}

/* side index */
.side-index {
  position: fixed;
  top: 50%;
  left: 24px;
  z-index: 10000;
  width: 120px;
  padding: 14px 10px;
  border-radius: 16px;
  background: rgba(7, 7, 12, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .25s ease, box-shadow .25s ease, background .3s ease;
  opacity: 0;
  transform: translate(-8px, -50%);
  animation: sideIndexIn .6s ease-out forwards .25s;
}

@keyframes sideIndexIn {
  0% { opacity: 0; transform: translate(-8px, -50%); }
  100% { opacity: 1; transform: translate(0, -50%); }
}

.side-index:hover {
  transform: translate(0, -51%);
  box-shadow: var(--shadow-md), 0 0 20px var(--accent-glow);
  background: rgba(7, 7, 12, 0.75);
}

[data-theme="light"] .side-index {
  background: rgba(250, 248, 245, 0.65);
  border: 1px solid var(--border);
  box-shadow: 0 8px 30px rgba(28, 25, 23, .06);
}

[data-theme="light"] .side-index:hover {
  background: rgba(250, 248, 245, 0.85);
}

.side-index nav {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}

.side-index .idx {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: .02em;
  opacity: .85;
  transition: opacity .25s, transform .25s, color .25s;
}

.side-index .idx:hover { opacity: 1; transform: translateX(6px); }
.side-index .idx.active { color: var(--accent); opacity: 1; }

.content { margin-left: 0; }
@media (max-width: 980px) { .side-index { display: none; } }

/* boot lock */
body.boot-lock { overflow: hidden; height: 100vh; height: 100dvh; }
body.boot-lock main, body.boot-lock footer, body.boot-lock .side-index { visibility: hidden; }

/* boot terminal */
.boot-term {
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  display: grid;
  place-items: center;
  z-index: 10000;
  background: var(--bg);
  color: var(--text);
  pointer-events: auto;
}

.boot-term .term-window {
  width: 720px;
  height: 320px;
  max-width: 92vw;
  max-height: 70vh;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: scale(.96) translateY(8px);
}

.boot-term.show .term-window { animation: bootTermIn .5s cubic-bezier(.16, 1, .3, 1) forwards; }
.boot-term.hide .term-window { animation: bootTermOut .45s cubic-bezier(.16, 1, .3, 1) forwards; }

@keyframes bootTermIn {
  0% { opacity: 0; transform: scale(.96) translateY(8px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes bootTermOut {
  0% { opacity: 1; transform: scale(1) translateY(0); }
  100% { opacity: 0; transform: scale(.94) translateY(8px); }
}

.term-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: transparent;
  border-bottom: 1px solid var(--border);
  font-size: clamp(13px, 3.8vw, 20px);
  color: var(--muted);
}

.term-title .dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.term-title .red { background: var(--red); }
.term-title .yellow { background: #D7A133; }
.term-title .green { background: #1CD66C; }

.term-body {
  flex: 1;
  margin: 0;
  padding: 14px 12px;
  white-space: pre-wrap;
  line-height: 1.6;
  font-size: clamp(13px, 3.8vw, 20px);
}

.term-body .prompt { color: #1CD66C; }
.term-body .path { color: var(--accent); }
.term-body .cursor { animation: blink 1s step-end infinite; }

@keyframes blink { 50% { opacity: 0; } }
.term-body .prog { text-align: center; display: block; margin-top: .3rem; }

/* boot output colors */
.boot-ok { color: #1CD66C; font-weight: 600; }
.boot-accent { color: var(--accent); }
.boot-dim { color: var(--muted); opacity: .4; }
.boot-info { color: var(--text); }

/* terminal glow */
.boot-term.show .term-window {
  box-shadow: var(--shadow-md), 0 0 80px rgba(28, 214, 108, .06);
}

/* social */
.social-links {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 20px 0;
}

.social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 1.2rem;
  transition: all 0.25s ease;
  text-decoration: none;
}

.social-link:hover {
  color: var(--accent);
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, .25), 0 0 16px var(--accent-glow);
}

/* theme transition */
html[data-theme] body,
html[data-theme] {
  transition: background 0.6s ease, color 0.6s ease, border-color 0.6s ease, background-color 0.6s ease;
}

body.theme-transition::before {
  content: "";
  position: fixed;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 9999;
  pointer-events: none;
  background: linear-gradient(135deg, var(--accent), var(--red));
  opacity: 0;
  transition: opacity 0.8s ease;
}

body.theme-transition-active::before { opacity: 0.25; }

/* tablet */
@media (max-width: 960px) {
  .hero-grid { grid-template-columns: 1fr; text-align: center; }
  .profile-frame { width: 300px; height: 360px; }
  :root { --work-card-size: clamp(190px, 46vw, 300px); }
}

/* small phones: shrink profile frame */
@media (max-width: 400px) {
  .profile-frame { width: min(240px, 70vw); height: min(300px, 88vw); }
}

/* phablet */
@media (max-width: 768px) {
  :root { --work-card-size: clamp(170px, 56vw, 280px); }
  .work-item { border-radius: 14px; }
}

/* mobile work card font */
@media (max-width: 560px) {
  #work .work-item {
    font-size: clamp(14px, 5vw, 20px);
  }
}

/* desktop: hide top navbar (sidebar layout visible) */
.navbar { display: none; }

/* mobile/tablet: show top navbar */
@media (max-width: 980px) {
  .navbar {
    position: fixed;
    top: calc(24px + env(safe-area-inset-top));
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(6px, 1.4vw, 12px);
    padding: clamp(8px, 1.2vw, 10px) clamp(14px, 2vw, 18px);
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--nav);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: var(--shadow-sm);
  }
  .nav-link {
    flex: 0 0 auto;
    white-space: nowrap;
    text-decoration: none;
    font-size: clamp(12px, 3.2vw, 15px);
    line-height: 1;
    padding: clamp(6px, 1.2vw, 10px) clamp(10px, 2vw, 14px);
    border-radius: 999px;
    color: var(--text);
    transition: background 0.25s ease, outline 0.25s ease;
  }
  .nav-link:hover, .nav-link.active {
    outline: 1px solid var(--accent);
    background: transparent;
  }
}

/* extra small phones */
@media (max-width: 420px) {
  .navbar {
    width: clamp(260px, 94vw, 620px);
    gap: clamp(2px, 0.8vw, 6px);
    padding: 6px 6px;
    flex-wrap: wrap;
    justify-content: center;
  }
  .nav-link {
    font-size: clamp(10px, 3.2vw, 13px);
    padding: 5px 6px;
  }
}

/* Navbar responsive labels: show short text on small phones */
.nav-short { display: none; }
@media (max-width: 420px) {
  .nav-full { display: none; }
  .nav-short { display: inline; }
}

/* iOS blur fix */
@supports (-webkit-touch-callout: none) {
  @media (max-width: 980px) {
    .navbar { -webkit-backdrop-filter: blur(10px); display: flex !important; }
  }
}

/* mobile theme toggle placement */
@media (max-width: 980px) {
  .theme-toggle {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom));
    left: calc(24px + env(safe-area-inset-left));
    top: auto;
    right: auto;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--nav);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    color: var(--text);
    display: grid;
    place-items: center;
    cursor: pointer;
    z-index: 2147483000;
    transition: all 0.25s ease;
  }
  .theme-toggle:hover {
    color: var(--accent);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
  }
}

/* mobile: lang toggle bottom-right */
@media (max-width: 980px) {
  .lang-toggle {
    position: fixed;
    bottom: calc(24px + env(safe-area-inset-bottom));
    right: calc(24px + env(safe-area-inset-right));
    top: auto;
    height: 38px;
    padding: 0 12px;
    font-size: .8rem;
  }
}

/* visibility after boot */
.theme-toggle, .topbar, .sidebar, .lang-toggle { opacity: 1; transition: opacity .25s ease, transform .25s ease; }
body.boot-lock .theme-toggle, body.boot-lock .topbar, body.boot-lock .sidebar, body.boot-lock .lang-toggle { opacity: 0; pointer-events: none; transform: translateY(4px); }


/* ===== Footer ===== */
.site-footer {
  background-color: var(--surface);
  border-top: 1px solid var(--border);
  padding: 28px 0 22px 0;
}
.site-footer .container { position: relative; z-index: 1; }
.footer-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr auto;
  align-items: start;
  gap: 24px;
  padding-bottom: 14px;
}
.footer-title { color: var(--text); font-weight: 600; letter-spacing: .2px; }
.footer-sub { color: var(--muted); margin: 6px 0 0 0; font-size: .95rem; }
.footer-nav { display: flex; flex-wrap: wrap; gap: 10px 14px; }
.footer-link {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  padding-bottom: 2px;
  transition: color .2s ease, border-color .2s ease, transform .15s ease;
}
.footer-link:hover, .footer-link:focus-visible {
  color: var(--text);
  border-color: var(--divider);
}
.footer-social { display: flex; justify-content: flex-end; gap: 10px; }
.footer-ico {
  width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 999px; color: var(--text);
  background: rgba(255,255,255,.06); border: 1px solid var(--border);
  text-decoration: none;
  transition: transform .15s ease, background .2s ease, border-color .2s ease;
}
.footer-ico:hover, .footer-ico:focus-visible {
  transform: translateY(-1px);
  background: rgba(255,255,255,.09);
  border-color: var(--divider);
}
.footer-bottom {
  display: flex; gap: 16px; align-items: center; justify-content: space-between;
  padding-top: 16px; border-top: 1px dashed var(--divider);
}
.footer-copy { margin: 0; color: var(--muted); font-size: .95rem; }
.to-top {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  border: 1px solid var(--border);
  background: var(--nav); color: var(--text);
  border-radius: 999px; width: 38px; height: 38px; line-height: 1;
  display: grid; place-items: center; cursor: pointer;
  transition: transform .15s ease, background .2s ease, border-color .2s ease, opacity .2s ease;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.to-top:hover, .to-top:focus-visible {
  transform: translateY(-1px);
  background: rgba(255,255,255,.08);
  border-color: var(--divider);
}
[data-theme="light"] .footer-ico {
  background: rgba(0,0,0,.05);
  border-color: rgba(0,0,0,.08);
}
[data-theme="light"] .to-top { background: rgba(0,0,0,.06); }
@media (max-width: 980px) {
  .footer-grid { grid-template-columns: 1fr; gap: 12px; }
  .footer-social { justify-content: flex-start; }
  .footer-bottom { flex-direction: row; }
}
@media (max-width: 520px) {
  .footer-bottom { flex-direction: column; align-items: flex-start; gap: 10px; }
}

/* ===== Contact bubbles ===== */
#contact .container { position: relative; z-index: 1; }
#contact .bubbles {
  position: absolute; top: 0; right: 0; bottom: 0; left: 0; pointer-events: none; z-index: 0; overflow: hidden;
}
#contact .bubble {
  position: absolute; bottom: -40px; left: var(--x, 50%);
  width: var(--size, 10px); height: var(--size, 10px); border-radius: 50%;
  border: 1px solid rgba(210, 148, 74, .18);
  background: radial-gradient(circle at 30% 30%,
    rgba(210, 148, 74, .25),
    rgba(210, 148, 74, .08) 55%,
    rgba(210, 148, 74, 0) 70%);
  opacity: .55; filter: blur(.2px);
  will-change: transform, opacity;
  animation: bubble-rise var(--dur, 12s) linear forwards;
}
@keyframes bubble-rise {
  0%   { transform: translateY(0); opacity: 0; }
  8%   { opacity: .45; }
  100% { transform: translateY(-110%); opacity: 0; }
}
[data-theme="light"] #contact .bubble {
  border-color: rgba(180, 122, 43, .16);
  background: radial-gradient(circle at 30% 30%,
    rgba(180, 122, 43, .22),
    rgba(180, 122, 43, .06) 55%,
    rgba(180, 122, 43, 0) 70%);
}


/* Work grid — responsive */
@media (max-width: 980px) {
  #work .work-grid,
  .work-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 640px) {
  #work .work-grid,
  .work-grid {
    grid-template-columns: 1fr;
    padding: 0;
  }

  #work .work-item,
  .work-item {
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
  }
}

/* ===== Light theme: floating dots ===== */
[data-theme="light"] .hero::before {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(2px 2px at 12% 28%, rgba(180, 122, 43, .12), transparent),
    radial-gradient(3px 3px at 85% 15%, rgba(180, 122, 43, .08), transparent),
    radial-gradient(2px 2px at 42% 72%, rgba(180, 122, 43, .10), transparent),
    radial-gradient(3px 3px at 68% 48%, rgba(180, 122, 43, .06), transparent),
    radial-gradient(2px 2px at 25% 88%, rgba(180, 122, 43, .09), transparent),
    radial-gradient(2px 2px at 90% 65%, rgba(180, 122, 43, .07), transparent);
  animation: floatDots 20s ease-in-out infinite alternate;
}
@keyframes floatDots {
  0%   { transform: translate(0, 0); }
  50%  { transform: translate(-8px, 6px); }
  100% { transform: translate(4px, -4px); }
}

/* ===== Light theme: organic blob shapes ===== */
[data-theme="light"] .hero .container::before {
  content: "";
  position: absolute;
  top: -80px;
  right: -120px;
  width: 400px;
  height: 400px;
  background: radial-gradient(ellipse at 50% 50%, rgba(180, 122, 43, .06), transparent 65%);
  border-radius: 40% 60% 55% 45% / 50% 40% 60% 50%;
  pointer-events: none;
  z-index: -1;
  animation: blobMorph 16s ease-in-out infinite alternate;
}
[data-theme="light"] .hero .container::after {
  content: "";
  position: absolute;
  bottom: -60px;
  left: -100px;
  width: 320px;
  height: 320px;
  background: radial-gradient(ellipse at 50% 50%, rgba(210, 168, 100, .08), transparent 65%);
  border-radius: 55% 45% 50% 50% / 40% 55% 45% 60%;
  pointer-events: none;
  z-index: -1;
  animation: blobMorph 18s ease-in-out infinite alternate-reverse;
}
@keyframes blobMorph {
  0%   { border-radius: 40% 60% 55% 45% / 50% 40% 60% 50%; transform: scale(1) rotate(0deg); }
  33%  { border-radius: 55% 45% 40% 60% / 45% 55% 50% 50%; transform: scale(1.04) rotate(3deg); }
  66%  { border-radius: 48% 52% 60% 40% / 55% 45% 48% 52%; transform: scale(.97) rotate(-2deg); }
  100% { border-radius: 42% 58% 50% 50% / 50% 42% 58% 50%; transform: scale(1.02) rotate(1deg); }
}

/* ===== Dark theme: subtle data particles ===== */
.hero::before {
  content: "";
  position: absolute;
  top: 0; right: 0; bottom: 0; left: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(210, 148, 74, .15), transparent),
    radial-gradient(1px 1px at 70% 20%, rgba(210, 148, 74, .10), transparent),
    radial-gradient(1px 1px at 45% 65%, rgba(210, 148, 74, .12), transparent),
    radial-gradient(1px 1px at 80% 75%, rgba(210, 148, 74, .08), transparent),
    radial-gradient(1px 1px at 15% 80%, rgba(210, 148, 74, .10), transparent),
    radial-gradient(1px 1px at 55% 10%, rgba(210, 148, 74, .06), transparent),
    radial-gradient(1px 1px at 35% 45%, rgba(210, 148, 74, .09), transparent),
    radial-gradient(1px 1px at 90% 40%, rgba(210, 148, 74, .07), transparent);
  animation: dataFlicker 12s ease-in-out infinite alternate;
}
@keyframes dataFlicker {
  0%   { opacity: .6; }
  50%  { opacity: 1; }
  100% { opacity: .7; }
}

/* ===== Skill tile hover glow ===== */
.skill-tile:hover {
  box-shadow: 0 0 16px var(--accent-glow);
}

/* ===== Stat pill hover glow ===== */
.stat-pill:hover {
  box-shadow: 0 0 12px var(--accent-glow);
}

/* ===== Category accent colors ===== */
.st-sys { --cat: #60A5FA; }
.st-net { --cat: #34D399; }
.st-cld { --cat: #F472B6; }
.st-dev { --cat: #F59E0B; }
.st-svc { --cat: #8B5CF6; }
.st-aut { --cat: #FACC15; }

/* ============================================================
   Skills — Card grid
   ============================================================ */
.sk-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--cat); box-shadow: 0 0 6px var(--cat);
  flex-shrink: 0;
}
.sk-cardgrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  max-width: 960px;
  margin: 0 auto;
}
.sk-card {
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: border-color .25s, box-shadow .25s;
}
.sk-card:hover {
  border-color: var(--cat);
  box-shadow: 0 0 20px rgba(128, 128, 128, .10);
  box-shadow: 0 0 20px color-mix(in srgb, var(--cat) 10%, transparent);
}
.sk-card h4 {
  display: flex; align-items: center; gap: 8px;
  font-size: .9rem; font-weight: 700; color: var(--cat);
  margin: 0 0 12px;
}
.sk-card h4 small {
  font-weight: 400; font-size: .68rem; color: var(--muted); font-style: italic; margin-left: auto;
}
.sk-card ul {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.sk-card li {
  display: flex; align-items: center; gap: 8px;
  font-size: .8rem;
}
.sk-card li strong { color: var(--text); min-width: 75px; }
.sk-card li span { color: var(--muted); font-size: .72rem; }

/* -- responsive -- */
@media (max-width: 700px) {
  .sk-cardgrid { grid-template-columns: 1fr; }
  .sk-tab-grid { grid-template-columns: 1fr; }
}
