:root {
  --red: #e30010;
  --red-dark: #b8000d;
  --gray: #6e6e6e;
  --ink: #151515;
  --paper: #fff;
  --tint: #f6f4f1;
  --line: #e6e3de;
  --radius: 20px;
  --ease-out: cubic-bezier(.22, .9, .24, 1);
  --ease-in-out: cubic-bezier(.76, 0, .24, 1);
  --gutter: clamp(16px, 5vw, 40px);
  --header-h: 76px;
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 12px);
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Montserrat", "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }

a { color: inherit; }

:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 3px;
  border-radius: 4px;
}

.container {
  width: 100%;
  max-width: 1160px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -80px;
  z-index: 60;
  padding: 10px 16px;
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  text-decoration: none;
  transition: top .2s;
}

.skip-link:focus { top: 12px; }

.page {
  min-height: 100vh;
  min-height: 100dvh;
}

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(255, 255, 255, .88);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color .3s, box-shadow .3s;
}

.site-header.is-scrolled {
  border-bottom-color: var(--line);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .04);
}

.site-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: var(--header-h);
}

.site-header__logo { display: block; flex: none; }

.site-header__logo img {
  display: block;
  height: 50px;
  width: auto;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(18px, 3vw, 36px);
}

.site-nav a {
  padding: 6px 0;
  color: var(--ink);
  font-size: .9rem;
  font-weight: 500;
  letter-spacing: .02em;
  text-decoration: none;
  background: linear-gradient(var(--red), var(--red)) 0 100% / 0 2px no-repeat;
  transition: background-size .35s var(--ease-out);
}

.site-nav a:hover,
.site-nav a:focus-visible { background-size: 100% 2px; }

.site-nav .site-nav__fb {
  padding: 8px 18px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: none;
  transition: background-color .25s, color .25s;
}

.site-nav .site-nav__fb:hover,
.site-nav .site-nav__fb:focus-visible { background: var(--ink); color: #fff; }

.nav-toggle { display: none; }

@media (max-width: 760px) {
  :root { --header-h: 68px; }

  .site-header__logo img { height: 42px; }

  .nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 4px;
    border: 0;
    background: none;
    color: var(--ink);
    font: inherit;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
  }

  .nav-toggle__bars,
  .nav-toggle__bars::before {
    display: block;
    width: 22px;
    height: 2px;
    background: currentColor;
    transition: transform .3s var(--ease-out);
  }

  .nav-toggle__bars { position: relative; transform: translateY(-3px); }
  .nav-toggle__bars::before { content: ""; position: absolute; top: 7px; left: 0; }

  .nav-toggle[aria-expanded="true"] .nav-toggle__bars { transform: translateY(0) rotate(45deg); }
  .nav-toggle[aria-expanded="true"] .nav-toggle__bars::before { top: 0; transform: rotate(-90deg); }

  .site-nav {
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 8px var(--gutter) 20px;
    background: #fff;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 16px 24px rgba(0, 0, 0, .06);
    visibility: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity .25s, transform .25s var(--ease-out), visibility 0s .25s;
  }

  .site-header.is-open .site-nav {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: opacity .25s, transform .25s var(--ease-out);
  }

  .site-nav a { padding: 14px 0; font-size: 1.05rem; background: none; border-bottom: 1px solid var(--line); }
  .site-nav .site-nav__fb { margin-top: 16px; text-align: center; border-bottom: 1.5px solid var(--ink); }
}

/* ---------- Shared ---------- */

