/* Mobile first. Dark, soft and layered: one rose accent on a violet-tinted near-black.
   Type is Plus Jakarta Sans at 400–700 only; heavier weights blur on small, dense screens.
   Contrast (WCAG AA, 4.5:1 for text): white on --primary, --primary-text, --muted and --danger on --bg/--surface.
   Saturated --primary is for fills and focus rings; pink text uses --primary-text.
   --danger is a true red, kept apart from the pink so field errors never read as accent. */

:root {
    color-scheme: dark;
    --primary: #d6195a;
    --primary-hover: #c01450;
    --primary-text: #ff8fb0;
    --primary-soft: color-mix(in srgb, var(--primary) 16%, transparent);
    --danger: #ff6a5c;
    --danger-soft: color-mix(in srgb, var(--danger) 14%, transparent);
    --bg: #0c0b0f;
    --surface: #16141b;
    --surface-hover: #1e1b24;
    /* Fields have no borders: a translucent fill sets them apart on any background */
    --field: rgb(255 255 255 / 0.06);
    --field-focus: rgb(255 255 255 / 0.1);
    --text: #f5f2f7;
    --muted: #a8a1b0;
    --overlay: color-mix(in srgb, var(--bg) 72%, transparent);
    --glass: color-mix(in srgb, var(--bg) 78%, transparent);
    --shadow: 0 12px 32px -16px rgb(0 0 0 / 0.7);
    --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
    --radius: 8px;
    --radius-sm: 6px;
    --radius-xs: 4px;
    --radius-lg: 14px;
    --font-small: 14px;
    --narrow: 600px;
    --gutter: 20px;
    --bottom-nav-height: 64px;
}

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

html {
    -webkit-text-size-adjust: 100%;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    margin: 0;
    /* A faint rose glow behind the top of every page gives the dark background some depth */
    background:
        radial-gradient(120% 480px at 50% -160px, color-mix(in srgb, var(--primary) 13%, transparent), transparent 70%)
        no-repeat,
        var(--bg);
    color: var(--text);
    font-family: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 16px;
    font-weight: 400;
    line-height: 1.6;

    padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
}

h1, h2, h3 {
    line-height: 1.2;
    margin: 0 0 12px;
    font-weight: 700;
    text-wrap: balance;
}

h1 { font-size: 28px; letter-spacing: -0.025em; margin-bottom: 16px; }
h2 { font-size: 22px; letter-spacing: -0.02em; }
h3 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }

@media (min-width: 700px) {
    h1 { font-size: 34px; }
    h2 { font-size: 24px; }
}

p { margin: 0 0 16px; }

b, strong { font-weight: 600; }

a { color: var(--text); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--primary-text); }

