/* ============================================================
   SUUB — Portfolio dronów
   Prosty, klasyczny styl. Jasne tło, stonowane kolory.
   ============================================================ */

:root {
  --bg:          #f4f1ea;   /* ciepłe, jasne tło */
  --surface:     #ffffff;   /* karty */
  --ink:         #2b2b2b;   /* główny tekst */
  --ink-soft:    #5f5f5f;   /* tekst drugorzędny */
  --line:        #ddd7cc;   /* obramowania */
  --accent:      #3a6b5e;   /* stonowana zieleń */
  --accent-dark: #2c5247;
  --shadow:      0 2px 10px rgba(0, 0, 0, .08);
  --radius:      10px;
  --maxw:        1040px;
  --font:        "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}

a { color: var(--accent); }
a:hover { color: var(--accent-dark); }

.container {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
}

/* ----------------------  NAGŁÓWEK  ---------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
}

.logo-mark {
  width: 32px;
  height: 32px;
  fill: var(--accent);
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
}
.logo-mark rect { fill: var(--accent); }
.logo-mark line { stroke: var(--accent); }

.logo-text {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 2px;
}

.main-nav { display: flex; gap: 24px; }
.main-nav a {
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 600;
  font-size: .98rem;
  padding: 4px 2px;
  border-bottom: 2px solid transparent;
}
.main-nav a:hover { color: var(--ink); border-bottom-color: var(--accent); }

/* ----------------------  WSTĘP  ---------------------- */
.intro { padding: 64px 20px 32px; max-width: 800px; }
.intro h1 {
  font-size: 2.1rem;
  line-height: 1.25;
  margin: 0 0 18px;
}
.lead { font-size: 1.12rem; color: var(--ink-soft); margin: 0 0 18px; }
.intro-hint { color: var(--accent); font-weight: 600; }

/* ----------------------  SEKCJA MODELI  ---------------------- */
.models { padding: 24px 20px 72px; }
.section-title {
  font-size: 1.6rem;
  margin: 0 0 24px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--line);
}

.models-list { display: flex; flex-direction: column; gap: 20px; }

