/* ============================================================
   Components — buttons, chips, cards, logo, nav, footer, etc.
   ============================================================ */

/* ---- Buttons (pill) ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 22px; min-height: var(--touch); border-radius: var(--radius-pill);
  font-family: var(--font-sans); font-size: 15px; font-weight: 600; line-height: 1;
  border: 0; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background var(--dur) var(--ease-out), color var(--dur) var(--ease-out),
              transform var(--dur-fast) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}
.btn:active { transform: scale(0.98); }
.btn .icon { width: 16px; height: 16px; }
.btn--lg { padding: 16px 28px; font-size: 16px; }

.btn-primary { background: var(--red-700); color: #fff; }
.btn-primary:hover { background: var(--red-800); color: #fff; text-decoration: none; }

.btn-ghost { background: transparent; color: var(--ink-900); border: 1.5px solid var(--ink-900); }
.btn-ghost:hover { background: var(--ink-900); color: #fff; text-decoration: none; }
.btn-ghost--dark { color: #fff; border-color: rgba(255,255,255,.6); }
.btn-ghost--dark:hover { background: #fff; color: var(--ink-900); }

.btn-secondary { background: #fff; color: var(--red-700); box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: var(--ink-50); color: var(--red-800); text-decoration: none; }

.btn-text { display: inline-flex; align-items: center; gap: 6px; color: var(--red-700); font-weight: 600; }
.btn-text:hover { gap: 9px; transition: gap var(--dur) var(--ease-out); }

/* ---- Chips ---- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 600; letter-spacing: .2px;
  background: #fff; color: var(--ink-700); border: 1px solid var(--ink-100);
}
.chip .icon { width: 12px; height: 12px; }
.chip--red { background: var(--red-50); color: var(--red-700); border-color: var(--red-100); }
.chip--red-solid { background: var(--red-700); color: #fff; border-color: var(--red-700); }
.chip--ink { background: var(--ink-900); color: #fff; border-color: var(--ink-900); }
.chip--ghost { background: transparent; color: var(--ink-700); border-color: var(--ink-200); }
.chip--slate { background: var(--slate-700); color: #fff; border-color: var(--slate-700); }

/* ---- Cards ---- */
.card {
  background: var(--bg-card); border-radius: var(--radius);
  padding: var(--space-8); box-shadow: var(--shadow);
  transition: box-shadow var(--dur) var(--ease-out);
}
.card:hover { box-shadow: var(--shadow-lg); }
.card--flat { box-shadow: none; border: 1px solid var(--ink-100); }

/* ---- Numbered callout disc ---- */
.callout {
  width: 28px; height: 28px; border-radius: var(--radius-pill);
  background: var(--red-700); color: #fff; font-weight: 700; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1; flex-shrink: 0; box-shadow: 0 1px 2px rgba(0,0,0,.15);
}

/* ---- Form inputs ---- */
.input, .textarea, .select {
  width: 100%; padding: 14px 16px; min-height: var(--touch); font-family: var(--font-sans); font-size: var(--fs-body);
  color: var(--fg-strong); background: #fff; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  transition: border-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}
.input:focus, .textarea:focus, .select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft);
}
.textarea { min-height: 130px; resize: vertical; }
.field { margin-bottom: var(--space-5); }
.field label { display: block; font-size: 14px; font-weight: 600; color: var(--ink-800); margin-bottom: 6px; }

/* ---- Icons ---- */
.icon { display: inline-flex; width: 20px; height: 20px; flex-shrink: 0; vertical-align: middle; }
.icon svg { width: 100%; height: 100%; display: block; }

