/* ==========================================================================
   ZMIENNE MOTYWU & TŁO Z SIATKĄ
   ========================================================================== */
:root {
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Ciemny motyw domyślny */
  --bg-primary: #090d16;
  --bg-navbar: rgba(9, 13, 22, 0.9);
  --grid-line: rgba(255, 255, 255, 0.035);
  --glow-indigo: rgba(99, 102, 241, 0.08);
  --glow-cyan: rgba(6, 182, 212, 0.06);

  --bg-surface: rgba(18, 26, 44, 0.7);
  --border-color: rgba(255, 255, 255, 0.08);
  --border-highlight: rgba(99, 102, 241, 0.4);

  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  
  --accent-primary: #6366f1;
  --accent-secondary: #06b6d4;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #06b6d4 100%);

  --card-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --blur-strength: blur(14px);
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-navbar: rgba(248, 250, 252, 0.9);
  --grid-line: rgba(0, 0, 0, 0.035);
  --glow-indigo: rgba(99, 102, 241, 0.04);
  --glow-cyan: rgba(6, 182, 212, 0.04);

  --bg-surface: rgba(255, 255, 255, 0.85);
  --border-color: rgba(0, 0, 0, 0.08);
  --border-highlight: rgba(99, 102, 241, 0.4);

  --text-main: #0f172a;
  --text-muted: #64748b;

  --accent-primary: #4f46e5;
  --accent-secondary: #0891b2;
  --accent-gradient: linear-gradient(135deg, #4f46e5 0%, #0891b2 100%);

  --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.06);
  --blur-strength: blur(12px);
}

/* ==========================================================================
   RESET & BLOKADA PRZEWIJANIA POZIOMEGO (RWD FIX DLA IPHONE)
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden; /* Blokuje rozpychanie strony w bok */
  position: relative;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  background-image: 
    radial-gradient(circle at 10% 20%, var(--glow-indigo) 0%, transparent 45%),
    radial-gradient(circle at 90% 60%, var(--glow-cyan) 0%, transparent 45%),
    linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 36px 36px, 36px 36px;
  background-attachment: fixed;
  color: var(--text-main);
  line-height: 1.6;
  transition: background-color 0.3s ease, color 0.3s ease;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.section {
  padding: 4.5rem 0;
  background: transparent;
  width: 100%;
  overflow-x: clip; /* Zabezpieczenie sekcji przed wyciekiem elementów 3D */
}

.section-title {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  display: inline-block;
}

.section-subtitle {
  color: var(--text-muted);
  margin-bottom: 2.25rem;
  font-size: 1.05rem;
}

.text-gradient {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

/* ==========================================================================
   KARTY GLASSMORPHISM
   ========================================================================== */
.glass-card {
  background: var(--bg-surface);
  backdrop-filter: var(--blur-strength);
  -webkit-backdrop-filter: var(--blur-strength);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
}

/* ==========================================================================
   NAWIGACJA
   ========================================================================== */
.navbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: var(--bg-navbar);
  backdrop-filter: var(--blur-strength);
  -webkit-backdrop-filter: var(--blur-strength);
  border-bottom: 1px solid var(--border-color);
  padding: 1rem 0;
  width: 100%;
}

.nav-container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.25rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand-logo {
  font-family: var(--font-mono);
  font-size: 1.3rem;
  font-weight: 700;
  text-decoration: none;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.nav-menu {
  display: flex;
  gap: 1.5rem;
}

.nav-link {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  transition: color 0.2s ease;
}

.nav-link:hover, .nav-link.active {
  color: var(--accent-primary);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.5rem;
  border-radius: 0.5rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease;
}

.icon-btn:hover {
  background: var(--border-color);
}

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

.mobile-only {
  display: none;
}

/* ==========================================================================
   HERO
   ========================================================================== */
.hero-section {
  padding: 4.5rem 0 3.5rem;
  display: flex;
  align-items: center;
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.status-indicator {
  width: 8px;
  height: 8px;
  background-color: #10b981;
  border-radius: 50%;
  box-shadow: 0 0 8px #10b981;
}

.hero-title {
  font-size: 2.7rem;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 1.25rem;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 680px;
  margin-bottom: 2rem;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.4rem;
  border-radius: 0.6rem;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
}

.btn-primary {
  background: var(--accent-gradient);
  color: #ffffff;
}

.btn-primary:hover {
  opacity: 0.92;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  background: var(--border-color);
  border-color: var(--accent-primary);
}

.btn-block {
  width: 100%;
  justify-content: center;
}

.hero-socials {
  display: flex;
  gap: 1rem;
}

.social-link {
  color: var(--text-muted);
  border: 1px solid var(--border-color);
  padding: 0.55rem;
  border-radius: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s ease, border-color 0.2s ease;
}

.social-link:hover {
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

/* ==========================================================================
   O MNIE & EDUKACJA
   ========================================================================== */
.about-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
  gap: 1.5rem;
}

.card-icon {
  display: inline-flex;
  color: var(--accent-primary);
  margin-bottom: 1rem;
}

.timeline-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  margin-top: 1rem;
}

.timeline-list li {
  position: relative;
  padding-left: 1.25rem;
  border-left: 2px solid var(--border-color);
}

.timeline-list li strong {
  display: block;
  font-size: 0.95rem;
}

.timeline-list li .text-muted {
  display: block;
  font-size: 0.85rem;
  margin-top: 0.15rem;
  margin-bottom: 0.35rem;
}

.timeline-list li p {
  font-size: 0.85rem;
  color: var(--text-main);
  line-height: 1.45;
}

.interests-grid {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  margin-top: 1.25rem;
}

.interest-item {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.interest-item i {
  color: var(--accent-secondary);
  flex-shrink: 0;
  margin-top: 0.2rem;
}

.interest-item strong {
  display: block;
  font-size: 0.95rem;
}

.interest-item .text-muted {
  display: block;
  font-size: 0.85rem;
  margin-top: 0.15rem;
  line-height: 1.4;
}

/* ==========================================================================
   STACK TECHNOLOGICZNY (JSON & GWIAZDKI)
   ========================================================================== */
.tech-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr));
  gap: 1.15rem;
}

