﻿/**
 * eCards browse + customise + success flow.
 * Loaded after site-base.css + card-viewer.css.
 */

.page-flow {
    padding-block: 1rem 2rem;
}

.page-heading {
    font-size: clamp(1.2rem, 2.5vw, 1.45rem);
    font-weight: 800;
    color: var(--theme-ink);
    margin: 0 0 0.75rem;
}

.category-bar {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--theme-line);
}

.category-bar a {
    padding: 0.35rem 0.85rem;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    color: var(--primary);
    background: rgba(230, 126, 115, 0.1);
    border: 1px solid transparent;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.category-bar a:hover {
    background: rgba(230, 126, 115, 0.18);
}

.category-bar a.active {
    background: var(--primary);
    color: #fff;
    border-color: transparent;
}

.page-stats {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.category-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    grid-auto-rows: 1fr;
    gap: 1rem;
    margin-top: 1rem;
}

.category-card {
    position: relative;
    min-height: 100px;
    text-decoration: none;
    color: inherit;
    border-radius: var(--radius-lg);
    transition: transform var(--transition-normal);
}

.category-card:nth-child(odd):hover {
    transform: rotate(-1.5deg) scale(1.02);
}

.category-card:nth-child(even):hover {
    transform: rotate(1.5deg) scale(1.02);
}

.category-bg {
    position: absolute;
    inset: 0;
    opacity: 0.35;
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, rgba(230, 126, 115, 0.18), rgba(106, 176, 184, 0.18));
    transition: opacity var(--transition-normal), transform var(--transition-normal);
    pointer-events: none;
}

.category-card:hover .category-bg {
    opacity: 0.5;
    transform: scale(1.02);
}

.category-content {
    position: relative;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border: 1px solid rgba(255, 255, 255, 0.85);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 24px rgba(125, 73, 92, 0.12);
    padding: 1.25rem 0.85rem;
    transition: box-shadow var(--transition-normal), border-color var(--transition-normal);
}

.category-card:hover .category-content {
    box-shadow: 0 14px 34px rgba(125, 73, 92, 0.18);
    border-color: rgba(255, 255, 255, 0.96);
}

.cat-icon {
    display: none;
}

.category-content h3 {
    color: var(--theme-ink);
    font-size: 1.45rem;
    line-height: 1.15;
    margin: 0;
}

.category-content p {
    display: none;
}

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1.25rem;
}

.item-card {
    background: var(--white);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: transform 0.2s, box-shadow 0.2s;
    text-decoration: none;
    color: inherit;
    display: block;
}

.item-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(137, 89, 106, 0.12);
}

.item-card-img {
    aspect-ratio: 3 / 4;
    background: var(--gray-100);
    overflow: hidden;
    position: relative;
}

.item-card-img img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.featured-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    background: var(--primary);
    color: #fff;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    text-transform: uppercase;
}

.item-card-body {
    padding: 0.7rem 0.85rem;
}

.item-card-title {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--theme-ink);
}

/* Customise: viewer + form */
.customize-layout {
    display: grid;
    gap: 2rem;
    grid-template-columns: 1fr;
    align-items: start;
}

@media (min-width: 768px) {
    .customize-layout {
        grid-template-columns: minmax(0, 3fr) minmax(280px, 2fr);
    }
}

.customize-layout > div {
    min-width: 0;
    width: 100%;
}

.customize-layout .mockup-controls {
    width: 100%;
    justify-content: center;
    box-sizing: border-box;
}

