/* Noorology Clients Portal — public client portal styles.
   Light mode only. Purple, white, black. */

:root {
    --c-primary:        #6D28D9;
    --c-primary-hover:  #5B21B6;
    --c-secondary:      #8B5CF6;
    --c-soft:           #F5F3FF;
    --c-soft-2:         #EDE9FE;
    --c-text:           #111111;
    --c-text-2:         #555555;
    --c-muted:          #6B7280;
    --c-border:         #E5E7EB;
    --c-bg:             #FFFFFF;
    --c-error:          #DC2626;
    --radius:           10px;
    --radius-lg:        16px;
    --font-body:        'Poppins', system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-head:        'Playfair Display', Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font-body); color: var(--c-text); background: var(--c-bg); line-height: 1.65; -webkit-font-smoothing: antialiased; }

a { color: var(--c-primary); text-decoration: none; }
a:hover { color: var(--c-primary-hover); text-decoration: underline; }

h1, h2, h3 { font-family: var(--font-head); color: var(--c-text); margin: 0 0 .5em; line-height: 1.2; }
h1 { font-size: clamp(32px, 5vw, 52px); font-weight: 600; }
h2 { font-size: clamp(24px, 3vw, 32px); font-weight: 600; }
h3 { font-size: 18px; font-family: var(--font-body); font-weight: 600; }

p { margin: 0 0 1em; color: var(--c-text-2); }
.muted { color: var(--c-muted); }

/* Topbar — large, centered logo, always-visible white bar */
.portal-topbar {
    display: flex; align-items: center; justify-content: center;
    padding: 22px 24px;
    background: #fff;
    position: sticky; top: 0; z-index: 20;
    border-bottom: 1px solid var(--c-border);
    box-shadow: 0 2px 0 -1px var(--c-soft);
}
.portal-body.has-cover .portal-topbar {
    /* When a cover image is set, the topbar stays as a solid white bar —
       the cover image now starts BELOW the topbar instead of behind it,
       so the brand is always clearly visible. */
    background: #fff;
    color: var(--c-text);
}
.portal-brand {
    display: inline-flex; align-items: center; gap: 10px;
    color: var(--c-text); font-weight: 600; font-family: var(--font-head);
    text-decoration: none;
}
.portal-brand:hover { text-decoration: none; color: var(--c-text); }
.portal-body.has-cover .portal-brand { color: var(--c-text); }
.portal-body.has-cover .portal-brand:hover { color: var(--c-primary); }
.portal-brand-logo {
    height: 64px; width: auto; display: block;
    max-width: 320px;
}
.brand-dot-fallback {
    display: inline-flex; align-items: center; justify-content: center;
    background: linear-gradient(135deg, var(--c-primary), var(--c-secondary));
    color: #fff;
    border-radius: 50%;
    font-family: var(--font-head);
    font-weight: 600;
    aspect-ratio: 1 / 1;
}
.portal-tagline { color: var(--c-muted); font-size: 13px; }

/* Hero — tall, centered, parallax + cross-fade slideshow */
.portal-hero {
    min-height: 80vh;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    position: relative;
    overflow: hidden;
    isolation: isolate;
}
/* Stacked image layers. The container is translated on scroll (--py, set by
   JS) for parallax; each slide cross-fades + slowly zooms (Ken Burns). */
