/*
  Styles for Harshitha Machiraju’s portfolio
  This stylesheet combines a soft pastel palette with a flowing wave
  background. It is tailored to be ADHD‑friendly: clean typography,
  generous whitespace and gentle interactions.
*/

/* Base resets and root variables */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Inter, 'Helvetica Neue', Arial, 'Noto Sans', 'Apple Color Emoji', 'Segoe UI Emoji';
  /* Theme tokens */
  --color-text: #152238; /* calm ink */
  --color-surface: rgba(255, 255, 255, 0.75);
  --color-surface-strong: rgba(255, 255, 255, 0.95);
  --color-border: rgba(13, 27, 42, 0.08);
  --brand: #5f6ee8; /* slightly softer purple */
  /* Cards (timeline boxes) */
  --card-bg: #f6f7ff; /* gentle lavender wash */
  --card-border: rgba(95, 110, 232, 0.18);
  /* Tag/Chip styles */
  --chip-bg: #eef2ff; /* subtler than white */
  --chip-border: rgba(95, 110, 232, 0.28);
  --chip-text: #3a4599;
  color: var(--color-text);
  /* Light background – avoids an overly blue cast */
  background: linear-gradient(180deg, #fbfcff, #f2f5ff);
  /* Parallax scroll variable updated by JS */
  --scroll: 0;
}

/* Push content below fixed header height */
main { padding-top: 70px; }

/* Flowing wave background */
/* Use your SVG's real width (W) here */
:root {
  --tile: 2048px;
}

/* example: if your SVG width/viewBox width is 2048 */

.wave-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: url('assets/expansive-waves-oldold.svg') repeat-x left center / var(--tile) 100%;
  animation: drift 30s linear infinite;
  transform: translateY(calc(var(--scroll) * -1px));
  /* keep vertical parallax */
  opacity: 0.8;
}

body.dark .wave-bg { opacity: 0.35; }

@keyframes drift {
  from {
    background-position-x: 500;
  }

  to {
    background-position-x: calc(var(--tile) * -1);
  }
}

/* Header styles */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  padding-top: calc(14px + env(safe-area-inset-top));
  backdrop-filter: blur(6px);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  z-index: 5;
}
.menu-toggle { display:none; background:none; border:0; font-size:24px; line-height:1; color: var(--brand); }
.brand {
  font-weight: 800;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: #5a5cda;
  border: 2px solid #5a5cda;
  padding: 4px 8px;
  border-radius: 10px;
}
.site-nav { display: flex; align-items: center; }
.site-nav a {
  margin-left: 18px;
  text-decoration: none;
  color: #123;
  opacity: 0.8;
  transition: opacity 0.2s ease, color 0.2s ease;
}
.site-nav a:hover {
  opacity: 1;
  color: #5a5cda;
}

/* Toggle control */
.theme-toggle-input { display: none; }
.theme-toggle {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  width: 64px;
  height: 32px;
  margin-left: 12px;
  padding: 4px;
  border-radius: 999px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  position: relative;
  cursor: pointer;
}
.theme-toggle::before { content: ''; }
.theme-toggle::after {
  content: '☀️';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #5a5cda;
  box-shadow: 0 2px 6px rgba(0,0,0,.25);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 12px;
  transition: transform .25s ease;
}
.theme-toggle-input:checked + .theme-toggle::before { content: ''; }
.theme-toggle-input:checked + .theme-toggle::after { transform: translateX(32px); content: '🌙'; }

/* Floating social bar */
.social-bar {
  position: fixed;
  left: 16px;
  top: 40%;
  transform: translateY(-50%);
  display: grid;
  gap: 14px;
  z-index: 4;
}
.social-bar a {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 12px;
  color: var(--brand);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  transition: transform 0.2s ease, background 0.2s ease;
}
.social-bar a:hover {
  transform: translateY(-2px) scale(1.06);
  background: var(--color-surface-strong);
}

