:root {
  --bg-color: #0d1117;
  --bg-bright-color: #161b22;
  --bg-accent: #1c2128;
  --i18n-overlay: #1b2128;
  --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;
  --i18n-overlay: #f0f2f4;
  --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;
  position: relative; /* anchor dropdowns inside controls */
}

.app-controls div:not(.lang-container) {
  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:not(.lang-option) {
  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);
  outline: none;
  overflow: hidden;
  flex-shrink: 0;
}

.app-controls button:not(.lang-option):hover,
.app-controls div:not(.lang-container):hover {
  border-color: var(--accent-color);
  background-color: var(--bg-accent);
  transform: scale(1.08);
}

.app-controls button:not(.lang-option):active,
.app-controls div:not(.lang-container):active {
  transform: scale(0.96);
}

.app-controls button:not(.lang-option) svg,
.app-controls div:not(.lang-container) svg {
  width: 20px;
  height: 20px;
  transition: var(--transition);
  stroke: var(--text-muted);
  pointer-events: none;
}

/* Make the language toggle icon use the main text color for better contrast
   and highlight with accent color on hover/focus. More specific selector
   overrides the generic .app-controls button svg stroke. */
#lang-change svg {
  stroke: var(--text-color);
  width: 20px !important;
  height: 20px !important;
  flex-shrink: 0;
}

#lang-change:hover svg,
#lang-change:focus svg {
  stroke: var(--accent-color);
}

/* Ensure currentColor is set on the button so SVGs using stroke="currentColor"
   inherit the intended color. Use !important to override other color rules if needed. */
#lang-change {
  /* Match the theme-toggle default icon color (muted text) */
  color: var(--text-muted) !important;
}

#lang-change:hover,
#lang-change:focus {
  color: var(--accent-color) !important;
}

/* Language dropdown — hidden by default, positioned by JS on desktop */
.lang-container {
  display: none;
  position: fixed; /* JS overrides top/left on desktop; mobile CSS overrides to bottom-sheet */
  min-width: 160px;
  max-width: 260px;
  background-color: var(--bg-bright-color);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  box-shadow: var(--shadow);
  flex-direction: column;
  padding: 0.25rem 0;
  z-index: 9000;
  max-height: 60vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  cursor: default;
}

.lang-container.open {
  display: flex;
}

.lang-option {
  background: none;
  border: none;
  text-align: left;
  padding: 0.6rem 1rem;
  width: 100%;
  display: block;
  font-size: 0.9rem;
  color: var(--text-color);
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}

.lang-option:hover,
.lang-option:focus {
  background-color: var(--bg-accent);
  color: var(--accent-color);
  outline: none;
  transform: none !important;
}

/* Language picker backdrop (mobile) */
.lang-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1399;
  cursor: pointer;
}
.lang-backdrop.open {
  display: block;
}

.app-controls button:not(.lang-option):hover svg,
.app-controls div:not(.lang-container):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;
}

/* ===== Mobile Menu Toggle (hamburger) ===== */
.mobile-menu-toggle {
  display: none; /* hidden on desktop */
  background: none;
  border: none;
  padding: 0.5rem;
  margin-left: auto;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  z-index: 201;
}

.mobile-menu-toggle {
  /* ensure a consistent touch target so the cross appears centered visually */
  width: 44px;
  height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mobile-menu-toggle svg {
  width: 24px;
  height: 24px;
  stroke: var(--text-color);
  transition: var(--transition);
  display: block;
}

/* Ensure SVG children transform correctly around the SVG center */
.mobile-menu-toggle svg,
.mobile-menu-toggle svg * {
  transform-box: fill-box;
  /* percent-based center works regardless of svg size */
  transform-origin: 50% 50%;
  stroke-linecap: round;
}

.mobile-menu-toggle:hover svg,
.mobile-menu-toggle:focus svg {
  stroke: var(--accent-color);
}

/* Hamburger → X animation */
.mobile-menu-toggle .hamburger-top,
.mobile-menu-toggle .hamburger-mid,
.mobile-menu-toggle .hamburger-bot {
  transition: transform 0.22s cubic-bezier(.2,.9,.3,1), opacity 0.18s ease;
  will-change: transform, opacity;
  transform-origin: 50% 50%;
}
/* Ensure mid line has explicit starting transform so scale animates smoothly */
.mobile-menu-toggle .hamburger-mid {
  transform-origin: center;
  transform: scaleX(1);
}

.mobile-menu-open .mobile-menu-toggle .hamburger-top {
  transform: translateY(6px) rotate(45deg);
}

.mobile-menu-open .mobile-menu-toggle .hamburger-mid {
  transform: scaleX(0);
  opacity: 0;
}

.mobile-menu-open .mobile-menu-toggle .hamburger-bot {
  transform: translateY(-6px) rotate(-45deg);
}

.mobile-menu-toggle:focus {
  outline: 2px solid var(--accent-color);
  outline-offset: 2px;
  border-radius: 6px;
}

/* Mobile menu overlay backdrop */
.mobile-menu-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 149;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  -webkit-tap-highlight-color: transparent;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.3s ease, visibility 0s 0.3s;
}

