/* ==========================================
   8. 卡片網格與瀑布流佈局 (Grids & Cards)
   ========================================== */
#content-container {
    /* --chapter-extra-space 由 interaction.js 的章節導航依「視窗高度 − 最後一個章節高度」動態計算，
   讓最後一個章節也能自然滑動到判定基準線，不需要在底部強制鎖定刻度 */
    padding: 0 20px calc(100px + var(--chapter-extra-space, 0px)) 20px;
    min-height: calc(100vh - 200px);
    max-width: 860px;
    width: 100%;
    margin: 0 auto;
    box-sizing: border-box;
}

.empty-state-view {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100dvh - 260px);
    width: 100%;
    margin: 0 auto;
    color: var(--text-secondary);
    opacity: 0.38;
    font-weight: 500;
    letter-spacing: 1px;
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
    pointer-events: none;
    box-sizing: border-box;
}

.empty-state-label {
    translate: 0 -12px;
    display: grid;
    gap: 8px;
    font-size: 17px;
    font-weight: 700;
}

.empty-state-logo {
    display: block;
    width: 0;
    min-width: 100%;
    height: auto;
    fill: currentColor;
}

.view-panel {
    width: 100%;
    contain: layout style;
}

.category-wrapper,
.note-grid {
    contain: layout style;
}

.view-panel>.category-wrapper:first-child,
.view-panel>.group-title:first-child,
#content-container>.category-wrapper:first-child,
#content-container>.group-title:first-child {
    margin-top: 0px;
}

.note-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: start;
    gap: 24px;
    margin-bottom: 40px;
    min-height: 80px;
    padding-bottom: 10px;
}

.note-card {
    padding: 24px;
    padding-bottom: 24px;
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    background: var(--card-glass-bg);
    border: 1px solid var(--glass-border);
    cursor: pointer;
    box-shadow: var(--glass-shadow-soft), var(--glass-inner-highlight);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.15s, background-color 0.2s ease;
    transform: translateZ(0);
    position: relative;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    contain: layout style;
    min-width: 0;
    box-sizing: border-box;
    width: 100%;
}

[data-theme="dark"] .note-card {
    background: var(--card-glass-bg);
    box-shadow: var(--glass-shadow-soft), var(--glass-inner-highlight);
}

.bookmark-capsule {
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.3px;
    background: rgba(120, 120, 120, 0.35);
    color: var(--text-secondary);
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: var(--glass-inner-highlight);
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    line-height: 1.2;
    box-sizing: border-box;
    align-self: flex-start;
    margin-bottom: 12px;
    z-index: 2;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-decoration: none;
    user-select: none;
    -webkit-user-select: none;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.bookmark-capsule.is-link {
    cursor: pointer;
}

@media (hover: hover) {
    .bookmark-capsule.is-link:hover {
        background: rgba(150, 150, 150, 0.45);
        border-color: rgba(255, 255, 255, 0.35);
        color: #FAF6EE;
    }
}

.bookmark-capsule.is-link:active {
    transform: scale(0.96) translateZ(0);
}

.bookmark-capsule:not(.is-link) {
    cursor: default;
    pointer-events: none;
}

.note-card .reminder-card-title,
.note-card .reminder-card-title:visited {
    color: #4da8da;
    cursor: pointer;
    text-decoration: none;
    width: fit-content;
    max-width: 100%;
}

.note-card:not(.is-custom-record) .reminder-card-title:active {
    text-decoration: underline;
    text-decoration-thickness: 2px;
    text-underline-offset: 4px;
    text-decoration-color: #4da8da;
}

@media (hover: hover) {
    .note-card:not(.is-custom-record) .reminder-card-title:hover {
        text-decoration: underline;
        text-decoration-thickness: 2px;
        text-underline-offset: 4px;
        text-decoration-color: #4da8da;
    }
}

.note-card.is-custom-record .reminder-card-title {
    color: var(--primary);
    cursor: pointer;
    text-decoration: none;
}

.note-card .footer {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
    font-size: 15.5px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-left: 12px;
    padding-left: 12px;
    border-left: 2px solid var(--glass-border);
    margin-bottom: 0;
    min-width: 0;
    width: calc(100% - 12px);
    box-sizing: border-box;
}

.note-card .footer span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.2px;
    max-width: 100%;
    box-sizing: border-box;
    font-size: 15.5px;
}

.note-card .footer .bookmark-desc {
    font-size: 16.5px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    word-break: normal;
    box-sizing: border-box;
}

.note-card .footer .bookmark-desc.is-empty {
    opacity: 0.5;
}

.note-card .note-timestamp {
    position: static;
    margin: 0;
    padding: 0;
    border: none;
    border-left: none;
    padding-top: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0.7;
    font-variant-numeric: tabular-nums;
}

.reminders-masonry {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    justify-content: start;
    align-items: start;
    gap: 24px;
    margin-bottom: 40px;
    min-height: 80px;
    padding-bottom: 10px;
    width: 100%;
    box-sizing: border-box;
}

@media (max-width: 1200px) {
    .note-grid,
    .reminders-masonry {
        grid-template-columns: minmax(0, 1fr);
    }
}

.reminder-card {
    padding: 24px;
    padding-bottom: 24px;
    display: flex;
    flex-direction: column;
    border-radius: 20px;
    background: var(--card-glass-bg);
    border: 1px solid var(--glass-border);
    cursor: pointer;
    box-shadow: var(--glass-shadow-soft), var(--glass-inner-highlight);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.3s ease, border-color 0.3s ease, background-color 0.2s ease;
    transform: translateZ(0);
    position: relative;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    contain: layout style;
}

[data-theme="dark"] .reminder-card {
    background: var(--card-glass-bg);
    box-shadow: var(--glass-shadow-soft), var(--glass-inner-highlight);
}

