/* Návod Tailwind CSS v4 (/cs/tailwind-css, /tailwind-css) - specifika nad sdíleným publication-guide.css.
   Načítá <PageStyles name="tailwind-css" /> jen na této stránce (obal <main className="pg tw">).
   Komponenty: src/components/pages/(wiki)/tailwindcss/page.tsx, CopyCode.tsx, illustrations.tsx.
   Čisté CSS (mimo Tailwind), třídy s prefixem tw-. */

.tw {
  --twg-mono: ui-monospace, SFMono-Regular, "Cascadia Code", Menlo, Consolas, "Liberation Mono", monospace;
  --twg-code-bg: #0f1f17;
  --twg-code-head: #16291f;
  --twg-code-text: #e6f2eb;
}

/* Neproporcionální písmo v SVG schématu (přebije .pg-svg text { font-family: inherit }) */
.pg-svg text.tw-mono { font-family: var(--twg-mono); }

/* Skrytý text pro čtečky (číslo kroku v nadpisu) */
.tw-vh {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ------------------------------------------------------------------ */
/* Inline kód                                                          */
/* ------------------------------------------------------------------ */

.tw .pg-prose :not(pre) > code,
.tw .pg-table code {
  padding: 0.1em 0.4em;
  border: 1px solid var(--pg-line);
  border-radius: 6px;
  background: #f5f8f6;
  font-family: var(--twg-mono);
  font-size: 0.86em;
  color: var(--pg-ink);
  overflow-wrap: anywhere;
}
.tw .pg-callout :not(pre) > code { background: rgba(255, 255, 255, 0.7); }

/* ------------------------------------------------------------------ */
/* Ukázka kódu s hlavičkou a tlačítkem Kopírovat                        */
/* ------------------------------------------------------------------ */

.tw-code {
  margin: 20px 0 0 !important;
  overflow: hidden;
  border-radius: 14px;
  background: var(--twg-code-bg);
  box-shadow: var(--pg-shadow);
}
.pg-prose > .tw-code { max-width: 860px; }

.tw-code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  padding: 6px 8px 6px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  background: var(--twg-code-head);
}
.tw-code-file,
.tw-code-lang {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--twg-mono);
  font-size: 12.5px;
  color: #9fdcb8;
}
.tw-code-lang {
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7fa892;
}

.tw-code pre {
  margin: 0;
  padding: 16px 18px 18px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  font-family: var(--twg-mono);
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--twg-code-text);
  white-space: pre;
  tab-size: 2;
}
.tw-code pre code { font: inherit; color: inherit; background: none; border: 0; padding: 0; }

.tw-copy {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: transparent;
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  color: #cfe9da;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background-color 0.15s;
}
.tw-copy:hover,
.tw-copy:focus-visible { border-color: var(--pg-accent); color: #fff; outline: none; }
.tw-copy.is-done { border-color: var(--pg-brand); background: var(--pg-brand); color: #fff; }
.tw-copy svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
@media (prefers-reduced-motion: reduce) { .tw-copy { transition: none; } }

/* ------------------------------------------------------------------ */
/* Záložky Express × Next.js (FrameworkTabs.tsx)                        */
/* ------------------------------------------------------------------ */

.tw-tabs { margin-top: 28px !important; }
.tw-tabs-list {
  display: inline-grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 4px;
  width: 100%;
  max-width: 560px;
  padding: 4px;
  border: 1px solid var(--pg-line);
  border-radius: 14px;
  background: var(--pg-soft);
}
.tw-tab {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
  padding: 10px 16px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  font: inherit;
  text-align: left;
  color: var(--pg-muted);
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.tw-tab:hover { color: var(--pg-ink); }
.tw-tab:focus-visible { outline: 2px solid var(--pg-brand); outline-offset: 2px; }
.tw-tab[aria-selected="true"] {
  background: #fff;
  color: var(--pg-ink);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.08), 0 6px 16px rgba(15, 42, 29, 0.08);
}
.tw-tab-title { font-size: 16px; font-weight: 700; line-height: 1.3; }
.tw-tab-note { font-size: 12.5px; line-height: 1.4; color: var(--pg-muted); }
.tw-tab[aria-selected="true"] .tw-tab-note { color: var(--pg-brand-2); }
@media (prefers-reduced-motion: reduce) { .tw-tab { transition: none; } }

/* Obsah panelu navazuje na prózu kapitoly (stejné rozestupy jako .pg-prose > *) */
.tw-tabpanel-body { display: flow-root; }
.tw-tabpanel-body > * + * { margin-top: 16px; }
.tw-tabpanel-body > :first-child { margin-top: 24px !important; }
.tw-tabpanel-body > p,
.tw-tabpanel-body > h3,
.tw-tabpanel-body > ul:not([class]),
.tw-tabpanel-body > ol:not([class]),
.tw-tabpanel-body > .pg-lead-in { max-width: 780px; }
.tw-tabpanel-body > .tw-code { max-width: 860px; }
.tw-tabpanel-body > :first-child:is(h3) { margin-top: 32px !important; }

/* ------------------------------------------------------------------ */
/* Kroky návodu (číslo v kroužku, svislá osa mezi kroky)                */
/* ------------------------------------------------------------------ */

.tw-step {
  position: relative;
  max-width: 860px;
  margin-top: 40px !important;
  padding-left: 54px;
}
.tw-step-n {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  background: var(--pg-brand);
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 0 0 5px rgba(0, 169, 79, 0.12);
}
/* Osa k dalšímu kroku */
.tw-step:has(+ .tw-step)::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 46px;
  bottom: -34px;
  width: 2px;
  border-radius: 2px;
  background: linear-gradient(rgba(0, 169, 79, 0.45), rgba(0, 169, 79, 0.12));
}
.pg-prose .tw-step h3 {
  margin: 0 !important;
  padding-top: 3px;
  font-size: 21px;
  line-height: 1.4;
}
.tw-step-body > p { margin: 10px 0 0; }
.tw-step-body > .tw-code { margin-top: 14px !important; }
.tw-step-after { font-size: 15px; color: var(--pg-muted); }

@media (max-width: 639px) {
  .tw-step { padding-left: 44px; }
  .tw-step-n { width: 30px; height: 30px; font-size: 13px; }
  .tw-step:has(+ .tw-step)::before { left: 14px; top: 40px; }
  .pg-prose .tw-step h3 { padding-top: 1px; font-size: 19px; }
  .tw-code pre { font-size: 12.5px; padding: 14px 14px 16px; }
}
