/*
  Architekt živých plotů – responzivní světlý styl
  - zachovává funkčnost i vizualizaci živého plotu (#plot)
  - ponechává systémový font / font prohlížeče (bez externích fontů)
*/

:root{
  /* ladění do zelené (sjednoceno s kvizem) */
  --pageBg: #f6f6f6;
  --cardBg: #ffffff;
  --text: #1f2328;
  --muted: #5b6674;
  --border: rgba(47, 125, 50, 0.18);
  /* kviz je víc "flat" – stíny používáme jen při hover/aktivní volbě */
  --shadow: none;
  --hoverShadow: 0 10px 18px rgba(0,0,0,.05);

  --accent: #2f7d32;
  --accent2:#1f5f23;
  --accentSoft: rgba(47,125,50,0.10);

  --radius: 14px;
  --pad: 16px;

  --headerGap: 12px;
  --maxW: 1080px;

  /* výška segmentů plotu – škáluje se s viewportem */
  --plotH: clamp(76px, 14vw, 120px);
}

*{ box-sizing: border-box; }
html, body{ height: 100%; }
body{
  margin: 0;
  color: var(--text);
  background: var(--pageBg);
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a{ color: inherit; }

/* --- header --- */
.site-header{
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255,255,255,0.86);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner{
  max-width: var(--maxW);
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--headerGap);
  flex-wrap: wrap;
}

#top01{
  font-weight: 700;
  letter-spacing: .2px;
}
#top01 a{
  color: var(--accent2);
  text-decoration: none;
  border-bottom: 1px dashed rgba(47,125,50,0.35);
}
#top01 a:hover{ border-bottom-style: solid; }

#closecart a{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 0;
  background: transparent;
  color: var(--accent2);
  text-decoration: none;
  font-weight: 700;
  box-shadow: none;
  white-space: nowrap;
  border-bottom: 1px dashed rgba(47,125,50,0.35);
}

/* malé „ikonky“ v headeru (bez obrázků, jen typografie) */
#top01::before{
  content: "🌿";
  margin-right: 8px;
}
#closecart a::before{
  content: "←";
  margin-right: 8px;
  font-weight: 900;
}
#closecart a:hover{ border-bottom-style: solid; }

/* --- layout --- */
.container{
  max-width: var(--maxW);
  margin: 0 auto;
  padding: 18px 16px 28px;
}

h2{
  margin: 18px 0 10px;
  font-size: 1.05rem;
}

#delkad{
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px;
  border: 1px solid var(--border);
  background: var(--cardBg);
  border-radius: var(--radius);
  box-shadow: none;
}

#delkad:hover{
  box-shadow: var(--hoverShadow);
  border-color: rgba(47,125,50,.28);
}
#delkad label{
  font-weight: 700;
}
#delka{
  width: 140px;
  max-width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 1rem;
}

#delka:focus{
  outline: none;
  border-color: rgba(47,125,50,.45);
  box-shadow: 0 0 0 3px rgba(47,125,50,.10);
}

/* --- rostliny grid --- */
#rostliny{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
  margin-top: 10px;
}
.rostlina{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  background: var(--cardBg);
  border-radius: var(--radius);
  box-shadow: none;
  transition: transform .06s ease, border-color .12s ease, box-shadow .12s ease;
}

.rostlina:hover{
  border-color: rgba(47,125,50,.35);
  box-shadow: var(--hoverShadow);
  transform: translateY(-1px);
}
.rostlina.is-checked{
  border-color: rgba(47,125,50,0.45);
  background: linear-gradient(180deg, rgba(47,125,50,0.06), rgba(47,125,50,0.03));
  box-shadow: 0 0 0 3px rgba(47,125,50,0.10);
}
.rostlina label{
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}
.rostlina input[type="checkbox"]{
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  accent-color: var(--accent);
}

/* --- primary button --- */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 0;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  box-shadow: none;
}
.btn:hover{ filter: brightness(1.03); }
.btn:active{ transform: translateY(1px); }

.btn::after{
  content: "→";
  font-weight: 900;
}

/* --- tabulka --- */
#tabulka{
  margin-top: 8px;
}
#tabulka table{
  width: 100%;
  max-width: 680px;
  margin: 14px auto 0;
  background: var(--cardBg);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: none;
}
#tabulka td{
  font-weight: 700;
}

/* --- plot preview (scroll na malých displejích) --- */
#plot{
  margin-top: 16px;
  /* menší vnitřní odsazení, aby "plot" působil kompaktně i na mobilu */
  padding: 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.78));
  box-shadow: none;

  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  -webkit-overflow-scrolling: touch;
}

/* wrapper pro overlay (indikátor pozice scrollu) */
.plot-wrap{
  position: relative;
}

/* --- WOW: lupa (zoom) nad plotem ---
   - myš: zobrazuje se při hoveru a sleduje kurzor
   - touch: při dotyku se "zaparkuje" vpravo nahoře, aby nepřekážela prstu */
.plot-magnifier{
  --lensSize: clamp(128px, 24vw, 170px);
  position: absolute;
  width: var(--lensSize);
  height: var(--lensSize);
  left: 12px;
  top: 12px;
  z-index: 40;
  pointer-events: none;

  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(47,125,50, 0.22);
  background: rgba(255,255,255,0.92);
  box-shadow: none;

  opacity: 1;
  visibility: visible;
  transform: translateZ(0) scale(1);
  transition: opacity .12s ease, transform .12s ease;
}
.plot-magnifier.is-hidden{
  opacity: 0;
  visibility: hidden;
  transform: translateZ(0) scale(0.98);
}

