/* ==========================================================================
   BioHacker Hub — biohacker.is
   ========================================================================== */

:root {
    --bg:          #0a0a0a;
    --cyan:        #22d3ee;
    --cyan-soft:   #67e8f9;
    --magenta:     #e879f9;
    --magenta-hot: #f0abfc;
    --violet:      #a78bfa;
    --emerald:     #34d399;
    --rose:        #fb7185;
    --text:        #f8fafc;
    --muted:       #94a3b8;

    --shell:       min(1200px, 92vw);
    --ease:        cubic-bezier(.22, 1, .36, 1);

    --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
                 "Helvetica Neue", Arial, sans-serif;
    --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
                 "Liberation Mono", "Courier New", monospace;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    min-height: 100svh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }
ul  { list-style: none; margin: 0; padding: 0; }
svg { width: 100%; height: 100%; display: block; }

a { color: inherit; text-decoration: none; }

:focus-visible {
    outline: 2px solid var(--cyan);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ==========================================================================
   Intro splash
   ========================================================================== */

.intro {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    background: var(--bg);
    animation: intro-out .9s var(--ease) 1.9s forwards;
}

.intro__word {
    font-size: clamp(2.5rem, 11vw, 8rem);
    font-weight: 900;
    letter-spacing: -.05em;
    background: linear-gradient(180deg, #fff 0%, #cbd5e1 55%, #64748b 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: intro-in 1.4s var(--ease) both;
}

.intro.is-done { display: none; }

@keyframes intro-in {
    from { opacity: 0; transform: scale(.86); filter: blur(14px); }
    to   { opacity: 1; transform: scale(1);   filter: blur(0); }
}

@keyframes intro-out {
    to { opacity: 0; visibility: hidden; }
}

/* ==========================================================================
   Background layers
   ========================================================================== */

.bg {
    position: fixed;
    inset: 0;
    z-index: 0;
    overflow: hidden;
    pointer-events: none;
}

.bg__image {
    position: absolute;
    inset: 0;
    background-image: url("../images/hero-background.png");
    background-image: image-set(
        url("../images/hero-background.webp") type("image/webp"),
        url("../images/hero-background.png")  type("image/png"));
    background-repeat: no-repeat;
    background-position: center;
    background-size: auto 85%;
    filter: brightness(.8);
    /* Feather the edges so the artwork bleeds into the page instead of
       showing its bounding box. */
    mask-image:
        radial-gradient(ellipse 62% 58% at 50% 46%, #000 42%, transparent 78%);
    -webkit-mask-image:
        radial-gradient(ellipse 62% 58% at 50% 46%, #000 42%, transparent 78%);
}

/* Circuit grid — заоблени клетки, както в оригинала, плюс редки магента вертикали */
.bg__grid {
    position: absolute;
    inset: -12%;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='250' height='200'%3E%3Crect x='6' y='6' width='238' height='188' rx='9' fill='none' stroke='%2322d3ee' stroke-opacity='0.14' stroke-width='1'/%3E%3C/svg%3E"),
        linear-gradient(to right, rgba(232, 121, 249, .11) 1px, transparent 1px);
    background-size: 250px 200px, 750px 100%;
    animation: grid-drift 30s linear infinite;
}

@keyframes grid-drift {
    to { transform: translate3d(250px, 200px, 0); }
}

/* Horizontal scan lines */
.bg__scan {
    position: absolute;
    left: 0;
    width: 100%;
    height: 1px;
    background: linear-gradient(90deg,
        transparent, var(--cyan) 35%, var(--cyan) 65%, transparent);
    opacity: .5;
}

.bg__scan--a { animation: scan 11s linear infinite; }
.bg__scan--b { animation: scan 17s linear infinite 4s; opacity: .3; }

@keyframes scan {
    from { top: -2%; }
    to   { top: 102%; }
}

/* Hexagon clusters */
.hex {
    position: absolute;
    width: clamp(150px, 15vw, 240px);
    aspect-ratio: 1;
}

.hex__svg { overflow: visible; }

.hex__ring {
    fill: none;
    stroke: var(--emerald);
    stroke-opacity: .75;
    stroke-width: 2;
}

.hex__core {
    fill: var(--emerald);
    fill-opacity: .9;
    animation: core-pulse 4.5s ease-in-out infinite;
    transform-origin: 100px 100px;
}

@keyframes core-pulse {
    0%, 100% { transform: scale(1);    fill-opacity: .75; }
    50%      { transform: scale(1.18); fill-opacity: 1; }
}

.hex__satellite {
    fill: none;
    stroke: var(--magenta);
    stroke-opacity: .55;
    stroke-width: 1.5;
    transform-origin: 100px 100px;
    animation: satellite-drift 9s ease-in-out infinite;
    animation-delay: calc(var(--n) * -1.4s);
}

/* Малките шестоъгълници дишат навън-навътре около центъра */
@keyframes satellite-drift {
    0%, 100% { transform: scale(1);    stroke-opacity: .38; }
    50%      { transform: scale(1.09); stroke-opacity: .75; }
}

.hex--tl { top: -4%;    left: -3%; }
.hex--tr { top: -4%;    right: -3%; }
.hex--bl { bottom: 1%;  left: -3%; }
.hex--br { bottom: 1%;  right: -3%; }
/* Почти изцяло извън кадъра долу — в оригинала се подава само горният ръб */
.hex--bc { bottom: -13%; left: 39%; opacity: .45; }

.hex--tr .hex__core,
.hex--bl .hex__core { animation-delay: -2.2s; }

.hex--tr .hex__satellite { animation-direction: reverse; }
.hex--br .hex__satellite { animation-duration: 11s; }

/* DNA helices */
.helix {
    position: absolute;
    width: clamp(46px, 4.4vw, 66px);
    height: clamp(240px, 34vh, 400px);
    overflow: hidden;
    opacity: .85;
    /* Краищата избледняват, за да не се вижда рязък отрез */
    mask-image: linear-gradient(180deg, transparent, #000 14%, #000 86%, transparent);
    -webkit-mask-image: linear-gradient(180deg, transparent, #000 14%, #000 86%, transparent);
}

/* SVG-то съдържа два периода; преместването с точно 50% зацикля безшевно
   и изглежда като въртяща се спирала. */
.helix__svg {
    width: 100%;
    height: auto;
    animation: helix-flow 12s linear infinite;
}

@keyframes helix-flow {
    from { transform: translateY(0); }
    to   { transform: translateY(-50%); }
}

.helix__rung {
    stroke: var(--emerald);
    stroke-opacity: .5;
    stroke-width: 1.6;
}

.helix__node--cyan    { fill: var(--cyan); }
.helix__node--magenta { fill: #c026d3; }

/* Позициите повтарят оригинала: две по краищата, една горе-вдясно от центъра
   и една долу-вляво, която минава зад картите — без да опира текста. */
.helix--a { left: 3.5%;  top: 20%; }
.helix--b { right: 3%;   top: 34%; }
.helix--c { left: 23%;   top: 66%; }
.helix--d { right: 25%;  top: 1%; }

.helix--b .helix__svg { animation-duration: 15s; animation-direction: reverse; }
.helix--c .helix__svg { animation-duration: 18s; }
.helix--d .helix__svg { animation-duration: 14s; animation-direction: reverse; }

/* Floating molecule labels */
.molecules { position: absolute; inset: 0; }

.molecule {
    position: absolute;
    font-family: var(--font-mono);
    font-size: .8rem;
    letter-spacing: .08em;
    color: rgba(103, 232, 249, .30);
    top: calc(6% + (var(--i) * 7.4%));
    left: calc(4% + (var(--i) * 7.6%));
    animation: float 14s ease-in-out infinite;
    animation-delay: calc(var(--i) * -1.1s);
}

.molecule:nth-child(even) {
    color: rgba(232, 121, 249, .26);
    left: auto;
    right: calc(3% + (var(--i) * 6.2%));
}

@keyframes float {
    0%, 100% { transform: translateY(0)     rotate(0deg);   opacity: .25; }
    50%      { transform: translateY(-28px) rotate(6deg);   opacity: .7;  }
}

/* ==========================================================================
   Page shell
   ========================================================================== */

.page {
    position: relative;
    z-index: 1;
    width: var(--shell);
    margin-inline: auto;
    padding-block: clamp(2rem, 6vh, 5rem) clamp(3rem, 8vh, 6rem);
    display: flex;
    flex-direction: column;
    gap: clamp(2.5rem, 7vh, 5rem);
}

/* ==========================================================================
   Hero
   ========================================================================== */

.hero { text-align: center; }

.hero__name {
    margin: 0;
    font-size: clamp(3.2rem, 12vw, 9rem);
    font-weight: 900;
    letter-spacing: -.05em;
    line-height: .95;
    background: linear-gradient(180deg, #fff 0%, #e2e8f0 45%, #64748b 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    filter: drop-shadow(0 0 34px rgba(148, 163, 184, .35));
}

.hero__line {
    margin: clamp(.6rem, 2vh, 1.4rem) 0 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(.35rem, 1.4vh, .9rem);
}

.hero__small {
    font-size: clamp(.8rem, 2.2vw, 1.4rem);
    font-weight: 600;
    letter-spacing: .5em;
    text-indent: .5em;
    color: #cbd5e1;
}

.hero__word {
    position: relative;
    font-size: clamp(1.9rem, 6.6vw, 4.4rem);
    font-weight: 900;
    letter-spacing: .06em;
}

/* Neon duplicate layer behind the text */
.hero__word::before {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    filter: blur(18px);
    opacity: .85;
    z-index: -1;
}

.hero__word--hacker,
.hero__word--hacker::before { color: var(--magenta-hot); }

.hero__word--bio,
.hero__word--bio::before { color: var(--cyan-soft); }

.hero__word--hacker { text-shadow: 0 0 26px rgba(232, 121, 249, .75); }
.hero__word--bio    { text-shadow: 0 0 26px rgba(34, 211, 238, .75); }

/* Trait marquee */
.traits {
    margin-top: clamp(1.5rem, 4vh, 3rem);
    overflow: hidden;
    mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 12%, #000 88%, transparent);
}

.traits__track {
    display: flex;
    gap: clamp(1.5rem, 4vw, 3.5rem);
    width: max-content;
    animation: marquee 34s linear infinite;
}

@keyframes marquee {
    to { transform: translateX(-50%); }
}

.trait {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .55rem;
    min-width: 84px;
}

.trait__icon {
    width: 46px;
    height: 46px;
    padding: 11px;
    border: 1px solid rgba(148, 163, 184, .35);
    border-radius: 12px;
    color: var(--text);
    background: rgba(15, 23, 42, .45);
    backdrop-filter: blur(4px);
}

.trait__label {
    font-family: var(--font-mono);
    font-size: .68rem;
    letter-spacing: .18em;
    color: var(--muted);
}

/* ==========================================================================
   Ecosystem
   ========================================================================== */

.ecosystem { text-align: center; }

.ecosystem__title {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .5em;
    margin: 0 0 clamp(1.5rem, 4vh, 2.75rem);
    padding: .7em 1.4em;
    font-size: clamp(1.05rem, 3.4vw, 1.9rem);
    font-weight: 900;
    letter-spacing: .12em;
    border: 1px solid rgba(34, 211, 238, .35);
    border-radius: 14px;
    background: rgba(8, 47, 73, .28);
    box-shadow: 0 0 40px rgba(34, 211, 238, .18), inset 0 0 30px rgba(34, 211, 238, .07);
    backdrop-filter: blur(6px);
}

.ecosystem__title-a { color: var(--cyan-soft); }
.ecosystem__title-b { color: var(--emerald); }

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
    gap: clamp(1rem, 2.2vw, 1.6rem);
}

.card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .55rem;
    height: 100%;
    padding: 1.9rem 1.15rem 3.4rem;
    border: 1px solid rgba(148, 163, 184, .22);
    border-radius: 16px;
    background: rgba(2, 6, 23, .62);
    backdrop-filter: blur(8px);
    transition: transform .35s var(--ease), border-color .35s var(--ease),
                box-shadow .35s var(--ease);
}

.card:hover,
.card:focus-visible {
    transform: translateY(-6px);
    border-color: var(--accent, var(--cyan));
    box-shadow: 0 18px 44px -18px var(--accent, var(--cyan)),
                0 0 34px -14px var(--accent, var(--cyan));
}

.card--cyan    { --accent: var(--cyan); }
.card--violet  { --accent: var(--violet); }
.card--rose    { --accent: var(--rose); }
.card--emerald { --accent: var(--emerald); }

.card__media {
    display: grid;
    place-items: center;
    width: 100%;
    height: 74px;
    margin-bottom: .4rem;
    overflow: hidden;
}

.card__media picture { display: block; width: 100%; }

.card__media img {
    width: 100%;
    height: 74px;
    object-fit: contain;
    object-position: center;
}

.card__icon {
    width: 52px;
    height: 52px;
    padding: 11px;
    border: 1px solid color-mix(in srgb, var(--accent, var(--cyan)) 45%, transparent);
    border-radius: 13px;
    color: var(--accent, var(--cyan));
    background: color-mix(in srgb, var(--accent, var(--cyan)) 10%, transparent);
}

.card__title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
}

.card__desc {
    margin: 0;
    font-size: .88rem;
    color: var(--muted);
}

.card__go {
    position: absolute;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    padding: 8px;
    border: 1px solid rgba(148, 163, 184, .3);
    border-radius: 50%;
    color: var(--accent, var(--cyan));
    transition: border-color .3s var(--ease), background-color .3s var(--ease);
}

.card:hover .card__go {
    border-color: var(--accent, var(--cyan));
    background: color-mix(in srgb, var(--accent, var(--cyan)) 14%, transparent);
}

/* ==========================================================================
   Contact / footer
   ========================================================================== */

.contact {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.4rem;
    text-align: center;
}

.contact__mail {
    display: inline-flex;
    align-items: center;
    gap: .7rem;
    font-family: var(--font-mono);
    font-size: clamp(.95rem, 2.6vw, 1.3rem);
    letter-spacing: .04em;
    color: var(--cyan-soft);
    transition: color .3s var(--ease), text-shadow .3s var(--ease);
}

.contact__mail:hover {
    color: #fff;
    text-shadow: 0 0 18px rgba(34, 211, 238, .8);
}

.contact__mail-icon { width: 26px; height: 26px; color: var(--cyan); }

.social { display: flex; gap: 1rem; }

.social__link {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    padding: 13px;
    border: 1px solid rgba(148, 163, 184, .3);
    border-radius: 50%;
    background: rgba(15, 23, 42, .55);
    color: var(--text);
    transition: transform .3s var(--ease), border-color .3s var(--ease),
                color .3s var(--ease), box-shadow .3s var(--ease);
}

.social__link:hover {
    transform: translateY(-3px);
    border-color: var(--cyan);
    color: var(--cyan-soft);
    box-shadow: 0 0 24px -6px var(--cyan);
}

.tagline {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: .6rem;
    margin: .6rem 0 0;
    font-family: var(--font-mono);
    font-size: clamp(.85rem, 2.8vw, 1.45rem);
    color: var(--cyan-soft);
    text-shadow: 0 0 22px rgba(34, 211, 238, .45);
}

.tagline sup { font-size: .5em; }

.tagline__spark { animation: twinkle 2.6s ease-in-out infinite; }
.tagline__spark:last-child { animation-delay: -1.3s; }

@keyframes twinkle {
    0%, 100% { opacity: .35; transform: scale(.85); }
    50%      { opacity: 1;   transform: scale(1.15); }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 640px) {
    /* Изображението е квадратно: "cover" отрязваше лицето отстрани, затова го
       побираме по ширината на екрана и го вдигаме към заглавието. */
    .bg__image {
        background-size: 100% auto;
        background-position: center 18%;
        opacity: .8;
        mask-image:
            radial-gradient(ellipse 74% 30% at 50% 33%, #000 45%, transparent 80%);
        -webkit-mask-image:
            radial-gradient(ellipse 74% 30% at 50% 33%, #000 45%, transparent 80%);
    }

    .bg__grid { background-size: 150px 130px, 400px 100%; }
    .hex      { width: 130px; }
    .hex--bc  { display: none; }

    /* На тесен екран остават само крайните спирали, за да не се блъскат в текста */
    .helix--c,
    .helix--d { display: none; }
    .helix    { width: 34px; opacity: .5; }

    /* Картите в мрежа 2х2 вместо една под друга */
    .cards { grid-template-columns: repeat(2, 1fr); gap: .75rem; }

    .card        { padding: 1.15rem .7rem 3rem; gap: .35rem; }
    .card__media { height: 56px; }
    .card__media img { height: 56px; }
    .card__icon  { width: 44px; height: 44px; padding: 9px; }
    .card__title { font-size: .95rem; }
    .card__desc  { font-size: .74rem; line-height: 1.35; }
    .card__go    { bottom: .95rem; width: 30px; height: 30px; padding: 7px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
    .intro { display: none; }
}
