/* ==========================================================================
   Capricon CMP — public pages (candidate application)
   Builds on auth-cmp.css (tokens, buttons, hexagons, reveal animations)
   ========================================================================== */

html:has(body.cmp-public), body.cmp-public { height: auto; }
body.cmp-public { background: #f3f4f7; min-height: 100vh; display: flex; flex-direction: column; }
body.cmp-public > * { flex-shrink: 0; }

/* ---------- Nav ---------- */

.cmp-nav {
    position: sticky; top: 0; z-index: 20;
    display: flex; align-items: center; justify-content: space-between;
    height: 76px;
    padding: 0 clamp(16px, 5vw, 72px);
    background: rgba(255, 255, 255, .88);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(0, 0, 0, .05);
}
.cmp-nav-brand img { height: 44px; width: auto; display: block; }

.cmp-btn-ghost {
    height: 42px; padding: 0 24px;
    border: 1.5px solid var(--cmp-orange);
    background: transparent;
    color: var(--cmp-orange);
}
.cmp-btn-ghost:hover { background: var(--cmp-orange); color: #fff; transform: translateY(-1px); }

/* ---------- Hero band ---------- */

.cmp-hero-band {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    padding: 72px 16px 168px;
    background: radial-gradient(110% 120% at 50% 0%, #2b2d33 0%, var(--cmp-ink-2) 60%, #0d0e11 100%);
    color: #fff;
    text-align: center;
}
.cmp-hero-band .cmp-hex { opacity: 0; animation: cmp-fade 1.6s ease forwards; animation-delay: var(--d, .2s); }

.b1 { width: 170px; top: -40px; right: 14%;  --depth: 18px; --dur: 10s; }
.b2 { width: 260px; top: 30px;  right: -60px; --depth: 12px; --dur: 12s; --delay: -3s; --sw: 2; }
.b3 { width: 90px;  top: 150px; right: 20%;  --depth: 28px; --dur: 8s;  --delay: -1s; }
.b4 { width: 300px; bottom: -110px; left: -90px; --depth: 14px; --dur: 13s; --sw: 2; }
.b5 { width: 120px; bottom: 40px; left: 12%; --depth: 24px; --dur: 9s; --delay: -4s; }

.cmp-hero-inner { position: relative; max-width: 760px; margin: 0 auto; }

.cmp-pill {
    display: inline-block;
    padding: 7px 16px;
    margin-bottom: 22px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--cmp-orange), var(--cmp-orange-2));
    box-shadow: 0 10px 24px -10px rgba(255, 106, 0, .8);
    font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
    color: #fff;
}
.cmp-hero-band h1 {
    margin: 0 0 14px;
    font-size: clamp(32px, 5vw, 56px);
    font-weight: 800;
    letter-spacing: -.025em;
    line-height: 1.08;
    color: #fff;
}
.cmp-hero-band h1 .w { display: inline-block; }
.cmp-hero-band h1 .accent {
    background: linear-gradient(90deg, var(--cmp-orange), #ffb067, var(--cmp-orange));
    background-size: 200% 100%;
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
    animation: cmp-shimmer 4s linear infinite;
}
.cmp-hero-band p { margin: 0; font-size: 17px; color: rgba(255, 255, 255, .72); }

/* ---------- Form card ---------- */

.cmp-page { flex: 1; padding: 0 16px; }

.cmp-sheet {
    position: relative;
    z-index: 2;
    max-width: 920px;
    margin: -120px auto 0;
    padding: clamp(24px, 4vw, 48px);
    border-radius: 24px;
    background: #fff;
    box-shadow: 0 40px 80px -40px rgba(21, 22, 26, .35), 0 2px 6px rgba(21, 22, 26, .04);
}

.cmp-section + .cmp-section { margin-top: 40px; }

.cmp-section-head { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.cmp-section-head .cmp-card-ico { margin: 0; width: 44px; height: 44px; }
.cmp-section-head .cmp-card-ico svg { width: 22px; height: 22px; color: #fff; }
.cmp-section-head h2 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -.01em; color: var(--cmp-ink); }
.cmp-section-head p { margin: 2px 0 0; font-size: 13px; color: var(--cmp-muted); }

.cmp-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px 20px; }
.cmp-grid .span-2 { grid-column: span 2; }

.cmp-public .cmp-field { margin: 0; }

.cmp-label {
    display: block;
    margin: 0 0 8px 6px;
    font-size: 13px; font-weight: 600;
    color: var(--cmp-ink);
}
.cmp-label .opt { font-weight: 400; color: var(--cmp-muted); }

.cmp-control { position: relative; }
.cmp-control .cmp-ico {
    position: absolute; left: 18px; top: 50%;
    width: 20px; height: 20px;
    transform: translateY(-50%);
    color: #9a9fad;
    transition: color .25s;
    pointer-events: none;
}
.cmp-control:focus-within .cmp-ico { color: var(--cmp-orange); }

.cmp-public .cmp-input { height: 54px; padding: 0 20px 0 50px; }

select.cmp-input {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 48px;
    cursor: pointer;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7080' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 18px center;
    background-size: 18px;
}
select.cmp-input:invalid, select.cmp-input option[value=""] { color: #9a9fad; }
select.cmp-input option { color: var(--cmp-ink); }

/* hide number spinners on phone fields */
.cmp-public input[type=number]::-webkit-outer-spin-button,
.cmp-public input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.cmp-public input[type=number] { -moz-appearance: textfield; }

/* country code + mobile in one pill */
.cmp-phone {
    display: flex;
    height: 54px;
    border: 1.5px solid var(--cmp-line);
    border-radius: 999px;
    background: var(--cmp-field);
    transition: border-color .25s, box-shadow .25s, background .25s;
}
.cmp-phone:focus-within {
    background: #fff;
    border-color: var(--cmp-orange);
    box-shadow: 0 0 0 4px var(--cmp-orange-soft), 0 10px 24px -12px rgba(255, 106, 0, .55);
}
.cmp-phone .cmp-input {
    height: 100%;
    border: 0; border-radius: 0;
    background: transparent;
    box-shadow: none !important;
}
.cmp-phone .cc { position: relative; flex: 0 0 132px; border-right: 1.5px solid var(--cmp-line); }
.cmp-phone .cc .plus {
    position: absolute; left: 48px; top: 50%;
    transform: translateY(-50%);
    color: var(--cmp-muted); font-weight: 600;
    pointer-events: none;
}
.cmp-phone .cc .cmp-input { padding-left: 62px; padding-right: 8px; }
.cmp-phone .num { flex: 1; }
.cmp-phone .num .cmp-input { padding-left: 18px; }

.cmp-help { margin: 8px 0 0 8px; font-size: 13px; color: var(--cmp-muted); }

/* jquery-validate */
.cmp-public label.error { display: block; margin: 6px 0 0 8px; font-size: 13px; color: #e5484d; }
.cmp-public .cmp-input.error { border-color: #e5484d; }
.cmp-phone:has(.cmp-input.error) { border-color: #e5484d; }

/* footer of card */
.cmp-sheet-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 20px;
    margin-top: 40px; padding-top: 28px;
    border-top: 1px solid var(--cmp-line);
}
.cmp-sheet-foot p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--cmp-muted); }
.cmp-sheet-foot p a { color: var(--cmp-ink); font-weight: 600; text-decoration: none; }
.cmp-sheet-foot p a:hover { color: var(--cmp-orange); }
.cmp-sheet-foot .cmp-btn-primary { width: auto; padding: 0 30px; }
.cmp-sheet-foot .cmp-btn-primary .arrow { width: 18px; height: 18px; transition: transform .3s var(--cmp-ease); }
.cmp-sheet-foot .cmp-btn-primary:hover .arrow { transform: translateX(4px); }
.cmp-sheet-foot .cmp-btn-primary.is-loading .arrow { display: none; }

/* flash messages from partials.validation_errors */
.cmp-flash .row { margin: 0 0 24px !important; }
.cmp-flash .col-lg-10 { width: 100%; padding: 0; }
.cmp-flash .col-lg-1 { display: none; }
.cmp-flash .alert { border-radius: 16px; }

/* ---------- Searchable select (Select2) ---------- */

.cmp-control .cmp-ico { z-index: 2; }
.cmp-public .select2-container { display: block; }
.cmp-public .select2-container--default .select2-selection--single {
    height: 54px;
    border: 1.5px solid var(--cmp-line);
    border-radius: 999px;
    background: var(--cmp-field);
    outline: none;
    transition: border-color .25s, box-shadow .25s, background .25s;
}
.cmp-public .select2-container--default .select2-selection--single .select2-selection__rendered {
    padding: 0 48px 0 50px;
    line-height: 51px;
    font-size: 15px;
    color: var(--cmp-ink);
}
.cmp-public .select2-container--default .select2-selection--single .select2-selection__placeholder { color: #9a9fad; }
.cmp-public .select2-container--default .select2-selection--single .select2-selection__arrow {
    top: 0; right: 18px;
    width: 18px; height: 100%;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b7080' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") center / 18px no-repeat;
    transition: transform .25s var(--cmp-ease);
}
.cmp-public .select2-container--default .select2-selection--single .select2-selection__arrow b { display: none; }
.cmp-public .select2-container--open .select2-selection--single .select2-selection__arrow { transform: rotate(180deg); }
.cmp-public .select2-container--focus .select2-selection--single,
.cmp-public .select2-container--open .select2-selection--single {
    background: #fff;
    border-color: var(--cmp-orange);
    box-shadow: 0 0 0 4px var(--cmp-orange-soft), 0 10px 24px -12px rgba(255, 106, 0, .55);
}
.cmp-control:has(.select2-container--open) .cmp-ico,
.cmp-control:has(.select2-container--focus) .cmp-ico { color: var(--cmp-orange); }
.cmp-control:has(select.error) .select2-selection--single { border-color: #e5484d; }

/* dropdown panel (appended to body) */
.cmp-public .select2-dropdown {
    margin-top: 8px;
    border: 1px solid var(--cmp-line);
    border-radius: 18px !important;
    overflow: hidden;
    box-shadow: 0 24px 48px -20px rgba(21, 22, 26, .35);
    animation: cmp-drop .22s var(--cmp-ease);
}
.cmp-public .select2-dropdown--above { margin-top: -8px; }
.cmp-public .select2-search--dropdown { padding: 12px; }
.cmp-public .select2-search--dropdown .select2-search__field {
    height: 44px;
    padding: 0 16px 0 42px;
    border: 1.5px solid var(--cmp-line);
    border-radius: 999px;
    background: var(--cmp-field) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239a9fad' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") 16px center / 18px no-repeat;
    font-size: 14px;
    outline: none;
}
.cmp-public .select2-search--dropdown .select2-search__field:focus { border-color: var(--cmp-orange); background-color: #fff; }
.cmp-public .select2-results__options { padding: 0 8px 8px; }
.cmp-public .select2-results > .select2-results__options { max-height: 280px; }
.cmp-public .select2-results__option {
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    color: var(--cmp-ink);
}
.cmp-public .select2-container--default .select2-results__option--highlighted.select2-results__option--selectable {
    background: var(--cmp-orange-soft);
    color: var(--cmp-orange);
}
.cmp-public .select2-container--default .select2-results__option--selected {
    background: var(--cmp-orange);
    color: #fff;
}
.cmp-public .select2-results__option--disabled[role=option]:first-child:empty { display: none; }
.cmp-public .select2-results__message { color: var(--cmp-muted); }

@keyframes cmp-drop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }

/* ---------- Policy pages ---------- */

.cmp-doc {
    position: relative; z-index: 2;
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 28px;
    max-width: 1160px;
    margin: -120px auto 0;
    align-items: start;
}
.cmp-doc .cmp-sheet { margin: 0; max-width: none; }

.cmp-toc {
    position: sticky; top: 100px;
    margin-top: 150px;
    padding: 22px 18px;
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 24px 48px -30px rgba(21, 22, 26, .35);
}
.cmp-toc-title {
    display: block; margin: 0 0 12px 10px;
    font-size: 11px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase;
    color: var(--cmp-muted);
}
.cmp-toc ol { list-style: none; margin: 0; padding: 0; }
.cmp-toc ol a {
    display: block;
    padding: 8px 10px;
    border-left: 2px solid transparent;
    border-radius: 0 8px 8px 0;
    font-size: 13.5px; line-height: 1.35;
    color: var(--cmp-ink);
    text-decoration: none;
    transition: color .2s, background .2s, border-color .2s;
}
.cmp-toc ol a:hover { color: var(--cmp-orange); }
.cmp-toc ol a.is-active { border-left-color: var(--cmp-orange); background: var(--cmp-orange-soft); color: var(--cmp-orange); font-weight: 600; }

.cmp-toc-switch { display: flex; flex-direction: column; gap: 6px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--cmp-line); }
.cmp-toc-switch a {
    padding: 9px 14px;
    border-radius: 999px;
    font-size: 13px; font-weight: 600;
    color: var(--cmp-muted);
    text-decoration: none;
    transition: color .2s, background .2s;
}
.cmp-toc-switch a:hover { color: var(--cmp-ink); background: var(--cmp-field); }
.cmp-toc-switch a.is-active { color: #fff; background: var(--cmp-ink); }

.cmp-doc-meta {
    display: inline-block;
    margin: 0 0 8px;
    padding: 6px 14px;
    border-radius: 999px;
    background: var(--cmp-field);
    font-size: 13px; color: var(--cmp-muted);
}
.cmp-doc-section { padding: 28px 0; border-bottom: 1px solid var(--cmp-line); scroll-margin-top: 100px; }
.cmp-doc-section:last-child { border-bottom: 0; padding-bottom: 0; }
.cmp-doc-section h2 {
    display: flex; align-items: baseline; gap: 14px;
    margin: 0 0 14px;
    font-size: 21px; font-weight: 700; letter-spacing: -.01em;
    color: var(--cmp-ink);
}
.cmp-doc-section h2 .num { font-size: 14px; font-weight: 800; color: var(--cmp-orange); font-variant-numeric: tabular-nums; }
.cmp-doc-section p { margin: 0 0 12px; font-size: 16px; line-height: 1.75; color: #3d414b; }
.cmp-doc-section p:last-child { margin-bottom: 0; }
.cmp-doc-section a { color: var(--cmp-orange); text-decoration: none; font-weight: 600; }
.cmp-doc-section a:hover { text-decoration: underline; }
.cmp-doc-thanks {
    margin-top: 20px !important;
    padding: 18px 20px;
    border-left: 3px solid var(--cmp-orange);
    border-radius: 0 14px 14px 0;
    background: var(--cmp-orange-soft);
}

@media (max-width: 991.98px) {
    .cmp-doc { grid-template-columns: 1fr; margin-top: -100px; }
    .cmp-toc { display: none; }
}

/* ---------- Page footer ---------- */

.cmp-page-foot {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 18px;
    padding: 40px 16px 32px;
    font-size: 13px; color: var(--cmp-muted);
}
.cmp-page-foot a { color: var(--cmp-muted); text-decoration: none; }
.cmp-page-foot a:hover { color: var(--cmp-orange); }

/* ---------- Responsive ---------- */

@media (max-width: 767.98px) {
    .cmp-nav { height: 64px; }
    .cmp-nav-brand img { height: 34px; }
    .cmp-hero-band { padding: 48px 16px 140px; }
    .cmp-grid { grid-template-columns: 1fr; }
    .cmp-grid .span-2 { grid-column: auto; }
    .cmp-sheet { margin-top: -100px; border-radius: 20px; }
    .cmp-sheet-foot { flex-direction: column-reverse; align-items: stretch; text-align: center; }
    .cmp-sheet-foot .cmp-btn-primary { width: 100%; }
    .b1, .b3 { display: none; }
}
