/* Ramneek Kalra — personal community site (light + dark) */
:root {
  --bg: #ffffff;
  --bg-subtle: #f4f6fa;
  --bg-elevated: #eef1f6;
  --bg-card: #ffffff;
  --border: rgba(26, 29, 38, 0.1);
  --border-strong: rgba(26, 29, 38, 0.14);
  --text: #1a1d26;
  --text-muted: #5a6270;
  --accent: #b8860b;
  --accent-dark: #8a6610;
  --accent-soft: rgba(184, 134, 11, 0.1);
  --link: #1a5278;
  --header-bg: rgba(255, 255, 255, 0.92);
  --header-shadow: 0 1px 0 rgba(26, 29, 38, 0.06), 0 8px 24px rgba(26, 29, 38, 0.04);
  --radius: 12px;
  --font-sans: "DM Sans", system-ui, sans-serif;
  --font-display: "Fraunces", Georgia, serif;
  --max: 1100px;
  --space: clamp(1rem, 4vw, 2rem);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12141a;
  --bg-subtle: #1a1d26;
  --bg-elevated: #232731;
  --bg-card: #1a1d26;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #e8eaef;
  --text-muted: #a0a6b4;
  --accent: #d4a84b;
  --accent-dark: #c4953a;
  --accent-soft: rgba(212, 168, 75, 0.14);
  --link: #8ec5f0;
  --header-bg: rgba(18, 20, 26, 0.92);
  --header-shadow: 0 1px 0 rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

.skip-link {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link:focus {
  position: fixed;
  top: 0.65rem;
  left: 0.65rem;
  z-index: 10001;
  width: auto;
  height: auto;
  margin: 0;
  padding: 0.65rem 1rem;
  overflow: visible;
  clip: auto;
  white-space: normal;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--bg);
  background: var(--text);
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(26, 29, 38, 0.2);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 100% 60% at 50% -10%, rgba(184, 134, 11, 0.06), transparent),
    radial-gradient(ellipse 50% 40% at 100% 0%, rgba(26, 82, 120, 0.04), transparent);
  min-height: 100vh;
}

html[data-theme="dark"] body {
  background-image:
    radial-gradient(ellipse 100% 60% at 50% -10%, rgba(212, 168, 75, 0.08), transparent),
    radial-gradient(ellipse 50% 40% at 100% 0%, rgba(142, 197, 240, 0.06), transparent);
}

a {
  color: var(--link);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--accent-dark);
}

img {
  max-width: 100%;
  height: auto;
}

/* ——— Header ——— */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: var(--header-bg);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--header-shadow);
}

.header-inner {
  position: relative;
  max-width: var(--max);
  margin: 0 auto;
  /* Room for theme toggle (always position:absolute) so nav never sits under it */
  padding: 0.85rem calc(var(--space) + 3.25rem) 0.85rem var(--space);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}

.theme-toggle {
  position: absolute;
  top: 0.85rem;
  right: var(--space);
  z-index: 210;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  cursor: pointer;
  font: inherit;
  padding: 0.35rem;
  border-radius: 999px;
  color: var(--text-muted);
  flex-shrink: 0;
  transition:
    color 0.2s ease,
    background 0.2s ease;
}

.theme-toggle:hover {
  color: var(--text);
  background: var(--bg-subtle);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.theme-toggle-track {
  display: block;
  width: 2.75rem;
  height: 1.5rem;
  border-radius: 999px;
  background: var(--border-strong);
  position: relative;
  transition: background 0.2s ease;
}

html[data-theme="dark"] .theme-toggle-track {
  background: rgba(212, 168, 75, 0.28);
}

.theme-toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: calc(1.5rem - 6px);
  height: calc(1.5rem - 6px);
  border-radius: 50%;
  background: #fff;
  border: 1px solid rgba(26, 29, 38, 0.14);
  transition: transform 0.25s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

html[data-theme="dark"] .theme-toggle-thumb {
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateX(1.125rem);
}

.nav {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.nav-toggle {
  display: none;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.5rem 1.1rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
}

.nav-list {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.35rem clamp(0.75rem, 2vw, 1.35rem);
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-list a {
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 500;
}

.nav-list a:hover {
  color: var(--text);
}

/* ——— Hero (page head) ——— */
.hero-region {
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-subtle) 55%, var(--bg) 100%);
  border-bottom: 1px solid var(--border);
}

.hero-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: clamp(1.75rem, 5vw, 3.25rem) var(--space) clamp(2rem, 5vw, 3.5rem);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(1.5rem, 4vw, 2.75rem);
  align-items: center;
  min-height: min(480px, 75vh);
}

