:root {
    --black: #0a0a0a;
    --white: #ffffff;
    --gray: #888888;
    --light-gray: #eeeeee;
}

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

body {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

/* =========================================================
   Public page — themeable via body class
   ========================================================= */

body.public {
    display: flex;
    justify-content: center;
    min-height: 100vh;
    background: var(--page-bg);
    color: var(--page-text);
}

.theme-mono {
    --page-bg: #ffffff;
    --page-text: #0a0a0a;
    --page-muted: #767676;
    --pill-bg: #ffffff;
    --pill-border: #0a0a0a;
    --pill-text: #0a0a0a;
    --pill-icon: #f1f1f1;
    --card-bg: #ffffff;
    --card-border: #0a0a0a;
    --card-text: #0a0a0a;
    --frame-border: #e2e2e2;
    --social-bg: transparent;
    --social-border: #0a0a0a;
    --social-text: #0a0a0a;
    --avatar-ring: #e2e2e2;
    --pulse-color: rgba(10, 10, 10, 0.35);
}

.theme-banner {
    --accent: #7fa39a;
    --page-bg: linear-gradient(
        160deg,
        color-mix(in srgb, var(--accent) 82%, #ffffff) 0%,
        var(--accent) 45%,
        color-mix(in srgb, var(--accent) 78%, #000000) 100%
    );
    --page-text: #ffffff;
    --page-muted: rgba(255, 255, 255, 0.85);
    --pill-bg: rgba(255, 255, 255, 0.9);
    --pill-border: rgba(255, 255, 255, 0.6);
    --pill-text: #0a0a0a;
    --pill-icon: #eeeeee;
    --card-bg: rgba(0, 0, 0, 0.08);
    --card-border: rgba(255, 255, 255, 0.35);
    --card-text: #ffffff;
    --frame-border: rgba(255, 255, 255, 0.5);
    --social-bg: rgba(255, 255, 255, 0.25);
    --social-border: rgba(255, 255, 255, 0.5);
    --social-text: #ffffff;
    --avatar-ring: rgba(255, 255, 255, 0.7);
    --pulse-color: rgba(255, 255, 255, 0.85);
}

.page {
    width: 100%;
    max-width: 480px;
    padding: 48px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow-x: hidden;
}

/* Dark-text mode: applied when the accent pulled from the banner is light */
.theme-banner.text-dark {
    --page-text: #0a0a0a;
    --page-muted: rgba(10, 10, 10, 0.65);
    --social-bg: rgba(10, 10, 10, 0.08);
    --social-border: rgba(10, 10, 10, 0.55);
    --social-text: #0a0a0a;
    --card-border: rgba(10, 10, 10, 0.3);
    --card-text: #0a0a0a;
    --frame-border: rgba(10, 10, 10, 0.2);
    --avatar-ring: rgba(10, 10, 10, 0.35);
    --pulse-color: rgba(10, 10, 10, 0.35);
}

.banner-frame {
    width: 100%;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 20px;
}

/* On the banner theme the image bleeds to the page edges and fades into the gradient */
.theme-banner .banner-frame {
    width: calc(100% + 48px);
    margin: -48px -24px 0;
    border-radius: 0;
    -webkit-mask-image: linear-gradient(to bottom, #000 70%, transparent 100%);
    mask-image: linear-gradient(to bottom, #000 70%, transparent 100%);
}

.banner-image {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.profile {
    text-align: center;
    margin-bottom: 32px;
}

.avatar-placeholder {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: var(--black);
    margin: 0 auto 16px;
    border: 3px solid var(--avatar-ring);
}

.avatar-image {
    display: block;
    width: 96px;
    height: 96px;
    border-radius: 50%;
    object-fit: cover;
    margin: 0 auto 16px;
    border: 3px solid var(--avatar-ring);
}

.profile h1 {
    font-family: 'Libre Baskerville', Georgia, serif;
    font-size: 28px;
    font-weight: 400;
    margin-bottom: 4px;
    color: var(--page-text);
}

/* Bold sans-serif header when a banner drives the page look */
.theme-banner .profile h1 {
    font-family: 'Open Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 32px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.tagline {
    color: var(--page-muted);
    font-size: 14px;
    letter-spacing: 0.02em;
}

.social-row {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin-top: 14px;
}

.social-icon {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--social-bg);
    border: 1.5px solid var(--social-border);
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--social-text);
    transition: transform 0.15s ease;
}

.social-icon:hover {
    transform: translateY(-2px);
}

.section-header {
    text-align: center;
    font-weight: 700;
    font-size: 14px;
    color: var(--page-text);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin: 8px 0 -4px;
}

.links {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.link-button {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 14px 18px;
    background: var(--pill-bg);
    border: 1.5px solid var(--pill-border);
    color: var(--pill-text);
    text-decoration: none;
    font-size: 15px;
    font-weight: 600;
    border-radius: 999px;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.link-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.12);
}

.link-icon {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--pill-icon);
    flex-shrink: 0;
    margin-right: 12px;
}

.link-label {
    flex: 1;
    text-align: center;
    margin-right: 28px; /* balances the icon so text stays visually centered */
}

.link-thumb {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
    flex-shrink: 0;
    margin-right: 12px;
}

.link-sub {
    display: block;
    font-size: 12px;
    font-weight: 400;
    color: var(--gray);
}

.dots {
    color: var(--page-muted);
    font-size: 16px;
    line-height: 1;
    flex-shrink: 0;
}

/* --- Lead-capture gate page --- */

.gate-card {
    width: 100%;
    margin-top: 24px;
    border: 1.5px solid var(--card-border);
    border-radius: 20px;
    background: var(--card-bg);
    color: var(--card-text);
    padding: 28px 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 12px;
}

.gate-thumb {
    width: 88px;
    height: 88px;
    border-radius: 16px;
    object-fit: cover;
    border: 1px solid var(--frame-border);
}

.gate-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--card-text);
}

.gate-sub {
    font-size: 14px;
    color: var(--page-muted);
}

.gate-error {
    font-size: 14px;
    color: #cc3333;
    font-weight: 600;
}

.gate-form {
    width: 100%;
    max-width: 320px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 4px;
}

.gate-form input {
    padding: 12px 16px;
    border: 1.5px solid var(--pill-border);
    border-radius: 999px;
    font-size: 14px;
    font-family: inherit;
    background: var(--pill-bg);
    color: var(--pill-text);
    text-align: center;
}

.gate-form input:focus {
    outline: 2px solid var(--pill-border);
    outline-offset: 1px;
}

.gate-btn {
    display: inline-block;
    padding: 12px 28px;
    background: var(--pill-text);
    color: var(--pill-bg);
    border: none;
    border-radius: 999px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    text-decoration: none;
    cursor: pointer;
}

.gate-back {
    margin-top: 8px;
    font-size: 13px;
    color: var(--page-muted);
    text-decoration: none;
}

.featured-card {
    display: flex;
    flex-direction: column;
    width: 100%;
    text-decoration: none;
    color: var(--card-text);
    border: 1.5px solid var(--card-border);
    border-radius: 20px;
    padding: 16px 16px 12px;
    background: var(--card-bg);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.featured-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.featured-eyebrow {
    font-size: 15px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 12px;
}

.featured-image-frame {
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid var(--frame-border);
}

.featured-image {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 10;
    object-fit: cover;
}

.featured-image-placeholder {
    background: var(--pill-icon);
}

.featured-caption {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 14px;
    font-size: 15px;
    font-weight: 600;
}

@keyframes card-pulse {
    0% {
        box-shadow: 0 0 0 0 var(--pulse-color);
    }
    70% {
        box-shadow: 0 0 0 12px rgba(255, 255, 255, 0);
    }
    100% {
        box-shadow: 0 0 0 0 rgba(255, 255, 255, 0);
    }
}

.link-button.pulse,
.featured-card.pulse {
    animation: card-pulse 2s ease-out infinite;
}

body.public footer {
    margin-top: 40px;
    color: var(--page-muted);
    font-size: 13px;
}

/* =========================================================
   Admin panel
   ========================================================= */

body.admin {
    background: #f3f3f1;
    color: #1a1a1a;
    min-height: 100vh;
}

.admin-layout {
    max-width: 1080px;
    margin: 0 auto;
    padding: 32px 24px 64px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 40px;
    align-items: start;
}

@media (max-width: 920px) {
    .admin-layout {
        grid-template-columns: minmax(0, 1fr);
    }
    .preview-col {
        display: none;
    }
}

.admin-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 24px;
}

.admin-top h1 {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.logout-link {
    color: #767676;
    text-decoration: none;
    font-size: 14px;
}

.logout-link:hover {
    color: #1a1a1a;
}

.card {
    background: #ffffff;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    margin-bottom: 16px;
}

details.collapse > summary {
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    list-style: none;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

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

details.collapse > summary::after {
    content: "\203A";
    font-size: 20px;
    color: #999;
    transform: rotate(90deg);
    transition: transform 0.15s ease;
}

details.collapse[open] > summary::after {
    transform: rotate(-90deg);
}

details.collapse[open] > summary {
    margin-bottom: 16px;
}

.stack-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stack-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 13px;
    color: #767676;
    font-weight: 600;
}

body.admin input[type="text"],
body.admin input[type="url"],
body.admin input[type="password"],
body.admin select {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    background: #fafafa;
    color: #1a1a1a;
    transition: border-color 0.15s ease, background 0.15s ease;
}

body.admin input:focus,
body.admin select:focus {
    outline: none;
    border-color: #0a0a0a;
    background: #ffffff;
}

body.admin input[type="file"] {
    font-size: 13px;
    color: #767676;
}

body.admin input[type="file"]::file-selector-button {
    padding: 8px 16px;
    margin-right: 10px;
    background: #ffffff;
    color: #0a0a0a;
    border: 1px solid #d0d0d0;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
}

.field-hint {
    font-size: 12px;
    color: #999999;
    font-weight: 400;
}

.pos-frame {
    width: 100%;
    max-width: 320px;
    aspect-ratio: 4 / 3;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
    cursor: grab;
    touch-action: none;
    background: #f1f1f1;
}

.pos-frame.dragging {
    cursor: grabbing;
    border-color: #0a0a0a;
}

.pos-frame img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

.pos-frame.pos-avatar {
    width: 120px;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
}

.pick-frame {
    width: 100%;
    max-width: 320px;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #e0e0e0;
}

.pick-frame img {
    display: block;
    width: 100%;
    height: auto;
    cursor: crosshair;
    user-select: none;
    -webkit-user-drag: none;
}

body.admin input[type="color"] {
    width: 56px;
    height: 36px;
    padding: 2px;
    border: 1px solid #e0e0e0;
    border-radius: 10px;
    background: #ffffff;
    cursor: pointer;
}

.btn-primary {
    padding: 12px 24px;
    background: #0a0a0a;
    color: #ffffff;
    border: none;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    align-self: flex-start;
    transition: background 0.15s ease;
}

.btn-primary:hover {
    background: #333333;
}

.btn-secondary {
    padding: 8px 18px;
    background: #ffffff;
    color: #0a0a0a;
    border: 1px solid #d0d0d0;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

.btn-secondary:hover {
    border-color: #0a0a0a;
}

.check-row {
    display: flex;
    flex-direction: row !important;
    align-items: center;
    gap: 8px !important;
    font-size: 13px;
    color: #767676;
    font-weight: 600;
}

.check-row input[type="checkbox"] {
    width: auto;
}

/* --- Link cards --- */

.link-card {
    display: flex;
    gap: 14px;
    align-items: stretch;
    padding: 18px 20px;
}

.link-card.is-off {
    opacity: 0.55;
}

.reorder-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
}

.icon-btn {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #999999;
    transition: background 0.15s ease, color 0.15s ease;
}

.icon-btn:hover {
    background: #f1f1f1;
    color: #1a1a1a;
}

.icon-btn.danger:hover {
    background: #fdecec;
    color: #cc3333;
}

.link-fields {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.field-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.type-select {
    max-width: 150px;
    flex-shrink: 0;
}

.title-input {
    font-weight: 600;
}

.save-row {
    justify-content: flex-end;
}

.side-col {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 14px;
    padding-left: 14px;
    border-left: 1px solid #f0f0f0;
}

.switch-form {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.switch-label {
    font-size: 11px;
    font-weight: 600;
    color: #999999;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.switch {
    position: relative;
    display: inline-block;
    width: 40px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    inset: 0;
    background: #d6d6d6;
    border-radius: 999px;
    transition: background 0.2s ease;
    cursor: pointer;
}

.slider::before {
    content: "";
    position: absolute;
    height: 18px;
    width: 18px;
    left: 3px;
    top: 3px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

.switch input:checked + .slider {
    background: #0a0a0a;
}

.switch input:checked + .slider::before {
    transform: translateX(16px);
}

.leads-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.leads-table th {
    text-align: left;
    color: #767676;
    font-weight: 600;
    padding: 8px 10px;
    border-bottom: 1px solid #e0e0e0;
}

.leads-table td {
    padding: 8px 10px;
    border-bottom: 1px solid #f0f0f0;
}

.leads-table a {
    color: #1a1a1a;
}

/* --- Live preview phone --- */

.preview-col {
    position: sticky;
    top: 32px;
}

.phone-frame {
    width: 320px;
    height: 640px;
    border: 10px solid #0a0a0a;
    border-radius: 40px;
    overflow: hidden;
    background: #ffffff;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.12);
    margin: 0 auto;
}

.phone-frame iframe {
    width: 100%;
    height: 100%;
    border: 0;
}

/* --- Login --- */

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: 100%;
    max-width: 360px;
}

.login-card h1 {
    font-size: 20px;
    margin-bottom: 16px;
}

.error {
    color: #cc3333;
    font-size: 14px;
    margin-bottom: 12px;
}
