/* ==========================================================================
   Liskovački kamen – konfigurator kamena
   Koncept: svijetli arhitektonski alat. Topla neutralna podloga (kao maketa
   na papiru), grafitna tipografija, kamen kao jedini akcent boje.
   Namjerno samo svijetla tema: prikaz kuće je kalibriran za svijetlu pozadinu.
   ========================================================================== */
:root {
  --paper: #eceae5;
  --paper-2: #f6f5f2;
  --card: #ffffff;
  --ink: #1d1f22;
  --ink-2: #4b4d52;
  --ink-3: #7b7c80;
  --line: rgba(29, 31, 34, .12);
  --line-2: rgba(29, 31, 34, .22);
  --stone: #8a7653;
  --stone-soft: #d9cfbd;
  --navy: #0e142e;

  --f-display: "Archivo", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --f-body: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --f-accent: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --ease: cubic-bezier(.2, .7, .1, 1);
  --panel: 420px;
  --head: 76px;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font-family: var(--f-body); font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
button, input, textarea { font: inherit; color: inherit; }
h1, h2, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--stone); outline-offset: 2px; }

/* ---------- Dugmad ---------- */
.kbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 46px; padding: .7rem 1.2rem; border: 1px solid var(--ink); cursor: pointer; text-decoration: none;
  font-size: .78rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  transition: background-color .3s var(--ease), color .3s var(--ease), border-color .3s var(--ease);
}
.kbtn--dark { background: var(--ink); color: var(--paper-2); }
.kbtn--dark:hover { background: var(--stone); border-color: var(--stone); }
.kbtn--line { background: transparent; color: var(--ink); border-color: var(--line-2); }
.kbtn--line:hover { border-color: var(--ink); background: var(--card); }

/* ---------- Zaglavlje ---------- */
.kh {
  position: sticky; top: 0; z-index: 30; height: var(--head);
  display: flex; align-items: center; gap: 1.25rem;
  padding: 0 max(20px, env(safe-area-inset-right, 0px)) 0 max(20px, env(safe-area-inset-left, 0px));
  background: rgba(236, 234, 229, .94); border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(1.2) blur(8px);
}
.kh__brand { flex: none; line-height: 0; }
.kh__brand img { height: 52px; width: auto; }
.kh__title { min-width: 0; padding-left: 1.25rem; border-left: 1px solid var(--line); }
.kh__eyebrow { font-size: .66rem; font-weight: 600; letter-spacing: .24em; text-transform: uppercase; color: var(--stone); }
.kh__h1 { font-family: var(--f-display); font-weight: 750; font-stretch: 108%; font-size: 1.15rem; line-height: 1.2; text-transform: uppercase; letter-spacing: .01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kh__nav { margin-left: auto; display: flex; align-items: center; gap: 1rem; }
.kh__back { font-size: .8rem; font-weight: 500; text-decoration: none; color: var(--ink-2); padding: .5rem 0; white-space: nowrap; }
.kh__back:hover { color: var(--ink); }
.kh__lang { display: flex; border: 1px solid var(--line-2); }
.kh__lang a { display: grid; place-items: center; min-width: 38px; height: 36px; font-size: .7rem; font-weight: 600; letter-spacing: .12em; text-decoration: none; color: var(--ink-3); }
.kh__lang li + li a { border-left: 1px solid var(--line); }
.kh__lang a[aria-current] { background: var(--ink); color: var(--paper-2); }
.kh__lang a:hover:not([aria-current]) { color: var(--ink); }
.kh__send { min-height: 40px; padding: .5rem 1rem; }

/* ---------- Raspored ---------- */
.kf { display: grid; grid-template-columns: minmax(0, 1fr) var(--panel); height: calc(100vh - var(--head)); height: calc(100dvh - var(--head)); }

/* ---------- Prikaz kuće ---------- */
.kv { position: relative; min-width: 0; padding: 14px 0 14px 14px; }
.kv__stage { container-type: inline-size; position: relative; height: 100%; overflow: hidden; background: #e2dfd9; border: 1px solid var(--line); }
.kv__canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; outline: none; }
.kv__canvas.is-dragging { cursor: grabbing; }
.kv__canvas.is-pick { cursor: pointer; }
.kv__label, .kv__badge {
  position: absolute; left: 14px; top: 14px; margin: 0; padding: .45rem .75rem; pointer-events: none;
  background: rgba(255, 255, 255, .92); border: 1px solid var(--line); font-size: .74rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
}
.kv__badge { left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--paper-2); border-color: var(--ink); }
.kv__label::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: .5rem; background: var(--stone); vertical-align: 1px; }
.kv__hint { position: absolute; left: 14px; bottom: 66px; max-width: 26rem; margin: 0; font-size: .74rem; color: var(--ink-2); background: rgba(246, 245, 242, .86); padding: .4rem .65rem; pointer-events: none; transition: opacity .6s var(--ease); }
.kv__hint.is-faded { opacity: 0; }
.kv__loading { position: absolute; right: 14px; top: 14px; display: flex; align-items: center; gap: .55rem; padding: .45rem .75rem; background: var(--card); border: 1px solid var(--line); font-size: .74rem; }
.kv__loading span { width: 12px; height: 12px; border: 2px solid var(--line-2); border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.kv__nogl { position: absolute; inset: 0; display: grid; place-content: center; gap: 1rem; padding: 2rem; text-align: center; background: var(--paper-2); }
.kv__nogl p { max-width: 30rem; }

.kv__views, .kv__zoom, .kv__tools { position: absolute; display: flex; background: rgba(255, 255, 255, .94); border: 1px solid var(--line); }
.kv__views { left: 14px; bottom: 14px; }
.kv__views button, .kv__zoom button {
  min-width: 44px; height: 40px; padding: 0 .85rem; border: 0; background: none; cursor: pointer;
  font-size: .72rem; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2);
  transition: background-color .25s, color .25s;
}
.kv__views button + button, .kv__zoom button + button { border-left: 1px solid var(--line); }
.kv__views button:hover, .kv__zoom button:hover { color: var(--ink); background: var(--paper-2); }
.kv__views button.is-active { background: var(--ink); color: var(--paper-2); }
.kv__zoom { right: 14px; top: 14px; flex-direction: column; }
.kv__zoom button { font-size: 1.1rem; padding: 0; width: 42px; }
.kv__zoom button + button { border-left: 0; border-top: 1px solid var(--line); }
.kv__loading:not([hidden]) ~ .kv__zoom { top: 60px; }
.kv__tools { right: 14px; bottom: 14px; }
.kv__tool {
  display: inline-flex; align-items: center; gap: .5rem; height: 40px; padding: 0 .85rem; border: 0; background: none; cursor: pointer;
  font-size: .72rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); white-space: nowrap;
  transition: background-color .25s, color .25s;
}
.kv__tool + .kv__tool { border-left: 1px solid var(--line); }
.kv__tool svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; flex: none; }
.kv__tool:hover { background: var(--paper-2); color: var(--ink); }
.kv__tool[aria-pressed="true"] { background: var(--ink); color: var(--paper-2); }