/* Hero section */
/* .hero {
  min-height: 70vh;
  display: grid;
  align-content: center;
  padding: 12vh 10vw 14vh;
  text-align: left;
} */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18vh 10vw;
  min-height: 70vh;
  gap: 2rem;
  /* space between text and photo */
}
.hero h1 {
  font-size: clamp(2.2rem, 5vw, 4rem);
  margin: 0 0 10px;
}
.hero p {
  font-size: clamp(1.05rem, 1.6vw, 1.3rem);
  max-width: 60ch;
  opacity: 0.85;
  margin: 0;
}

/* Left column */
.hero-text {
  flex: 1;
}

/* Right column (photo) */
.hero-photo {
  flex: 1;
  display: flex;
  justify-content: center;
  perspective: 1000px;
}

.hero-photo img {
  max-width: 280px;
  /* control photo size */
  width: 100%;
  height: auto;
  border-radius: 50%;
  /* circle crop */
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  object-fit: cover;
  transition: transform 600ms ease;
  transform-origin: 50% 50%;
  backface-visibility: hidden;
  will-change: transform;
}

/* Flip state */
/* remove flip; using spin instead */

/* 360° horizontal spin */
@keyframes spinY360 {
  from { transform: rotateY(0deg); }
  to { transform: rotateY(360deg); }
}

.hero-photo img.is-spinning {
  animation: spinY360 900ms linear;
  transition: none;
}

/* On small screens: stack vertically */
@media (max-width: 768px) {
  .hero {
    flex-direction: column;
    text-align: center;
    padding: 12vh 8vw;
  }

  .hero-photo {
    margin-top: 2rem;
  }
}

/* Tablet adjustments */
@media (max-width: 1024px) {
  .hero { padding: 14vh 8vw; }
  .content { padding: 18vh 8vw; }
}

.cta {
  display: inline-block;
  margin-top: 18px;
  background: #5a5cda;
  color: white;
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(90, 92, 218, 0.25);
  transition: background-color 0.3s ease, transform 0.3s ease;
}
.cta:hover {
  background: #494bb5;
  transform: translateY(-2px);
}

/* Generic primary button used on secondary pages */
.primary-btn {
  display: inline-block;
  background: #5a5cda;
  color: #fff;
  text-decoration: none;
  padding: 10px 16px;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(90, 92, 218, 0.25);
  transition: background-color 0.3s ease, transform 0.3s ease;
}
.primary-btn:hover {
  background: #494bb5;
  transform: translateY(-2px);
}

/* Content sections */
.content {
  padding: 24vh 10vw;
}
.content h2 {
  margin: 0 0 10px;
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  color: #5a5cda;
}

/* Contact form */
.contact-form {
  margin-top: 1.2rem;
  max-width: 720px;
}
.form-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 14px;
}
.form-row label {
  font-size: 0.9rem;
  color: #345c8c;
  margin-bottom: 6px;
}
.form-row input,
.form-row textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(13,27,42,0.15);
  background: rgba(255,255,255,0.9);
  color: #0d1b2a;
  font: inherit;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.form-row input:focus,
.form-row textarea:focus {
  border-color: #5a5cda;
  box-shadow: 0 0 0 3px rgba(90,92,218,0.15);
}
.form-hint {
  margin-top: 8px;
  font-size: 0.85rem;
  color: #345c8c;
}

/* Education timeline */
.timeline {
  position: relative;
  margin-top: 1.8rem;
  padding-left: 26px;
}
.timeline::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: linear-gradient(180deg, rgba(90,92,218,0.25), rgba(90,92,218,0.05));
}
.timeline-item {
  position: relative;
  margin: 0 0 22px 0;
}
.timeline-dot {
  position: absolute;
  left: 6px;
  top: 6px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #5a5cda;
  box-shadow: 0 0 0 4px rgba(90,92,218,0.15);
}
.timeline-content {
  background: var(--card-bg);
  border: 1px solid rgba(13,27,42,0.08);
  border-radius: 12px;
  padding: 12px 14px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}
