/* ==========================================================
   PROJECT M - STYLE.CSS
   Dark mode / laboratorium inżynierskie.
   Struktura: 1) Reset  2) Zmienne  3) Ogólne  4) Komponenty
   5) Sekcje  6) Media queries (mobile-first)
========================================================== */

/* ---------- 1) RESET ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }
button, input, textarea { font: inherit; color: inherit; }

/* ---------- 2) ZMIENNE (PODMIEŃ KOLORY TUTAJ, JEŚLI CHCESZ ZMIENIĆ MOTYW) ---------- */
:root {
  /* Tła */
  --bg-void: #0a0b0d;
  --bg-panel: #15171b;
  --bg-panel-alt: #1b1e23;

  /* Linie / obramowania */
  --border: #2a2d33;
  --border-bright: #40444c;

  /* Tekst */
  --text-primary: #f2f3f5;
  --text-muted: #9a9ea6;
  --text-dim: #5c6169;

  /* Akcenty: pomarańcz = świat fizyczny, cyjan = świat cyfrowy */
  --accent-physical: #ff5a1f;
  --accent-physical-dim: #ff5a1f33;
  --accent-digital: #00d9ff;
  --accent-digital-dim: #00d9ff33;

  /* Typografia */
  --font-display: 'Rajdhani', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  --radius: 2px;
}

/* ---------- 3) OGÓLNE ---------- */
body {
  background: var(--bg-void);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent-physical); color: #0a0b0d; }

:focus-visible {
  outline: 2px solid var(--accent-digital);
  outline-offset: 3px;
}

.section {
  padding: 5rem 1.25rem;
  max-width: 1200px;
  margin: 0 auto;
}

.section-head { margin-bottom: 2.5rem; }

.section-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  letter-spacing: 0.01em;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.9rem;
  text-transform: uppercase;
}
.eyebrow-sep { color: var(--text-dim); }

.dot {
  width: 7px; height: 7px; border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 8px currentColor;
}
.dot-physical { background: var(--accent-physical); color: var(--accent-physical); }
.dot-digital { background: var(--accent-digital); color: var(--accent-digital); }

/* Etykiety modułów / tagi w stylu schematu technicznego */
.tag, .module-tag {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.35rem 0.7rem;
  border: 1px solid var(--border-bright);
  border-radius: var(--radius);
  display: inline-block;
}
.tag-physical, .module-tag.tag-physical {
  color: var(--accent-physical);
  border-color: var(--accent-physical-dim);
}
.tag-digital, .module-tag.tag-digital {
  color: var(--accent-digital);
  border-color: var(--accent-digital-dim);
}

.caption-tag {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--text-dim);
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.5rem;
}

/* ---------- 4) KOMPONENTY ---------- */

/* Przyciski */
.btn {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: 0.02em;
  padding: 0.85rem 1.7rem;
  border-radius: var(--radius);
  display: inline-block;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--accent-physical);
  color: #0a0b0d;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 24px var(--accent-physical-dim); }
.btn-ghost {
  border-color: var(--border-bright);
  color: var(--text-primary);
}
.btn-ghost:hover { border-color: var(--accent-digital); color: var(--accent-digital); }
.btn-full { width: 100%; text-align: center; }
.btn-sm { padding: 0.6rem 1.3rem; font-size: 0.9rem; }

/* Ramka schematu technicznego - narożniki jak w celowniku CAD */
.frame {
  position: relative;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.frame::before, .frame::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  border-color: var(--accent-physical);
  transition: width 0.25s ease, height 0.25s ease;
  pointer-events: none;
  filter: drop-shadow(0 0 2px rgba(0, 0, 0, 0.9)) drop-shadow(0 0 1px rgba(0, 0, 0, 0.9));
}
.frame::before { top: -1px; left: -1px; border-top: 2px solid; border-left: 2px solid; }
.frame::after { bottom: -1px; right: -1px; border-bottom: 2px solid; border-right: 2px solid; }
.frame:hover::before, .frame:hover::after { width: 22px; height: 22px; }
.frame.frame-digital::before, .frame.frame-digital::after { border-color: var(--accent-digital); }

/* Placeholder na zdjęcia */
.image-placeholder {
  background:
    repeating-linear-gradient(135deg, var(--bg-panel-alt) 0 10px, var(--bg-panel) 10px 20px);
  border: 1px dashed var(--border-bright);
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  aspect-ratio: 4 / 3;
  padding: 1rem;
}
.placeholder-icon { width: 32px; height: 32px; opacity: 0.6; }
.image-placeholder.small { aspect-ratio: 4 / 3; }

