/* Kalendarze 2027 · edytorski katalog w trzech trybach kolorystycznych; Garamond w dużym stopniu, Inter w tekście.
   Tryb ustawia atrybut data-theme na <html> (przełącznik w nagłówku, zapamiętany w przeglądarce).
   --accent to kolor plam (przyciski, ramki), --accent-text to ta sama barwa przyciemniona do kontrastu AA na tle. */
:root,
[data-theme="tangerine"] {
  /* Midnight Blue #123448 (tło) · Ice Blue #DCEFF4 (tekst) · Tangerine #FF781F */
  --paper: #123448;
  --paper-deep: #18405a;
  --ink: #dceff4;
  --muted: #9db9c6;
  --rule: rgb(220 239 244 / 0.5);
  --rule-soft: rgb(220 239 244 / 0.16);
  --accent: #ff781f;
  --accent-text: #ff781f;
  --on-accent: #123448;
  --shadow: rgb(0 0 0 / 0.5);
  color-scheme: dark;
}
[data-theme="hibiscus"] {
  /* Salt Grey #E5E5DE · Deep Olive #303B2E · Hibiscus Pink #FF4F8B */
  --paper: #e5e5de;
  --paper-deep: #d6d6cc;
  --ink: #303b2e;
  --muted: #5e665a;
  --rule: rgb(48 59 46 / 0.5);
  --rule-soft: rgb(48 59 46 / 0.14);
  --accent: #ff4f8b;
  --accent-text: #b0184f;
  --on-accent: #1b2119;
  --shadow: rgb(48 59 46 / 0.22);
  color-scheme: light;
}
[data-theme="oxblood"] {
  /* Oxblood #411827 · Liquid Silver #CDD1DC · Ballet Pink #EAC4D4 */
  --paper: #411827;
  --paper-deep: #4e1e30;
  --ink: #cdd1dc;
  --muted: #b79aa8;
  --rule: rgb(205 209 220 / 0.5);
  --rule-soft: rgb(205 209 220 / 0.16);
  --accent: #eac4d4;
  --accent-text: #eac4d4;
  --on-accent: #411827;
  --shadow: rgb(0 0 0 / 0.55);
  color-scheme: dark;
}
:root {
  --serif: "Cormorant Garamond", "EB Garamond", Garamond, Georgia, serif;
  --sans: "Inter", system-ui, sans-serif;
  --gutter: clamp(16px, 4vw, 48px);
  --gap: clamp(16px, 2.4vw, 40px);
  --section: clamp(96px, 12vw, 180px);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  scroll-padding-top: 80px;
  scroll-behavior: smooth;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: clip; }
body { margin: 0; background: var(--paper); }
h1, h2, h3, p, figure, dl, dd, ul { margin: 0; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; }
button { color: inherit; font: inherit; cursor: pointer; }
:focus-visible { outline: 1.5px solid var(--accent-text); outline-offset: 4px; }
[hidden] { display: none !important; }
em { font-style: italic; }

.wrap { width: calc(100% - 2 * var(--gutter)); margin-inline: auto; }

