/*
Theme Name: A+D
Description: Strona pracowni A+D – realizacje, blog, PL/EN. Wymaga wtyczki „A+D — treści”.
Version: 1.0.0
Author: A+D
Text Domain: aplusd
*/

/* ===== Tokens. Three looks for comparison on the preview: a (light), b (yellow), c (dark). ===== */
:root {
  --bg: #fff; --fg: #111; --muted: #6b6b6b; --line: #e4e4e4; --soft: #f4f4f2;
  --accent: #E5C111; --accent-fg: #111; --head-bg: #fff; --head-fg: #111;
  --card-bg: transparent; --logo-filter: none;
  --font: "Bahnschrift", "DIN Alternate", "DIN Next", "D-DIN", "Barlow", "Roboto Condensed", "Segoe UI", Roboto, Arial, sans-serif;
  --gap: 16px; --pad: 16px; --max: 1360px; --radius: 0;
  --head-h: 64px;
}
@media (min-width: 900px) { :root { --gap: 24px; --pad: 32px; --head-h: 76px; } }
html[data-skin="b"] {
  --head-bg: #E5C111; --head-fg: #111; --soft: #faf6e1; --line: #e8e2c4;
}
html[data-skin="c"] {
  --bg: #111; --fg: #f2f2f0; --muted: #a3a3a0; --line: #2a2a2a; --soft: #1b1b1b;
  --head-bg: #111; --head-fg: #f2f2f0; --logo-filter: invert(1);
}

