/* ============================================
   N-TECH NEWS ARCHIVE - Agency-Level Stylesheet
   ============================================ */

body { 
    background-color: #050505; 
    color: #f5f5f5; 
    font-family: "Noto Sans JP", sans-serif; 
    font-feature-settings: "palt"; 
    -webkit-font-smoothing: antialiased; 
    cursor: none; 
    overflow-x: hidden; 
}

.cad-grid { 
    position: fixed; 
    inset: 0; 
    background-image: linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px); 
    background-size: 100px 100px; 
    pointer-events: none; 
    z-index: -1; 
}

.cursor-dot { 
    width: 4px; height: 4px; 
    background: #00f0ff; 
    position: fixed; 
    z-index: 10000; 
    pointer-events: none; 
    mix-blend-mode: screen; 
    transition: opacity 0.2s; 
}

.cursor-outline { 
    width: 40px; height: 40px; 
    border: 1px solid rgba(0, 240, 255, 0.5); 
    position: fixed; 
    z-index: 9999; 
    pointer-events: none; 
    transform: translate(-50%, -50%); 
    transition: width 0.15s ease, height 0.15s ease, background 0.15s ease, border-color 0.15s ease; 
}

body.hovering .cursor-outline { 
    width: 64px; height: 64px; 
    background: rgba(0, 240, 255, 0.05); 
    border-color: rgba(0, 240, 255, 0.8); 
}

@media (max-width: 1024px) { 
    body { cursor: auto !important; } 
    .cursor-dot, .cursor-outline { display: none !important; } 
}

.text-justify-jp { 
    text-align: justify; 
    text-justify: inter-ideograph; 
    word-break: auto-phrase; 
}

/* === Hero Section === */
@keyframes glitch-text { 
    0%,100% { text-shadow: 0 0 0 transparent; } 
    25% { text-shadow: -2px 0 #0055ff, 2px 0 #00f0ff; } 
    50% { text-shadow: 2px 0 #0055ff, -2px 0 #00f0ff; } 
}
@keyframes scan { 
    0% { transform: translateY(-100%); } 
    100% { transform: translateY(100vh); } 
}
.hero-scan { 
    position: absolute; 
    left: 0; right: 0; 
    height: 1px; 
    background: linear-gradient(90deg, transparent, rgba(0, 240, 255, 0.4), transparent); 
    animation: scan 4s linear infinite; 
    pointer-events: none; 
}
.hero-title:hover { 
    animation: glitch-text 0.4s ease-in-out; 
}

/* === Featured Hero === */
.featured-hero {
    position: relative;
    border: 1px solid rgba(0, 240, 255, 0.2);
    background: linear-gradient(135deg, rgba(0, 85, 255, 0.05), rgba(0, 240, 255, 0.02));
    transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
    overflow: hidden;
}
.featured-hero::before {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at var(--mouse-x, 50%) var(--mouse-y, 50%), rgba(0, 240, 255, 0.08), transparent 40%);
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
}
.featured-hero:hover { 
    border-color: rgba(0, 240, 255, 0.6); 
    transform: translateY(-2px); 
}
.featured-hero:hover::before { opacity: 1; }
.featured-hero::after {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 60px; height: 60px;
    background: linear-gradient(135deg, transparent 50%, rgba(0, 240, 255, 0.2) 50%);
    transition: width 0.4s, height 0.4s;
}
.featured-hero:hover::after { width: 80px; height: 80px; }

.line-clamp-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* === Year Sticky Marker === */
.year-marker {
    position: sticky;
    top: 64px;
    z-index: 20;
    background: linear-gradient(180deg, #050505 0%, #050505 70%, transparent 100%);
    padding: 1.5rem 0 0.5rem;
    margin-top: 2rem;
    margin-bottom: 1rem;
}
.year-marker:first-of-type { margin-top: 0; }
.year-marker-line {
    position: relative;
    height: 1px;
    background: linear-gradient(90deg, rgba(0, 240, 255, 0.6), rgba(0, 240, 255, 0.05));
}
.year-marker-line::before {
    content: '';
    position: absolute;
    left: -1px;
    top: -3px;
    width: 7px;
    height: 7px;
    background: #00f0ff;
    border-radius: 50%;
    box-shadow: 0 0 12px #00f0ff;
}

/* === Article Cards === */
.article-card {
    position: relative;
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1), background-color 0.3s, border-color 0.3s;
    opacity: 0;
    transform: translateY(40px);
}
.article-card.is-visible { 
    opacity: 1; 
    transform: translateY(0); 
    transition: transform 0.8s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.8s; 
}

/* List view */
.article-card-list {
    display: flex;
    flex-direction: column;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding: 1.75rem 1rem;
}
@media (min-width: 768px) { 
    .article-card-list { 
        flex-direction: row; 
        align-items: center; 
        gap: 2rem; 
        padding: 2rem 1rem; 
    } 
}
.article-card-list:hover { background-color: rgba(255, 255, 255, 0.02); }
.article-card-list .arrow { transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1); }
.article-card-list:hover .arrow { transform: translateX(8px); }

