/* ==========================================================================
   Base – shared by every page
   reset · typography · layout · buttons · header · footer · cursors
   ========================================================================== */

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); }
body {
  margin: 0;
  background: var(--c-white);
  color: var(--c-text);
  font-family: var(--font-ui);
  font-size: var(--fs-ui);
  line-height: var(--lh);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
h1, h2, h3, h4, h5, p, ul, figure { margin: 0; }
ul { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; }
}

/* ---------- Text selection ---------- */
::selection { background: var(--c-bordo); color: var(--c-blue-light); }
/* on the bordo footer the colours swap, otherwise the selection would be invisible */
.site-footer ::selection { background: var(--c-blue-light); color: var(--c-bordo); }

/* ---------- Custom cursors ---------- */
html, body { cursor: var(--cursor-default); }
a, button, [role="button"], label, summary { cursor: var(--cursor-pointer); }
button:disabled, [aria-disabled="true"] { cursor: not-allowed; }

/* ---------- Cursor trail: little butterflies (js/cursor-trail.js) ----------
   Each one appears behind the cursor, flaps its wings and flutters up and away
   while fading out. Colours follow the hero butterfly (orange → pink). */
.cursor-trail {
  position: fixed;
  inset: 0;
  z-index: 999;
  pointer-events: none;
  overflow: hidden;
}
.cursor-bfly {
  position: absolute;
  width: var(--size, 16px);
  height: var(--size, 16px);
  margin: calc(var(--size, 16px) / -2) 0 0 calc(var(--size, 16px) / -2);
  animation: bfly-fly 1.4s cubic-bezier(.25, .6, .3, 1) forwards;
}
.cursor-bfly svg { width: 100%; height: 100%; overflow: visible; }
.cursor-bfly__wings {
  fill: currentColor;
  transform-box: fill-box;
  transform-origin: center;
  animation: bfly-flap var(--flap, .2s) ease-in-out infinite alternate;
}
.cursor-bfly__body { fill: var(--c-bordo); }

@keyframes bfly-fly {
  0%   { opacity: 0; transform: translate(0, 0) rotate(0) scale(.4); }
  15%  { opacity: .95; transform: translate(calc(var(--tx) * .15), calc(var(--ty) * .15)) rotate(calc(var(--rot) * .3)) scale(1); }
  70%  { opacity: .85; }
  100% { opacity: 0; transform: translate(var(--tx), var(--ty)) rotate(var(--rot)) scale(.7); }
}
/* seen from above: wings fold towards the body and open again */
@keyframes bfly-flap {
  from { transform: scaleX(1); }
  to   { transform: scaleX(.25); }
}
@media (prefers-reduced-motion: reduce) {
  .cursor-trail { display: none; }
}

/* ---------- Accessibility helpers ---------- */
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap;
}
.skip-link {
  position: absolute; left: 16px; top: -100px; z-index: 1000;
  padding: 12px 20px;
  background: var(--c-bordo); color: var(--c-white);
  border-radius: var(--radius-pill);
}
.skip-link:focus { top: 12px; }

:focus-visible {
  outline: 3px solid var(--c-bordo);
  outline-offset: 3px;
}

/* ---------- Typography (scale from content.txt) ---------- */
.h1 { font: 400 var(--fs-h1)/var(--lh) var(--font-heading); }
.h2 { font: 700 var(--fs-h2)/var(--lh) var(--font-heading); }
.h3 { font: 400 var(--fs-h3)/var(--lh) var(--font-heading); }
.h4 { font: 200 var(--fs-h4)/var(--lh) var(--font-ui); }
.h5 { font: 300 var(--fs-h5)/var(--lh) var(--font-ui); }