::selection { background: var(--primary); color: #fff; }

:focus-visible { outline: 2px solid var(--primary-text); outline-offset: 3px; }

img, video { max-width: 100%; display: block; }

/* Class names follow BEM: .block, .block__element, .block--modifier (states too, e.g. .nav__link--active).
   Utilities (.muted, .small, .center, .hidden, .visually-hidden) and long prose (.legal) are the only exceptions. */

.muted { color: var(--muted); }
.small { font-size: var(--font-small); }
.center { text-align: center; }
.hidden { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }

/* Header and navigation */

/* Small screens navigate with the bottom nav; the header only shows from 900px.
   Both bars are frosted glass so content scrolls softly underneath. */
.site-header {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 16px;
    padding: 12px var(--gutter);
    position: sticky;
    top: 0;
    z-index: 20;
}

.nav--top { display: none; }

.nav--bottom {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    height: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
}

.site-header,
.nav--bottom {
    background: var(--glass);
    -webkit-backdrop-filter: blur(18px) saturate(1.4);
    backdrop-filter: blur(18px) saturate(1.4);
}

.nav__link {
    position: relative;
    color: var(--muted);
    font-weight: 500;
    text-decoration: none;
    transition: color 0.2s var(--ease);
}

.nav__link:hover,
.nav__link--active { color: var(--text); }

.nav--bottom .nav__link {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-size: 13px;
    line-height: 1.2;
    padding: 0 4px;
    -webkit-tap-highlight-color: transparent;
}

/* Active tab: a short fully rounded bar, centered near the edge that faces the content.
   Same mark on both bars: at the top of the bottom nav, at the bottom of the header. */
.nav__link--active::before {
    content: "";
    position: absolute;
    left: 50%;
    width: 22px;
    height: 4px;
    margin-left: -11px;
    border-radius: 999px;
    background: var(--primary);
}

.nav--bottom .nav__link--active::before { top: 6px; }
.nav--top .nav__link--active::before { bottom: 6px; }

@media (min-width: 900px) {
    body { padding-bottom: 0; }
    .nav--bottom { display: none; }
    .site-header { display: flex; padding-top: 0; padding-bottom: 0; }

    .nav--top { display: flex; gap: 8px; font-size: 15px; }
    .nav--top .nav__link { padding: 20px 14px; }
}

/* Page */

.page {
    max-width: 1080px;
    margin: 0 auto;
    padding: 28px var(--gutter) 56px;
}

.narrow {
    max-width: var(--narrow);
    margin-left: auto;
    margin-right: auto;
}

.section { margin-top: 48px; }
.section:first-child { margin-top: 0; }

/* Footer: quiet links below every page */
.site-footer {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 24px;
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 var(--gutter) 32px;
    font-size: var(--font-small);
}

.site-footer__link { color: var(--muted); text-decoration: none; }
.site-footer__link:hover { color: var(--text); }

/* Long legal text: the terms */
.legal h2 { margin-top: 36px; }
.legal ul { padding-left: 22px; margin: 0 0 16px; }
.legal li { margin-bottom: 10px; }

/* Buttons: .button plus modifiers for size (--block, --large, --small) and look (--secondary, --danger, --mercadopago).
   Full width on phones; from 700px only --block stays full width. */

.button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 52px;
    padding: 12px 24px;
    border: 0;
    border-radius: var(--radius);
    background: var(--primary);
    color: #fff;
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.005em;
    text-decoration: none;
    text-align: center;
    flex-shrink: 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.2s var(--ease), transform 0.15s var(--ease);
}