/* ---------- HEADER / NAV ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(10, 11, 13, 0.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.navbar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}
.logo {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 0.04em;
}
.logo-accent { color: var(--accent-physical); }

.nav-toggle-input { display: none; }
.nav-toggle-label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  cursor: pointer;
  z-index: 110;
}
.nav-toggle-label span,
.nav-toggle-label::before,
.nav-toggle-label::after {
  content: '';
  width: 24px; height: 2px;
  background: var(--text-primary);
  transition: transform 0.25s ease, opacity 0.25s ease;
}
.nav-toggle-input:checked + .nav-toggle-label::before { transform: translateY(7px) rotate(45deg); }
.nav-toggle-input:checked + .nav-toggle-label span { opacity: 0; }
.nav-toggle-input:checked + .nav-toggle-label::after { transform: translateY(-7px) rotate(-45deg); }

.nav-links {
  position: fixed;
  top: 0; right: 0;
  height: 100vh;
  width: min(75vw, 320px);
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 6rem 2rem 2rem;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}
.nav-toggle-input:checked ~ .nav-links { transform: translateX(0); }
.nav-links a {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.nav-cta { color: var(--accent-physical); }

/* ---------- HERO ---------- */
.hero {
  position: relative;
  overflow: hidden;
  padding: 4rem 1.25rem 5rem;
}
.hero-grid-bg {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.35;
  mask-image: radial-gradient(ellipse at 50% 0%, black 40%, transparent 80%);
}
.hero-inner {
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3rem;
}
.hero-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.2rem, 8vw, 4rem);
  line-height: 1.08;
  letter-spacing: 0.005em;
  margin-bottom: 1.25rem;
}
.hero-subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 46ch;
  margin-bottom: 2rem;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 1rem; margin-bottom: 2rem; }
.hero-tags { display: flex; flex-wrap: wrap; gap: 0.75rem; }

.hero-visual { display: flex; justify-content: center; }
.wireframe-cube { width: 100%; max-width: 340px; overflow: visible; }
.cube-edges .edge {
  fill: none;
  stroke: var(--accent-physical);
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-dasharray: 900;
  stroke-dashoffset: 900;
  animation: draw-cube 2.4s ease forwards 0.3s;
  opacity: 0.85;
}
.cube-nodes circle {
  fill: var(--accent-digital);
  opacity: 0;
  animation: fade-node 0.6s ease forwards 2.2s;
}
.cube-nodes .node-core {
  fill: var(--accent-physical);
  filter: drop-shadow(0 0 6px var(--accent-physical));
}
@keyframes draw-cube { to { stroke-dashoffset: 0; } }
@keyframes fade-node { to { opacity: 1; } }

/* ---------- USŁUGI ---------- */
.services-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}
.service-card {
  padding: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.module-tag { align-self: flex-start; }
.service-icon { width: 40px; height: 40px; color: var(--text-primary); }
.frame-physical .service-icon { color: var(--accent-physical); }
.frame-digital .service-icon { color: var(--accent-digital); }
.service-card h3 { font-family: var(--font-display); font-size: 1.4rem; font-weight: 600; }
.service-card p { color: var(--text-muted); }
.feature-list { margin-top: 0.5rem; display: flex; flex-direction: column; gap: 0.6rem; }
.feature-list li {
  font-size: 0.92rem;
  color: var(--text-muted);
  padding-left: 1.2rem;
  position: relative;
}
.feature-list li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--accent-physical);
}
.frame-digital .feature-list li::before { color: var(--accent-digital); }

/* ---------- O MNIE ---------- */
.about-grid {
  display: grid;
  gap: 2.5rem;
  grid-template-columns: 1fr;
}
.about-visual { padding: 0.75rem; }
.about-visual .image-placeholder { aspect-ratio: 1 / 1; }
.about-visual .caption-tag { margin: 0.75rem 0 0; }
.about-text { color: var(--text-muted); margin-bottom: 1.1rem; }
.spec-list { margin-top: 1.5rem; display: flex; flex-direction: column; gap: 0.9rem; }
.spec-list li {
  font-size: 0.95rem;
  border-top: 1px solid var(--border);
  padding-top: 0.9rem;
}
.spec-list li span {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  color: var(--accent-physical);
  margin-bottom: 0.3rem;
}

/* ---------- REALIZACJE ---------- */
.portfolio-grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: 1fr;
}
.portfolio-card { overflow: hidden; }
.portfolio-image {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  filter: contrast(1.08) brightness(1.02) saturate(1.05);
  transition: transform 0.4s ease, filter 0.4s ease;
}
.portfolio-image--render {
  object-fit: contain;
  background: #2e2e2e;
  filter: none;
}
.portfolio-card:hover .portfolio-image {
  transform: scale(1.045);
  filter: contrast(1.12) brightness(1.05) saturate(1.1);
}
.portfolio-card:hover .portfolio-image--render {
  transform: scale(1.02);
  filter: none;
}
@media (prefers-reduced-motion: reduce) {
  .portfolio-image { transition: filter 0.2s linear; }
  .portfolio-card:hover .portfolio-image { transform: none; }
}
.portfolio-info { padding: 1.25rem; display: flex; flex-direction: column; gap: 0.5rem; }
.portfolio-info .module-tag { align-self: flex-start; margin-bottom: 0.3rem; }
.portfolio-info h3 { font-family: var(--font-display); font-size: 1.1rem; font-weight: 600; }
.portfolio-info p { color: var(--text-muted); font-size: 0.9rem; }

