/*
 * Shared base layer: reset, document typography and the primitives every
 * surface reuses (.shell, .btn, .card, .section-title, .eyebrow,
 * .content-section, .bee-decor). Consumes tokens.css exclusively -- no raw
 * colors, no page-specific rules.
 *
 * Page- and module-specific stylesheets load after this one and are limited
 * to what is genuinely their own.
 */

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

/*
 * Anchor navigation (nav.qtpl's #dobierz-linie / #linie / #o-hodowli
 * / #wiedza / #kontakt links) animates to the target section instead
 * of jumping. Covers in-page link clicks, history back/forward and
 * any scripted scroll of the document.
 */
html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-offset);
}

/* DESIGN.md sec. 21: respect prefers-reduced-motion. */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

body {
  font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--color-ink-950);
  background: var(--color-surface-muted);
  line-height: 1.5;
}

/*
 * Gutters are the shell's job (see .shell below), never the body's -- some
 * module stylesheets (e.g. the SSR list module's ssr-list.css) were written
 * to stand alone and set padding directly on body. Loaded after this file,
 * an unqualified `body { padding }` there would win on source order alone;
 * `html body` outranks it on specificity instead, so the layout keeps body
 * flush regardless of what a module stylesheet assumes about owning the
 * page.
 */
html body {
  padding: 0;
}

a { color: inherit; }

.shell {
  width: min(calc(100% - 32px), var(--container-max));
  margin: 0 auto;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.eyebrow {
  margin: 0 0 var(--space-2);
  color: var(--color-honey-700);
  font-size: var(--text-sm);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-title {
  position: relative;
  max-width: 22ch;
  margin: 0;
  font-size: clamp(var(--text-2xl), 3.5vw, var(--text-4xl));
  line-height: 1.08;
  letter-spacing: -0.02em;
}

/*
 * Decorative bee mark around headings (secondary visual code per
 * DESIGN.md §23 — subtle, not a primary graphic). Each heading that
 * carries .bee-decor gets one bee placed via ::before; its
 * position/rotation/opacity come from per-heading CSS custom
 * properties (--b1-*) computed server-side in bees.go so each
 * heading gets its own varied, non-repeating arrangement. Hovering
 * the heading itself (not the bee) drives the rotation.
 *
 * transform-origin (--b1-origin) is a fixed point out to one side of
 * the bee's own body, on its local x-axis (the bee faces "up" at
 * rotate(0), so this axis always sits perpendicular to whichever way
 * it's currently facing). That pivot never moves; only the rotation
 * animates between --b1-rot0 and --b1-rot1. Rotating a fixed distance
 * away from your own center around a planted point is exactly what
 * carries you forward along a curved path as you turn -- so the same
 * single rotation reads as rotation and movement at once, tangential
 * to the bee's own heading, like a gentle walk along an arc rather
 * than a spin in place. bees.go compensates the resting placement so
 * the bee still lands exactly in its intended slot despite the
 * off-center pivot.
 */
.bee-decor {
  position: relative;
}

.bee-decor::before {
  position: absolute;
  display: block;
  content: var(--b1-content, none);
  top: var(--b1-top, auto);
  bottom: var(--b1-bottom, auto);
  left: var(--b1-left, auto);
  right: var(--b1-right, auto);
  width: var(--b1-size, 24px);
  height: var(--b1-size, 24px);
  background: url("/static/data/images/bee-motif.webp") center / contain no-repeat;
  opacity: var(--b1-op, 0.4);
  pointer-events: none;
  transform-origin: var(--b1-origin, 50% 50%);
  transition: transform 280ms ease, opacity 280ms ease;
  transform: rotate(var(--b1-rot0, 0deg));
}

.bee-decor:hover::before {
  transform: rotate(var(--b1-rot1, var(--b1-rot0, 0deg)));
  opacity: calc(var(--b1-op, 0.4) + 0.18);
}

@media (prefers-reduced-motion: reduce) {
  .bee-decor::before {
    transition: none;
  }
}

@media (max-width: 620px) {
  .bee-decor::before {
    display: none;
  }
}

.section-lede {
  max-width: var(--content-readable);
  margin: var(--space-3) 0 0;
  color: var(--color-ink-700);
  font-size: var(--text-lg);
  line-height: 1.6;
}

.content-section {
  padding: clamp(var(--space-7), 7vw, var(--space-9)) 0;
  border-bottom: 1px solid var(--color-border);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--color-brand-yellow-500);
  color: var(--color-ink-950);
}

.btn-secondary {
  background: transparent;
  border-color: var(--color-ink-400);
  color: var(--color-ink-950);
}

.btn:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 45%, transparent);
  outline-offset: 2px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-5);
  margin-top: var(--space-6);
}

.card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.card h3 {
  margin: 0;
  font-size: var(--text-lg);
  letter-spacing: -0.01em;
}

.card p {
  margin: 0;
  color: var(--color-ink-700);
}

.card .card-link {
  margin-top: var(--space-3);
  font-weight: 800;
  font-size: var(--text-sm);
}

@media (max-width: 860px) {
  .card-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 620px) {
  .card-grid { grid-template-columns: 1fr; }
  .content-section { padding: var(--space-6) 0; }
}