/* ---------- Layout ---------- */
.container {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* ---------- Icons (SVG used as a mask → inherits text colour) ---------- */
.icon {
  display: inline-block;
  flex: none;
  background-color: currentColor;
  -webkit-mask: var(--icon) center / contain no-repeat;
          mask: var(--icon) center / contain no-repeat;
}
.icon--right  { --icon: url("/assets/right-arrow.svg");  width: 15px; height: 13px; }
.icon--down   { --icon: url("/assets/down-arrow.svg");   width: 13px; height: 15px; }
.icon--arrow  { --icon: url("/assets/arrow-button.svg"); width: 44px; height: 39px; }

/* ---------- Peach "marker" highlight with irregular edges ----------
   Fill = background colour, ragged top/bottom = repeating mask tile,
   ragged ends = two small caps. Works across line breaks (box-decoration-break).
   Used in the homepage intro and for case-study tags. */
.marker {
  --marker-edge: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 40' preserveAspectRatio='none'%3E%3Cpath d='M0 3.2 4 2.1 9 3.6 13 1.6 18 2.8 23 1.2 27 3.1 32 2 36 3.7 41 1.9 45 2.6 50 1 55 3 59 1.8 64 3.2V36.4L60 38.2 56 36.6 51 38.6 47 37 42 38.9 38 36.8 33 38.2 28 36.5 24 38.7 19 37.1 15 38.5 10 36.6 5 38.4 0 36.4Z'/%3E%3C/svg%3E");
  --marker-start: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 40' preserveAspectRatio='none'%3E%3Cpath d='M10 0V40H2.6L1.2 35 3 30.5.6 26 2.2 21 .4 16.5 2.4 12 .8 7.5 2.8 3.4 1.6 0Z'/%3E%3C/svg%3E");
  --marker-end: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 40' preserveAspectRatio='none'%3E%3Cpath d='M0 0V40H7.8L9.2 35.4 7.4 31 9.6 26.2 7.8 21.6 9.4 17 7.6 12.4 9.6 8 8 3.6 8.8 0Z'/%3E%3C/svg%3E");
  --marker-mid: linear-gradient(#000 0 0);

  color: inherit;
  padding: .06em .18em;
  margin: 0 -.06em;
  /* the fill is a gradient so it can be "drawn" from left to right (homepage) */
  background: linear-gradient(var(--c-peach), var(--c-peach)) left center / 100% 100% no-repeat;
  -webkit-box-decoration-break: clone;
          box-decoration-break: clone;

  mask-image: var(--marker-edge), var(--marker-start), var(--marker-end), var(--marker-mid);
  mask-size: 64px 100%, 10px 100%, 10px 100%, calc(100% - 18px) 100%;
  mask-position: 0 0, left top, right top, center;
  mask-repeat: repeat-x, no-repeat, no-repeat, no-repeat;
  mask-composite: intersect, add, add, add;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

/* Outline button: "Discover my work", "Go to case study", "Send me a message" */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 60px;
  padding: 0 36px;
  border: 1px solid var(--c-text);
  border-radius: var(--radius-pill);
  background: var(--c-white);
  color: var(--c-text);
  font: 400 var(--fs-btn)/1.2 var(--font-ui);
  white-space: nowrap;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
@media (hover: hover) {
  .btn:hover { background: var(--c-blue-light); transform: translateY(-2px); }
}
.btn:active { transform: none; }
.btn:active { background: var(--c-bordo); border-color: var(--c-bordo); color: var(--c-white); }
.btn:disabled, .btn[aria-disabled="true"] {
  background: var(--c-white);
  border-color: var(--c-disabled);
  color: var(--c-disabled);
  pointer-events: none;
}

/* Outline button on bordo background: LinkedIn, Instagram */
.btn--on-dark {
  background: transparent;
  border-color: var(--c-blue-light);
  color: var(--c-blue-light);
  padding: 0 28px;
}
@media (hover: hover) {
  .btn--on-dark:hover { background: transparent; border-color: var(--c-white); color: var(--c-white); transform: none; } /* LinkedIn / Instagram don't lift */
}
.btn--on-dark:active { background: rgba(190, 222, 244, .12); border-color: var(--c-blue-light); color: var(--c-blue-light); }
.btn--on-dark:focus-visible { outline-color: var(--c-blue-light); }

/* Pill / chip: filters (All, UX/UI, Branding) */
.chip {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid var(--c-text);
  border-radius: var(--radius-pill);
  background: var(--c-white);
  color: var(--c-text);
  font: 400 var(--fs-ui)/1 var(--font-ui);
  white-space: nowrap;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
@media (hover: hover) {
  .chip:hover { background: var(--c-blue-light); transform: translateY(-2px); }
  .chip[aria-pressed="true"]:hover { background: var(--c-bordo); }
}
.chip[aria-pressed="true"],
.chip:active { background: var(--c-bordo); border-color: var(--c-bordo); color: var(--c-blue-light); }
.chip:active { transform: none; }
.chip:disabled { transform: none; }
.chip:disabled { background: var(--c-white); border-color: var(--c-disabled); color: var(--c-disabled); }

/* ==========================================================================
   Header
   ========================================================================== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--c-white);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  height: var(--header-h);
}
/* the logo SVG has a square 1159 viewBox with empty margins → the image box is larger than the visible mark */
.site-header__logo { display: block; width: 60px; height: 47px; flex: none; position: relative; }
.site-header__logo img { position: absolute; left: -2px; top: 50%; width: 63px; height: 63px; max-width: none; transform: translateY(-46%); }

.site-nav { display: flex; align-items: center; gap: 17px; }
.site-nav__list { display: flex; align-items: center; gap: 18px; }

.site-nav__link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 24px;
  border-radius: var(--radius-pill);
  color: var(--c-bordo);
  font: 400 var(--fs-ui)/1 var(--font-ui);
  transition: background-color var(--dur) var(--ease);
}
@media (hover: hover) {
  .site-nav__link:hover { background: var(--c-peach); }
}
.site-nav__link:active { background: transparent; }
.site-nav__link[aria-current="page"] { font-weight: 500; }

/* "Copy e-mail" */
.copy-email { position: relative; }
.copy-email__btn {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 20px;
  border-radius: var(--radius-pill);
  background: var(--c-blue-light);
  color: var(--c-bordo);
  font: 400 var(--fs-ui)/1 var(--font-ui);
  white-space: nowrap;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
@media (hover: hover) {
  .copy-email__btn:hover { background: var(--c-bordo); color: var(--c-white); transform: translateY(-2px); }
}
.copy-email__btn:active { transform: none; }
.copy-email__btn:active,
.copy-email.is-copied .copy-email__btn { background: var(--c-blue-light); color: var(--c-bordo); transform: none; }

/* both labels share one grid cell → the button keeps the width of the longer one */
.copy-email__labels { display: grid; justify-items: center; }
.copy-email__label { grid-area: 1 / 1; display: inline-flex; align-items: center; gap: 6px; transition: opacity var(--dur) var(--ease); }
.copy-email__label--done { opacity: 0; }
.copy-email__check { width: 12px; height: 10px; flex: none; }
.copy-email.is-copied .copy-email__label--default { opacity: 0; }
.copy-email.is-copied .copy-email__label--done { opacity: 1; }

/* ---------- Language switch (PL / EN) – line-art vinyl record ----------
   White pill with a black outline like the other buttons. Side A (bordo label)
   = PL, side B (empty label) = EN. On click the record spins and flips over and
   the tonearm swings out and back (main.js adds .is-moving). The active language
   is underlined in bordo. main.js keeps data-lang, <html lang> and the labels in sync. */
.lang-switch { display: inline-flex; flex: none; border-radius: var(--radius-pill); -webkit-tap-highlight-color: transparent; }
/* sits in the header row after the nav (outside the mobile menu):
   desktop – right after "Copy e-mail", same 17px gap as inside the nav;
   mobile – next to the hamburger (see the 900px breakpoint below) */
.site-nav { margin-left: auto; }
.site-header__inner > .lang-switch { margin-left: -7px; }
.lang-switch__plate {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--c-text);          /* same outline as the other buttons */
  border-radius: var(--radius-pill);
  background: var(--c-white);
  color: var(--c-text);
  transition: background-color var(--dur) var(--ease);
}
.lang-switch__mark {
  position: relative;
  color: var(--c-text-muted);
  font: 500 .75rem/1 var(--font-ui);
  letter-spacing: .1em;
  transition: color .3s var(--ease);
}
.lang-switch__mark::after {                   /* bordo underline under the active language */
  content: "";
  position: absolute; left: 0; right: .1em; bottom: -5px;
  height: 1.5px; border-radius: 1px;
  background: var(--c-bordo);
  transform: scaleX(0);
  transition: transform .3s var(--ease);
}
.lang-switch[data-lang="pl"] .lang-switch__mark--pl,
.lang-switch[data-lang="en"] .lang-switch__mark--en { color: var(--c-bordo); }
.lang-switch[data-lang="pl"] .lang-switch__mark--pl::after,
.lang-switch[data-lang="en"] .lang-switch__mark--en::after { transform: scaleX(1); }

/* record + tonearm, drawn with a 1.5 px line so they stay crisp at this size */
.lang-switch__deck { position: relative; display: block; width: 34px; height: 26px; }
.lang-switch__flip {
  position: absolute; left: 0; top: 1px;
  width: 24px; height: 24px;
  transform-style: preserve-3d;
  transform: perspective(200px) rotateY(0deg);
  transition: transform .5s cubic-bezier(.45, .05, .25, 1);
}
.lang-switch[data-lang="en"] .lang-switch__flip { transform: perspective(200px) rotateY(180deg); }
.lang-switch__face { position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.lang-switch__face--b { transform: rotateY(180deg); }
.lang-switch__disc { width: 24px; height: 24px; }
.lang-switch__arm {
  position: absolute; right: 0; top: 0;
  width: 10px; height: 22px;
  overflow: visible;
  transform-origin: 7px 2.5px;
}
.lang-switch svg * { fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.lang-switch svg .ls-fill   { fill: var(--c-white); transition: fill var(--dur) var(--ease); }
.lang-switch svg .ls-groove { stroke-width: .75; }
.lang-switch svg .ls-accent { stroke: var(--c-bordo); }
.lang-switch svg .ls-solid  { fill: var(--c-bordo); }
.lang-switch svg .ls-hole   { fill: var(--c-white); stroke: none; }

.lang-switch.is-moving .lang-switch__disc { animation: ls-spin .5s cubic-bezier(.3, 0, .3, 1); }
.lang-switch.is-moving .lang-switch__arm  { animation: ls-arm .5s cubic-bezier(.4, 0, .2, 1); }
@keyframes ls-spin { to { transform: rotate(360deg); } }
@keyframes ls-arm {
  0%, 100% { transform: rotate(0deg); }
  35%, 65% { transform: rotate(-26deg); }
}

@media (hover: hover) {
  .lang-switch:hover .lang-switch__plate { background: var(--c-blue-light); }
  .lang-switch:hover svg .ls-fill { fill: var(--c-blue-light); }
}
@media (prefers-reduced-motion: reduce) {
  .lang-switch__flip, .lang-switch__mark, .lang-switch__mark::after { transition: none; }
  .lang-switch.is-moving .lang-switch__disc,
  .lang-switch.is-moving .lang-switch__arm { animation: none; }
}
/* Hamburger (mobile / tablet) */
.nav-toggle {
  display: none;
  position: relative;
  width: 48px; height: 48px;
  margin-right: -12px;
  border-radius: var(--radius-pill);
}
.nav-toggle__bar,
.nav-toggle__bar::before,
.nav-toggle__bar::after {
  position: absolute;
  left: 50%;
  width: 24px; height: 2px;
  margin-left: -12px;
  background: var(--c-bordo);
  border-radius: 2px;
  transition: transform .25s var(--ease), opacity .2s;
}
.nav-toggle__bar { top: 50%; margin-top: -1px; }
.nav-toggle__bar::before, .nav-toggle__bar::after { content: ""; left: 0; margin-left: 0; }
.nav-toggle__bar::before { transform: translateY(-7px); }
.nav-toggle__bar::after  { transform: translateY(7px); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar::before { transform: rotate(45deg); background: var(--c-bordo); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bar::after  { transform: rotate(-45deg); background: var(--c-bordo); }

@media (max-width: 900px) {
  :root { --header-h: 64px; }
  .site-header__logo { width: 50px; height: 40px; }
  .site-header__logo img { width: 54px; height: 54px; }
  .nav-toggle { display: block; }

  .site-nav {
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 20px;
    padding: 16px var(--gutter) 32px;
    background: var(--c-white);
    box-shadow: 0 16px 24px -16px rgba(18, 31, 19, .2);
    visibility: hidden;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity .2s var(--ease), transform .2s var(--ease), visibility 0s .2s;
  }
  .site-nav.is-open {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: opacity .2s var(--ease), transform .2s var(--ease);
  }
  .site-nav__list { flex-direction: column; align-items: stretch; gap: 4px; }
  .site-nav__link { width: 100%; min-height: 52px; font-size: 1.125rem; }
  .copy-email { align-self: flex-start; }
  .site-header__inner > .lang-switch { order: 2; margin-left: auto; }
  .nav-toggle { order: 3; margin-left: -12px; }
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  background: var(--c-bordo);
  color: var(--c-blue-light);
}
.site-footer__inner {
  display: grid;
  grid-template-columns: 1fr minmax(0, 552px);
  grid-template-areas:
    "logo   aside"
    "copy   copy";
  gap: 0 40px;
  min-height: 476px;
  padding-top: 48px;
  padding-bottom: 32px;
}
.site-footer__logo { grid-area: logo; position: relative; display: block; width: 52px; height: 40px; margin-top: 6px; }
.site-footer__logo img { position: absolute; left: -1px; top: 50%; width: 52px; height: 52px; max-width: none; transform: translateY(-46%); }

.site-footer__aside { grid-area: aside; }
.site-footer__social { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 20px; }

.footer-mail {
  position: relative;
  display: block;
  margin-top: 32px;
  padding: 18px 40px 0 0;
  border-top: 1px dashed rgba(190, 222, 244, .55);
  color: var(--c-blue-light);
  font: 200 clamp(1.25rem, .9rem + 1.4vw, 2rem)/1.4 var(--font-ui);
  overflow-wrap: anywhere;
  transition: color var(--dur) var(--ease);
}
.footer-mail__arrow {
  position: absolute;
  top: 18px; right: 4px;
  font-size: 1rem;
  line-height: 1;
  transition: transform .3s var(--ease);
}
@media (hover: hover) {
  .footer-mail:hover { color: var(--c-white); }
  .footer-mail:hover .footer-mail__arrow { transform: translate(5px, -5px); }
}
.footer-mail:focus-visible { outline-color: var(--c-blue-light); }

.site-footer__copy {
  grid-area: copy;
  align-self: end;
  color: var(--c-on-bordo-muted);
  font: 400 var(--fs-small)/1.5 var(--font-ui);
}

@media (max-width: 760px) {
  .site-footer__inner {
    grid-template-columns: 1fr;
    grid-template-areas: "logo" "aside" "copy";
    gap: 40px;
    min-height: 0;
  }
  .site-footer__social { justify-content: flex-start; }
}