.kv__split { position: absolute; inset: 0; pointer-events: none; --x: 50%; }
.kv__split::before { content: ""; position: absolute; top: 0; bottom: 0; left: var(--x); width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .15); }
.kv__split-tag { position: absolute; top: 14px; padding: .35rem .6rem; background: rgba(29, 31, 34, .85); color: #fff; font-size: .68rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.kv__split-tag--l { right: calc(100% - var(--x) + 12px); }
.kv__split-tag--r { left: calc(var(--x) + 12px); }
.kv__split-handle {
  position: absolute; top: 50%; left: var(--x); width: 46px; height: 46px; margin: -23px 0 0 -23px; border-radius: 50%;
  border: 2px solid #fff; background: var(--ink); color: #fff; cursor: ew-resize; pointer-events: auto; touch-action: none;
  font-size: .9rem; letter-spacing: -.05em; box-shadow: 0 4px 16px rgba(0, 0, 0, .25);
}

@container (max-width: 960px) { .kv__tool span { display: none; } .kv__tool { padding: 0 .75rem; } }

/* ---------- Panel ---------- */
.kp { min-width: 0; overflow-y: auto; padding: 22px 22px 28px; display: flex; flex-direction: column; gap: 1.4rem; scrollbar-width: thin; }
.kp__intro { font-family: var(--f-accent); font-style: italic; font-size: 1.3rem; line-height: 1.3; color: var(--ink); }
.kp__tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--line-2); background: var(--paper-2); }
.kp__tabs button {
  min-height: 48px; padding: .5rem .4rem; border: 0; background: none; cursor: pointer; line-height: 1.2;
  font-size: .72rem; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-3);
  hyphens: auto; overflow-wrap: anywhere;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}
