:root {
    --olympic-blue: #0081C8;
    --olympic-blue-dark: #0066a1;
    --olympic-yellow: #FCB131;
    --olympic-green: #00A651;
    --olympic-red: #EE334E;
    --ink: #1a1a2e;
    --muted: #6b7280;
    --glass-bg: rgba(255, 255, 255, 0.72);
    --glass-border: rgba(255, 255, 255, 0.3);
    --radius: 20px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #e4e8ec 100%);
    background-attachment: fixed;
    min-height: 100vh;
    color: var(--ink);
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    padding: 2.5rem 1rem 0;
}

/* ---------- Animated background ---------- */
.bg-blobs {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.45;
    animation: float 20s ease-in-out infinite;
}

.blob-1 {
    width: 600px;
    height: 600px;
    background: linear-gradient(135deg, var(--olympic-blue) 0%, var(--olympic-green) 100%);
    top: -220px;
    left: -200px;
}

.blob-2 {
    width: 500px;
    height: 500px;
    background: linear-gradient(135deg, var(--olympic-yellow) 0%, var(--olympic-red) 100%);
    bottom: -180px;
    right: -160px;
    animation-delay: -5s;
}

.blob-3 {
    width: 420px;
    height: 420px;
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    animation-delay: -10s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -30px) scale(1.05); }
    50% { transform: translate(-20px, 20px) scale(0.95); }
    75% { transform: translate(20px, 30px) scale(1.02); }
}

/* ---------- Layout ---------- */
.container {
    width: 100%;
    max-width: 1080px;
    margin: 0 auto;
    flex: 1;
}

.header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.header-logo {
    height: 62px;
    width: auto;
    margin-bottom: 1.5rem;
}

.header h1 {
    font-size: clamp(2rem, 5vw, 2.75rem);
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--muted);
    font-size: 1.0625rem;
    max-width: 34rem;
    margin: 0 auto;
}

/* ---------- Search ---------- */
.search {
    position: relative;
    max-width: 24rem;
    margin: 2rem auto 0;
}

.search__icon {
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--muted);
    pointer-events: none;
}

.search input {
    width: 100%;
    padding: 0.875rem 1rem 0.875rem 2.875rem;
    font-size: 0.9375rem;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.75);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.05);
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search input::placeholder { color: #9ca3af; }

.search input:focus {
    border-color: rgba(0, 129, 200, 0.5);
    box-shadow: 0 0 0 4px rgba(0, 129, 200, 0.12);
}

.search input::-webkit-search-cancel-button { cursor: pointer; }

/* ---------- Grid ---------- */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
    gap: 1.25rem;
}

.card {
    position: relative;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.02);
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), box-shadow 0.4s;
}

.card::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: var(--accent-gradient);
    opacity: 0;
    transition: opacity 0.3s;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.02);
}

.card:hover::before { opacity: 1; }

.card__link {
    display: block;
    padding: 1.5rem;
    text-decoration: none;
    color: inherit;
    outline: none;
}

.card__link:focus-visible {
    box-shadow: inset 0 0 0 2px var(--accent);
    border-radius: var(--radius);
}

.card__icon {
    width: 52px;
    height: 52px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    background: var(--accent-gradient);
    box-shadow: 0 6px 16px var(--accent-shadow);
    margin-bottom: 1.125rem;
}

.card__icon svg { width: 26px; height: 26px; }

.card__head {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.375rem;
}

.card__title {
    font-size: 1.1875rem;
    font-weight: 700;
}

.card__badge {
    padding: 0.1875rem 0.5625rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #9a6400;
    background: rgba(252, 177, 49, 0.18);
    border: 1px solid rgba(252, 177, 49, 0.35);
    border-radius: 999px;
    white-space: nowrap;
}

.card__desc {
    color: var(--muted);
    font-size: 0.9063rem;
    line-height: 1.5;
    margin-bottom: 1.125rem;
    min-height: 2.7em;
}

