/* ==========================================================================
   Raushan Raj — Portfolio
   ========================================================================== */

/* ---------- Tokens ---------- */
:root {
  --bg: #f7f7fb;
  --bg-alt: #eeeef6;
  --surface: #ffffff;
  --text: #14141f;
  --muted: #5b5b70;
  --border: #e2e2ec;
  --accent: #5b4cf0;
  --accent-2: #0ea5c6;
  --accent-soft: rgba(91, 76, 240, .1);
  --success: #16a34a;
  --shadow: 0 1px 2px rgba(20, 20, 40, .04), 0 8px 24px rgba(20, 20, 40, .06);
  --shadow-lg: 0 20px 50px rgba(40, 30, 120, .16);
  --header-bg: rgba(247, 247, 251, .75);

  --radius: 18px;
  --radius-sm: 10px;
  --container: 1120px;
  --gutter: clamp(16px, 4vw, 32px);
  --header-h: 68px;
  --tabbar-h: 0px;

  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", var(--font);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b0b12;
    --bg-alt: #11111b;
    --surface: #161622;
    --text: #ececf4;
    --muted: #9d9db3;
    --border: #262636;
    --accent: #8b7dff;
    --accent-2: #38c6e6;
    --accent-soft: rgba(139, 125, 255, .14);
    --success: #4ade80;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    --shadow-lg: 0 20px 50px rgba(0, 0, 0, .5);
    --header-bg: rgba(11, 11, 18, .7);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b0b12;
  --bg-alt: #11111b;
  --surface: #161622;
  --text: #ececf4;
  --muted: #9d9db3;
  --border: #262636;
  --accent: #8b7dff;
  --accent-2: #38c6e6;
  --accent-soft: rgba(139, 125, 255, .14);
  --success: #4ade80;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .5);
  --header-bg: rgba(11, 11, 18, .7);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 8px); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  padding-bottom: var(--tabbar-h);
  transition: background-color .3s, color .3s;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
p { margin: 0 0 1em; }
h1, h2, h3 { font-family: var(--font-display); line-height: 1.15; margin: 0; letter-spacing: -.02em; }
ul, ol { margin: 0; padding: 0; list-style: none; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: var(--gutter); }
.muted { color: var(--muted); }
.i { width: 1.15em; height: 1.15em; flex: none; }
.gradient-text {
  background: linear-gradient(100deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 100;
  background: var(--accent); color: #fff; padding: 8px 14px; border-radius: 8px;
}
.skip-link:focus { top: 12px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 48px; padding: 0 22px; border-radius: 999px;
  font-weight: 600; font-size: 15px; border: 1px solid transparent;
  transition: transform .2s, box-shadow .2s, background-color .2s, border-color .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }
.btn--primary {
  color: #fff;
  background: linear-gradient(100deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--accent-2)));
  box-shadow: 0 8px 20px -6px color-mix(in srgb, var(--accent) 60%, transparent);
}
.btn--primary:hover { transform: translateY(-2px); box-shadow: 0 12px 26px -6px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn--ghost { border-color: var(--border); background: var(--surface); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn--sm { min-height: 38px; padding: 0 16px; font-size: 14px; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  cursor: pointer; transition: color .2s, border-color .2s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent); }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}

