/* ========== Design tokens ========== */
/* Layout tokens, shared by every theme. */
:root {
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --max: 1100px;
  --header-h: 64px;
  --bottombar-h: 60px;
}

/* Color themes. The build writes data-theme="<site.json theme>" on <html>;
   every theme color below must come from these tokens, never a literal. */

/* Token roles:
   --primary / --accent / --on-accent  the accent color (crnobela: chosen in the CMS and
                                       injected by the build as an inline <style>)
   --highlight / --highlight-soft      neutral emphasis (crnobela: white; teget: red)
   --btn-*                             buttons (crnobela: white, accent on hover) */

/* Crno-bela (default): black / white / grays + one accent color. The accent
   values here are only a fallback; the build overrides them per site.json. */
:root,
:root[data-theme="crnobela"] {
  color-scheme: dark;
  --bg: #0a0a0a; --bg-alt: #101010; --surface: #161616; --surface-2: #1f1f1f;
  --text: #f2f2f2; --muted: #9a9a9a;
  --primary: #ffffff; --primary-dark: #d4d4d4; --primary-soft: rgba(255, 255, 255, .10);
  --accent: #cfcfcf; --on-accent: #0a0a0a;
  --highlight: #ffffff; --highlight-soft: rgba(255, 255, 255, .10); --link: var(--text); --link-hover: var(--primary);
  --navy: #262626; --border: #2a2a2a;
  --header-bg: rgba(10, 10, 10, .9); --footer-bg: #050505; --hero-2: #1d1d1d;
  --glow: rgba(255, 255, 255, .07);
  --btn-bg: #ffffff; --btn-text: #0a0a0a;
  --btn-hover-bg: var(--primary); --btn-hover-text: var(--on-accent);
  --ghost-hover-bg: transparent; --ghost-hover-text: var(--primary); --ghost-hover-border: var(--primary);
}

/* Teget: the original navy / red palette. */
:root[data-theme="teget"] {
  color-scheme: dark;
  --bg: #070b14; --bg-alt: #0b1322; --surface: #101a2f; --surface-2: #16233f;
  --text: #e7ecf6; --muted: #8e9ab4;
  --primary: #e11d2e; --primary-dark: #b3121f; --primary-soft: rgba(225, 29, 46, .14);
  --accent: #7c9cff; --on-accent: #ffffff;
  --highlight: var(--primary); --highlight-soft: var(--primary-soft); --link: var(--accent); --link-hover: var(--accent);
  --navy: #1b2d55; --border: #1f2c47;
  --header-bg: rgba(7, 11, 20, .88); --footer-bg: #04070d; --hero-2: #0f1c3a;
  --glow: rgba(225, 29, 46, .18);
  --btn-bg: var(--primary); --btn-text: #ffffff;
  --btn-hover-bg: var(--primary-dark); --btn-hover-text: #ffffff;
  --ghost-hover-bg: var(--text); --ghost-hover-text: var(--bg); --ghost-hover-border: var(--text);
}

