/* =========================================================
   Šimon Šťastný — sdílené styly pro index.html a clanek.html
   ========================================================= */

:root {
  --green: 34, 197, 94;
  --fg: #f2f5f3;
  --body: #d7ded9;
  --muted: #8b968f;
  --line: rgba(255, 255, 255, 0.10);
  --card: rgba(255, 255, 255, 0.035);

  /* odstíny zelené, aby se rgba() neopakovalo u každého hoveru */
  --g-edge: rgba(var(--green), 0.45);
  --g-soft: rgba(var(--green), 0.12);
  --g-tint: rgba(var(--green), 0.08);
  --g-glow: 0 10px 30px -12px rgba(var(--green), 0.55);

  --ease: cubic-bezier(.2, .7, .3, 1);
  --sunk: rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  min-height: 100dvh;
  width: 100%;
  position: relative;
  background: #000;
  color: var(--fg);
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* Arctic Lights — záře shora */
body::before {
  background:
    radial-gradient(ellipse 80% 60% at 50% 0%, rgba(var(--green), 0.25), transparent 70%),
    #000;
}

/* jemný grain, aby gradient nepásmoval */
body::after {
  opacity: 0.3;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.5'/%3E%3C/svg%3E");
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
}
body::before { z-index: 0; }
body::after  { z-index: 1; }

main {
  position: relative;
  z-index: 2;
  width: 100%;
  margin: 0 auto;
}

/* rozcestník je úzký a na střed, článek širší a zarovnaný vlevo */
.page-links {
  max-width: 32rem;
  padding: clamp(3.5rem, 12vh, 7rem) 1.25rem 4rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.page-article {
  max-width: 44rem;
  padding: clamp(2rem, 6vh, 3.5rem) 1.25rem 5rem;
  animation: rise 0.6s var(--ease) both;
}

/* ---------- společné povrchy ---------- */

/* prosklené karty */
.link,
.contact,
.socials a {
  background: var(--card);
  border: 1px solid var(--line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

/* zapuštěné bloky — kód a soubor ke stažení */
.code,
.file {
  position: relative;
  border-radius: 0.7rem;
  background: var(--sunk);
  border: 1px solid var(--line);
}

/* čtvercová ikonová tlačítka uvnitř zapuštěných bloků */
.code .copy,
.file .dl {
  position: absolute;
  top: 50%;
  right: 0.6rem;
  transform: translateY(-50%);
  /* bez z-indexu by <pre> tlačítko překrylo a klik by k němu nedošel */
  z-index: 1;
  width: 2rem;
  height: 2rem;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 0.45rem;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.88);
  border: 1px solid var(--line);
  transition: color .2s ease, border-color .2s ease, background-color .2s ease;
}
.code .copy svg,
.file .dl svg { width: 0.95rem; height: 0.95rem; display: block; }

/* zelené zvýraznění ikony: hover u kódu, hover celé karty u souboru, a stav „hotovo" */
.code .copy:hover,
.code .copy:focus-visible,
.code .copy.done,
.file:hover .dl,
.file:focus-visible .dl {
  color: rgb(var(--green));
  border-color: var(--g-edge);
  background: var(--g-soft);
  outline: none;
}
.code .copy.done { border-color: rgba(var(--green), 0.6); background: rgba(var(--green), 0.18); }
.code .copy { cursor: pointer; }
.code .copy.fail {
  color: #ffc400;
  border-color: rgba(255, 196, 0, 0.5);
  background: rgba(255, 196, 0, 0.14);
}

/* =========================================================
   Rozcestník (index.html)
   ========================================================= */

.page-links h1 {
  margin: 0;
  font-size: clamp(1.6rem, 6vw, 2.1rem);
  font-weight: 400;
  letter-spacing: 0.02em;
  animation: rise 0.6s 0.05s var(--ease) both;
}

.handle {
  margin: 0.4rem 0 0;
  font-size: 0.9rem;
  color: rgb(var(--green));
  opacity: 0.85;
  animation: rise 0.6s 0.1s var(--ease) both;
}

.links {
  width: 100%;
  margin-top: 2.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.link {
  --d: 0ms;
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1rem 1.1rem;
  border-radius: 0.9rem;
  text-decoration: none;
  color: var(--fg);
  transition: transform .25s var(--ease), border-color .25s ease,
              background-color .25s ease, box-shadow .25s ease;
  animation: rise 0.6s var(--ease) both;
  animation-delay: var(--d);
}

.link:hover,
.link:focus-visible {
  transform: translateY(-2px);
  background: rgba(var(--green), 0.09);
  border-color: var(--g-edge);
  box-shadow: var(--g-glow);
  outline: none;
}
.link:active { transform: translateY(0) scale(0.99); }

/* zvýrazněný odkaz na článek */
.link.featured {
  background: var(--g-tint);
  border-color: rgba(var(--green), 0.3);
}
.link.featured .label { line-height: 1.35; white-space: normal; }

.link .ico {
  flex: 0 0 auto;
  width: 2.1rem;
  height: 2.1rem;
  display: grid;
  place-items: center;
  border-radius: 0.55rem;
  background: var(--g-soft);
  border: 1px solid rgba(var(--green), 0.2);
  color: rgb(var(--green));
}
.link .ico svg { width: 1.05rem; height: 1.05rem; display: block; }

.link .txt { display: flex; flex-direction: column; min-width: 0; }
.link .label { font-size: 0.98rem; letter-spacing: 0.01em; }
.link .sub {
  font-size: 0.75rem;
  color: var(--muted);
  margin-top: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.link .arrow {
  margin-left: auto;
  padding-left: 0.5rem;
  display: grid;
  place-items: center;
  color: var(--muted);
  opacity: 0;
  transform: translateX(-4px);
  transition: opacity .25s ease, transform .25s ease, color .25s ease;
}
.link:hover .arrow,
.link:focus-visible .arrow {
  opacity: 1;
  transform: translateX(0);
  color: rgb(var(--green));
}

/* ---------- kontaktní formulář ---------- */

.contact {
  width: 100%;
  margin-top: 2rem;
  padding: 1.35rem 1.25rem 1.4rem;
  border-radius: 0.9rem;
  animation: rise 0.6s 0.4s var(--ease) both;
}

.contact h2 {
  margin: 0 0 1.1rem;
  font-size: 0.95rem;
  font-weight: 400;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}
.contact h2 svg { width: 1rem; height: 1rem; color: rgb(var(--green)); flex: 0 0 auto; }

.field { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.9rem; }
.field label { font-size: 0.75rem; letter-spacing: 0.06em; color: var(--muted); }

.field input,
.field textarea {
  width: 100%;
  padding: 0.7rem 0.8rem;
  border-radius: 0.6rem;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.5;
  transition: border-color .2s ease, box-shadow .2s ease, background-color .2s ease;
}
.field textarea { resize: vertical; min-height: 6.5rem; }
.field :is(input, textarea)::placeholder { color: rgba(255, 255, 255, 0.22); }
.field :is(input, textarea):focus {
  outline: none;
  border-color: rgba(var(--green), 0.55);
  background: rgba(var(--green), 0.05);
  box-shadow: 0 0 0 3px var(--g-soft);
}

.submit {
  width: 100%;
  margin-top: 0.3rem;
  padding: 0.85rem 1rem;
  border-radius: 0.7rem;
  border: 1px solid var(--g-edge);
  background: rgba(var(--green), 0.14);
  color: rgb(var(--green));
  font-family: inherit;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  transition: transform .2s var(--ease), background-color .2s ease, box-shadow .2s ease;
}
.submit svg { width: 1rem; height: 1rem; transition: transform .2s ease; }
.submit:hover,
.submit:focus-visible {
  background: rgba(var(--green), 0.22);
  box-shadow: var(--g-glow);
  transform: translateY(-2px);
  outline: none;
}
.submit:is(:hover, :focus-visible) svg { transform: translateX(3px); }
.submit:active { transform: translateY(0) scale(0.99); }
.submit:disabled {
  opacity: 0.55;
  cursor: progress;
  transform: none;
  box-shadow: none;
}

/* past na roboty — pryč z obrazovky, ale ne display:none, aby ji roboti vyplnili */
.trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.form-note {
  margin: 0.85rem 0 0;
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
  min-height: 1.1em;
}
.form-note.ok { color: rgb(var(--green)); }

/* ---------- kolečka se sítěmi ---------- */

.socials {
  margin-top: 2.25rem;
  display: flex;
  gap: 0.6rem;
  animation: rise 0.6s 0.5s var(--ease) both;
}
.socials a {
  width: 2.8rem;
  height: 2.8rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--muted);
  transition: color .2s ease, border-color .2s ease, transform .2s ease,
              background-color .2s ease, box-shadow .2s ease;
}
.socials a:hover,
.socials a:focus-visible {
  color: rgb(var(--green));
  border-color: var(--g-edge);
  background: rgba(var(--green), 0.1);
  box-shadow: var(--g-glow);
  transform: translateY(-2px);
  outline: none;
}
.socials a:active { transform: translateY(0) scale(0.96); }
.socials svg { width: 1.2rem; height: 1.2rem; display: block; }

/* =========================================================
   Článek (clanek.html)
   ========================================================= */

.hero h1 {
  margin: 0;
  font-size: clamp(1.5rem, 5.5vw, 2.3rem);
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: 0.01em;
}
.hero .meta {
  margin: 1rem 0 0;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.rule {
  height: 1px;
  margin: 2.5rem 0;
  background: linear-gradient(90deg, rgba(var(--green), 0.5), rgba(255, 255, 255, 0.06) 60%, transparent);
  border: 0;
}

article { font-size: 0.95rem; line-height: 1.75; }

article h2 {
  margin: 3rem 0 1rem;
  font-size: clamp(1.15rem, 4vw, 1.4rem);
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: 0.01em;
  padding-left: 0.9rem;
  border-left: 2px solid rgba(var(--green), 0.6);
}

article p { margin: 0 0 1rem; color: var(--body); }

article a {
  color: rgb(var(--green));
  text-decoration: none;
  border-bottom: 1px solid rgba(var(--green), 0.35);
  transition: border-color .2s ease, background-color .2s ease;
}
article a:hover,
article a:focus-visible {
  border-bottom-color: rgb(var(--green));
  background: rgba(var(--green), 0.1);
  outline: none;
}

/* číslované kroky */
ol.steps {
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
  counter-reset: step;
}
ol.steps > li {
  position: relative;
  counter-increment: step;
  padding-left: 2.6rem;
  margin: 0 0 0.85rem;
  color: var(--body);
}
ol.steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.15rem;
  width: 1.7rem;
  height: 1.7rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-size: 0.78rem;
  color: rgb(var(--green));
  background: var(--g-soft);
  border: 1px solid rgba(var(--green), 0.28);
}

/* zvýrazněné bloky */
.callout {
  margin: 0 0 1.5rem;
  padding: 1.1rem 1.2rem;
  border-radius: 0.8rem;
  background: rgba(var(--green), 0.07);
  border: 1px solid rgba(var(--green), 0.25);
  color: var(--body);
  line-height: 1.7;
}
.callout p:last-child { margin-bottom: 0; }
.callout.warn {
  background: rgba(255, 196, 0, 0.07);
  border-color: rgba(255, 196, 0, 0.3);
}

/* bloky s kódem */
.code {
  margin: 0.75rem 0 1.25rem;
  overflow: hidden;
}
.code pre {
  margin: 0;
  /* vpravo gutter pro ikonu — zalomený text do ní nikdy nezasáhne */
  padding: 0.95rem 3.4rem 0.95rem 1rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: inherit;
  font-size: 0.82rem;
  line-height: 1.6;
  color: rgb(var(--green));
}

/* video */
.video {
  display: grid;
  place-items: center;
  gap: 0.6rem;
  aspect-ratio: 16 / 9;
  margin: 0 0 1.25rem;
  border-radius: 0.8rem;
  background: var(--card);
  border: 1px dashed rgba(var(--green), 0.3);
  color: var(--muted);
  font-size: 0.82rem;
  text-align: center;
  padding: 1rem;
  overflow: hidden;
}
.video svg { width: 2rem; height: 2rem; color: rgba(var(--green), 0.6); }
.video iframe { width: 100%; height: 100%; border: 0; display: block; }

/* soubor ke stažení — stejný raster i tlačítko jako bloky s kódem */
.file {
  display: block;
  /* 2.6rem = odsazení obsahu kroku, aby box lícoval s bloky kódu */
  margin: 0.75rem 0 1.25rem 2.6rem;
  padding: 0.95rem 3.4rem 0.95rem 1rem;
  text-decoration: none;
  transition: border-color .2s ease, background-color .2s ease;
}
.file:hover,
.file:focus-visible {
  border-color: rgba(var(--green), 0.3);
  outline: none;
}
.file .n {
  display: block;
  font-size: 0.82rem;
  line-height: 1.6;
  color: rgb(var(--green));
  overflow-wrap: anywhere;
}
.file .s {
  display: block;
  margin-top: 0.1rem;
  font-size: 0.72rem;
  color: var(--muted);
}

/* soubor zatím není nahraný — ať nikdo neklikne do prázdna */
.file.missing { opacity: 0.5; cursor: not-allowed; }
.file.missing .n { color: var(--muted); }
.file.missing:hover { border-color: var(--line); }
.file.missing:hover .dl {
  color: var(--muted);
  border-color: var(--line);
  background: rgba(0, 0, 0, 0.88);
}

/* =========================================================
   Patička a animace
   ========================================================= */

footer {
  margin-top: 3rem;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.25);
  text-align: center;
}
.page-links footer { animation: rise 0.6s 0.55s var(--ease) both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}