.timeline-header {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.timeline-year {
  font-size: 0.85rem;
  color: #345c8c;
  background: rgba(90,92,218,0.12);
  border: 1px solid rgba(90,92,218,0.25);
  padding: 2px 8px;
  border-radius: 999px;
}
.timeline h3 {
  margin: 6px 0 4px 0;
  font-size: 1.05rem;
  color: #233;
}
.timeline p {
  margin: 0;
  color: #345c8c;
  font-size: 0.95rem;
}

/* Projects grid */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.5rem;
  margin-top: 1.6rem;
}
.project-card {
  background: var(--card-bg);
  border-radius: 12px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.project-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}
.project-card img {
  width: 100%;
  height: 160px;
  object-fit: cover;
}
.project-card .card-content {
  padding: 1rem;
  flex: 1;
}
.project-card h3 {
  margin: 0 0 8px;
  font-size: 1.15rem;
  color: #333;
}
.project-card p {
  margin: 0;
  font-size: 0.9rem;
  color: #345c8c;
}

/* Responsive adjustments */
@media (max-width: 600px) {
  .menu-toggle { display:block; }
  .site-nav { position: absolute; top: 58px; right: 12px; left: 12px; background: var(--color-surface); border:1px solid var(--color-border); border-radius:12px; padding:10px; display:none; flex-direction: column; gap:10px; }
  .site-nav a { margin-left: 0; }
  .site-nav.open { display:flex; }
  .social-bar { left: 8px; }
  .projects-grid { grid-template-columns: 1fr; }
  .paper-list { grid-template-columns: 1fr; }
  .paper { padding: 12px; }
}

/* Media defaults for fluid images */
img, svg, video { max-width: 100%; height: auto; }

