:root {
  --bg: #ffffff;
  --fg: #111111;
  --muted: #5b5b5b;
  --border: #1a1a1a;
  --pill-bg: #111111;
  --pill-fg: #ffffff;
  --accent: #111111;
  --surface: #f5f5f5;
}

[data-theme="dark"] {
  --bg: #0b0b0b;
  --fg: #f5f5f5;
  --muted: #b5b5b5;
  --border: #2a2a2a;
  --pill-bg: #f5f5f5;
  --pill-fg: #0b0b0b;
  --accent: #f5f5f5;
  --surface: #121212;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, 'Apple Color Emoji', 'Segoe UI Emoji';
  background: var(--bg);
  color: var(--fg);
  line-height: 1.4;
  min-height: 100svh; /* allow mobile chrome UI without clipping */
  display: grid;
  grid-template-rows: auto 1fr auto; /* header, main, footer */
  overflow-y: auto; /* enable natural page scrolling */
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  scrollbar-gutter: stable;
}

/* Animated abstract background lines */
.bg-abstract { position: fixed; inset: 0; z-index: -1; overflow: hidden; opacity: .12; }
.bg-abstract .bg-waves { width: 100%; height: 100%; display: block; color: var(--fg); }
.bg-abstract .wave-layer { transform-origin: 50% 50%; }
.bg-abstract .layer-1 { animation: drift1 24s ease-in-out infinite; }
.bg-abstract .layer-2 { animation: drift2 30s ease-in-out infinite; }
.bg-abstract .layer-3 { animation: drift3 36s ease-in-out infinite; }

@keyframes drift1 { 0%,100% { transform: translateY(-10px) translateX(-16px) scale(1.02); } 50% { transform: translateY(10px) translateX(16px) scale(1.035); } }
@keyframes drift2 { 0%,100% { transform: translateY(12px) translateX(-10px) scale(1.012); } 50% { transform: translateY(-12px) translateX(10px) scale(1.024); } }
@keyframes drift3 { 0%,100% { transform: translateY(-8px) translateX(16px) scale(1.01); } 50% { transform: translateY(8px) translateX(-16px) scale(1.02); } }

@media (prefers-reduced-motion: reduce) {
  .bg-abstract .wave-layer { animation: none; }
}

.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus { left: 1rem; top: 1rem; background: var(--accent); color: var(--pill-fg); padding: .5rem .75rem; border-radius: .5rem; }

.site-header {
  display: flex;
  justify-content: flex-start;
  padding: 16px 24px;
}

.toggle {
  padding: 12px 18px;
  border-radius: 999px;
  background: var(--fg);
  border: 1.5px solid var(--border);
  color: var(--bg);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 10px;
}
.toggle:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

/* Invert button colors in light theme for contrast */
[data-theme="light"] .toggle { background: var(--fg); color: var(--bg); }
[data-theme="dark"] .toggle { background: var(--fg); color: var(--bg); }

/* Icon that switches via CSS (sun/moon) */
.toggle .icon {
  width: 18px; height: 18px; display: inline-block; border-radius: 50%;
  position: relative; background: currentColor;
}
[data-theme="dark"] .toggle .icon { box-shadow: 0 0 0 4px currentColor inset; background: transparent; }
[data-theme="light"] .toggle .icon { background: currentColor; }

/* Slightly larger label */
.toggle .label { font-weight: 600; font-size: 14px; }

.container { max-width: 1200px; margin: 0 auto; padding: 16px 24px 20px; display: grid; align-content: center; justify-items: center; justify-content: center; text-align: center; min-height: 0; }

.hero {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 28px;
  min-height: 0; /* allow the grid to center without forcing height */
}
.hero { justify-items: center; justify-content: center; }

.avatar { display: flex; justify-content: center; }
.avatar-circle {
  width: min(540px, 62vw);
  aspect-ratio: 1 / 1;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--muted);
  overflow: hidden; /* clip zoomed image inside circle */
}
.avatar-circle img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; transform: scale(1); transition: transform .45s ease; }
.avatar-circle:hover img { transform: scale(1.12); }

