/* ═══════════════════════════════════════════════════════════════
   ScrapBag · šivalnica spominov
   Oblikovni sistem: krojaški papir + denim + zlata nit
   ═══════════════════════════════════════════════════════════════ */

:root {
  /* barve */
  --paper:        #f4edde;
  --paper-deep:   #ebe1c9;
  --paper-card:   #faf5ea;
  --ink:          #2e2318;
  --ink-soft:     #6b5d4a;
  --denim:        #2c4a6e;
  --denim-deep:   #1d3550;
  --denim-faded:  #8ba4bd;
  --denim-wash:   #dde6ee;
  --thread:       #d78d3a;
  --thread-bright:#e9a94e;
  --thread-pale:  #f3d9ae;
  --chalk:        #b3452f;
  --ok:           #4a7a4e;

  /* pisave */
  --f-display: "Fraunces", Georgia, serif;
  --f-body: "Instrument Sans", "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", Consolas, monospace;

  /* ritem */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 22px;
  --shadow-card: 0 1px 2px rgba(46,35,24,.08), 0 6px 18px -6px rgba(46,35,24,.18);
  --shadow-pop:  0 2px 4px rgba(46,35,24,.10), 0 16px 40px -12px rgba(29,53,80,.35);

  /* šiv — dvojna prešita črta kot na kavbojkah */
  --stitch: repeating-linear-gradient(90deg, var(--thread) 0 9px, transparent 9px 15px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--f-body);
  font-size: 16.5px;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--paper);
  /* krojaški papir: zrno + bledi 10 mm raster */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 .18 0 0 0 0 .14 0 0 0 0 .09 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='240' height='240' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(rgba(44,74,110,.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(44,74,110,.045) 1px, transparent 1px);
  background-size: 240px 240px, 38px 38px, 38px 38px;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--thread-pale); }

/* ── glava ─────────────────────────────────────────────────── */

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 10px clamp(14px, 4vw, 40px);
  background: color-mix(in srgb, var(--paper) 88%, white 12%);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid rgba(46,35,24,.12);
  box-shadow: 0 1px 0 rgba(255,255,255,.6) inset;
}

.brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--ink);
}
.brand-mark { width: 38px; height: 38px; flex: none; }
.bm-bg     { fill: var(--denim); }
.bm-bag    { fill: none; stroke: var(--thread-bright); stroke-width: 2.4; }
.bm-handle { fill: none; stroke: var(--thread-bright); stroke-width: 2.4; stroke-linecap: round; }
.bm-stitch { stroke: var(--thread-bright); stroke-width: 1.4; stroke-dasharray: 3 3; }
.brand-word {
  font-family: var(--f-display);
  font-weight: 640; font-size: 1.35rem; letter-spacing: -.01em;
}
.brand-word em { font-style: italic; color: var(--denim); }

/* stepper — nit skozi štiri vbode */
.stepper { display: flex; align-items: center; }
.topbar.hide-steps .stepper { display: none; }
.step {
  appearance: none; background: none; border: 0; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 4px 10px; color: var(--ink-soft);
  font-family: var(--f-body); font-size: .72rem; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase;
  position: relative;
}
.step:not(:first-child)::before {
  content: ""; position: absolute; top: 12px; right: calc(50% + 11px);
  width: calc(100% - 22px); height: 2px;
  background: var(--stitch); opacity: .45;
}
.step-dot {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2.5px solid var(--denim-faded); background: var(--paper-card);
  transition: all .25s ease;
}
.step.is-done .step-dot { background: var(--thread); border-color: var(--thread); }
.step.is-active { color: var(--denim); }
.step.is-active .step-dot {
  border-color: var(--denim); background: var(--denim);
  box-shadow: 0 0 0 4px rgba(44,74,110,.15);
}
.step:disabled { cursor: default; opacity: .55; }
@media (max-width: 640px) {
  .step-label { display: none; }
  .step { padding: 6px 8px; }
  .step:not(:first-child)::before { top: 13px; right: calc(50% + 10px); width: calc(100% - 18px); }
}

/* ── zasloni ───────────────────────────────────────────────── */