.eyebrow {
  margin: 0 0 14px;
  color: var(--red);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h1, h2, h3 { margin: 0; line-height: 1.1; letter-spacing: -.02em; }

h2 { font-size: clamp(1.9rem, 4.2vw, 3rem); font-weight: 700; }

.btn {
  display: inline-block;
  padding: 14px 28px;
  border: 1.5px solid var(--ink);
  border-radius: 999px;
  background: none;
  color: var(--ink);
  font-size: .95rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color .25s, color .25s, border-color .25s, transform .25s var(--ease-out);
}

.btn:hover,
.btn:focus-visible { background: var(--ink); color: #fff; transform: translateY(-2px); }

.btn--primary { background: var(--red); border-color: var(--red); color: #fff; }

.btn--primary:hover,
.btn--primary:focus-visible { background: var(--red-dark); border-color: var(--red-dark); }

.link-more {
  color: var(--ink);
  font-size: .95rem;
  font-weight: 600;
  text-decoration: none;
  background: linear-gradient(var(--red), var(--red)) 0 100% / 100% 2px no-repeat;
  padding-bottom: 3px;
}

.link-more span { display: inline-block; transition: transform .3s var(--ease-out); }
.link-more:hover span,
.link-more:focus-visible span { transform: translateX(4px); }

.section { padding: clamp(64px, 10vw, 120px) 0; }
.section--tint { background: var(--tint); }

.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 32px;
  margin-bottom: clamp(28px, 5vw, 56px);
}

/* ---------- Hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: clamp(40px, 6vw, 80px) 0 clamp(36px, 5vw, 64px);
}

.hero__inner { position: relative; z-index: 1; }

.hero__title {
  max-width: 11em;
  font-size: clamp(2.8rem, 8.4vw, 6.4rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -.035em;
}

.hero__accent { color: var(--red); }

.hero__lead {
  max-width: 30em;
  margin: 28px 0 0;
  color: var(--gray);
  font-size: clamp(1.02rem, 1.7vw, 1.3rem);
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 40px;
}

.hero__stave {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 30%, #000 62%);
          mask-image: linear-gradient(90deg, transparent 30%, #000 62%);
}

.hero__lines path { stroke: #d6d3ce; stroke-width: 1.6; }

.hero__notes .note {
  transform-box: fill-box;
  transform-origin: 50% 100%;
}

@media (max-width: 760px) {
  .hero { min-height: 0; padding-bottom: 200px; }

  /* Text takes the full width, so the artwork moves under it. */
  .hero__stave {
    inset: auto 0 0 0;
    height: 190px;
    -webkit-mask-image: none;
            mask-image: none;
  }
}

/* Staff lines draw themselves and the notes pop once the intro curtain lifts. */
.has-intro .hero__lines path { stroke-dasharray: 1; stroke-dashoffset: 1; }
.has-intro .hero__notes .note { opacity: 0; }

/* Safety net: if the intro never ran, show the artwork as is. */
.intro-done .hero__lines path { stroke-dashoffset: 0; }
.intro-done .hero__notes .note { opacity: 1; }

/* After drawing, the lines keep drifting out of step with each other so the staff always looks alive. */
.intro-leave .hero__lines path {
  animation:
    draw 2.2s var(--ease-in-out) calc(.3s + var(--n, 0) * .12s) both,
    sway 9s ease-in-out calc(var(--n, 0) * -1.7s) infinite alternate;
}

.intro-leave .hero__lines path:nth-child(2) { --n: 1; }
.intro-leave .hero__lines path:nth-child(3) { --n: 2; }
.intro-leave .hero__lines path:nth-child(4) { --n: 3; }
.intro-leave .hero__lines path:nth-child(5) { --n: 4; }

.intro-leave .hero__notes .note {
  animation: note-pop .8s cubic-bezier(.3, .7, .3, 1) calc(1.5s + var(--d) * .14s) both;
}

.note__bob {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  animation: bob 4s ease-in-out calc(var(--d) * -1.1s) infinite alternate;
}

@keyframes draw {
  from { stroke-dashoffset: 1; }
  to   { stroke-dashoffset: 0; }
}

@keyframes sway {
  from { transform: translateY(0); }
  to   { transform: translateY(-16px); }
}

@keyframes bob {
  from { transform: translateY(0) rotate(-2deg); }
  to   { transform: translateY(-9px) rotate(2deg); }
}

@keyframes note-pop {
  0%   { opacity: 0; transform: translateY(-14px) scale(.4) rotate(-14deg); }
  55%  { opacity: 1; transform: translateY(2px) scale(1.1) rotate(3deg); }
  100% { opacity: 1; transform: none; }
}

/* ---------- Photo ribbon ---------- */

.ribbon {
  --h: clamp(140px, 19vw, 240px);
  --gap: clamp(10px, 1.4vw, 18px);
  display: grid;
  gap: var(--gap);
  padding: 0 0 clamp(56px, 8vw, 96px);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}

.ribbon__row { overflow: hidden; }

/* Row two is a little smaller and runs the other way, so the two never move in step. */
.ribbon__row--second { --h: clamp(120px, 16vw, 204px); }

.ribbon__track {
  display: flex;
  width: max-content;
  animation: ribbon var(--speed, 90s) linear infinite;
}

.ribbon__row--reverse .ribbon__track { animation-direction: reverse; }

.ribbon:hover .ribbon__track { animation-play-state: paused; }

.ribbon__set {
  display: flex;
  flex: none;
  gap: var(--gap);
  padding-right: var(--gap);
}

.ribbon__set img {
  display: block;
  flex: none;
  height: var(--h);
  width: auto;
  object-fit: cover;
  border-radius: 16px;
  background: var(--tint);
}

/* site.js puts the track together from --n identical sets, so one set is exactly 1/n of its width. */
@keyframes ribbon {
  to { transform: translateX(calc(-100% / var(--n, 2))); }
}

/* ---------- Posts ---------- */

.posts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 24px;
}