/* Grid view */
.articles-grid { 
    display: grid; 
    grid-template-columns: 1fr; 
    gap: 1.5rem; 
}
@media (min-width: 640px) { 
    .articles-grid { 
        grid-template-columns: 1fr 1fr; 
        gap: 2rem; 
    } 
}
@media (min-width: 1024px) { 
    .articles-grid { grid-template-columns: 1fr 1fr 1fr; } 
}
.article-card-grid {
    position: relative;
    display: flex;
    flex-direction: column;
    padding: 2rem 1.5rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(255, 255, 255, 0.01);
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    min-height: 280px;
}
.article-card-grid:hover { 
    border-color: rgba(0, 240, 255, 0.5); 
    background: rgba(0, 240, 255, 0.02); 
    transform: translateY(-4px); 
    box-shadow: 0 10px 40px rgba(0, 240, 255, 0.08); 
}
.article-card-grid::after { 
    content: ''; 
    position: absolute; 
    bottom: 0; 
    left: 0; 
    height: 1px; 
    width: 0; 
    background: #00f0ff; 
    transition: width 0.6s ease; 
}
.article-card-grid:hover::after { width: 100%; }

/* NEW Badge */
@keyframes pulse-ring { 
    0% { box-shadow: 0 0 0 0 rgba(0, 240, 255, 0.6); } 
    70% { box-shadow: 0 0 0 8px rgba(0, 240, 255, 0); } 
    100% { box-shadow: 0 0 0 0 rgba(0, 240, 255, 0); } 
}
.new-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.15em;
    color: #00f0ff;
    background: rgba(0, 240, 255, 0.1);
    border: 1px solid rgba(0, 240, 255, 0.6);
    padding: 2px 6px;
    border-radius: 2px;
    animation: pulse-ring 2s infinite;
    font-family: 'JetBrains Mono', monospace;
}
.new-badge::before {
    content: '';
    width: 5px;
    height: 5px;
    background: #00f0ff;
    border-radius: 50%;
}

/* Featured Badge */
.featured-badge { 
    display: inline-flex; 
    align-items: center; 
    gap: 0.3rem; 
    font-size: 9px; 
    font-weight: 700; 
    letter-spacing: 0.2em; 
    color: #ffc800; 
    border: 1px solid #ffc800; 
    padding: 2px 8px; 
    font-family: 'JetBrains Mono', monospace;
}

/* Filter chips */
.filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: transparent;
    color: rgba(255, 255, 255, 0.6);
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    transition: all 0.3s;
    white-space: nowrap;
    flex-shrink: 0;
}
.filter-chip:hover { 
    color: #fff; 
    border-color: rgba(0, 240, 255, 0.4); 
}
.filter-chip.is-active { 
    color: #050505; 
    background: #00f0ff; 
    border-color: #00f0ff; 
    box-shadow: 0 0 20px rgba(0, 240, 255, 0.4); 
}
.filter-chip .count { 
    font-size: 9px; 
    opacity: 0.6; 
}

/* Search */
.search-bar { position: relative; }
.search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 0.75rem 1rem 0.75rem 2.5rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 13px;
    letter-spacing: 0.05em;
    transition: all 0.3s;
}
.search-input:focus { 
    outline: none; 
    border-color: rgba(0, 240, 255, 0.5); 
    background: rgba(0, 240, 255, 0.03); 
}
.search-input::placeholder { 
    color: rgba(255, 255, 255, 0.3); 
}