@media (prefers-reduced-motion: reduce) {
  .avatar-circle img { transition: none; }
}

.intro { text-align: center; }
.title { font-size: clamp(56px, 9vw, 140px); margin: 0; letter-spacing: -0.02em; font-weight: 700; line-height: 0.95; }
.tagline { margin: -2px 0 16px; color: var(--muted); font-size: clamp(14px, 1.5vw, 18px); font-weight: 300; letter-spacing: 0.2px; }

.socials { margin-block: 10%; }
.socials ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: nowrap; gap: 16px; overflow-x: auto; -webkit-overflow-scrolling: touch; justify-content: center; }
.socials ul { scroll-snap-type: x mandatory; scroll-padding-inline: 24px; touch-action: pan-x; }
.socials ul::-webkit-scrollbar { height: 8px; }
.socials ul::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }
.socials li { flex: 0 0 auto; scroll-snap-align: center; }
.pill { display: inline-flex; align-items: center; gap: 10px; padding: 12px 22px; border-radius: 999px; background: linear-gradient(180deg, var(--surface), transparent); color: var(--fg); text-decoration: none; border: 1.5px solid var(--border); position: relative; overflow: hidden; transition: transform .2s ease, box-shadow .2s ease, background-color .2s ease, color .2s ease, border-color .2s ease; box-shadow: 0 1px 0 rgba(255,255,255,.06) inset, 0 8px 18px rgba(0,0,0,.12); --brand: var(--border); }
.pill { min-height: 40px; min-width: 44px; }
.pill:hover { filter: none; transform: translateY(-2px); box-shadow: 0 1px 0 rgba(255,255,255,.08) inset, 0 14px 28px rgba(0,0,0,.18); }
.pill:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
/* subtle highlight layer */
.pill::after { content: ""; position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(135deg, rgba(255,255,255,.10), rgba(255,255,255,0)); pointer-events: none; }
/* brand bead on the left */
.pill::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 3px rgba(0,0,0,.08); }

