/* Import Orbitron font for site title */
@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@300..700&display=swap');

/* Apply Orbitron font to all text elements */
body, html, input, textarea, button, select {
  font-family: "Space Grotesk", monospace !important;
}

/* Site title styling */
.site-title {
  /* Use the main sans font for legibility instead of the display Orbitron font */
  font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-weight: 700;
  font-size: 1.15rem; /* slightly reduced to avoid forced wrapping */
  margin-left: 0.5rem;
  background: linear-gradient(135deg, #0074e0 0%, #5f1bbf 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-decoration: none;
  letter-spacing: normal !important;
  transition: all 0.22s ease;
  text-transform: none !important;
  line-height: 1.12;
  white-space: normal;
  word-break: normal;
  max-width: 100%;
  text-shadow: none !important;
  display: inline-block;
}

.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  transition: transform 0.2s ease;
}

.logo:hover {
  transform: scale(1.05);
}

.logo:hover .site-title {
  background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

/* Dark mode support for site title */
@media (prefers-color-scheme: dark) {
  .site-title {
    background: linear-gradient(135deg, #00d4ff 0%, #ff00ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
  
  .logo:hover .site-title {
    background: linear-gradient(135deg, #ff00ff 0%, #00d4ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
  }
}

/* Responsive adjustments for site title */
@media (max-width: 768px) {
  .site-title {
    font-size: 1.05rem !important;
    margin-left: 0.5rem;
    letter-spacing: normal !important;
    line-height: 1.08;
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .site-title {
    font-size: 0.98rem !important;
    margin-left: 0.4rem;
    letter-spacing: normal !important;
    line-height: 1.08;
  }
}

.project-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin: 2rem 0;
}
.tile {
  background: #f5f5f5;
  border-radius: 8px;
  padding: 1rem;
  width: 250px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
  transition: transform 0.2s;
}
.tile:hover {
  transform: translateY(-5px) scale(1.03);
}

.project-list {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: flex-start;
  margin-top: 2rem;
}
.project-item {
  background: #f5f5f5;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.07);
  padding: 1.5rem 1.2rem;
  width: 270px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.18s, box-shadow 0.18s;
}
.project-item:hover {
  transform: translateY(-6px) scale(1.03);
  box-shadow: 0 6px 18px rgba(0,0,0,0.13);
}
.project-item h2 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
}
.project-item p {
  margin-bottom: 0;
  color: #444;
}
a, .post-item-summary a, li a {
  /* Allow links to wrap normally so long strings don't force horizontal scrolling */
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  text-decoration: none;
}
@media (max-width: 700px) {
  .project-list {
    flex-direction: column;
    gap: 1.2rem;
  }
  .project-item {
    width: 100%;
    min-width: 0;
    min-height: unset;
  }
  .project-card {
    min-height: unset;
    padding-bottom: 1rem;
  }
  
  .project-tiles {
    gap: 1rem;
  }
  
  .tile {
    width: 100%;
    max-width: 100%;
  }
}

/* Enhanced project cards with arrow icons */
.project-card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.project-card {
  background: #f8f9fa;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid #e9ecef;
  cursor: pointer;
  overflow: hidden;
  width: 100%;
  box-sizing: border-box;
}

.project-card-link:hover .project-card {
  transform: translateY(-4px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.15);
}

.project-header {
  margin-bottom: 1rem;
}

.project-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.project-type {
  background: #2563eb;
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.project-date {
  color: #6c757d;
  font-size: 0.85rem;
  font-weight: 500;
}

.project-title {
  margin: 0;
  font-size: 1.3rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #141313!important;
  transition: color 0.2s ease;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.project-card-link:hover .project-title {
  color: #2563eb!important;
}

.arrow-icon {
  width: 20px;
  height: 20px;
  transition: transform 0.2s ease;
  opacity: 0.6;
  flex-shrink: 0;
}

.project-card-link:hover .arrow-icon {
  transform: translateX(4px);
  opacity: 1;
}

.project-description {
  margin-top: 0.75rem;
  padding-left: 1.5rem;
}

.project-summary {
  margin: 0;
  color: #42494f;
  font-size: 0.95rem;
  line-height: 1.5;
  word-break: break-word;
  overflow-wrap: break-word;
  hyphens: auto;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-bottom: 0.25rem;
}

@media (max-width: 700px) {
  .project-card {
    padding: 1.25rem;
    margin-bottom: 1.25rem;
  }
  
  .project-title {
    font-size: 1.2rem;
    white-space: normal;
    word-break: break-word;
    hyphens: auto;
  }
  
  .arrow-icon {
    width: 16px;
    height: 16px;
  }
}

/* Projects page enhancements */
.projects-intro {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 12px;
  padding: 2rem;
  margin: 2rem 0;
  border-left: 4px solid #2563eb;
}

/* --- Buttons & hero CTA --- */
.hero-cta {
  margin: 1rem 0 0.5rem 0;
  display: flex;
  gap: .75rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .65rem 1.05rem;
  border-radius: 12px;
  font-weight: 700;
  line-height: 1;
  border: 1px solid transparent;
  text-decoration: none !important;
  cursor: pointer;
  user-select: none;
  transition: transform .12s cubic-bezier(.2,.9,.2,1), box-shadow .18s ease, background-color .18s ease, border-color .18s ease, opacity .12s ease;
  will-change: transform, box-shadow;
  -webkit-tap-highlight-color: transparent;
}
.btn:hover { transform: translateY(-3px); }
.btn:active { transform: translateY(-1px) scale(.997); }
.btn:focus { outline: none; }
.btn:focus-visible { box-shadow: 0 0 0 4px rgba(37,99,235,0.18); }

.btn-primary {
  background: linear-gradient(90deg,#111 0%, #333 100%);
  color: #fff !important;
  border-color: transparent;
  box-shadow: 0 6px 24px rgba(0,0,0,0.20);
}
.btn-primary:hover { box-shadow: 0 10px 30px rgba(34,34,34,0.16); opacity: 0.98 }

.btn-outline {
  background: transparent;
  color: #222 !important; /* used outside dark hero areas */
  border-color: rgba(34,34,34,0.14);
  transition: color .14s ease, background-color .14s ease, border-color .14s ease;
}
.btn-outline:hover { border-color: rgba(34,34,34,0.28); background: rgba(0,0,0,0.03); }

.btn-ghost {
  background: transparent;
  color: rgba(34,34,34,0.85) !important;
  border-color: transparent;
}
.btn-ghost:hover {
  background: rgba(0,0,0,0.03);
}

/* Variant for outline buttons placed on dark/gradient hero backgrounds */
.hero-cta .btn-outline {
  color: #f9fafb !important; /* near-white for strong contrast */
  border-color: rgba(255,255,255,0.12);
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
}
.hero-cta .btn-outline:hover {
  background: rgba(255,255,255,0.06);
  border-color: rgba(255,255,255,0.20);
}

/* Stronger focus ring for accessibility */
.btn:focus-visible {
  box-shadow: 0 0 0 4px rgba(99,102,241,0.22); /* indigo focus ring */
}

/* Make CTA buttons stack and grow on very small screens */
@media (max-width: 600px) {
  .hero-cta { flex-direction: column; gap: .5rem; }
  .hero-cta .btn { width: 100%; padding: .85rem 1rem; font-size: 1rem; }
}

/* Form helpers */
.form-grid { display: grid; gap: .85rem; max-width: 680px }
.form-grid label { font-weight: 600; color: #e5e7eb; display:block }
.form-grid input, .form-grid textarea {
  width: 100%;
  padding: .65rem .8rem;
  border-radius: 10px;
  border: 1px solid #2d2f36;
  background: rgba(15,17,21,0.85);
  color: #e6edf3;
  outline: none;
}
.form-grid input:focus, .form-grid textarea:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 3px rgba(79,70,229,0.25);
}
.form-grid button.btn { width: fit-content; padding-left: 1.1rem; padding-right: 1.1rem }
.hidden-field { display:none }

.projects-intro p {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.6;
  color: #495057;
}

.projects-stats {
  display: flex;
  justify-content: center;
  gap: 3rem;
  margin: 2rem 0 3rem 0;
  padding: 1.5rem;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

.stat-item {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.stat-number {
  font-size: 2.5rem;
  font-weight: 700;
  color: #2563eb;
  line-height: 1;
}

.stat-label {
  font-size: 0.9rem;
  color: #6c757d;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 500;
}

@media (max-width: 700px) {
  .projects-intro {
    padding: 1.5rem;
    margin: 1.5rem 0;
  }
  
  .projects-stats {
    gap: 2rem;
    padding: 1.25rem;
  }
  
  .stat-number {
    font-size: 2rem;
  }
  
  .stat-label {
    font-size: 0.8rem;
  }
}

/* Additional mobile breakpoints for better responsiveness */
@media (max-width: 600px) {
  .projects-stats {
    flex-direction: column;
    gap: 1.5rem;
    padding: 1rem;
  }
  
  .stat-item {
    flex-direction: row;
    justify-content: center;
    gap: 1rem;
  }
  
  .stat-number {
    font-size: 1.8rem;
  }
  
  .stat-label {
    font-size: 0.85rem;
    text-align: left;
  }
}

@media (max-width: 480px) {
  .projects-intro {
    padding: 1rem;
    margin: 1rem 0;
  }
  
  .projects-intro p {
    font-size: 1rem;
  }
  
  .projects-stats {
    padding: 0.75rem;
    margin: 1.5rem 0 2rem 0;
  }
  
  .stat-number {
    font-size: 1.5rem;
  }
  
  .stat-label {
    font-size: 0.8rem;
  }
}

/* Enhanced Language Selector */
.language-selector {
  position: relative;
  display: inline-block;
}

.lang-toggle {
  cursor: pointer;
  user-select: none;
  outline: none;
  transition: all 0.2s ease;
}

.current-lang {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  transition: all 0.2s ease;
  min-width: 70px;
  justify-content: space-between;
}

.lang-toggle:hover .current-lang {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(0, 0, 0, 0.2);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.flag-icon {
  font-size: 1.1rem;
  line-height: 1;
}

.lang-text {
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.dropdown-arrow {
  font-size: 0.7rem;
  transition: transform 0.2s ease;
  opacity: 0.7;
}

.lang-toggle[aria-expanded="true"] .dropdown-arrow {
  transform: rotate(180deg);
}

.lang-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  background: white;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: all 0.2s ease;
  z-index: 1000;
  /* Ensure dropdown is wide enough for full language names and prevent wrapping */
  min-width: 180px;
  box-sizing: border-box;
  white-space: nowrap;
  overflow: hidden;
}

.lang-toggle[aria-expanded="true"] .lang-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-option {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 1rem;
  text-decoration: none;
  color: #333;
  transition: background-color 0.2s ease;
  border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.lang-option:last-child {
  border-bottom: none;
}

.lang-option:hover {
  background-color: #f8f9fa;
  color: #2563eb;
}

.lang-option .lang-text {
  font-size: 0.9rem;
  font-weight: 500;
  /* Prevent language names from breaking across lines; ellipsize if extremely long */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

/* Mobile responsive adjustments */
@media (max-width: 768px) {
  .language-selector {
    order: -1;
  }
  
  .current-lang {
    padding: 0.3rem 0.6rem;
    min-width: 60px;
  }
  
  .lang-text {
    font-size: 0.8rem;
  }
  
  .lang-dropdown {
    right: -10px;
    /* allow a bit more room on smaller screens while still preventing awkward wrapping */
    min-width: 140px;
    white-space: nowrap;
  }
  
  .lang-option {
    padding: 0.6rem 0.8rem;
  }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
  .current-lang {
    background: rgba(0, 0, 0, 0.2);
    border-color: rgba(255, 255, 255, 0.2);
    color: #fff;
  }
  
  .lang-toggle:hover .current-lang {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.3);
  }
  
  .lang-dropdown {
    background: #2d3748;
    border-color: rgba(255, 255, 255, 0.2);
  }
  
  .lang-option {
    color: #e2e8f0;
    border-bottom-color: rgba(255, 255, 255, 0.1);
  }
  
  .lang-option:hover {
    background-color: #4a5568;
    color: #90cdf4;
  }
}

/* 404 Page Styling */
.main-404 h1 {
  font-family: 'Orbitron', monospace;
  font-weight: 700;
  font-size: 2.5rem;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 1.5rem;
  animation: glow 2s ease-in-out infinite alternate;
}

.main-404 pre {
  color: #667eea;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
  animation: float 3s ease-in-out infinite;
}

.main-404 p {
  font-size: 1.1rem;
  margin-top: 2rem;
  color: #666;
}

.main-404 a {
  color: #667eea;
  text-decoration: none;
  font-weight: 600;
  padding: 0.5rem 1rem;
  border: 2px solid #667eea;
  border-radius: 25px;
  transition: all 0.3s ease;
  display: inline-block;
  margin-top: 1rem;
}

.main-404 a:hover {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(102, 126, 234, 0.3);
}

@keyframes glow {
  from {
    text-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
  }
  to {
    text-shadow: 0 0 30px rgba(118, 75, 162, 0.5);
  }
}

@keyframes float {
  0%, 100% {
    transform: translateY(0px);
  }
  50% {
    transform: translateY(-10px);
  }
}

/* Dark mode support for 404 page */
@media (prefers-color-scheme: dark) {
  .main-404 h1 {
    background: linear-gradient(135deg, #00d4ff 0%, #ff00ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
  
  .main-404 pre {
    color: #00d4ff;
    text-shadow: 0 0 10px rgba(0, 212, 255, 0.3);
  }
  
  .main-404 p {
    color: #e2e8f0;
  }
  
  .main-404 a {
    color: #00d4ff;
    border-color: #00d4ff;
  }
  
  .main-404 a:hover {
    background: linear-gradient(135deg, #00d4ff 0%, #ff00ff 100%);
    color: white;
    box-shadow: 0 5px 15px rgba(0, 212, 255, 0.3);
  }
  
  @keyframes glow {
    from {
      text-shadow: 0 0 20px rgba(0, 212, 255, 0.3);
    }
    to {
      text-shadow: 0 0 30px rgba(255, 0, 255, 0.5);
    }
  }
}

/* Responsive adjustments for 404 page */
@media (max-width: 768px) {
  .main-404 h1 {
    font-size: 2rem;
  }
  
  .main-404 pre {
    font-size: 1rem;
  }
  
  .main-404 p {
    font-size: 1rem;
  }
}

@media (max-width: 700px) {
  nav ul li, .mobile-menu li, .mobile-menu a {
    margin: 1.2rem 0 !important;
    display: block;
    text-align: center;
  }
}

/* Mobile form and overscroll fixes */
@media (max-width: 700px) {
  /* Ensure containers don't overflow horizontally */
  .projects-intro,
  .projects-stats,
  .project-card,
  .project-item,
  .tile {
    box-sizing: border-box;
    max-width: 100%;
    overflow-x: hidden;
  }
  
  /* Fix any potential horizontal scroll issues */
  body {
    overflow-x: hidden;
  }
  
  /* Make sure flex containers wrap properly */
  .project-list,
  .project-tiles {
    width: 100%;
  }
  
  /* Ensure form grid stacks and uses full width on small screens */
  .form-grid {
    max-width: 100%;
    padding: 0 1rem;
    grid-template-columns: 1fr;
  }

  .form-grid input,
  .form-grid textarea,
  .form-grid button,
  .form-grid label {
    width: 100%;
    box-sizing: border-box;
  }

  .form-grid button.btn {
    width: 100%;
    padding-left: 1rem;
    padding-right: 1rem;
    margin-top: 0.5rem;
  }

  .hero-cta {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* Sticky footer and content-fill fixes
   - Make body a column flex container so the main content grows and footer sits at the bottom
   - Targets common main/content selectors used by the theme
   - Keeps overscroll-behavior to reduce bounce where supported
*/
html, body {
  height: 100%;
}
body {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  /* Keep the overscroll behavior set earlier */
  overscroll-behavior-y: contain;
}

/* --------------------------------------------------------------------------
   Strong override for hero CTA buttons
   - Ensures the Projects (btn-ghost) button uses the same outlined style
   - Centers the row and gives a consistent max-width so buttons line up
   - Placed late in the file so it overrides earlier theme rules
   -------------------------------------------------------------------------- */
.hero-cta {
  display: flex !important;
  flex-direction: column !important;
  gap: .75rem !important;
  align-items: center !important;
  justify-content: center !important;
}
.hero-cta .btn,
.hero-cta a.btn,
.hero-cta button.btn {
  display: block !important;
  width: 100% !important;
  max-width: 520px !important;
  margin: .35rem auto !important;
  box-sizing: border-box !important;
  background: rgba(255,255,255,0.02) !important;
  color: #f9fafb !important;
  border: 1px solid rgba(255,255,255,0.12) !important;
  border-radius: 12px !important;
  text-align: center !important;
}
.hero-cta .btn:hover,
.hero-cta a.btn:hover,
.hero-cta button.btn:hover {
  transform: translateY(-3px) !important;
  background: rgba(255,255,255,0.06) !important;
  border: 1px solid rgba(255,255,255,0.24) !important;
}


/* Ensure the central content area grows to fill available space */
main[aria-label="Content"],
main[role="main"],
.page-content,
.wrapper,
.wrapper.list-page,
.wrapper.post {
  flex: 1 0 auto;
}

/* Reduce bottom margin on the footer to avoid extra space being reserved */
.footer {
  margin-bottom: 0 !important;
}

/* If a direct child wrapper exists, ensure it doesn't introduce extra bottom padding */
body > .wrapper {
  display: flex;
  flex-direction: column;
}

/* Small safeguard: if the page still bounces on some iOS devices, limiting body background painting reduces visual "gap" */
html {
  background-attachment: fixed;
}