/* View toggle */
.view-toggle-btn {
    padding: 0.5rem 0.75rem;
    color: rgba(255, 255, 255, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    transition: all 0.3s;
    background: transparent;
}
.view-toggle-btn:hover { color: #fff; }
.view-toggle-btn.is-active { 
    color: #00f0ff; 
    border-color: rgba(0, 240, 255, 0.4); 
    background: rgba(0, 240, 255, 0.05); 
}

/* Magnetic */
.magnetic { 
    transition: transform 0.2s cubic-bezier(0.23, 1, 0.32, 1); 
}

/* Loading */
.loader-pulse { 
    width: 8px; 
    height: 8px; 
    background: #00f0ff; 
    border-radius: 50%; 
    box-shadow: 0 0 12px #00f0ff; 
    animation: pulseCyan 1.5s ease-in-out infinite; 
}
@keyframes pulseCyan { 
    0%, 100% { opacity: 1; } 
    50% { opacity: 0.4; } 
}

/* No results */
.no-results { 
    padding: 4rem 1rem; 
    text-align: center; 
    color: rgba(255, 255, 255, 0.4); 
}

/* Sticky controls */
.controls-sticky { 
    position: sticky; 
    top: 0; 
    z-index: 30; 
    background: rgba(5, 5, 5, 0.9); 
    backdrop-filter: blur(20px); 
    border-bottom: 1px solid rgba(255, 255, 255, 0.05); 
    margin: 0 -1.5rem; 
    padding: 1rem 1.5rem; 
}

/* Counter */
.counter-num { 
    font-family: 'Oswald', sans-serif; 
    font-weight: 700; 
    font-size: 3rem; 
    line-height: 1; 
    color: #00f0ff; 
}
@media (min-width: 768px) { 
    .counter-num { font-size: 4rem; } 
}

/* Custom scrollbar */
html { 
    scrollbar-width: thin; 
    scrollbar-color: rgba(0, 240, 255, 0.4) rgba(5, 5, 5, 0.5); 
}
html::-webkit-scrollbar { width: 8px; }
html::-webkit-scrollbar-track { background: rgba(5, 5, 5, 0.5); }
html::-webkit-scrollbar-thumb { 
    background: rgba(0, 240, 255, 0.4); 
    border-radius: 4px; 
}
html::-webkit-scrollbar-thumb:hover { 
    background: rgba(0, 240, 255, 0.6); 
}

/* Hide scrollbar for filter chips */
#filter-chips::-webkit-scrollbar { height: 4px; }
#filter-chips::-webkit-scrollbar-thumb { 
    background: rgba(0, 240, 255, 0.2); 
}

/* ============================================
   PHASE 3: Agency-level Enhancements
   ============================================ */

/* === Sort Chips === */
.sort-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.9rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: transparent;
    color: rgba(255, 255, 255, 0.5);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    transition: all 0.3s;
    white-space: nowrap;
}
.sort-chip:hover { color: #fff; border-color: rgba(0, 240, 255, 0.4); }
.sort-chip.is-active {
    color: #00f0ff;
    border-color: rgba(0, 240, 255, 0.6);
    background: rgba(0, 240, 255, 0.05);
}

/* === Share Popover === */
.share-popover {
    position: absolute;
    z-index: 100;
    display: flex;
    gap: 4px;
    background: rgba(5, 5, 5, 0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0, 240, 255, 0.4);
    padding: 6px;
    box-shadow: 0 4px 20px rgba(0, 240, 255, 0.15);
    animation: popover-in 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}
.share-popover::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%) rotate(45deg);
    width: 10px;
    height: 10px;
    background: rgba(5, 5, 5, 0.95);
    border-right: 1px solid rgba(0, 240, 255, 0.4);
    border-bottom: 1px solid rgba(0, 240, 255, 0.4);
}
@keyframes popover-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}
.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 28px;
    padding: 0 10px;
    background: transparent;
    color: rgba(255, 255, 255, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.1);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.1em;
    text-decoration: none;
    transition: all 0.2s;
}
.share-btn:hover {
    color: #00f0ff;
    border-color: rgba(0, 240, 255, 0.5);
    background: rgba(0, 240, 255, 0.05);
}

