:root {
  --bg: #0a0f1f;
  --bg-soft: #111630;
  --text: #e6e8ef;
  --text-dim: #b8bfd6;
  --card: #121935;
  --accent: #5eead4;   /* teal accent */
  --accent-2: #a78bfa; /* soft purple */
  --rm-green-1: #32ff7e;
  --rm-green-2: #22ff66;
  --rm-green-3: #12f256;
  --rm-green-4: #7dffb3;
  --border: #1e2647;
  --shadow: 0 10px 30px rgba(0,0,0,.25);
}

:root[data-theme="light"] {
  --bg: #f7fafc;
  --bg-soft: #ffffff;
  --text: #12131a;
  --text-dim: #4b5563;
  --card: #ffffff;
  --accent: #0ea5e9;
  --accent-2: #7c3aed;
  --border: #e5e7eb;
  --shadow: 0 10px 24px rgba(17,24,39,.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

/* Accessibility */
.skip-link {
  position: absolute; left: -999px; top: auto; width: 1px; height: 1px; overflow: hidden;
}
.skip-link:focus { position: static; width: auto; height: auto; padding: .5rem 1rem; background: var(--accent); color: #000; }

.container { width: min(1080px, 92%); margin: 0 auto; }

.site-header {
  background:
    radial-gradient(80% 80% at 20% 0%, rgba(79,70,229,.25), transparent 60%),
    radial-gradient(60% 80% at 100% 0%, rgba(14,165,233,.16), transparent 60%),
    linear-gradient(180deg, rgba(10,15,31,1) 0%, rgba(10,15,31,0) 60%);
  border-bottom: 1px solid var(--border);
}

.nav { display: flex; align-items: center; justify-content: space-between; padding: 1rem 0; }
.brand { font-weight: 800; letter-spacing: .5px; text-decoration: none; color: var(--text); }
.brand span { color: var(--accent); }
.menu { list-style: none; display: flex; gap: 1rem; margin: 0; padding: 0; }
.menu a { color: var(--text-dim); text-decoration: none; padding: .5rem .75rem; border-radius: .5rem; }
.menu a:hover { color: var(--text); background: rgba(255,255,255,.06); }
.nav-toggle { display: none; background: none; border: 1px solid var(--border); color: var(--text); padding: .5rem .75rem; border-radius: .5rem; }

/* Hero */
.hero { display: grid; grid-template-columns: 1.2fr .8fr; gap: 2rem; padding: 4rem 0 3rem; position: relative; isolation: isolate; }
.hero-text h1 { font-size: clamp(2rem, 2.5vw + 1rem, 3rem); line-height: 1.15; margin: 0 0 1rem; }
.lead { color: var(--text-dim); max-width: 65ch; }
.gradient-text { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.cta { display: flex; gap: .75rem; margin-top: 1.25rem; }

.hero-art { position: relative; min-height: 260px; }
.orb { position: absolute; border-radius: 50%; filter: blur(40px); opacity: .75; }
.orb-1 { width: 220px; height: 220px; background: #6366f1; top: 20%; left: 5%; }
.orb-2 { width: 160px; height: 160px; background: #22d3ee; top: 50%; right: 5%; }
.orb-3 { width: 120px; height: 120px; background: #a78bfa; bottom: 0; left: 35%; }

/* Sections */
.section { padding: 3rem 0; }
.section-head h2 { margin: 0 0 .25rem; font-size: 1.75rem; }
.section-head p { margin: 0; color: var(--text-dim); }

.about-grid { display: grid; gap: 1rem; margin-top: 1.5rem; grid-template-columns: repeat(3, minmax(0,1fr)); }
.about-card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 1.25rem; box-shadow: var(--shadow); }

/* What I Do cards */
.projects-grid { margin-top: 1.5rem; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 1rem; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 1.25rem; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: .75rem; }
.card h3 { margin: 0; }
.card p { margin: 0; color: var(--text-dim); }
.card .meta { list-style: none; display: flex; flex-wrap: wrap; gap: .5rem; padding: 0; margin: .25rem 0 0; }
.card .meta li { font-size: .85rem; padding: .2rem .5rem; border: 1px solid var(--border); border-radius: 999px; }

/* Skills */
.skills { display: flex; flex-wrap: wrap; gap: .6rem; margin: 1.5rem 0 0; padding: 0; list-style: none; }
.skills li { background: var(--card); border: 1px solid var(--border); border-radius: 999px; padding: .5rem .75rem; box-shadow: var(--shadow); }
.skills span { color: var(--text); font-weight: 600; }

/* Misc */
.contact { display: flex; align-items: center; gap: 1rem; margin-top: 1.5rem; }
.socials a { color: var(--text-dim); margin-right: .75rem; text-decoration: none; }
.socials a:hover { color: var(--text); }
.btn { border: 1px solid var(--border); border-radius: 10px; padding: .6rem 1rem; text-decoration: none; color: var(--text); display: inline-block; }
.btn:hover { background: rgba(255,255,255,.06); }
.btn-primary { background: linear-gradient(90deg, var(--accent), var(--accent-2)); color: #0b1020; border: none; font-weight: 700; }
.btn-ghost { background: transparent; }

.site-footer { border-top: 1px solid var(--border); background: var(--bg-soft); }
.footer-inner { display: flex; align-items: center; justify-content: space-between; padding: 1rem 0; }
.theme-toggle { background: transparent; border: 1px solid var(--border); color: var(--text); padding: .5rem .75rem; border-radius: .5rem; cursor: pointer; }

/* ——— Portal Easter egg (hidden by default) ——— */
#portalEgg[hidden] { display: none !important; }
#portalEgg {
  position: fixed; inset: 0; z-index: 9999;
  display: grid; place-items: center;
  background: #000; /* starfield is drawn on canvas */
}
.stars { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

/* Wrap to center the portal and allow ellipse shape */
.rm-wrap {
  position: relative; width: min(76vmin, 620px); aspect-ratio: 5/7;
  display: grid; place-items: center;
  filter: saturate(1.2);
}

/* PORTAL BODY (ellipse) */
.rm-portal { position: relative; width: 100%; height: 100%; transform: rotate(-2deg); }

/* 1) outer glowing rim (irregular) */
.rm-layer.rim {
  position: absolute; inset: 0;
  border-radius: 50% / 45%;
  background:
    radial-gradient(50% 60% at 50% 50%, rgba(18,242,86,.32), rgba(18,242,86,0) 60%),
    repeating-conic-gradient(from 0deg,
      rgba(50,255,126,.85) 0 6deg, rgba(50,255,126,.55) 6deg 12deg,
      rgba(50,255,126,.85) 12deg 20deg, rgba(50,255,126,.55) 20deg 26deg);
  filter: blur(3px);
  box-shadow:
    0 0 55px rgba(49,255,137,.35),
    inset 0 0 90px rgba(49,255,137,.28);
  animation: rim-wobble 2200ms ease-in-out infinite;
}

/* 2) main swirling mass */
.rm-layer.swirl {
  position: absolute; inset: 8%;
  border-radius: 50% / 45%;
  background:
    conic-gradient(from 0deg,
      var(--rm-green-1), var(--rm-green-2), var(--rm-green-3),
      var(--rm-green-4), var(--rm-green-2), var(--rm-green-1));
  mix-blend-mode: screen;
  filter: blur(6px) contrast(1.05);
  animation: swirl-spin 1600ms linear infinite;
}

/* 3) counter-rotating inner swirl for depth */
.rm-layer.swirl2 {
  position: absolute; inset: 14%;
  border-radius: 50% / 45%;
  background:
    conic-gradient(from 180deg,
      var(--rm-green-2), var(--rm-green-3), var(--rm-green-1),
      var(--rm-green-4), var(--rm-green-3), var(--rm-green-2));
  mix-blend-mode: screen;
  filter: blur(10px) brightness(1.05);
  animation: swirl-spin 2400ms linear infinite reverse;
}

/* 4) little white specks inside the portal */
.rm-layer.specks {
  position: absolute; inset: 0; border-radius: 50% / 45%;
  background:
    radial-gradient(circle at 20% 30%, rgba(255,255,255,.8) 0 1px, transparent 2px),
    radial-gradient(circle at 70% 60%, rgba(255,255,255,.75) 0 1px, transparent 2px),
    radial-gradient(circle at 40% 80%, rgba(255,255,255,.8) 0 1px, transparent 2px),
    radial-gradient(circle at 60% 25%, rgba(255,255,255,.7) 0 1px, transparent 2px),
    radial-gradient(circle at 80% 50%, rgba(255,255,255,.75) 0 1px, transparent 2px);
  filter: blur(.3px);
  animation: speck-drift 3200ms ease-in-out infinite;
}

/* click target (invisible core) */
.rm-core {
  position: absolute; z-index: 3; inset: 28% 26%;
  border-radius: 50% / 45%;
  border: none; background: radial-gradient(closest-side, rgba(0,0,0,.35), rgba(0,0,0,.05) 60%, rgba(0,0,0,0) 61%);
  cursor: pointer;
  box-shadow:
    inset 0 0 60px rgba(0,0,0,.35),
    0 0 90px rgba(49,255,137,.25);
}
.rm-core:focus { outline: 2px solid rgba(163,255,106,.6); outline-offset: 4px; }

/* Animations */
@keyframes swirl-spin { to { transform: rotate(360deg); } }
@keyframes rim-wobble {
  0%,100% { transform: scale(1); filter: blur(3px); }
  50% { transform: scale(1.02); filter: blur(3.6px); }
}
@keyframes speck-drift {
  0%,100% { transform: translate(0,0) scale(1); opacity: .9; }
  50%     { transform: translate(1px,-1px) scale(1.02); opacity: 1; }
}

/* Reduced motion: gentle pulse only */
@media (prefers-reduced-motion: reduce) {
  .rm-layer.swirl, .rm-layer.swirl2 { animation: none; }
  .rm-layer.rim { animation: rim-wobble 3000ms ease-in-out infinite; }
}

/* Responsive */
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; }
  .hero-art { order: -1; height: 200px; margin-bottom: .5rem; }
  .projects-grid, .about-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .menu { display: none; }
  .menu.open { display: flex; flex-direction: column; gap: .5rem; position: absolute; right: 4%; top: 64px; background: var(--bg-soft); border: 1px solid var(--border); padding: .75rem; border-radius: .75rem; }
  .nav-toggle { display: inline-block; }
  .projects-grid, .about-grid { grid-template-columns: 1fr; }
}