.tech-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  padding: 1.25rem;
  border-radius: 0.85rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.75rem;
}

.tech-name {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text-main);
}

.tech-tag {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: block;
  margin-top: 0.15rem;
}

.tech-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.tech-stars {
  display: flex;
  gap: 0.25rem;
  align-items: center;
  margin-top: auto;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--border-color);
}

.star {
  font-size: 1.15rem;
  line-height: 1;
}

.star.filled {
  color: #fbbf24;
  text-shadow: 0 0 6px rgba(251, 191, 36, 0.4);
}

.star.empty {
  color: var(--border-color);
}

/* ==========================================================================
   3D SLIDESHOW / CAROUSEL (RWD & FIX DLA KLIKANIA)
   ========================================================================== */
.carousel-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem 0;
  overflow: hidden; /* KLUCZOWE: odcina wystające karty z prawej i lewej strony */
  user-select: none;
}

.carousel-stage {
  width: 100%;
  max-width: 860px;
  height: 440px;
  position: relative;
  perspective: 1000px;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: pan-y;
}

.carousel-track {
  width: 100%;
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  display: flex;
  align-items: center;
  justify-content: center;
}

.carousel-card {
  position: absolute;
  width: 360px;
  max-width: calc(100vw - 80px);
  height: 390px;
  display: flex;
  flex-direction: column;
  transition: transform 0.45s cubic-bezier(0.25, 1, 0.5, 1), 
              opacity 0.45s cubic-bezier(0.25, 1, 0.5, 1),
              filter 0.45s cubic-bezier(0.25, 1, 0.5, 1);
  will-change: transform, opacity;
  pointer-events: none; /* Domyślnie wyłączone, włączane dla active/next/prev */
}

/* Karta centralna */
.carousel-card.active {
  transform: translateX(0) translateZ(0) scale(1) rotateY(0deg);
  opacity: 1;
  z-index: 10;
  pointer-events: auto;
  filter: blur(0);
  cursor: default;
}

/* Karta prawa (zwiększony z-index i pointer-events) */
.carousel-card.next {
  transform: translateX(65%) translateZ(-160px) scale(0.85) rotateY(-18deg);
  opacity: 0.55;
  z-index: 8;
  pointer-events: auto;
  filter: blur(0.5px);
  cursor: pointer;
}

/* Karta lewa (zwiększony z-index i pointer-events) */
.carousel-card.prev {
  transform: translateX(-65%) translateZ(-160px) scale(0.85) rotateY(18deg);
  opacity: 0.55;
  z-index: 8;
  pointer-events: auto;
  filter: blur(0.5px);
  cursor: pointer;
}

.carousel-card.next:hover,
.carousel-card.prev:hover {
  opacity: 0.85;
  border-color: var(--accent-primary);
}

.carousel-card.hidden-right {
  transform: translateX(120%) translateZ(-350px) scale(0.6);
  opacity: 0;
  z-index: 1;
  visibility: hidden;
}

.carousel-card.hidden-left {
  transform: translateX(-120%) translateZ(-350px) scale(0.6);
  opacity: 0;
  z-index: 1;
  visibility: hidden;
}

.card-badge {
  align-self: flex-start;
  background: rgba(99, 102, 241, 0.15);
  color: var(--accent-primary);
  border: 1px solid rgba(99, 102, 241, 0.3);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 9999px;
  margin-bottom: 0.75rem;
}

.project-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.project-icon {
  color: var(--accent-secondary);
  flex-shrink: 0;
}

.project-card p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: auto;
  margin-bottom: 0.75rem;
}

.tags span {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  background: var(--border-color);
  padding: 0.2rem 0.5rem;
  border-radius: 0.35rem;
  color: var(--text-main);
}

.project-links-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.project-link {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.4rem 0.75rem;
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  text-decoration: none;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  width: fit-content;
  transition: all 0.2s ease;
}