main { max-width: 1100px; margin: 0 auto; padding: 0 clamp(14px, 4vw, 40px) 60px; }

.screen { display: none; animation: rise .45s cubic-bezier(.22,.9,.35,1) both; }
.screen.is-active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.screen-head { margin: clamp(22px, 5vh, 46px) 0 26px; max-width: 640px; }
.screen-kicker {
  font-family: var(--f-mono); font-size: .78rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--chalk); margin: 0 0 6px;
}
.screen-title {
  font-family: var(--f-display); font-weight: 620; letter-spacing: -.015em;
  font-size: clamp(1.7rem, 4.5vw, 2.5rem); line-height: 1.12; margin: 0 0 10px;
}
.screen-sub { color: var(--ink-soft); margin: 0; }

.screen-nav {
  display: flex; justify-content: space-between; gap: 12px;
  margin-top: 34px; padding-top: 18px;
  border-top: 2px dashed rgba(46,35,24,.18);
}

/* ── gumbi ─────────────────────────────────────────────────── */

.btn {
  appearance: none; cursor: pointer; border: 0;
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--f-body); font-weight: 650; font-size: .95rem;
  padding: 12px 22px; border-radius: 999px;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn--primary {
  background: var(--denim); color: #fff;
  box-shadow: 0 2px 0 var(--denim-deep), 0 10px 24px -8px rgba(29,53,80,.5);
  outline: 1.5px dashed rgba(255,255,255,.5); outline-offset: -5px;
}
.btn--primary:hover { background: var(--denim-deep); }
.btn--primary:disabled {
  background: var(--denim-faded); box-shadow: none; cursor: not-allowed;
  outline-color: rgba(255,255,255,.35);
}
.btn--ghost {
  background: transparent; color: var(--denim);
  box-shadow: inset 0 0 0 2px rgba(44,74,110,.35);
}
.btn--ghost:hover { background: rgba(44,74,110,.08); }
.btn--big { font-size: 1.06rem; padding: 15px 28px; }
.btn-ico { width: 20px; height: 20px; }

/* ── naslovnica ────────────────────────────────────────────── */

.hero {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr);
  gap: clamp(20px, 4vw, 48px); align-items: center;
  padding-top: clamp(28px, 6vh, 64px);
}
@media (max-width: 860px) { .hero { grid-template-columns: 1fr; } }

.hero-kicker {
  display: inline-block; font-family: var(--f-mono); font-size: .8rem;
  letter-spacing: .14em; text-transform: uppercase; color: var(--denim);
  border: 1.5px dashed var(--thread); border-radius: 999px;
  padding: 5px 14px; margin: 0 0 18px; background: var(--paper-card);
}
.hero-title {
  font-family: var(--f-display); font-weight: 560; letter-spacing: -.02em;
  font-size: clamp(2.4rem, 6.5vw, 4.1rem); line-height: 1.04; margin: 0 0 18px;
}
.hero-title .hl {
  font-style: italic; font-weight: 680; color: var(--denim);
  position: relative; white-space: nowrap;
}
.hero-title .hl::after {
  content: ""; position: absolute; left: 2%; right: -1%; bottom: .04em;
  height: .14em; background: var(--stitch); opacity: .9;
}
.hero-lead { max-width: 52ch; color: var(--ink-soft); font-size: 1.06rem; margin: 0 0 24px; }
.hero-lead strong { color: var(--ink); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 26px; }

.hero-how {
  list-style: none; display: flex; flex-wrap: wrap; gap: 8px 22px;
  margin: 0; padding: 0; font-size: .9rem; color: var(--ink-soft);
}
.hero-how b {
  display: inline-flex; width: 22px; height: 22px; margin-right: 7px;
  align-items: center; justify-content: center;
  background: var(--thread); color: #fff; border-radius: 50%;
  font-family: var(--f-mono); font-size: .72rem;
}

.hero-art svg { width: 100%; height: auto; display: block; filter: drop-shadow(0 18px 30px rgba(29,53,80,.18)); }