.kp__tabs button + button { border-left: 1px solid var(--line); }
.kp__tabs button:hover { color: var(--ink); }
.kp__tabs button[aria-selected="true"] { background: var(--ink); color: var(--paper-2); }
.kp__pane { display: grid; gap: 1.1rem; }
.kp__label { font-size: .68rem; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; color: var(--stone); margin-bottom: .55rem; }
.kp__chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.kp__chip {
  display: inline-flex; align-items: center; gap: .45rem; min-height: 38px; padding: .35rem .8rem; cursor: pointer;
  border: 1px solid var(--line-2); background: var(--card); font-size: .82rem; font-weight: 500; color: var(--ink-2);
  transition: border-color .25s, background-color .25s, color .25s;
}
.kp__chip::before { content: ""; width: 10px; height: 10px; border: 1.5px solid currentColor; border-radius: 50%; }
.kp__chip:hover { border-color: var(--ink); color: var(--ink); }
.kp__chip[aria-checked="true"] { border-color: var(--ink); background: var(--ink); color: var(--paper-2); }
.kp__chip[aria-checked="true"]::before { background: var(--stone-soft); border-color: var(--stone-soft); }

.kp__products { display: grid; gap: .75rem; }
.kprod { background: var(--card); border: 1px solid var(--line); transition: border-color .3s var(--ease), box-shadow .3s var(--ease); }
.kprod.is-active { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.kprod__main { display: grid; grid-template-columns: 112px minmax(0, 1fr); width: 100%; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.kprod__img { position: relative; overflow: hidden; aspect-ratio: 1; max-width: 100%; }
.kprod__img img { width: 100%; height: 100%; object-fit: cover; transition: transform .8s var(--ease); }
.kprod__main:hover .kprod__img img { transform: scale(1.06); }
.kprod__body { padding: .8rem .9rem; display: grid; gap: .2rem; align-content: start; min-width: 0; }
.kprod__cat { font-size: .64rem; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); }
.kprod__name { font-family: var(--f-display); font-weight: 750; font-stretch: 106%; font-size: .98rem; line-height: 1.15; text-transform: uppercase; }
.kprod__sub { font-family: var(--f-accent); font-style: italic; font-size: 1rem; color: var(--stone); line-height: 1.2; }
.kprod__short { font-size: .8rem; color: var(--ink-2); line-height: 1.4; margin-top: .2rem; }
.kprod__meta { font-size: .7rem; color: var(--ink-3); margin-top: .25rem; }
.kprod__vars { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: .45rem; padding: 0 .9rem .9rem; }
.kvar { display: grid; gap: .3rem; padding: 0; border: 0; background: none; cursor: pointer; text-align: left; font-size: .72rem; color: var(--ink-2); line-height: 1.25; }
.kvar img { width: 100%; aspect-ratio: 1; object-fit: cover; border: 2px solid transparent; outline: 1px solid var(--line); transition: border-color .25s; }
.kvar:hover img { border-color: var(--stone-soft); }
.kvar[aria-pressed="true"] img { border-color: var(--ink); }
.kvar[aria-pressed="true"] { color: var(--ink); font-weight: 600; }
.kprod__approx { padding: 0 .9rem .8rem; font-size: .7rem; color: var(--ink-3); }

.kp__summary { border-top: 1px solid var(--line-2); padding-top: 1rem; }
.kp__summary-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.kp__mini { display: flex; gap: 1rem; }
.kp__link { padding: .3rem 0; border: 0; background: none; cursor: pointer; font-size: .74rem; font-weight: 600; letter-spacing: .06em; color: var(--ink-2); border-bottom: 1px solid var(--line-2); }
.kp__link:hover { color: var(--ink); border-color: var(--ink); }
.kp__link:disabled { opacity: .4; cursor: default; }
.kp__rows { display: grid; }
.krow { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; align-items: center; gap: .75rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.krow__sw { width: 34px; height: 34px; background: #ddd center / cover; outline: 1px solid var(--line); }
.krow__txt { min-width: 0; padding: 0; border: 0; background: none; text-align: left; cursor: pointer; }
.krow__surf { display: block; font-size: .66rem; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.krow__mat { display: block; font-size: .86rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.krow.is-orig .krow__mat { color: var(--ink-3); }
.krow__x { width: 32px; height: 32px; border: 1px solid transparent; background: none; cursor: pointer; color: var(--ink-3); font-size: 1.1rem; line-height: 1; }
.krow__x:hover { border-color: var(--line-2); color: var(--ink); }
.krow.is-target { background: linear-gradient(90deg, rgba(138, 118, 83, .1), transparent 70%); }

.kp__actions { display: grid; grid-template-columns: 1fr auto; gap: .5rem; }
.kp__note { font-size: .72rem; color: var(--ink-3); }

/* ---------- Dijalozi, obavijest ---------- */
.ktoast {
  position: fixed; z-index: 60; left: 50%; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%);
  max-width: calc(100vw - 32px); padding: .75rem 1.1rem; background: var(--ink); color: var(--paper-2); font-size: .84rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .2); animation: toast .4s var(--ease);
}
@keyframes toast { from { opacity: 0; transform: translate(-50%, 10px); } }
.kdlg { width: min(980px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow: auto; padding: 0; border: 0; background: var(--paper-2); color: var(--ink); box-shadow: 0 30px 80px rgba(0, 0, 0, .3); }
.kdlg::backdrop { background: rgba(29, 31, 34, .55); }
.kdlg[open] { animation: toast .35s var(--ease); }
.kdlg__inner { position: relative; padding: 1.5rem; display: grid; gap: 1rem; }
.kdlg__inner--narrow { max-width: 640px; }
.kdlg:has(.kdlg__inner--narrow) { width: min(640px, calc(100vw - 32px)); }
.kdlg__x { position: absolute; right: 10px; top: 10px; width: 42px; height: 42px; border: 1px solid var(--line-2); background: var(--card); cursor: pointer; font-size: 1.4rem; line-height: 1; }
.kdlg__h { font-family: var(--f-display); font-weight: 780; font-stretch: 108%; font-size: 1.3rem; text-transform: uppercase; padding-right: 3rem; }
.kdlg__img { width: 100%; height: auto; max-height: 64vh; object-fit: contain; border: 1px solid var(--line); background: #fff; }
.kdlg__row { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; }
.kdlg__small { font-size: .78rem; color: var(--ink-3); flex: 1 1 18rem; }
.kdlg__small a { color: var(--ink-2); }
.kdlg__p { color: var(--ink-2); }
.kdlg__msg { width: 100%; resize: vertical; padding: .8rem; border: 1px solid var(--line-2); background: var(--card); font-size: .86rem; line-height: 1.5; }

/* Veza na foto-konfigurator */
.kp__photo { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .8rem 1rem; border: 1px solid var(--line-2); text-decoration: none; color: var(--ink); font-size: .74rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; transition: border-color .3s var(--ease), background-color .3s var(--ease); }
.kp__photo:hover { border-color: var(--ink); background: var(--card); }

/* ---------- Tablet ---------- */
@media (max-width: 1100px) {
  :root { --panel: 360px; }
  .kh__back { display: none; }
  .kv__tool span { display: none; }
}

/* ---------- Telefon: prikaz gore (ostaje vidljiv), panel ispod ---------- */
@media (max-width: 820px) {
  :root { --head: 60px; }
  .kh { gap: .75rem; padding-inline: max(16px, env(safe-area-inset-left, 0px)) max(16px, env(safe-area-inset-right, 0px)); }
  .kh__brand img { height: 40px; }
  .kh__title { padding-left: .75rem; }
  .kh__h1 { font-size: .9rem; }
  .kh__eyebrow { display: none; }
  .kh__send { display: none; }
  .kh__lang a { min-width: 34px; height: 34px; }
  .kf { display: block; height: auto; }
  .kv { position: sticky; top: var(--head); z-index: 10; height: 50vh; height: 50svh; padding: 0; background: var(--paper); }
  .kv__stage { border: 0; border-bottom: 1px solid var(--line-2); }
  .kv__views { left: 8px; right: 8px; bottom: 8px; }
  .kv__views button { flex: 1 1 0; }
  .kv__views button { min-width: 0; padding: 0 .6rem; height: 38px; font-size: .64rem; letter-spacing: .06em; }
  .kv__tools { right: 54px; top: 8px; bottom: auto; }
  .kv__tool { padding: 0 .7rem; height: 38px; }
  .kv__zoom { right: 8px; top: 8px; }
  .kv__zoom button { width: 38px; height: 38px; }
  .kv__label { left: 8px; top: auto; bottom: 54px; max-width: calc(100% - 16px); font-size: .64rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .kv__hint { left: 8px; right: 8px; bottom: 54px; font-size: .7rem; z-index: 1; }
  .kv__loading { left: 8px; right: auto; top: 8px; }
  .kv__badge { top: 54px; font-size: .64rem; }
  .kp { overflow: visible; padding: 18px max(16px, env(safe-area-inset-right, 0px)) calc(30px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); gap: 1.2rem; }
  .kp__intro { font-size: 1.12rem; }
  .kp__tabs { position: sticky; top: calc(var(--head) + 50svh); z-index: 5; }
  .kprod__main { grid-template-columns: 96px minmax(0, 1fr); }
  .kp__actions { grid-template-columns: 1fr; }
  .kdlg__inner { padding: 1.1rem; }
}
@media (max-width: 380px) {
  .kh__title { display: none; }
  .kv__views button { padding: 0 .45rem; font-size: .6rem; }
  .kprod__main { grid-template-columns: 84px minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