/* Etykiety: drobny Inter wersalikami, z rozstrzeleniem */
.label {
  font-family: var(--sans);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.label--accent { color: var(--accent-text); }

/* Nagłówki: Garamond, regular, ciasna interlinia, ujemny tracking w dużym stopniu */
h1, h2, h3, .serif {
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.015em;
  text-wrap: balance;
}
h1 em, h2 em { color: var(--accent-text); }

.skip-link {
  position: fixed; z-index: 10; top: 8px; left: var(--gutter);
  padding: 10px 16px; transform: translateY(-160%);
  background: var(--ink); color: var(--paper);
}
.skip-link:focus { transform: none; }

/* Nagłówek strony */
.site-header {
  position: sticky; z-index: 5; top: 0;
  background: color-mix(in srgb, var(--paper) 90%, transparent);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-bottom: 1px solid var(--rule);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px 24px; min-height: 64px; flex-wrap: wrap;
}
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--sans); font-weight: 700; font-size: 19px; line-height: 1; letter-spacing: -0.02em;
  text-decoration: none; white-space: nowrap;
}
/* Znak „dobre dni”: słońce z uśmiechem w kolorze akcentu; na jasnym motywie w kolorze tekstu (kontrast) */
.brand-sun { width: 28px; height: 28px; flex: none; fill: var(--accent); }
[data-theme="hibiscus"] .brand-sun { fill: var(--ink); }
.site-nav {
  --nav-gap: clamp(12px, 2.6vw, 32px);
  display: flex;
  gap: var(--nav-gap);
  margin-inline-start: auto;
}
.site-nav a {
  display: inline-flex; min-height: 44px; align-items: center;
  font-size: 11px; font-weight: 500; letter-spacing: 0.22em; text-transform: uppercase;
  text-decoration: none; background: linear-gradient(currentColor, currentColor) left calc(50% + 10px) / 0 1px no-repeat;
  transition: background-size 240ms var(--ease-out), color 160ms ease;
}
.site-nav a[aria-current] { color: var(--accent-text); background-size: 100% 1px; }
/* Narzędzia w nagłówku: język, kolorystyka, a na wąskim ekranie przycisk menu */
.header-tools { display: flex; align-items: center; gap: 12px; }
.language-link {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; height: 44px; padding-inline-start: 12px;
  font-size: 11px; font-weight: 500; letter-spacing: 0.22em; text-decoration: none;
  transition: color 160ms ease;
}
.language-link::before {
  content: ""; position: absolute; left: 0; top: 50%;
  width: 1px; height: 12px; transform: translateY(-50%); background: var(--rule);
}
.menu-toggle {
  display: none; position: relative;
  width: 44px; height: 44px; padding: 0; border: 0; background: none;
}
.menu-toggle span {
  position: absolute; left: 11px; right: 11px; top: 50%; height: 1.5px; margin-top: -0.75px; background: currentColor;
  transition: transform 220ms var(--ease-out);
}
.menu-toggle span:first-child { transform: translateY(-4px); }
.menu-toggle span:last-child { transform: translateY(4px); }
.menu-toggle[aria-expanded="true"] span:first-child { transform: rotate(45deg); }
.menu-toggle[aria-expanded="true"] span:last-child { transform: rotate(-45deg); }
.menu-toggle:active { transform: scale(0.94); }
@media (hover: hover) and (pointer: fine) {
  .site-nav a:hover, .brand:hover, .language-link:hover { color: var(--accent-text); }
  .site-nav a:hover { background-size: 100% 1px; }
}