/* Semantic colors stay the same in every theme so they remain recognisable. */
:root {
  --error: #ff5a67;
  --success: #4ade80;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 16px; }
.center { text-align: center; margin-top: 32px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.accent { color: var(--highlight); }

/* ========== Accessibility [#13] ========== */
.skip-link {
  position: absolute; left: 8px; top: -60px; z-index: 300;
  background: var(--btn-bg); color: var(--btn-text); padding: 10px 18px; border-radius: 8px;
  font-weight: 600; transition: top .15s ease;
}
.skip-link:focus { top: 8px; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

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

/* ========== Buttons ========== */
.btn {
  display: inline-block;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: 2px solid var(--btn-bg);
  padding: 12px 22px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: background .2s, transform .1s;
}
.btn:hover { background: var(--btn-hover-bg); border-color: var(--btn-hover-bg); color: var(--btn-hover-text); text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--text); }
.btn--ghost:hover { background: var(--ghost-hover-bg); color: var(--ghost-hover-text); border-color: var(--ghost-hover-border); }
.btn--small { padding: 8px 16px; font-size: .9rem; }
.btn--full { width: 100%; }

/* ========== Header & nav [#1 #2] ========== */
.header {
  position: sticky; top: 0; z-index: 10;
  /* Deliberately no backdrop-filter here: it creates a new containing block
     for position:fixed descendants, which would break the off-canvas mobile
     nav (it'd anchor to this 64px-tall header instead of the viewport). */
  background: var(--header-bg);
  border-bottom: 1px solid var(--border);
}
.header__inner { display: flex; align-items: center; justify-content: space-between; height: var(--header-h); gap: 12px; }
.logo { display: flex; align-items: center; }
.logo img { height: 40px; width: auto; }
.logo:hover { text-decoration: none; }
.nav { display: flex; align-items: center; gap: 20px; }
.nav a { color: var(--text); font-weight: 500; }
.nav a:hover { color: var(--primary); text-decoration: none; }
/* Active section (js: inline IntersectionObserver, when theme.highlightActiveSection) */
.nav a.is-active { color: var(--primary); text-decoration: underline 2px var(--primary); text-underline-offset: 8px; }
@media (prefers-reduced-motion: no-preference) {
  .nav a { transition: color .15s ease; }
}

.hamburger {
  display: none; flex-direction: column; justify-content: center; gap: 5px;
  width: 40px; height: 40px; padding: 9px; background: none; border: none; cursor: pointer; border-radius: 8px;
}
.hamburger span { display: block; width: 100%; height: 2px; background: var(--text); border-radius: 2px; transition: transform .2s, opacity .2s; }
.hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ========== Hero ========== */
.hero { background: radial-gradient(circle at 80% 30%, var(--glow), transparent 45%), linear-gradient(135deg, var(--bg) 0%, var(--hero-2) 100%); padding: 72px 0; }
.hero__inner { display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: center; }
.eyebrow { text-transform: uppercase; letter-spacing: .1em; font-size: .75rem; color: var(--primary); font-weight: 700; }
.hero h1 { font-size: clamp(2rem, 4vw, 3rem); line-height: 1.15; margin: 8px 0 16px; }
.lead { font-size: 1.1rem; color: var(--muted); max-width: 520px; }
.hero__actions { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; }
.hero__img { width: 100%; max-width: 440px; justify-self: center; }

/* Trust row [#5] */
.trust { list-style: none; display: flex; flex-direction: column; gap: 9px; margin-top: 24px; }
.trust li { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .92rem; }
.trust__icon { width: 18px; height: 18px; color: var(--primary); flex: none; }

/* ========== Sections ========== */
.section { padding: 72px 0; }
.section--alt { background: var(--bg-alt); }
.section h2 { font-size: 1.9rem; margin-bottom: 8px; }
.section h2::after { content: ""; display: block; width: 48px; height: 3px; background: var(--primary); border-radius: 2px; margin-top: 8px; }

/* Cards [#6] */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 28px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
}
.card:hover { border-color: var(--highlight); }
.card__icon { width: 32px; height: 32px; color: var(--primary); margin-bottom: 10px; display: block; }
.card h3 { margin-bottom: 4px; }
.card p { color: var(--muted); }

/* Gallery */
.gallery { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 24px; }
.gallery__item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow); cursor: zoom-in; transition: transform .2s;
}
.gallery__item:hover { transform: translateY(-4px); border-color: var(--highlight); }
.gallery__item img { aspect-ratio: 4 / 5; object-fit: cover; width: 100%; }
.gallery__item figcaption { padding: 10px 14px; font-size: .9rem; color: var(--muted); }

/* Steps */
.steps { list-style: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-top: 28px; }
.steps li { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 24px; }
.steps span {
  display: inline-grid; place-items: center; width: 36px; height: 36px;
  border-radius: 50%; background: var(--primary); color: var(--on-accent); font-weight: 700; margin-bottom: 10px;
}
.steps strong { display: block; }
.steps + .small { margin-top: 20px; }
.steps--3 { grid-template-columns: repeat(3, 1fr); }

/* Compact band ("Za firme") — a .card laid out as text + checklist */
.section--band { padding-top: 0; }
.band { display: grid; grid-template-columns: 1.2fr 1fr; gap: 32px; align-items: center; padding: 32px; border-left: 4px solid var(--highlight); }
.tag + h2 { margin-top: 10px; }
.band__aside { display: flex; flex-direction: column; align-items: flex-start; gap: 20px; }
.checklist { list-style: none; display: grid; gap: 10px; }
.checklist li { display: flex; align-items: center; gap: 10px; }

/* Prices [#7] */
.prices { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 28px; align-items: stretch; }
.price-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 30px 24px 24px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px; position: relative;
}
.price-card.featured { border-color: var(--primary); background: linear-gradient(160deg, var(--surface), var(--navy)); }
.price-card.featured::before {
  content: "Preporučeno"; position: absolute; top: -12px; left: 24px;
  background: var(--primary); color: var(--on-accent); font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 4px 12px; border-radius: 999px;
}
.price-card h3 { font-size: 1.2rem; }
.price-card__hint { color: var(--muted); font-size: .9rem; flex: 1; }
.price-card__from { font-size: 1.05rem; }
.price-card__from strong { color: var(--highlight); font-size: 1.7rem; }
.price-card .btn { margin-top: 6px; }

