/*
 * Student "Important Notice" — a sign hanging on a string from the top of every /c/ page
 * (templates/customer/_dashboard_notice.html.twig, dashboard_notice_controller.js).
 *   .bit-notice__sign  — drops down from above the screen (translate)
 *   .bit-notice__swing — swings around the hook at its top centre (rotate), then sways gently
 * Colors: a bright yellow-amber caution sign with dark text, pinned (not the org theme) so it
 * always stands out against the navy app chrome and a pale theme can't wash it out.
 */
.bit-notice {
    --bn-left: 0px; /* set by the controller: centres the signs over #mainContent, not the window */
    --bn-w: min(440px, calc(100vw - var(--bn-left) - 32px));
    --bn-sun: #fde047;   /* bright yellow */
    --bn-amber: #f59e0b; /* amber */
    --bn-ink: #3b1d00;   /* text on the yellow */
    --bn-string: #8a6a3f;
}

/* ---------- the sign ---------- */
.bit-notice__sign {
    position: fixed;
    top: 0;
    left: var(--bn-left);
    right: 0;
    margin: 0 auto;
    width: var(--bn-w);
    z-index: 1040; /* above page chrome, below Bootstrap modals (1055) */
    transform: translateY(-115%);
    visibility: hidden;
    /* own compositor layer, so its motion never repaints the page under it */
    will-change: transform;
    pointer-events: none;
    /* putting it away: lift straight up */
    transition: transform .45s cubic-bezier(.5, 0, .75, 0), visibility 0s linear .45s;
}
.bit-notice.is-open .bit-notice__sign {
    transform: translateY(0);
    visibility: visible;
    pointer-events: auto;
    transition: none;
    animation: bit-notice-drop .85s cubic-bezier(.3, 1.3, .55, 1) both;
}
@keyframes bit-notice-drop {
    0%   { transform: translateY(-115%); }
    70%  { transform: translateY(14px); }
    85%  { transform: translateY(-4px); }
    100% { transform: translateY(0); }
}

.bit-notice__swing {
    position: relative;
    will-change: transform;
    padding-top: 90px; /* room for the string: the sign hangs well below the top edge */
    transform-origin: 50% 4px; /* the hook */
}
.bit-notice.is-open .bit-notice__swing {
    /* big swing as it lands, dying down, then two slow sways and it hangs still.
       Never infinite: a never-ending animation over the frosted (backdrop-filter) hero
       buttons and task cards made Chrome repaint them every frame, and they flickered. */
    animation:
        bit-notice-swing 3.4s cubic-bezier(.36, .07, .19, .97) .55s both,
        bit-notice-sway 5.5s ease-in-out 3.95s 2;
}
@keyframes bit-notice-swing {
    0%   { transform: rotate(0deg); }
    12%  { transform: rotate(7deg); }
    28%  { transform: rotate(-5.5deg); }
    44%  { transform: rotate(4deg); }
    60%  { transform: rotate(-2.6deg); }
    76%  { transform: rotate(1.5deg); }
    90%  { transform: rotate(-.8deg); }
    100% { transform: rotate(0deg); }
}
@keyframes bit-notice-sway {
    0%, 100% { transform: rotate(0deg); }
    25%      { transform: rotate(1.1deg); }
    75%      { transform: rotate(-1.1deg); }
}

/* hook and string */
.bit-notice__rig { /* drawn over the board's top edge so each string ends in its eyelet */
    position: absolute;
    top: 0;
    left: 0;
    z-index: 3;
    width: 100%;
    height: 102px; /* 90px of string + 12px down to the eyelet centres */
    overflow: visible;
    pointer-events: none;
}
.bit-notice__rig line {
    stroke: var(--bn-string);
    stroke-width: 2;
    stroke-linecap: round;
}
.bit-notice__hook {
    position: absolute;
    z-index: 4;
    top: -2px;
    left: 50%;
    width: 14px;
    height: 14px;
    margin-left: -7px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #f8fafc, #94a3b8 60%, #475569);
    box-shadow: 0 2px 4px rgba(0, 0, 0, .35);
}

/* the board */
.bit-notice__board {
    position: relative;
    display: flex;
    flex-direction: column;
    max-height: min(70vh, 560px);
    background: rgba(255, 255, 255, .97);
    border: 3px solid var(--bn-amber);
    border-radius: 16px;
    box-shadow: 0 22px 44px rgba(17, 42, 84, .35), 0 4px 10px rgba(17, 42, 84, .18),
                0 0 0 4px rgba(253, 224, 71, .45);
    color: #12233b;
    overflow: hidden;
}
/* where the string ties on: two eyelets in the top corners */
.bit-notice__eyelet {
    position: absolute;
    top: 7px;
    z-index: 2;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
    border: 2px solid var(--bn-string);
}
.bit-notice__eyelet--l { left: calc(12% - 5px); }
.bit-notice__eyelet--r { right: calc(12% - 5px); }