/* Przyciski */
.actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: clamp(28px, 3vw, 40px); }
.preorder-deadline { margin-top: 14px; font-weight: 600; }
.button {
  display: inline-flex; min-height: 48px; align-items: center; justify-content: center; gap: 12px;
  border: 1px solid var(--ink); padding: 12px 22px;
  background: transparent; color: var(--ink);
  font-size: 11px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase;
  text-decoration: none; white-space: nowrap;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms var(--ease-out);
}
.button span { transition: transform 200ms var(--ease-out); }
.button:active { transform: scale(0.98); }
.button[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }
.button small { font-size: inherit; font-weight: 400; letter-spacing: 0.12em; }
.button--solid { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
@media (hover: hover) and (pointer: fine) {
  .button:hover { background: var(--ink); color: var(--paper); }
  .button--solid:hover { background: var(--ink); border-color: var(--ink); }
  .button:hover span { transform: translateX(3px); }
}

/* Hero */
.hero {
  /* wysokość nagłówka, paska N° 2027 i odstępów nad ilustracjami */
  --hero-chrome: 190px;
  padding-top: 14px;
  /* hero wypełnia ekran pod nagłówkiem, blok z tekstem i ramkami stoi na jego środku */
  display: flex; flex-direction: column;
  min-height: calc(100svh - var(--header-h, 65px));
}
.hero-grid { flex: 1; align-content: center; padding-bottom: clamp(20px, 3vh, 32px); }
.hero-bar {
  display: flex; justify-content: space-between; gap: 16px;
  padding-bottom: 12px; border-bottom: 1px solid var(--rule-soft);
}
.hero-grid {
  display: grid; gap: clamp(32px, 5vw, 64px);
  padding-top: clamp(20px, 3vh, 32px);
}
.hero h1 { font-size: clamp(52px, 7.6vw, 124px); line-height: 0.92; letter-spacing: -0.03em; }
.lead {
  max-width: 30ch; margin-top: clamp(24px, 3vw, 40px);
  font-family: var(--serif); font-style: italic; font-size: clamp(22px, 2vw, 28px); line-height: 1.3;
}
.hero-figure { min-width: 0; }

/* Hero: dwie ramki 4:5 z czystymi ilustracjami, losowo ze wszystkich serii, zmieniają się na przemian */
.hero-slider {
  display: flex; justify-content: center; align-items: flex-end;
  gap: clamp(12px, 1.6vw, 24px);
  padding-inline: clamp(0px, 3.5vw, 56px);
}
.tile {
  position: relative; overflow: hidden;
  flex: 0 1 calc((100svh - var(--hero-chrome)) * 4 / 5); min-width: 0;
  aspect-ratio: 4 / 5;
  border: 0; padding: 0; background: var(--rule-soft); cursor: pointer;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.2), 0 24px 48px -24px var(--shadow);
  transition: transform 160ms var(--ease-out);
}
.tile:active { transform: scale(0.985); }
.tile-img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transform: scale(1.03);
  transition: opacity 1100ms var(--ease-out), transform 1600ms var(--ease-out);
}
.tile-img.is-active { opacity: 1; transform: none; }
@media (hover: hover) and (pointer: fine) {
  .tile-img.is-active { transition: opacity 1100ms var(--ease-out), transform 700ms var(--ease-out); }
  .tile:hover .tile-img.is-active { transform: scale(1.02); }
}
@media (prefers-reduced-motion: reduce) {
  .tile-img { transform: none; transition: opacity 300ms ease; }
}

/* Telefon i wąski ekran: nagłówek, lead, ilustracje, a pod nimi przyciski równej szerokości; wszystko na krawędzi siatki */
@media (max-width: 55.99rem) {
  .hero-grid { gap: 0; }
  .hero-copy { display: contents; }
  .hero h1 { order: 1; }
  .hero .lead { order: 2; }
  .hero .preorder-deadline { order: 3; }
  .hero-figure.hero-slider { order: 4; padding-inline: 0; margin-top: clamp(28px, 6vw, 40px); }
  .hero .actions { order: 5; flex-direction: column; align-items: stretch; }
  .hero .actions .button { width: 100%; }
}

/* Sekcje */
.section { margin-top: var(--section); }
.section-head {
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 32px;
  padding-bottom: clamp(20px, 2.5vw, 32px); border-bottom: 1px solid var(--rule);
}
.section-head h2 { font-size: clamp(48px, 8.4vw, 128px); line-height: 0.92; }
.section-head .label { text-align: right; padding-bottom: 6px; }

/* Kolekcja */
.collection {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  column-gap: var(--gap);
  row-gap: clamp(36px, 5vw, 64px);
  padding-top: clamp(26px, 4vw, 56px);
}
.work { min-width: 0; }
.work-link {
  display: block;
  width: 100%;
  max-width: 54.4svh;
  margin-inline: auto;
  text-decoration: none;
}
.work-media {
  position: relative;
  overflow: clip;
  width: 100%;
  aspect-ratio: 4 / 5;
  background: var(--paper-deep);
}
.work-image, .work-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.work-art {
  opacity: 0;
  transition: opacity 300ms var(--ease-out);
}
.chip {
  position: absolute; right: 12px; bottom: 12px;
  padding: 6px 10px; background: var(--paper); font-size: 10px;
}
.work-info { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--rule); }
.work-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.work-head h3 {
  font-size: clamp(30px, 3vw, 44px); line-height: 1.02;
  transition: color 160ms ease;
}
.work-head .serial { flex-shrink: 0; color: var(--muted); }
.work-desc { max-width: 44ch; margin-top: 12px; color: var(--muted); font-size: 15px; }
.work-meta { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 14px; }
.work-price { color: var(--ink); }
.work-price small { margin-left: 10px; color: var(--muted); font-size: inherit; }
@media (hover: hover) and (pointer: fine) {
  .work-media:hover .work-art.is-ready,
  .work-link:focus-visible .work-art.is-ready { opacity: 1; }
  .work-link:hover h3 { color: var(--accent-text); }
}
@media (hover: none) and (prefers-reduced-motion: no-preference),
       (pointer: coarse) and (prefers-reduced-motion: no-preference) {
  .work-media.is-in-view .work-art.is-ready {
    opacity: 1;
    transition-delay: 2.5s;
  }
}