.custom-form {
    display: flex;
    flex-direction: column;
    width: 100%;
    background: var(--white);
    padding: 1.5rem;
    border-radius: 12px;
    border: 1px solid var(--theme-line);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.form-label {
    display: block;
    font-weight: 700;
    font-size: 0.85rem;
    margin-bottom: 0.35rem;
    color: var(--theme-ink);
}

.form-input,
.form-textarea {
    width: 100%;
    max-width: 100%;
    padding: 0.7rem 0.85rem;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    margin-bottom: 0.75rem;
    background: rgba(255, 255, 255, 0.95);
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

.form-input:focus,
.form-textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(230, 126, 115, 0.18);
}

.form-textarea {
    min-height: 88px;
    resize: vertical;
}

.char-count {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: right;
    margin-top: -0.4rem;
    margin-bottom: 0.75rem;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    background: linear-gradient(135deg, var(--primary), #d16a60);
    color: #fff;
    border: none;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    font-family: inherit;
    box-shadow: 0 4px 16px rgba(230, 126, 115, 0.35);
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.15s;
}

a.btn-primary {
    text-decoration: none;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(230, 126, 115, 0.42);
}

.btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: none;
    border: none;
    font-size: 0.9rem;
    color: var(--primary);
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 1rem;
    padding: 0;
    font-family: inherit;
}

.btn-back:hover {
    text-decoration: underline;
}

/* Success */
.success-panel {
    background: var(--white);
    border-radius: 12px;
    padding: 2rem 1.5rem;
    text-align: center;
    border: 1px solid var(--theme-line);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    max-width: 560px;
    margin: 0 auto;
}

.success-panel h2 {
    color: var(--theme-ink);
    margin-bottom: 0.5rem;
}

.success-rate-limit {
    font-size: 0.82rem;
    color: rgba(79, 54, 64, 0.72);
    line-height: 1.45;
    margin: 0 auto 0.75rem;
    max-width: 28rem;
}

.success-rate-limit[hidden] {
    display: none !important;
}

/* Created-card preview (first page) on success view */
.success-card-preview {
    margin: 0.5rem auto 1rem;
    max-width: 360px;
    width: 100%;
}

.success-card-preview-frame {
    width: 100%;
    aspect-ratio: 3 / 4;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--theme-line);
    background: #fff;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

.success-card-preview-frame img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.share-url-box {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.share-url-box input {
    flex: 1;
    min-width: 0;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.85rem;
    background: var(--gray-100);
}

.share-url-box button {
    padding: 0.65rem 1rem;
    border: 1px solid var(--primary);
    background: var(--primary);
    color: #fff;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    font-family: inherit;
    transition: filter 0.15s;
}

.share-url-box button:hover {
    filter: brightness(1.05);
}

.share-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.share-actions a,
.share-actions button {
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: none;
    border: 1.5px solid var(--gray-300);
    background: var(--white);
    color: var(--text-main);
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.15s, color 0.15s;
}

.share-actions a:hover,
.share-actions button:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.email-send-row {
    display: flex;
    gap: 0.5rem;
    margin: 1rem 0;
    flex-wrap: wrap;
}

.email-send-row input {
    flex: 1;
    min-width: 0;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--gray-300);
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.85rem;
}

.email-send-row button {
    padding: 0.65rem 1rem;
    border: none;
    background: var(--primary);
    color: #fff;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    font-family: inherit;
}

.status-msg {
    font-size: 0.85rem;
    margin-top: 0.5rem;
}

.status-msg.ok {
    color: #16a34a;
}

.status-msg.err {
    color: #dc2626;
}

.access-code-box {
    margin: 1.25rem 0;
    padding: 1rem;
    background: rgba(230, 126, 115, 0.08);
    border-radius: 8px;
    border: 1px dashed rgba(230, 126, 115, 0.4);
}

.access-code-box code {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.05em;
    word-break: break-all;
}

@media (max-width: 600px) {
    .card-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
        gap: 0.75rem;
    }
}

@media (max-width: 767px) {
    .category-grid {
        display: flex;
        gap: 0.85rem;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0.2rem 1rem 0.5rem 0.15rem;
        margin-inline: -0.15rem;
        scroll-snap-type: x mandatory;
        -webkit-overflow-scrolling: touch;
    }

    .category-grid {
        scrollbar-width: thin;
        scrollbar-color: rgba(185, 128, 138, 0.45) transparent;
    }
    .category-grid::-webkit-scrollbar { height: 6px; }
    .category-grid::-webkit-scrollbar-thumb {
        background: rgba(185, 128, 138, 0.45);
        border-radius: 999px;
    }

    .category-card {
        flex: 0 0 min(72vw, 240px);
        min-height: 200px;
        scroll-snap-align: start;
    }
}

