/* zonmedia-news：入口網式首頁樣式
   放在 assets/custom/ 而不是 assets/css/：主題的 screen.css 要跑 gulp 才會編成
   assets/built/screen.css，這台機器沒有 node_modules。這個檔由 default.hbs 直接引用，
   不進打包流程，之後若真的 build 主題也不會衝突。

   版面尺寸參考中時新聞網實測值：容器 1240、主欄 924、側欄 313。 */

.zn-main,
.zn-ticker {
    --zn-container: 1240px;
    --zn-side: 313px;
    --zn-gap: 3.2rem;
    --zn-line: rgba(0, 0, 0, 0.1);
}

.zn-main .gh-inner,
.zn-ticker .gh-inner {
    max-width: var(--zn-container);
}

/* 1. 快訊條 --------------------------------------------------------------- */

.zn-ticker {
    border-bottom: 1px solid var(--zn-line);
    margin-top: 2.4rem;
}

.zn-ticker-inner {
    display: flex;
    align-items: center;
    gap: 1.6rem;
    height: 48px;
    overflow: hidden;
}

.zn-ticker-label {
    flex: none;
    padding: 0.4rem 1.2rem;
    font-size: 1.4rem;
    font-weight: 700;
    color: #7a601c;
    background: #f0e3bd;          /* 與廣告版位同一組芥子色 */
    border-radius: 3px;
}

.zn-ticker-viewport {
    overflow: hidden;
    flex: 1;
}

.zn-ticker-track {
    display: flex;
    gap: 3.2rem;
    white-space: nowrap;
    animation: zn-ticker 60s linear infinite;
}

.zn-ticker-track:hover {
    animation-play-state: paused;
}

.zn-ticker-track a {
    font-size: 1.5rem;
    color: var(--color-primary-text);
}

@keyframes zn-ticker {
    from { transform: translateX(0); }
    to   { transform: translateX(-50%); }
}

@media (prefers-reduced-motion: reduce) {
    .zn-ticker-track { animation: none; }
}

/* 2. 兩欄骨架 ------------------------------------------------------------- */

.zn-main {
    padding-top: 3.2rem;
    padding-bottom: 4.8rem;
}

.zn-cols {
    display: grid;
    grid-template-columns: minmax(0, 1fr) var(--zn-side);
    gap: var(--zn-gap);
    align-items: start;
}

@media (max-width: 991px) {
    .zn-cols { grid-template-columns: minmax(0, 1fr); }
}

/* 3. 頭條輪播 ------------------------------------------------------------- */
/* 用原生捲動 + scroll-snap 當底：手指滑動、觸控板、鍵盤都是瀏覽器原生行為，
   JS 只負責「自動輪播」與「圓點狀態」。不依賴任何輪播套件。 */

.zn-hero-carousel {
    position: relative;
    margin-bottom: 3.2rem;
}

.zn-hero-track {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    border-radius: 6px;
    scrollbar-width: none;              /* 捲軸藏起來，但捲動能力保留 */
}

.zn-hero-track::-webkit-scrollbar { display: none; }

.zn-hero-track:focus-visible {
    outline: 2px solid var(--ghost-accent-color, #1F4E79);
    outline-offset: 3px;
}

.zn-hero-slide {
    flex: 0 0 100%;
    scroll-snap-align: start;
}

/* 防線：廣告插入器等外部腳本若把節點塞進軌道，會打亂 scroll-snap 與張數換算 */
.zn-hero-track > :not(.zn-hero-slide) {
    display: none !important;
}

.zn-hero-media {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;        /* 放在容器而不是 img：沒有首圖的文章也不會塌高度 */
    background: #15171a;
}

.zn-hero-media img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    opacity: 0.85;
}

.zn-hero-caption {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    padding: 6rem 2.4rem 2rem;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.72), transparent);
}

.zn-hero-tag {
    display: inline-block;
    margin-bottom: 0.8rem;
    padding: 0.2rem 0.8rem;
    font-size: 1.2rem;
    font-weight: 700;
    color: #4a3b16;
    background: #e6d49b;
    border-radius: 3px;
}

.zn-hero-title {
    margin: 0;
    font-size: clamp(2rem, 1rem + 1.6vw, 3.2rem);
    line-height: 1.3;
    color: #fff;
    text-shadow: 0 2px 12px rgba(0, 0, 0, 0.55);
}

/* 左右切換鈕：桌機顯示，手機隱藏（手指直接滑比較自然）*/
.zn-hero-nav {
    position: absolute;
    top: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0 0 4px;
    font-size: 2.6rem;
    line-height: 1;
    color: #fff;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.4);
    border: 0;
    border-radius: 50%;
    transform: translateY(-50%);
    transition: background 0.2s, opacity 0.2s;
}

