/* ============================================================
   Ravi Varma Sagiraju — portfolio
   Dark, terminal-accented. No external fonts or assets.
   ============================================================ */

:root {
  --bg:        #0a0a0b;
  --bg-soft:   #101013;
  --surface:   #131317;
  --surface-2: #17171c;
  --border:    #242429;
  --border-lit:#33333b;

  --text:      #ececed;
  --text-mid:  #a8a8b3;
  --text-dim:  #6e6e7a;

  --accent:    #34d399;
  --accent-dim:#1f7a5a;
  --accent-glow: rgba(52, 211, 153, .14);
  --amber:     #fbbf24;

  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;

  --wrap: 1120px;
  --r: 14px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Ambient glow behind the hero */
body::before {
  content: "";
  position: fixed;
  top: -25vh; left: 50%;
  width: 120vw; height: 80vh;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, var(--accent-glow), transparent 62%);
  pointer-events: none;
  z-index: 0;
}

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 24px; position: relative; z-index: 1; }

a { color: inherit; text-decoration: none; }

h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.02em; font-weight: 650; }

.muted { color: var(--text-dim); font-weight: 400; }

.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--accent); color: #04150e; padding: 10px 16px; z-index: 100; border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; }

/* ───────────────────────── NAV ───────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(10, 10, 11, .72);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .25s ease, background .25s ease;
}
.nav.scrolled { border-bottom-color: var(--border); background: rgba(10, 10, 11, .9); }

.nav-inner { display: flex; align-items: center; justify-content: space-between; height: 66px; }

.logo { display: inline-flex; align-items: center; gap: 10px; font-family: var(--mono); font-size: 14px; }
.logo-mark {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--border-lit);
  color: var(--accent); font-weight: 700; font-size: 13px;
}
.logo-text { color: var(--text-mid); letter-spacing: .01em; }
.logo:hover .logo-text { color: var(--text); }

.nav-links { display: flex; gap: 4px; }
.nav-links a {
  padding: 8px 13px; border-radius: 8px;
  font-size: 14px; color: var(--text-mid);
  transition: color .18s ease, background .18s ease;
}
.nav-links a:hover { color: var(--text); background: var(--surface); }
.nav-links a.active { color: var(--accent); }

.nav-toggle {
  display: none; flex-direction: column; gap: 5px;
  background: none; border: 0; cursor: pointer; padding: 8px;
}
.nav-toggle span { width: 20px; height: 1.8px; background: var(--text-mid); border-radius: 2px; transition: transform .25s ease, opacity .2s ease; }
.nav-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(6.8px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.nav-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6.8px) rotate(-45deg); }

/* ───────────────────────── HERO ───────────────────────── */
.hero { padding: 88px 0 64px; }

.hero-grid {
  display: grid; grid-template-columns: 1.05fr .95fr;
  gap: 56px; align-items: center;
}