/* Respect reduced motion preferences */
@media (prefers-reduced-motion: reduce) {
  .wave-bg { animation: none; }
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  body:not(.light){
    --brand: #9ab0ff;
    --color-text: var(--brand);
    --color-surface: rgba(18, 22, 33, 0.65);
    --color-surface-strong: rgba(18, 22, 33, 0.9);
    --color-border: rgba(232, 238, 246, 0.14);
    --card-bg: #101521; /* deep slate */
    --card-border: rgba(154, 176, 255, 0.22);
    --chip-bg: rgba(154,176,255,0.12);
    --chip-border: rgba(154,176,255,0.35);
    --chip-text: #b8c6ff;
    background: linear-gradient(180deg, #0b0f18, #05070c);
  }
  body:not(.light) .site-nav a { color: var(--brand); opacity: 1; }
  body:not(.light) .site-nav a:hover { color: #c6d0ff; }
  body:not(.light) :where(h1,h2,h3,h4,h5,h6,p,li,a,span,small,em,strong,code){ color: var(--brand); }
}

/* Explicit dark class (overrides system) */
body.dark {
  --brand: #9ab0ff;
  --color-text: var(--brand);
  --color-surface: rgba(18, 22, 33, 0.65);
  --color-surface-strong: rgba(18, 22, 33, 0.9);
  --color-border: rgba(232, 238, 246, 0.14);
  --card-bg: #101521;
  --card-border: rgba(154, 176, 255, 0.22);
  --chip-bg: rgba(154,176,255,0.12);
  --chip-border: rgba(154,176,255,0.35);
  --chip-text: #b8c6ff;
  background: linear-gradient(180deg, #0b0f18, #05070c);
}
body.dark .site-nav a { color: var(--brand); opacity: 1; }
body.dark .site-nav a:hover { color: #c6d0ff; }
body.dark :where(h1,h2,h3,h4,h5,h6,p,li,a,span,small,em,strong,code){ color: var(--brand); }

/* Ensure readable dark text on light surfaces in dark mode */
body.dark .paper,
body.dark .paper *,
body.dark .project-card,
body.dark .project-card *,
body.dark .timeline-content,
body.dark .timeline-content *,
body.dark .section-placeholder,
body.dark .section-placeholder *,
body.dark .content,
body.dark .content * {
  color: #9ab0ff !important;
  opacity: 1 !important;
}


/* Section loading states */
.section-placeholder {
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border-radius: 12px;
  margin: 2rem 0;
}

.section-placeholder .loading {
  color: #5a5cda;
  font-size: 1.1rem;
  opacity: 0.7;
}

.section-placeholder .error {
  color: #e74c3c;
  font-size: 1rem;
  opacity: 0.8;
}

/* Reduce oversized spacing on smaller screens while keeping separation */
@media (max-width: 768px) {
  .hero {
    padding: 16vh 10vw;
  }
  .content {
    padding: 18vh 8vw;
  }
}

.papers-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
@media (max-width: 600px) {
  .content#papers, #papers.content, section#papers.content { padding-left: clamp(18px, 6vw, 2rem); padding-right: clamp(18px, 6vw, 2rem); }
}

.paper-controls {
  display: flex;
  gap: .6rem;
}

.paper-controls input,
.paper-controls select {
  padding: .6rem .8rem;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: var(--card-bg);
  backdrop-filter: blur(6px);
}

.paper-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 14px;
}

.paper {
  width: 100%;
  box-sizing: border-box;
  background: var(--card-bg);
  border: 1px solid rgba(0, 0, 0, .06);
  border-radius: 14px;
  padding: 14px 16px;
  backdrop-filter: blur(6px);
}

.paper-title {
  font-weight: 700;
  text-decoration: none;
  color: #0d1b2a;
}

.paper-title:hover {
  text-decoration: underline;
}

.paper-venue {
  margin-left: .6rem;
  font-size: .9rem;
  color: var(--chip-text);
  background: var(--chip-bg);
  border: 1px solid var(--chip-border);
  padding: .15rem .5rem;
  border-radius: 999px;
}

.paper-blurb {
  margin: 6px 0 8px;
  opacity: .9;
}

.paper-actions a {
  display: inline-block;
  margin-right: .6rem;
  padding: .25rem .55rem;
  font-size: .9rem;
  border-radius: 999px;
  text-decoration: none;
  background: #eef3ff;
}

.paper-tags {
  display: flex;
  gap: .4rem;
  flex-wrap: wrap;
  margin-top: 6px;
}

.paper-tags span {
  background: var(--chip-bg);
  color: var(--chip-text);
  border: 1px solid var(--chip-border);
  padding: .15rem .5rem;
  border-radius: 999px;
  font-size: .85rem;
}

.bibtex summary {
  cursor: pointer;
  font-size: .9rem;
  opacity: .85;
}

/* Copyright footer */
.copyright {
  text-align: center;
  padding: 20px env(safe-area-inset-right) 20px env(safe-area-inset-left);
  margin-top: 40px;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  backdrop-filter: blur(6px);
}

.copyright p {
  margin: 0;
  font-size: 0.9rem;
  color: #556070;
  opacity: 0.8;
}

@media (prefers-color-scheme: dark) {
  body:not(.light) .copyright p {
    color: #cbd6ff;
    opacity: 0.85;
  }
}

body.dark .copyright p {
  color: #cbd6ff;
  opacity: 0.85;
}

.decor-img {
  position: absolute;
  width: 200px;
  opacity: 0.15;
  z-index: -1;
}


.hero-art {
  width: 100%;
  max-height: 250px;
  opacity: 0.9;
  margin-top: 1.5rem;
}

.figure {
  display: block;
  max-width: 100%;
  margin: 2rem auto;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.section {
  scroll-margin-top: 85px;
  /* header offset */
  padding: 0 clamp(18px, 6vw, 2rem);
  max-width: 900px;
  /* matches index content width */
  margin: 0 auto;
  /* centers section horizontally */
}

.hero {
  scroll-margin-top: 85px;
  padding: 8rem 2rem;
  max-width: 900px;
  margin: 0 auto;
}