.post {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: transform .4s var(--ease-out), box-shadow .4s var(--ease-out);
}

.post:hover { transform: translateY(-4px); box-shadow: 0 18px 40px rgba(0, 0, 0, .08); }

.post__image {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--tint);
}

.post__body {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 26px;
}

.post__date {
  color: var(--red);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.post__title { font-size: 1.3rem; line-height: 1.25; letter-spacing: -.01em; }

.post__text {
  margin: 0;
  color: var(--gray);
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.post__body .link-more,
.post__body .btn { margin-top: auto; }

.post--featured { grid-column: 1 / -1; }

.post--featured .post__title { font-size: clamp(1.5rem, 3vw, 2.2rem); }
.post--featured .post__text { font-size: 1.05rem; -webkit-line-clamp: 6; }

@media (min-width: 860px) {
  .post--featured { flex-direction: row; }

  .post--featured .post__image {
    flex: 0 0 42%;
    width: 42%;
    aspect-ratio: auto;
    min-height: 380px;
  }

  .post--featured .post__body { justify-content: center; padding: clamp(32px, 4vw, 56px); }
  .post--featured .post__body .link-more { margin-top: 12px; }
}

.post--empty {
  grid-column: 1 / -1;
  background: var(--tint);
  border-style: dashed;
}

.post--empty:hover { transform: none; box-shadow: none; }

.post--empty .post__body { padding: clamp(28px, 5vw, 56px); gap: 16px; }
.post--empty .post__title { font-size: clamp(1.4rem, 3vw, 2rem); max-width: 22em; }
.post--empty .post__text { max-width: 36em; display: block; }
.post--empty .btn { margin-top: 12px; }

/* ---------- Classes ---------- */

.switch {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.switch__tab {
  min-height: 42px;
  padding: 8px 22px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--gray);
  font: inherit;
  font-size: .92rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .25s, color .25s;
}

.switch__tab:hover { color: var(--ink); }
.switch__tab[aria-selected="true"] { background: var(--ink); color: #fff; }

.classes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr));
  gap: 20px;
  align-items: start;
}

