/* Lexicon — interactive questionnaire (page-upitnik-proba.php, assets/js/quiz.js). Uses the tokens from main.css :root.
   Phone (<600px): exactly one screen, only the question area scrolls. Tablet / landscape phone (600–959px): centred card,
   page scrolls with Back and Dalje pinned. Desktop (≥960px wide and not portrait, i.e. aspect ≥ 4/5): photo aside + question card, sized to one screen.
   Portrait tablets ≥960px wide (iPad Pro) keep the tablet card. The same query is used in page-upitnik-proba.php. */
body.quiz-page{background:var(--cream);margin:0;padding-bottom:0}
.quiz-shell{max-width:520px;margin:0 auto;min-height:100vh;min-height:100dvh;display:flex;flex-direction:column}
.quiz-brand{padding:14px 22px 0}
.quiz-brand a{display:inline-flex;align-items:center;text-decoration:none}
.quiz-brand img{display:block;height:22px;width:auto}
.quiz-aside{display:none}
.quiz{flex:1;display:flex;flex-direction:column}
.quiz-form{flex:1;display:flex;flex-direction:column;color:var(--ink);font-size:16px}
.quiz-form button,.quiz-form a,.quiz-form label{-webkit-tap-highlight-color:transparent;touch-action:manipulation}
.quiz-noscript{padding:22px}
.q-hp{position:absolute!important;left:-9999px!important;width:1px;height:1px;opacity:0}
[hidden]{display:none!important}

