/*
  Nectrus Experience Engine — shared design tokens for the "Presentation Pack"
  (Classic / Legal / Editorial) templates. Scoped under .nex-scope so these
  tokens never leak into the existing app chrome / ArcColours palette.
*/

.nex-scope {
    /* Brand */
    --nex-primary: #0E7F80;
    --nex-primary-contrast: #FFFFFF;

    /* Neutrals */
    --nex-white: #FFFFFF;
    --nex-bg: #F7F8F9;
    --nex-divider: #E5E7EB;
    --nex-text: #222222;
    --nex-text-secondary: #666666;
    --nex-text-muted: #999999;

    /* Radii */
    --nex-radius-card: 12px;
    --nex-radius-button: 10px;
    --nex-radius-image: 12px;

    /* Shadows */
    --nex-shadow-light: 0 4px 12px rgba(0, 0, 0, .08);
    --nex-shadow-hover: 0 10px 30px rgba(0, 0, 0, .12);

    /* Spacing (8pt grid) */
    --nex-space-sm: 8px;
    --nex-space-md: 16px;
    --nex-space-lg: 24px;
    --nex-space-section: 48px;
    --nex-space-hero: 72px;
    --nex-margin-desktop: 64px;
    --nex-margin-tablet: 32px;
    --nex-margin-mobile: 20px;

    /* Typography */
    --nex-font-primary: 'Inter', 'Segoe UI', Helvetica, Arial, sans-serif;
    --nex-h1: 48px;
    --nex-h2: 36px;
    --nex-h3: 28px;
    --nex-body: 18px;
    --nex-small: 15px;
    --nex-line-height: 1.6;

    font-family: var(--nex-font-primary);
    color: var(--nex-text);
    line-height: var(--nex-line-height);
}

.nex-scope h1, .nex-scope h2, .nex-scope h3 {
    font-family: var(--nex-font-primary);
    color: var(--nex-text);
}

.nex-scope h1 { font-size: var(--nex-h1); }
.nex-scope h2 { font-size: var(--nex-h2); }
.nex-scope h3 { font-size: var(--nex-h3); }
.nex-scope p, .nex-scope .nex-body { font-size: var(--nex-body); }
.nex-scope small, .nex-scope .nex-small { font-size: var(--nex-small); }

/* Shared card treatment */
.nex-scope .nex-card {
    background: var(--nex-white);
    border-radius: var(--nex-radius-card);
    box-shadow: var(--nex-shadow-light);
    transition: box-shadow .2s ease, transform .2s ease;
}

.nex-scope .nex-card:hover {
    box-shadow: var(--nex-shadow-hover);
}

    .nex-scope .nex-btn-primary {
        background: var(--nex-white);
        color: var(--nex-primary);
        border: 1.5px solid var(--nex-primary);
        border-radius: var(--nex-radius-button);
        min-height: 44px;
        padding: 0 var(--nex-space-lg);
        font-family: var(--nex-font-primary);
        transition: background .2s ease;
    }

.nex-scope .nex-btn-primary:hover {
    background: #0B6667;
    color: var(--nex-primary-contrast);
}

.nex-scope .nex-btn-secondary {
    background: var(--nex-white);
    color: var(--nex-primary);
    border: 1.5px solid var(--nex-primary);
    border-radius: var(--nex-radius-button);
    min-height: 44px;
    padding: 0 var(--nex-space-lg);
    font-family: var(--nex-font-primary);
    transition: background .2s ease, color .2s ease;
}

    .nex-scope .nex-btn-secondary:hover {
        background: #0B6667;
        color: var(--nex-primary-contrast);
    }

.nex-scope img {
    border-radius: var(--nex-radius-image);
}

/* Mobile behaviour shared across all templates */
@media (max-width: 767px) {
    .nex-scope {
        padding-left: var(--nex-margin-mobile);
        padding-right: var(--nex-margin-mobile);
    }

    .nex-scope .nex-row {
        flex-direction: column;
    }

    .nex-scope button, .nex-scope a.nex-btn-primary {
        min-height: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nex-scope * {
        animation: none !important;
        transition: none !important;
    }
}

/* NexAttachmentItem's eye icon: a real <a target="_blank"> on desktop (opens the file
   in a new browser tab, no in-page viewer), a modal-triggering <button> on mobile
   (a new tab is a poor experience there). Loaded globally (see _Layout.cshtml) since
   NexAttachmentItem is used both inside the Presentation Pack templates and directly
   in the candidate-facing profile pages. */
@media (min-width: 768px) {
    .nex-mobile-only { display: none !important; }
}

@media (max-width: 767px) {
    .nex-desktop-only { display: none !important; }
}

/* ── NexPopup — shared structural styles. Per-template skins (colour, font,
   animation) live in experience-engine-classic/legal/editorial.css ── */
.nex-popup-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .45);
    animation: nexPopupFadeIn 180ms ease;
}

.nex-popup-wrap {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.nex-popup-dialog {
    background: var(--nex-white);
    border-radius: var(--nex-radius-card);
    width: 500px;
    max-width: 95vw;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--nex-shadow-hover);
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    font-family: var(--nex-font-primary);
    color: var(--nex-text);
}