/* ---- Logo wordmark ---- */
.logo { font-weight: 700; font-size: 26px; line-height: 1; letter-spacing: -0.01em; color: var(--ink-900); white-space: nowrap; text-decoration: none; }
.logo:hover { text-decoration: none; color: var(--ink-900); }
.logo .accent { color: var(--red-700); }
.logo--dark { color: #fff; }
.logo--dark:hover { color: #fff; }

/* ============================================================
   Top banner — Fiskalizacija 2.0
   ============================================================ */
.topbanner {
  background: var(--red-50); color: var(--ink-700);
  padding: 12px 32px; display: flex; align-items: center; justify-content: center;
  gap: 14px; font-size: 14px; position: relative; border-bottom: 1px solid var(--red-100);
}
.topbanner .icon { color: var(--red-700); }
.topbanner a { color: var(--red-700); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.topbanner__close {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: transparent; border: 0; color: var(--ink-400); cursor: pointer; padding: 10px; line-height: 0;
  min-width: var(--touch); min-height: var(--touch);
  display: inline-flex; align-items: center; justify-content: center;
}
.topbanner.is-hidden { display: none; }
@media (max-width: 720px) { .topbanner { font-size: 12.5px; padding: 10px 40px 10px 16px; } }

/* ============================================================
   Nav
   ============================================================ */
.nav { background: #fff; border-bottom: 1px solid var(--ink-100); position: sticky; top: 0; z-index: var(--z-nav); }
.nav__row { height: 76px; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 40px; }
.nav__links { display: flex; justify-content: flex-end; gap: 28px; align-items: center; }
.nav__link {
  display: flex; align-items: center; gap: 7px; font-size: 15px; font-weight: 500;
  color: var(--ink-700); text-decoration: none; cursor: pointer; position: relative;
}
.nav__link .icon { width: 16px; height: 16px; color: var(--red-700); }
.nav__link:hover { color: var(--red-700); text-decoration: none; }
.nav__link.is-active { color: var(--red-700); font-weight: 600; }
.nav__cta { display: flex; gap: 12px; align-items: center; }
.nav__search {
  display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-500);
  background: none; border: 0; cursor: pointer; font-family: var(--font-sans);
}
.nav__search kbd {
  font-family: var(--font-mono); font-size: 11px; border: 1px solid var(--ink-200);
  border-radius: 4px; padding: 1px 5px; color: var(--ink-500);
}
.nav__burger {
  display: none; background: none; border: 0; cursor: pointer;
  padding: 10px; color: var(--ink-900);
  min-width: var(--touch); min-height: var(--touch);
  align-items: center; justify-content: center;
}

/* mega-nav dropdown */
.nav__item { position: relative; }
.megamenu {
  position: absolute; top: calc(100% + 12px); left: 50%; transform: translateX(-50%) translateY(8px);
  background: #fff; border: 1px solid var(--ink-100); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl); padding: 20px; min-width: 520px; opacity: 0; visibility: hidden;
  transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out); z-index: var(--z-modal);
}
.nav__item:hover .megamenu, .nav__item:focus-within .megamenu { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.megamenu__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.megamenu__link { display: flex; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm); text-decoration: none; color: var(--ink-800); }
.megamenu__link:hover { background: var(--paper); text-decoration: none; }
.megamenu__link .icon { color: var(--red-700); margin-top: 2px; }
.megamenu__link b { display: block; font-size: 14px; font-weight: 600; color: var(--ink-900); }
.megamenu__link span { font-size: 12.5px; color: var(--ink-500); }

@media (max-width: 900px) {
  /* Mobile nav: only the logo and the burger live in the strip.
     The "Zatražite ponudu" CTA moves into the drawer where it gets full width
     and a partner "Pošaljite poruku" secondary action. */
  .nav__links, .nav__search { display: none; }
  .nav__cta > .btn { display: none; }     /* hide the in-nav primary CTA */
  .nav__burger { display: inline-flex; }
  .nav__row { grid-template-columns: minmax(0, 1fr) auto; gap: 12px; height: 64px; }
  .nav__cta { gap: 0; }
}
@media (max-width: 480px) {
  .nav__row { height: 60px; }
}

/* mobile drawer */
.drawer { position: fixed; inset: 0; z-index: var(--z-modal); visibility: hidden; }
.drawer.is-open { visibility: visible; }
.drawer__scrim { position: absolute; inset: 0; background: rgba(14,14,14,.45); opacity: 0; transition: opacity var(--dur); }
.drawer.is-open .drawer__scrim { opacity: 1; }
.drawer__panel {
  position: absolute; top: 0; right: 0; height: 100%;
  width: min(360px, 92vw); max-width: 92vw;
  background: #fff;
  transform: translateX(100%); transition: transform var(--dur-slow) var(--ease-out);
  padding: 24px 20px; overflow-y: auto; display: flex; flex-direction: column; gap: 4px;
}
.drawer.is-open .drawer__panel { transform: translateX(0); }
.drawer__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.drawer__head .topbanner__close { position: static; transform: none; }
.drawer__panel > a {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 12px; min-height: var(--touch);
  color: var(--ink-800); font-weight: 500;
  border-bottom: 1px solid var(--ink-50);
}
.drawer__panel > a:hover { color: var(--red-700); text-decoration: none; }
.drawer__panel > a .icon { color: var(--red-700); }

/* Drawer footer CTA pair (replaces the lost-from-nav primary). */
.drawer__cta {
  margin-top: 20px;
  display: grid; gap: 10px;
}
.drawer__cta .btn { width: 100%; justify-content: center; }
.drawer__contact {
  margin: 14px 0 0;
  padding-top: 14px;
  border-top: 1px solid var(--ink-50);
  display: grid; gap: 6px;
  font-size: 13.5px;
}
.drawer__contact a {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--ink-700); text-decoration: none;
  min-height: 36px;
}
.drawer__contact a:hover { color: var(--red-700); text-decoration: none; }
.drawer__contact .icon { color: var(--red-700); }

/* ============================================================
   Footer
   ============================================================ */
.footer { background: var(--ink-900); color: rgba(255,255,255,.7); padding: 72px 0 32px; }
.footer a { color: rgba(255,255,255,.7); }
.footer a:hover { color: #fff; }
.footer__grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 40px; }
.footer__head { font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: #fff; margin-bottom: 18px; }
.footer__col ul { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.footer__brandcopy { font-size: 14px; line-height: 1.6; max-width: 320px; }
.footer__contact { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; font-size: 14px; }
.footer__contact .icon { color: var(--red-500); margin-top: 2px; }
.footer__bottom { margin-top: 56px; padding-top: 24px; border-top: 1px solid rgba(255,255,255,.1); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 13px; color: rgba(255,255,255,.5); }
@media (max-width: 900px) { .footer__grid { grid-template-columns: 1fr 1fr; gap: 32px; } }
@media (max-width: 560px) { .footer__grid { grid-template-columns: 1fr; } }

/* ============================================================
   Cookie consent
   ============================================================ */
.cookie {
  position: fixed; left: 24px; bottom: 24px; right: auto;
  width: calc(100% - 48px); max-width: 380px; z-index: var(--z-modal);
  background: #fff; border: 1px solid var(--ink-100); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xl); padding: 20px; font-size: 13.5px; line-height: 1.55;
}
.cookie.is-hidden { display: none; }
.cookie__actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.cookie__actions .btn { flex: 1 1 auto; }
.cookie .btn { padding: 11px 16px; font-size: 13px; min-height: 40px; justify-content: center; }
@media (max-width: 480px) {
  .cookie { left: 12px; right: 12px; bottom: 12px; max-width: none; width: auto; padding: 16px; }
  .cookie__actions { flex-direction: column; }
  .cookie__actions .btn { width: 100%; min-height: var(--touch); }
}

/* ============================================================
   ⌘K command palette
   ============================================================ */
.cmdk { position: fixed; inset: 0; z-index: 300; display: none; }
.cmdk.is-open { display: block; }
.cmdk__scrim { position: absolute; inset: 0; background: rgba(14,14,14,.45); backdrop-filter: blur(3px); }
.cmdk__panel {
  position: relative; max-width: 560px; margin: 12vh auto 0; background: #fff;
  border-radius: var(--radius-lg); box-shadow: var(--shadow-xl); overflow: hidden;
}
.cmdk__input { width: 100%; border: 0; border-bottom: 1px solid var(--ink-100); padding: 18px 20px; font-size: 17px; font-family: var(--font-sans); }
.cmdk__input:focus { outline: none; }
.cmdk__results { max-height: 50vh; overflow-y: auto; padding: 8px; }
.cmdk__item { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--radius-sm); color: var(--ink-800); text-decoration: none; cursor: pointer; }
.cmdk__item .icon { color: var(--red-700); }
.cmdk__item.is-active, .cmdk__item:hover { background: var(--paper); }
.cmdk__empty { padding: 24px; text-align: center; color: var(--ink-400); font-size: 14px; }

/* ---- Toast (used by KPD asistent on copy) ---- */
.kpd-toast {
  position: fixed; left: 50%; bottom: 24px;
  transform: translate(-50%, 30px);
  background: var(--ink-900); color: #fff;
  font-family: var(--font-mono); font-size: 13px; font-weight: 600;
  padding: 12px 18px; border-radius: var(--radius-pill);
  box-shadow: var(--shadow-xl);
  opacity: 0; pointer-events: none;
  transition: opacity var(--dur) var(--ease-out), transform var(--dur) var(--ease-out);
  z-index: var(--z-modal);
  max-width: calc(100% - 32px); text-align: center;
}
.kpd-toast.is-show { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 480px) {
  .kpd-toast { bottom: 16px; font-size: 12.5px; padding: 11px 16px; }
}

/* ---- DEMO PODATAK sticker ----
   Marks unverified content. Rendered only when DEV_LABELS=true at build/run
   time. Helpers in src/components.js: devLabel() / devBlock().

   IMPORTANT: must never overflow its container. `white-space: nowrap` would
   make a 70-char Croatian label push the document wider than the viewport on
   a phone — that was a real regression. Now wraps and caps width. */
.dev-label {
  display: inline-flex; align-items: center; gap: 6px;
  max-width: 100%;
  padding: 3px 9px; border: 1.5px dashed var(--red-700);
  border-radius: var(--radius-pill);
  background: rgba(139,26,26,.06);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 10.5px; font-weight: 700; line-height: 1.3;
  color: var(--red-700); letter-spacing: .06em; text-transform: uppercase;
  vertical-align: middle;
  user-select: none;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.dev-label::before { content: "●"; color: var(--red-700); font-size: 8px; flex-shrink: 0; }

.dev-block {
  position: relative;
  outline: 1.5px dashed rgba(139,26,26,.35);
  outline-offset: 6px;
  border-radius: 6px;
  max-width: 100%;
}
.dev-block > .dev-label {
  position: absolute; top: -12px; left: 16px;
  background: var(--paper); z-index: 1;
  max-width: calc(100% - 32px);
}
@media (max-width: 480px) {
  /* On phones the sticker becomes a one-line corner pip — no Croatian sentence
     bleeding into the layout. The aria-label keeps the full text accessible. */
  .dev-label {
    font-size: 9.5px; padding: 2px 7px;
    overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; max-width: 40vw;
  }
  .dev-block > .dev-label { top: -10px; left: 8px; }
}
@media (prefers-reduced-motion: no-preference) {
  .dev-label { animation: dev-pulse 2.6s ease-in-out infinite; }
}
@keyframes dev-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .55; }
}

/* ============================================================
   Decorative "__mark" numerals (the giant low-opacity background
   letters/numbers on hero/CTA sections). Single global rule:
   they are decorative, never receive input, and disappear on phone
   viewports where they would otherwise overflow off-screen.
   See plan §R1. */
.hero__mark, .pulse__mark, .kpd__mark, .matrix__mark, .case__mark,
.booking__mark, .numbers__mark,
.about-hero__mark, .about-cta__mark, .about-doc__mark,
.price-hero__mark, .price-cta__mark,
.svc-hero__mark, .svc-cta__mark,
.faq-hero__mark, .faq-cta__mark,
.kontakt-hero__mark, .kontakt-cta__mark,
.alati-kpd__mark, .toolhero__mark, .legal-doc__mark,
.kpdh__mark {
  pointer-events: none;
  user-select: none;
}
@media (max-width: 480px) {
  .hero__mark, .pulse__mark, .kpd__mark, .matrix__mark, .case__mark,
  .booking__mark, .numbers__mark,
  .about-hero__mark, .about-cta__mark, .about-doc__mark,
  .price-hero__mark, .price-cta__mark,
  .svc-hero__mark, .svc-cta__mark,
  .faq-hero__mark, .faq-cta__mark,
  .kontakt-hero__mark, .kontakt-cta__mark,
  .alati-kpd__mark, .toolhero__mark, .legal-doc__mark,
  .kpdh__mark {
    display: none !important;
  }
}

/* ============================================================
   Media — AI photography system (picture() + ambientVideo()
   in src/components.js). Images are exact-aspect crops from
   scripts/media/process.mjs; object-fit guards rounding drift.
   ============================================================ */
.pic { display: block; overflow: hidden; }
.pic img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Full-bleed decorative loop inside a position:relative section.
   Sits under the section's content; a scrim keeps text contrast. */
.ambient { position: absolute; inset: 0; overflow: hidden; z-index: 0; }
.ambient__video { width: 100%; height: 100%; object-fit: cover; }
.ambient--scrim::after {
  content: "";
  position: absolute; inset: 0;
  background: rgba(10, 10, 12, 0.72);
}
.pic--fill { width: 100%; height: 100%; }

/* Ken Burns drift for real-photo ambient stills — deliberately glacial.
   Gated per motion preference (the base.css kill-switch also covers it). */
.ambient--kenburns .pic--fill { position: absolute; inset: 0; }
@media (prefers-reduced-motion: no-preference) {
  .ambient--kenburns img {
    animation: ambient-drift 60s ease-in-out infinite alternate;
    will-change: transform;
  }
}
@keyframes ambient-drift {
  from { transform: scale(1); }
  to { transform: scale(1.05) translateY(-1.5%); }
}