.reminder-card:active {
    transform: scale(0.96) translateZ(0);
}

.reminder-card .note-timestamp {
    position: static;
    margin: 0;
    padding: 0;
    border: none;
    border-left: none;
    padding-top: 4px;
    font-size: 12px;
    color: var(--text-secondary);
    opacity: 0.7;
    font-variant-numeric: tabular-nums;
}

.reminder-card .footer {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 7px;
    font-size: 15.5px;
    color: var(--text-secondary);
    line-height: 1.4;
    margin-left: 12px;
    padding-left: 12px;
    border-left: 2px solid var(--glass-border);
    margin-bottom: 0;
}

.reminder-card .footer span {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.2px;
    font-size: 15.5px;
}

.reminder-checkbox {
    position: absolute;
    top: 22px;
    right: 24px;
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    border-radius: 50%;
    border: 3.5px solid var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: default;
    pointer-events: none;
    box-sizing: border-box;
    transition: border-color 0.25s ease, background-color 0.25s ease;
    background: transparent;
    padding: 0;
    outline: none !important;
    box-shadow: none;
    -webkit-tap-highlight-color: transparent;
    z-index: 2;
}

.reminder-checkbox:focus,
.reminder-checkbox:focus-visible {
    outline: none !important;
    box-shadow: none !important;
}

.reminder-checkbox svg {
    width: 22px;
    height: 22px;
    display: block;
    color: #FAF6EE;
    opacity: 0;
    transform: scale(0.4);
    transition: opacity 0.2s ease, transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.reminder-checkbox.checked {
    background-color: var(--primary);
    border-color: var(--primary);
    cursor: default;
}

.reminder-checkbox.checked svg {
    opacity: 1;
    transform: scale(1);
    stroke-width: 3.5;
}

.reminder-countdown {
    padding: 5px 12px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.5px;
    background: rgba(154, 135, 30, 0.15);
    color: var(--primary);
    border: 1px solid rgba(154, 135, 30, 0.35);
    box-shadow: inset 0 0 0 1px rgba(154, 135, 30, 0.18);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
    box-sizing: border-box;
    pointer-events: none;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
    transition: color 0.25s ease, background-color 0.25s ease, border-color 0.25s ease;
    align-self: flex-start;
    margin-bottom: 12px;
    z-index: 2;
}

.reminder-countdown.urgent {
    background: rgba(154, 135, 30, 0.18);
    color: var(--primary);
    border-color: rgba(154, 135, 30, 0.45);
    box-shadow: inset 0 0 0 1px rgba(154, 135, 30, 0.22);
}

.reminder-countdown.overdue {
    background: rgba(114, 47, 55, 0.22);
    color: #ac4252;
    border-color: rgba(114, 47, 55, 0.48);
    box-shadow: inset 0 0 0 1px rgba(114, 47, 55, 0.24);
    font-weight: 700;
}

.reminder-countdown.done {
    background: rgba(154, 135, 30, 0.2);
    color: var(--primary);
    border: 1px solid var(--primary);
    box-shadow: inset 0 0 0 1px rgba(154, 135, 30, 0.25);
    font-weight: 700;
}

.reminder-modal-checkbox {
    width: 58px;
    height: 44px;
    min-width: 58px;
    min-height: 44px;
    border-radius: 12px;
    background: var(--input-bg);
    border: 1px solid var(--glass-border);
    box-shadow: var(--glass-inner-highlight);
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-sizing: border-box;
    padding: 0;
    outline: none !important;
    flex-shrink: 0;
    margin-left: 0;
    margin-right: 0;
    transform: translateZ(0);
    transform-origin: center center;
    will-change: transform;
    transition: transform 0.25s cubic-bezier(0.2, 0.8, 0.2, 1),
        background 0.25s ease,
        border-color 0.25s ease,
        color 0.25s ease,
        box-shadow 0.25s ease;
}

.reminder-modal-checkbox svg {
    width: 22px;
    height: 22px;
    display: block;
    color: var(--text-secondary);
    stroke-width: 3.5;
    transition: color 0.25s ease;
}

.reminder-modal-checkbox:active {
    transform: scale(0.85) translateZ(0) !important;
    transition: transform 0.04s ease-out !important;
}

.reminder-modal-checkbox.checked {
    background: var(--primary) !important;
    border-color: var(--primary) !important;
    color: #FAF6EE !important;
    box-shadow: 0 0 20px rgba(154, 135, 30, 0.55), 0 4px 16px rgba(154, 135, 30, 0.35), inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.reminder-modal-checkbox.checked svg {
    color: #FAF6EE;
    stroke-width: 3.5;
}

.reminder-card-title {
    font-size: 23px;
    font-weight: 700;
    color: var(--primary);
    margin-left: 12px;
    margin-bottom: 14px;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-all;
    transition: color 0.25s ease;
}

.reminder-card.is-overdue .reminder-card-title {
    color: #ac4252;
}

.reminder-card.is-done {
    opacity: 0.4;
}

.reminder-card.is-done:not(.card-entrance) {
    animation: none !important;
}

.reminder-card.reminder-glowing::before,
.note-card.reminder-glowing::before {
    content: '';
    position: absolute;
    inset: -1px;
    border-radius: inherit;
    pointer-events: none;
    border: 1px solid var(--primary);
    box-shadow: 0 0 16px rgba(154, 135, 30, 0.65), inset 0 0 8px rgba(154, 135, 30, 0.25);
    opacity: 0;
    animation: reminderBreathingGlow 4.2s ease-in-out infinite;
    animation-delay: var(--reminder-delay, 0s);
    z-index: 1;
}

.reminder-card.is-done.reminder-glowing::before {
    display: none !important;
}