.mobile-menu-open .mobile-menu-overlay {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transition: opacity 0.3s ease, visibility 0s 0s;
}

/* ===== Mobile Sidebar Toggle (project pages) ===== */
.mobile-sidebar-toggle {
  display: none; /* hidden on desktop */
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  background-color: var(--bg-bright-color);
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  color: var(--accent-color);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  margin-bottom: 1rem;
  -webkit-tap-highlight-color: transparent;
  transition: var(--transition);
}

.mobile-sidebar-toggle svg {
  width: 18px;
  height: 18px;
  stroke: var(--accent-color);
  flex-shrink: 0;
}

.mobile-sidebar-toggle:hover,
.mobile-sidebar-toggle:focus {
  border-color: var(--accent-color);
  background-color: var(--bg-accent);
}

/* Mobile sidebar overlay */
.mobile-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 199;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
}

/* ===== Tap highlight removal for mobile ===== */
@media (pointer: coarse) {
  a, button, [role="button"], select, input, textarea {
    -webkit-tap-highlight-color: transparent;
  }
}

/* ===== Safe area insets for notched devices ===== */
@supports (padding: env(safe-area-inset-top)) {
  .app-header {
    padding-left: max(2rem, env(safe-area-inset-left));
    padding-right: max(2rem, env(safe-area-inset-right));
  }

  .app-content {
    padding-left: max(2rem, env(safe-area-inset-left));
    padding-right: max(2rem, env(safe-area-inset-right));
  }

  .app-footer {
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom));
    padding-left: max(2rem, env(safe-area-inset-left));
    padding-right: max(2rem, env(safe-area-inset-right));
  }
}

/* ===== Tablet breakpoint (≤1024px) ===== */
@media (max-width: 1024px) {
  .app-content {
    max-width: 100%;
  }

  .hero h1 {
    font-size: 3rem;
  }
}

/* ===== Mobile breakpoint (≤768px) ===== */
@media (max-width: 768px) {
  /* Header layout — z-index must be above the mobile overlay (149)
     so that the fixed nav drawer inside is not covered by it */
  .app-header {
    padding: 0 1rem;
    height: 60px;
    z-index: 200;
  }

  .app-logo {
    font-size: 1.4rem;
  }

  /* Show hamburger toggle */
  .mobile-menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    order: 10; /* push to right side */
  }

  /* Nav becomes a slide-down drawer */
  .app-nav {
    position: fixed;
    top: 60px; /* below header */
    left: 0;
    right: 0;
    background-color: var(--bg-color);
    border-bottom: 2px solid var(--border-color);
    flex-direction: column;
    gap: 0;
    padding: 0;
    margin: 0;
    z-index: 150;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: max-height 0.35s ease, opacity 0.3s ease, visibility 0s 0.35s;
    box-shadow: var(--shadow);
  }

  .mobile-menu-open .app-nav {
    max-height: 320px;
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transition: max-height 0.35s ease, opacity 0.3s ease, visibility 0s 0s;
  }
  /* Allow scrolling inside the mobile nav when content exceeds max-height */
  .app-nav {
    -webkit-overflow-scrolling: touch;
    overflow-y: auto;
  }

  .app-nav a {
    display: flex;
    align-items: center;
    padding: 1rem 1.5rem;
    font-size: 1rem;
    font-weight: 500;
    color: var(--text-color);
    border-bottom: 1px solid var(--border-color);
    min-height: 48px; /* touch target */
    width: 100%;
  }

  .app-nav a:last-child {
    border-bottom: none;
  }

  .app-nav a::after {
    display: none; /* remove underline hover effect in mobile drawer */
  }

  .app-nav a:hover,
  .app-nav a:focus {
    color: var(--accent-color);
    background-color: var(--bg-accent);
  }

  .app-nav a:active {
    background-color: var(--bg-accent);
    color: var(--accent-color);
  }

  /* Controls remain in header */
  .app-controls {
    margin-left: auto;
    margin-right: 0.5rem;
    gap: 0.5rem;
  }

  .app-controls button:not(.lang-option),
  .app-controls div:not(.lang-container) {
    height: 36px;
    width: 36px;
    min-height: 44px; /* touch target */
    min-width: 44px;
  }

  .app-controls button svg,
  .app-controls div svg {
    width: 18px;
    height: 18px;
  }

  /* Content area */
  .app-content {
    padding: 1rem;
  }

  /* Footer */
  .app-footer {
    padding: 1rem;
    font-size: 0.8rem;
  }

  /* Hero section */
  .hero {
    margin: 2rem auto;
    padding: 1.5rem 1rem;
  }

  .hero h1 {
    font-size: 2.25rem;
  }

  .hero p {
    font-size: 1.05rem;
  }

  .hero-actions {
    flex-direction: column;
    width: 100%;
    gap: 0.75rem;
  }

  .hero-actions .app-button {
    width: 100%;
    max-width: 320px;
    min-height: 48px; /* touch target */
  }

  /* Buttons: bigger touch targets */
  .app-button {
    padding: 0.75rem 1.5rem;
    min-height: 48px;
    font-size: 0.95rem;
  }

  /* Messages */
  .message {
    font-size: 0.9rem;
    padding: 0.75rem 1rem;
  }

  /* Lang container on mobile — slide-up bottom-sheet */
  .lang-container {
    min-width: 160px;
    max-width: 240px;
    z-index: 1400;
  }

  .lang-container.open {
    display: flex;
  }

  .lang-option {
    padding: 0.9rem 1.25rem;
    min-height: 48px;
    font-size: 1rem;
    display: flex;
    align-items: center;
    width: 100%;
    background: transparent;
    border: none;
    text-align: left;
    color: var(--text-color);
    border-bottom: 1px solid rgba(0,0,0,0.06);
  }