/* ---------- Header ---------- */
.header {
  position: fixed; inset: 0 0 auto; z-index: 50;
  height: calc(var(--header-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  transition: background-color .3s, border-color .3s;
  border-bottom: 1px solid transparent;
}
.header.is-scrolled {
  background: var(--header-bg);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom-color: var(--border);
}
.header__inner { height: var(--header-h); display: flex; align-items: center; gap: 24px; }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; }
.brand__mark {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 12px;
  color: #fff; font-size: 14px; letter-spacing: .02em;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.brand__name { font-size: 17px; }
.nav { display: flex; gap: 4px; margin-left: auto; }
.nav a {
  position: relative; padding: 8px 14px; border-radius: 999px;
  font-size: 14.5px; font-weight: 500; color: var(--muted); transition: color .2s, background-color .2s;
}
.nav a:hover { color: var(--text); }
.nav a.is-active { color: var(--accent); background: var(--accent-soft); }
.header__actions { display: flex; align-items: center; gap: 10px; }

/* ---------- Hero ---------- */
.hero {
  position: relative; overflow: hidden;
  min-height: min(100vh, 960px); min-height: min(100svh, 960px);
  display: flex; align-items: center;
  padding: calc(var(--header-h) + env(safe-area-inset-top) + 40px) 0 72px;
}
.hero::before, .hero::after {
  content: ""; position: absolute; border-radius: 50%; filter: blur(80px); opacity: .45; z-index: -1; pointer-events: none;
}
.hero::before { width: 520px; height: 520px; background: var(--accent); top: -160px; right: -120px; }
.hero::after { width: 420px; height: 420px; background: var(--accent-2); bottom: -180px; left: -140px; opacity: .25; }
.hero__grid { display: grid; grid-template-columns: 1.2fr .8fr; align-items: center; column-gap: clamp(32px, 6vw, 80px); row-gap: 28px; }
.badge {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 8px 16px; border-radius: 16px; font-size: 13.5px; font-weight: 500; line-height: 1.5; text-align: left;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
}
.flag { display: inline-block; width: 1.5em; height: 1em; vertical-align: -.15em; margin-left: 2px; border-radius: 2px; box-shadow: 0 0 0 1px rgba(0,0,0,.12); }
.badge { grid-column: 1 / -1; justify-self: start; margin: 0; font-size: 14.5px; }
.badge .hl { font-family: var(--font-display); font-weight: 700; }
.badge .at { color: var(--text); }
@media (min-width: 1100px) { .badge { white-space: nowrap; } }
.badge__dot { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 0 var(--success); animation: pulse 2s infinite; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.hero__title { font-size: clamp(2.5rem, 7vw, 4.6rem); }
.hero__title .gradient-text { white-space: nowrap; }
.hero__aka { margin: 10px 0 0; color: var(--muted); font-size: 1.05rem; }
.hero__role { margin: 22px 0 32px; font-size: clamp(1.15rem, 2.4vw, 1.5rem); font-weight: 500; min-height: 1.6em; }
.hero__role-label { color: var(--muted); }
.typed { color: var(--text); font-weight: 600; }
.typed::after { content: ""; display: inline-block; width: 2px; height: 1.05em; margin-left: 3px; vertical-align: -.15em; background: var(--accent); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; }
.socials { display: flex; gap: 10px; margin-top: 32px; }
.socials a {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border); color: var(--muted);
  transition: color .2s, border-color .2s, transform .2s;
}
.socials a:hover { color: var(--accent); border-color: var(--accent); transform: translateY(-3px); }
.socials--sm { margin: 0; }
.socials--sm a { width: 38px; height: 38px; }

.hero__media { display: flex; justify-content: center; }
.portrait {
  position: relative; width: min(100%, 380px); aspect-ratio: 4 / 5;
  border-radius: 28px; padding: 6px;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  box-shadow: var(--shadow-lg);
  transform: rotate(2deg);
  transition: transform .4s;
}
.portrait:hover { transform: rotate(0); }
.portrait img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 15%; border-radius: 22px; }

/* ---------- Sections ---------- */
.section { padding: clamp(64px, 10vw, 112px) 0; }
.section--alt { background: var(--bg-alt); }
.section__head { margin-bottom: clamp(32px, 5vw, 52px); max-width: 680px; }
.eyebrow {
  margin: 0 0 10px; font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--accent);
}
.section__title { font-size: clamp(1.75rem, 4vw, 2.6rem); }

/* ---------- Cards ---------- */
.card {
  position: relative; display: block;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: clamp(20px, 3vw, 28px); box-shadow: var(--shadow);
  transition: transform .25s, border-color .25s, box-shadow .25s;
}
.card p { color: var(--muted); margin: 0; }
.card__meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.date { font-size: 13.5px; font-weight: 500; color: var(--muted); }
.card__title { font-size: 1.2rem; margin-bottom: 8px; }
.org { color: var(--accent); font-weight: 600; }
.tag { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; }
.tag--live { color: var(--success); background: color-mix(in srgb, var(--success) 14%, transparent); }
.card--icon { display: flex; gap: 18px; align-items: flex-start; }
.card__icon {
  display: grid; place-items: center; flex: none; width: 46px; height: 46px; border-radius: 14px;
  color: var(--accent); background: var(--accent-soft);
}
.card__icon .i { width: 22px; height: 22px; }

