/* InevitableClips™ — shared styles */

@font-face {
    font-family: 'Anton';
    src: url('/assets/fonts/anton-latin.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

:root {
    --red: #ff3333;
    --red-deep: #c4141a;
    --red-glow: rgba(255, 51, 51, 0.45);
    --bg: #0a0a0c;
    --surface: rgba(255, 255, 255, 0.07);
    --surface-hover: rgba(255, 255, 255, 0.11);
    --border: rgba(255, 255, 255, 0.14);
    --text: #ffffff;
    --text-dim: rgba(255, 255, 255, 0.72);
    --text-faint: rgba(255, 255, 255, 0.58);
    --radius: 14px;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-display: 'Anton', Impact, 'Arial Narrow Bold', sans-serif;
}

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

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

body {
    font-family: var(--font-body);
    background-color: var(--bg);
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    overflow-x: hidden;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

/* Fixed backdrop on its own layer: works on iOS and keeps scrolling smooth.
   Full, sharp logo behind a dark overlay, matching the original look. */
.backdrop {
    position: fixed;
    inset: 0;
    z-index: -2;
    background: var(--bg) url('/assets/bg-logo.webp') center / cover no-repeat;
}

.backdrop::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 50% 0%, rgba(255, 51, 51, 0.12), transparent 70%),
        linear-gradient(180deg, rgba(10, 10, 12, 0.72) 0%, rgba(10, 10, 12, 0.85) 100%);
}

/* Slow-drifting ember glow */
.embers {
    position: fixed;
    inset: -20%;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(circle at 20% 80%, rgba(255, 51, 51, 0.16), transparent 35%),
        radial-gradient(circle at 85% 30%, rgba(196, 20, 26, 0.14), transparent 30%);
    animation: drift 18s ease-in-out infinite alternate;
}

.container {
    position: relative;
    text-align: center;
    padding: 3rem 1.25rem 2.5rem;
    max-width: 520px;
    width: 100%;
}

/* Entrance animation, staggered via --i */
.reveal {
    opacity: 0;
    animation: rise 0.7s var(--ease) forwards;
    animation-delay: calc(var(--i, 0) * 70ms);
}

/* ---------- Header ---------- */

.share-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text);
    cursor: pointer;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s var(--ease);
}

.share-btn svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.share-btn:hover,
.share-btn:focus-visible {
    background: var(--red);
    border-color: var(--red);
    transform: scale(1.06);
}

.avatar-wrap {
    position: relative;
    width: 132px;
    height: 132px;
    margin: 0 auto 1.4rem;
    border-radius: 50%;
}

/* Spinning red ring behind the logo */
.avatar-wrap::before {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--red), transparent 30%, var(--red-deep) 50%, transparent 80%, var(--red));
    animation: spin 6s linear infinite;
}

.avatar-wrap::after {
    content: '';
    position: absolute;
    inset: -18px;
    border-radius: 50%;
    background: radial-gradient(circle, var(--red-glow), transparent 65%);
    z-index: -1;
    animation: pulse 3.2s ease-in-out infinite;
}

.logo {
    position: relative;
    z-index: 1;
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--bg);
    background: var(--bg);
}

h1,
.display {
    font-family: var(--font-display);
    font-weight: 400;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    line-height: 1.05;
}

h1 {
    font-size: clamp(2.1rem, 9vw, 2.9rem);
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 18px rgba(0, 0, 0, 0.7);
}

h1 .accent {
    color: var(--red);
    text-shadow: 0 0 24px rgba(255, 51, 51, 0.55);
}

h1 sup {
    font-family: var(--font-body);
    font-size: 0.32em;
    vertical-align: top;
    position: relative;
    top: 0.35em;
    margin-left: 0.1em;
    color: var(--text-faint);
}

.chips {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.9rem;
}

.chip {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.3rem 0.65rem;
    border-radius: 999px;
    background: rgba(255, 51, 51, 0.12);
    border: 1px solid rgba(255, 51, 51, 0.35);
    color: #ffd6d6;
}

.tagline {
    color: var(--text-dim);
    font-size: 1rem;
    max-width: 30ch;
    margin: 0 auto 2.25rem;
}

/* ---------- Link groups ---------- */

.links-group + .links-group {
    margin-top: 2.25rem;
}

.group-title {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--text-faint);
    margin-bottom: 0.9rem;
}

.group-title::before,
.group-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18));
}

.group-title::after {
    background: linear-gradient(270deg, transparent, rgba(255, 255, 255, 0.18));
}

.group-sub {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin: -0.4rem 0 0.9rem;
}

