:root {
  --bg-color: #0d1117;
  --bg-bright-color: #161b22;
  --bg-accent: #1c2128;
  --text-color: rgb(230, 237, 243);
  --text-muted: #8b949e;
  --accent-color: #58a6ff;
  --accent-secondary: #1f6feb;
  --border-color: #30363d;
  --success-color: #3fb950;
  --danger-color: #f85149;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.2);
  --radius: 8px;
  --transition: all 0.2s ease;
}

[data-theme="light"] {
  --bg-color: rgb(230, 237, 243);
  --bg-bright-color: #ffffff;
  --bg-accent: #f6f8fa;
  --text-color: #0d1117;
  --text-muted: #57606a;
  --accent-color: #0969da;
  --accent-secondary: #033d8b;
  --border-color: #d0d7de;
  --success-color: #1a7f37;
  --danger-color: #da3633;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  font-family: 'Inter', 'Segoe UI', 'Roboto', sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
  line-height: 1.6;
  height: 100%;
}

body, html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-color);
  color: var(--text-color);
  overflow-x: hidden;
  transition: background-color 0.3s ease, color 0.3s ease;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

#app {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.app-header {
  background-color: var(--bg-color);
  padding: 0 2rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  height: 70px;
  border-bottom: 2px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.app-logo {
  font-family: 'Inter', 'Segoe UI', sans-serif;
  font-size: 2rem;
  font-weight: 900;
  color: var(--text-color);
  text-decoration: none;
  transition: var(--transition);
  letter-spacing: -0.5px;
}

.app-logo:hover {
  opacity: 0.8;
  color: var(--accent-color);
}

.app-nav {
  margin-left: auto;
  display: flex;
  gap: 2rem;
  align-items: center;
}

.app-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
  transition: var(--transition);
  position: relative;
}

.app-nav a:hover,
.app-nav a:focus {
  color: var(--accent-color);
  outline: none;
}

.app-nav a::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  width: 0;
  height: 2px;
  background-color: var(--accent-color);
  transition: width 0.3s ease;
}

.app-nav a:hover::after,
.app-nav a:focus::after {
  width: 100%;
}

.app-controls {
  background-color: transparent;
  display: flex;
  gap: 0.75rem;
  margin-left: 2rem;
}

.app-controls div {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  height: 38px;
  width: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  background-color: var(--bg-bright-color);
}

.app-controls button {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  height: 38px;
  width: 38px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  background-color: var(--bg-bright-color);
}

.app-controls button:hover,
.app-controls div:hover {
  border-color: var(--accent-color);
  background-color: var(--bg-accent);
  transform: scale(1.08);
}

.app-controls button:active,
.app-controls div:active {
  transform: scale(0.96);
}

.app-controls button svg,
.app-controls div svg {
  width: 20px;
  height: 20px;
  transition: var(--transition);
  stroke: var(--text-muted);
  pointer-events: none;
}

.app-controls button:hover svg,
.app-controls div:hover svg {
  stroke: var(--accent-color);
}

.sun-icon,
.moon-icon {
  position: absolute;
}

/* Dark mode: show sun icon (to switch to light) */
.sun-icon {
  display: block;
  opacity: 1;
  animation: spin-in 0.3s ease-in-out;
}

.moon-icon {
  display: none;
  opacity: 0;
}

/* Light mode: show moon icon (to switch to dark) */
[data-theme="light"] .sun-icon {
  display: none;
  opacity: 0;
}

[data-theme="light"] .moon-icon {
  display: block;
  opacity: 1;
  animation: spin-in 0.3s ease-in-out;
}

@keyframes spin-in {
  from {
    opacity: 0;
    transform: rotate(-90deg);
  }
  to {
    opacity: 1;
    transform: rotate(0deg);
  }
}

.app-content {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
  overflow-x: hidden;
  margin: 0 auto;
  width: 100%;
  max-width: 1200px;
}

.app-footer {
  background-color: var(--bg-color);
  padding: 1.5rem 2rem;
  box-shadow: var(--shadow-sm);
  border-top: 2px solid var(--border-color);
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
  flex-shrink: 0;
  margin-top: auto;
}

.footer-content {
  max-width: 1200px;
  margin: 0 auto;
}

.footer-content p {
  margin: 0.25rem 0;
}

.app-footer a {
  color: var(--accent-color);
  text-decoration: none;
  transition: var(--transition);
}

.app-footer a:hover,
.app-footer a:focus {
  color: var(--accent-secondary);
  text-decoration: underline;
  outline: none;
}