.cta-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.85rem;
  padding: 2.5rem 1.75rem;
  min-height: 100%;
}
.cta-icon { width: 36px; height: 36px; color: var(--accent-physical); }
.cta-card h3 { font-family: var(--font-display); font-size: 1.15rem; font-weight: 600; }
.cta-card p { color: var(--text-muted); font-size: 0.9rem; max-width: 32ch; }
.cta-card .btn { margin-top: 0.4rem; }

/* ---------- KONTAKT ---------- */
.contact-grid {
  display: grid;
  gap: 2.5rem;
  grid-template-columns: 1fr;
}
.contact-form { padding: 2rem; display: flex; flex-direction: column; gap: 1.25rem; }
.form-field { display: flex; flex-direction: column; gap: 0.5rem; }
.form-field label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.form-field input, .form-field textarea {
  background: var(--bg-panel-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  color: var(--text-primary);
  resize: vertical;
}
.form-field input:focus, .form-field textarea:focus {
  border-color: var(--accent-digital);
}
.form-field input::placeholder, .form-field textarea::placeholder { color: var(--text-dim); }

.contact-info { display: flex; flex-direction: column; gap: 2rem; }
.contact-block { border-top: 1px solid var(--border); padding-top: 1.25rem; }
.contact-link {
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--accent-physical);
}
.contact-plain { color: var(--text-muted); }
.social-list { display: flex; flex-direction: column; gap: 0.6rem; }
.social-list a {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-primary);
  transition: color 0.2s ease;
}
.social-list a:hover { color: var(--accent-digital); }

/* ---------- POWIADOMIENIE (TOAST) ---------- */
.toast-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 11, 13, 0.7);
  backdrop-filter: blur(3px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s;
  z-index: 999;
}
.toast-backdrop.show { opacity: 1; visibility: visible; }

.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.92);
  width: min(90vw, 420px);
  background: var(--bg-panel);
  border: 1px solid var(--accent-physical);
  color: var(--text-primary);
  padding: 2rem 1.75rem;
  border-radius: var(--radius);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  text-align: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
  z-index: 1000;
}
.toast.show { opacity: 1; visibility: visible; transform: translate(-50%, -50%) scale(1); }

.toast-icon {
  width: 44px;
  height: 44px;
  color: var(--accent-physical);
  flex-shrink: 0;
}
.toast-text {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.15rem;
  line-height: 1.4;
}
.toast.toast-error { border-color: var(--accent-digital); }
.toast.toast-error .toast-icon { color: var(--accent-digital); }

@media (prefers-reduced-motion: reduce) {
  .toast, .toast-backdrop { transition: opacity 0.15s linear; }
  .toast { transform: translate(-50%, -50%); }
  .toast.show { transform: translate(-50%, -50%); }
}

/* ---------- STOPKA ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 2rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  align-items: center;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
}
.footer-tag { font-family: var(--font-mono); font-size: 0.7rem; letter-spacing: 0.1em; }

/* ---------- 6) MEDIA QUERIES (mobile-first: rozszerzamy od ~600px w górę) ---------- */
@media (min-width: 600px) {
  .services-grid { grid-template-columns: repeat(2, 1fr); }
  .portfolio-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-actions .btn { min-width: 180px; text-align: center; }
}

@media (min-width: 860px) {
  .nav-toggle-input, .nav-toggle-label { display: none; }
  .nav-links {
    position: static;
    height: auto;
    width: auto;
    background: transparent;
    border: none;
    flex-direction: row;
    align-items: center;
    padding: 0;
    transform: none;
    gap: 2rem;
  }
  .nav-links a { border-bottom: none; padding: 0; }

  .hero-inner { flex-direction: row; align-items: center; justify-content: space-between; }
  .hero-content { flex: 1.1; }
  .hero-visual { flex: 0.9; }

  .about-grid { grid-template-columns: 0.8fr 1.2fr; align-items: center; }
  .contact-grid { grid-template-columns: 1.4fr 1fr; }
}

@media (min-width: 1080px) {
  .portfolio-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ---------- Redukcja ruchu dla użytkowników, którzy tego potrzebują ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cube-edges .edge, .cube-nodes circle {
    animation: none;
    stroke-dashoffset: 0;
    opacity: 1;
  }
  .btn-primary:hover { transform: none; }
}