.hero-strip {
  display: flex; flex-wrap: wrap; gap: 10px 30px; justify-content: center;
  margin-top: clamp(30px, 7vh, 60px); padding: 14px 18px;
  background: var(--denim); color: var(--denim-wash);
  border-radius: var(--r-md); font-size: .88rem; font-weight: 550;
  outline: 1.5px dashed rgba(233,169,78,.55); outline-offset: -6px;
}

/* ── kartice modelov ───────────────────────────────────────── */

.model-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
}

.model-card {
  appearance: none; text-align: left; cursor: pointer;
  background: var(--paper-card); border: 1.5px solid rgba(46,35,24,.14);
  border-radius: var(--r-lg); padding: 16px 16px 14px;
  box-shadow: var(--shadow-card);
  transition: transform .18s ease, box-shadow .22s ease, border-color .2s ease;
  position: relative; font-family: var(--f-body); color: var(--ink);
}
.model-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-pop); }
.model-card.is-selected {
  border: 2px solid var(--denim);
  outline: 2px dashed var(--thread); outline-offset: 3px;
  transform: translateY(-3px);
}
.model-card.is-selected::after {
  content: "✓"; position: absolute; top: -10px; right: -8px;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--thread); color: #fff; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 3px 8px rgba(46,35,24,.3);
}
.model-sketch {
  aspect-ratio: 5 / 4; display: flex; align-items: center; justify-content: center;
  background:
    linear-gradient(rgba(44,74,110,.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(44,74,110,.06) 1px, transparent 1px);
  background-size: 19px 19px;
  border-radius: var(--r-md); margin-bottom: 12px;
  border: 1px solid rgba(46,35,24,.08);
}
.model-sketch svg { width: 82%; height: 82%; }
.model-name { font-family: var(--f-display); font-weight: 640; font-size: 1.12rem; margin: 0 0 2px; }
.model-desc { color: var(--ink-soft); font-size: .84rem; margin: 0 0 10px; min-height: 2.4em; }
.model-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag {
  font-family: var(--f-mono); font-size: .68rem; letter-spacing: .04em;
  padding: 3px 9px; border-radius: 999px;
  background: var(--denim-wash); color: var(--denim);
}
.tag--diff1 { background: #e3ecdd; color: var(--ok); }
.tag--diff2 { background: var(--thread-pale); color: #91601e; }
.tag--diff3 { background: #f3ddd6; color: var(--chalk); }

/* skice — ročna črta */
.sk-line   { fill: none; stroke: var(--denim); stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.sk-thin   { fill: none; stroke: var(--denim); stroke-width: 1.6; stroke-linecap: round; }
.sk-stitch { fill: none; stroke: var(--thread); stroke-width: 1.6; stroke-dasharray: 4 4; stroke-linecap: round; }
.sk-fill   { fill: var(--denim-wash); }

/* ── velikost ──────────────────────────────────────────────── */

.size-row {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  max-width: 720px;
}
.size-card {
  appearance: none; cursor: pointer; font-family: var(--f-body); color: var(--ink);
  background: var(--paper-card); border: 1.5px solid rgba(46,35,24,.14);
  border-radius: var(--r-lg); padding: 20px 16px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  box-shadow: var(--shadow-card);
  transition: transform .18s ease, box-shadow .22s ease;
}
.size-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-pop); }
.size-card.is-selected {
  border: 2px solid var(--denim);
  outline: 2px dashed var(--thread); outline-offset: 3px;
}
.size-badge {
  font-family: var(--f-display); font-weight: 700; font-style: italic;
  font-size: 2rem; color: var(--denim); line-height: 1;
}
.size-name { font-weight: 650; }
.size-dims { font-family: var(--f-mono); font-size: .8rem; color: var(--ink-soft); }
.size-sketchwrap { height: 74px; display: flex; align-items: flex-end; justify-content: center; }
.size-sketchwrap svg { height: 100%; width: auto; }

.size-meta { margin-top: 22px; max-width: 720px; font-size: .95rem; }
.size-meta b { color: var(--denim); }

.card-paper {
  background: var(--paper-card); border: 1.5px solid rgba(46,35,24,.14);
  border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--shadow-card);
}

/* ── blago ─────────────────────────────────────────────────── */

.fabric-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  margin-bottom: 18px;
}
.fabric-slot {
  background: var(--paper-card); border-radius: var(--r-lg);
  border: 1.5px solid rgba(46,35,24,.14);
  padding: 14px; box-shadow: var(--shadow-card);
  display: flex; flex-direction: column; gap: 10px;
}
.fabric-role { display: flex; align-items: baseline; gap: 8px; }
.fabric-role b { font-family: var(--f-display); font-size: 1.02rem; }
.fabric-role span { font-size: .78rem; color: var(--ink-soft); }
.fabric-drop {
  position: relative; aspect-ratio: 4 / 3; border-radius: var(--r-md);
  border: 2px dashed var(--denim-faded);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px; color: var(--denim); cursor: pointer; overflow: hidden;
  background: var(--denim-wash); text-align: center;
  transition: border-color .2s ease, background .2s ease;
}
.fabric-drop:hover { border-color: var(--denim); background: #d2deea; }
.fabric-drop.has-img { border-style: solid; border-color: var(--thread); background: none; }
.fabric-drop img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.fabric-drop .fd-ico { font-size: 1.6rem; line-height: 1; }
.fabric-drop .fd-txt { font-size: .8rem; font-weight: 600; padding: 0 10px; }
.fabric-drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.fabric-clear {
  appearance: none; border: 0; cursor: pointer; align-self: flex-start;
  background: none; color: var(--chalk); font-size: .78rem; font-weight: 650;
  padding: 0; text-decoration: underline dashed; text-underline-offset: 3px;
}
.fabric-clear[hidden] { display: none; }
.fabric-tip { font-size: .92rem; max-width: 720px; }

/* ── rezultat ──────────────────────────────────────────────── */

.screen-head--result {
  display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end;
  justify-content: space-between; max-width: none;
}
.result-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.tabs {
  display: flex; gap: 4px; margin-bottom: -1.5px; position: relative; z-index: 2;
  flex-wrap: wrap;
}
.tab {
  appearance: none; cursor: pointer; font-family: var(--f-body);
  font-weight: 650; font-size: .92rem; color: var(--ink-soft);
  background: var(--paper-deep); border: 1.5px solid rgba(46,35,24,.14);
  border-bottom: 0; border-radius: var(--r-md) var(--r-md) 0 0;
  padding: 10px 20px;
}
.tab.is-active { background: var(--paper-card); color: var(--denim); border-color: rgba(46,35,24,.2); }

.tabpane { display: none; }
.tabpane.is-active { display: block; animation: rise .35s ease both; }

.preview-stage { padding: clamp(14px, 3vw, 34px); border-top-left-radius: 0; }
.preview-stage svg { width: 100%; max-width: 560px; height: auto; display: block; margin: 0 auto; }
.preview-note { text-align: center; color: var(--ink-soft); font-size: .88rem; }

.pattern-legend {
  display: flex; flex-wrap: wrap; gap: 8px 20px; padding: 12px 4px;
  font-size: .82rem; color: var(--ink-soft); font-family: var(--f-mono);
}
.pattern-legend .lg { display: inline-flex; align-items: center; gap: 7px; }
.lg-swatch { width: 26px; height: 0; border-top: 2.5px solid var(--ink); }
.lg-swatch--dash { border-top-style: dashed; border-top-color: var(--chalk); }
.lg-swatch--grain { border-top-color: var(--denim); }

.pattern-stage { padding: clamp(10px, 2vw, 24px); overflow-x: auto; border-top-left-radius: 0; }
.pattern-stage svg { display: block; margin: 0 auto; max-width: 100%; height: auto; }

/* ── navodila ──────────────────────────────────────────────── */

.guide { display: grid; gap: 18px; grid-template-columns: minmax(0, 1fr); max-width: 780px; }
.guide-card { border-top-left-radius: 0; }
.guide h3 {
  font-family: var(--f-display); font-weight: 640; font-size: 1.2rem;
  margin: 0 0 10px; color: var(--denim);
}
.guide table { border-collapse: collapse; width: 100%; font-size: .92rem; }
.guide th, .guide td { text-align: left; padding: 7px 10px; border-bottom: 1px dashed rgba(46,35,24,.2); }
.guide th { font-family: var(--f-mono); font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); }
.guide td.num { font-family: var(--f-mono); white-space: nowrap; }

.guide ol.steps { margin: 0; padding: 0; list-style: none; counter-reset: korak; }
.guide ol.steps li {
  counter-increment: korak; position: relative;
  padding: 10px 0 10px 46px; border-bottom: 1px dashed rgba(46,35,24,.16);
}
.guide ol.steps li:last-child { border-bottom: 0; }
.guide ol.steps li::before {
  content: counter(korak); position: absolute; left: 0; top: 9px;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--denim); color: #fff;
  font-family: var(--f-mono); font-size: .82rem; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.guide .mat-chip {
  display: inline-block; font-family: var(--f-mono); font-size: .72rem;
  background: var(--denim-wash); color: var(--denim);
  border-radius: 999px; padding: 2px 9px; margin-left: 6px;
}

/* ── telefon: vse na dosegu palca ──────────────────────────── */

@media (max-width: 640px) {
  body { font-size: 16px; }

  /* lepljiva vrstica z gumbi — »Naprej« vedno pri roki */
  .screen-nav {
    position: sticky; bottom: 0; z-index: 30;
    margin: 26px calc(-1 * clamp(14px, 4vw, 40px)) 0;
    padding: 12px clamp(14px, 4vw, 40px) calc(12px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, var(--paper) 78%, transparent);
    border-top: 0;
  }
  .screen-nav .btn { flex: 1; justify-content: center; }
  .screen-nav .btn--ghost { flex: 0 1 auto; }

  /* kompaktne kartice modelov — 2 stolpca, vse vidno hitreje */
  .model-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .model-card { padding: 10px 10px 12px; border-radius: var(--r-md); }
  .model-sketch { margin-bottom: 8px; border-radius: 10px; }
  .model-name { font-size: .98rem; }
  .model-desc { display: none; }
  .model-tags .tag { font-size: .6rem; padding: 2px 7px; }

  .size-row { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .size-card { padding: 14px 6px; }
  .size-dims { font-size: .68rem; }
  .size-badge { font-size: 1.6rem; }

  /* rezultat: gumba čez celo širino, kroj čitljiv z drsenjem */
  .result-actions { width: 100%; }
  .result-actions .btn { flex: 1; justify-content: center; }
  .pattern-stage svg { min-width: 680px; max-width: none; }
  .preview-stage { padding: 10px; }
  .tab { padding: 9px 14px; font-size: .86rem; }

  .hero-actions .btn--big { width: 100%; justify-content: center; }
  .hero-strip { font-size: .8rem; gap: 8px 18px; }
}

/* miška: hover učinki samo tam, kjer obstaja kazalec */
@media (hover: none) {
  .model-card:hover, .size-card:hover { transform: none; box-shadow: var(--shadow-card); }
}

/* ── noga ──────────────────────────────────────────────────── */

.sitefoot {
  text-align: center; padding: 26px 16px 34px; color: var(--ink-soft);
  font-size: .86rem; border-top: 2px dashed rgba(46,35,24,.15);
}
.sitefoot .heart { color: var(--chalk); }

/* ── TISK ──────────────────────────────────────────────────── */

.print-root { display: none; }

@media print {
  @page { size: A4 portrait; margin: 0; }
  body { background: #fff; }
  body > *:not(.print-root) { display: none !important; }
  .print-root { display: block; }
  .print-page {
    width: 210mm; height: 296mm; /* -1mm varnostno pred prelomom */
    page-break-after: always; overflow: hidden; position: relative;
    display: flex; align-items: center; justify-content: center;
  }
  .print-page:last-child { page-break-after: auto; }
  .print-page svg { display: block; }
  /* tekoči dokument (navodila) — sme se prelomiti čez več strani */
  .print-flow { width: 186mm; margin: 0 auto; padding: 12mm 0 10mm; font-family: var(--f-body); color: #000; }
  .print-flow h1, .print-flow h2 { page-break-after: avoid; }
  .print-flow table, .print-flow li { page-break-inside: avoid; }
}
