:root {
  --bg-color: #ffffff;
  --text-color: #1a1a1a;
  --accent-color: #0066cc;
  --border-color: #e5e5e5;
  --text-muted: #666666;
  --text-subtle: #555555;
  --code-bg: #f8f8f8;
  --code-color: #d73a49;
  --table-even-bg: #fafafa;
}

[data-theme="dark"] {
  --bg-color: #121212;
  --text-color: #e5e7eb;
  --accent-color: #3b82f6;
  --border-color: #27272a;
  --text-muted: #9ca3af;
  --text-subtle: #a1a1aa;
  --code-bg: #18181b;
  --code-color: #f43f5e;
  --table-even-bg: #18181b;
}

body, nav, footer, a, pre, code, th, td, .metrics, .post-list li, .theme-toggle {
  transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

body {
  max-width: 800px;
  margin: auto;
  padding: 1.5rem;
  line-height: 1.7;
  color: var(--text-color);
  background: var(--bg-color);
}

@media (max-width: 768px) {
  body {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  body {
    padding: 0.875rem;
  }
}

/* Nav */
nav {
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.nav-home {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-color);
  text-decoration: none;
  border: none;
}

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

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.nav-links a {
  font-size: 0.95rem;
  color: var(--accent-color);
  text-decoration: none;
  border-bottom: none;
  position: relative;
  transition: opacity 0.2s ease;
}

.nav-links a:hover {
  opacity: 0.7;
  border-bottom: none;
}

@media (max-width: 480px) {
  nav {
    gap: 0.75rem;
    margin-bottom: 1.5rem;
  }
  
  .nav-links {
    gap: 1rem;
  }
  
  .nav-links a {
    font-size: 0.9rem;
  }
}

/* Links */
a {
  color: var(--accent-color);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

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

a[target="_blank"]::after,
a[href^="http"]:not([href*="bhavya-dalal.github.io"])::after {
  font-size: 0.85em;
  opacity: 0.7;
}

a[target="_blank"]:hover::after,
a[href^="http"]:not([href*="bhavya-dalal.github.io"]):hover::after {
  content: " (External)";
  opacity: 1;
}

/* Navigation and footer links - no underline */
nav a, footer a {
  border-bottom: none;
  color: var(--accent-color);
}

nav a:hover, footer a:hover {
  border-bottom: none;
  opacity: 0.7;
}

footer a[target="_blank"]::after,
footer a[href^="http"]:not([href*="bhavya-dalal.github.io"])::after {
  font-size: 0.85em;
  opacity: 0.7;
}
footer a[href^="http"]:not([href*="bhavya-dalal.github.io"]):hover::after {
  content: " (External)";
  font-size: 0.85em;
  opacity: 0.7;
}

/* Headings */
h1, h2, h3 {
  line-height: 1.3;
  color: var(--text-color);
  font-weight: 600;
}

h1 { 
  font-size: 2rem; 
  margin: 1.5rem 0 1rem;
}

h2 { 
  font-size: 1.35rem;
  margin: 1.5rem 0 0.75rem;
}

h3 { 
  font-size: 1.1rem;
  margin: 1.25rem 0 0.5rem;
}

@media (max-width: 768px) {
  h1 { font-size: 1.75rem; }
  h2 { font-size: 1.25rem; }
  h3 { font-size: 1rem; }
}

@media (max-width: 480px) {
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.1rem; }
  h3 { font-size: 0.95rem; }
}

/* Experience */
.exp-item {
  margin-bottom: 2.5rem;
}

.exp-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 0.75rem;
}

.exp-company {
  font-weight: 600;
  color: var(--text-color);
  font-size: 1.05rem;
}

.exp-period {
  font-size: 0.9rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.exp-role {
  color: var(--text-subtle);
  margin-bottom: 0.75rem;
  font-style: italic;
  font-size: 0.95rem;
}

.exp-highlights {
  margin: 0;
  padding-left: 1.5rem;
  list-style: disc;
}

.exp-highlights li {
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
  line-height: 1.6;
}

@media (max-width: 480px) {
  .exp-item {
    margin-bottom: 2rem;
  }
  
  .exp-header {
    flex-direction: column;
    gap: 0.25rem;
  }
}

/* Metrics */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1.5rem;
  margin: 2rem 0;
  padding: 1.5rem 0;
  border-top: 1px solid var(--border-color);
  border-bottom: 1px solid var(--border-color);
}

.metric-num {
  font-size: 1.6rem;
  font-weight: 600;
  color: var(--accent-color);
  display: block;
  margin-bottom: 0.5rem;
}

.metric-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: block;
  line-height: 1.4;
}