.lang-option:last-child {
  border-bottom: none;
}

  /* Show mobile sidebar toggle on project pages */
  .mobile-sidebar-toggle {
    display: flex;
  }
}

/* ===== Small phone breakpoint (≤480px) ===== */
@media (max-width: 480px) {
  .app-header {
    padding: 0 0.75rem;
    height: 56px;
    z-index: 200;
  }

  .app-nav {
    top: 56px;
  }

  .app-logo {
    font-size: 1.2rem;
  }

  .app-content {
    padding: 0.75rem;
  }

  .app-footer {
    padding: 0.75rem;
    font-size: 0.7rem;
  }

  .hero {
    margin: 1.5rem auto;
    padding: 1rem 0.5rem;
  }

  .hero h1 {
    font-size: 1.85rem;
  }

  .hero p {
    font-size: 0.95rem;
  }

  .hero-actions .app-button {
    max-width: 100%;
  }

  .app-controls {
    gap: 0.25rem;
    margin-right: 0.25rem;
  }

  .app-controls button:not(.lang-option),
  .app-controls div:not(.lang-container) {
    height: 32px;
    width: 32px;
    min-height: 44px;
    min-width: 44px;
  }
}

/* ===== Landscape phone ===== */
@media (max-width: 768px) and (orientation: landscape) {
  .app-nav {
    max-height: 0;
  }

  .mobile-menu-open .app-nav {
    max-height: 200px;
    overflow-y: auto;
  }

  .app-nav a {
    padding: 0.75rem 1.5rem;
    min-height: 44px;
  }

  .hero {
    margin: 1rem auto;
  }

  .hero h1 {
    font-size: 2rem;
  }
}

/* ===== Prevent body scroll when mobile menu is open ===== */
.mobile-menu-open {
  overflow: hidden;
}

/* ===== Touch-friendly hover states (no hover on touch devices) ===== */
@media (hover: none) {
  .app-nav a::after {
    display: none;
  }

  .app-controls button:hover,
  .app-controls div:hover {
    transform: none;
  }

  .app-button.primary:hover,
  .app-button.secondary:hover {
    transform: none;
  }
}

/* Selection styling */
.i18n-loading {
  position: relative;
  display: inline-block;
  width: auto;
  max-width: 100%;
  min-width: 0;
  height: auto;
  min-height: 1em;
  border-radius: 4px;
  overflow: hidden;
}

/* Overlay placeholder shown while localization is loading.
   Uses ::before to render a blurred/lightened block with optional placeholder text
   and ::after for the moving shimmer. When loaded, both pseudo-elements are hidden. */
.i18n-loading::before {
  content: attr(data-i18n-placeholder, ' ');
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0.125em 0.25em;
  box-sizing: border-box;
  backdrop-filter: blur(6px) brightness(1.06);
  -webkit-backdrop-filter: blur(6px) brightness(1.06);
  background-color: rgba(255, 255, 255, 0.06);
  color: transparent !important;
  pointer-events: none;
}