.button:hover { background: var(--primary-hover); color: #fff; }
.button:active { transform: scale(0.985); }
.button:disabled { background: var(--surface); color: var(--muted); cursor: not-allowed; transform: none; }

.button--secondary { background: var(--surface-hover); color: var(--text); }
.button--secondary:hover { background: color-mix(in srgb, var(--surface-hover) 80%, #fff 8%); color: var(--text); }

.button--danger { background: var(--danger-soft); color: var(--danger); }
.button--danger:hover { background: color-mix(in srgb, var(--danger) 24%, transparent); color: var(--danger); }

.button--large { font-size: 17px; min-height: 58px; }

.button__icon { width: 18px; height: 18px; flex-shrink: 0; }

/* Pay buttons: Mercado Pago yellow with its logo and a ring, so paying is the obvious next step */
.button--mercadopago {
    --mp-yellow: #ffe600;
    border-radius: 999px;
    background: var(--mp-yellow);
    color: #141414;
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--mp-yellow) 18%, transparent);
    transition: transform 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.button--mercadopago:hover,
.button--mercadopago:focus-visible {
    background: var(--mp-yellow);
    color: #141414;
    transform: translateY(-2px);
    box-shadow: 0 0 0 8px color-mix(in srgb, var(--mp-yellow) 26%, transparent);
}

@media (prefers-reduced-motion: reduce) {
    .button,
    .button--mercadopago { transition: none; }
    .button:active,
    .button--mercadopago:hover,
    .button--mercadopago:focus-visible { transform: none; }
}

.button--small {
    display: inline-flex;
    width: auto;
    min-height: 40px;
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    font-size: var(--font-small);
}

.button--block { width: 100%; display: flex; }

@media (min-width: 700px) {
    .button { width: auto; display: inline-flex; }
    .button--block { width: 100%; display: flex; }
}

/* Text under a field, or centered under a full-width button */
.form__hint,
.button-note { font-size: var(--font-small); line-height: 1.5; margin: 10px 0 0; color: var(--muted); }
.button-note { text-align: center; }

/* Forms */

.form__field { margin-bottom: 20px; }
.form__field--last { margin-bottom: 0; }

/* A field's label: a <label>, a <legend> or, for a group without one input, a <span> */
.form__label {
    display: block;
    padding: 0;
    font-size: 15px;
    font-weight: 500;
    margin-bottom: 8px;
}

.form__input {
    width: 100%;
    min-height: 52px;
    padding: 12px 16px;
    border: 0;
    border-radius: var(--radius);
    background: var(--field);
    font: inherit;
    font-size: 16px;
    color: var(--text);
    -webkit-appearance: none;
    appearance: none;
    caret-color: var(--primary-text);
    transition: background-color 0.2s var(--ease);
}

.form__input::placeholder { color: color-mix(in srgb, var(--muted) 75%, transparent); }

.form__input--textarea { min-height: 110px; resize: vertical; }

/* Focus: the fill lightens */
.form__input:focus,
.price-input:focus-within {
    outline: none;
    background: var(--field-focus);
}

.form__fieldset { border: 0; padding: 0; margin-inline: 0; min-width: 0; }

.form--search { margin-bottom: 32px; }

.form__error {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin: 10px 0 0;
    font-size: var(--font-small);
    font-weight: 500;
    line-height: 1.45;
    color: var(--danger);
}

/* Alert icon: a circle with an exclamation mark, drawn in the text color */
.form__error::before {
    content: "";
    flex-shrink: 0;
    width: 18px;
    height: 18px;
    margin-top: 1px;
    background: currentColor;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1a11 11 0 1 0 0 22 11 11 0 0 0 0-22Zm-1.5 5h3l-.5 8h-2l-.5-8Zm1.5 10a1.75 1.75 0 1 1 0 3.5 1.75 1.75 0 0 1 0-3.5Z'/%3E%3C/svg%3E") center / contain no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 1a11 11 0 1 0 0 22 11 11 0 0 0 0-22Zm-1.5 5h3l-.5 8h-2l-.5-8Zm1.5 10a1.75 1.75 0 1 1 0 3.5 1.75 1.75 0 0 1 0-3.5Z'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* A field with an error tints its input red, focused or not */
.form__field:has(> .form__error) .form__input,
.choice__body:has(> .form__error) .price-input {
    background: var(--danger-soft);
}

/* Input with its button alongside: search, invite */
.input-row { display: flex; gap: 8px; }
.input-row__input { flex: 1; min-width: 0; }
.input-row__button { width: auto; }

.price-input {
    display: flex;
    border-radius: var(--radius);
    background: var(--field);
    align-items: center;
    padding-left: 16px;
    font-size: 20px;
    font-weight: 600;
    transition: background-color 0.2s var(--ease);
}

/* The input inside is see-through: the box around it takes the fill and the focus */
.price-input__input,
.price-input__input:focus {
    background: transparent;
    font-size: 20px;
    font-weight: 600;
    padding-left: 8px;
    font-variant-numeric: tabular-nums;
}

/* Radio cards: one option per card, the radio drawn as a check mark.
   .choice__body holds an option's own fields, e.g. the price. */

.choices { display: grid; gap: 10px; }

.choice {
    border-radius: var(--radius);
    background: var(--surface);
    transition: background-color 0.2s var(--ease);
}

.choice:has(.choice__input:checked) { background: var(--primary-soft); }

.choice__head {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 16px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.choice__mark {
    position: relative;
    flex: none;
    width: 22px;
    height: 22px;
    margin-top: 2px;
    border-radius: 50%;
    background: var(--field-focus);
    transition: background-color 0.2s var(--ease);
}

.choice__input:checked + .choice__mark { background: var(--primary); }

/* Check mark icon, centered in the circle */
.choice__input:checked + .choice__mark::after {
    content: "";
    position: absolute;
    inset: 0;
    background: #fff;
    -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 14px no-repeat;
    mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 14px no-repeat;
}

/* Keyboard focus lightens the whole card instead of drawing a ring */
.choice:has(.choice__input:focus-visible) { background: var(--surface-hover); }
.choice:has(.choice__input:checked:focus-visible) { background: color-mix(in srgb, var(--primary) 24%, transparent); }

.choice__title { display: block; font-weight: 600; }
.choice__description { display: block; margin-top: 2px; font-size: var(--font-small); line-height: 1.5; color: var(--muted); }

.choice__body { padding: 0 16px 16px; }

/* Under the sign in form, the invite to sign up, and vice versa */
.auth-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 28px;
    padding: 10px 10px 10px 16px;
    border-radius: var(--radius);
    background: var(--primary-soft);
}

.auth-switch__text { margin: 0; font-weight: 500; }

/* Surface boxes: messages, callouts, the share link */

.flash,
.notice,
.share-link {
    padding: 16px;
    border-radius: var(--radius);
    background: var(--surface);
}

.flash { font-weight: 500; margin-bottom: 20px; }
.flash--error { background: var(--danger-soft); }

/* Highlighted block that asks for an action: the home invite.
   A rose wash in one corner sets it apart without a border. */
.callout {
    max-width: var(--narrow);
    margin-left: auto;
    margin-right: auto;
    padding: 28px var(--gutter);
    border-radius: var(--radius-lg);
    background:
        radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--primary) 22%, transparent), transparent 60%),
        var(--surface);
}

