/* EkoUrn - wspolne tokeny (brand/ekourn-wytyczne-strony.md, sekcje 3-4).
   Strona, sklep i panel korzystaja z tych samych wartosci. */

:root {
  --background: #F6F3EC;
  --surface: #FFFDFA;
  --surface-stone: #EAE4DB;
  --text: #30312E;
  --text-muted: #62615B;
  --border: #D7D0C5;
  --control-border: #817B72;
  --accent: #725743;

  --button: #30312E;
  --button-hover: #454640;
  --button-text: #FFFDFA;

  /* Stany - stonowane, bez jaskrawych akcentow. Kontrast AA na --surface. */
  --ok: #3F5B3A;
  --ok-bg: #E4EADB;
  --warn: #7A4A12;
  --warn-bg: #F3E3C8;
  --danger: #8A2E25;
  --danger-bg: #F2DCD6;
  --info: #3D4E63;
  --info-bg: #DEE3EA;

  --font-serif: Georgia, 'Times New Roman', serif;
  --font-sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;

  --radius: 6px;
  --radius-photo: 6px;

  --content-max: 1240px;
  --gutter: clamp(20px, 4.5vw, 64px);
  --section-gap: clamp(48px, 8vw, 104px);

  --fs-h1: clamp(2.25rem, 1.55rem + 2.9vw, 4rem);          /* 36 -> 64 px */
  --fs-h2: clamp(1.75rem, 1.4rem + 1.5vw, 2.625rem);       /* 28 -> 42 px */
  --fs-product: clamp(1.375rem, 1.3rem + 0.3vw, 1.625rem); /* 22 -> 26 px */
  --fs-body: clamp(1rem, 0.96rem + 0.2vw, 1.125rem);       /* 16 -> 18 px */
  --fs-meta: 0.875rem;                                     /* 14 px */

  --ease: 170ms ease;
  --header-h: 76px;
  --focus: 0 0 0 3px var(--background), 0 0 0 5px var(--text);
}

@media (prefers-reduced-motion: reduce) {
  :root { --ease: 0ms linear; }
  *, *::before, *::after { transition-duration: 0ms !important; animation-duration: 0ms !important; scroll-behavior: auto !important; }
}

*, *::before, *::after { box-sizing: border-box; }

/* Atrybut hidden musi wygrywac z display: flex/inline-flex nadanym klasami. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font: 400 var(--fs-body)/1.65 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--surface-stone); color: var(--text); }
p, li, dd { text-wrap: pretty; }

img, svg, video { max-width: 100%; height: auto; display: block; }
picture { display: contents; }

a { color: var(--accent); text-decoration: underline; text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--text); }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 2px; }

h1, h2, h3, h4 { font-family: var(--font-serif); font-weight: 400; color: var(--text); margin: 0 0 0.5em; text-wrap: balance; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.skip-link { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--text); color: var(--button-text); padding: 10px 16px; border-radius: var(--radius); }
.skip-link:focus { top: 12px; }

/* --- Przyciski ------------------------------------------------------------ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5em;
  min-height: 48px; padding: 0 1.4em;
  font: 500 1rem/1.2 var(--font-sans); letter-spacing: 0.01em;
  border-radius: var(--radius); border: 1px solid var(--button);
  background: var(--button); color: var(--button-text);
  text-decoration: none; cursor: pointer;
  transition: background-color var(--ease), border-color var(--ease), color var(--ease);
}
.btn:hover { background: var(--button-hover); border-color: var(--button-hover); color: var(--button-text); }
.btn-secondary { background: transparent; color: var(--text); border-color: var(--control-border); }
.btn-secondary:hover { background: var(--surface-stone); color: var(--text); border-color: var(--text); }
.btn-danger { background: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: #6d231c; border-color: #6d231c; }
.btn-small { min-height: 44px; padding: 0 1em; font-size: 0.9375rem; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; }
.btn-link { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; font: inherit; cursor: pointer; min-height: 44px; }

/* --- Formularze ----------------------------------------------------------- */

.field { display: grid; gap: 6px; margin-bottom: 18px; }
.field label, .label { font-weight: 500; font-size: 0.9375rem; }
.field .hint { font-size: var(--fs-meta); color: var(--text-muted); margin: 0; }
.field .error { font-size: var(--fs-meta); color: var(--danger); margin: 0; }

input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="number"],
input[type="search"], input[type="url"], input[type="date"], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 12px;
  font: 400 1rem/1.4 var(--font-sans); color: var(--text);
  background: var(--surface); border: 1px solid var(--control-border); border-radius: var(--radius);
  transition: border-color var(--ease);
}
textarea { min-height: 120px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--text); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--danger); }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; accent-color: var(--text); margin: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; min-height: 44px; padding-top: 10px; cursor: pointer; }
.check input { flex: none; margin-top: 3px; }

/* --- Komunikaty ------------------------------------------------------------ */

.flash { border-radius: var(--radius); padding: 14px 16px; margin: 0 0 20px; border-left: 4px solid; }
.flash-ok { background: var(--ok-bg); border-color: var(--ok); }
.flash-error { background: var(--danger-bg); border-color: var(--danger); }
.flash-warn { background: var(--warn-bg); border-color: var(--warn); }
.flash-info { background: var(--info-bg); border-color: var(--info); }
.flash p { margin: 0; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 0.8125rem; font-weight: 500; line-height: 1.6; background: var(--surface-stone); color: var(--text); white-space: nowrap; }
.badge-ok { background: var(--ok-bg); color: var(--ok); }
.badge-warn { background: var(--warn-bg); color: var(--warn); }
.badge-info { background: var(--info-bg); color: var(--info); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-muted { background: var(--surface-stone); color: var(--text-muted); }

.photo-missing {
  display: grid; place-items: center; aspect-ratio: 4 / 5; width: 100%;
  background: var(--surface-stone); border: 1px dashed var(--control-border);
  color: var(--text-muted); font-size: var(--fs-meta); border-radius: var(--radius-photo);
}
.photo-missing span { background: var(--surface); padding: 4px 10px; border-radius: 999px; }

.swatch { display: inline-block; width: 1em; height: 1em; border-radius: 50%; border: 1px solid rgba(0,0,0,.25); vertical-align: -0.15em; }