/* --- Karta modelu --- */
.model-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* Przycisk-nagłówek karty (klikalny) */
.model-head {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
  padding: 16px 20px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: inherit;
}
.model-head:hover { background: #faf8f3; }

.model-thumb {
  width: 96px;
  height: 72px;
  flex: 0 0 auto;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f0ece2;
  object-fit: cover;
}

.model-head-text { flex: 1 1 auto; min-width: 0; }
.model-head-text h3 { margin: 0 0 4px; font-size: 1.2rem; }
.model-head-text .model-tagline { margin: 0; color: var(--ink-soft); font-size: .95rem; }
.model-head-text .model-year { color: var(--accent); font-weight: 600; }

.model-toggle {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  color: var(--accent);
  transition: transform .3s ease, background .2s ease;
}
.model-card.open .model-toggle { transform: rotate(180deg); background: #eef4f1; }
.model-toggle svg { width: 18px; height: 18px; fill: currentColor; }

/* --- Panel rozwijany (animacja wysokości -> reszta strony przesuwa się w dół) --- */
.model-panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .4s ease;
}
.model-card.open .model-panel { grid-template-rows: 1fr; }

.panel-inner {
  overflow: hidden;
  min-height: 0;
}

.panel-content {
  padding: 4px 20px 28px;
  border-top: 1px solid var(--line);
}
.panel-top {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 28px;
  align-items: start;
}

/* Widok 3D */
.viewer-wrap { position: relative; }
model-viewer {
  width: 100%;
  height: 380px;
  background: linear-gradient(#fbfaf6, #ede8dd);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  --poster-color: transparent;
}

.viewer-caption {
  margin-top: 8px;
  font-size: .85rem;
  color: var(--ink-soft);
  text-align: center;
}

/* Przełącznik wersji modelu 3D (ewolucja projektu) */
.versions { margin-top: 16px; }
.versions-label {
  display: block;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--ink-soft);
  margin-bottom: 10px;
}
.version-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.version-chip {
  font-family: inherit;
  font-size: .85rem;
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #faf8f3;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.version-chip:hover { border-color: var(--accent); color: var(--ink); }
.version-chip.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
/* Opis wybranej wersji (zmienia się przy przełączaniu modelu) */
.version-info {
  background: #faf8f3;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  padding: 14px 16px;
  margin: 0 0 22px;
}
.version-title {
  margin: 0 0 6px;
  font-size: 1.05rem;
  color: var(--accent-dark);
}
.version-desc {
  margin: 0;
  color: var(--ink-soft);
  min-height: 1.4em;
}

/* Komunikat zastępczy gdy brak pliku .glb */
.viewer-fallback {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  color: var(--ink-soft);
  background: linear-gradient(#fbfaf6, #ede8dd);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}
.viewer-fallback.show { display: flex; }
.viewer-fallback strong { color: var(--ink); display: block; margin-bottom: 6px; }
.viewer-fallback code {
  background: #f0ece2; padding: 2px 6px; border-radius: 4px; font-size: .85rem;
}

/* Opis + proces */
.panel-info h4 { margin: 0 0 6px; font-size: 1.05rem; }
.panel-info .model-desc { margin: 0 0 22px; color: var(--ink-soft); }

.specs { list-style: none; padding: 0; margin: 0 0 24px; }
.specs li {
  display: flex; justify-content: space-between;
  padding: 6px 0; border-bottom: 1px solid var(--line);
  font-size: .92rem;
}
.specs li span:first-child { color: var(--ink-soft); }
.specs li span:last-child { font-weight: 600; }

/* Oś czasu procesu */
.process { margin-top: 8px; }
.process > h4 { margin: 0 0 14px; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 22px; position: relative; }
.timeline::before {
  content: ""; position: absolute; left: 6px; top: 4px; bottom: 4px;
  width: 2px; background: var(--line);
}
.timeline li { position: relative; padding: 0 0 18px 4px; }
.timeline li::before {
  content: ""; position: absolute; left: -22px; top: 4px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent);
}
.timeline li:last-child { padding-bottom: 0; }
.timeline .step-title { font-weight: 700; }
.timeline .step-text { color: var(--ink-soft); font-size: .92rem; }

/* ----------------------  SEKCJA MEDIÓW (film + galeria)  ---------------------- */
.panel-media {
  margin-top: 28px;
  display: grid;
  gap: 28px;
}
.media-block > h4 {
  margin: 0 0 14px;
  font-size: 1.15rem;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--line);
}

/* Film (16:9) */
.video-frame {
  position: relative;
  width: 100%;
  max-width: 760px;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.video-frame iframe,
.video-frame video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* Galeria zdjęć */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 12px;
}
.gallery-item {
  padding: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f0ece2;
  cursor: pointer;
  overflow: hidden;
  aspect-ratio: 4 / 3;
}
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .25s ease;
}
.gallery-item:hover img { transform: scale(1.06); }

/* Stan pusty (brak filmu / zdjęć) */
.media-empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 24px;
  background: #faf8f3;
  color: var(--ink-soft);
  text-align: center;
}
.media-empty strong { display: block; color: var(--ink); margin-bottom: 6px; }
.media-empty code { background: #f0ece2; padding: 2px 6px; border-radius: 4px; font-size: .85rem; }

/* Lightbox (powiększone zdjęcie) */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, .85);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.lightbox.open { display: flex; }
.lightbox-img {
  max-width: 92vw;
  max-height: 88vh;
  border-radius: 6px;
  box-shadow: 0 8px 40px rgba(0, 0, 0, .5);
  background: #fff;
}
.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .15);
  color: #fff;
  border: none;
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}
.lightbox-close:hover { background: rgba(255, 255, 255, .3); }

/* ----------------------  STOPKA  ---------------------- */
.site-footer { background: #2b2b2b; color: #d9d4ca; margin-top: 40px; }
.footer-inner {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 32px;
  padding: 44px 20px 32px;
}
.footer-col h3 { margin: 0 0 14px; color: #fff; font-size: 1.05rem; }
.contact-list { list-style: none; padding: 0; margin: 0; }
.contact-list li { padding: 4px 0; }
.contact-list a, .site-footer a { color: #9ec7ba; text-decoration: none; }
.contact-list a:hover, .site-footer a:hover { color: #fff; text-decoration: underline; }
.footer-note { margin: 0; color: #b7b2a8; }

.footer-bottom { border-top: 1px solid #3f3f3f; }
.footer-bottom p { margin: 0; padding: 16px 20px; font-size: .85rem; color: #9a958c; text-align: center; }

/* ----------------------  PRZYCISK "DO GÓRY"  ---------------------- */
.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity .25s ease, transform .25s ease, visibility .25s, background .2s;
}
.back-to-top.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.back-to-top:hover { background: var(--accent-dark); color: #fff; }
.back-to-top svg { width: 24px; height: 24px; fill: currentColor; }

/* ----------------------  RESPONSYWNOŚĆ  ---------------------- */
@media (max-width: 760px) {
  .intro { padding-top: 40px; }
  .intro h1 { font-size: 1.7rem; }
  .panel-top { grid-template-columns: 1fr; }
  model-viewer { height: 300px; }
  .footer-inner { grid-template-columns: 1fr; gap: 24px; }
  .main-nav { gap: 16px; }
  .model-thumb { width: 72px; height: 56px; }
}

@media (max-width: 460px) {
  .logo-text { letter-spacing: 1px; }
  .main-nav a { font-size: .9rem; }
  .model-head { gap: 12px; padding: 14px; }
}

/* Szacunek dla użytkowników preferujących mniej ruchu */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