.links-stack {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

/* ---------- Buttons ---------- */

.btn {
    --mx: 50%;
    --my: 50%;
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    width: 100%;
    background: var(--surface);
    border: 1px solid var(--border);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    color: var(--text);
    padding: 0.85rem 1rem;
    border-radius: var(--radius);
    text-decoration: none;
    text-align: left;
    font: inherit;
    font-size: 1.02rem;
    font-weight: 600;
    cursor: pointer;
    overflow: hidden;
    isolation: isolate;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.35);
    transition: transform 0.35s var(--ease), border-color 0.25s ease, box-shadow 0.35s var(--ease), background 0.25s ease;
}

/* Pointer-following spotlight */
.btn::before {
    content: '';
    position: absolute;
    inset: 0;
    z-index: -1;
    background: radial-gradient(220px circle at var(--mx) var(--my), rgba(255, 51, 51, 0.28), transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.btn:hover,
.btn:focus-visible {
    transform: translateY(-3px);
    border-color: rgba(255, 51, 51, 0.75);
    background: var(--surface-hover);
    box-shadow: 0 10px 30px rgba(255, 51, 51, 0.28), 0 4px 24px rgba(0, 0, 0, 0.4);
}

.btn:hover::before,
.btn:focus-visible::before {
    opacity: 1;
}

.btn:active {
    transform: translateY(-1px) scale(0.99);
}

.btn:focus-visible,
.creator:focus-visible,
.back:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 3px;
}

.btn-icon {
    flex-shrink: 0;
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 11px;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: background 0.25s ease, border-color 0.25s ease;
}

.btn-icon svg {
    width: 21px;
    height: 21px;
    fill: currentColor;
}

.btn-icon svg.stroke {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.btn:hover .btn-icon,
.btn:focus-visible .btn-icon {
    background: var(--red);
    border-color: var(--red);
}

.btn-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.btn-label {
    line-height: 1.25;
}

.btn-meta {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-faint);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.btn-arrow {
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    fill: none;
    stroke: var(--text-faint);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform 0.3s var(--ease), stroke 0.25s ease;
}

.btn:hover .btn-arrow,
.btn:focus-visible .btn-arrow {
    stroke: #ffffff;
    transform: translateX(3px);
}

/* Featured (primary) button */
.btn.featured {
    background: linear-gradient(135deg, rgba(255, 51, 51, 0.22), rgba(196, 20, 26, 0.08));
    border-color: rgba(255, 51, 51, 0.5);
}

.btn.featured .btn-icon {
    background: var(--red);
    border-color: var(--red);
}

/* Solid red call-to-action */
.btn.solid {
    justify-content: center;
    text-align: center;
    background: linear-gradient(135deg, var(--red), var(--red-deep));
    border-color: var(--red);
}

.btn.solid:hover,
.btn.solid:focus-visible {
    background: linear-gradient(135deg, #ff4d4d, var(--red));
}

/* ---------- Clip submission ---------- */

.section-desc {
    color: var(--text-dim);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.submit-panel > summary {
    list-style: none;
}

.submit-panel > summary::-webkit-details-marker {
    display: none;
}

.submit-panel .btn-arrow,
.submit-panel .btn:hover .btn-arrow,
.submit-panel .btn:focus-visible .btn-arrow {
    transform: rotate(90deg);
}

.submit-panel[open] .btn-arrow,
.submit-panel[open] .btn:hover .btn-arrow,
.submit-panel[open] .btn:focus-visible .btn-arrow {
    transform: rotate(-90deg);
}

.submit-panel[open] > summary {
    border-color: rgba(255, 51, 51, 0.75);
}

.clip-form {
    margin-top: 0.8rem;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    background: rgba(18, 18, 22, 0.72);
    border: 1px solid var(--border);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-radius: var(--radius);
    padding: 1.35rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
    animation: rise 0.45s var(--ease);
}

.field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

@media (max-width: 440px) {
    .field-row {
        grid-template-columns: 1fr;
    }
}

.clip-form label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.85);
    margin-bottom: 0.4rem;
}

.clip-form input[type="text"],
.clip-form input[type="email"],
.clip-form input[type="url"],
.clip-form textarea {
    width: 100%;
    font: inherit;
    font-size: 1rem; /* 16px avoids iOS zoom-on-focus */
    color: #ffffff;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    padding: 0.75rem 0.85rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.clip-form textarea {
    min-height: 96px;
    resize: vertical;
}

.clip-form input:focus,
.clip-form textarea:focus {
    outline: none;
    border-color: var(--red);
    box-shadow: 0 0 0 3px rgba(255, 51, 51, 0.25);
}

.clip-form input:user-invalid,
.clip-form textarea:user-invalid {
    border-color: #ff8080;
}

.clip-form ::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.optional {
    font-weight: 400;
    color: var(--text-faint);
}

.clip-form .btn {
    margin-top: 0.25rem;
}

.clip-form button:disabled {
    opacity: 0.65;
    cursor: wait;
    transform: none;
}

.form-note {
    font-size: 0.78rem;
    color: var(--text-faint);
    text-align: center;
}

.form-status {
    font-size: 0.92rem;
    text-align: center;
    min-height: 1.2em;
}

.form-status.error {
    color: #ff9a9a;
}

.form-success {
    text-align: center;
    padding: 0.75rem 0.25rem;
}

.form-success .check {
    width: 56px;
    height: 56px;
    margin: 0 auto 0.75rem;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--red);
    box-shadow: 0 0 30px var(--red-glow);
    animation: pop 0.5s var(--ease);
}

.form-success .check svg {
    width: 28px;
    height: 28px;
    fill: none;
    stroke: #fff;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.form-success h3 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.5rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    margin-bottom: 0.3rem;
}

.form-success p {
    color: var(--text-dim);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.link-btn {
    background: none;
    border: none;
    color: var(--red);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.hidden-field,
[hidden] {
    display: none !important;
}

/* ---------- Creators page ---------- */

.back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--text-dim);
    text-decoration: none;
    font-size: 0.9rem;
    margin-bottom: 1.75rem;
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    background: var(--surface);
    border: 1px solid var(--border);
    transition: color 0.2s ease, border-color 0.2s ease;
}

.back:hover,
.back:focus-visible {
    color: #ffffff;
    border-color: var(--red);
}

.creators {
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.creator .avatar {
    flex-shrink: 0;
    width: 52px;
    height: 52px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-size: 1.4rem;
    color: #fff;
    background: linear-gradient(135deg, var(--red), #5a0b0e);
    border: 2px solid rgba(255, 255, 255, 0.15);
}

.creator .avatar svg {
    width: 24px;
    height: 24px;
    fill: currentColor;
}

.badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
    background: var(--red);
    color: #fff;
    margin-left: 0.4rem;
    vertical-align: 2px;
}

.creator.open {
    background: rgba(255, 255, 255, 0.025);
    border-style: dashed;
    border-color: rgba(255, 255, 255, 0.28);
    box-shadow: none;
}

.creator.open .avatar {
    background: rgba(0, 0, 0, 0.35);
    border: 1px dashed rgba(255, 255, 255, 0.3);
    color: var(--text-dim);
}

.creator.open:hover .avatar,
.creator.open:focus-visible .avatar {
    color: #fff;
    background: var(--red);
    border-color: var(--red);
}

/* ---------- 404 ---------- */

.big-code {
    font-family: var(--font-display);
    font-size: clamp(6rem, 30vw, 9rem);
    line-height: 1;
    color: transparent;
    -webkit-text-stroke: 2px var(--red);
    text-shadow: 0 0 40px rgba(255, 51, 51, 0.35);
    margin-bottom: 0.5rem;
}

/* ---------- Footer & toast ---------- */

footer {
    margin-top: 2.75rem;
    font-size: 0.8rem;
    color: var(--text-faint);
}

.disclaimer {
    margin-top: 0.5rem;
    font-size: 0.72rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.55);
    max-width: 44ch;
    margin-left: auto;
    margin-right: auto;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 1.5rem;
    transform: translate(-50%, 150%);
    background: #17171b;
    border: 1px solid rgba(255, 51, 51, 0.5);
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.7rem 1.1rem;
    border-radius: 999px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: transform 0.4s var(--ease), opacity 0.3s ease, visibility 0.4s;
    z-index: 10;
}

.toast.show {
    transform: translate(-50%, 0);
    opacity: 1;
    visibility: visible;
}

/* ---------- Keyframes ---------- */

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

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@keyframes pulse {
    0%, 100% {
        opacity: 0.55;
        transform: scale(0.96);
    }
    50% {
        opacity: 1;
        transform: scale(1.04);
    }
}

@keyframes drift {
    to {
        transform: translate(4%, -3%) scale(1.08);
    }
}

@keyframes pop {
    from {
        transform: scale(0.4);
        opacity: 0;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

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

    .btn:hover,
    .btn:focus-visible {
        transform: none;
    }
}

.creator .btn-meta {
    white-space: normal;
}
