/**
 * Frontend Styles - DailyShip Blog
 * Dark theme inspired by deep navy + blue glow aesthetic
 * Fonts: Space Grotesk (headings), DM Sans (body), JetBrains Mono (code)
 */

/* ============ Design Tokens ============ */
:root {
    --bg: #0B0F1A;
    --surface: #111827;
    --card: #1A2236;
    --border: #1E2D45;
    --blue-400: #60A5FA;
    --blue-500: #3B82F6;
    --blue-600: #2563EB;
    --purple-400: #818CF8;
    --purple-500: #C084FC;
    --text-primary: #E2E8F0;
    --text-secondary: #94A3B8;
    --text-muted: #64748B;
    --glow: 0 0 24px rgba(59, 130, 246, 0.20);
    --glow-sm: 0 0 12px rgba(59, 130, 246, 0.15);
}

/* ============ Reset & Base ============ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html { scroll-behavior: smooth; }

body {
    font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.7;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
    font-family: 'Space Grotesk', sans-serif;
    line-height: 1.3;
}

code, pre, .mono {
    font-family: 'JetBrains Mono', 'Fira Code', monospace;
}

a {
    color: var(--blue-400);
    text-decoration: none;
    transition: color 0.2s;
}

a:hover { color: var(--blue-500); }

img { max-width: 100%; height: auto; }

/* ============ Utilities ============ */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 24px;
}

.gradient-text {
    background: linear-gradient(135deg, #60A5FA 0%, #818CF8 50%, #C084FC 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.text-glow { text-shadow: 0 0 20px rgba(96, 165, 250, 0.40); }

/* ============ Header ============ */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(11, 15, 26, 0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 72px;
}

.logo {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, #60A5FA 0%, #818CF8 50%, #C084FC 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
}

.logo-icon {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.logo-icon svg {
    width: 28px;
    height: 28px;
}

.nav {
    display: flex;
    gap: 8px;
    list-style: none;
    align-items: center;
}

.nav a {
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 0.9rem;
    padding: 8px 16px;
    border-radius: 8px;
    position: relative;
    transition: color 0.2s, background 0.2s;
}

.nav a:hover,
.nav a.active {
    color: var(--text-primary);
    background: rgba(96, 165, 250, 0.08);
}

/* ============ Hero ============ */
.hero {
    position: relative;
    padding: 100px 0 80px;
    text-align: center;
    overflow: hidden;
}

.hero::before {
    content: '';
    position: absolute;
    top: -50%;
    left: 50%;
    transform: translateX(-50%);
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.12) 0%, rgba(129, 140, 248, 0.06) 40%, transparent 70%);
    pointer-events: none;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 16px;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.20);
    border-radius: 100px;
    font-size: 0.85rem;
    color: var(--blue-400);
    font-weight: 500;
    margin-bottom: 24px;
}

.hero-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--blue-400);
    animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.hero h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: -0.03em;
    position: relative;
}

.hero p {
    font-size: 1.2rem;
    color: var(--text-secondary);
    max-width: 600px;
    margin: 0 auto;
    line-height: 1.7;
}

.hero-cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 32px;
    padding: 12px 28px;
    background: var(--blue-500);
    color: #fff;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: background 0.2s, box-shadow 0.2s;
    cursor: pointer;
}

.hero-cta:hover {
    background: var(--blue-600);
    box-shadow: var(--glow);
    color: #fff;
}

/* ============ Search Bar ============ */
.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 6px 8px 6px 16px;
    margin-bottom: 24px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-bar:focus-within {
    border-color: var(--blue-500);
    box-shadow: var(--glow-sm);
}

.search-bar-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: var(--text-muted);
}

.search-bar-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    padding: 8px 4px;
    min-width: 0;
}

.search-bar-input::placeholder {
    color: var(--text-muted);
}

.search-bar-clear {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    transition: color 0.2s;
}

.search-bar-clear:hover {
    color: var(--text-primary);
}

.search-bar-btn {
    background: var(--blue-500);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 8px 18px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.2s, box-shadow 0.2s;
    white-space: nowrap;
}

.search-bar-btn:hover {
    background: var(--blue-600);
    box-shadow: var(--glow-sm);
}

/* ============ Tag Filter ============ */
.tag-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 28px;
}

.tag-chip {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 500;
    border: 1px solid var(--border);
    color: var(--text-secondary);
    background: transparent;
    transition: all 0.2s;
    cursor: pointer;
    white-space: nowrap;
}

.tag-chip:hover {
    border-color: var(--blue-400);
    color: var(--blue-400);
    background: rgba(59, 130, 246, 0.06);
}

.tag-chip-all {
    border-color: var(--border);
    color: var(--text-secondary);
}

.tag-chip-all.tag-chip-active {
    background: var(--blue-500);
    border-color: var(--blue-500);
    color: #fff;
}

.tag-chip-active {
    box-shadow: var(--glow-sm);
}

/* ============ Posts Section ============ */
.posts-section {
    padding: 60px 0 80px;
}