.plot-magnifier .magnifier-inner{
  position: relative;
  width: 100%;
  height: 100%;
}
.plot-magnifier .magnifier-content{
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  will-change: transform;
}

/* jemný "kříž" uprostřed lupy */
.plot-magnifier .magnifier-reticle{
  position: absolute;
  inset: 0;
}
.plot-magnifier .magnifier-reticle::before,
.plot-magnifier .magnifier-reticle::after{
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  background: rgba(47,125,50, 0.22);
  transform: translate(-50%, -50%);
}
.plot-magnifier .magnifier-reticle::before{
  width: 2px;
  height: 46px;
  border-radius: 2px;
}
.plot-magnifier .magnifier-reticle::after{
  width: 46px;
  height: 2px;
  border-radius: 2px;
}

@media (prefers-reduced-motion: reduce){
  .plot-magnifier{ transition: none; }
}

/* pevná šipka uprostřed viditelné oblasti + pill s metry */
.plot-indicator{
  position: absolute;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 30;
  display: grid;
  place-items: center;
  gap: 6px;
}
.plot-indicator.is-hidden{ display: none; }

.plot-indicator .indicator-pill{
  font-size: 12px;
  font-weight: 900;
  color: #111827;
  background: rgba(255,255,255,0.92);
  border: 1px solid rgba(47,125,50, 0.22);
  border-radius: 999px;
  padding: 6px 10px;
  box-shadow: none;
  line-height: 1;
  user-select: none;
  white-space: nowrap;
}

.plot-indicator .indicator-line{
  width: 2px;
  height: calc(var(--plotH) + 34px + 10px);
  background: rgba(47,125,50, 0.28);
  border-radius: 2px;
}

.plot-indicator .indicator-arrow{
  width: 0;
  height: 0;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 10px solid rgba(47,125,50, 0.45);
  filter: none;
}

/* Vnitřní wrapper: segmenty + metr (obě vrstvy se posouvají společně) */
.plot-inner{
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
}

/* řádek se segmenty – eliminace mikro-mezer (baseline/whitespace) */
.plot-row{
  white-space: nowrap;
  font-size: 0;
  line-height: 0;
  position: relative;
  display: inline-block;
}

/* zvýraznění každých 5 m (1000 px) – jemná svislá linka přes celý plot */
.plot-row::after{
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background-image: repeating-linear-gradient(
    to right,
    rgba(15, 23, 42, 0.22) 0 2px,
    transparent 2px 1000px
  );
  opacity: 0.55;
}

/* segmety přidává JS jako <div style="...">; tohle jen doplní chování */
#plot .plot-row > div{
  height: var(--plotH) !important;
  background-size: cover;
  background-repeat: no-repeat;
  vertical-align: bottom;

  /* JS dává border-right + border-radius → na světlém pozadí to vypadá jako mezery.
     Tady je přepíšeme, aby plot byl spojitý jako dřív. */
  border-right: 0 !important;
  border-radius: 0 !important;
  position: relative;
  z-index: 1;
}

/* --- "metr" pod plotem (0.5m čárky, 1m čárky + popisky) --- */
.plot-ruler{
  position: relative;
  height: 34px;
  width: 100%;
  border-top: 1px solid rgba(15, 23, 42, 0.16);
  padding-top: 6px;

  /* 4 vrstvy:
     - zvýraznění 5 m (silnější)
     - 1 m
     - 0.5 m (kratší)
     - jemné páskování každých 5 m (alternující) */
  background-image:
    repeating-linear-gradient(to right,
      rgba(15, 23, 42, 0.45) 0 2px,
      transparent 2px 1000px
    ),
    repeating-linear-gradient(to right,
      rgba(15, 23, 42, 0.32) 0 1px,
      transparent 1px 200px
    ),
    repeating-linear-gradient(to right,
      rgba(15, 23, 42, 0.22) 0 1px,
      transparent 1px 100px
    ),
    repeating-linear-gradient(to right,
      rgba(47,125,50, 0.06) 0 1000px,
      transparent 1000px 2000px
    );

  background-size: 1000px 100%, 200px 100%, 100px 55%, 2000px 100%;
  background-repeat: repeat-x;
  background-position: 0 0, 0 0, 0 0, 0 0;
}

.plot-ruler .ruler-label{
  position: absolute;
  top: 10px;
  font-size: 12px;
  line-height: 1;
  font-weight: 800;
  color: var(--muted);
  transform: translateX(-50%);
  white-space: nowrap;
  user-select: none;
}
.plot-ruler .ruler-label.five{
  color: #111827;
  font-size: 12.5px;
}
.plot-ruler .ruler-label.start{ transform: none; }
.plot-ruler .ruler-label.end{ transform: translateX(-100%); }

/* drobná hint: "přetažení" */
#plot:empty::before{
  content: "Vyberte alespoň 1 typ živého plotu…";
  color: var(--muted);
  font-weight: 700;
  display: block;
  padding: 16px;
}

/* --- mobile tweaks --- */
@media (max-width: 520px){
  .header-inner{ padding: 12px 12px; }
  .container{ padding: 16px 12px 24px; }
  #top01{ font-size: 0.98rem; }
  #closecart a{ width: 100%; }
  #delka{ width: 100%; }
  .btn{ width: 100%; }
}

@media (prefers-reduced-motion: reduce){
  .btn:active{ transform: none; }
}