.hero-photo-frame {
  justify-self: center;
  position: relative;
}

.hero-photo-frame::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 22px;
  background: linear-gradient(145deg, rgba(184, 134, 11, 0.35), rgba(26, 82, 120, 0.2));
  z-index: -1;
  opacity: 0.85;
}

.hero-photo {
  display: block;
  width: min(300px, 72vw);
  max-height: min(420px, 55vh);
  object-fit: cover;
  object-position: center top;
  border-radius: 16px;
  box-shadow:
    0 24px 48px rgba(26, 29, 38, 0.12),
    0 0 0 1px rgba(26, 29, 38, 0.06);
  background: var(--bg-subtle);
}

html[data-theme="dark"] .hero-photo {
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.06);
}

.hero-copy {
  text-align: left;
  min-width: 0;
}

.hero-badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-dark);
  background: var(--accent-soft);
  padding: 0.35rem 0.85rem;
  border-radius: 999px;
  margin-bottom: 0.85rem;
}

.hero-region h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.1rem, 5.5vw, 3.25rem);
  line-height: 1.12;
  margin: 0 0 0.65rem;
  letter-spacing: -0.02em;
}

.hero-role {
  font-size: 1.08rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.hero-lede {
  margin: 0 0 1.35rem;
  color: var(--text-muted);
  font-size: 1.02rem;
  max-width: 38rem;
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.65rem 1.35rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
  border: none;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    box-shadow 0.15s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
}

.btn-primary:hover {
  color: #fff;
  box-shadow: 0 8px 28px rgba(184, 134, 11, 0.35);
}

.btn-ghost {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border-strong);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

main {
  max-width: var(--max);
  margin: 0 auto;
  padding: var(--space);
}

section {
  padding: clamp(2.5rem, 5vw, 4rem) 0;
  border-top: 1px solid var(--border);
}

.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-dark);
  margin: 0 0 0.5rem;
}

section h2 {
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 3.5vw, 2.1rem);
  margin: 0 0 1.25rem;
  font-weight: 600;
}

.section-intro {
  color: var(--text-muted);
  max-width: 52rem;
  margin: 0 0 1.75rem;
}

.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  font-size: 0.88rem;
  color: var(--text-muted);
}

.card-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.35rem;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease;
  box-shadow: 0 1px 2px rgba(26, 29, 38, 0.04);
}

html[data-theme="dark"] .card {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.card:hover {
  border-color: rgba(184, 134, 11, 0.35);
  box-shadow: 0 8px 24px rgba(26, 29, 38, 0.06);
}

html[data-theme="dark"] .card:hover {
  border-color: rgba(212, 168, 75, 0.4);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.card h3 {
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
  font-weight: 600;
}

.card p,
.card li {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.card ul {
  margin: 0;
  padding-left: 1.1rem;
}

.timeline {
  position: relative;
  padding-left: 1.25rem;
  border-left: 2px solid var(--border);
  margin-left: 0.5rem;
}

.timeline-item {
  position: relative;
  padding-bottom: 1.75rem;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: calc(-1.25rem - 5px);
  top: 0.35rem;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--bg);
}

.timeline-meta {
  font-size: 0.82rem;
  color: var(--accent-dark);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.timeline-item h3 {
  font-size: 1.1rem;
  margin: 0 0 0.35rem;
}

.leadership-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.65rem;
}

.leadership-list li {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.85rem 1.1rem;
  font-size: 0.95rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.75rem;
  box-shadow: 0 1px 2px rgba(26, 29, 38, 0.04);
}

html[data-theme="dark"] .leadership-list li {
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.leadership-list .role {
  font-weight: 600;
  color: var(--text);
}

.leadership-list .org {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.research-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.stat {
  background: var(--accent-soft);
  border: 1px solid rgba(184, 134, 11, 0.22);
  border-radius: var(--radius);
  padding: 1.25rem;
  text-align: center;
}

.stat strong {
  display: block;
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--accent-dark);
  line-height: 1.1;
}

.stat span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.projects-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.project-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.2rem;
  transition: border-color 0.2s ease;
}

.project-card:hover {
  border-color: rgba(184, 134, 11, 0.25);
}

.project-card h3 {
  font-size: 1rem;
  margin: 0 0 0.4rem;
}

.project-card .project-desc {
  margin: 0;
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.project-card .type {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-dark);
  margin-bottom: 0.35rem;
}

a.project-card--link {
  display: block;
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}

a.project-card--link:hover {
  color: inherit;
}

a.project-card--link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

a.project-card--link h3 {
  color: var(--text);
}

a.project-card--link .project-desc {
  color: var(--text-muted);
}

.project-card-cta {
  display: inline-block;
  margin-top: 0.65rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--link);
}

a.project-card--link:hover .project-card-cta {
  color: var(--accent-dark);
}

.contact-mailto-shortcuts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem 0.5rem;
  font-size: 0.92rem;
}

