/*
 * Autoradix – vlastné štýly, ktoré sa nedajú zapísať Tailwind triedami
 * (animácie vzoru, písací kurzor, efekty kariet a videa).
 * Farby berie z tokenov v inc/nastavenie.php (var(--color-…)).
 * Prefix bd- ako na motoraster.
 */

html { scroll-behavior: smooth; overflow-x: hidden; }
@supports (overflow: clip) { html, body { overflow-x: clip; } }
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
::selection { background: var(--color-accent); color: var(--color-black); }
section[id] { scroll-margin-top: 88px; }

/* Písací kurzor v hlavnom nadpise */
.bd-caret { display: inline-block; width: .07em; height: .8em; margin-left: .05em; background: var(--color-accent-text); vertical-align: -.03em; animation: bdBlink 1s steps(1) infinite; }
@keyframes bdBlink { 50% { opacity: 0; } }

/* Línie vzoru sa pri načítaní dokreslia */
.bd-draw path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: bdDraw 1.8s cubic-bezier(.65, 0, .35, 1) .2s forwards; }
.bd-draw path:nth-child(2) { animation-delay: .75s; }
.bd-draw path:nth-child(3) { animation-delay: 1.05s; }
@keyframes bdDraw { to { stroke-dashoffset: 0; } }
@keyframes bdRedraw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }

/* Svetlo, ktoré nepretržite prebieha líniou vzoru */
.bd-flow path { stroke-dasharray: .16 .84; animation: bdFlow 6s linear infinite; }
.bd-flow path:nth-child(2) { animation-delay: -2s; }
.bd-flow path:nth-child(3) { animation-delay: -4s; }
.bd-flow-late { opacity: 0; animation: bdFade .8s ease 2.3s forwards; }
@keyframes bdFlow { from { stroke-dashoffset: 0; } to { stroke-dashoffset: -1; } }
@keyframes bdFade { to { opacity: 1; } }

/* Logo AUTORADIX: písmená sa dokreslia jedno po druhom, potom jeden úsek svetla
   prejde postupne od prvého písmena po posledné (A → X), krátka pauza a znova.
   Každé písmeno má svoje okno 0,5 s z cyklu 6,5 s (7,7 %), posunuté o poradie písmena. */
.bd-logo .bd-logo-kresba path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: bdDraw .9s cubic-bezier(.65, 0, .35, 1) forwards; animation-delay: calc(.15s + var(--i, 0) * .11s); }
.bd-logo-tok path { stroke-dasharray: .2 2; stroke-dashoffset: .2; animation: bdLogoTok 6.5s linear infinite; animation-delay: calc(1.8s + var(--i, 0) * .5s); }
@keyframes bdLogoTok { 0% { stroke-dashoffset: .2; } 7.7% { stroke-dashoffset: -1; } 100% { stroke-dashoffset: -1; } }

/* Nástup obsahu v úvode */
.bd-in { animation: bdIn 1s cubic-bezier(.2, .7, .2, 1) both; }
.bd-in-2 { animation-delay: .15s; }
.bd-in-3 { animation-delay: .3s; }
@keyframes bdIn { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

/* Vodorovná línia v sekcii Ako to funguje */
.bd-line {
    background: var(--color-accent) linear-gradient(90deg, rgba(255, 255, 255, 0) 0, rgba(255, 255, 255, .7) 50%, rgba(255, 255, 255, 0) 100%) no-repeat;
    background-size: 240px 100%;
    animation: bdStreak 4.5s linear infinite;
}
@keyframes bdStreak { from { background-position: -240px 0; } to { background-position: calc(100% + 240px) 0; } }

/* Karty: nadvihnutie a znovu dokreslenie ikony */
.bd-card { transition: transform .35s cubic-bezier(.2, .7, .2, 1), box-shadow .35s ease, border-color .35s ease; }
@media (hover: hover) {
    .bd-card:hover { transform: translateY(-6px); box-shadow: 0 24px 48px rgba(30, 36, 32, .14); border-color: var(--color-accent); }
    .bd-card:hover .bd-tile path { animation: bdRedraw .9s cubic-bezier(.65, 0, .35, 1); }
}
.bd-tile path { stroke-dasharray: 1; stroke-dashoffset: 0; }

/* Tlačidlá */
.bd-btn { transition: transform .25s ease, background-color .25s ease, color .25s ease; }
.bd-btn:hover { transform: translateY(-2px); }

/* Podčiarknutie, ktoré sa vysunie (veľký telefón v kontakte) */
.bd-ul { background: linear-gradient(currentColor, currentColor) no-repeat 0 100% / 0% .06em; transition: background-size .5s cubic-bezier(.2, .7, .2, 1); }
.bd-ul:hover { background-size: 100% .06em; }

/* Video */
.bd-pulse { animation: bdPulse 2.6s ease-out infinite; }
@keyframes bdPulse { 0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .55); } 70%, 100% { box-shadow: 0 0 0 22px rgba(255, 255, 255, 0); } }
.bd-video-popis { transition: opacity .35s ease, transform .35s ease; }
.bd-hraje .bd-video-popis { opacity: 0; transform: translateY(10px); pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .bd-caret, .bd-draw path, .bd-flow path, .bd-flow-late, .bd-in, .bd-line, .bd-pulse, .bd-card:hover .bd-tile path, .bd-logo .bd-logo-kresba path { animation: none !important; }
    .bd-draw path, .bd-logo .bd-logo-kresba path { stroke-dashoffset: 0 !important; }
    .bd-logo-tok { display: none; }
    .bd-flow-late { opacity: 1 !important; }
    .bd-card:hover, .bd-btn:hover { transform: none; }
}