/* Customise flow: mirror chosen background on <main> for small portrait (see effects.js) */
@media (max-width: 640px) and (orientation: portrait) {
    main.customise-page-backdrop-host.has-customise-page-bg {
        background-color: #f5f2f8;
    }

    main.customise-page-backdrop-host.has-customise-page-bg #customize-view .custom-form {
        background: rgba(255, 255, 255, 0.93);
        border-radius: var(--radius-lg, 12px);
        padding: 0.85rem 1rem;
        box-shadow: 0 2px 14px rgba(0, 0, 0, 0.07);
    }

    main.customise-page-backdrop-host.has-customise-page-bg #customize-view > h1.font-hand {
        text-shadow: 0 1px 3px rgba(255, 255, 255, 0.95), 0 0 12px rgba(255, 255, 255, 0.75);
    }

    main.customise-page-backdrop-host.has-customise-page-bg #customize-view > .btn-back {
        background: rgba(255, 255, 255, 0.88);
        border-radius: 999px;
        padding: 0.35rem 0.75rem;
        box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
    }
}

/* Dedicated extras browse pages (colouring / writing paper / posters) */
.extras-page-h1 {
    font-size: clamp(1.75rem, 4vw, 2.35rem);
    margin: 0 0 0.35rem;
    color: var(--theme-ink, var(--heading, #2d3a4a));
}

/* Extras hub — subhead / spacing (home.css ties .gallery-section-sub to #gallery-section only) */
.page-extras-hub .gallery-section-sub {
    font-size: 1.05rem;
    line-height: 1.5;
    color: rgba(79, 54, 64, 0.78);
    margin: 0.75rem auto 0;
    max-width: 40rem;
}

/* Extras hub — uniform with eCard/postcard category tiles */
.page-extras-hub .extras-hub-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-rows: 1fr;
    gap: 1rem 1.15rem;
    max-width: 640px;
    margin: 0 auto;
    padding: 0;
    list-style: none;
}

.page-extras-hub .extras-hub-grid > li {
    margin: 0;
    padding: 0;
    list-style: none;
    min-width: 0;
}

.page-extras-hub .extras-hub-grid .category-card {
    display: block;
    min-height: 100px;
    max-width: 200px;
    width: 100%;
    margin: 0 auto;
}

.page-extras-hub .extras-hub-grid .category-content {
    padding: 1.25rem 0.85rem;
    justify-content: center;
    min-height: 100%;
    border-color: rgba(222, 187, 176, 0.45);
    box-shadow: 0 10px 28px rgba(137, 89, 106, 0.12);
}

.page-extras-hub .extras-hub-grid .cat-icon {
    display: none;
}

.page-extras-hub .extras-hub-grid .category-content h3 {
    font-size: 1.45rem;
    line-height: 1.15;
    margin: 0;
}

.page-extras-hub .extras-hub-grid .category-content .text-sm {
    display: none;
}

@media (max-width: 720px) {
    .page-extras-hub .extras-hub-grid {
        grid-template-columns: 1fr;
        max-width: 220px;
        gap: 1rem;
    }

    .page-extras-hub .extras-hub-grid .category-card {
        max-width: none;
    }
}

@media (min-width: 721px) and (max-width: 1023px) {
    .page-extras-hub .extras-hub-grid {
        max-width: 560px;
        grid-template-columns: repeat(3, minmax(0, 168px));
        justify-content: center;
    }
}

@media (min-width: 1024px) {
    .page-extras-hub .extras-hub-grid {
        max-width: 720px;
        grid-template-columns: repeat(3, minmax(0, 200px));
        justify-content: center;
        gap: 1.25rem 1.5rem;
    }

    .page-extras-hub .extras-hub-grid .category-card {
        max-width: 200px;
    }
}

/* Filtered extras: HTML list of detail links (crawlable; complements JS gallery). */
.extras-filtered-seo-nav {
    margin: 0 0 1.25rem;
    padding: 0.75rem 1rem;
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.45);
    border: 1px solid var(--theme-line, rgba(0, 0, 0, 0.06));
}

.extras-filtered-seo-intro {
    margin: 0 0 0.5rem;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.extras-seo-item-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: 0.35rem 1.25rem;
    font-size: 0.9rem;
}

.extras-seo-item-list a {
    color: var(--primary, #c44);
    text-decoration: underline;
    text-underline-offset: 2px;
}