.callout__title { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 6px; }
.callout__text { color: var(--muted); font-size: 15px; margin-bottom: 18px; }

/* Full-width variant (/vender, the home invite): the pitch beside its button or form from 700px */
.callout--wide { max-width: none; }

@media (min-width: 700px) {
    .callout { padding: 32px; }

    .callout--wide {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 32px;
    }

    .callout--wide .callout__text { margin-bottom: 0; }
    /* No shrinking: the long pitch beside it would squeeze the email field */
    .callout--wide .callout__form { flex: 0 0 min(420px, 55%); }
}

/* Centered message: errors, checkout, payment status */

.panel {
    text-align: center;
    max-width: var(--narrow);
    margin: 0 auto;
    padding: 40px 0;
}

.panel__text { font-size: 18px; color: var(--muted); }
.panel__note { font-size: var(--font-small); margin-top: 20px; }
.panel__button { margin-top: 8px; }

/* Empty list: no packs, no purchases, no search results */

.empty {
    text-align: center;
    max-width: var(--narrow);
    margin: 80px auto;
}

.empty__icon {
    display: block;
    width: 72px;
    height: 72px;
    margin: 0 auto 20px;
    /* The PNG is used as a mask so the icon takes the muted text color on the dark background */
    background: var(--muted);
    -webkit-mask: url("../images/empty.png") center / contain no-repeat;
    mask: url("../images/empty.png") center / contain no-repeat;
}

.empty__text { font-size: 18px; color: var(--muted); }
.empty__button { margin-top: 8px; }

/* Small label: pack state, "Portada", "Conectado" */

.badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
    line-height: 1.5;
    padding: 2px 8px;
    border-radius: var(--radius-xs);
    background: var(--surface-hover);
}

.badge--accent { background: var(--primary); color: #fff; }

/* List of rows, each on its own surface: sales, admin */

.rows { display: grid; gap: 6px; }

.row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 14px;
    padding: 14px 16px;
    border-radius: var(--radius);
    background: var(--surface);
}