/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--head-h) + 12px); }
body { margin: 0; background: var(--bg); color: var(--fg); font: 400 16px/1.55 var(--font); font-stretch: 95%; }
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--fg); text-decoration-color: var(--accent); }
h1, h2, h3 { font-weight: 600; line-height: 1.15; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(26px, 3.4vw, 44px); }
p { margin: 0 0 .9em; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr, .hp { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; z-index: 100; background: var(--accent); color: #111; padding: 8px 12px; }
.skip:focus { left: 8px; }
.wrap { width: 100%; max-width: var(--max); margin: 0 auto; padding-left: var(--pad); padding-right: var(--pad); }
.label { font-size: 12px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin: 0 0 10px; }
.label a { text-decoration: none; }
.label a:hover { color: var(--fg); }
.muted { color: var(--muted); }
.count { font-size: .5em; color: var(--muted); vertical-align: super; font-weight: 400; }

/* ===== Header: logo · three choices · PL/EN + search ===== */
.site-header { position: sticky; top: 0; z-index: 40; background: var(--head-bg); color: var(--head-fg); border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; gap: var(--gap); min-height: var(--head-h); }
.logo img { width: auto; height: 44px; filter: var(--logo-filter); }
@media (min-width: 900px) { .logo img { height: 54px; } }
.main-nav { display: flex; gap: clamp(14px, 3vw, 40px); margin-left: auto; }
.main-nav a, .sub-nav a { text-decoration: none; text-transform: uppercase; letter-spacing: .08em; font-weight: 600; font-size: 14px; padding: 6px 0; border-bottom: 2px solid transparent; white-space: nowrap; }
.main-nav a.is-active, .main-nav a:hover { border-bottom-color: var(--accent); }
html[data-skin="b"] .main-nav a.is-active, html[data-skin="b"] .main-nav a:hover { border-bottom-color: #111; }
.header-tools { display: flex; align-items: center; gap: 12px; }
.lang { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-decoration: none; border: 1px solid currentColor; padding: 3px 7px; }
.search input { width: 150px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: inherit; font: inherit; font-size: 14px; padding: 6px 2px; }
.search input:focus { outline: none; border-bottom-color: var(--accent); }
@media (max-width: 899px) {
  .header-row { flex-wrap: wrap; gap: 0 14px; padding-top: 6px; padding-bottom: 6px; }
  .logo img { height: 40px; }
  .main-nav { gap: 16px; }
  .main-nav a { font-size: 13px; letter-spacing: .05em; }
  .header-tools { order: -1; position: absolute; right: var(--pad); top: 6px; }
  .search { display: none; }
  .main-nav { margin-left: auto; padding-top: 22px; }
}
@media (max-width: 359px) { .main-nav a { font-size: 12px; letter-spacing: .02em; } .main-nav { gap: 10px; } }

.sub-nav { border-top: 1px solid var(--line); background: var(--head-bg); }
.sub-row { display: flex; gap: 0; overflow-x: auto; scrollbar-width: none; }
.sub-row::-webkit-scrollbar { display: none; }
.sub-nav a { font-size: 12.5px; padding: 11px 16px 9px; color: var(--muted); }
.sub-nav a:first-child { padding-left: 0; }
.sub-nav a.is-active, .sub-nav a:hover { color: var(--head-fg); border-bottom-color: var(--accent); }
html[data-skin="b"] .sub-nav a { color: #5a4c00; }
html[data-skin="b"] .sub-nav a.is-active { color: #111; border-bottom-color: #111; }

/* ===== Page head ===== */
.page-head { padding-top: 24px; padding-bottom: 16px; }
.page-intro { color: var(--muted); max-width: 60ch; margin: 6px 0 0; }

/* ===== Cards: one grid, edges aligned ===== */
.grid-cards { display: grid; gap: var(--gap); grid-template-columns: 1fr; }
@media (min-width: 640px) { .grid-cards { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1000px) { .grid-cards { grid-template-columns: repeat(3, 1fr); } }
.card { display: grid; grid-template-columns: 38% 1fr; gap: 12px; align-items: start; background: var(--card-bg); }
@media (min-width: 640px) { .card { grid-template-columns: 1fr; gap: 10px; } }
.card-media { display: block; aspect-ratio: 16 / 10; overflow: hidden; background: var(--soft); }
.card-media img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease; }
.card:hover .card-media img { transform: scale(1.03); }
.card-noimg { display: grid; place-items: center; width: 100%; height: 100%; color: var(--muted); letter-spacing: .2em; }
.card-meta { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 4px; }
.card-title { font-size: 17px; font-weight: 600; }
@media (min-width: 1000px) { .card-title { font-size: 19px; } }
.card-title a { text-decoration: none; }
.card-title a:hover { text-decoration: underline; text-decoration-color: var(--accent); }
.card-excerpt { color: var(--muted); font-size: 14.5px; margin: 6px 0 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 639px) { .card-excerpt { -webkit-line-clamp: 2; font-size: 14px; } }

/* ===== Home: newest project (rotating 3) + two newest posts = three things ===== */
.home-grid { display: grid; gap: var(--gap); padding-top: 20px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .home-grid { grid-template-columns: 2fr 1fr; align-items: stretch; } }
.home-feature { display: flex; flex-direction: column; min-width: 0; }
.rotator { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: var(--soft); }
@media (min-width: 900px) { .rotator { aspect-ratio: auto; flex: 1; min-height: 420px; } }
.rotator-slide { position: absolute; inset: 0; opacity: 0; visibility: hidden; transition: opacity .8s ease, visibility 0s linear .8s; }
.rotator-slide.is-active { opacity: 1; visibility: visible; transition: opacity .8s ease; }
.rotator-slide a { display: block; height: 100%; text-decoration: none; color: #fff; }
.rotator-slide img { width: 100%; height: 100%; object-fit: cover; }
.rotator-caption { position: absolute; left: 0; right: 0; bottom: 0; padding: 48px 20px 16px; background: linear-gradient(transparent, rgba(0,0,0,.72)); }
.rotator-caption .card-meta { color: rgba(255,255,255,.85); }
.rotator-caption h3 { font-size: clamp(20px, 2.4vw, 32px); }
.rotator-dots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.rotator-dots button { border: 0; background: none; padding: 8px 0 0; text-align: left; cursor: pointer; border-top: 3px solid var(--line); font-size: 12px; color: var(--muted); }
.rotator-dots button span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rotator-dots button[aria-current="true"] { border-top-color: var(--accent); color: var(--fg); }
.home-side { display: grid; gap: var(--gap); align-content: start; min-width: 0; }
.home-side .card { grid-template-columns: 38% 1fr; }
@media (min-width: 900px) { .home-side .card { grid-template-columns: 1fr; } }
.home-paths { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gap); padding-top: 28px; }
.path { display: block; text-decoration: none; border-top: 3px solid var(--fg); padding-top: 10px; }
.path strong { display: block; text-transform: uppercase; letter-spacing: .06em; font-size: 15px; }
.path span { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.path:hover { border-top-color: var(--accent); }
@media (max-width: 639px) { .path span { display: none; } .path strong { font-size: 13px; } }

/* ===== Project filters ===== */
.filters { display: grid; gap: 8px; padding-bottom: 18px; }
.filter-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.filters.has-open .filter-group:not(.is-open) { display: none; }
.filter-label { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); min-width: 72px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border: 1px solid var(--line); font-size: 13.5px; text-decoration: none; background: var(--bg); }
.chip small { color: var(--muted); font-size: 11px; }
.chip:hover { border-color: var(--fg); }
.chip.is-on { background: var(--accent); border-color: var(--accent); color: #111; }
.chip.is-on small { color: #111; }
.chip-clear { border-style: dashed; justify-self: start; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }

/* ===== Entry (project / post / page) ===== */
.entry-head { padding-top: 22px; padding-bottom: 16px; }
.entry-head .card-meta { margin-bottom: 8px; }
.entry-grid { display: grid; gap: var(--gap); padding-top: 20px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .entry-grid { grid-template-columns: 2fr 1fr; } }
.entry-text { min-width: 0; }
.prose { max-width: 72ch; font-size: 17px; }
.prose h2 { font-size: 22px; margin: 1.4em 0 .5em; }
.prose h3 { font-size: 18px; margin: 1.2em 0 .4em; }
.prose img { margin: 1em 0; }
.prose ul, .prose ol { padding-left: 1.2em; }
.prose a { text-decoration-color: var(--accent); text-decoration-thickness: 2px; }
.prose > :first-child { margin-top: 0; }
.entry-aside { display: grid; gap: var(--gap); align-content: start; }
@media (min-width: 900px) { .entry-aside { position: sticky; top: calc(var(--head-h) + 60px); } }
.cta { background: var(--soft); padding: 18px 20px; border-left: 4px solid var(--accent); }
.cta-title { font-weight: 600; font-size: 18px; margin-bottom: 4px; }
.btn { display: inline-block; background: var(--accent); color: #111; border: 0; padding: 10px 18px; text-decoration: none; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; font-size: 13px; cursor: pointer; }
.btn:hover { background: #111; color: #fff; }
html[data-skin="c"] .btn:hover { background: #fff; color: #111; }
.files ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.files a { display: flex; gap: 8px; align-items: baseline; text-decoration: none; padding: 8px 10px; border: 1px solid var(--line); }
.files a:hover { border-color: var(--fg); }
.files-type { font-size: 11px; font-weight: 700; background: var(--fg); color: var(--bg); padding: 1px 5px; }
.files-size { color: var(--muted); font-size: 12px; margin-left: auto; }
.lang-note { background: var(--soft); border-left: 4px solid var(--accent); padding: 10px 14px; font-size: 14px; }

/* ===== Gallery: swipe on touch, buttons/drag/keys on desktop ===== */
.gallery { position: relative; }
.gallery-track { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: thin; -webkit-overflow-scrolling: touch; cursor: grab; }
.gallery-track.is-dragging { cursor: grabbing; scroll-snap-type: none; }
.gallery-track.is-dragging a { pointer-events: none; }
.gallery-slide { flex: 0 0 auto; margin: 0; scroll-snap-align: start; height: clamp(240px, 62vh, 640px); background: var(--soft); }
.gallery-slide a { display: block; height: 100%; }
.gallery-slide img { height: 100%; width: auto; max-width: none; object-fit: cover; user-select: none; -webkit-user-drag: none; }
@media (max-width: 639px) {
  .gallery { margin: 0 calc(var(--pad) * -1); }
  .gallery-track { padding: 0 var(--pad); scroll-padding: 0 var(--pad); }
  .gallery-slide { height: auto; width: 86vw; aspect-ratio: 4 / 3; }
  .gallery-slide img { width: 100%; height: 100%; }
  .gallery-bar { padding: 0 var(--pad); }
}
.gallery-bar { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.gallery-count { font-variant-numeric: tabular-nums; font-size: 14px; min-width: 4.5em; text-align: center; }
.gallery-hint { color: var(--muted); font-size: 12px; margin-left: auto; }
.icon-btn { width: 40px; height: 40px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; font-size: 18px; line-height: 1; display: inline-grid; place-items: center; }
.icon-btn:hover { border-color: var(--fg); }
.icon-btn:disabled { opacity: .35; cursor: default; }

/* Lightbox */
.lightbox { width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; background: #0b0b0b; color: #fff; }
.lightbox::backdrop { background: #0b0b0b; }
.lightbox[open] { display: flex; flex-direction: column; }
.lightbox-track { flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior: contain; }
.lightbox-track::-webkit-scrollbar { display: none; }
.lightbox-track figure { flex: 0 0 100%; margin: 0; scroll-snap-align: center; display: grid; place-items: center; padding: 12px; }
.lightbox-track img { max-width: 100%; max-height: calc(100dvh - 90px); width: auto; height: auto; object-fit: contain; }
.lightbox-bar { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 10px 10px calc(10px + env(safe-area-inset-bottom)); }
.lightbox .icon-btn { background: transparent; color: #fff; border-color: #444; }
.lightbox-close { position: absolute; top: 10px; right: 10px; }

/* ===== Neighbours + related ===== */
.neighbours { display: grid; grid-template-columns: 1fr 1fr; gap: var(--gap); padding-top: 36px; }
.neighbour { text-decoration: none; border-top: 1px solid var(--line); padding-top: 10px; }
.neighbour strong { display: block; font-size: 15px; }
.neighbour.next { text-align: right; grid-column: 2; }
.neighbour:hover { border-top-color: var(--accent); }
.related { padding-top: 36px; }

/* ===== Pagination ===== */
.pagination { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 28px; }
.pagination .page-numbers { min-width: 40px; height: 40px; display: inline-grid; place-items: center; border: 1px solid var(--line); text-decoration: none; padding: 0 8px; }
.pagination .current { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.pagination .dots { border: 0; }

/* ===== Contact form ===== */
.contact { margin-top: 28px; padding-top: 20px; border-top: 3px solid var(--fg); }
.contact h2 { font-size: 22px; margin-bottom: 14px; }
.contact-form { display: grid; gap: 12px; grid-template-columns: 1fr; max-width: 72ch; }
@media (min-width: 640px) { .contact-form { grid-template-columns: 1fr 1fr; } .contact-form .full { grid-column: 1 / -1; } }
.contact-form label > span { display: block; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 4px; }
.contact-form input[type=text], .contact-form input[type=email], .contact-form input[type=tel], .contact-form textarea { width: 100%; font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--line); padding: 10px 12px; border-radius: 0; }
.contact-form input:focus, .contact-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.contact-form .consent { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; color: var(--muted); }
.contact-form .consent span { text-transform: none; letter-spacing: 0; font-size: 13.5px; margin: 0; }
.contact-form .btn { justify-self: start; }
.form-note { padding: 10px 14px; border-left: 4px solid; }
.form-note.is-ok { border-color: #2e7d32; background: rgba(46,125,50,.08); }
.form-note.is-error { border-color: #c62828; background: rgba(198,40,40,.08); }

/* ===== Footer ===== */
.site-footer { margin-top: 56px; border-top: 1px solid var(--line); background: var(--soft); font-size: 14px; }
.footer-grid { display: grid; gap: var(--gap); padding-top: 28px; padding-bottom: 20px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .footer-grid { grid-template-columns: 2fr 1fr 1fr; } }
.footer-about p:last-child { color: var(--muted); max-width: 60ch; }
.footer-nav { display: flex; flex-direction: column; gap: 4px; }
.footer-nav a { text-decoration: none; }
.footer-nav a:hover { text-decoration: underline; text-decoration-color: var(--accent); }
@media (max-width: 899px) { .footer-nav { flex-direction: row; flex-wrap: wrap; gap: 6px 16px; } }
.footer-bottom { padding-bottom: 90px; color: var(--muted); font-size: 12px; }

/* ===== Floating arrows: back (←) and top (↑), always within thumb reach ===== */
.fab { position: fixed; right: max(12px, env(safe-area-inset-right)); bottom: max(14px, env(safe-area-inset-bottom)); z-index: 50; display: flex; flex-direction: column; gap: 8px; }
.fab-btn { width: 48px; height: 48px; border-radius: 50%; border: 0; background: var(--fg); color: var(--bg); font-size: 20px; line-height: 1; cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,.25); display: grid; place-items: center; transition: transform .15s ease, background .15s ease; }
.fab-btn:hover { background: var(--accent); color: #111; transform: translateY(-1px); }
.fab-btn[hidden] { display: none; }
@media (min-width: 900px) { .fab { right: 24px; bottom: 24px; } }

/* Preview-only look switcher */
.skin-switch { position: fixed; left: 10px; bottom: 10px; z-index: 60; display: flex; align-items: center; gap: 4px; background: rgba(17,17,17,.88); color: #fff; padding: 5px 8px; font-size: 12px; }
.skin-switch button { width: 26px; height: 26px; border: 1px solid #555; background: transparent; color: #fff; cursor: pointer; }
.skin-switch button[aria-pressed="true"] { background: #E5C111; color: #111; border-color: #E5C111; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