@media (max-width: 480px) {
  .metrics {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    padding: 1rem 0;
    margin: 1.5rem 0;
  }
  
  .metric-num {
    font-size: 1.35rem;
  }
  
  .metric-label {
    font-size: 0.8rem;
  }
}

/* Skills */
.skills-row {
  margin-bottom: 1rem;
  font-size: 0.95rem;
  line-height: 1.6;
}

.skills-label {
  font-weight: 600;
  color: var(--accent-color);
}

@media (max-width: 480px) {
  .skills-row {
    margin-bottom: 0.75rem;
    font-size: 0.9rem;
  }
}

/* Post list */
.post-list {
  list-style: none;
  padding: 0;
  margin: 1.5rem 0 0;
}

.post-list li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border-color);
  gap: 1.5rem;
}

.post-list li:first-child {
  border-top: 1px solid var(--border-color);
}

.post-list li a {
  color: var(--accent-color);
}

.post-date {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: nowrap;
}

@media (max-width: 480px) {
  .post-list li {
    flex-direction: column;
    gap: 0.25rem;
    padding: 0.5rem 0;
  }
  
  .post-date {
    font-size: 0.8rem;
  }
}

/* Single post */
.post-meta {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 1rem;
}

/* Code */
code {
  font-size: 0.85em;
  background: var(--code-bg);
  padding: 2px 5px;
  border-radius: 3px;
  color: var(--code-color);
}

pre {
  background: var(--code-bg);
  padding: 1rem;
  overflow-x: auto;
  border-radius: 4px;
  border-left: 3px solid var(--accent-color);
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
  color: inherit;
  border-radius: 0;
}

/* Tables */
table {
  margin: 1.5rem auto;
  border-collapse: collapse;
  width: 100%;
}

th, td {
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}

th { 
  background: var(--code-bg); 
  font-weight: 600;
  color: var(--text-color);
}

tr:nth-child(even) { 
  background: var(--table-even-bg); 
}

/* Images */
img, video, iframe {
  max-width: 100%;
  height: auto;
}

p > img:only-child {
  display: block;
  margin: 1.5rem auto;
  border-radius: 4px;
}

/* Footer */
footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

/* Theme Toggle Button */
.theme-toggle {
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.theme-toggle:hover {
  background-color: var(--code-bg);
  color: var(--accent-color);
  transform: scale(1.05);
}

/********** SUN/MOON SHOW/HIDE **********/
.theme-toggle svg {
  width: 1.2rem;
  height: 1.2rem;
}

.theme-toggle .sun-icon {
  display: none;
}

.theme-toggle .moon-icon {
  display: block;
}

[data-theme="dark"] .theme-toggle .sun-icon {
  display: block;
}

[data-theme="dark"] .theme-toggle .moon-icon {
  display: none;
}

@media (max-width: 480px) {
  footer {
    flex-direction: column;
    gap: 0.5rem;
  }
}

/* Page content */
.page-content {
  margin-bottom: 2rem;
}

.page-content > *:first-child {
  margin-top: 0;
}

.page-content table {
  font-size: 0.9rem;
}

/* Writing section */
.writing-section {
  margin-top: 3rem;
}

/* Responsive text */
@media (max-width: 600px) {
  body {
    font-size: 1rem;
  }
}

/* Accessibility */
@media (prefers-reduced-motion: reduce) {
  a {
    transition: none;
  }
}
