/* ============================================
   AKADEMIA WALIDACJI — wspólne style podstron
   (akademia.html, akademiacleanroom.html, akademiatermostatyki.html)
   Ładuj PO style.css
   ============================================ */

/* --tone = kolor wypełnień; --tone-text = wersja do tekstu, ramek i markerów (czytelna na granacie);
   --on-tone = kolor tekstu na plakietce; --tint/--tint2 = siła zabarwienia tła paneli */
body.ak { --tone: var(--accent); }
body.ak, [data-tone] { --tone-text: var(--tone); --on-tone: var(--navy); --tint: 5%; --tint2: 10%; }
[data-tone="teal"] { --tone: #4fc3c3; }
[data-tone="blue"] { --tone: #6fb1ff; }
[data-tone="gold"] { --tone: #ffc40c; }
[data-tone="green"] { --tone: #5fd38d; }
[data-tone="klein"] { --tone: #002FA7; --tone-text: #5b8cff; --on-tone: #fff; --tint: 18%; --tint2: 32%; }

.ak-main { padding-top: 4.6rem; }
.ak-block { padding: 5rem 5vw; border-top: 1px solid var(--rule); }
.ak-main > .ak-block:first-child { border-top: 0; }

a:focus-visible, button:focus-visible { outline: 2px solid var(--tone-text, var(--accent)); outline-offset: 3px; }

/* ── Placeholder na zdjęcia (obraz opcjonalny: znika sam, gdy brak pliku) ── */
.ph {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background:
    linear-gradient(var(--rule) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(90deg, var(--rule) 1px, transparent 1px) 0 0 / 28px 28px,
    linear-gradient(135deg, color-mix(in srgb, var(--tone) 22%, var(--steel)), var(--steel));
  display: flex; align-items: center; justify-content: center;
}
.ph::after {
  content: attr(data-ph);
  font-family: 'DM Mono', monospace; font-size: 0.62rem; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--muted); opacity: 0.8; text-align: center; padding: 0 1rem;
}
.ph img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: 1; }

/* ── Banner Akademii ── */
.ak-banner { position: relative; overflow: hidden; text-align: center; padding: 5rem 5vw 4.5rem; border-bottom: 1px solid var(--rule); }
.ak-banner-inner { position: relative; max-width: 760px; margin: 0 auto; }
.ak-logo img { display: block; margin: 0 auto 1.6rem; max-height: 120px; max-width: min(440px, 85%); }
.ak-wordmark { font-family: 'DM Serif Display', serif; font-weight: 400; font-size: clamp(2.6rem, 6.5vw, 4.8rem); line-height: 1.05; color: var(--offwhite); margin-bottom: 1.2rem; }
.ak-wordmark em { font-style: italic; color: var(--accent); }
.ak-logo:not(.no-img) .ak-wordmark { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); margin: 0; }
.ak-lead { color: var(--muted); font-size: 1.05rem; max-width: 560px; margin: 0 auto; line-height: 1.8; }

/* ── Karty ścieżek ── */
.paths { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.path-card {
  display: flex; flex-direction: column; color: inherit; text-decoration: none;
  border: 1px solid color-mix(in srgb, var(--tone-text) 35%, transparent);
  background: color-mix(in srgb, var(--tone) var(--tint), var(--navy));
  transition: border-color 0.2s, transform 0.2s;
}
.path-card:hover { border-color: var(--tone-text); transform: translateY(-3px); }
.path-body { padding: 1.8rem; display: flex; flex-direction: column; gap: 0.9rem; flex: 1; }
.path-body h3 { font-family: 'DM Serif Display', serif; font-weight: 400; font-size: 1.7rem; line-height: 1.2; color: var(--offwhite); }
.path-body p { color: var(--muted); font-size: 0.95rem; }
.pts { list-style: none; display: grid; gap: 0.35rem; }
.pts li { position: relative; padding-left: 1.1rem; font-size: 0.88rem; color: var(--muted); line-height: 1.55; }
.pts li::before { content: ''; position: absolute; left: 0; top: 0.7em; width: 6px; height: 1px; background: var(--tone-text); }
.cta { margin-top: auto; padding-top: 0.6rem; font-family: 'DM Mono', monospace; font-size: 0.72rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--tone-text); }
.path-card:hover .cta { text-decoration: underline; text-underline-offset: 6px; }

/* ── O Akademii ── */
.about2 { display: grid; grid-template-columns: 1fr 1fr; gap: 5rem; align-items: start; }
.about2 p { color: var(--muted); margin-bottom: 1.1rem; }
.benefits { display: grid; gap: 1.6rem; }
.benefit { border-left: 2px solid var(--accent); padding-left: 1.2rem; }
.benefit h3 { font-family: 'DM Sans', sans-serif; font-weight: 500; font-size: 1rem; color: var(--offwhite); margin-bottom: 0.2rem; }
.benefit p { font-size: 0.9rem; margin: 0; }

/* ── Pozostałe kursy ── */
.courses { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.5rem; }
.course { display: flex; flex-direction: column; background: var(--steel); border: 1px solid var(--rule); color: inherit; text-decoration: none; transition: border-color 0.2s; }
.course:hover { border-color: var(--accent); }
.course .ph { aspect-ratio: 3 / 2; }
.course-body { padding: 1.4rem; display: flex; flex-direction: column; gap: 0.6rem; flex: 1; }
.course-body h3 { font-family: 'DM Serif Display', serif; font-weight: 400; font-size: 1.3rem; color: var(--offwhite); }
.course-body p { font-size: 0.88rem; color: var(--muted); }
.course-body .tag { align-self: flex-start; }

/* ── Podstrona ścieżki ── */
.pw-head { padding: 3.5rem 5vw 2.5rem; max-width: 1200px; margin: 0 auto; }
.crumb { font-family: 'DM Mono', monospace; font-size: 0.7rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); text-decoration: none; }
.crumb:hover { color: var(--accent); }
.pw-title { font-family: 'DM Serif Display', serif; font-weight: 400; font-size: clamp(2rem, 4.6vw, 3.6rem); line-height: 1.1; color: var(--offwhite); margin: 1.2rem 0 1rem; }
.pw-sub { color: var(--muted); font-size: 1.05rem; max-width: 640px; }
.pw-note { margin-top: 2rem; max-width: 640px; border-left: 2px solid var(--accent); padding: 0.4rem 0 0.4rem 1.2rem; font-size: 0.92rem; color: var(--muted); }
.pw-note strong { color: var(--offwhite); font-weight: 500; }
.pw-note ul { margin: 0.4rem 0 0.5rem 1.1rem; }
.pw-body { max-width: 1200px; margin: 0 auto; padding: 0 5vw 4rem; }

.start { display: flex; justify-content: center; margin: 0.5rem 0 1.5rem; }
.start span { font-family: 'DM Mono', monospace; font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; border: 1px solid var(--accent); color: var(--accent); padding: 0.6rem 1.6rem; }
.join { width: 1px; height: 2.2rem; margin: 0 auto; background: linear-gradient(var(--rule), var(--accent)); }

.branch { --c: 3; border: 1px solid color-mix(in srgb, var(--tone-text) 40%, transparent); background: color-mix(in srgb, var(--tone) var(--tint), var(--navy)); padding: 1.8rem; }
.branch-head { margin-bottom: 1.4rem; }
.branch-head h2 { font-size: clamp(1.5rem, 2.6vw, 2rem); margin-bottom: 0.3rem; color: var(--offwhite); }
.branch-head h2::before { content: ''; display: inline-block; width: 10px; height: 10px; background: var(--tone-text); margin-right: 0.7rem; }
.branch-head p { color: var(--muted); font-size: 0.92rem; }
.branch.c4 { --c: 4; }
.branch.c1 { --c: 1; }
.branch.c2 { --c: 2; }
.fork { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; }
.fork .branch { --c: 1; }

.tiles { display: grid; grid-template-columns: repeat(var(--c), minmax(0, 1fr)); gap: 1rem; }
.effect { margin-top: 1.2rem; padding: 0.8rem 1rem; font-size: 0.9rem; color: var(--muted); background: color-mix(in srgb, var(--tone) var(--tint2), transparent); border-left: 2px solid var(--tone-text); }
.effect strong { color: var(--offwhite); font-weight: 500; margin-right: 0.4rem; }
.stage-note { color: var(--muted); font-size: 0.95rem; margin: -0.6rem 0 1.4rem; max-width: 560px; }

/* kafelek */
.tile { position: relative; isolation: isolate; cursor: pointer; display: flex; flex-direction: column; gap: 0.8rem; padding: 1rem; background: var(--steel); border: 1px solid var(--rule); transition: border-color 0.2s, transform 0.2s; }
.tile:hover, .tile:focus-within { border-color: var(--tone-text); transform: translateY(-3px); }
.tile-code { align-self: flex-start; font-family: 'DM Mono', monospace; font-size: 0.78rem; font-weight: 500; letter-spacing: 0.06em; background: var(--tone); color: var(--on-tone); padding: 0.15rem 0.6rem; }
.tile .ph { aspect-ratio: 16 / 10; }
.tile h3 { font-family: 'DM Serif Display', serif; font-weight: 400; font-size: 1.2rem; line-height: 1.25; color: var(--offwhite); margin-bottom: 0.5rem; }
.tile-more { margin-top: auto; align-self: flex-start; background: none; border: 0; padding: 0; cursor: pointer; font-family: 'DM Mono', monospace; font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--tone-text); }
.tile-more::after { content: ''; position: absolute; inset: 0; z-index: 2; } /* cały kafelek jest klikalny */
.tile-more span { margin-left: 0.4rem; font-size: 0.9rem; }
.tile-full { display: none; }

.tile.wide { display: grid; grid-template-columns: 260px 1fr; grid-template-areas: "img top" "img body" "img more"; grid-template-rows: auto 1fr auto; column-gap: 1.5rem; row-gap: 0.7rem; }
.tile.wide .tile-code { grid-area: top; }
.tile.wide .ph { grid-area: img; aspect-ratio: auto; min-height: 150px; }
.tile.wide .tile-body { grid-area: body; }
.tile.wide .tile-more { grid-area: more; }

.stages { max-width: 860px; margin: 0 auto; }
.stage { --c: 1; border: 1px solid color-mix(in srgb, var(--tone-text) 40%, transparent); background: color-mix(in srgb, var(--tone) var(--tint), var(--navy)); padding: 1.2rem; }
.stage .tile { background: var(--steel); }
.ems { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 2rem; padding: 1.1rem 1.4rem; border: 1px dashed var(--rule); }
.ems h3 { font-family: 'DM Serif Display', serif; font-weight: 400; font-size: 1.2rem; color: var(--offwhite); }
.ems .pts { grid-auto-flow: column; gap: 1.4rem; }
.decision { text-align: center; margin: 0 auto; font-family: 'DM Mono', monospace; font-size: 0.78rem; letter-spacing: 0.06em; color: var(--navy); background: #ffc40c; padding: 0.7rem 1.4rem; max-width: max-content; }
.loop { margin: 1.5rem auto 0; max-width: 860px; border: 1px solid #ffc40c; padding: 1.2rem 1.5rem; }
.loop strong { color: var(--offwhite); font-weight: 500; }
.loop ul { margin: 0.5rem 0 0 1.2rem; color: var(--muted); font-size: 0.92rem; }

.pw-links { margin-top: 3rem; }
.pw-links h2 { font-size: 1.4rem; margin-bottom: 1rem; }
.chips { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0.8rem; }
.chip { padding: 0.9rem 1rem; border: 1px solid var(--rule); font-size: 0.85rem; color: var(--muted); }
.chip strong { display: block; color: var(--accent); font-family: 'DM Mono', monospace; font-weight: 500; font-size: 0.78rem; letter-spacing: 0.04em; margin-bottom: 0.15rem; }
.goal { margin-top: 1.5rem; padding: 1.1rem 1.4rem; border: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); color: var(--text); }
.goal strong { color: var(--accent); font-family: 'DM Mono', monospace; letter-spacing: 0.1em; margin-right: 0.6rem; font-weight: 500; }

/* ── Okno ze szczegółami kafelka ── */
#tile-dialog { margin: auto; padding: 0; width: min(780px, 92vw); max-height: 86vh; background: var(--navy); color: var(--text); border: 1px solid var(--tone-text); flex-direction: column; overflow: hidden; }
#tile-dialog[open] { display: flex; animation: dlg-in 0.22s ease; }
#tile-dialog::backdrop { background: rgba(5, 12, 20, 0.82); backdrop-filter: blur(3px); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.dlg-head { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.4rem; border-bottom: 1px solid var(--rule); background: var(--steel); flex-shrink: 0; }
.dlg-head h3 { flex: 1; font-family: 'DM Serif Display', serif; font-weight: 400; font-size: 1.4rem; line-height: 1.2; color: var(--offwhite); }
.dlg-close { width: 40px; height: 40px; flex-shrink: 0; background: none; border: 1px solid var(--rule); color: var(--text); font-size: 1.4rem; line-height: 1; cursor: pointer; }
.dlg-close:hover { border-color: var(--tone-text); color: var(--tone-text); }
.dlg-body { overflow-y: auto; overscroll-behavior: contain; padding: 1.6rem 1.4rem 2rem; -webkit-overflow-scrolling: touch; }
.dlg-body h4 { font-family: 'DM Sans', sans-serif; font-weight: 500; font-size: 1.05rem; color: var(--offwhite); margin: 1.6rem 0 0.5rem; }
.dlg-body h4:first-child { margin-top: 0; }
.dlg-body p { color: var(--muted); margin-bottom: 0.9rem; max-width: 68ch; }
.dlg-body ul { margin: 0 0 1rem 1.2rem; color: var(--muted); }
.dlg-body .btn { margin-top: 1rem; }

.fork .tiles { max-width: 400px; }
.tiles .loop { margin: 0; max-width: none; padding: 1.2rem; }
.effect + .effect { margin-top: 0.6rem; }

/* ── Treść kursu: opis na kafelku i w oknie ── */
.tile-desc { font-size: 0.88rem; color: var(--muted); line-height: 1.6; margin-bottom: 0.8rem; }
.meta { list-style: none; display: grid; gap: 0.25rem; padding-top: 0.7rem; border-top: 1px solid var(--rule); font-size: 0.8rem; color: var(--muted); line-height: 1.45; }
.meta b, .facts b { display: inline-block; min-width: 4.6rem; margin-right: 0.4rem; font-family: 'DM Mono', monospace; font-weight: 400; font-size: 0.66rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--tone-text); }
.dlg-body .dlg-sub { font-family: 'DM Mono', monospace; font-size: 0.78rem; letter-spacing: 0.03em; line-height: 1.6; color: var(--tone-text); margin-bottom: 1.1rem; }
.dlg-body .facts { list-style: none; margin: 0 0 1.5rem; padding: 0.9rem 1rem; display: grid; gap: 0.3rem; font-size: 0.9rem; color: var(--muted); border-left: 2px solid var(--tone-text); background: color-mix(in srgb, var(--tone) var(--tint2), transparent); }
.dlg-body li { margin-bottom: 0.35rem; line-height: 1.6; }
.dlg-body .checks { list-style: none; margin-left: 0; }
.dlg-body .checks li { position: relative; padding-left: 1.5rem; }
.dlg-body .checks li::before { content: '✓'; position: absolute; left: 0; color: var(--tone-text); }

/* ── Okno kursu: box, zagadnienia, powiązane kursy ── */
.tile .pts { margin-bottom: 0.9rem; }
.tile .pts li { font-size: 0.85rem; }
.dlg-body .dlg-box { margin: 1.4rem 0; padding: 1rem 1.2rem; border: 1px solid var(--tone-text); background: color-mix(in srgb, var(--tone) var(--tint2), transparent); }
.dlg-body .dlg-box strong { display: block; margin-bottom: 0.4rem; font-family: 'DM Serif Display', serif; font-weight: 400; font-size: 1.2rem; line-height: 1.3; color: var(--offwhite); }
.dlg-body .dlg-box p { margin: 0; color: var(--text); }
.dlg-body details { border-top: 1px solid var(--rule); }
.dlg-body details:last-of-type { border-bottom: 1px solid var(--rule); }
.dlg-body summary { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 0.85rem 0; cursor: pointer; list-style: none; font-weight: 500; color: var(--offwhite); }
.dlg-body summary::-webkit-details-marker { display: none; }
.dlg-body summary::after { content: '+'; flex-shrink: 0; font-size: 1.3rem; line-height: 1; color: var(--tone-text); }
.dlg-body details[open] summary::after { content: '\2013'; }
.dlg-body details > p, .dlg-body details > ul { margin-bottom: 1rem; }
.dlg-body .related { list-style: none; margin-left: 0; }
.dlg-body .related li { padding: 0.7rem 0; border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.92rem; }
.dlg-body .related a { color: var(--tone-text); font-weight: 500; text-decoration: none; }
.dlg-body .related a:hover { text-decoration: underline; text-underline-offset: 4px; }
.dlg-body .dlg-soon { margin-top: 2rem; padding: 1.2rem; border: 1px dashed var(--tone-text); }
.dlg-body .dlg-soon strong { display: block; margin-bottom: 0.3rem; color: var(--offwhite); }
.dlg-body .dlg-soon p { margin-bottom: 0.5rem; }

/* ── Responsive ── */
@media (max-width: 1000px) {
  .branch, .branch.c4 { --c: 2; }
  .fork { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .paths, .about2 { grid-template-columns: 1fr; }
  .about2 { gap: 3rem; }
}
@media (max-width: 800px) {
  .courses { grid-template-columns: 1fr; }
  .tile.wide { grid-template-columns: 1fr; grid-template-areas: "top" "img" "body" "more"; }
  .tile.wide .ph { aspect-ratio: 16 / 10; min-height: 0; }
  .ems .pts { grid-auto-flow: row; gap: 0.35rem; }
}
@media (max-width: 640px) {
  .ak-main { padding-top: 4rem; }
  .ak-block { padding: 3.5rem 5vw; }
  .ak-banner { padding: 3.5rem 5vw 3rem; }
  .pw-head { padding: 2.2rem 5vw 1.8rem; }
  .pw-body { padding-bottom: 3rem; }
  .branch, .branch.c4, .branch.c2 { --c: 1; padding: 1.1rem; }
  .stage { padding: 0.9rem; }
  .path-body { padding: 1.3rem; }
  /* okno jako arkusz od dołu, prawie na cały ekran */
  #tile-dialog { margin: auto 0 0; width: 100%; max-width: 100%; max-height: 92dvh; border-left: 0; border-right: 0; border-bottom: 0; }
  .dlg-head { padding: 0.9rem 1rem; }
  .dlg-head h3 { font-size: 1.2rem; }
  .dlg-body { padding: 1.3rem 1rem 2.5rem; }
  .btn { width: 100%; text-align: center; }
}
@media (prefers-reduced-motion: reduce) {
  #tile-dialog[open] { animation: none; }
  .tile, .path-card { transition: none; }
}

/* ── Dodatki: wersja 6 ── */
.tile-top { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; }
.tile.wide .tile-top { grid-area: top; }
.qr { font-family: 'DM Mono', monospace; font-size: 0.66rem; font-weight: 500; letter-spacing: 0.08em; padding: 0.12rem 0.5rem; border: 1px solid var(--tone-text); color: var(--tone-text); background: color-mix(in srgb, var(--tone) 14%, transparent); }
.qr.opt { border-style: dashed; background: none; }
.legend { margin-top: 1.4rem; max-width: 760px; font-size: 0.86rem; color: var(--muted); line-height: 2; }
.legend .qr { color: var(--accent); border-color: var(--accent); background: none; }
.pw-lead { color: var(--text); font-size: 1.05rem; max-width: 640px; margin-top: 0.8rem; }
.legend-line { font-family: 'DM Mono', monospace; font-size: 0.72rem; letter-spacing: 0.04em; line-height: 1.8; border-top: 1px solid var(--rule); padding-top: 1rem; margin-top: 1.4rem; }
a.start { text-decoration: none; }
a.start:hover span { background: var(--accent); color: var(--navy); }
.forkbar { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; text-align: center; padding: 0.9rem 1.2rem; border: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.forkbar strong { font-family: 'DM Mono', monospace; font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 500; color: var(--accent); }
.forkbar span { font-size: 0.88rem; color: var(--muted); max-width: 640px; }
.fork3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fork3 .tiles { max-width: none; }
.rq-block { border: 1px solid color-mix(in srgb, var(--tone-text) 40%, transparent); background: color-mix(in srgb, var(--tone) var(--tint), var(--navy)); padding: 1.6rem 1.8rem; }
.rq-block h3 { font-family: 'DM Serif Display', serif; font-weight: 400; font-size: 1.5rem; color: var(--offwhite); margin-bottom: 0.4rem; }
.rq-block p { color: var(--muted); margin-bottom: 1.1rem; }
.rq-btns { display: flex; flex-wrap: wrap; gap: 0.7rem; }
.rq-btn { display: inline-block; padding: 0.7rem 1.1rem; border: 1px solid var(--tone-text); color: var(--offwhite); text-decoration: none; font-size: 0.86rem; transition: background 0.2s, color 0.2s; }
.rq-btn:hover { background: var(--tone); color: var(--navy); }
.endcard { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; text-align: center; text-decoration: none; padding: 1.4rem; border: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); transition: background 0.2s; }
.endcard:hover { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.endcard strong { font-family: 'DM Serif Display', serif; font-weight: 400; font-size: 1.4rem; color: var(--offwhite); }
.endcard span { font-family: 'DM Mono', monospace; font-size: 0.78rem; letter-spacing: 0.08em; color: var(--accent); }
.tiles4 { --c: 4; }
.tiles2 { --c: 2; }
.ak-block > h2 { margin-bottom: 0.8rem; }
.cta-band { text-align: center; }
.cta-band p { color: var(--muted); max-width: 520px; margin: 0 auto 1.6rem; }
@media (max-width: 1000px) {
  .tiles4 { --c: 2; }
  .fork3 { grid-template-columns: 1fr; }
  .fork3 .tiles { max-width: 460px; }
}
@media (max-width: 640px) {
  .tiles4, .tiles2 { --c: 1; }
  .rq-block { padding: 1.2rem; }
  .rq-btn { width: 100%; text-align: center; }
}

.tiles .loop { align-self: start; }
