/* ============================================
   styles.css — pyharsh.com

   Color system:
     --bg         off-white with slight warmth
     --accent     darker cyan for text (WCAG AA on light bg)
     --accent-bright  vivid cyan for decorative elements

   Typography: system font stack — no external fonts.
   Fast, native, zero network requests.
   ============================================ */


/* --- Custom Properties --- */

:root {
  --bg: #fafaf8;
  --bg-alt: #f3f3f1;
  --text: #1a1a1a;
  --text-secondary: #555;
  --accent: #0e7490;
  --accent-bright: #06b6d4;
  --accent-hover: #0c5e73;
  --border: #e5e5e3;
  --nav-bg: rgba(250, 250, 248, 0.92);
  --nav-links-bg: rgba(250, 250, 248, 0.98);
  --max-width: 720px;
  --nav-height: 56px;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
    Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;
}


/* --- Reset & Base --- */

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--nav-height);
}

body {
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

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

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

strong {
  font-weight: 600;
}


/* --- Layout --- */

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 80px 0;
}

.section h2 {
  font-size: 1.5rem;
  font-weight: 600;
  margin-bottom: 32px;
  letter-spacing: -0.02em;
}


/* --- Navigation --- */

.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--nav-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.nav-logo {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.nav-logo:hover {
  color: var(--accent);
}

/* Groups nav-links + theme toggle + hamburger on the right */
.nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 28px;
}

.nav-links a {
  font-size: 0.875rem;
  color: var(--text-secondary);
  transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
}

/* Dark mode toggle button */
.theme-toggle {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease;
  flex-shrink: 0;
}

.theme-toggle:hover {
  color: var(--accent);
}

/* Show moon in light mode, sun in dark mode */
.icon-sun { display: none; }
.icon-moon { display: block; }

.dark .icon-sun { display: block; }
.dark .icon-moon { display: none; }

/* Hamburger toggle — hidden on desktop, shown on mobile */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  width: 28px;
  height: 20px;
  position: relative;
}

.nav-toggle span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text);
  position: absolute;
  left: 0;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.nav-toggle span:nth-child(1) { top: 0; }
.nav-toggle span:nth-child(2) { top: 9px; }
.nav-toggle span:nth-child(3) { top: 18px; }

/* X shape when menu is open */
.nav-toggle.open span:nth-child(1) {
  transform: rotate(45deg);
  top: 9px;
}

.nav-toggle.open span:nth-child(2) {
  opacity: 0;
}

.nav-toggle.open span:nth-child(3) {
  transform: rotate(-45deg);
  top: 9px;
}


/* --- Hero --- */

.hero {
  padding-top: calc(var(--nav-height) + 80px);
  padding-bottom: 60px;
}

.hero-name {
  font-size: 2.8rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 12px;
}

.hero-tagline {
  font-size: 1.15rem;
  color: var(--text-secondary);
  margin-bottom: 0;
}


/* --- About --- */

.about-content {
  display: flex;
  gap: 40px;
  align-items: flex-start;
}

.about-text {
  flex: 1;
}

.about-text p {
  margin-bottom: 16px;
}

.about-text p:last-child {
  margin-bottom: 0;
}

.about-photo {
  flex-shrink: 0;
  width: 200px;
}

.about-photo img {
  border-radius: 6px;
  width: 100%;
  height: auto;
}


/* --- Projects --- */

.project {
  /* Negative margin extends hover background into the container's side padding */
  padding: 28px 16px;
  margin: 0 -16px;
  border-bottom: 1px solid var(--border);
  border-radius: 4px;
  transition: background 0.15s ease;
}

.project:hover {
  background: var(--bg-alt);
}

.project:last-child {
  border-bottom: none;
}

.project h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 4px;
  letter-spacing: -0.01em;
}

/* Project title links: look like text by default, accent on hover */
.project h3 a {
  color: var(--text);
  text-decoration: none;
}

.project h3 a:hover {
  color: var(--accent);
}