.day {
  padding: 22px 26px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.day__name {
  margin-bottom: 6px;
  color: var(--red);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.class { padding: 20px 0 22px; border-top: 1px solid var(--line); }
.day__name + .class { padding-top: 6px; border-top: 0; }

.class__time { margin: 0 0 6px; font-size: .95rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.class__name { margin: 0; font-size: 1.2rem; font-weight: 700; line-height: 1.25; letter-spacing: -.01em; }
.class__who, .class__note { margin: 6px 0 0; color: var(--gray); font-size: .9rem; }

.class__foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 12px; font-size: .85rem; }
.class__teacher { color: var(--gray); }

.price { padding: 3px 12px; border-radius: 999px; background: var(--tint); font-weight: 600; white-space: nowrap; }
.price--free { background: #e3f4e8; color: #17673a; }

.classes__signup {
  margin: 28px 0 0;
  max-width: 52em;
  padding: 20px 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.classes__signup a { margin-left: .2em; color: var(--red); font-weight: 600; white-space: nowrap; }

@media (max-width: 560px) {
  .switch { width: 100%; }
  .switch__tab { flex: 1; padding-inline: 10px; }
}

/* ---------- About ---------- */

.about {
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  align-items: center;
  gap: clamp(32px, 6vw, 80px);
}

.about__text h2 { margin-bottom: 24px; }
.about__text p { margin: 0 0 16px; max-width: 34em; color: #3d3d3d; font-size: 1.05rem; }
.about__text a { color: var(--red); font-weight: 600; }
.about__text a:hover { color: var(--red-dark); }

.about__mark img { display: block; width: 100%; height: auto; opacity: .9; }

@media (max-width: 760px) {
  .about { grid-template-columns: 1fr; }
  .about__mark { order: -1; max-width: 340px; }
}

/* ---------- Contact ---------- */

.contact {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 20px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.contact__card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.section--tint .contact__card { background: #fff; }

.contact__card h3 {
  color: var(--red);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.contact__card p { margin: 0; font-size: 1.05rem; }
.contact__card a { text-decoration-thickness: 1px; text-underline-offset: 3px; }
.contact__card .link-more { text-decoration: none; margin-top: auto; }
.contact__card { grid-column: span 2; }
.contact__card--wide { grid-column: span 4; }
.contact__card--half { grid-column: span 3; }

.hours {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 24px;
  margin: 0;
  font-size: 1.05rem;
}

.hours dt { font-weight: 600; }
.hours dd { margin: 0; color: var(--gray); overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }

/* Dane instytucji na wąskim ekranie: nazwa pola nad wartością, żeby numer konta się mieścił. */
@media (max-width: 560px) {
  .hours--stack { grid-template-columns: 1fr; gap: 0; }
  .hours--stack dt { color: var(--gray); font-size: .82rem; font-weight: 400; }
  .hours--stack dd { margin-bottom: 12px; color: var(--ink); }
}

/* Telefony i adresy e-mail: opis nad numerem, żeby długie adresy się mieściły. */
.contact__lines { display: grid; gap: 12px; width: 100%; margin: 0; padding: 0; list-style: none; }
.contact__lines li { display: grid; gap: 1px; }
.contact__label { color: var(--gray); font-size: .82rem; }
.contact__lines .contact__big { font-size: 1.12rem; }

@media (max-width: 860px) {
  .contact { grid-template-columns: repeat(2, 1fr); }
  .contact__card, .contact__card--half { grid-column: auto; }
  .contact__card--wide { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .contact { grid-template-columns: 1fr; }
  .contact__card { grid-column: auto; }
}

.contact__big { font-size: clamp(1.05rem, 2.2vw, 1.5rem); font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.contact__big:hover { color: var(--red); }

/* ---------- Footer ---------- */

.site-footer { border-top: 1px solid var(--line); padding: 28px 0; color: var(--gray); font-size: .875rem; }

.site-footer__bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px 24px;
}

.site-footer p { margin: 0; }
.site-footer a { text-underline-offset: 3px; }
.site-footer__contact { flex-basis: 100%; }

/* ---------- News cards open the article ---------- */

.post { position: relative; }
.post__link { color: inherit; text-decoration: none; }

/* One link per card, stretched over the whole card (clicks anywhere, a single stop for keyboard and screen readers). */
.post__link::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.post:has(.post__link:focus-visible) { outline: 3px solid var(--red); outline-offset: 3px; }
.post__link:focus-visible { outline: none; }
.post:hover .link-more span { transform: translateX(4px); }

.posts__more {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin: clamp(28px, 4vw, 48px) 0 0;
}

/* ---------- Projects ---------- */

.projects {
  position: relative;
  overflow: hidden;
  padding: clamp(72px, 10vw, 120px) 0 clamp(72px, 9vw, 112px);
  background: var(--ink);
  color: #fff;
}

/* Faint staff lines running across the band. */
.projects::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(to bottom, transparent 0 21px, rgba(255, 255, 255, .055) 21px 22px);
  pointer-events: none;
}

.projects__head { position: relative; max-width: 1160px; }
.projects .eyebrow { color: #ff5a64; }
.projects h2 { max-width: 16em; }
.projects__lead { max-width: 38em; margin: 18px 0 0; color: #c9c5bf; font-size: 1.05rem; }

.projects__marquee {
  position: relative;
  margin-top: clamp(32px, 5vw, 56px);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
          mask-image: linear-gradient(90deg, transparent, #000 6%, #000 94%, transparent);
}

.projects__track {
  display: flex;
  width: max-content;
  padding-block: 14px;
  animation: projects-scroll 80s linear infinite;
}

.projects__marquee:hover .projects__track,
.projects__marquee:focus-within .projects__track { animation-play-state: paused; }

.projects__set {
  display: flex;
  flex: none;
  gap: 24px;
  padding-right: 24px;
}

/* The track holds --n identical sets (site.js), so one set is exactly 1/n of its width. */
@keyframes projects-scroll {
  to { transform: translateX(calc(-100% / var(--n, 3))); }
}

.project {
  position: relative;
  display: flex;
  flex: none;
  flex-direction: column;
  gap: 14px;
  width: min(82vw, 380px);
  padding: 28px;
  border-radius: 24px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
  transition: transform .35s var(--ease-out), box-shadow .35s var(--ease-out);
}

a.project:hover,
a.project:focus-visible { transform: translateY(-6px); box-shadow: 0 24px 48px rgba(0, 0, 0, .4); }
a.project:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }

.project__chip {
  align-self: flex-start;
  padding: 5px 14px;
  border-radius: 999px;
  background: #fdecee;
  color: var(--red-dark);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.project__money { display: grid; gap: 2px; margin: 0; }
.project__amount { color: var(--red); font-size: clamp(1.9rem, 3.2vw, 2.4rem); font-weight: 700; line-height: 1.05; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.project__of { color: var(--gray); font-size: .82rem; }
.project__title { margin: 0; font-size: 1.15rem; line-height: 1.3; letter-spacing: -.01em; }
.project__summary { margin: 0; color: #4b4b4b; font-size: .93rem; }

.project__cta {
  align-self: flex-start;
  margin-top: auto;
  padding-bottom: 3px;
  background: linear-gradient(var(--red), var(--red)) 0 100% / 100% 2px no-repeat;
  font-size: .92rem;
  font-weight: 600;
}

.project__cta span { display: inline-block; transition: transform .3s var(--ease-out); }
a.project:hover .project__cta span { transform: translateX(4px); }

/* Logotypy instytucji dofinansowujących: stała wysokość paska, żeby przyciski w kartach były na jednej linii. */
.project__logos {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  min-height: 62px;
  margin-top: 4px;
  padding-top: 16px;
  border-top: 1px solid #ece8e2;
}

.project__logo { display: block; width: auto; max-width: 100%; }
.project__logo--wide { width: 100%; height: auto; }
/* Dwa płaskie logotypy mają się zmieścić obok siebie także w wąskiej karcie (szerokość karty min(82vw, 380px) minus 56px marginesów i odstęp). */
.project__logo--flat { height: min(34px, calc((min(82vw, 380px) - 72px) / 8.7)); }
.project__logo--block { height: 42px; }

/* ---------- Musical notes ---------- */

/* A small note in front of every section label. */
.eyebrow { display: flex; align-items: center; gap: .7em; }

.eyebrow::before {
  content: "";
  flex: none;
  width: .78em;
  height: 1.3em;
  background: currentColor;
  -webkit-mask: url(assets/note.svg) center / contain no-repeat;
          mask: url(assets/note.svg) center / contain no-repeat;
}

/* Notes that keep rising through the hero. */
.hero__float { position: absolute; inset: 0; pointer-events: none; }

.fnote {
  --o: .5;
  position: absolute;
  left: var(--x);
  bottom: -50px;
  width: var(--s);
  height: auto;
  fill: var(--red);
  opacity: 0;
  animation: drift var(--dur) linear var(--delay) infinite;
}

.fnote--gray { --o: .4; fill: #8a8782; }

@keyframes drift {
  0%   { opacity: 0; transform: translate(0, 0) rotate(-10deg); }
  12%  { opacity: var(--o); }
  50%  { transform: translate(calc(var(--dx) * .5), calc(var(--rise) * -.5)) rotate(8deg); }
  88%  { opacity: var(--o); }
  100% { opacity: 0; transform: translate(var(--dx), calc(var(--rise) * -1)) rotate(-6deg); }
}

@media (max-width: 760px) {
  .fnote { display: none; }
}

/* A wavy staff straddling the edge between two sections. */
.staff {
  --sh: clamp(70px, 9vw, 120px);
  position: relative;
  z-index: 2;
  height: var(--sh);
  margin-block: calc(var(--sh) / -2);
  pointer-events: none;
}

.staff__lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.staff__lines path { stroke: #cfcac2; stroke-width: 1.8; }
.staff__lines path:nth-child(2) { --n: 1; }
.staff__lines path:nth-child(3) { --n: 2; }
.staff__lines path:nth-child(4) { --n: 3; }
.staff__lines path:nth-child(5) { --n: 4; }

.staff__note,
.about__note {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--s);
  height: auto;
  fill: var(--red);
  transform-origin: 50% 100%;
}

.staff__note--gray,
.about__note--gray { fill: #8a8782; }

/* Lines draw themselves and the notes pop in the first time the staff scrolls into view, then keep drifting. */
.js-ready .staff:not(.in-view) .staff__lines path { stroke-dasharray: 1; stroke-dashoffset: 1; }
.js-ready .staff:not(.in-view) .staff__note { opacity: 0; }

.staff.in-view .staff__lines path {
  stroke-dasharray: 1;
  animation:
    draw 2s var(--ease-in-out) calc(var(--n, 0) * .1s) both,
    staff-sway 8s ease-in-out calc(var(--n, 0) * -1.5s) infinite alternate;
}

.staff.in-view .staff__note {
  animation: note-pop .8s cubic-bezier(.3, .7, .3, 1) calc(.8s + var(--d) * .14s) both;
}

@keyframes staff-sway {
  from { transform: translateY(0); }
  to   { transform: translateY(-9px); }
}

/* Fixed decoration in the empty side margins of wide screens. */
.side { display: none; }

@media (min-width: 1360px) {
  .side {
    --gw: calc((100vw - 1160px) / 2);
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 5;
    display: flex;
    justify-content: center;
    width: var(--gw);
    overflow: hidden;
    pointer-events: none;
  }

  .side--left { left: 0; }
  .side--right { right: 0; }
  .side--right .side__lines { transform: scaleX(-1); }
}

.side__stage { position: relative; width: min(100%, 190px); height: 100%; }

.side__lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

.side__lines path {
  stroke: #d3cfc8;
  stroke-width: 1.4;
  vector-effect: non-scaling-stroke;
  animation: side-sway 9s ease-in-out infinite alternate;
}

.side__lines path:nth-child(2) { animation-delay: -1.6s; }
.side__lines path:nth-child(3) { animation-delay: -3.2s; }
.side__lines path:nth-child(4) { animation-delay: -4.8s; }
.side__lines path:nth-child(5) { animation-delay: -6.4s; }

.snote {
  --o: .5;
  --rise: 115vh;
  position: absolute;
  left: var(--x);
  bottom: -50px;
  width: var(--s);
  height: auto;
  fill: var(--red);
  opacity: 0;
  animation: drift var(--dur) linear var(--delay) infinite;
}

.snote--gray { --o: .4; fill: #8a8782; }
.snote--down { top: -50px; bottom: auto; animation-name: drift-down; }

@keyframes side-sway {
  from { transform: translateX(-9px); }
  to   { transform: translateX(9px); }
}

@keyframes drift-down {
  0%   { opacity: 0; transform: translate(0, 0) rotate(8deg); }
  12%  { opacity: var(--o); }
  50%  { transform: translate(calc(var(--dx) * .5), calc(var(--rise) * .5)) rotate(-8deg); }
  88%  { opacity: var(--o); }
  100% { opacity: 0; transform: translate(var(--dx), var(--rise)) rotate(6deg); }
}

/* Notes dancing around the logo in "O nas". */
.about__mark { position: relative; }

/* ---------- Reveal ---------- */

/* Page content rises in once the intro curtain starts lifting. */
.has-intro .reveal { opacity: 0; }

.intro-leave .reveal {
  animation: reveal-up .9s var(--ease-out) calc(.25s + var(--i, 0) * .09s) both;
}

.intro-done .reveal { opacity: 1; }

/* Below the fold: rise in as each block scrolls into view (class set by site.js). */
.js-ready .reveal-on-scroll:not(.in-view) { opacity: 0; transform: translateY(28px); }

.reveal-on-scroll {
  transition: opacity .8s var(--ease-out) calc(var(--i, 0) * .09s), transform .8s var(--ease-out) calc(var(--i, 0) * .09s);
}

.post.reveal-on-scroll { transition-property: opacity, transform, box-shadow; }

@keyframes reveal-up {
  from { opacity: 0; transform: translateY(28px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- "Animacje: wyłączone" ---------- */

/* Animations are on by default on every system (Windows 10 often reports "reduce motion" without the user knowing).
   Visitors who want a still page switch them off with the footer button; html.no-motion is set before the first paint. */
html.no-motion,
html.no-motion * ,
html.no-motion *::before,
html.no-motion *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

html.no-motion .reveal,
html.no-motion .reveal-on-scroll { opacity: 1 !important; transform: none !important; }
html.no-motion .hero__lines path,
html.no-motion .staff__lines path { stroke-dashoffset: 0 !important; }
html.no-motion .hero__notes .note,
html.no-motion .staff__note { opacity: 1 !important; }
html.no-motion .fnote,
html.no-motion .snote { display: none; }

/* The ribbons stand still and can be swiped instead. */
html.no-motion .ribbon,
html.no-motion .projects__marquee { -webkit-mask-image: none; mask-image: none; }
html.no-motion .ribbon__row,
html.no-motion .projects__marquee { overflow-x: auto; scrollbar-width: none; }
html.no-motion .ribbon__track,
html.no-motion .projects__track { padding-inline: var(--gap, 16px); }
html.no-motion .ribbon__set[aria-hidden="true"],
html.no-motion .projects__set[aria-hidden="true"] { display: none; }

.motion-toggle {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.motion-toggle:hover { color: var(--ink); }