.section-title {
    font-size: 1.35rem;
    font-weight: 600;
    margin-bottom: 32px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-primary);
}

.section-title::before {
    content: '';
    width: 4px;
    height: 22px;
    background: linear-gradient(180deg, var(--blue-400), var(--purple-400));
    border-radius: 2px;
}

/* ============ Posts Grid ============ */
.posts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 24px;
}

/* ============ Post Card ============ */
.post-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    overflow: hidden;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    cursor: pointer;
}

.post-card:hover {
    border-color: rgba(59, 130, 246, 0.40);
    box-shadow: var(--glow);
    transform: translateY(-2px);
}

.post-image {
    width: 100%;
    height: 200px;
    object-fit: cover;
    background: var(--card);
}

.post-image-placeholder {
    width: 100%;
    height: 200px;
    background: linear-gradient(135deg, var(--card) 0%, var(--surface) 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    overflow: hidden;
}

.post-image-placeholder::before {
    content: '';
    position: absolute;
    width: 120px;
    height: 120px;
    background: radial-gradient(circle, rgba(59, 130, 246, 0.15), transparent 70%);
}

.post-image-placeholder svg {
    width: 48px;
    height: 48px;
    color: var(--text-muted);
    opacity: 0.4;
}

.post-body {
    padding: 24px;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.post-category {
    background: rgba(59, 130, 246, 0.10);
    color: var(--blue-400);
    padding: 3px 10px;
    border-radius: 6px;
    font-weight: 500;
    font-size: 0.78rem;
    letter-spacing: 0.02em;
}

.post-title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 10px;
    line-height: 1.45;
}

.post-title a {
    color: var(--text-primary);
    transition: color 0.2s;
}

.post-title a:hover { color: var(--blue-400); }

.post-excerpt {
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.post-views {
    color: var(--text-muted);
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 6px;
}

.post-views svg {
    width: 16px;
    height: 16px;
}

.read-more {
    font-weight: 500;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--blue-400);
}

.read-more:hover .read-more-arrow {
    transform: translateX(4px);
}

.read-more-arrow {
    transition: transform 0.2s;
    display: inline-block;
}

/* ============ Pagination ============ */
.pagination {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 48px;
}

.pagination a,
.pagination span {
    padding: 10px 16px;
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all 0.2s;
}

.pagination a {
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
}

.pagination a:hover {
    background: var(--blue-500);
    border-color: var(--blue-500);
    color: white;
    box-shadow: var(--glow-sm);
}

.pagination .active {
    background: var(--blue-500);
    color: white;
    box-shadow: var(--glow-sm);
}

.pagination .disabled {
    opacity: 0.4;
    cursor: not-allowed;
    color: var(--text-muted);
}

.pagination .ellipsis {
    color: var(--text-muted);
}

/* ============ Post Detail ============ */
.post-detail {
    padding: 60px 0 80px;
}

.post-detail-header {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 48px;
}

.post-detail-title {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 20px;
    letter-spacing: -0.02em;
}

.post-detail-meta {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 20px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.post-detail-meta span {
    display: flex;
    align-items: center;
    gap: 6px;
}

.post-detail-meta svg {
    width: 16px;
    height: 16px;
    color: var(--text-muted);
}

.post-detail-featured {
    width: 100%;
    object-fit: contain;
    border-radius: 16px;
    margin-bottom: 48px;
    border: 1px solid var(--border);
}

/* ============ Article Content ============ */
.post-detail-content {
    max-width: 750px;
    margin: 0 auto;
    font-size: 1.05rem;
    line-height: 1.8;
}

.post-detail-content h1,
.post-detail-content h2,
.post-detail-content h3 {
    color: var(--text-primary);
    margin-top: 40px;
    margin-bottom: 16px;
}

.post-detail-content h2 {
    font-size: 1.6rem;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.post-detail-content h3 {
    font-size: 1.3rem;
}

.post-detail-content p {
    margin-bottom: 20px;
    color: var(--text-secondary);
}

.post-detail-content ul,
.post-detail-content ol {
    margin-bottom: 20px;
    padding-left: 24px;
}

.post-detail-content li {
    margin-bottom: 8px;
    color: var(--text-secondary);
}

.post-detail-content a {
    color: var(--blue-400);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.post-detail-content blockquote {
    border-left: 3px solid var(--blue-500);
    padding: 16px 24px;
    margin: 24px 0;
    background: rgba(59, 130, 246, 0.05);
    border-radius: 0 8px 8px 0;
    color: var(--text-secondary);
    font-style: italic;
}

.post-detail-content code {
    background: var(--card);
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 0.88em;
    border: 1px solid var(--border);
}

.post-detail-content pre {
    background: #0D1117;
    padding: 20px 24px;
    border-radius: 12px;
    overflow-x: auto;
    margin-bottom: 24px;
    border: 1px solid var(--border);
    line-height: 1.7;
    font-size: 0.88rem;
}

.post-detail-content pre code {
    padding: 0;
    background: none;
    border: none;
    font-size: inherit;
}

.post-detail-content img {
    border-radius: 12px;
    margin: 24px 0;
    border: 1px solid var(--border);
}

.post-detail-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 24px 0;
}

.post-detail-content th,
.post-detail-content td {
    padding: 12px 16px;
    border: 1px solid var(--border);
    text-align: left;
}

.post-detail-content th {
    background: var(--card);
    font-weight: 600;
}

.post-detail-content hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 40px 0;
}

/* ============ Tags ============ */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 40px;
    max-width: 750px;
    margin-left: auto;
    margin-right: auto;
}

.tag {
    padding: 5px 14px;
    border-radius: 6px;
    font-size: 0.8rem;
    font-weight: 500;
    color: white;
    transition: opacity 0.2s;
    cursor: pointer;
}

.tag:hover {
    opacity: 0.85;
    color: white;
}

/* ============ Back Link ============ */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 32px;
    transition: color 0.2s;
}

