:root {
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
html { scroll-padding-top: calc(env(safe-area-inset-top, 0px) + 84px); scroll-behavior: smooth; }
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { max-width: 100%; }
a { color: var(--accent-text); text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; font-family: var(--display); letter-spacing: -0.02em; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; list-style: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.wrap { width: min(1120px, 100% - 48px); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Background layers */
#bg { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.halo { position: fixed; z-index: 0; pointer-events: none; width: 46vmax; height: 46vmax; border-radius: 50%; background: radial-gradient(circle, var(--glow), transparent 65%); filter: blur(30px); opacity: 0.55; }
.halo-r { right: -24vmax; top: 20vh; }
.halo-l { left: -30vmax; bottom: -10vh; opacity: 0.3; }
main, .site-footer { position: relative; z-index: 1; }

/* Cursor glow (fine pointers only) */
.cursor { position: fixed; z-index: 60; left: 0; top: 0; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 22px 6px var(--glow); pointer-events: none; opacity: 0; transition: opacity .2s; }
.cursor.on { opacity: 0.85; }
@media (pointer: coarse) { .cursor { display: none; } }

/* Header */
.topbar {
  position: fixed; z-index: 50; top: 0; left: 0; right: 0;
  padding-top: env(safe-area-inset-top, 0px);
  background: var(--header-bg);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-row { display: flex; align-items: center; gap: 12px 28px; min-height: 60px; flex-wrap: wrap; padding-block: 8px; }
.logo { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink); text-decoration: none; font: 600 0.95rem var(--display); }
.logo i { width: 8px; height: 8px; border-radius: 50%; background: var(--accent-2); }
.top-mail { color: var(--muted); font-size: 0.92rem; text-decoration: none; margin-right: auto; }
.top-mail:hover { color: var(--ink); }
.nav { display: flex; align-items: center; gap: 2px; overflow-x: auto; max-width: 100%; }
.nav a { color: var(--ink); text-decoration: none; font-weight: 500; font-size: 0.95rem; padding: 8px 12px; border-radius: var(--radius); white-space: nowrap; transition: background .15s, color .15s; }
.nav a:hover { background: var(--panel); color: var(--accent-text); }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); cursor: pointer; transition: transform .1s, background .15s; flex: none; }
.icon-btn:hover { background: var(--bg-2); }
.icon-btn:active { transform: scale(0.96); }

/* Fixed side elements */
.side-social { position: fixed; z-index: 40; left: 22px; bottom: calc(env(safe-area-inset-bottom, 0px) + 24px); display: flex; flex-direction: column; gap: 10px; }
.side-social a { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--ink); text-decoration: none; font: 600 0.8rem var(--display); transition: transform .12s, color .15s, border-color .15s; }
.side-social a:hover { color: var(--accent-text); border-color: var(--accent); transform: scale(1.06); }
.resume-fab { position: fixed; z-index: 40; right: 24px; bottom: calc(env(safe-area-inset-bottom, 0px) + 24px); display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); color: var(--ink); text-decoration: none; font-weight: 600; font-size: 0.95rem; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); transition: transform .1s, border-color .15s; }
.resume-fab:hover { border-color: var(--accent); }
.resume-fab:active { transform: scale(0.98); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 22px; border-radius: var(--radius); font: 600 1rem var(--body); text-decoration: none; border: 1px solid var(--accent); cursor: pointer; transition: transform .1s, filter .15s, background .15s; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-quiet { background: transparent; color: var(--accent-text); }
.btn-quiet:hover { background: var(--accent-soft); }

@media (max-width: 900px) {
  .side-social { display: none; }
  .top-mail { display: none; }
  .topbar-row { justify-content: space-between; }
  .wrap { width: min(1120px, 100% - 36px); }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}