.portal-hero-slides {
    position: absolute; inset: -20% 0 -20% 0;
    z-index: -1;
    transform: translate3d(0, var(--py, 0), 0);
    will-change: transform;
}
.portal-hero-slide {
    position: absolute; inset: 0;
    background-size: cover; background-position: center;
    opacity: 0;
    transition: opacity 1.6s ease-in-out;
    animation: hero-kenburns 20s ease-in-out infinite alternate;
}
.portal-hero-slide.is-active { opacity: 1; }
@keyframes hero-kenburns {
    from { transform: scale(1.03); }
    to   { transform: scale(1.12); }
}
@media (prefers-reduced-motion: reduce) {
    .portal-hero-slide { animation: none; transition: none; }
}
.portal-hero-overlay {
    width: 100%;
    background: linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,.25) 50%, rgba(0,0,0,.65) 100%);
    padding: 120px 24px 80px;
    display: flex; align-items: center; justify-content: center;
    min-height: 80vh;
}
.portal-hero-inner {
    max-width: 880px; margin: 0 auto;
    text-align: center;
    /* Subtle fade-up entrance */
    animation: hero-fade-up 0.9s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes hero-fade-up {
    from { opacity: 0; transform: translateY(20px); }
    to   { opacity: 1; transform: translateY(0); }
}
.portal-hero-plain {
    background: linear-gradient(180deg, var(--c-soft) 0%, #fff 100%);
    color: var(--c-text);
    padding: 120px 24px 96px;
    min-height: 70vh;
    display: flex; align-items: center; justify-content: center;
}
.eyebrow {
    text-transform: uppercase; letter-spacing: 3px;
    color: #fff; font-size: 12px; font-weight: 600;
    margin: 0 0 16px;
    opacity: .9;
}
.portal-hero-plain .eyebrow { color: var(--c-primary); }
.portal-hero h1, .portal-hero-plain h1 {
    color: inherit; margin: 0 0 12px;
    font-size: clamp(40px, 6vw, 64px);
    line-height: 1.05;
    letter-spacing: -0.02em;
    text-shadow: 0 2px 20px rgba(0,0,0,.25);
}
.portal-hero-plain h1 { text-shadow: none; }
.hero-client {
    color: inherit; opacity: .9; margin: 0 0 8px;
    font-size: clamp(16px, 1.6vw, 20px);
    font-family: var(--font-head);
    font-style: italic;
    text-shadow: 0 1px 8px rgba(0,0,0,.3);
}
.hero-date  {
    color: inherit; opacity: .85; margin: 8px 0 0;
    font-size: 14px;
    text-shadow: 0 1px 6px rgba(0,0,0,.3);
}
.hero-date i { margin-right: 6px; }

/* Nav — uses the portal's chosen theme colour */
.portal-nav {
    display: flex; justify-content: center; gap: 22px;
    padding: 14px 24px;
    background: var(--c-primary); border-bottom: 1px solid rgba(0,0,0,.08);
    position: sticky; top: 108px; z-index: 9;
    overflow-x: auto;
}
.portal-nav a {
    color: rgba(255,255,255,.88); font-size: 14px; font-weight: 500;
    padding: 6px 4px;
    white-space: nowrap;
}
.portal-nav a:hover { color: #fff; text-decoration: none; }

/* Content */
.portal-content {
    max-width: 880px; margin: 0 auto;
    padding: 48px 24px;
}
.portal-section { padding: 32px 0; border-bottom: 1px solid var(--c-border); }
.portal-section:last-child { border-bottom: none; }
.lead { font-size: 18px; color: var(--c-text-2); }
.welcome-note {
    background: var(--c-soft);
    border-left: 4px solid var(--c-primary);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-top: 20px;
    color: var(--c-text);
}

/* Empty placeholder card */
.portal-empty { padding: 48px 0; }
.empty-card {
    text-align: center;
    background: #fff;
    border: 1px dashed var(--c-border-strong);
    border-radius: var(--radius-lg);
    padding: 48px 24px;
    color: var(--c-text-2);
}
.empty-card i {
    font-size: 40px;
    color: var(--c-primary);
    margin-bottom: 12px;
    display: inline-block;
}
.empty-card h2 { margin: 0 0 8px; }
.empty-card p { margin: 0; max-width: 460px; margin-left: auto; margin-right: auto; }

.portal-socials { display: flex; gap: 12px; margin-top: 12px; }
.portal-socials a {
    display: inline-flex; align-items: center; justify-content: center;
    width: 38px; height: 38px; border-radius: 50%;
    background: var(--c-soft); color: var(--c-primary);
    transition: background .12s ease, color .12s ease;
}
.portal-socials a:hover { background: var(--c-primary); color: #fff; text-decoration: none; }

/* Footer */
.portal-footer {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 24px;
    border-top: 1px solid var(--c-border);
    background: var(--c-bg);
    font-size: 13px; color: var(--c-text-2);
    flex-wrap: wrap; gap: 8px;
}

/* Buttons (used on state cards) */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 10px 16px;
    border-radius: var(--radius);
    font: inherit; font-size: 14px; font-weight: 500;
    border: 1px solid transparent; cursor: pointer;
    text-decoration: none;
}
.btn-primary { background: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-hover); color: #fff; text-decoration: none; }
.btn-ghost { background: transparent; color: var(--c-text); border-color: var(--c-border-strong); }
.btn-ghost:hover { background: var(--c-soft); border-color: var(--c-primary); color: var(--c-primary); text-decoration: none; }
.btn-block { display: flex; width: 100%; }

/* State screens (PIN, not-found, expired) */
.portal-state {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 32px 16px;
    background:
        radial-gradient(1200px 600px at 50% -200px, var(--c-soft) 0%, transparent 60%),
        var(--c-bg);
}
.state-card {
    max-width: 440px;
    background: #fff; border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    padding: 36px 28px;
    text-align: center;
    box-shadow: 0 12px 32px rgba(17,17,17,.06);
}
.state-card i {
    display: inline-flex; align-items: center; justify-content: center;
    width: 56px; height: 56px; border-radius: 50%;
    background: var(--c-soft); color: var(--c-primary);
    font-size: 22px; margin-bottom: 16px;
}
.state-card h1 { font-size: 22px; margin: 0 0 6px; }
.state-card p { margin: 0 0 16px; }

.pin-card { max-width: 420px; }
.pin-form { display: grid; gap: 14px; margin-top: 8px; }
.pin-form label { text-align: left; }
.pin-form label > span {
    display: block; font-size: 13px; color: var(--c-text);
    margin-bottom: 6px; font-weight: 500;
}
.pin-form input {
    width: 100%; padding: 12px 14px;
    border: 1px solid var(--c-border-strong);
    border-radius: var(--radius);
    font: inherit; font-size: 18px; text-align: center; letter-spacing: 4px;
    color: var(--c-text); background: #fff;
}
.pin-form input:focus {
    outline: none; border-color: var(--c-primary);
    box-shadow: 0 0 0 3px rgba(109,40,217,.15);
}

.flash {
    border-radius: var(--radius);
    padding: 10px 14px; margin-bottom: 14px;
    font-size: 14px; border: 1px solid transparent;
}
.flash-error { background: #FEF2F2; color: #991B1B; border-color: #FECACA; }

/* Mobile */
@media (max-width: 600px) {
    .portal-tagline { display: none; }
    .portal-topbar { padding: 16px 16px 20px; }
    .portal-brand-logo { height: 48px; max-width: 220px; }
    .portal-hero {
        min-height: 75vh;
        background-attachment: scroll; /* iOS/Android: parallax via JS only */
    }
    .portal-hero-overlay { padding: 80px 16px 56px; min-height: 75vh; }
    .portal-hero-plain { padding: 72px 16px 64px; min-height: 60vh; }
    .portal-nav { gap: 16px; padding: 12px 16px; top: 84px; }
    .portal-content { padding: 32px 16px; }
    .portal-section { padding: 24px 0; }
    .link-grid { grid-template-columns: 1fr; }
}

/* External delivery link cards */
.link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 14px;
    margin-top: 16px;
}
.link-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px 18px;
    background: #fff;
    border: 1px solid var(--c-border);
    border-radius: var(--radius-lg);
    color: var(--c-text);
    text-decoration: none;
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.link-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(109,40,217,.10);
    border-color: var(--c-soft-2);
    text-decoration: none;
    color: var(--c-text);
}
.link-card-icon {
    width: 48px; height: 48px;
    display: flex; align-items: center; justify-content: center;
    background: var(--c-soft); color: var(--c-primary);
    border-radius: 12px;
    font-size: 20px;
    flex-shrink: 0;
}
.link-card-body { flex: 1; min-width: 0; }
.link-card-provider {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--c-muted);
    font-weight: 600;
    margin-bottom: 2px;
}
.link-card-title {
    font-family: var(--font-head);
    font-size: 18px;
    color: var(--c-text);
    margin: 0;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.link-card-desc {
    color: var(--c-text-2);
    font-size: 13px;
    margin-top: 2px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.link-card-cta {
    display: inline-flex; align-items: center; gap: 6px;
    background: var(--c-primary); color: #fff;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px; font-weight: 500;
    white-space: nowrap;
    flex-shrink: 0;
}
.link-card-cta i { font-size: 11px; }
.link-card:hover .link-card-cta { background: var(--c-primary-hover); }

/* iCloud and any custom/unknown provider keep a Font Awesome glyph on a coloured tile */
.link-card.provider-icloud .link-card-icon { background: #111; color: #fff; }

/* Brand-logo providers: clean white tile, the inline logo supplies the colour */
.link-card-icon-logo { background: #fff; border: 1px solid var(--c-border); padding: 9px; }
.link-card-icon svg  { width: 100%; height: 100%; display: block; }

/* Hosted photo galleries */
.gallery-block { margin-top: 28px; }
.gallery-block + .gallery-block { margin-top: 36px; }
.gallery-title {
    font-family: var(--font-head);
    font-size: 22px;
    margin: 0 0 4px;
    color: var(--c-text);
}
.gallery-grid {
    display: grid;
    gap: 6px;
    margin-top: 12px;
}
.gallery-layout-masonry {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 6px;
}
.gallery-layout-masonry .gallery-tile:nth-child(3n+1) { grid-row: span 28; }
.gallery-layout-masonry .gallery-tile:nth-child(3n+2) { grid-row: span 22; }
.gallery-layout-masonry .gallery-tile:nth-child(3n)   { grid-row: span 30; }
.gallery-layout-grid {
    grid-template-columns: repeat(2, 1fr);
}
.gallery-tile {
    display: block;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--c-soft);
    cursor: zoom-in;
    position: relative;
}
.gallery-tile img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform .3s ease, opacity .3s ease;
}
.gallery-tile:hover img { transform: scale(1.04); }

/* Lightbox */
.lightbox {
    position: fixed; inset: 0;
    background: rgba(17, 17, 17, .94);
    z-index: 1000;
    display: none;
    align-items: center; justify-content: center;
    flex-direction: column;
    padding: 32px;
}
.lightbox.is-open { display: flex; }
.lightbox-stage {
    flex: 1; min-height: 0;
    display: flex; align-items: center; justify-content: center;
    max-width: 100%; max-height: 100%;
}
.lightbox-stage img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 6px;
    box-shadow: 0 12px 48px rgba(0,0,0,.5);
}
.lightbox-caption {
    color: #fff; opacity: .85;
    margin-top: 16px;
    text-align: center;
    max-width: 720px;
    font-size: 14px;
}
.lightbox-close,
.lightbox-prev,
.lightbox-next,
.lightbox-download {
    position: absolute;
    background: rgba(255,255,255,.10);
    color: #fff;
    border: 1px solid rgba(255,255,255,.15);
    border-radius: 50%;
    width: 44px; height: 44px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 22px;
    text-decoration: none;
    transition: background .12s ease, transform .05s ease;
}
.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover,
.lightbox-download:hover { background: rgba(255,255,255,.20); }
.lightbox-close:active,
.lightbox-prev:active,
.lightbox-next:active { transform: scale(.95); }
.lightbox-close  { top: 18px; right: 18px; }
.lightbox-prev   { left: 18px; top: 50%; transform: translateY(-50%); }
.lightbox-prev:active { transform: translateY(-50%) scale(.95); }
.lightbox-next   { right: 18px; top: 50%; transform: translateY(-50%); }
.lightbox-next:active { transform: translateY(-50%) scale(.95); }
.lightbox-download {
    bottom: 24px; right: 24px;
    width: auto; height: 40px;
    border-radius: 999px;
    padding: 0 18px;
    font-size: 13px; font-weight: 500;
    gap: 6px;
}
.lightbox-download[hidden] { display: none; }

/* Drop-zone for admin uploads */
.dropzone {
    border: 2px dashed var(--c-border-strong);
    border-radius: var(--radius-lg);
    padding: 40px 24px;
    text-align: center;
    cursor: pointer;
    background: var(--c-bg-soft);
    transition: background .12s ease, border-color .12s ease;
    color: var(--c-text-2);
}
.dropzone:hover, .dropzone.is-drag {
    background: var(--c-soft);
    border-color: var(--c-primary);
    color: var(--c-primary);
}
.dropzone i { font-size: 32px; margin-bottom: 8px; display: block; }
.dropzone input[type="file"] { display: none; }
.upload-preview-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 8px;
    margin-top: 12px;
}
.upload-preview-item {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 8px;
    background: var(--c-bg-soft);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
}
.upload-preview-item img {
    width: 48px; height: 48px; object-fit: cover; border-radius: 6px;
}
.upload-preview-meta { flex: 1; min-width: 0; }

/* Image admin list */
.image-list { list-style: none; margin: 0; padding: 0; }
.image-item {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--c-border);
    background: #fff;
}
.image-item:last-child { border-bottom: none; }
.image-thumb {
    width: 72px; height: 56px;
    background: var(--c-soft);
    border-radius: var(--radius-sm, 6px);
    overflow: hidden;
    flex-shrink: 0;
}
.image-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.image-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.image-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; }