.card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding-top: 0.9375rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

.card__domain {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.card__arrow {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--accent);
    flex-shrink: 0;
    transition: gap 0.25s;
}

.card__arrow svg { width: 15px; height: 15px; }

.card:hover .card__arrow { gap: 0.5rem; }

/* QR button sits above the card link */
.card__qr {
    position: absolute;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 2;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 11px;
    color: var(--muted);
    cursor: pointer;
    transition: color 0.2s, background 0.2s, transform 0.2s;
}

.card__qr svg { width: 17px; height: 17px; }

.card__qr:hover {
    color: var(--accent);
    background: #fff;
    transform: scale(1.06);
}

.card__qr:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.empty {
    text-align: center;
    color: var(--muted);
    padding: 3rem 1rem;
    font-size: 0.9375rem;
}

/* ---------- Byline (tetify) ---------- */
.byline {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1.125rem;
    padding: 0.4375rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--muted);
    text-decoration: none;
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid var(--glass-border);
    border-radius: 999px;
    transition: background 0.25s, transform 0.25s, box-shadow 0.25s;
}

.byline img {
    height: 13px;
    width: auto;
    transform: translateY(0.5px);
}

.byline:hover {
    background: #fff;
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.07);
}

/* ---------- Footer ---------- */
.footer {
    margin-top: auto;
    padding: 2rem 1rem 2.5rem;
    text-align: center;
}

.footer-inner {
    display: inline-flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
}

.footer-logo {
    height: 32px;
    width: auto;
}

.footer-divider {
    width: 1px;
    height: 24px;
    background: #e5e7eb;
}

.footer p {
    margin: 0;
    color: var(--muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.footer-link {
    color: var(--olympic-green);
    text-decoration: none;
    font-weight: 700;
    transition: all 0.3s ease;
}

.footer-link:hover { text-decoration: underline; }

/* ---------- Buttons ---------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8125rem 1.25rem;
    font-size: 0.9375rem;
    font-weight: 600;
    border: none;
    border-radius: 13px;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
}

.btn svg { width: 18px; height: 18px; }

.btn-primary {
    width: 100%;
    color: #fff;
    background: linear-gradient(135deg, var(--olympic-blue) 0%, var(--olympic-blue-dark) 100%);
    box-shadow: 0 8px 20px rgba(0, 129, 200, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    filter: brightness(1.05);
}

/* ---------- QR modal ---------- */
.modal {
    position: fixed;
    inset: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

.modal[hidden] { display: none; }

.modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(26, 26, 46, 0.45);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: fade 0.2s ease;
}

.modal__card {
    position: relative;
    width: 100%;
    max-width: 21rem;
    padding: 2rem 1.75rem 1.75rem;
    text-align: center;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.25);
    animation: pop 0.28s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal__close {
    position: absolute;
    top: 0.875rem;
    right: 0.875rem;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--muted);
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.modal__close svg { width: 18px; height: 18px; }
.modal__close:hover { background: #f3f4f6; color: var(--ink); }

.modal__title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.modal__url {
    font-size: 0.8438rem;
    color: var(--muted);
    margin-bottom: 1.5rem;
    word-break: break-all;
}

.qr {
    display: flex;
    justify-content: center;
    padding: 1rem;
    background: #fff;
    border: 1px solid rgba(0, 0, 0, 0.07);
    border-radius: 18px;
    margin-bottom: 1.5rem;
}

.qr img, .qr canvas { display: block; width: 208px; height: 208px; }

@keyframes fade { from { opacity: 0; } }

@keyframes pop {
    from { opacity: 0; transform: translateY(12px) scale(0.96); }
}

/* ---------- Responsive & motion ---------- */
@media (max-width: 640px) {
    body { padding-top: 1.75rem; }
    .header-logo { height: 50px; }
    .grid { grid-template-columns: 1fr; }
    .card__desc { min-height: 0; }
}

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