/* Since then / 那之後: the once-per-account welcome card (since_then_intro.js).
   A sibling of highlight_discovery_tooltip.css: same radius, border, Palatino
   title, top 100 in the window, 0.6 s fade + scale, same pill. Colours come
   from the entry window's theme tokens. The demo (drag-select → the 補記 ·
   複製 bubble → 補記 → underline → two notes) loops on one 7.2 s cycle while
   the card is open (CEO 2026-10-14): ~5.6 s of play, a rest, a short fade.
   Reduce Motion: three still frames, no animation. Cursor targets come from
   since_then_intro.js (place()). Loaded only when entry_notes is on
   (templates/sidebar.html). */

:is(#historicalResponseModalContent, #inspirationResponseModalContent).sti-host { position: relative; }

.since-then-intro {
    position: absolute;
    top: 100px;
    left: 50%;
    width: 90%;
    max-width: 500px;
    z-index: 10000;
    opacity: 0;
    transform: translateX(-50%) scale(0.95);
    transition: opacity 0.6s cubic-bezier(0.25, 0.1, 0.25, 1),
                transform 0.6s cubic-bezier(0.25, 0.1, 0.25, 1);
    pointer-events: none;
    text-align: left;
}

.since-then-intro.show {
    opacity: 1;
    transform: translateX(-50%) scale(1);
    pointer-events: auto;
}

.since-then-intro.hide {
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.since-then-intro .sti-card {
    background: var(--inspiration-modal-bg, #FFFDF9);
    border-radius: 20px;
    border: 1.5px solid var(--inspiration-modal-border, rgba(139, 92, 246, 0.25));
    box-shadow: 0 6px 16px rgba(139, 92, 246, 0.15);
    overflow: hidden;
    position: relative;
}

/* Decorative rule at the bottom, as on the highlight card. */
.since-then-intro .sti-card::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 20px;
    right: 20px;
    height: 2px;
    background-color: var(--inspiration-modal-border, rgba(139, 92, 246, 0.18));
    border-radius: 1px;
}

.since-then-intro .sti-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.since-then-intro .sti-header {
    display: flex;
    align-items: center;
    gap: 10px;
}

.since-then-intro .sti-icon {
    width: 32px;
    height: 32px;
    border-radius: 16px;
    background: linear-gradient(135deg, #8B5CF6 0%, #A78BFA 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.3);
    flex-shrink: 0;
}

.since-then-intro .sti-svg { display: inline-flex; line-height: 0; }

.since-then-intro .sti-title {
    flex: 1;
    font-family: Palatino, 'Palatino Linotype', 'Book Antiqua', 'PingFang TC', 'Hiragino Sans GB', serif;
    font-size: 16px;
    font-weight: 700;
    line-height: 1.35;
    color: var(--inspiration-modal-text, #2C1810);
    margin: 0;
    letter-spacing: 0.1px;
}

.since-then-intro .sti-close {
    width: 32px;
    height: 32px;
    margin: -6px -8px -6px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px;
    border: none;
    background: none;
    color: var(--inspiration-modal-muted-text, #8a7a63);
    font-size: 15px;
    cursor: pointer;
    flex-shrink: 0;
}
.since-then-intro .sti-close:hover { background: rgba(139, 92, 246, 0.1); }
.since-then-intro .sti-close:focus-visible,
.since-then-intro .sti-cta:focus-visible { outline: 2px solid rgba(139, 92, 246, 0.55); outline-offset: 2px; }

/* The sample: one line, its underline, two later notes, the bubble, the cursor. */
.since-then-intro {
    --sti-cycle: 7.2s;
    --sti-sel: rgba(139, 92, 246, 0.26);
}
.since-then-intro.sti--dark { --sti-sel: rgba(167, 139, 250, 0.42); }

.since-then-intro .sti-demo {
    border-radius: 12px;
    background: var(--inspiration-modal-input-bg, rgba(0, 0, 0, 0.025));
    border: 1px solid var(--inspiration-modal-border, rgba(0, 0, 0, 0.08));
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

.since-then-intro .sti-play {
    position: relative;
    padding: 50px 16px 14px; /* room above the line for the bubble */
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.since-then-intro .sti-line {
    margin: 0 0 2px;
    font-family: Palatino, 'Palatino Linotype', 'PingFang TC', 'Hiragino Sans GB', serif;
    font-size: 15px;
    line-height: 24px;
    color: var(--inspiration-modal-text, #2b2722);
}

.since-then-intro .sti-sel {
    background-image: linear-gradient(var(--sti-sel), var(--sti-sel));
    background-repeat: no-repeat;
    background-position: 0 0;
    background-size: 0% 100%;
    border-radius: 2px;
}

.since-then-intro .sti-u {
    background-image: linear-gradient(var(--sti-ink), var(--sti-ink));
    background-repeat: no-repeat;
    background-position: 0 100%;
    background-size: 0% 1.5px;
    padding-bottom: 3px;
}

.since-then-intro .sti-note {
    align-self: flex-start;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 4px 10px 5px;
    border-left: 2px solid var(--sti-ink1);
    border-radius: 2px 8px 8px 2px;
    background: rgba(29, 111, 102, 0.07);
    opacity: 0;
    transform: translateY(-4px);
}
.since-then-intro .sti-note--3 { border-left-color: var(--sti-ink3); background: rgba(174, 138, 102, 0.09); }
.since-then-intro.sti--dark .sti-note { background: rgba(120, 195, 185, 0.08); }
.since-then-intro.sti--dark .sti-note--3 { background: rgba(166, 134, 100, 0.12); }

.since-then-intro .sti-note-label {
    font-family: 'Avenir Next', Avenir, 'Helvetica Neue', 'PingFang TC', sans-serif;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 15px;
    color: var(--sti-ink1-text);
}
.since-then-intro .sti-note--3 .sti-note-label { color: var(--sti-ink3-text); }

.since-then-intro .sti-note-text {
    font-family: Palatino, 'Palatino Linotype', 'PingFang TC', 'Hiragino Sans GB', serif;
    font-size: 14px;
    line-height: 20px;
    color: var(--inspiration-modal-text, #2b2722);
}

/* since_then_web.js's selection bubble (.st-bubble), drawn in place. */
.since-then-intro .sti-bubble {
    position: absolute;
    left: var(--sti-bx, 16px);
    top: var(--sti-by, 8px);
    display: inline-flex;
    align-items: center;
    background: rgba(28, 28, 30, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    padding: 2px;
    opacity: 0;
    white-space: nowrap;
}
.since-then-intro .sti-bubble-btn {
    font-family: 'Avenir Next', Avenir, 'Helvetica Neue', 'PingFang TC', sans-serif;
    font-size: 14px;
    line-height: 18px;
    color: #fff;
    padding: 7px 14px;
    border-radius: 8px;
}
.since-then-intro .sti-bubble-btn.is-on { background: rgba(255, 255, 255, 0.12); }
.since-then-intro .sti-bubble-sep { width: 1px; height: 18px; background: rgba(255, 255, 255, 0.2); }

.since-then-intro .sti-cursor {
    position: absolute;
    left: 0;
    top: 0;
    opacity: 0;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
    pointer-events: none;
}

/* One cycle, every part on it (ms / 72 = %): drag 750–1650, bubble 1950,
   hover 補記 2500, click 2950, underline 3150–3850, a year later 4000–4500,
   three years later 5100–5600, rest, fade 6800–7100. */
.since-then-intro.show .sti-play .sti-sel { animation: sti-select var(--sti-cycle) linear infinite; }
.since-then-intro.show .sti-play .sti-u { animation: sti-underline var(--sti-cycle) linear infinite; }
.since-then-intro.show .sti-play .sti-note--1 { animation: sti-note1 var(--sti-cycle) linear infinite; }
.since-then-intro.show .sti-play .sti-note--3 { animation: sti-note3 var(--sti-cycle) linear infinite; }
.since-then-intro.show .sti-play .sti-bubble { animation: sti-bubble var(--sti-cycle) linear infinite; }
.since-then-intro.show .sti-play .sti-bubble-note { animation: sti-hover var(--sti-cycle) linear infinite; }
.since-then-intro.show .sti-play .sti-cursor { animation: sti-cursor var(--sti-cycle) linear infinite; }

@keyframes sti-select {
    0%, 10.4% { background-size: 0% 100%; }
    22.9%, 43.7% { background-size: 100% 100%; }
    44%, 100% { background-size: 0% 100%; } /* 補記 clears the selection */
}
@keyframes sti-underline {
    0%, 43.75% { background-size: 0% 1.5px; background-position: 0 100%; animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1); }
    53.5%, 94.4% { background-size: 100% 1.5px; background-position: 0 100%; }
    94.5% { background-size: 100% 1.5px; background-position: 100% 100%; }
    98.6%, 100% { background-size: 0% 1.5px; background-position: 100% 100%; }
}
@keyframes sti-note1 {
    0%, 55.6% { opacity: 0; transform: translateY(-4px); animation-timing-function: cubic-bezier(0.25, 0.1, 0.25, 1); }
    62.5%, 94.4% { opacity: 1; transform: none; }
    98.6%, 100% { opacity: 0; transform: none; }
}
@keyframes sti-note3 {
    0%, 70.8% { opacity: 0; transform: translateY(-4px); animation-timing-function: cubic-bezier(0.25, 0.1, 0.25, 1); }
    77.8%, 94.4% { opacity: 1; transform: none; }
    98.6%, 100% { opacity: 0; transform: none; }
}
@keyframes sti-bubble {
    0%, 27.1% { opacity: 0; transform: translateY(4px) scale(0.96); }
    31.25%, 43.05% { opacity: 1; transform: none; }
    45.8%, 100% { opacity: 0; transform: scale(0.96); }
}
@keyframes sti-hover {
    0%, 34.6% { background: transparent; }
    34.7%, 40.9% { background: rgba(255, 255, 255, 0.12); }
    41%, 41.7% { background: rgba(255, 255, 255, 0.2); }
    41.8%, 45.8% { background: rgba(255, 255, 255, 0.12); }
    46%, 100% { background: transparent; }
}
@keyframes sti-cursor {
    0% { opacity: 0; transform: translate(var(--sti-rx, 200px), var(--sti-ry, 120px)); }
    4.2% { opacity: 1; transform: translate(var(--sti-rx, 200px), var(--sti-ry, 120px)); animation-timing-function: ease-in-out; }
    10.4% { opacity: 1; transform: translate(var(--sti-sx, 16px), calc(var(--sti-sy, 62px) - 8px)); }
    22.9%, 26.4% { opacity: 1; transform: translate(var(--sti-ex, 190px), calc(var(--sti-ey, 62px) - 8px)); animation-timing-function: ease-in-out; }
    34.7%, 40.3% { opacity: 1; transform: translate(var(--sti-tx, 60px), var(--sti-ty, 24px)); }
    41% { opacity: 1; transform: translate(var(--sti-tx, 60px), var(--sti-ty, 24px)) scale(0.9); }
    41.7%, 43% { opacity: 1; transform: translate(var(--sti-tx, 60px), var(--sti-ty, 24px)); }
    45.8%, 100% { opacity: 0; transform: translate(var(--sti-tx, 60px), var(--sti-ty, 24px)); }
}

/* Reduce Motion: three still frames (selected · the bubble · the note). */
.since-then-intro .sti-strip { display: none; gap: 8px; padding: 10px; }
.since-then-intro .sti-fr {
    flex: 1;
    min-width: 0;
    min-height: 120px;
    border-radius: 10px;
    background: var(--inspiration-modal-bg, #FFFDF9);
    border: 1px solid var(--inspiration-modal-border, rgba(0, 0, 0, 0.08));
    padding: 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 6px;
}
.since-then-intro .sti-fr--wide { flex: 1.25; }
.since-then-intro .sti-fr .sti-line { font-size: 13px; line-height: 20px; margin: 0; }
.since-then-intro .sti-fr .sti-sel { background-size: 100% 100%; }
.since-then-intro .sti-fr .sti-u--on { background-size: 100% 1.5px; }
.since-then-intro .sti-fr .sti-bubble { position: static; opacity: 1; align-self: flex-start; }
.since-then-intro .sti-fr .sti-bubble-btn { font-size: 12px; padding: 5px 9px; }
.since-then-intro .sti-fr .sti-note { opacity: 1; transform: none; padding: 3px 7px 4px; }
.since-then-intro .sti-fr .sti-note-label { font-size: 10.5px; line-height: 14px; }
.since-then-intro .sti-fr .sti-note-text { font-size: 12px; line-height: 17px; }

.since-then-intro .sti-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
}

.since-then-intro .sti-cta {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 10px 16px;
    border-radius: 10px;
    background-color: rgba(139, 92, 246, 0.12);
    border: none;
    color: #8B5CF6;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 2px 4px rgba(139, 92, 246, 0.15);
    flex-shrink: 0;
}
.since-then-intro .sti-cta:hover {
    background-color: rgba(139, 92, 246, 0.18);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(139, 92, 246, 0.2);
}
.since-then-intro.sti--dark .sti-cta { color: #C4B5FD; background-color: rgba(167, 139, 250, 0.16); }
.since-then-intro.sti--dark .sti-cta:hover { background-color: rgba(167, 139, 250, 0.24); }

@media (max-width: 768px) {
    .since-then-intro { width: 95%; top: 80px; }
    .since-then-intro .sti-content { padding: 16px; gap: 12px; }
    .since-then-intro .sti-title { font-size: 14px; }
    .since-then-intro .sti-footer { justify-content: stretch; }
    .since-then-intro .sti-cta { width: 100%; justify-content: center; }
}

/* Reduce Motion: a 0.2 s fade, no scale, the still strip instead of the loop. */
@media (prefers-reduced-motion: reduce) {
    .since-then-intro,
    .since-then-intro.show,
    .since-then-intro.hide {
        transform: translateX(-50%);
        transition: opacity 0.2s ease;
    }
    .since-then-intro .sti-play { display: none; }
    .since-then-intro .sti-strip { display: flex; }
    .since-then-intro .sti-demo *,
    .since-then-intro.show .sti-demo * { animation: none !important; }
    .since-then-intro .sti-cta,
    .since-then-intro .sti-cta:hover { transition: none; transform: none; }
}

/* Reduce Motion on a narrow window: three frames side by side are ~74 px at
   360 px, and the bubble (nowrap) would run over the next frame. Stack them. */
@media (prefers-reduced-motion: reduce) and (max-width: 600px) {
    .since-then-intro .sti-strip { flex-direction: column; }
    .since-then-intro .sti-fr,
    .since-then-intro .sti-fr--wide { flex: none; min-height: 0; }
}