.bit-notice__hd {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 22px 12px 12px 16px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .45), rgba(255, 255, 255, 0) 55%),
        linear-gradient(135deg, var(--bn-sun), var(--bn-amber));
    color: var(--bn-ink);
}
.bit-notice__ico {
    width: 34px; height: 34px; flex: 0 0 auto;
    display: grid; place-items: center;
    border-radius: 10px;
    background: rgba(255, 255, 255, .55);
    border: 1px solid rgba(255, 255, 255, .8);
    color: var(--bn-ink);
}
.bit-notice__hd-txt { flex: 1; min-width: 0; text-align: center; } /* "IMPORTANT NOTICE" + title centred between the icon and the X */
.bit-notice__kicker {
    display: block;
    font-size: .66rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    opacity: .85;
    line-height: 1.2;
}
.bit-notice__hd h2 {
    margin: 1px 0 0;
    overflow-wrap: anywhere;
    font-size: 1.05rem !important;
    font-weight: 600 !important;
    color: var(--bn-ink) !important;
    line-height: 1.25;
    letter-spacing: .01em;
}
.bit-notice__x {
    width: 32px; height: 32px; flex: 0 0 auto;
    border: 0; border-radius: 9px;
    background: transparent; color: var(--bn-ink);
}
.bit-notice__x:hover { background: rgba(255, 255, 255, .5); }

/* the message: TinyMCE HTML, evened out so it reads as part of the sign */
.bit-notice__body {
    padding: 14px 16px;
    overflow-y: auto;
    font-size: .92rem;
    line-height: 1.55;
    color: #12233b;
}
.bit-notice__body > :first-child { margin-top: 0; }
.bit-notice__body > :last-child { margin-bottom: 0; }
.bit-notice__body img { max-width: 100%; height: auto; border-radius: 8px; }
.bit-notice__body a { color: #1d5c86; text-decoration: underline; }
.bit-notice__body table { max-width: 100%; }

.bit-notice__ft {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px 12px 16px;
    border-top: 1px solid rgba(245, 158, 11, .35);
}
.bit-notice__logo { max-height: 30px; max-width: 140px; object-fit: contain; }

/* ---------- put away: a mini copy of the sign (hook, V string, yellow board), top centre
   (where the sign hung; the hero's quick-action buttons own the top right) ---------- */
.bit-notice__tab {
    position: fixed;
    top: 0;
    left: var(--bn-left);
    right: 0;
    width: max-content;
    margin: 0 auto;
    padding: 12px 0 0; /* a short string: the whole sign fits in the gap above the hero banner */
    z-index: 1040;
    border: 0;
    background: none;
    cursor: pointer;
    transform-origin: 50% 2px; /* the hook */
    transform: translateY(-130%);
    will-change: transform;
    transition: transform .45s cubic-bezier(.3, 1.4, .55, 1) .25s;
}
.bit-notice__tab-rig {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    width: 100%;
    height: 18px; /* 12px of string + 6px down to the eyelet centres */
    overflow: visible;
    pointer-events: none;
}
.bit-notice__tab-rig line {
    stroke: var(--bn-string);
    stroke-width: 2;
    stroke-linecap: round;
}
.bit-notice__tab-hook {
    position: absolute;
    top: -2px;
    left: 50%;
    z-index: 3;
    width: 8px;
    height: 8px;
    margin-left: -4px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #f8fafc, #94a3b8 60%, #475569);
    box-shadow: 0 2px 3px rgba(0, 0, 0, .35);
}
.bit-notice__tab-board {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 14px 4px;
    border: 2px solid var(--bn-amber);
    border-radius: 8px;
    background:
        linear-gradient(180deg, rgba(255, 255, 255, .45), rgba(255, 255, 255, 0) 55%),
        linear-gradient(135deg, var(--bn-sun), var(--bn-amber));
    color: var(--bn-ink);
    font-size: .72rem;
    font-weight: 600;
    line-height: 1.2;
    white-space: nowrap;
    box-shadow: 0 8px 18px rgba(17, 42, 84, .3), 0 0 0 3px rgba(253, 224, 71, .4);
}
.bit-notice__tab-txt { display: inline-flex; align-items: baseline; gap: 5px; min-width: 0; }
.bit-notice__tab-kicker { font-size: .6rem; letter-spacing: .1em; text-transform: uppercase; }
.bit-notice__tab-sep { opacity: .6; }
.bit-notice__tab-title {
    max-width: min(240px, calc(100vw - 190px));
    overflow: hidden;
    text-overflow: ellipsis;
}
.bit-notice__tab-board .bit-notice__eyelet { top: 2px; width: 6px; height: 6px; border-width: 1.5px; }
.bit-notice__tab-board .bi { font-size: .75rem; }
.bit-notice__tab-board .bit-notice__eyelet--l { left: calc(14% - 3px); }
.bit-notice__tab-board .bit-notice__eyelet--r { right: calc(14% - 3px); }

.bit-notice.is-ready:not(.is-open) .bit-notice__tab {
    transform: translateY(0);
    animation: bit-notice-tag-sway 4.5s ease-in-out .8s 2; /* settles; never infinite (see the big sign) */
}
.bit-notice.is-open .bit-notice__tab { transition-delay: 0s; }
@keyframes bit-notice-tag-sway {
    0%, 100% { transform: rotate(0deg); }
    25%      { transform: rotate(3.5deg); }
    75%      { transform: rotate(-3.5deg); }
}
.bit-notice__tab:hover .bit-notice__tab-board { filter: brightness(1.06); }
.bit-notice__tab:focus-visible { outline: none; }
.bit-notice__tab:focus-visible .bit-notice__tab-board { outline: 3px solid #1d5c86; outline-offset: 2px; }

@media (prefers-reduced-motion: reduce) {
    .bit-notice__sign,
    .bit-notice__tab { transition: none !important; }
    .bit-notice.is-open .bit-notice__sign,
    .bit-notice.is-open .bit-notice__swing,
    .bit-notice.is-ready:not(.is-open) .bit-notice__tab { animation: none !important; }
}
@media print { .bit-notice { display: none; } }