/* === Share Trigger Button === */
.share-trigger {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: none;
}

/* === Timeline Scrub (右側のyearナビ) === */
#timeline-scrub {
    position: fixed;
    right: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    z-index: 25;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem 0.5rem;
    background: rgba(5, 5, 5, 0.5);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 2px;
}
@media (max-width: 1024px) {
    #timeline-scrub { display: none !important; }
}
.scrub-year {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.4);
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    letter-spacing: 0.15em;
    transition: all 0.3s;
}
.scrub-year:hover { color: #00f0ff; }
.scrub-year.is-active {
    color: #00f0ff;
}
.scrub-year.is-active .scrub-dot {
    background: #00f0ff;
    box-shadow: 0 0 8px #00f0ff;
}
.scrub-year .scrub-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    transition: all 0.3s;
}
.scrub-year .scrub-label {
    opacity: 0;
    transform: translateX(-8px);
    transition: all 0.3s;
    pointer-events: none;
}
#timeline-scrub:hover .scrub-year .scrub-label,
.scrub-year.is-active .scrub-label {
    opacity: 1;
    transform: translateX(0);
}

/* === Command Palette === */
.command-palette-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 12vh;
    animation: cmd-overlay-in 0.2s ease-out;
}
@keyframes cmd-overlay-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
.command-palette {
    width: 100%;
    max-width: 640px;
    margin: 0 1rem;
    background: rgba(10, 10, 10, 0.98);
    border: 1px solid rgba(0, 240, 255, 0.3);
    box-shadow: 0 20px 60px rgba(0, 240, 255, 0.15);
    animation: cmd-panel-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes cmd-panel-in {
    from { opacity: 0; transform: translateY(-12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}
.cmd-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}
.cmd-input {
    flex-grow: 1;
    background: transparent;
    border: none;
    color: #fff;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    outline: none;
}
.cmd-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}
.cmd-results {
    max-height: 60vh;
    overflow-y: auto;
    padding: 0.5rem;
}
.cmd-section {
    margin-bottom: 0.75rem;
}
.cmd-section:last-child {
    margin-bottom: 0;
}
.cmd-section-title {
    font-family: 'JetBrains Mono', monospace;
    font-size: 9px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.3);
    padding: 0.5rem 0.75rem;
}
.cmd-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.75rem;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.8);
    font-family: 'Noto Sans JP', sans-serif;
    font-size: 13px;
    text-align: left;
    transition: all 0.15s;
}
.cmd-item:hover {
    background: rgba(0, 240, 255, 0.05);
    color: #fff;
}
.cmd-item span {
    flex-grow: 1;
}
.cmd-item kbd {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 2px;
}
.cmd-shortcut-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.75rem;
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
}
.cmd-shortcut-row kbd {
    font-family: 'JetBrains Mono', monospace;
    font-size: 10px;
    color: #00f0ff;
    background: rgba(0, 240, 255, 0.05);
    border: 1px solid rgba(0, 240, 255, 0.3);
    padding: 3px 8px;
    border-radius: 2px;
    margin-left: 4px;
}
.cmd-cat-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 6px currentColor;
}

/* === Help Button === */
.shortcut-help-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.4);
    transition: all 0.3s;
}
.shortcut-help-btn:hover {
    color: #00f0ff;
    border-color: rgba(0, 240, 255, 0.5);
    background: rgba(0, 240, 255, 0.05);
}

/* === Print Mode === */
@media print {
    body {
        background: white !important;
        color: black !important;
        cursor: auto !important;
    }
    .cad-grid, .cursor-dot, .cursor-outline,
    .controls-sticky, #timeline-scrub, #stats-counter,
    #featured-hero-wrap, .share-trigger,
    header, .hero-scan, footer, .new-badge {
        display: none !important;
    }
    .article-card {
        opacity: 1 !important;
        transform: none !important;
        page-break-inside: avoid;
        border-bottom: 1px solid #ccc !important;
    }
    .article-card * {
        color: black !important;
    }
    h1, h2 {
        color: black !important;
    }
    .year-marker {
        background: white !important;
        color: black !important;
        position: static !important;
    }
    .year-marker .text-white,
    .year-marker .text-gray-500 {
        color: black !important;
    }
}