/* Brand hover colors */
.pill.fb { --brand: #1877F2; }
.pill.ig { --brand: #E1306C; }
.pill.sc { --brand: #FFFC00; }
.pill.tt { --brand: #000000; }
.pill.x { --brand: #ff0000; }
.pill.th { --brand: #000000; }

.pill.fb:hover { background: #000000; color: #ffffff; border-color: #1877F2; }
.pill.ig:hover { background: #000000; color: #ffffff; border-color: #E1306C; }
.pill.sc:hover { background: #000000; color: #ffffff; border-color: #FFFC00; }
.pill.tt:hover { background: #000000; color: #ffffff; border-color: #000000; }
.pill.x:hover { background: #000000; color: #ffffff; border-color: #ff0000; }
.pill.th:hover { background: #000000; color: #ffffff; border-color: #000000; }

.contact { margin-top: 22px; display: grid; justify-items: center; }
.typewriter { font-family: 'Caveat', 'Comic Sans MS', 'Bradley Hand', cursive; text-align: center; color: var(--muted); margin-bottom: 10px; overflow: hidden; white-space: nowrap; border-right: 2px solid var(--muted); width: 0; font-size: clamp(18px, 2.2vw, 28px); animation: typing 2.4s steps(26, end) forwards, caret 1s step-end infinite; }
@keyframes typing { to { width: 26ch; } }
@keyframes caret { 50% { border-color: transparent; } }
.input-label { display: block; color: var(--muted); margin-bottom: 10px; font-size: 16px; }
.email-bar { display: grid; grid-template-columns: auto; gap: 12px; align-items: center; justify-content: center; }
.email-bar input {
  height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--fg);
  font-size: 16px;
}
/* removed collaboration input */
.email-bar .action {
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 22px;
  border-radius: 999px;
  border: 2px solid transparent;
  color: var(--pill-fg);
  background: linear-gradient(var(--pill-bg), var(--pill-bg)) padding-box,
              conic-gradient(from 0deg, #ff2d2d, #ff8a00, #ffd400, #ff2d2d) border-box;
  position: relative;
  transition: transform .22s ease, box-shadow .22s ease, background .4s ease;
  box-shadow: 0 8px 18px rgba(0,0,0,.14);
}
.email-bar .action:hover { transform: translateY(-2px); box-shadow: 0 14px 28px rgba(0,0,0,.2); }
.email-bar .action::before {
  content: "";
  position: absolute;
  top: -50%; left: -30%;
  width: 20%; height: 200%;
  background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,.55) 50%, transparent 100%);
  transform: skewX(-20deg);
  opacity: 0; pointer-events: none;
}
.email-bar .action:hover::before { opacity: 1; animation: sheen 1s linear; }
@keyframes sheen { from { left: -30%; } to { left: 130%; } }

.site-footer { text-align: center; padding: 12px 16px 16px; color: var(--muted); }
.site-footer .footer-link { color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.site-footer .footer-link:hover { color: var(--fg); }

@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 20px; text-align: center; }
  .intro { text-align: center; }
  .email-bar { grid-template-columns: 1fr; }
}

/* Responsive desktop refinements */
@media (min-width: 1024px) {
  .container { padding: 20px 28px 24px; }
  .hero { gap: 36px; }
  .avatar-circle { width: min(560px, 40vw); }
}

@media (min-width: 1280px) {
  .container { padding: 24px 32px 28px; }
  .hero { gap: 44px; }
  .avatar-circle { width: min(600px, 36vw); }
}

@media (min-width: 1536px) {
  .container { max-width: 1400px; }
  .title { font-size: clamp(64px, 6vw, 160px); }
}

/* Small-screen optimizations */
@media (max-width: 640px) {
  .site-header { padding: 12px 16px; }
  .container { padding: 12px 16px 16px; }
  .hero { gap: 16px; }
  .avatar-circle { width: min(320px, 70vw); }
  .title { font-size: clamp(32px, 12vw, 56px); }
  .tagline { font-size: clamp(13px, 3.4vw, 16px); }
  .pill { padding: 10px 16px; font-size: 14px; }
  .socials { margin-block: 6%; }
  .typewriter { max-width: 100%; width: auto; display: inline-block; }
  /* Switch socials to 2x3 grid on phones */
  .socials ul { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 12px; overflow: visible; scroll-snap-type: none; justify-content: center; }
  .socials li { flex: initial; }
  .socials .pill { width: 100%; justify-content: center; }
}

/* Ultra-small phones: ensure first screen fits neatly */
@media (max-width: 380px), (max-height: 700px) {
  .site-header { padding: 10px 12px; }
  .container { padding: 10px 12px 12px; }
  .hero { gap: 12px; }
  .avatar-circle { width: min(240px, 62vw); }
  .title { font-size: clamp(28px, 11.5vw, 44px); }
  .tagline { margin: 0 0 8px; font-size: clamp(12px, 3.2vw, 14px); }
  .socials { margin-block: 4%; }
  .pill { padding: 8px 14px; font-size: 13px; }
  .email-bar .action { height: 40px; padding: 0 16px; }
}

/* Reduce background visuals on phones for clarity and performance */
@media (max-width: 640px) {
  .bg-abstract { opacity: .08; }
}
@media (max-width: 380px) {
  .bg-abstract { display: none; }
}

/* Height-based adjustments to keep content within the viewport */
@media (max-height: 760px) {
  .site-header { padding: 12px 20px; }
  .container { padding: 12px 20px 12px; }
  .hero { gap: 18px; }
  .avatar-circle { width: min(360px, 46vw); }
  .title { font-size: clamp(36px, 6.4vw, 78px); }
  .tagline { margin-bottom: 14px; }
}
@media (max-height: 640px) {
  .avatar-circle { width: min(300px, 40vw); }
  .title { font-size: clamp(32px, 5.6vw, 64px); }
}