@media (min-width: 36rem) {
  .collection { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 62rem) {
  .collection { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Jak to działa / Specyfikacja */
.split {
  display: grid; gap: 24px;
  padding-top: clamp(20px, 2.5vw, 32px); border-top: 1px solid var(--rule);
}
.order-option + .order-option { margin-top: 28px; padding-top: 28px; border-top: 1px solid var(--rule-soft); }
.option-heading { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 24px; margin-bottom: 10px; }
.option-heading h3 { font-size: clamp(36px, 4.4vw, 64px); }
.price { font-family: var(--serif); font-size: clamp(26px, 2.6vw, 36px); line-height: 1; color: var(--accent-text); }
.order-option > p { max-width: 48ch; color: var(--muted); }
.specs > div {
  display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 16px;
  padding-block: 16px; border-bottom: 1px solid var(--rule-soft);
}
.specs > div:first-child { padding-top: 0; }
.specs dt { font-size: 11px; font-weight: 500; letter-spacing: 0.22em; text-transform: uppercase; padding-top: 6px; }
.specs dd { font-family: var(--serif); font-size: clamp(22px, 2vw, 28px); line-height: 1.2; }
.specs dd p + p { margin-top: 0.65em; }


/* Przełącznik kolorystyki: trzy pastylki w kolorze tła danego trybu, bez obwódek; wybrana jest większa */
.theme-switch {
  display: flex; align-items: center; gap: 0; padding-inline: 4px;
  border-radius: 99px; background: color-mix(in srgb, var(--ink) 22%, transparent);
}
.theme-swatch {
  display: grid; place-items: center;
  width: 30px; height: 30px; padding: 0; border: 0; background: none;
  position: relative;
}
.theme-swatch::after { content: ""; position: absolute; inset: -7px 0; } /* cel dotykowy 44 px */
.theme-swatch::before {
  content: ""; width: 14px; height: 14px; border-radius: 50%;
  background: var(--sw);
  transform: scale(1);
  transition: transform 200ms var(--ease-out);
}
.theme-swatch--tangerine { --sw: #123448; }
.theme-swatch--hibiscus { --sw: #e5e5de; }
.theme-swatch--oxblood { --sw: #411827; }
.theme-swatch[aria-pressed="true"]::before { transform: scale(1.45); }
.theme-swatch:active::before { transform: scale(0.88); }
@media (hover: hover) and (pointer: fine) {
  .theme-swatch[aria-pressed="false"]:hover::before { transform: scale(1.2); }
}

/* Zmiana trybu: łagodne przenikanie tła i tekstu, bez skoku jasności */
html.theme-fading, html.theme-fading * { transition: background-color 280ms ease, color 280ms ease, border-color 280ms ease !important; }
@media (prefers-reduced-motion: reduce) {
  html.theme-fading, html.theme-fading * { transition: none !important; }
}

/* Stopka */
/* Stopka: jak na spark-hu-ai.netlify.app (treść i proporcje) */
.site-footer { margin-top: var(--section); border-top: 1px solid var(--ink); }
.end {
  display: grid; grid-template-columns: auto 1fr; gap: 24px 20px; align-items: start;
  padding: 30px 0 calc(36px + env(safe-area-inset-bottom));
  font-family: var(--sans); color: var(--ink);
}
.end-badge { width: 48px; height: auto; color: var(--ink); }
.end p { margin: 5px 0 0; font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.end-links { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 0 8px; }
.end-top { grid-column: 1 / -1; justify-self: start; }
.end a {
  position: relative; display: inline-flex; align-items: center; height: 30px; margin: 7px 0; padding: 0 14px;
  border: 1px solid currentColor; border-radius: 99px; color: var(--ink);
  font: 500 10.5px/1 var(--sans); letter-spacing: 0.08em; text-transform: uppercase;
  text-decoration: none; white-space: nowrap;
  transition: background-color 200ms ease, color 200ms ease, transform 160ms var(--ease-out);
}
.end a::after { content: ""; position: absolute; inset: -8px -4px; }
.end a.end-name, .end a.end-mail {
  display: block; height: auto; margin: 0; padding: 0; border: 0; border-radius: 2px;
  text-transform: none; white-space: normal;
}
.end a.end-name { font: 500 14px/1.2 var(--sans); letter-spacing: 0.02em; }
.end a.end-mail {
  display: inline-block; margin-top: 5px; font: 400 12.5px/1.5 var(--sans); letter-spacing: 0;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
}
.end a.end-name::after, .end a.end-mail::after { inset: -6px -8px; }
.end a:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) {
  .end a.end-name:hover { color: var(--accent-text); }
  .end a.end-mail:hover { text-decoration-color: var(--accent); }
  .end a:not(.end-name, .end-mail):hover { background: var(--ink); color: var(--paper); }
}
@media (min-width: 760px) {
  .end { grid-template-columns: auto 1fr auto auto; }
  .end-links, .end-top { grid-column: auto; }
}
@media (max-width: 480px) {
  .end-links { gap: 0 5px; justify-content: space-between; }
  .end-links a { padding: 0 8px; letter-spacing: 0.05em; }
}

@media (min-width: 56rem) {
  /* kolumna tekstu ma szerokość treści, plansza stoi na środku między tekstem a prawą krawędzią */
  /* 12 kolumn: tekst na 6, każda ramka na 3; góra nagłówka równo z górą ramek, przyciski równo z ich dołem */
  .hero-grid { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); align-items: stretch; }
  .hero-copy { grid-column: 1 / 7; display: flex; flex-direction: column; justify-content: space-between; }
  .hero-copy h1 { margin-top: -0.12em; }
  .hero-figure.hero-slider {
    grid-column: 7 / -1; align-self: stretch;
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: var(--gap);
    padding-inline: 0;
  }
  /* ramka ma co najmniej 4:5, a gdy tekst jest wyższy, rośnie do jego wysokości (kadr przycięty) */
  .hero-slider .tile { width: 100%; height: 100%; }
  /* mniejsza szpara między hero a kolekcją */
  .hero + .section { margin-top: clamp(56px, 6vw, 96px); }
}
@media (min-width: 56rem) and (max-width: 79.99rem) {
  .hero-copy { grid-column: 1 / 8; }
  .hero-figure.hero-slider { grid-column: 8 / -1; }
  .split { grid-template-columns: repeat(12, minmax(0, 1fr)); column-gap: var(--gap); }
  .split > .label { grid-column: 1 / 5; padding-top: 10px; }
  .split-body { grid-column: 5 / -1; }
}

@media (max-width: 40rem) {
  :root { scroll-padding-top: 124px; }
  .header-inner { padding-block: 8px; }
  .hero-bar span:nth-child(2) { display: none; }
  .section-head .label { text-align: left; }
}

/* Wąski ekran: menu chowa się pod hamburgerem; obok zostają język i kolorystyka */
@media (max-width: 55.99rem) {
  :root { scroll-padding-top: 76px; }
  .header-inner { flex-wrap: nowrap; position: relative; padding-block: 6px; }
  .header-tools { margin-inline-start: auto; gap: 4px; }
  .menu-toggle { display: block; margin-inline-end: -11px; }
  .language-link { min-width: 36px; padding-inline-start: 10px; }
  .theme-switch { padding-inline: 2px; }
  .theme-swatch { width: 26px; }
  .brand { white-space: nowrap; min-width: 0; }
  .site-nav {
    position: absolute; top: 100%; left: calc(-1 * var(--gutter)); right: calc(-1 * var(--gutter));
    flex-direction: column; gap: 0; margin: 0;
    padding: 8px var(--gutter) 20px;
    background: var(--paper); border-bottom: 1px solid var(--rule);
    box-shadow: 0 24px 40px -28px var(--shadow);
    opacity: 0; visibility: hidden; transform: translateY(-8px);
    transition: opacity 200ms var(--ease-out), transform 220ms var(--ease-out), visibility 0s linear 220ms;
  }
  .site-nav.is-open {
    opacity: 1; visibility: visible; transform: none;
    transition: opacity 200ms var(--ease-out), transform 220ms var(--ease-out), visibility 0s;
  }
  .site-nav a {
    min-height: 56px; border-bottom: 1px solid var(--rule-soft);
    font-family: var(--serif); font-size: 30px; font-weight: 400; letter-spacing: -0.01em; text-transform: none;
    background: none;
  }
  .site-nav a:last-child { border-bottom: 0; }
  .site-nav a[aria-current] { color: var(--accent-text); }
}
@media (max-width: 55.99rem) and (prefers-reduced-motion: reduce) {
  .site-nav, .site-nav.is-open { transform: none; }
}
@media (max-width: 24rem) {
  .brand { font-size: 17px; }
  .theme-swatch { width: 24px; }
  .header-tools { gap: 2px; }
}

/* ===== Podgląd pracy ===== */
.viewer {
  width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; border: 0; padding: 0;
  background: var(--paper); color: var(--ink);
  overscroll-behavior: contain;
}
.viewer[open] {
  display: grid; grid-template-columns: minmax(0, 1fr) clamp(320px, 28vw, 420px);
  grid-template-rows: minmax(0, 1fr);
  opacity: 1;
  transition: opacity 240ms var(--ease-out), display 240ms allow-discrete, overlay 240ms allow-discrete;
}
@starting-style { .viewer[open] { opacity: 0; } }
.viewer::backdrop { background: var(--paper); }

.viewer-stage {
  position: relative; min-width: 0; min-height: 0; height: 100%;
  user-select: none; touch-action: pan-y;
}
/* Ramka zawsze mieści się w ekranie: obraz dopasowany do niej, z oddechem dookoła */
.viewer-frame {
  position: absolute;
  inset: clamp(44px, 8vh, 88px) clamp(72px, 8vw, 136px);
}
.viewer-frame img {
  position: absolute; inset: 0; margin: auto;
  max-width: 100%; max-height: 100%; width: auto; height: auto;
  object-fit: contain;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.2), 0 24px 56px -24px var(--shadow);
  transition: opacity 280ms var(--ease-out), transform 420ms var(--ease-out);
}
.viewer-frame img.is-leaving { opacity: 0; }
.viewer-frame img.is-entering { opacity: 0; transform: translateX(calc(var(--dir, 1) * 16px)); }

.viewer-arrow {
  position: absolute; top: 50%; translate: 0 -50%;
  display: grid; place-items: center; width: 48px; height: 48px;
  border: 0; background: var(--paper); color: var(--ink);
  font-family: var(--sans); font-size: 20px; line-height: 1;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms var(--ease-out);
}
.viewer-arrow--prev { left: clamp(8px, 2vw, 28px); }
.viewer-arrow--next { right: clamp(8px, 2vw, 28px); }
.viewer-arrow:active { transform: scale(0.94); }
@media (hover: hover) and (pointer: fine) {
  .viewer-arrow:hover { background: var(--ink); color: var(--paper); }
}
.viewer-count {
  position: absolute; left: 0; right: 0; bottom: clamp(12px, 2.4vh, 24px);
  text-align: center; color: var(--muted);
}

.viewer-panel {
  min-height: 0; overflow-y: auto;
  border-left: 1px solid var(--rule);
  padding: clamp(28px, 4vh, 40px) clamp(24px, 2.4vw, 36px) 32px;
  display: flex; flex-direction: column; gap: 18px;
}
.viewer-panel > .label:first-child { padding-right: 56px; color: var(--muted); }
.viewer-title { font-family: var(--serif); font-style: italic; font-size: clamp(36px, 3.2vw, 48px); line-height: 1; padding-right: 40px; }
.viewer-desc { color: var(--muted); font-size: 15px; }
.viewer-art {
  align-self: flex-start;
  min-height: 44px;
  margin-block: -8px;
  padding: 0;
  border: 0;
  background: transparent;
  font-size: 14px;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.viewer-art:hover { color: var(--accent-text); }
.viewer-buy { display: grid; gap: 12px; padding-top: 18px; border-top: 1px solid var(--rule-soft); }
.viewer-size { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 6px; padding: 0; border: 0; min-width: 0; }
.viewer-size legend { grid-column: 1 / -1; padding: 0; margin-bottom: 8px; color: var(--muted); }
.viewer-size label {
  position: relative; display: block; cursor: pointer;
  padding: 10px 14px; border: 1px solid var(--rule-soft);
  transition: border-color 160ms ease, background-color 160ms ease, transform 160ms var(--ease-out);
}
.viewer-size label:active { transform: scale(0.98); }
.viewer-size input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.viewer-size span { display: grid; gap: 2px; }
.viewer-size strong { font-family: var(--serif); font-size: 22px; font-weight: 500; line-height: 1.1; }
.viewer-size small { font-size: 10px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.viewer-size label:has(:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.viewer-size label:has(:checked) small { color: var(--accent-text); }
.viewer-size label:has(:focus-visible) { outline: 1.5px solid var(--accent-text); outline-offset: 3px; }
@media (hover: hover) and (pointer: fine) {
  .viewer-size label:hover { border-color: var(--rule); }
  .viewer-size label:has(:checked):hover { border-color: var(--accent); }
}
.viewer-price { font-family: var(--serif); font-size: clamp(34px, 3vw, 44px); line-height: 1; }
.viewer-price .label { margin-left: 6px; color: var(--muted); }
.viewer-buy .button { width: 100%; justify-content: space-between; }
.viewer-thumbs {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px;
  margin-top: auto; padding-top: 20px;
}
.viewer-thumbs button {
  position: relative; padding: 0; border: 0; background: var(--paper-deep);
  aspect-ratio: 2 / 3; overflow: hidden; opacity: 0.55;
  transition: opacity 160ms ease;
}
.viewer-thumbs button::after { content: ""; position: absolute; inset: 0; border: 1px solid transparent; transition: border-color 160ms ease; }
.viewer-thumbs img { width: 100%; height: 100%; object-fit: cover; }
.viewer-thumbs [aria-current="true"] { opacity: 1; }
.viewer-thumbs [aria-current="true"]::after { border-color: var(--ink); }
@media (hover: hover) and (pointer: fine) { .viewer-thumbs button:hover { opacity: 1; } }

.viewer-close-form { position: absolute; top: clamp(14px, 2.4vh, 24px); right: clamp(14px, 2vw, 24px); z-index: 2; }
.viewer-close {
  display: grid; place-items: center; width: 44px; height: 44px;
  border: 1px solid var(--ink); border-radius: 50%; background: var(--paper);
  font-family: var(--sans); font-size: 22px; font-weight: 300; line-height: 1;
  transition: background-color 160ms ease, color 160ms ease, transform 160ms var(--ease-out);
}
.viewer-close:active { transform: scale(0.94); }
@media (hover: hover) and (pointer: fine) { .viewer-close:hover { background: var(--ink); color: var(--paper); } }

@media (max-width: 55.99rem) {
  .viewer[open] { display: block; overflow-y: auto; }
  .viewer-stage { height: 70dvh; }
  .viewer-frame { inset: 64px 56px 44px; }
  .viewer-arrow { width: 40px; height: 40px; font-size: 18px; }
  .viewer-arrow--prev { left: 6px; }
  .viewer-arrow--next { right: 6px; }
  .viewer-panel { border-left: 0; border-top: 1px solid var(--rule); overflow: visible; }
  .viewer-thumbs { margin-top: 8px; }
  .viewer-close-form { position: fixed; }
}

@media (prefers-reduced-motion: reduce) {
  :root { scroll-behavior: auto; }
  .viewer-frame img, .tile-img { transition: opacity 200ms ease; transform: none !important; }
  .work-art { transition: none; }
}