@media (max-width: 768px) {
  .app-header {
    padding: 0 1rem;
  }

  .app-nav {
    gap: 1rem;
  }

  .app-nav a {
    font-size: 0.875rem;
  }

  .app-content {
    padding: 1rem;
  }

  .app-footer {
    padding: 1rem;
    font-size: 0.75rem;
  }

  .app-logo {
    font-size: 1.5rem;
  }

  .app-controls {
    margin-left: 1rem;
  }

  .app-controls div {
    height: 32px;
    width: 32px;
  }

  .app-controls div svg {
    width: 16px;
    height: 16px;
  }

  .hero {
    margin: 2rem auto;
    padding: 1.5rem 1rem;
  }

  .hero h1 {
    font-size: 2.5rem;
  }

  .hero p {
    font-size: 1.1rem;
  }

  .hero-actions {
    flex-direction: column;
    width: 100%;
  }

  .hero-actions .app-button {
    width: 100%;
    max-width: 300px;
  }

  .search-box {
    min-width: 100%;
  }

  .filter-group {
    width: 100%;
  }

  .quick-links {
    grid-template-columns: 1fr;
  }

  .cta-section {
    padding: 1.5rem;
  }

  .cta-section h2 {
    font-size: 1.5rem;
  }

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

@media (max-width: 480px) {
  .app-header {
    padding: 0 0.75rem;
  }

  .app-nav {
    gap: 0.75rem;
    font-size: 0.8rem;
  }

  .app-nav a {
    padding: 0.25rem 0.5rem;
  }

  .app-logo {
    font-size: 1.25rem;
  }

  .app-content {
    padding: 1rem 0.75rem;
  }

  .app-footer {
    padding: 0.75rem;
    font-size: 0.7rem;
  }

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

  .hero p {
    font-size: 1rem;
  }
}

/* Selection styling */
::selection {
  background-color: var(--accent-color);
  color: var(--bg-color);
}

::-moz-selection {
  background-color: var(--accent-color);
  color: var(--bg-color);
}

/* Scrollbar styling */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg-color);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* Focus visible for accessibility */
*:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
}

/* Button reset */
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

/* Link focus state */
a:focus-visible {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
  border-radius: 2px;
}

/* Smooth transitions for theme changes */
*:where(:not(svg, svg *)) {
  transition-property: background-color, border-color, color, box-shadow;
  transition-duration: 0.3s;
  transition-timing-function: ease;
}

/* Disable transitions during page load */
.preload * {
  transition: none !important;
}

/* Loading animation */
@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.loading {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Utility classes */
.text-center {
  text-align: center;
}

.text-muted {
  color: var(--text-muted);
}

.text-accent {
  color: var(--accent-color);
}

.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mt-4 { margin-top: 2rem; }

.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }
.mb-3 { margin-bottom: 1.5rem; }
.mb-4 { margin-bottom: 2rem; }

.p-1 { padding: 0.5rem; }
.p-2 { padding: 1rem; }
.p-3 { padding: 1.5rem; }
.p-4 { padding: 2rem; }

/* Error and info messages */
.message {
  padding: 1rem 1.5rem;
  border-radius: var(--radius);
  margin: 1rem 0;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.95rem;
}

.message-info {
  background-color: rgba(88, 166, 255, 0.1);
  border: 1px solid var(--accent-color);
  color: var(--text-color);
}

.message-success {
  background-color: rgba(63, 185, 80, 0.1);
  border: 1px solid var(--success-color);
  color: var(--text-color);
}

.message-warning {
  background-color: rgba(210, 153, 34, 0.1);
  border: 1px solid #d29922;
  color: var(--text-color);
}

.message-error {
  background-color: rgba(248, 81, 73, 0.1);
  border: 1px solid var(--danger-color);
  color: var(--text-color);
}

/* Badge component */
.badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 12px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge-primary {
  background-color: var(--accent-color);
  color: var(--bg-color);
}

.badge-success {
  background-color: var(--success-color);
  color: var(--bg-color);
}

.badge-danger {
  background-color: var(--danger-color);
  color: var(--bg-color);
}

.badge-muted {
  background-color: var(--bg-accent);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

/* Skip to main content for accessibility */
.skip-to-main {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent-color);
  color: var(--bg-color);
  padding: 0.5rem 1rem;
  text-decoration: none;
  z-index: 1000;
  border-radius: 0 0 4px 0;
  font-weight: 600;
}

.skip-to-main:focus {
  top: 0;
}

/* Link styling */
.link {
  color: var(--accent-color);
  text-decoration: none;
  cursor: pointer;
  border-bottom: 1px solid transparent;
  transition: var(--transition);
}

.link:hover,
.link:focus {
  border-bottom-color: var(--accent-color);
  outline: none;
}

/* Button styles */
.app-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.875rem 1.75rem;
  border: 2px solid var(--accent-color);
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: var(--transition);
  line-height: 1;
  white-space: nowrap;
  font-family: inherit;
}

.app-button.primary {
  background-color: var(--accent-color);
  color: var(--bg-color);
}

.app-button.primary:hover,
.app-button.primary:focus {
  background-color: var(--accent-secondary);
  border-color: var(--accent-secondary);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.app-button.secondary {
  background-color: transparent;
  color: var(--accent-color);
}

.app-button.secondary:hover,
.app-button.secondary:focus {
  background-color: var(--bg-accent);
  transform: translateY(-2px);
}

.app-button:active {
  transform: translateY(0);
}

/* Hero section */
.hero {
  margin: 4rem auto 3rem;
  padding: 2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  position: relative;
  max-width: 800px;
}

.hero::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 800px;
  height: 400px;
  background: radial-gradient(
    ellipse at center,
    rgba(88, 166, 255, 0.15) 0%,
    transparent 70%
  );
  pointer-events: none;
  z-index: -1;
}

.hero h1 {
  font-size: 3.5rem;
  font-weight: 900;
  margin: 0 0 1.5rem;
  background: linear-gradient(135deg, var(--accent-color), var(--accent-secondary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  background-size: 200% auto;
  animation: gradient-shift 3s ease infinite;
  line-height: 1.2;
}

@keyframes gradient-shift {
  0%, 100% {
    background-position: 0% 50%;
  }
  50% {
    background-position: 100% 50%;
  }
}

.hero p {
  font-size: 1.25rem;
  color: var(--text-muted);
  max-width: 600px;
  line-height: 1.7;
  text-align: center;
}

/* Hero action buttons */
.hero-actions {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}