/* Top bar */
.q-top{display:flex;align-items:center;gap:10px;padding:10px 18px 4px 10px;position:sticky;top:0;background:var(--cream);z-index:5}
.q-back{width:44px;height:44px;border-radius:22px;border:0;background:transparent;color:var(--navy);cursor:pointer;display:flex;align-items:center;justify-content:center;flex-shrink:0;transition:background .15s}
.q-back:hover{background:var(--sand)}
.q-back svg{width:22px;height:22px;fill:none;stroke:currentColor;stroke-width:2;stroke-linecap:round;stroke-linejoin:round}
.q-paws{display:flex;gap:4px;flex:1;min-width:0;align-items:center}
.q-paw{flex:0 1 24px;min-width:0}
.q-paw svg{width:100%;max-width:24px;height:auto;aspect-ratio:1;display:block;fill:#e3d5bd;transition:fill .3s,transform .3s}
.q-paw:nth-child(odd) svg{transform:rotate(-12deg)}
.q-paw:nth-child(even) svg{transform:rotate(12deg)}
.q-paw.is-done svg{fill:var(--terra)}
.q-paw.is-cur svg{fill:var(--navy);transform:scale(1.15)}
.q-dog{flex-shrink:0;font-size:13px;font-weight:600;color:var(--navy);background:var(--sand);padding:6px 12px;border-radius:20px;max-width:120px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}

/* Question area + step transition */
.q-stage-wrap{flex:1;position:relative;min-height:0;display:flex;flex-direction:column}
.q-stage{flex:1;overflow-x:hidden}
.q-fade{display:none}
.q-body{display:flex;flex-direction:column;gap:12px;padding:16px 22px 28px;transition:opacity .2s ease,transform .22s cubic-bezier(.2,.7,.3,1);will-change:opacity,transform}
.q-leave-fwd{opacity:0;transform:translateX(-24px);transition-duration:.14s}
.q-leave-back{opacity:0;transform:translateX(24px);transition-duration:.14s}
.q-enter-fwd{opacity:0;transform:translateX(24px);transition:none}
.q-enter-back{opacity:0;transform:translateX(-24px);transition:none}
.q-title{margin:0;font-family:'Manrope',system-ui,sans-serif;font-weight:600;font-size:30px;line-height:1.1;color:var(--navy);outline:none}
.q-sub{margin:-4px 0 4px;font-size:15px;color:#6b6152}
.q-h2{margin:14px 0 0;font-family:'Manrope',system-ui,sans-serif;font-weight:600;font-size:21px;color:var(--navy)}
.q-eyebrow{margin:0;font-family:'Manrope',system-ui,sans-serif;font-style:normal;font-weight:600;font-size:15px;color:var(--terra-700)}

/* Intro */
.q-intro{display:flex;flex-direction:column;gap:16px}
.q-intro picture{display:block}
.q-intro img{width:100%;height:300px;object-fit:cover;object-position:50% 62%;border-radius:24px;display:block}
.q-intro .q-title{font-size:38px;line-height:1.05}
.q-intro .q-sub{margin:0;font-size:16px;line-height:1.55;color:var(--body)}
.q-alt{margin:0;text-align:center;font-size:14px;color:#6b6152}
.q-alt a{color:var(--terra-700);text-decoration:underline;text-underline-offset:2px}

/* Answer cards */
.q-list{display:grid;grid-template-columns:minmax(0,1fr);gap:10px}
.q-card{display:flex;align-items:center;gap:14px;width:100%;box-sizing:border-box;text-align:left;padding:14px 16px;min-height:60px;border-radius:18px;border:2px solid var(--border);background:var(--card);font:inherit;color:var(--ink);cursor:pointer;transition:background .18s,border-color .18s,box-shadow .18s,transform .12s}
.q-card:hover{border-color:#dcc6a6}
.q-card:active{transform:scale(.985)}
.q-card.is-sel{border-color:var(--terra);background:#fbeee4}
.q-card-text{display:flex;flex-direction:column;gap:2px;flex:1}
.q-card-label{font-weight:600;font-size:16px}
.q-card-sub{font-size:14px;color:#6b6152}
.q-tick{width:24px;height:24px;border-radius:12px;border:2px solid #d9c7a8;flex-shrink:0;display:flex;align-items:center;justify-content:center;transition:background .18s,border-color .18s}
.q-tick svg{width:14px;height:14px;fill:none;stroke:#fff;stroke-width:3;stroke-linecap:round;stroke-linejoin:round;opacity:0;transform:scale(.6);transition:opacity .15s,transform .15s}
.q-card.is-sel .q-tick{background:var(--terra);border-color:var(--terra)}
.q-card.is-sel .q-tick svg{opacity:1;transform:none}
.q-badge{width:32px;height:32px;border-radius:16px;flex-shrink:0;display:flex;align-items:center;justify-content:center;font-weight:700;font-size:15px;background:var(--sand);color:var(--navy);transition:background .18s,color .18s}
.q-card.is-sel .q-badge{background:var(--terra);color:#fff}
.q-card--row .q-card-label{font-weight:500}

.q-chips{display:flex;flex-wrap:wrap;gap:8px}
.q-chip{min-height:44px;padding:0 16px;border-radius:22px;border:2px solid var(--border);background:var(--card);color:var(--ink);font:inherit;font-size:15px;font-weight:500;cursor:pointer;transition:background .18s,border-color .18s,color .18s}
.q-chip:hover{border-color:#dcc6a6}
.q-chip.is-sel{background:var(--terra-700);border-color:var(--terra-700);color:#fff} /* 15px text: terra 700 keeps white at 5.6:1 */

/* Contact fields */
.q-fields{display:grid;grid-template-columns:minmax(0,1fr);gap:10px}
.q-field{display:flex;flex-direction:column;gap:6px}
.q-label{font-size:13px;font-weight:600;margin-top:6px}
.q-input{height:54px;box-sizing:border-box;padding:0 16px;border-radius:14px;border:1.5px solid var(--border);background:var(--card);font:inherit;font-size:17px;color:var(--ink);width:100%}
.q-input:focus{outline:2px solid var(--terra);outline-offset:1px}
.q-input.is-bad{border-color:#7a2a12}
/* Grad suggestions: in the flow under the field (no overlay to clip inside the scrolling stage) */
.q-sugs{list-style:none;margin:4px 0 0;padding:6px;border:1.5px solid var(--border);border-radius:14px;background:var(--card);box-shadow:var(--shadow)}
.q-sugs[hidden]{display:none}
.q-sug{display:flex;align-items:center;min-height:44px;padding:0 12px;border-radius:10px;font-size:16px;color:var(--ink);cursor:pointer}
.q-sug:hover,.q-sug[aria-selected="true"]{background:var(--cream-2)}
.q-list--grid.q-list--compact .q-card{min-height:56px}
.q-input.q-textarea{height:auto;min-height:150px;padding:14px 16px;line-height:1.45;resize:vertical}
.q-link{align-self:flex-start;background:none;border:0;padding:8px 0;font:inherit;font-size:14px;color:var(--terra-700);text-decoration:underline;cursor:pointer}
.q-seg{border:0;margin:8px 0 0;padding:0;min-width:0}
.q-seg legend{font-size:13px;font-weight:600;padding:0;margin-bottom:8px}
.q-seg div{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px}
.q-seg button{height:46px;border-radius:14px;border:2px solid var(--border);background:var(--card);color:var(--ink);font:inherit;font-size:15px;font-weight:600;cursor:pointer;transition:background .18s,border-color .18s,color .18s}
.q-seg button.is-sel{background:var(--navy);border-color:var(--navy);color:#fff}
.q-consent{display:flex;gap:12px;align-items:flex-start;margin-top:12px;font-size:13px;line-height:1.45;color:var(--body);cursor:pointer}
.q-consent input{width:22px;height:22px;margin:0;flex-shrink:0;accent-color:var(--terra)}
.q-consent a{color:var(--terra-700);text-decoration:underline}
.q-error{margin:6px 0 0;padding:12px 14px;border-radius:12px;background:#fbe3dc;color:#7a2a12;font-size:14px}
.q-error a{color:inherit;font-weight:600;text-decoration:underline}

/* Footer button */
.q-foot{position:sticky;bottom:0;padding:12px 22px calc(18px + env(safe-area-inset-bottom));background:var(--cream);border-top:1px solid var(--border);z-index:5}
/* 19px: white on terracotta is 4.2:1, which the brandbook allows only at 14pt (18.7px) and up */
.q-primary{box-sizing:border-box;padding:0 24px;display:flex;align-items:center;justify-content:center;width:100%;height:56px;border-radius:40px;border:0;background:var(--terra);color:#fff;font:inherit;font-size:19px;font-weight:600;cursor:pointer;text-decoration:none;transition:background .2s,color .2s,transform .12s}
.q-primary:hover{background:var(--terra-700);color:#fff}
.q-primary:active{transform:scale(.99)}
.q-primary[aria-disabled="true"]{background:#e8dcc8;color:#7d7263;cursor:default}
.q-primary--navy{background:var(--navy);height:auto;min-height:56px;padding:12px 24px;text-align:center;line-height:1.3}
.q-primary--navy:hover{background:var(--navy-2)}
.quiz-form button:focus-visible,.quiz-form a:focus-visible{outline:2px solid var(--terra);outline-offset:2px}

/* Result */
.q-done{display:flex;align-items:center;gap:8px;margin:0;font-size:14px;font-weight:600;color:#3f6b3a}
.q-done svg{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round}
.q-result{display:flex;flex-direction:column;gap:16px}
.q-result-side{display:flex;flex-direction:column;gap:14px}
.q-rec{border-radius:22px;overflow:hidden;background:var(--card);border:1px solid var(--border)}
.q-rec img{width:100%;height:170px;object-fit:cover;display:block}
.q-rec>div{padding:16px 18px 18px;display:flex;flex-direction:column;gap:8px}
.q-rec-name{margin:0;font-family:'Manrope',system-ui,sans-serif;font-weight:600;font-size:25px;color:var(--navy)}
.q-rec ul{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px}
.q-rec li{display:flex;gap:10px;font-size:15px;line-height:1.45;color:var(--body)}
.q-rec li svg{width:18px;height:18px;flex-shrink:0;margin-top:2px;fill:none;stroke:var(--terra);stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round}
.q-note{margin:0;background:var(--sand);border-radius:16px;padding:14px 16px;font-size:15px;line-height:1.45}
.q-next{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:12px}
.q-next li{display:flex;gap:12px;align-items:center;font-size:15px;line-height:1.4}
.q-next b{width:40px;height:40px;border-radius:20px;flex-shrink:0;background:var(--navy);color:#fff;display:flex;align-items:center;justify-content:center;font-family:'Manrope',system-ui,sans-serif;font-weight:600}
.q-story{border:1.5px dashed #d9c7a8;border-radius:18px;padding:14px 16px;display:flex;gap:12px;align-items:center}
.q-story>div{width:64px;height:64px;border-radius:14px;background:var(--cream-2);flex-shrink:0;display:flex;align-items:center;justify-content:center;font-size:11px;color:#6b6152}
.q-story p{margin:0;font-size:14px;line-height:1.45;color:var(--body)}
.q-story strong{color:var(--navy)}
.q-close{margin:4px 0 0;text-align:center;font-family:'Manrope',system-ui,sans-serif;font-style:normal;font-size:22px;color:var(--terra-700)}

/* Phone: the page is exactly one screen tall; only the question area scrolls, and only when it must */
@media (max-width:599.98px){
  html:has(body.quiz-page){height:100%;overflow:hidden;overscroll-behavior:none}
  body.quiz-page{height:100%;overflow:hidden;overscroll-behavior:none}
  .quiz-shell{height:100vh;height:100dvh;min-height:0}
  body.q-in-progress .quiz-brand{display:none}
  .quiz,.quiz-form{min-height:0}
  .q-top{position:static;padding:8px 14px 0 8px}
  .q-stage{overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;min-height:0}
  .q-fade{display:block;position:absolute;left:0;right:0;bottom:0;height:44px;pointer-events:none;background:linear-gradient(rgba(250,244,234,0),var(--cream));opacity:0;transition:opacity .2s}
  .q-stage-wrap.has-more .q-fade{opacity:1}
  .q-body{padding:10px 20px 20px;gap:10px}
  .q-title{font-size:27px}
  .q-sub{font-size:14px}
  .q-foot{position:static;padding:10px 20px calc(14px + env(safe-area-inset-bottom))}
  .q-card{min-height:56px;padding:12px 16px}
  .q-list--grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .q-list--grid .q-card{position:relative;flex-direction:column;align-items:flex-start;justify-content:flex-start;min-height:92px;padding:12px 12px 12px 14px}
  .q-list--grid .q-card-label{font-size:15px;padding-right:26px;line-height:1.25}
  .q-list--grid .q-card-sub{font-size:13px;line-height:1.3}
  .q-list--grid .q-tick{position:absolute;top:10px;right:10px;width:22px;height:22px}
  .q-intro{gap:12px}
  .q-intro .q-title{font-size:34px}
  .q-intro img{height:min(300px,30vh)}
  .q-card{min-height:52px;padding:11px 16px}
  .q-list{gap:8px}
  .q-list--grid .q-card{min-height:86px}
  .q-fields{gap:8px}
  .q-field{gap:4px}
  .q-label{margin-top:0}
  .q-input{height:50px}
  .q-seg{margin-top:4px}
  .q-seg legend{margin-bottom:6px}
  .q-seg button{height:44px}
  .q-consent{margin-top:6px}
}

/* Short phones (iPhone SE and similar) */
@media (max-width:599.98px) and (max-height:620px){
  .q-title{font-size:24px}
  .q-sub{font-size:13px;margin:-6px 0 0}
  .q-body{padding-top:6px;gap:8px}
  .q-card{min-height:46px;padding:8px 14px}
  .q-card-sub{font-size:13px}
  .q-list--grid .q-card{min-height:78px;padding:10px 10px 10px 12px}
}

/* First visit on a phone: the cookie banner sits above the quiz, so the intro gives up photo height to keep
   Krenimo on the first screen. Ads open in Instagram's in-app browser, which is shorter than Safari. */
@media (max-width:599.98px){
  html.consent-ask .quiz-shell:has(> .consent:not([hidden])) .q-intro img{height:min(200px,22vh)}
}
@media (max-width:599.98px) and (max-height:760px){
  html.consent-ask .quiz-shell:has(> .consent:not([hidden])) .q-intro picture{display:none}
  html.consent-ask .quiz-shell:has(> .consent:not([hidden])) .q-intro .q-title{font-size:30px}
}

/* Tablet and landscape phones: centred card, the page scrolls, Back and Dalje stay pinned in view */
@media (min-width:600px){
  .quiz-shell{padding:24px 0 40px}
  /* clip, not hidden: hidden would make .quiz a scroll container and break the sticky bars */
  .quiz{background:var(--card);border-radius:28px;box-shadow:var(--shadow);margin-top:16px;overflow:hidden;overflow:clip}
  .q-top,.q-foot{background:var(--card)}
  .q-top{padding:20px 28px 4px 18px;position:sticky;top:0}
  .q-body{padding:18px 32px 32px}
  .q-foot{position:sticky;bottom:0;border-top:0;padding:12px 32px calc(24px + env(safe-area-inset-bottom))}
}
@media (min-width:600px) and (max-height:520px){
  .quiz-shell{padding:12px 0 16px}
  .quiz{margin-top:10px}
  .q-intro img{display:none}
  .q-body{padding:12px 28px 20px}
}

/* Desktop and laptop: photo aside + question card, sized to exactly one screen.
   The shell is the viewport's height (capped on very tall screens), the photo shrinks or grows to fill whatever
   the aside has left, and only the question area inside the card scrolls when a screen is taller than the card.
   Below 500px of height the shell stops shrinking and the page scrolls instead. */
@media (min-width:960px) and (min-aspect-ratio:4/5){
  html:has(body.quiz-page){height:100%}
  body.quiz-page{min-height:100%;display:flex;flex-direction:column;justify-content:center}
  .quiz-shell{box-sizing:border-box;width:100%;max-width:1240px;height:100vh;height:100dvh;min-height:500px;max-height:1080px;margin:0 auto;
    padding:clamp(16px,3vh,32px) clamp(32px,4vw,56px);display:grid;grid-template-columns:minmax(0,5fr) minmax(0,7fr);grid-template-rows:auto minmax(0,1fr);
    column-gap:clamp(32px,4vw,56px);row-gap:clamp(12px,2.4vh,24px);align-items:stretch}
  .quiz-brand{grid-column:1/-1;padding:0}
  .quiz-brand img{height:26px}
  .quiz-aside{display:flex;flex-direction:column;gap:clamp(12px,2vh,20px);min-height:0}
  .quiz-aside-photo{display:block;flex:1 1 0;min-height:120px;border-radius:28px;overflow:hidden;background:var(--sand)}
  .quiz-aside-photo img{width:100%;height:100%;object-fit:cover;object-position:50% 40%;display:block}
  .quiz-aside ul{flex:none;list-style:none;margin:0;padding:0;display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px 18px}
  .quiz-aside li{position:relative;padding-left:20px;font-size:15px;line-height:1.5;color:var(--body)}
  .quiz-aside li::before{content:"";position:absolute;left:0;top:7px;width:9px;height:9px;border-radius:5px;background:var(--terra)}
  .quiz-aside p{flex:none;margin:0;font-size:15px;line-height:1.5;color:#6b6152}
  .quiz-aside p a{color:var(--navy);font-weight:600;text-decoration:none}
  .quiz-aside p a:hover{color:var(--terra-700);text-decoration:underline}
  .quiz{margin:0;min-height:0;display:flex;flex-direction:column}
  .quiz-form{min-height:0}
  .q-top{position:static;padding:clamp(16px,2.6vh,28px) 40px 0 28px}
  .q-paw{flex-basis:28px}
  .q-paw svg{max-width:28px}
  .q-stage{overflow-y:auto;overscroll-behavior:contain;min-height:0;display:flex;flex-direction:column;scrollbar-width:thin;scrollbar-color:#e3d5bd transparent}
  .q-body{flex:1 0 auto;padding:clamp(14px,2.4vh,24px) 48px clamp(20px,3vh,36px);gap:clamp(10px,1.6vh,16px)}
  .q-fade{display:block;position:absolute;left:0;right:0;bottom:0;height:48px;pointer-events:none;background:linear-gradient(rgba(255,253,249,0),var(--card));opacity:0;transition:opacity .2s}
  .q-stage-wrap.has-more .q-fade{opacity:1}
  .q-title{font-size:clamp(32px,4.6vh,40px)}
  .q-sub{font-size:16px}
  .q-h2{font-size:24px}
  .q-list{grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
  .q-list--single{grid-template-columns:minmax(0,1fr)}
  .q-card{min-height:clamp(60px,8.4vh,76px);padding:14px 20px}
  .q-card-label{font-size:17px}
  .q-fields{grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}
  .q-seg div{max-width:480px}
  .q-fields.q-fields--one{grid-template-columns:minmax(0,1fr)}
  .q-foot{position:static;padding:clamp(12px,2vh,16px) 48px clamp(20px,3.6vh,40px);display:flex;justify-content:flex-end}
  .q-foot .q-primary{width:auto;min-width:240px;padding:0 40px}
  .q-intro{margin:auto 0;padding:8px 0 16px;gap:20px}
  .q-intro picture{display:none}
  .q-intro .q-title{font-size:clamp(44px,6.4vh,56px)}
  .q-intro .q-sub{font-size:18px;max-width:30em}
  .q-primary--start{width:auto;min-width:240px;padding:0 40px;align-self:flex-start}
  .q-alt{text-align:left}
  .q-result{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:24px;align-items:start}
  .q-rec img{height:clamp(150px,22vh,220px)}
}
/* Short laptop screens: give the photo and the card every pixel */
@media (min-width:960px) and (min-aspect-ratio:4/5) and (max-height:720px){
  .quiz-brand img{height:24px}
  .quiz-aside ul{gap:4px 16px}
  .quiz-aside li{font-size:14px}
  .quiz-aside p{font-size:14px}
  .q-sub{margin:-2px 0 2px}
}
/* Cookie banner (main.css .consent): same content and buttons, but never on top of the question or Krenimo / Dalje.
   page-kontakt.php prints it as the first child of .quiz-shell. Phones and tablets: in the flow above the card, so it pushes the quiz down
   instead of covering it. Desktop: fixed bottom left, over the photo column, clear of the card. */
@media not all and (min-width:960px) and (min-aspect-ratio:4/5){
  body.quiz-page .consent{position:static;flex:none;margin:12px 16px 4px;max-width:none}
}
@media (min-width:960px) and (min-aspect-ratio:4/5){
  body.quiz-page .consent{left:max(clamp(32px,4vw,56px),calc((100vw - 1240px) / 2 + 56px));right:auto;bottom:clamp(16px,3vh,32px);margin:0;width:min(440px,36vw)}
}
@media (prefers-reduced-motion:reduce){.q-body,.q-card,.q-chip,.q-paw svg,.q-fade{transition:none}}

/* E9 redesign (1.5.0): the desktop aside photo sits under the same ~50% navy veil as the site heroes */
.quiz-aside-photo{position:relative}
.quiz-aside-photo::after{content:"";position:absolute;inset:0;background:linear-gradient(180deg,rgba(39,50,79,.5),rgba(39,50,79,.5) 55%,rgba(39,50,79,.8));border-radius:inherit;pointer-events:none}
.q-title,.q-h2,.q-rec-name{letter-spacing:-.025em;font-weight:700}
.q-eyebrow{font-family:'Inter',system-ui,sans-serif;font-size:13px;letter-spacing:.14em;text-transform:uppercase}