.i18n-loading::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 10001;
  pointer-events: none;
  /* softer multi-stop gradient with wider size to avoid visible edge */
  background: linear-gradient(90deg,
    rgba(255,255,255,0) 0%,
    rgba(255,255,255,0.06) 25%,
    rgba(255,255,255,0.14) 50%,
    rgba(255,255,255,0.06) 75%,
    rgba(255,255,255,0) 100%);
  background-size: 100% 100%;
  background-position: 100% 0;
  filter: blur(4px);
  animation: i18n-shimmer 1.1s linear infinite;
}

@keyframes i18n-shimmer {
  0% { background-position: -150% 0; }
  60% { background-position: 40% 0; }
  80% { background-position: 85% 0; }
  100% { background-position: 100% 0; }
}

/* Hide the overlay once the localized value is applied */
.i18n-loading[data-i18n-loaded="true"]::before,
.i18n-loading[data-i18n-loaded="true"]::after {
  display: none;
}

/* Light theme variant for slightly darker overlay */
[data-theme="light"] .i18n-loading::before {
  backdrop-filter: blur(6px) brightness(1.02);
  -webkit-backdrop-filter: blur(6px) brightness(1.02);
  /* Midpoint overlay between white and previous darker value */
  background-color: rgba(250, 250, 250, 0.95) !important;
  mix-blend-mode: normal !important;
  z-index: 10002;
}
/* NOTE: lang-container styles are defined earlier (desktop popup)
   and in the mobile media query (bottom-sheet). Removed duplicate
   definitions here to avoid conflicting rules that broke height. */
*: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) !important;
}

.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;
}

/* Localization loading shimmer */
.i18n-loading {
  position: relative;
  display: inline-block;
  width: auto;
  max-width: 100%;
  min-width: 0;
  height: auto;
  min-height: 1em;
  border-radius: 4px;
  overflow: hidden;
  background-color: rgba(255, 255, 255, 0.03);
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
  text-shadow: none !important;
  caret-color: transparent !important;
  user-select: none;
}

/* Make sure nested text nodes are hidden while loading */
.i18n-loading * {
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
}

/* Hide SVGs and images inside loading placeholders to avoid icon glow */
.i18n-loading svg,
.i18n-loading img {
  opacity: 0 !important;
  fill: transparent !important;
  stroke: transparent !important;
}

/* Prevent box-shadows / outlines on loading placeholders */
.i18n-loading,
.i18n-loading * {
  box-shadow: none !important;
  text-shadow: none !important;
  outline: none !important;
}

.i18n-loading::before {
  content: '';
  position: absolute;
  inset: 0;
  backdrop-filter: blur(6px) brightness(1.06);
  -webkit-backdrop-filter: blur(6px) brightness(1.06);
  background-color: rgba(255, 255, 255, 0.06);
  pointer-events: none;
}

/* Light theme: use subtle dark overlay so shimmer is still visible */
[data-theme="light"] .i18n-loading::before {
  backdrop-filter: blur(6px) brightness(0.98);
  -webkit-backdrop-filter: blur(6px) brightness(0.98);
  background-color: rgba(0, 0, 0, 0.04);
}

.i18n-loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100% !important;
  height: 100% !important;
  width: 300% !important;
  z-index: 10003 !important;
  pointer-events: none;
}

@keyframes i18n-shimmer {
  from { transform: translateX(-100%); }
  to   { transform: translateX(100%); }
}

/* Remove loading visuals once localized */
.i18n-loading[data-i18n-loaded="true"] {
  background: transparent;
  color: inherit !important;
  -webkit-text-fill-color: inherit !important;
  user-select: text;
}
.i18n-loading[data-i18n-loaded="true"]::after,
.i18n-loading[data-i18n-loaded="true"]::before {
  display: none;
}
.i18n-loading[data-i18n-loaded="true"] * {
  color: inherit !important;
  -webkit-text-fill-color: inherit !important;
}

/* Attribute-based i18n overlay (works with JS data attributes)
   Shows ::before placeholder and ::after shimmer while [data-i18n-loading]
   and hides immediately when [data-i18n-loaded] is present. */
[data-i18n-loading] {
  position: relative;
  display: inline-block;
  width: auto;
  max-width: 100%;
  min-width: 0;
  min-height: 1em;
  border-radius: 4px;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  caret-color: transparent;
}