.back-link:hover { color: var(--blue-400); }

.back-link svg {
    width: 16px;
    height: 16px;
}

/* ============ Footer ============ */
.footer {
    background: var(--surface);
    border-top: 1px solid var(--border);
    padding: 48px 0 24px;
    margin-top: 40px;
}

.footer-content {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.footer-content .logo {
    margin-bottom: 12px;
    display: inline-block;
}

.footer p {
    margin-top: 8px;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 16px;
}

.footer-links a {
    color: var(--text-muted);
    font-size: 0.85rem;
    transition: color 0.2s;
}

.footer-links a:hover { color: var(--blue-400); }

/* ============ 404 Page ============ */
.not-found-page {
    text-align: center;
    padding: 120px 20px;
}

.not-found-page h1 {
    font-size: 7rem;
    font-weight: 700;
    background: linear-gradient(135deg, #60A5FA 0%, #818CF8 50%, #C084FC 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 16px;
    letter-spacing: -0.04em;
}

.not-found-page p {
    color: var(--text-secondary);
    margin-bottom: 32px;
    font-size: 1.15rem;
}

.not-found-page .btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: var(--blue-500);
    color: white;
    padding: 12px 28px;
    border-radius: 10px;
    font-weight: 600;
    transition: background 0.2s, box-shadow 0.2s;
}

.not-found-page .btn:hover {
    background: var(--blue-600);
    box-shadow: var(--glow);
    color: white;
}

/* ============ Products Showcase ============ */
.products-section {
    padding: 0 0 80px;
}

.products-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

.product-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    padding: 24px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 14px;
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    color: inherit;
    text-decoration: none;
}

.product-card:hover {
    border-color: rgba(59, 130, 246, 0.40);
    box-shadow: var(--glow);
    transform: translateY(-2px);
    color: inherit;
}

.product-card-icon {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(59, 130, 246, 0.10);
    border-radius: 10px;
    color: var(--blue-400);
}

.product-card-icon svg {
    width: 22px;
    height: 22px;
}

.product-card-body {
    flex: 1;
    min-width: 0;
}

.product-card-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.product-card-external {
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 0.2s, transform 0.2s;
}

.product-card:hover .product-card-external {
    opacity: 1;
    transform: translate(2px, -2px);
}

.product-card-desc {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 10px;
}

.product-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.product-tag {
    font-size: 0.72rem;
    font-weight: 500;
    padding: 3px 9px;
    border-radius: 6px;
    background: rgba(129, 140, 248, 0.10);
    color: var(--purple-400);
    letter-spacing: 0.02em;
}

/* ============ Empty State ============ */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-muted);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.4;
}

.empty-state p {
    font-size: 1rem;
}

/* ============ Responsive ============ */
@media (max-width: 768px) {
    .hero { padding: 60px 0 48px; }

    .hero h1 { font-size: 2rem; }

    .hero p { font-size: 1rem; }

    .posts-grid {
        grid-template-columns: 1fr;
    }

    .nav { gap: 4px; }

    .nav a {
        padding: 6px 10px;
        font-size: 0.85rem;
    }

    .post-detail-title { font-size: 1.75rem; }

    .header-content {
        flex-direction: column;
        height: auto;
        padding: 12px 0;
        gap: 8px;
    }

    .section-title { font-size: 1.15rem; }

    .products-grid {
        grid-template-columns: 1fr;
    }

    .not-found-page h1 { font-size: 5rem; }

    .tag-filter { gap: 6px; }

    .tag-chip {
        padding: 4px 10px;
        font-size: 0.75rem;
    }

    .search-bar-btn {
        padding: 8px 12px;
        font-size: 0.8rem;
    }
}

@media (max-width: 480px) {
    .hero h1 { font-size: 1.65rem; }

    .posts-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .post-body { padding: 16px; }

    .pagination { gap: 4px; }
    .pagination a, .pagination span {
        padding: 8px 12px;
        font-size: 0.85rem;
    }
}

/* ============ Reduced Motion ============ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}