.zn-hero-nav:hover { background: rgba(0, 0, 0, 0.65); }
.zn-hero-nav.is-prev { left: 1.2rem; }
.zn-hero-nav.is-next { right: 1.2rem; }

@media (max-width: 767px) {
    .zn-hero-nav { display: none; }
}

.zn-hero-dots {
    position: absolute;
    right: 0;
    bottom: 1.2rem;
    left: 0;
    display: flex;
    gap: 0.8rem;
    justify-content: center;
}

.zn-hero-dots button {
    width: 9px;
    height: 9px;
    padding: 0;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.45);
    border: 0;
    border-radius: 50%;
    transition: background 0.2s, transform 0.2s;
}

.zn-hero-dots button[aria-selected="true"] {
    background: #fff;
    transform: scale(1.35);
}

.zn-hero-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 0;
    height: 3px;
    background: var(--ghost-accent-color, #1F4E79);
    border-radius: 0 3px 3px 0;
    pointer-events: none;
}

/* 4. 區塊標題 ------------------------------------------------------------- */

.zn-block-title,
.zn-side-title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin: 0 0 1.6rem;
    padding-bottom: 0.8rem;
    font-size: 2rem;
    border-bottom: 2px solid var(--ghost-accent-color, #1F4E79);
}

.zn-block-title a { color: inherit; }

.zn-more {
    font-size: 1.3rem;
    font-weight: 400;
    color: var(--color-secondary-text);
}

/* 5. 焦點新聞（圖左文右）-------------------------------------------------- */

.zn-block { margin-bottom: 4rem; }

.zn-focus {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 2.4rem 3.2rem;
}

@media (max-width: 600px) {
    .zn-focus { grid-template-columns: minmax(0, 1fr); }
}

.zn-item {
    display: grid;
    grid-template-columns: 120px minmax(0, 1fr);
    gap: 1.4rem;
}

.zn-item-media img {
    display: block;
    width: 120px;
    height: 80px;
    object-fit: cover;
    border-radius: 4px;
}

.zn-item-title {
    margin: 0;
    font-size: 1.6rem;
    line-height: 1.4;
}

.zn-item-body a { color: inherit; }

.zn-item-meta {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    margin-top: 0.6rem;
    font-size: 1.2rem;
    color: var(--color-secondary-text);
}

.zn-tag {
    padding: 0.1rem 0.6rem;
    color: #7a601c !important;
    background: #f0e3bd;
    border-radius: 3px;
}

/* 6. 分類區塊 ------------------------------------------------------------- */

.zn-channels {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 3.2rem 2.8rem;
}

@media (max-width: 900px) { .zn-channels { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .zn-channels { grid-template-columns: minmax(0, 1fr); } }

.zn-channel-lead img {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    border-radius: 4px;
}

.zn-channel-lead h3 {
    margin: 0.8rem 0 1.2rem;
    font-size: 1.6rem;
    line-height: 1.4;
}

.zn-channel-lead a { color: inherit; }

.zn-channel-item {
    display: block;
    padding: 0.8rem 0 0.8rem 1.2rem;
    font-size: 1.4rem;
    line-height: 1.5;
    color: var(--color-primary-text);
    border-top: 1px solid var(--zn-line);
    position: relative;
}

.zn-channel-item::before {
    content: "・";
    position: absolute;
    left: -0.2rem;
    color: var(--color-secondary-text);
}

.zn-empty {
    font-size: 1.4rem;
    color: var(--color-secondary-text);
}

/* 7. 側欄 ----------------------------------------------------------------- */

.zn-side-block { margin-bottom: 3.2rem; }

.zn-rank {
    margin: 0;
    padding: 0;
    list-style: none;
    counter-reset: zn;
}

.zn-rank li {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
    padding: 1rem 0;
    border-bottom: 1px solid var(--zn-line);
    font-size: 1.45rem;
    line-height: 1.45;
}

.zn-rank-no {
    font-family: var(--font-sans);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--ghost-accent-color, #1F4E79);
    text-align: center;
}

.zn-rank a { color: var(--color-primary-text); }

.zn-side-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.zn-side-list li {
    display: flex;
    gap: 1rem;
    justify-content: space-between;
    padding: 0.9rem 0;
    border-bottom: 1px solid var(--zn-line);
    font-size: 1.4rem;
    line-height: 1.45;
}

.zn-side-list a { color: var(--color-primary-text); }

.zn-side-list time {
    flex: none;
    font-size: 1.2rem;
    color: var(--color-secondary-text);
}

.ad-slot--side { margin: 0 0 3.2rem; min-height: 270px; }
.ad-slot--side .ad-box { min-height: 250px; display: flex; flex-direction: column; justify-content: center; }