.row__body { flex: 1 1 0; min-width: 0; }
.row__title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row__amount { white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Admin rows: smaller text, and the details wrap above the action on narrow screens */
.row--admin { font-size: var(--font-small); }
.row--admin .row__body { flex-basis: 220px; }

/* Small muted line with a leading icon: disclaimers under a list */
.footnote {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 12px 0 0;
    font-size: var(--font-small);
    color: var(--muted);
}

.footnote__icon { width: 16px; height: 16px; flex-shrink: 0; }

.mercadopago-logo { flex-shrink: 0; width: auto; height: 28px; }

/* Avatars */

.avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    background: linear-gradient(140deg, #f0457f, var(--primary) 55%, #9b1a6b);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 21px;
    text-transform: uppercase;
    overflow: hidden;
    --protected-blur: 6px;
}

.avatar--large { width: 104px; height: 104px; font-size: 42px; box-shadow: var(--shadow); --protected-blur: 12px; }

/* Home */

.creator-list {
    display: grid;
    gap: 20px;
}

@media (min-width: 700px) {
    .creator-list { grid-template-columns: 1fr 1fr; gap: 24px; }
}

/* Each creator sits on its own soft card */
.creator-card {
    min-width: 0;
    padding: 16px;
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.creator-card__meta { margin: 12px 0 14px; font-size: var(--font-small); }

.creator-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 14px;
    text-decoration: none;
}

.creator-head:hover { color: var(--text); }

/* Above a pack's cover or content */
.creator-head--spaced { margin-bottom: 20px; }

/* Long names end in an ellipsis instead of pushing the card wider */
.creator-head__text { min-width: 0; }
.creator-head__name,
.creator-head__username { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.creator-head__name { font-size: 17px; font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
.creator-head__username { color: var(--muted); font-size: var(--font-small); }

/* Large preview of a creator's latest pack covers (one to three), in one 6:5 frame for every creator.
   One fills the frame; two split it in halves; with three, the newest takes two thirds and
   the others stack beside it, which makes all three 4:5 portraits. */
.creator-preview {
    display: grid;
    grid-template-columns: 1fr;
    grid-auto-rows: 1fr;
    gap: 4px;
    aspect-ratio: 6 / 5;
    overflow: hidden;
    border-radius: var(--radius);
}

.creator-preview:has(> .creator-preview__item:nth-child(2)) { grid-template-columns: 1fr 1fr; }
.creator-preview:has(> .creator-preview__item:nth-child(3)) { grid-template-columns: 2fr 1fr; }
.creator-preview__item:first-child:nth-last-child(3) { grid-row: span 2; }

.creator-preview__item {
    position: relative;
    min-height: 0;
}

.creator-preview__image {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    background: var(--surface-hover);
}

/* Photo and video count over each cover */
.creator-preview__count {
    position: absolute;
    left: 8px;
    bottom: 8px;
    /* Wraps onto a second line rather than overflowing a narrow cover */
    max-width: calc(100% - 16px);
    display: flex;
    flex-wrap: wrap;
    gap: 6px 10px;
    font-size: 13px;
    line-height: 1;
    padding: 6px;
}

.creator-preview__count-item { display: inline-flex; align-items: center; gap: 5px; }
.creator-preview__icon { width: 14px; height: 14px; }

/* Creators that aren't featured: a smaller card after the featured ones, two across on a phone.
   Its frame holds the newest cover, or the two newest side by side. */
.creator-list--compact { grid-template-columns: 1fr 1fr; gap: 12px; }
.creator-list + .creator-list--compact { margin-top: 32px; }

@media (min-width: 700px) {
    .creator-list--compact { grid-template-columns: repeat(3, 1fr); gap: 20px; }
    .creator-list + .creator-list--compact { margin-top: 40px; }
}

.creator-card--compact { padding: 10px; }
.creator-card--compact .creator-head { gap: 10px; margin-bottom: 10px; }
.creator-card--compact .creator-head__name { font-size: 15px; }
.creator-card--compact .creator-head__username { font-size: 13px; }
.creator-card--compact .avatar { width: 36px; height: 36px; font-size: 16px; }
.creator-card--compact .creator-preview__count { left: 6px; bottom: 6px; max-width: calc(100% - 12px); gap: 4px 6px; padding: 4px 5px; font-size: 12px; }
.creator-card--compact .creator-preview__count-item { gap: 3px; }
.creator-card--compact .creator-preview__icon { width: 12px; height: 12px; }
.creator-card--compact .creator-card__meta { margin: 8px 0 10px; font-size: 13px; }

@media (min-width: 700px) {
    .creator-card--compact { padding: 14px; }
    .creator-card--compact .creator-head { gap: 12px; margin-bottom: 12px; }
    .creator-card--compact .creator-head__name { font-size: 16px; }
    .creator-card--compact .avatar { width: 44px; height: 44px; font-size: 19px; }
}

.pagination { margin-top: 40px; text-align: center; }

/* Profile */

.profile-header {
    text-align: center;
    margin: 8px 0 36px;
}

.profile-header__avatar { margin: 0 auto 18px; }
.profile-header__title { margin-bottom: 2px; }
.profile-header__bio { max-width: 520px; margin: 14px auto 0; color: color-mix(in srgb, var(--text) 85%, var(--muted)); }

/* Three square thumbnails per row (locked pack contents) */

.thumb-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    border-radius: var(--radius);
    overflow: hidden;
}

.thumb-grid__item {
    aspect-ratio: 1;
    width: 100%;
    object-fit: cover;
    border-radius: var(--radius-xs);
    background: var(--surface-hover);
}

/* 4:5 cover image, on pack cards and the pack page */

.cover {
    display: block;
    position: relative;
    aspect-ratio: 4 / 5;
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
}

/* Long, gently decelerating zoom; will-change keeps the image on its own layer so it doesn't jitter */
.cover__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
    will-change: transform;
}

/* A cover that links somewhere zooms in a little on hover */
.cover--link:hover .cover__image { transform: scale(1.06); }

@media (prefers-reduced-motion: reduce) {
    .cover__image { transition: none; }
    .cover--link:hover .cover__image { transform: none; }
}

/* Pack cards */

.pack-grid {
    display: grid;
    gap: 36px;
}

@media (min-width: 700px) {
    .pack-grid { grid-template-columns: repeat(2, 1fr); column-gap: 24px; }
}

@media (min-width: 1000px) {
    .pack-grid { grid-template-columns: repeat(3, 1fr); }
}

.pack-card__cover { margin-bottom: 14px; }
.pack-card__title { margin-bottom: 4px; }
.pack-card__meta { margin-bottom: 2px; font-size: var(--font-small); }
.pack-card__price { margin-bottom: 2px; font-size: 18px; font-weight: 600; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.pack-card__button { margin-top: 16px; }
.pack-card__receipt { margin-top: 16px; }

/* Receipt: payment details printed like a till receipt, with thermal paper, monospace type, torn zigzag edges.
   The teeth are a mask, not borders. */
.receipt {
    --receipt-paper: #f3efe6;
    --receipt-ink: #26232b;
    --receipt-faded: #6d6874;
    --receipt-tooth: 10px;
    padding: calc(var(--receipt-tooth) + 12px) 18px calc(var(--receipt-tooth) + 14px);
    background: var(--receipt-paper);
    color: var(--receipt-ink);
    font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
    font-size: 13px;
    -webkit-mask:
        conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / var(--receipt-tooth) 51% repeat-x,
        conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / var(--receipt-tooth) 51% repeat-x;
    mask:
        conic-gradient(from 135deg at top, #0000, #000 1deg 89deg, #0000 90deg) top / var(--receipt-tooth) 51% repeat-x,
        conic-gradient(from -45deg at bottom, #0000, #000 1deg 89deg, #0000 90deg) bottom / var(--receipt-tooth) 51% repeat-x;
}
.receipt__title {
    margin: 0 0 6px;
    color: var(--receipt-faded);
    font-size: 11px;
    letter-spacing: 0.24em;
    text-align: center;
    text-transform: uppercase;
}
.receipt__rows { display: grid; gap: 6px; margin: 0; }
.receipt__row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.receipt__label { color: var(--receipt-faded); text-transform: uppercase; letter-spacing: 0.06em; }
.receipt__value { margin: 0; font-variant-numeric: tabular-nums; text-align: right; overflow-wrap: anywhere; }
.receipt__link { display: inline-flex; align-items: center; gap: 5px; color: var(--receipt-ink); }
/* The brand pink that stays readable on the light paper. */
.receipt__link:hover { color: var(--primary); }
.receipt__link-icon { width: 13px; height: 13px; flex-shrink: 0; }

/* Frosted labels over media: photo and video counts, tile marks and status */
.creator-preview__count,
.tile__badge--video,
.tile-status {
    background: var(--overlay);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
}

/* Locked overlay (lock or play symbol over an empty tile) */

.locked {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--primary) 14%, transparent), transparent 70%),
        var(--surface);
}

.locked::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 44px;
    height: 44px;
    margin: -22px 0 0 -22px;
    border-radius: 50%;
    background: var(--overlay) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 2a5 5 0 0 0-5 5v3H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8a2 2 0 0 0-2-2h-1V7a5 5 0 0 0-5-5zm-3 5a3 3 0 1 1 6 0v3H9V7z'/%3E%3C/svg%3E") center / 18px no-repeat;
}