.project time {
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 12px;
}

.project p {
  margin-bottom: 14px;
}

/* Label above the project title — used for the responsible disclosure callout */
.project-label {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 6px;
}

/* Tech tag chips below each project */
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tags span {
  font-size: 0.73rem;
  padding: 3px 10px;
  border-radius: 3px;
  background: var(--bg-alt);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.project-link {
  display: inline-block;
  font-size: 0.85rem;
  margin-top: 10px;
}


/* --- Research --- */

.research-content p {
  margin-bottom: 16px;
}

.research-content p:last-child {
  margin-bottom: 0;
}


/* --- Now --- */

.now-intro {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 28px;
}

.now-content {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

.now-photo {
  width: 160px;
  flex-shrink: 0;
  border-radius: 6px;
}

.now-list {
  list-style: none;
  flex: 1;
}

.now-list li {
  margin-bottom: 16px;
  padding-left: 16px;
  border-left: 2px solid var(--border);
}

.now-list li:last-child {
  margin-bottom: 0;
}

.now-updated {
  margin-top: 28px;
  font-size: 0.8rem;
  color: var(--text-secondary);
  font-style: italic;
}


/* --- Writing --- */

.writing-placeholder {
  color: var(--text-secondary);
  font-style: italic;
}


/* --- Contact --- */

.contact-note {
  margin-bottom: 20px;
  color: var(--text-secondary);
}

.contact-links {
  list-style: none;
  display: flex;
  gap: 24px;
}

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


/* --- Footer --- */

.footer {
  padding: 40px 0;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
}


/* --- Fade-in Animation ---
   Sections start invisible and slide up slightly.
   The Intersection Observer in script.js adds .visible when they enter view.
   The .no-js class on <html> ensures everything is visible if JS is off. */

.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: none;
}

/* When JS is disabled, the no-js class stays on <html> and overrides the
   fade-in to keep all content visible. */
.no-js .fade-in {
  opacity: 1;
  transform: none;
}


/* --- Responsive: Tablet & Mobile --- */

@media (max-width: 768px) {
  body {
    font-size: 16px;
  }

  /* Show hamburger, collapse nav links */
  .nav-toggle {
    display: block;
  }

  .nav-links {
    display: none;
    position: absolute;
    top: var(--nav-height);
    left: 0;
    right: 0;
    background: var(--nav-links-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    flex-direction: column;
    padding: 16px 24px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
  }

  .nav-links.open {
    display: flex;
  }

  .hero {
    padding-top: calc(var(--nav-height) + 48px);
    padding-bottom: 40px;
  }

  .hero-name {
    font-size: 2rem;
  }

  .section {
    padding: 56px 0;
  }

  /* Stack about: photo on top, text below */
  .about-content {
    flex-direction: column-reverse;
  }

  .about-photo {
    width: 160px;
  }

  /* Stack now content vertically */
  .now-content {
    flex-direction: column;
  }

  .now-photo {
    width: 120px;
  }

  /* Stack contact links */
  .contact-links {
    flex-direction: column;
    gap: 12px;
  }
}

@media (max-width: 480px) {
  .hero-name {
    font-size: 1.7rem;
  }

  .section h2 {
    font-size: 1.3rem;
  }

  .container {
    padding: 0 16px;
  }

  .nav {
    padding: 0 16px;
  }
}


/* --- Dark Mode ---
   Toggled by adding the .dark class to <html> via script.js.
   Respects the user's saved preference (localStorage) or system preference
   on first visit. */

.dark {
  --bg: #111110;
  --bg-alt: #1c1c1b;
  --text: #e8e8e6;
  --text-secondary: #8a8a88;
  --accent: #22d3ee;
  --accent-bright: #67e8f9;
  --accent-hover: #38bdf8;
  --border: #2e2e2c;
  --nav-bg: rgba(17, 17, 16, 0.92);
  --nav-links-bg: rgba(17, 17, 16, 0.98);
}