.grid { display: grid; gap: clamp(16px, 2.5vw, 24px); }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Projects */
.project { display: flex; flex-direction: column; }
.project:hover { transform: translateY(-4px); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); box-shadow: var(--shadow-lg); }
.project p { flex: 1; }
.project__arrow { color: var(--muted); transition: transform .25s, color .25s; }
.project:hover .project__arrow { color: var(--accent); transform: translate(3px, -3px); }
.project:hover .card__title { color: var(--accent); }
.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.tags li { font-size: 12.5px; font-weight: 500; padding: 4px 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(28px, 5vw, 64px); align-items: start; }
.about__bio p { font-size: 1.075rem; color: var(--muted); }
.about__bio strong { color: var(--text); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.chips li {
  padding: 8px 16px; border-radius: 999px; font-size: 14px; font-weight: 600;
  border: 1px dashed color-mix(in srgb, var(--accent) 45%, var(--border)); color: var(--text);
}
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.fact { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; }
.fact--wide { grid-column: 1 / -1; }
.fact dt { font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.fact dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.fact a { color: var(--accent); }

/* ---------- Timeline ---------- */
.timeline { position: relative; display: grid; gap: 20px; padding-left: 32px; }
.timeline::before {
  content: ""; position: absolute; left: 8px; top: 8px; bottom: 8px; width: 2px;
  background: linear-gradient(var(--accent), var(--accent-2), transparent);
}
.timeline__item { position: relative; }
.timeline__item::before {
  content: ""; position: absolute; left: -31px; top: 28px; width: 16px; height: 16px; border-radius: 50%;
  background: var(--bg-alt); border: 3px solid var(--accent);
}
.timeline__item:first-child::before { background: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.timeline .card:hover { transform: translateX(4px); border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }

/* ---------- Contact ---------- */
.contact {
  display: grid; grid-template-columns: 1fr 1fr; gap: clamp(28px, 5vw, 56px); align-items: center;
  padding: clamp(28px, 5vw, 56px); border-radius: 28px;
  background:
    radial-gradient(600px 300px at 0% 0%, var(--accent-soft), transparent 70%),
    radial-gradient(500px 300px at 100% 100%, color-mix(in srgb, var(--accent-2) 12%, transparent), transparent 70%),
    var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow);
}
.contact__intro .section__title { margin-bottom: 14px; }
.contact__intro .muted { margin-bottom: 26px; }
.contact__list { display: grid; gap: 14px; }
.contact__list li {
  display: flex; align-items: center; gap: 16px; padding: 14px 16px;
  border-radius: var(--radius-sm); background: var(--bg); border: 1px solid var(--border);
}
.contact__list li > div { display: flex; flex-direction: column; min-width: 0; }
.contact__list a, .contact__list span:not(.label):not(.card__icon) { font-weight: 600; overflow-wrap: anywhere; }
.contact__list a:hover { color: var(--accent); }
.label { font-size: 12.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }

/* ---------- Footer ---------- */
.footer { border-top: 1px solid var(--border); padding: 28px 0; }
.footer__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.footer p { margin: 0; color: var(--muted); font-size: 14px; }

/* ---------- Back to top ---------- */
.to-top {
  position: fixed; right: 24px; bottom: 24px; z-index: 40;
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%;
  background: var(--accent); color: #fff; box-shadow: var(--shadow-lg);
  opacity: 0; visibility: hidden; transform: translateY(12px); transition: opacity .3s, transform .3s, visibility .3s;
}
.to-top.is-visible { opacity: 1; visibility: visible; transform: none; }

/* ---------- Mobile tab bar ---------- */
.tabbar { display: none; }

/* ---------- Reveal on scroll ---------- */
.js .reveal { opacity: 0; transform: translateY(24px); transition: opacity .7s ease, transform .7s ease; }
.js .reveal.is-visible { opacity: 1; transform: none; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 960px) {
  .nav { display: none; }
  .header__actions { margin-left: auto; }
  .about, .contact { grid-template-columns: 1fr; }
}

/* Phones: app-style layout */
@media (max-width: 720px) {
  :root { --header-h: 58px; --tabbar-h: calc(64px + env(safe-area-inset-bottom)); }
  .hero__grid { grid-template-columns: 1fr; }
  .hero__media { order: -1; }
  .portrait { width: min(62vw, 260px); border-radius: 50%; aspect-ratio: 1; transform: none; }
  .portrait img { border-radius: 50%; object-position: 50% 12%; }
  .badge { display: block; justify-self: center; text-align: center; text-wrap: balance; }
  .badge__dot { display: inline-block; margin-right: 8px; vertical-align: .1em; }
  .brand__name { display: none; }
  .hero { min-height: auto; padding-top: calc(var(--header-h) + env(safe-area-inset-top) + 28px); padding-bottom: 56px; }
  .hero__cta { width: 100%; flex-direction: column; }
  .hero__cta .btn { width: 100%; }
  .grid--2 { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr 1fr; }
  .timeline { padding-left: 24px; }
  .timeline::before { left: 5px; }
  .timeline__item::before { left: -24px; width: 14px; height: 14px; }
  .card--icon { flex-direction: column; gap: 14px; }
  .contact { border-radius: 22px; }
  .contact__intro .btn { width: 100%; }
  .footer__inner { flex-direction: column; text-align: center; }
  .to-top { display: none; }

  .tabbar {
    position: fixed; inset: auto 0 0; z-index: 60;
    display: grid; grid-template-columns: repeat(5, 1fr);
    height: var(--tabbar-h); padding: 6px 6px env(safe-area-inset-bottom);
    background: var(--header-bg);
    -webkit-backdrop-filter: saturate(180%) blur(16px);
    backdrop-filter: saturate(180%) blur(16px);
    border-top: 1px solid var(--border);
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font-size: 11px; font-weight: 600; color: var(--muted); border-radius: 12px;
    -webkit-tap-highlight-color: transparent; transition: color .2s;
  }
  .tabbar .i { width: 22px; height: 22px; transition: transform .2s; }
  .tabbar a.is-active { color: var(--accent); }
  .tabbar a.is-active .i { transform: translateY(-2px); }
}

@media (max-width: 360px) {
  .facts { grid-template-columns: 1fr; }
  .header__cta { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .js .reveal { opacity: 1; transform: none; }
}