.locked--video::after {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
    background-size: 22px;
}

/* Pack page */

.pack-page {
    max-width: var(--narrow);
    margin: 0 auto;
}

.pack-page__cover { margin-bottom: 24px; }
.pack-page__meta { margin-bottom: 20px; }
.pack-page__buy { margin: 28px 0 36px; }

/* Purchased content viewer: one item per screen width, scroll to navigate */

.viewer {
    max-width: 900px;
    margin: 0 auto;
}

.viewer__header { margin-bottom: 20px; }
.viewer__more { margin: 32px auto 0; max-width: var(--narrow); }

.viewer__items {
    display: grid;
    gap: 12px;
    margin: 0 calc(var(--gutter) * -1);
}

.viewer__item { margin: 0; }

.viewer__media {
    width: 100%;
    height: auto;
    max-height: 92vh;
    object-fit: contain;
    background: var(--surface);
    transition: filter 0.2s var(--ease);
}

.viewer__media--image { display: block; }

@media (min-width: 900px) {
    .viewer__items { margin: 0; gap: 16px; }
    .viewer__media { border-radius: var(--radius-lg); }
}

/* Protected media: any image or video of a pack, covers included (media-guard.js).
   No save menu, dragging, selecting or iOS long-press. Images ignore the pointer so "save image"
   never targets them (clicks reach the link around a cover); videos keep their controls.
   Comes after the blocks it's mixed into so the hidden state wins over their transitions. */