.nex-popup-dialog.nex-popup-sm { width: 320px; }
.nex-popup-dialog.nex-popup-lg { width: 800px; }
.nex-popup-dialog.nex-popup-xl { width: 1140px; }

.nex-popup-dialog.nex-popup-full {
    width: 100vw;
    max-width: 100vw;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
}

.nex-popup-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--nex-space-md) var(--nex-space-md) 0;
}

.nex-popup-btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    color: var(--nex-text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s ease, color .15s ease;
}

.nex-popup-btn-icon:hover {
    background: var(--nex-bg);
    color: var(--nex-text);
}

.nex-popup-icon-wrap {
    display: flex;
    justify-content: center;
    padding: var(--nex-space-sm) var(--nex-space-lg) 0;
}

.nex-popup-icon-img {
    width: 72px;
    height: 72px;
    object-fit: contain;
}

/* Category illustration icon shown before block/timeline item titles
   (BrandIcons override -> BioCategory.ImagePath -> default). Shared across
   all 3 skins so an unstyled <img> never renders at its native size. */
.nex-scope .nex-block-icon,
.nex-scope .nex-timeline-icon {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 50%;
    object-fit: fill;
    flex-shrink: 0;
}

/* Flat text block — Overview (no card box, just a label + description row).
   Shared across all 3 skins. */
.nex-scope .nex-block {
    margin-bottom: var(--nex-space-lg);
}

.nex-scope .nex-block:last-child {
    margin-bottom: 0;
}

.nex-scope .nex-block-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--nex-text);
    margin: 0 0 4px;
}

/* Icon + title sit on the same line before the Overview block title. */
.nex-scope .nex-block-head {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 0 0 4px;
}

.nex-scope .nex-block-head .nex-block-title {
    margin: 0;
}

/* Icon + title grouping inside a timeline head, so the pair counts as a
   single flex item next to the badge/dates on the other side of
   justify-content: space-between (Academic/Vocational Qualifications,
   Experience, same per-category illustration icons as the Visual template). */
.nex-scope .nex-timeline-title-group {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.nex-scope .nex-timeline-title-group .nex-timeline-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Groups the Grade badge with the Dates/University text on the other side of
   justify-content: space-between, so all three sit on one row instead of the
   badge and the date/venue text landing at different vertical positions. */
.nex-scope .nex-timeline-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.nex-scope .nex-block-desc {
    font-size: var(--nex-small);
    color: var(--nex-text-secondary);
    margin: 0;
    line-height: 1.5;
}

/* Clamps long free text to exactly 3 lines regardless of column/card width —
   paired with a "Read more"/"Show less" toggle (see .nex-read-more) that adds
   or removes this class, rather than character-count truncation which can
   still run to several lines depending on how narrow the container is. */
.nex-scope .nex-clamp-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Contact Hours indicator on a phone entry — matches the reference Visual
   template's clock icon (arc-green-400, #33B773) exactly, rather than a text
   badge, so the popup card doesn't spell out "Good time" inline. */
.nex-scope .nex-good-time-icon {
    color: #33B773;
    font-size: 13px;
}

.nex-popup-title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--nex-space-sm);
    padding: var(--nex-space-sm) var(--nex-space-lg) 0;
}

.nex-popup-title {
    font-size: var(--nex-h3);
    font-weight: 600;
    text-align: center;
    margin: 0;
    word-break: break-word;
}

.nex-popup-nav-arrow {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--nex-primary);
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 32px;
    min-height: 32px;
}

.nex-popup-nav-arrow:disabled {
    color: var(--nex-text-muted);
    cursor: default;
    opacity: .4;
}

.nex-popup-subtext {
    text-align: center;
    color: var(--nex-text-secondary);
    font-size: var(--nex-small);
    padding: 0 var(--nex-space-lg);
    margin-top: 4px;
}

.nex-popup-body {
    padding: var(--nex-space-md) var(--nex-space-lg) var(--nex-space-lg);
    flex: 1;
}

@keyframes nexPopupFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@media (max-width: 767px) {
    .nex-popup-dialog {
        width: 100%;
        max-width: 100vw;
        margin: 0 var(--nex-margin-mobile);
    }

    .nex-popup-btn-icon, .nex-popup-nav-arrow {
        width: 44px;
        height: 44px;
        min-width: 44px;
        min-height: 44px;
    }

    /* The close/back icon svg stays a fixed 18px even though the button
       grows to the 44px touch target above — without this it looks like a
       tiny X lost in the middle of a much bigger circle on phones. */
    .nex-popup-btn-icon svg {
        width: 20px;
        height: 20px;
    }
}

/* Section (Parent) illustration beside the popup title - Classic / Legal */
.nex-popup-title-icon {
    width: 40px;
    height: 40px;
    object-fit: contain;
    flex-shrink: 0;
}

/* Child illustration shown beside a highlighted entry (replaces the generic glyph) */
.nex-entry-img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    flex-shrink: 0;
}

.nex-entry-img-inline {
    margin-right: 8px;
    vertical-align: middle;
}