.project-link:hover {
  background: var(--border-color);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.project-link.web-link:hover {
  border-color: var(--accent-secondary);
  color: var(--accent-secondary);
}

.project-link svg {
  flex-shrink: 0;
}

.carousel-btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-surface);
  backdrop-filter: var(--blur-strength);
  -webkit-backdrop-filter: var(--blur-strength);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 25;
  transition: all 0.25s ease;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.carousel-btn.prev-btn { left: 5px; }
.carousel-btn.next-btn { right: 5px; }

.carousel-btn:hover {
  background: var(--accent-gradient);
  color: #ffffff;
  border-color: transparent;
  transform: translateY(-50%) scale(1.08);
}

.carousel-dots {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.75rem;
}

.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--border-color);
  cursor: pointer;
  transition: all 0.3s ease;
}

.dot.active {
  background: var(--accent-primary);
  width: 24px;
  border-radius: 5px;
}

/* ==========================================================================
   SEKCJA POMYSŁÓW
   ========================================================================== */
.ideas-list {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
}

.idea-card {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 2rem;
  padding: 1.5rem 1.75rem;
}

.idea-main-content {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex-grow: 1;
}

.idea-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}

.idea-header .project-header {
  margin-bottom: 0;
}

.card-badge.idea-badge {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-secondary);
  border-color: rgba(6, 182, 212, 0.3);
  margin-bottom: 0;
}

.idea-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0;
}

.idea-card .tags {
  flex-shrink: 0;
  margin: 0;
  justify-content: flex-end;
}

/* ==========================================================================
   KONTAKT
   ========================================================================== */
.contact-wrapper {
  display: grid;
  grid-template-columns: 1fr 1.3fr;
  gap: 2rem;
}

.contact-items {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.contact-entry {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-muted);
}

.contact-entry a {
  color: var(--text-main);
  text-decoration: none;
  transition: color 0.2s ease;
}

.contact-entry a:hover {
  color: var(--accent-primary);
}

.contact-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
}

.form-group input,
.form-group textarea {
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  padding: 0.75rem;
  color: var(--text-main);
  font-family: inherit;
  font-size: 0.95rem;
  transition: border-color 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.form-status {
  font-size: 0.9rem;
  margin-top: 0.5rem;
  text-align: center;
}

.form-status.success {
  color: #10b981;
  background: rgba(16, 185, 129, 0.1);
  padding: 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.form-status.error {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
  padding: 0.75rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(239, 68, 68, 0.2);
}

/* ==========================================================================
   STOPKA & SCROLL TO TOP
   ========================================================================== */
.footer {
  border-top: 1px solid var(--border-color);
  padding: 2.5rem 0;
  background: var(--bg-surface);
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  flex-wrap: wrap;
  gap: 1rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-links a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-links a:hover {
  color: var(--accent-primary);
}

.scroll-to-top {
  position: fixed;
  bottom: 2rem;
  right: 1.5rem;
  z-index: 999;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--bg-surface);
  backdrop-filter: var(--blur-strength);
  -webkit-backdrop-filter: var(--blur-strength);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--card-shadow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(15px);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.scroll-to-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.scroll-to-top:hover {
  background: var(--accent-gradient);
  color: #ffffff;
  border-color: transparent;
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.4);
}

/* ==========================================================================
   RESPONSYWNOŚĆ MOBILNA (IPHONE SE & MAŁE EKRANY)
   ========================================================================== */
@media (max-width: 850px) {
  .idea-card {
    flex-direction: column;
    align-items: flex-start;
    gap: 1rem;
  }

  .idea-card .tags {
    justify-content: flex-start;
  }
}

@media (max-width: 768px) {
  .hero-title {
    font-size: 2.15rem;
  }
  
  .mobile-only {
    display: flex;
  }

  .nav-menu {
    position: fixed;
    top: 60px;
    left: 0;
    width: 100%;
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
    flex-direction: column;
    padding: 1.5rem;
    gap: 1rem;
    transform: translateY(-150%);
    transition: transform 0.3s ease;
  }

  .nav-menu.open {
    transform: translateY(0);
  }

  .contact-wrapper {
    grid-template-columns: 1fr;
  }

  /* Karuzela na małych ekranach */
  .carousel-stage {
    height: 410px;
  }

  .carousel-card {
    width: 275px;
    height: 375px;
    padding: 1.25rem;
  }

  .carousel-card.next {
    transform: translateX(46%) translateZ(-110px) scale(0.82) rotateY(-12deg);
  }

  .carousel-card.prev {
    transform: translateX(-46%) translateZ(-110px) scale(0.82) rotateY(12deg);
  }

  .carousel-btn {
    width: 38px;
    height: 38px;
  }

  .carousel-btn.prev-btn { left: 0px; }
  .carousel-btn.next-btn { right: 0px; }

  .scroll-to-top {
    bottom: 1.25rem;
    right: 1.25rem;
    width: 40px;
    height: 40px;
  }
}