.contact-mailto-shortcuts a {
  font-weight: 600;
}

.contact-shortcut-sep {
  color: var(--text-muted);
  user-select: none;
}

.contact-block {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  text-align: center;
  max-width: 36rem;
  margin: 0 auto;
}

.contact-block p {
  color: var(--text-muted);
  margin: 0 0 1.25rem;
}

.contact-block code {
  font-size: 0.88em;
  padding: 0.1em 0.35em;
  background: var(--bg-elevated);
  border-radius: 4px;
  border: 1px solid var(--border);
}

.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.contact-links a {
  font-weight: 600;
}

.contact-links--stack {
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
}

.contact-email-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 0.75rem;
}

.btn-copy-email {
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--link);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.btn-copy-email:hover {
  color: var(--accent-dark);
  border-color: rgba(184, 134, 11, 0.45);
  background: var(--accent-soft);
}

.btn-copy-email:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.contact-social-note {
  margin-top: 1.25rem !important;
  margin-bottom: 0 !important;
  font-size: 0.9rem;
}

.site-footer {
  text-align: center;
  padding: 2rem var(--space) 2.5rem;
  color: var(--text-muted);
  font-size: 0.88rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.footer-sep {
  margin: 0 0.35rem;
  opacity: 0.5;
}

.footer-top {
  font-weight: 600;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .hero-inner {
    grid-template-columns: 1fr;
    text-align: center;
    min-height: 0;
  }

  .hero-copy {
    text-align: center;
  }

  .hero-lede {
    margin-left: auto;
    margin-right: auto;
  }

  .hero-cta {
    justify-content: center;
  }
}

@media (max-width: 720px) {
  .nav-toggle {
    display: block;
  }

  .nav-list {
    display: none;
    flex-direction: column;
    width: 100%;
    max-width: 20rem;
    padding-top: 0.35rem;
    gap: 0.35rem;
  }

  .nav-list.is-open {
    display: flex;
  }

  .nav-list a {
    display: block;
    padding: 0.45rem 0.5rem;
    text-align: center;
  }
}

/* ——— First-visit loading bar ——— */
html.first-visit-pending body {
  overflow: hidden;
}

.first-load-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 100% 60% at 50% -10%, rgba(184, 134, 11, 0.06), transparent),
    radial-gradient(ellipse 50% 40% at 100% 0%, rgba(26, 82, 120, 0.04), transparent);
  transition: opacity 0.4s ease, visibility 0.4s ease;
}

html[data-theme="dark"] .first-load-overlay {
  background-image:
    radial-gradient(ellipse 100% 60% at 50% -10%, rgba(212, 168, 75, 0.08), transparent),
    radial-gradient(ellipse 50% 40% at 100% 0%, rgba(142, 197, 240, 0.06), transparent);
}

html.first-visit-pending .first-load-overlay {
  display: flex;
}

.first-load-inner {
  text-align: center;
  padding: var(--space);
}

.first-load-title {
  margin: 0 0 1.25rem;
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.first-load-track {
  width: min(300px, 78vw);
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}

.first-load-bar {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--link), var(--accent));
}

.first-load-overlay.first-load-overlay--done {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  html.first-visit-pending body {
    overflow: auto;
  }

  .first-load-overlay {
    transition: opacity 0.15s ease, visibility 0.15s ease;
  }
}