[data-i18n-loading]::before {
  content: attr(data-i18n-placeholder, '...');
  position: absolute;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0.125em 0.25em;
  box-sizing: border-box;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  background-color: var(--i18n-overlay);
  color: transparent;
  /* capture pointer events so underlying text cannot be selected or clicked */
  pointer-events: auto;
}

[data-i18n-loading]::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 10001;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.12) 50%, rgba(255,255,255,0) 100%);
  background-size: 200% 100%;
  background-position: -100% 0;
  filter: blur(4px);
  animation: i18n-shimmer 1.6s linear infinite;
}

/* Hide overlays when loaded flag is set */
[data-i18n-loaded="true"]::before,
[data-i18n-loaded="true"]::after {
  display: none !important;
}

/* Light theme variant */
[data-theme="light"] [data-i18n-loading]::before {
  backdrop-filter: blur(6px) brightness(1.02);
  -webkit-backdrop-filter: blur(6px) brightness(1.02);
  /* Midpoint overlay between white and previous darker value */
  background-color: rgba(250, 250, 250, 0.95) !important;
  mix-blend-mode: normal !important;
  z-index: 10002;
  pointer-events: none !important;
}

/* ensure nested content doesn't visually clash while overlay is present */
[data-i18n-loading] * {
  color: transparent !important;
  -webkit-text-fill-color: transparent !important;
}

[data-i18n-loading] svg,
[data-i18n-loading] img {
  opacity: 0 !important;
}

/* Consolidated i18n-loading fixes (override earlier duplicated rules)
   - Ensure a single, predictable shimmer animation
   - Prevent overlays from blocking interactions by default
   - Force animations and pseudo-elements to stop when loaded
*/

@keyframes i18n-shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* Prefer attribute-based overlays (localizator uses data-i18n-loading / data-i18n-loaded)
   Make overlays non-blocking so they don't prevent clicks unless explicitly desired. */
[data-i18n-loading]::after,
.i18n-loading::after {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  left: -100% !important;
  height: 100% !important;
  width: 300% !important;
  z-index: 10001 !important;
  pointer-events: none !important;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.14) 50%, rgba(255,255,255,0) 100%) !important;
  filter: blur(4px) !important;
  /* start off-screen to the left so keyframes can translate it across */
  transform: translateX(-100%);
  animation: i18n-shimmer 1.2s linear infinite !important;
  will-change: transform !important;
}
[data-i18n-loaded="true"]::before,
[data-i18n-loaded="true"]::after,
.i18n-loading[data-i18n-loaded="true"]::before,
.i18n-loading[data-i18n-loaded="true"]::after {
  display: none !important;
  animation: none !important;
}

/* Restore content visibility when loaded (stronger override) */
[data-i18n-loaded="true"],
.i18n-loading[data-i18n-loaded="true"] {
  background: transparent !important;
  color: inherit !important;
  -webkit-text-fill-color: inherit !important;
  user-select: text !important;
}

/* Ensure nested content is visible once loaded */
[data-i18n-loaded="true"] *,
.i18n-loading[data-i18n-loaded="true"] * {
  color: inherit !important;
  -webkit-text-fill-color: inherit !important;
  opacity: 1 !important;
}

/* If script ever removes data attribute but a class remained, stop animations on the class as well */
.i18n-loading::after {
  animation-play-state: running;
}

/* Strong override: single, visible transform-based shimmer for all i18n placeholders
   This block intentionally uses specific geometry and no background-position animations
   so the shimmer translates smoothly across the element without a reset jerk. */
.i18n-loading::after,
[data-i18n-loading]::after {
  content: '' !important;
  position: absolute !important;
  top: 0 !important;
  left: -100% !important;
  height: 100% !important;
  width: 300% !important;
  z-index: 10001 !important;
  pointer-events: none !important;
  background: linear-gradient(90deg, rgba(255,255,255,0) 0%, rgba(255,255,255,0.14) 50%, rgba(255,255,255,0) 100%) !important;
  filter: blur(4px) !important;
  /* let the keyframes drive transform; don't force with !important */
  transform: none;
  animation: i18n-shimmer 1.2s linear infinite !important;
  will-change: transform !important;
}

/* Light theme: use a dark shimmer so it shows above the light overlay */
[data-theme="light"] .i18n-loading::after,
[data-theme="light"] [data-i18n-loading]::after,
[data-theme="light"] .i18n-loading::after,
[data-theme="light"] [data-i18n-loading]::after {
  background: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,0.12) 50%, rgba(0,0,0,0) 100%) !important;
  filter: blur(4px) !important;
  z-index: 10004 !important;
  animation-duration: 1.2s !important;
}