/* ---- Films / videos ---- */
.video-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
    margin-top: 18px;
}
.video-card {
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: 14px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(17,17,17,.04);
    transition: box-shadow .2s ease, transform .2s ease;
}
.video-card:hover { box-shadow: 0 10px 30px rgba(109,40,217,.10); transform: translateY(-2px); }
.video-card--featured { grid-column: 1 / -1; }
.video-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    overflow: hidden;
}
.video-frame iframe,
.video-frame video {
    position: absolute; inset: 0;
    width: 100%; height: 100%;
    border: 0; display: block;
    object-fit: cover;
    background: #000;
}
.video-yt { cursor: pointer; }
.video-poster { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.video-play {
    position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: 72px; height: 72px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    background: rgba(109,40,217,.92); color: #fff; font-size: 26px;
    box-shadow: 0 6px 24px rgba(0,0,0,.35);
    transition: background .2s ease, transform .2s ease;
    pointer-events: none;
}
.video-yt:hover .video-play { background: var(--c-primary); transform: translate(-50%, -50%) scale(1.06); }
.video-play i { margin-left: 4px; }
.video-card-body { padding: 16px 18px 18px; }
.video-card-title { font-size: 19px; margin: 0 0 6px; }
.video-card-desc { color: var(--c-text-2); font-size: 14px; margin: 0; white-space: pre-line; }
.video-download { margin-top: 12px; }

/* ---- Download center ---- */
.download-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    margin-top: 18px;
}
.download-card {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px 18px;
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: 14px;
    color: var(--c-text);
    box-shadow: 0 1px 2px rgba(17,17,17,.04);
    transition: box-shadow .2s ease, transform .2s ease, border-color .2s ease;
}
.download-card:hover {
    text-decoration: none;
    color: var(--c-text);
    border-color: var(--c-secondary);
    box-shadow: 0 10px 30px rgba(109,40,217,.10);
    transform: translateY(-2px);
}
.download-icon {
    width: 52px; height: 52px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 12px;
    background: var(--c-soft);
    color: var(--c-primary);
    font-size: 22px;
}
.download-body { flex: 1; min-width: 0; }
.download-cat { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--c-primary); font-weight: 600; }
.download-title { font-weight: 600; color: var(--c-text); margin-top: 2px; }
.download-desc { color: var(--c-text-2); font-size: 14px; margin-top: 2px; }
.download-meta { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 6px; color: var(--c-muted); font-size: 13px; }
.download-meta i { margin-right: 4px; }
.download-cta {
    flex-shrink: 0;
    align-self: center;
    background: var(--c-primary);
    color: #fff;
    border-radius: 999px;
    padding: 9px 16px;
    font-size: 14px; font-weight: 500;
    white-space: nowrap;
}
.download-card:hover .download-cta { background: var(--c-primary-hover); }

/* ---- Notes ---- */
.note-list { display: grid; gap: 16px; margin-top: 18px; }
.note-card {
    display: flex;
    gap: 16px;
    padding: 20px;
    background: var(--c-soft);
    border: 1px solid var(--c-border);
    border-left: 4px solid var(--c-primary);
    border-radius: 12px;
}
.note-icon {
    width: 40px; height: 40px;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    border-radius: 10px;
    background: #fff;
    color: var(--c-primary);
    font-size: 18px;
}
.note-body { flex: 1; min-width: 0; }
.note-title { font-size: 18px; margin: 2px 0 6px; }
.note-text { color: var(--c-text-2); font-size: 15px; line-height: 1.7; }

@media (max-width: 600px) {
    .gallery-layout-masonry, .gallery-layout-grid { grid-template-columns: 1fr; }
    .video-grid { grid-template-columns: 1fr; gap: 18px; }
    .video-play { width: 58px; height: 58px; font-size: 20px; }
    .download-grid { grid-template-columns: 1fr; }
    .download-card { flex-wrap: wrap; }
    .download-cta { width: 100%; text-align: center; }
    .lightbox-close, .lightbox-prev, .lightbox-next, .lightbox-download {
        width: 38px; height: 38px; font-size: 18px;
    }
}
