/* ==========================================================
   Kartik Rana · portfolio
   Light, professional, with a soft Aero touch:
   sky-tinted background, frosted cards, gentle gloss.
   ========================================================== */

:root {
  --bg: #f5f9fd;
  --bg-tint: #e8f2fb;
  --surface: #ffffff;
  --surface-2: #f3f7fb;
  --line: #dfe8f1;
  --line-strong: #cbd9e7;

  --ink: #10243e;
  --ink-soft: #33495f;
  --muted: #627891;

  --accent: #1d72c4;
  --accent-hover: #155da3;
  --accent-soft: #e6f1fb;
  --accent-ink: #ffffff;
  --green: #2e9461;
  --green-soft: #e5f4ec;
  --teal: #178a86;
  --teal-soft: #e1f3f2;

  --shadow-sm: 0 1px 2px rgb(16 36 62 / .06);
  --shadow: 0 1px 2px rgb(16 36 62 / .05), 0 8px 24px -12px rgb(16 36 62 / .16);
  --shadow-lg: 0 1px 2px rgb(16 36 62 / .05), 0 18px 40px -20px rgb(16 36 62 / .25);
  --highlight: inset 0 1px 0 rgb(255 255 255 / .9);

  --sans: "Segoe UI", "Hind", "Nunito Sans", system-ui, -apple-system, sans-serif;
  --display: "Nunito Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "Fira Mono", Consolas, ui-monospace, monospace;

  --wrap: 1120px;
  --gutter: clamp(16px, 4vw, 40px);
  --radius: 16px;
  color-scheme: light;
}

/* Dark theme: only when the visitor chooses it with the toggle */
:root[data-theme="dark"] {
  --bg: #0d1726;
  --bg-tint: #102036;
  --surface: #13223a;
  --surface-2: #182a45;
  --line: #22364f;
  --line-strong: #2d4562;
  --ink: #e8f0f8;
  --ink-soft: #bccbdb;
  --muted: #8ba0b7;
  --accent: #5aa9ec;
  --accent-hover: #7cbcf2;
  --accent-soft: #17304d;
  --accent-ink: #08172a;
  --green: #5cc58f;
  --green-soft: #143528;
  --teal: #4cc2bd;
  --teal-soft: #123433;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .3);
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 10px 28px -14px rgb(0 0 0 / .6);
  --shadow-lg: 0 1px 2px rgb(0 0 0 / .3), 0 20px 44px -20px rgb(0 0 0 / .7);
  --highlight: inset 0 1px 0 rgb(255 255 255 / .05);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background:
    linear-gradient(180deg, var(--bg-tint) 0, var(--bg) 640px) no-repeat,
    var(--bg);
  color: var(--ink);
  font: 400 16.5px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; }
p { margin: 0 0 1em; }
.mono { font-family: var(--mono); }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

