/* =========================================================
   首頁「關於」右欄：精簡簡介＋技術收合（2026-11-26）
   動畫只在 js/home_about.js 加上 .anim-ready／.toggle-ready 後才生效，
   JS 沒載入時內容照常全部顯示。
   ========================================================= */

/* ---------- 標題：逐字打出 ---------- */
.home-lead {
    margin: 6px 0 18px;
    min-height: 1.35em;
    font-size: clamp(1.5rem, 2.4vw, 2rem);
    font-weight: 900;
    line-height: 1.35;
    letter-spacing: .5px;
    color: #f1f5f9;
}
.home-lead-name {
    color: var(--accent, #00d9ff);
    text-shadow: 0 0 18px rgba(0, 217, 255, .55);
}
.home-lead-caret {
    display: inline-block;
    width: 3px;
    height: 1em;
    margin-left: 6px;
    vertical-align: -.12em;
    background: var(--accent, #00d9ff);
    box-shadow: 0 0 10px var(--accent, #00d9ff);
    animation: homeCaret 1s step-end infinite;
}
.home-lead.is-typing .home-lead-caret { animation: none; }
@keyframes homeCaret { 50% { opacity: 0; } }

/* ---------- 段落與標籤依序淡入 ---------- */
.home-intro.anim-ready .home-reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity .7s ease, transform .7s cubic-bezier(.16, 1, .3, 1);
    transition-delay: calc(1.5s + var(--d, 0) * .2s);
}
.home-intro.anim-ready.is-revealed .home-reveal {
    opacity: 1;
    transform: none;
}

/* 重點字：底線由左往右畫出 */
.home-intro .intro-content strong {
    background: linear-gradient(rgba(251, 191, 36, .45), rgba(251, 191, 36, .45)) no-repeat 0 100% / 100% 2px;
}
.home-intro.anim-ready .intro-content strong {
    background-size: 0 2px;
    transition: background-size .8s ease calc(2s + var(--d, 0) * .2s);
}
.home-intro.anim-ready.is-revealed .intro-content strong { background-size: 100% 2px; }

/* ---------- 快速認識 ---------- */
.home-facts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px dashed rgba(255, 255, 255, .14);
}
.home-facts-label {
    margin-right: 4px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 1px;
    color: #38bdf8;
}
.home-fact { padding: 6px 14px; font-size: 13px; }
.home-fact i { margin-right: 4px; font-size: 12px; color: #38bdf8; }

/* 逐一彈出＋掃光（用 translate/scale，不影響原本 hover 的 transform） */
.home-intro.anim-ready .home-fact { opacity: 0; translate: 0 10px; scale: .92; }
.home-intro.anim-ready.is-revealed .home-fact {
    animation: homeFactIn .55s cubic-bezier(.34, 1.56, .64, 1) forwards;
    animation-delay: calc(2.1s + var(--i, 0) * .12s);
}
.home-intro.anim-ready.is-revealed .home-fact::before {
    animation: homeSweep 1s ease;
    animation-delay: calc(2.5s + var(--i, 0) * .12s);
}
@keyframes homeFactIn { to { opacity: 1; translate: 0 0; scale: 1; } }
@keyframes homeSweep { from { left: -100%; } to { left: 100%; } }

/* ---------- 技術收合 ---------- */
.tech-toggle { display: none; }
.tech-stack.toggle-ready .tech-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-top: 22px;
    padding: 10px 20px;
    border-radius: 12px;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #e2f7ff;
    background: var(--surface-chip);
    border: 1px solid var(--surface-border);
    box-shadow: var(--surface-shadow);
    cursor: pointer;
    transition: border-color .25s, box-shadow .25s, transform .25s, background .25s;
}
.tech-stack.toggle-ready .tech-toggle:hover {
    background: var(--surface-hover-tint);
    border-color: var(--surface-border-hover);
    box-shadow: var(--surface-shadow-hover);
    transform: translateY(-2px);
}
.tech-toggle:focus-visible { outline: 2px solid #00d9ff; outline-offset: 3px; }
.tech-toggle i { color: #38bdf8; transition: transform .45s cubic-bezier(.34, 1.56, .64, 1); }
.tech-stack.is-open .tech-toggle i { transform: rotate(180deg); }

/* 未展開時按鈕呼吸光暈，提示還有更多 */
.tech-stack.toggle-ready:not(.is-open) .tech-toggle { animation: homePulse 2.6s ease-in-out infinite; }
@keyframes homePulse {
    50% { box-shadow: 0 0 0 4px rgba(0, 217, 255, .12), 0 0 18px rgba(0, 217, 255, .35); }
}

/* 收合區：高度平滑展開（grid 0fr → 1fr） */
.tech-more {
    display: grid;
    grid-template-rows: 0fr;
    margin-top: -22px;            /* 抵銷 .tech-categories 的 gap，收合時不留空 */
    opacity: 0;
    transition: grid-template-rows .6s cubic-bezier(.16, 1, .3, 1), margin-top .6s, opacity .4s;
}
.tech-stack.is-open .tech-more { grid-template-rows: 1fr; margin-top: 0; opacity: 1; }
.tech-more-inner {
    display: flex;
    flex-direction: column;
    gap: 22px;
    min-height: 0;
    overflow: hidden;
}
/* 展開時標籤一顆顆浮現 */
.tech-stack.is-open .tech-more .category-title,
.tech-stack.is-open .tech-more .tech-item {
    animation: homeChipIn .45s cubic-bezier(.34, 1.56, .64, 1) both;
    animation-delay: calc(.15s + var(--i, 0) * 22ms);
}
@keyframes homeChipIn { from { opacity: 0; translate: 0 12px; scale: .9; } }

/* ---------- 減少動態效果 ---------- */
@media (prefers-reduced-motion: reduce) {
    .home-intro.anim-ready .home-reveal,
    .home-intro.anim-ready .home-fact { opacity: 1; transform: none; translate: none; scale: none; transition: none; animation: none; }
    .home-intro.anim-ready .intro-content strong { background-size: 100% 2px; transition: none; }
    .home-lead-caret,
    .tech-stack.toggle-ready .tech-toggle,
    .tech-stack.is-open .tech-more .category-title,
    .tech-stack.is-open .tech-more .tech-item { animation: none !important; }
    .tech-more { transition: none; }
}