.eyebrow {
  font-family: var(--mono); font-size: 12.5px; letter-spacing: .06em;
  color: var(--accent); text-transform: lowercase; margin: 0 0 20px;
  display: inline-flex; align-items: flex-start; gap: 9px;
}
.eyebrow::before {
  content: ""; flex: 0 0 auto; margin-top: 7px;
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 3px rgba(52,211,153,.16);
  animation: pulse 2.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.hero h1 { font-size: clamp(2.1rem, 5.2vw, 3.5rem); margin-bottom: 22px; }
.grad {
  background: linear-gradient(100deg, var(--accent), #67e8f9 70%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.lede { font-size: 1.05rem; color: var(--text-mid); max-width: 54ch; margin: 0 0 32px; }
.lede strong { color: var(--text); font-weight: 600; }

.cta { display: flex; flex-wrap: wrap; gap: 12px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 19px; border-radius: 10px;
  font-size: 14.5px; font-weight: 550;
  border: 1px solid var(--border-lit);
  transition: transform .18s ease, background .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.btn:hover { transform: translateY(-2px); }
.btn-primary {
  background: var(--accent); color: #04150e; border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(52,211,153,.18);
}
.btn-primary:hover { box-shadow: 0 8px 28px rgba(52,211,153,.28); }
.btn-ghost { background: var(--surface); color: var(--text-mid); }
.btn-ghost:hover { color: var(--text); border-color: var(--border-lit); background: var(--surface-2); }

/* Terminal */
.terminal {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden;
  box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
.term-bar {
  display: flex; align-items: center; gap: 7px;
  padding: 11px 14px; background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.dot { width: 11px; height: 11px; border-radius: 50%; }
.dot-r { background: #ff5f57; } .dot-y { background: #febc2e; } .dot-g { background: #28c840; }
.term-title { margin-left: 10px; font-family: var(--mono); font-size: 11.5px; color: var(--text-dim); }

.term-body {
  margin: 0; padding: 20px; overflow-x: auto;
  font-family: var(--mono); font-size: 12.8px; line-height: 1.85; color: var(--text-mid);
}
.term-body .p { color: var(--accent); }
.term-body .c { color: #67e8f9; }
.term-body .k { color: #c4b5fd; }
.term-body .s { color: var(--accent); }
.term-body .n { color: var(--amber); }
.cursor {
  display: inline-block; width: 8px; height: 15px;
  background: var(--accent); margin-left: 4px; vertical-align: text-bottom;
  animation: blink 1.1s step-end infinite;
}
@keyframes blink { 0%,100% { opacity: 1; } 50% { opacity: 0; } }

/* Stats */
.stats {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 1px; margin-top: 72px;
  background: var(--border); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden;
}
.stat { background: var(--bg-soft); padding: 26px 20px; text-align: center; }
.stat-num {
  display: block; font-family: var(--mono); font-size: clamp(1.55rem, 3.4vw, 2.15rem);
  font-weight: 700; color: var(--accent); letter-spacing: -.02em;
}
.stat-label { display: block; margin-top: 6px; font-size: 12.5px; color: var(--text-dim); letter-spacing: .02em; }

/* ───────────────────────── SECTIONS ───────────────────────── */
.section { padding: 96px 0; }
.section-tight { padding: 24px 0 72px; }

.sec-head { margin-bottom: 44px; max-width: 62ch; }
.sec-kicker {
  display: block; font-family: var(--mono); font-size: 12px;
  color: var(--accent); letter-spacing: .08em; margin-bottom: 12px;
}
.sec-head h2 { font-size: clamp(1.6rem, 3.6vw, 2.3rem); }
.sec-sub { color: var(--text-dim); margin: 14px 0 0; font-size: 15px; }

/* Code card */
.code-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); overflow: hidden; max-width: 720px; margin: 0 auto;
}
.code-head { padding: 10px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.file { font-family: var(--mono); font-size: 11.5px; color: var(--text-dim); }
.code-body {
  margin: 0; padding: 22px; overflow-x: auto;
  font-family: var(--mono); font-size: 12.6px; line-height: 1.8; color: var(--text-mid);
}
.code-body .kw { color: #c4b5fd; }
.code-body .var { color: #67e8f9; }
.code-body .type { color: var(--amber); }
.code-body .s { color: var(--accent); }
.code-body .n { color: var(--amber); }
.code-body .bool { color: #f472b6; }

/* ───────────────────────── TIMELINE ───────────────────────── */
.timeline { display: flex; flex-direction: column; gap: 20px; }

.job {
  display: grid; grid-template-columns: 190px 1fr; gap: 32px;
  padding: 30px; border: 1px solid var(--border); border-radius: var(--r);
  background: linear-gradient(180deg, var(--bg-soft), rgba(19,19,23,.4));
  transition: border-color .25s ease, transform .25s ease;
}
.job:hover { border-color: var(--border-lit); transform: translateY(-2px); }

.job-meta { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.job-date { font-family: var(--mono); font-size: 12.5px; color: var(--text-dim); }
.badge {
  font-family: var(--mono); font-size: 11px; padding: 3px 9px; border-radius: 20px;
  border: 1px solid var(--accent-dim); color: var(--accent); background: rgba(52,211,153,.07);
}

.job-body h3 { font-size: 1.28rem; margin-bottom: 6px; }
.job-org { font-family: var(--mono); font-size: 13px; color: var(--accent); margin: 0 0 14px; }
.job-desc { color: var(--text-mid); margin: 0 0 16px; font-size: 15px; }

/* Scale strip inside a role — the numbers that matter, up front */
.job-scale {
  display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px;
}
.job-scale span {
  font-family: var(--mono); font-size: 12px; color: var(--text-dim);
  padding: 6px 11px; border-radius: 8px;
  background: rgba(52, 211, 153, .05);
  border: 1px solid rgba(52, 211, 153, .16);
}
.job-scale b { color: var(--accent); font-weight: 700; }

.job-points { margin: 0 0 20px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 9px; }
.job-points li { position: relative; padding-left: 20px; color: var(--text-mid); font-size: 14.6px; }
.job-points li::before {
  content: "▹"; position: absolute; left: 0; top: 0; color: var(--accent); font-size: 13px;
}
.job-points strong, .bullets strong { color: var(--text); font-weight: 600; }

.tags { display: flex; flex-wrap: wrap; gap: 7px; }
.tags span {
  font-family: var(--mono); font-size: 11.5px; padding: 4px 10px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text-dim);
}

/* ───────────────────────── CARDS ───────────────────────── */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 20px; }

.card {
  display: flex; flex-direction: column;
  padding: 26px; border: 1px solid var(--border); border-radius: var(--r);
  background: var(--bg-soft);
  transition: border-color .25s ease, transform .25s ease, box-shadow .25s ease;
}
.card:hover {
  border-color: var(--accent-dim); transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(0,0,0,.4);
}
.card-top { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.card h3 { font-size: 1.1rem; }
.award {
  align-self: flex-start; font-family: var(--mono); font-size: 11px;
  color: var(--amber); background: rgba(251,191,36,.08);
  border: 1px solid rgba(251,191,36,.22); padding: 3px 9px; border-radius: 20px;
}
.card > p { color: var(--text-mid); font-size: 14.5px; margin: 0 0 16px; }

.bullets { margin: 0 0 18px; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.bullets li { position: relative; padding-left: 18px; font-size: 14px; color: var(--text-mid); }
.bullets li::before { content: ""; position: absolute; left: 0; top: 9px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent-dim); }

.card .tags { margin-top: auto; }

/* ───────────────────────── SKILLS ───────────────────────── */
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; }
.skill-group { padding: 24px; border: 1px solid var(--border); border-radius: var(--r); background: var(--bg-soft); }
.skill-group h3 { font-size: .82rem; text-transform: uppercase; letter-spacing: .1em; color: var(--text-dim); margin-bottom: 14px; font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips span {
  font-family: var(--mono); font-size: 12.5px; padding: 6px 12px; border-radius: 8px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-mid);
  transition: color .2s ease, border-color .2s ease;
}
.chips span:hover { color: var(--accent); border-color: var(--accent-dim); }

/* ───────────────────────── AWARDS ───────────────────────── */
.awards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.award-card {
  padding: 24px; border: 1px solid var(--border); border-radius: var(--r);
  background: var(--bg-soft); transition: border-color .25s ease;
}
.award-card:hover { border-color: rgba(251,191,36,.3); }
.award-year { font-family: var(--mono); font-size: 12px; color: var(--amber); }
.award-card h3 { font-size: 1.02rem; margin: 8px 0 8px; }
.award-card p { margin: 0 0 14px; font-size: 14px; color: var(--text-mid); }
.award-org { font-family: var(--mono); font-size: 11.5px; color: var(--text-dim); }

/* ───────────────────────── WRITING ───────────────────────── */
.posts { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.post {
  display: flex; flex-direction: column;
  padding: 26px; border: 1px solid var(--border); border-radius: var(--r);
  background: var(--bg-soft);
  transition: border-color .25s ease, transform .25s ease;
}
.post:hover { border-color: var(--accent-dim); transform: translateY(-3px); }
.post-meta { display: flex; gap: 7px; flex-wrap: wrap; margin-bottom: 14px; }
.post-tag {
  font-family: var(--mono); font-size: 11px; padding: 3px 9px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-dim);
}
.post h3 { font-size: 1.12rem; margin-bottom: 10px; }
.post p { color: var(--text-mid); font-size: 14.5px; margin: 0 0 18px; }
.post-foot { margin-top: auto; font-family: var(--mono); font-size: 12px; color: var(--accent); }

/* ───────────────────────── CONTACT ───────────────────────── */
.contact-card {
  text-align: center; padding: 64px 32px;
  border: 1px solid var(--border); border-radius: 20px;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(52,211,153,.09), transparent 65%),
    var(--bg-soft);
}
.contact-card h2 { font-size: clamp(1.6rem, 3.6vw, 2.3rem); margin-bottom: 14px; }
.contact-card > p { color: var(--text-mid); max-width: 50ch; margin: 0 auto 30px; }
.contact-links { display: flex; flex-wrap: wrap; gap: 12px; justify-content: center; }

/* ───────────────────────── FOOTER ───────────────────────── */
.footer { border-top: 1px solid var(--border); padding: 40px 0; margin-top: 40px; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 24px; align-items: center; justify-content: space-between; }
.foot-name { margin: 0; font-weight: 600; font-size: 15px; }
.foot-bio { margin: 4px 0 0; font-size: 13.5px; color: var(--text-dim); }
.foot-links { display: flex; gap: 18px; }
.foot-links a { font-size: 14px; color: var(--text-mid); transition: color .2s ease; }
.foot-links a:hover { color: var(--accent); }
.copy { margin: 0; font-family: var(--mono); font-size: 12px; color: var(--text-dim); }

/* ───────────────────────── REVEAL ANIMATION ───────────────────────── */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ───────────────────────── RESPONSIVE ───────────────────────── */
@media (max-width: 940px) {
  .hero-grid { grid-template-columns: 1fr; gap: 40px; }
  .stats { grid-template-columns: repeat(2, 1fr); margin-top: 48px; }
  .job { grid-template-columns: 1fr; gap: 16px; }
  .job-meta { flex-direction: row; align-items: center; gap: 12px; }
}

@media (max-width: 720px) {
  .nav-toggle { display: flex; }
  .logo-text { display: none; }
  .nav-links {
    position: absolute; top: 66px; left: 0; right: 0;
    flex-direction: column; gap: 0; padding: 8px 16px 16px;
    background: rgba(10,10,11,.97);
    backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
    display: none;
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 12px 8px; font-size: 15px; }

  .hero { padding: 56px 0 40px; }
  .section { padding: 64px 0; }
  .job, .card, .post, .skill-group, .award-card { padding: 22px; }
  .contact-card { padding: 44px 22px; }
  .cta .btn, .contact-links .btn { flex: 1 1 auto; justify-content: center; }
}

@media (max-width: 420px) {
  .stats { grid-template-columns: 1fr; }
}

/* ───────────────────────── A11Y ───────────────────────── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .reveal { opacity: 1; transform: none; }
}

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

::selection { background: var(--accent); color: #04150e; }