.protected {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    -webkit-user-drag: none;
}

img.protected { pointer-events: none; }

/* Set while the page is in the background or a screenshot shortcut is held.
   Hiding is instant so a fast capture can't catch it mid-transition; revealing may fade.
   The blur is on the media itself, so it also reaches a video shown fullscreen (top layer).
   Small media sets a smaller --protected-blur: a blur wider than the element smears it into
   the transparent space around it, and it vanishes instead of blurring. */
.protected--hidden { filter: blur(var(--protected-blur, 32px)) brightness(0.4); transition: none; }

@media print {
    .protected { visibility: hidden; }
}

/* Sell */

/* Inline prompt with a logo, a short text and its action. Lives under a field. */
.notice {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 14px;
    margin-top: 10px;
}

.notice__title { font-weight: 600; margin: 0 0 2px; }
.notice__text { margin: 0; font-size: 15px; line-height: 1.5; color: var(--muted); }
.notice__action { grid-column: 1 / -1; }

@media (min-width: 700px) {
    .notice { grid-template-columns: auto 1fr auto; gap: 16px; }
    .notice__action { grid-column: auto; }
}

.share-link {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 12px 0 28px;
    padding: 8px 8px 8px 16px;
}

.share-link--in-field { margin: 0; }

.share-link__url {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
    color: var(--primary-text);
    text-decoration: none;
}

/* Pack editor */

/* Drop targets: the empty dropzone and the "Agregar" tile */
.dropzone,
.tile-add {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border: 0;
    background: var(--surface);
    color: var(--text);
    text-align: center;
    cursor: pointer;
    transition: background-color 0.2s var(--ease);
}

.dropzone:hover,
.dropzone--dragging,
.tile-add:hover { background: var(--primary-soft); }

.dropzone {
    min-height: 240px;
    padding: 32px 16px;
    border-radius: var(--radius-lg);
}

.dropzone__title { font-size: 20px; font-weight: 600; letter-spacing: -0.015em; margin-bottom: 4px; }
.dropzone__text { font-size: var(--font-small); line-height: 1.5; }

/* The plus sits in a rose disc */
.dropzone__plus {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    margin-bottom: 14px;
    border-radius: 50%;
    background: var(--primary);
    color: #fff;
}