.wrap {
  width: 100%;
  max-width: calc(var(--wrap) + var(--gutter) * 2);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.skip-link {
  position: absolute; left: 12px; top: -48px; z-index: 100;
  background: var(--accent); color: #fff;
  padding: 8px 14px; border-radius: 8px; text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* ---------- Card ("glass": frosted white with a soft top highlight) ---------- */
.glass {
  position: relative;
  background: linear-gradient(180deg, var(--surface) 0%, color-mix(in srgb, var(--surface) 92%, var(--bg-tint)) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--highlight), var(--shadow);
}

.eyebrow {
  font: 700 12px/1.4 var(--display);
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 12px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }

.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 10px;
  font: 800 12.5px/1 var(--display); color: #fff; letter-spacing: .03em;
  background: linear-gradient(180deg, #4b9be0 0%, var(--accent) 55%, #175fa6 100%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .35), 0 1px 2px rgb(16 36 62 / .2);
}
.brand-name { font: 800 16px/1 var(--display); letter-spacing: -.01em; }

.nav { display: flex; align-items: center; gap: 2px; }
.nav a:not(.icon-btn) {
  text-decoration: none; font-size: 14.5px; font-weight: 500; color: var(--ink-soft);
  padding: 8px 12px; border-radius: 8px; transition: background .15s, color .15s;
}
.nav a:not(.icon-btn):hover { color: var(--ink); background: var(--accent-soft); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; border-radius: 9px; margin-left: 2px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
  cursor: pointer; transition: border-color .15s, color .15s;
}
.icon-btn:hover { color: var(--accent); border-color: var(--line-strong); }

.i-sun { display: none; }
:root[data-theme="dark"] .i-sun { display: block; }
:root[data-theme="dark"] .i-moon { display: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 10px;
  font: 700 15px/1 var(--display); text-decoration: none;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn-primary {
  color: #fff;
  background: linear-gradient(180deg, #3a8ddb 0%, var(--accent) 100%);
  border-color: #1a68b3;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .25), 0 1px 2px rgb(16 36 62 / .15);
}
.btn-primary:hover { background: linear-gradient(180deg, #2f80cc 0%, var(--accent-hover) 100%); }
:root[data-theme="dark"] .btn-primary { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
:root[data-theme="dark"] .btn-primary:hover { background: var(--accent-hover); }
.btn-ghost {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-lg { padding: 14px 24px; font-size: 16px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 10px; }

.link-arrow {
  font: 700 14px/1.3 var(--display); color: var(--accent);
  text-decoration: none;
}
.link-arrow:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Hero ---------- */
.hero { padding: clamp(48px, 8vw, 96px) 0 clamp(8px, 2vw, 24px); }
.hero-inner {
  display: grid; grid-template-columns: 1.35fr 1fr; gap: clamp(32px, 5vw, 64px);
  align-items: center;
}
.hero-title {
  font: 800 clamp(48px, 7.5vw, 84px)/1 var(--display);
  letter-spacing: -.03em;
  margin: 0 0 20px;
  color: var(--ink);
}
.hero-lede {
  max-width: 46ch;
  font-size: clamp(17px, 1.8vw, 19px);
  line-height: 1.6;
  color: var(--ink-soft);
  margin-bottom: 28px;
}

.hero-card { padding: 24px; }
.hc-head { display: flex; align-items: center; gap: 14px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.hc-avatar {
  display: grid; place-items: center; flex: none;
  width: 52px; height: 52px; border-radius: 50%;
  font: 800 17px/1 var(--display); color: #fff;
  background: linear-gradient(180deg, #5aa7e6 0%, var(--accent) 60%, #175fa6 100%);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .35), 0 0 0 4px var(--accent-soft);
}
.hc-name { margin: 0; font: 800 18px/1.2 var(--display); }
.hc-role { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.hc-facts { margin: 0; display: grid; }
.hc-facts div { padding: 12px 0; border-bottom: 1px solid var(--line); }
.hc-facts dt { font: 700 11px/1.3 var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.hc-facts dd { margin: 3px 0 0; font-size: 15px; font-weight: 500; color: var(--ink); line-height: 1.45; }
.hc-links { display: flex; gap: 18px; padding-top: 14px; }
.hc-links a { font: 700 14px/1 var(--display); color: var(--accent); text-decoration: none; }
.hc-links a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Sections ---------- */
.section { padding: clamp(56px, 8vw, 96px) 0; }
.section + .section { padding-top: 0; }
.section-head { margin-bottom: clamp(28px, 4vw, 44px); }
.section-title {
  font: 800 clamp(32px, 4.4vw, 46px)/1.08 var(--display);
  letter-spacing: -.02em;
  margin: 0;
  color: var(--ink);
}

/* ---------- Projects ---------- */
.project {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: clamp(24px, 4vw, 48px);
  align-items: start;
  margin-bottom: 24px;
  padding: clamp(18px, 3vw, 32px);
}
.project-flip { grid-template-columns: 1fr 1.1fr; }
.project-flip .project-media { order: 2; }

.project-media {
  position: sticky; top: 96px;
  display: block;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}
.project-media img { width: 100%; aspect-ratio: 5 / 3; object-fit: cover; }

.project-meta { font: 700 12px/1.4 var(--display); letter-spacing: .08em; text-transform: uppercase; color: var(--green); margin-bottom: 8px; }
.project-title {
  font: 800 clamp(28px, 3.4vw, 38px)/1.08 var(--display);
  letter-spacing: -.02em;
  margin: 0 0 6px;
}
.project-sub { font-size: 17px; color: var(--muted); margin-bottom: 16px; }
.project-body > p { color: var(--ink-soft); }

.highlights { list-style: none; margin: 18px 0; padding: 0; display: grid; gap: 9px; }
.highlights li {
  position: relative; padding-left: 22px;
  font-size: 15.5px; line-height: 1.55; color: var(--ink-soft);
}
.highlights li::before {
  content: ""; position: absolute; left: 3px; top: .5em;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  margin: 22px 0;
}
.stats div {
  display: flex; flex-direction: column-reverse; justify-content: flex-end;
  padding: 12px 14px; border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}
.stats dt { font-size: 12.5px; line-height: 1.3; color: var(--muted); }
.stats dd { margin: 0 0 2px; font: 800 26px/1 var(--display); color: var(--accent); letter-spacing: -.02em; }

.chips { list-style: none; padding: 0; margin: 0 0 24px; display: flex; flex-wrap: wrap; gap: 7px; }
.chips li {
  font-size: 13px; font-weight: 500; line-height: 1;
  padding: 7px 11px; border-radius: 8px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-soft);
}
.project-links { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------- OrwellBlue illustration (static) ---------- */
.orwell {
  padding: clamp(14px, 2.5vw, 22px);
  background: linear-gradient(160deg, #eaf4fd 0%, #d9eafa 100%);
}
:root[data-theme="dark"] .orwell { background: linear-gradient(160deg, #15304f, #0f2440); }
.ob-window {
  --ob-bg: #0f1c30; --ob-line: #22385a; --ob-ink: #dce8f6; --ob-dim: #8aa2c0;
  border-radius: 10px; overflow: hidden;
  border: 1px solid #b9cfe6;
  background: var(--ob-bg); color: var(--ob-ink);
  font-size: 11.5px;
  box-shadow: 0 14px 30px -16px rgb(16 36 62 / .5);
}
.ob-bar {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 12px;
  background: linear-gradient(180deg, #e9f3fc, #cfe2f4);
  border-bottom: 1px solid #a9c3de;
}
.ob-dot { width: 10px; height: 10px; border-radius: 50%; background: #9db6cf; }
.ob-title { margin-left: 8px; color: #23405f; }
.ob-live { margin-left: auto; color: #1f7a4a; font-size: 10.5px; letter-spacing: .08em; font-weight: 500; }

.ob-grid { display: grid; grid-template-columns: .85fr 1.4fr; }
.ob-fleet { padding: 12px; border-right: 1px solid var(--ob-line); }
.ob-ledger { padding: 12px; min-width: 0; }
.ob-label { margin: 0 0 8px; color: var(--ob-dim); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
.ob-agents, .ob-events { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.ob-agents li { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.ob-agents em { margin-left: auto; font-style: normal; color: var(--ob-dim); font-size: 10.5px; }
.ob-agents span { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.ob-agents .ok { background: #4cc488; }
.ob-agents .warn { background: #e8b13c; }
.ob-agents .bad { background: #ef6a55; }
.ob-events li { display: flex; gap: 8px; white-space: nowrap; overflow: hidden; }
.ob-events b { font-weight: 400; color: var(--ob-dim); }
.ob-events i { margin-left: auto; font-style: normal; padding-left: 8px; }
.ob-events .ok { color: #4cc488; }
.ob-events .warn { color: #e8b13c; }
.ob-events .bad { color: #ef6a55; }
.ob-alert {
  margin: 0 12px 12px; padding: 9px 11px; border-radius: 7px;
  background: rgb(239 106 85 / .12); border: 1px solid rgb(239 106 85 / .35); color: #ffa696;
}
.ob-caption { margin: 10px 2px 0; font-size: 11.5px; color: var(--muted); }

/* ---------- Repo grid (live from GitHub) ---------- */
.repos { padding: clamp(20px, 3vw, 28px); }
.repos-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.repos-title { font: 800 22px/1.2 var(--display); margin: 0; }
.repo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.repo-empty { grid-column: 1 / -1; color: var(--muted); font-size: 15px; margin: 0; }
.repo-empty a { color: var(--accent); font-weight: 600; }
.repo {
  display: flex; flex-direction: column; gap: 8px;
  padding: 16px 18px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--line);
  text-decoration: none;
  transition: border-color .15s, background .15s;
}
.repo:hover { border-color: var(--accent); background: var(--surface); }
.repo-name { font: 800 16px/1.3 var(--display); color: var(--accent); word-break: break-word; }
.repo-desc { font-size: 14.5px; color: var(--muted); margin: 0; flex: 1; }
.repo-foot { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); align-items: center; flex-wrap: wrap; }
.lang-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }

/* ---------- About ---------- */
.about {
  display: grid; grid-template-columns: 1fr 1.6fr; gap: 0 clamp(32px, 5vw, 64px);
  padding: clamp(24px, 4vw, 44px);
}
.about-body p { font-size: 17px; color: var(--ink-soft); }
.about-body p:last-child { margin-bottom: 0; }

/* ---------- Education timeline ---------- */
.timeline {
  list-style: none; margin: 0; padding: 0 0 0 28px;
  position: relative; display: grid; gap: 12px;
}
.timeline::before {
  content: ""; position: absolute; left: 6px; top: 14px; bottom: 14px; width: 2px;
  background: var(--line-strong);
}
.tl-item { padding: 18px 22px; border-radius: 14px; }
.tl-item::after {
  content: ""; position: absolute; left: -27px; top: 24px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent);
}
.tl-item.is-current::after { background: var(--green); border-color: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.tl-date { font: 700 12px/1.3 var(--display); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin: 0 0 6px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tl-badge {
  font-size: 10.5px; letter-spacing: .08em; color: var(--green);
  padding: 3px 8px; border-radius: 999px;
  background: var(--green-soft);
}
.tl-title { font: 800 19px/1.3 var(--display); margin: 0 0 3px; }
.tl-sub { margin: 0; color: var(--ink-soft); }
.tl-place { margin: 3px 0 0; font-size: 14px; color: var(--muted); }

/* ---------- Skills ---------- */
.skills { padding: clamp(24px, 4vw, 44px); }
.top-skills {
  list-style: none; margin: 0 0 32px; padding: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.top-skill {
  --tone: var(--accent); --tone-soft: var(--accent-soft);
  display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 14px;
  align-items: center;
  padding: 16px 18px; border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--tone);
  box-shadow: var(--shadow-sm);
}
.top-skill:nth-child(2) { --tone: var(--teal); --tone-soft: var(--teal-soft); }
.top-skill:nth-child(3) { --tone: var(--green); --tone-soft: var(--green-soft); }
.top-icon {
  grid-row: span 2;
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px;
  color: var(--tone); background: var(--tone-soft);
}
.top-label { font: 700 10.5px/1.2 var(--display); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.top-name { font: 800 17px/1.25 var(--display); color: var(--ink); }

.skill-groups { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px 36px; }
.skill-title { display: flex; align-items: center; gap: 9px; font: 800 16px/1.2 var(--display); margin: 0 0 10px; }
.skill-groups .chips { margin: 0; }
.skill-orb { width: 10px; height: 10px; border-radius: 3px; flex: none; background: var(--c); }
.orb-blue  { --c: #1d72c4; }
.orb-green { --c: #2e9461; }
.orb-aqua  { --c: #178a86; }
.orb-teal  { --c: #6a63c9; }
.orb-lime  { --c: #c27c1a; }
.orb-sky   { --c: #3d93d6; }
.orb-white { --c: #8aa0b7; }

/* ---------- Contact ---------- */
.contact-card { padding: clamp(28px, 5vw, 56px); text-align: center; }
.contact-card .cta-row { justify-content: center; }
.contact-title {
  font: 800 clamp(34px, 5.5vw, 60px)/1.05 var(--display);
  letter-spacing: -.025em;
  margin: 0 0 16px;
}
.contact-title em { font-style: normal; color: var(--accent); }
.contact-lede { font-size: 18px; color: var(--muted); max-width: 52ch; margin: 0 auto 28px; }

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--line); padding: 24px 0 32px; }
.footer-inner { display: flex; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.footer-inner a { text-decoration: none; }
.footer-inner a:hover { color: var(--accent); }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-inner { grid-template-columns: 1fr; }
  .project, .project-flip { grid-template-columns: 1fr; }
  .project-flip .project-media { order: 0; }
  .project-media { position: static; }
  .about { grid-template-columns: 1fr; }
  .top-skills { grid-template-columns: 1fr; }
  .skill-groups { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .nav-wide { display: none; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .brand-name { display: none; }
  .nav a:not(.icon-btn) { padding: 8px 8px; font-size: 14px; }
  .stats dd { font-size: 22px; }
  .stats div { padding: 10px; }
  .timeline { padding-left: 24px; }
  .timeline::before { left: 5px; }
  .tl-item { padding: 16px 18px; }
  .tl-item::after { left: -24px; }
  .ob-grid { grid-template-columns: 1fr; }
  .ob-fleet { border-right: 0; border-bottom: 1px solid var(--ob-line); }
  .ob-agents { grid-template-columns: 1fr 1fr; column-gap: 14px; }
  .ob-agents em { display: none; }
}