/* Workshop */
.workshop-hero { margin-top: 24px; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); background: var(--surface); border: 1px solid var(--border); }
.workshop-hero img { width: 100%; aspect-ratio: 16 / 7; object-fit: cover; }
.workshop-hero figcaption { padding: 10px 16px; font-size: .9rem; color: var(--muted); }
.equipment { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin-top: 24px; }
.equip { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.equip img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; }
.equip__body { padding: 18px 20px 22px; }
.equip h3 { font-size: 1.1rem; margin: 6px 0 12px; }
.tag { display: inline-block; font-size: .72rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  color: var(--highlight); background: var(--highlight-soft); padding: 3px 10px; border-radius: 999px; }
.specs { list-style: none; display: grid; gap: 6px; font-size: .88rem; }
.specs li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px dashed var(--border); padding-bottom: 6px; }
.specs span { color: var(--muted); white-space: nowrap; }
.specs strong { text-align: right; font-weight: 600; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 28px; text-align: center; }
.stats div { background: linear-gradient(160deg, var(--navy), var(--surface)); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius); padding: 18px 8px; }
.stats strong { display: block; font-size: 1.8rem; color: var(--highlight); line-height: 1.1; }
.stats span { font-size: .85rem; color: var(--muted); }

/* Meet the maker */
.maker {
  display: grid; grid-template-columns: auto 1fr auto; gap: 20px; align-items: center;
  margin-top: 28px; padding: 24px; border-radius: var(--radius);
  background: linear-gradient(120deg, var(--surface) 0%, var(--navy) 100%);
  border: 1px solid var(--border); border-left: 4px solid var(--highlight);
}
.maker__avatar { width: 72px; height: 72px; padding: 8px; border-radius: 50%; background: var(--bg); border: 2px solid var(--highlight); object-fit: cover; }
/* Logo fallback (no photo yet): show the whole printer, not a cropped middle. */
.maker__avatar--logo { padding: 13px; object-fit: contain; }
.maker h3 { font-size: 1.3rem; margin: 6px 0 4px; }

/* Dim photos slightly so they sit well on dark */
.workshop-hero img, .equip img { filter: brightness(.92) contrast(1.05); }
/* Crno-bela: workshop/equipment photos in grayscale (site.json grayscalePhotos). Gallery stays in color. */
:root[data-photos="grayscale"] .workshop-hero img, :root[data-photos="grayscale"] .equip img { filter: grayscale(1) contrast(1.05); }

/* FAQ [#8] */
.faq { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; max-width: 760px; }
.faq__item { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 2px 22px; }
.faq__item summary {
  cursor: pointer; padding: 17px 30px 17px 0; font-weight: 600; position: relative; list-style: none;
}
.faq__item summary::-webkit-details-marker { display: none; }
.faq__item summary::after {
  content: "+"; position: absolute; right: 2px; top: 13px; font-size: 1.4rem; line-height: 1; color: var(--highlight);
  transition: transform .2s;
}
.faq__item[open] { border-color: var(--primary); }
.faq__item[open] summary::after { transform: rotate(45deg); }
.faq__item p { color: var(--muted); padding: 0 0 18px; }

/* ========== Contact section [#3] ========== */
.contact-grid { display: grid; grid-template-columns: 1fr 1.2fr; gap: 32px; margin-top: 28px; align-items: start; }
.contact-channels { display: flex; flex-direction: column; gap: 12px; }
.channel {
  display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; color: var(--text);
  word-break: break-word;
}
.channel:hover { border-color: var(--highlight); text-decoration: none; background: var(--highlight-soft); color: var(--text); }
.channel__icon { width: 22px; height: 22px; color: var(--highlight); flex: none; display: block; }
.channel small { color: var(--muted); display: block; }
.channel--email { justify-content: space-between; gap: 8px; }
.channel--email a { display: flex; align-items: center; gap: 12px; color: var(--text); flex: 1; min-width: 0; }
.channel-meta { color: var(--muted); font-size: .9rem; padding-left: 4px; }

.copy-btn {
  display: flex; align-items: center; gap: 6px; flex: none;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text);
  padding: 8px 12px; border-radius: 8px; cursor: pointer; font: inherit; font-size: .8rem;
}
.copy-btn svg { width: 15px; height: 15px; }
.copy-btn:hover { border-color: var(--highlight); }
.copy-btn.is-copied { color: var(--success); border-color: var(--success); }