.dropzone__plus svg { width: 28px; height: 28px; }

.media-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

@media (min-width: 440px) {
    .media-grid { grid-template-columns: repeat(4, 1fr); }
}

.tile {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    overflow: hidden;
    background: var(--surface);
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

.tile--dragging { opacity: 0.35; }

/* The whole tile is one button that opens its options */
.tile__hit {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    padding: 0;
    background: transparent;
    cursor: pointer;
}

.tile__media {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}

/* "Portada" on the left, "Video" on the right */
.tile__badge { position: absolute; top: 6px; left: 6px; font-size: 11px; padding: 1px 8px; pointer-events: none; }
.tile__badge--video { left: auto; right: 6px; }

.tile-status {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 6px 8px;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.25;
    pointer-events: none;
}

.tile-status--failed { background: var(--primary); color: #fff; pointer-events: auto; }
.tile-status--ready { color: var(--primary-text); }
.tile-status--processing { display: flex; align-items: center; gap: 6px; }

/* A small button compacted to fit the tile */
.tile-status__button {
    width: 100%;
    min-height: 32px;
    margin-top: 4px;
    padding: 4px 8px;
    font-size: 12px;
}

.progress {
    height: 4px;
    margin-top: 6px;
    border-radius: 999px;
    background: var(--field-focus);
    overflow: hidden;
}

.progress__bar {
    height: 100%;
    width: 0;
    border-radius: inherit;
    background: var(--primary);
    transition: width 0.3s var(--ease);
}

.tile-add {
    aspect-ratio: 1;
    border-radius: var(--radius-sm);
    font: inherit;
    font-weight: 500;
    font-size: var(--font-small);
}

.tile-add__plus { width: 28px; height: 28px; margin-bottom: 4px; }

/* Photos and videos block: spaced from the form like a field. */
.editor__media { margin-bottom: 28px; }

.editor__publish { margin-top: 8px; }

.editor__secondary {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 24px;
    margin-top: 28px;
}

/* Action sheet for a tapped tile: a backdrop holding the panel */

.sheet {
    position: fixed;
    inset: 0;
    z-index: 50;
    background: var(--overlay);
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fade-in 0.2s var(--ease);
}

.sheet__panel {
    width: 100%;
    max-width: var(--narrow);
    background: var(--surface);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -12px 40px -12px rgb(0 0 0 / 0.6);
    padding: 20px 16px calc(16px + env(safe-area-inset-bottom));
    display: grid;
    gap: 10px;
    animation: sheet-in 0.28s var(--ease);
}

@media (min-width: 700px) {
    .sheet { align-items: center; }
    .sheet__panel { border-radius: var(--radius-lg); padding: 20px; }
}

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

@keyframes sheet-in {
    from { transform: translateY(24px); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .sheet,
    .sheet__panel { animation: none; }
}

/* Checkout and payment status mark */

.spinner {
    margin: 0 auto 24px;
    width: 44px;
    height: 44px;
    border: 4px solid var(--field-focus);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.9s linear infinite;
}

/* Inline, next to a tile's "Preparando…" */
.spinner--small {
    flex: none;
    width: 14px;
    height: 14px;
    margin: 0;
    border-width: 2px;
}

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

@media (prefers-reduced-motion: reduce) {
    .spinner { animation-duration: 3s; }
}

/* Account */

.account__section {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 24px;
}
.account__section + .account__section { margin-top: 16px; }
.account__section > :last-child { margin-bottom: 0; }

.avatar-field {
    display: flex;
    align-items: center;
    gap: 16px;
}

/* The native file input is hidden: its "Choose File" text follows the browser's language. */
.avatar-field__button:focus-within { outline: 2px solid var(--primary-text); outline-offset: 2px; }

/* Admin: deliberately plain */

.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 24px; }
.tabs__link { font-size: var(--font-small); font-weight: 500; padding: 8px 14px; border-radius: var(--radius-sm); background: var(--surface); text-decoration: none; }
.tabs__link:hover { background: var(--surface-hover); color: var(--text); }
.tabs__link--active,
.tabs__link--active:hover { background: var(--primary); color: #fff; }