.hours { margin-top: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; }
.hours h3 { font-size: .92rem; margin-bottom: 10px; }
.hours ul { list-style: none; display: grid; gap: 6px; font-size: .9rem; }
.hours li { display: flex; justify-content: space-between; color: var(--muted); }
.hours li span:first-child { color: var(--text); }

/* ========== Form ========== */
.form { display: grid; gap: 12px; }
.form__title { font-size: 1.2rem; }
.botcheck-field { display: none; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form label { display: grid; gap: 4px; font-size: .9rem; font-weight: 500; }
.form input, .form select, .form textarea {
  font: inherit; color: var(--text); background: var(--surface-2); padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
}
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.form__error { color: var(--error); font-size: .85rem; }
.form__success { margin-top: 20px; color: var(--success); font-weight: 600; text-align: center; }

/* ========== Footer [#10] ========== */
.footer { background: var(--footer-bg); border-top: 1px solid var(--border); color: var(--muted); padding: 48px 0 0; font-size: .9rem; }
.footer__grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 28px; padding-bottom: 32px; }
.footer__col { display: flex; flex-direction: column; gap: 8px; }
.footer__col h3 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text); margin-bottom: 4px; }
.footer__col img { height: 40px; width: auto; align-self: flex-start; margin-bottom: 4px; }
.footer a { color: var(--text); }
.footer a:hover { color: var(--primary); }
.footer__hours { list-style: none; display: flex; flex-direction: column; gap: 4px; }
.footer__hours li { display: flex; justify-content: space-between; gap: 10px; }
.footer__bottom { border-top: 1px solid var(--border); padding-block: 18px; font-size: .85rem; }

/* ========== Lightbox (uses the shared .modal component) ========== */
.modal { position: fixed; inset: 0; display: none; z-index: 100; }
.modal.is-open { display: grid; place-items: center; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .75); }
.modal__dialog {
  position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  width: min(480px, calc(100% - 32px)); max-height: calc(100vh - 32px); overflow-y: auto;
  padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.6);
  animation: pop .2s ease-out;
}
@keyframes pop { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal__close {
  position: absolute; top: 12px; right: 14px; background: none; border: none;
  font-size: 1.8rem; line-height: 1; cursor: pointer; color: var(--muted);
}
.modal--image .modal__dialog { width: min(720px, calc(100% - 32px)); padding: 16px; }

/* ========== Mobile bottom bar [#2] ========== */
.bottombar { display: none; }

/* ========== Responsive ========== */
@media (max-width: 860px) {
  .hero__inner { grid-template-columns: 1fr; text-align: center; }
  .lead { margin: 0 auto; }
  .hero__actions { justify-content: center; }
  .trust { align-items: center; }
  .cards, .steps, .equipment, .prices { grid-template-columns: 1fr; }
  .band { grid-template-columns: 1fr; gap: 20px; padding: 24px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .maker { grid-template-columns: 1fr; text-align: center; justify-items: center; }
  .logo img, .footer__col img { height: 34px; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .contact-grid { grid-template-columns: 1fr; }
  .footer__grid { grid-template-columns: 1fr 1fr; }

  /* Off-canvas nav */
  .hamburger { display: flex; }
  .nav {
    position: fixed; top: var(--header-h); left: 0; right: 0; bottom: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-top: 1px solid var(--border);
    padding: 8px 20px 24px; overflow-y: auto;
    transform: translateY(-8px); opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity .2s ease, transform .2s ease;
  }
  .nav.is-open { opacity: 1; transform: translateY(0); visibility: visible; pointer-events: auto; }
  .nav a { display: block; padding: 15px 4px; border-bottom: 1px solid var(--border); }
  .nav a.is-active { text-decoration: none; border-left: 3px solid var(--primary); padding-left: 12px; }

  /* Bottom bar */
  .bottombar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; gap: 4px;
    background: var(--header-bg); backdrop-filter: blur(10px);
    border-top: 1px solid var(--border);
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  }
  .bottombar__item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    color: var(--text); background: none; border: none; font: inherit; font-size: .72rem;
    padding: 6px 4px; border-radius: 10px; cursor: pointer;
  }
  .bottombar__item:hover, .bottombar__item:active { background: var(--surface-2); text-decoration: none; }
  .bottombar__item svg { width: 21px; height: 21px; }

  body { padding-bottom: calc(var(--bottombar-h) + env(safe-area-inset-bottom)); }
}
@media (max-width: 480px) {
  .form__row { grid-template-columns: 1fr; }
  .footer__grid { grid-template-columns: 1fr; }
}
