/* 
   Mantine-like CSS Variables 
   Ref: https://mantine.dev/theming/colors/
*/
:root {
    --color-white: #ffffff;
    --color-black: #000000;

    /* Gray Scale */
    --gray-0: #f8f9fa;
    --gray-1: #f1f3f5;
    --gray-2: #e9ecef;
    --gray-4: #ced4da;
    --gray-6: #868e96;
    --gray-7: #495057;
    --gray-9: #212529;

    /* Brand Color (Blue) */
    --primary-light: #e7f5ff;
    --primary: #228be6;
    --primary-dark: #1971c2;

    /* Spacing */
    --spacing-xs: 8px;
    --spacing-sm: 12px;
    --spacing-md: 16px;
    --spacing-lg: 24px;
    --spacing-xl: 32px;

    /* Radius */
    --radius-sm: 4px;
    --radius-md: 8px;
    --radius-lg: 16px;

    /* Shadows */
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.05), 0 1px 2px rgba(0, 0, 0, 0.1);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
    --shadow-hover: 0 10px 15px -3px rgba(0, 0, 0, 0.05), 0 4px 6px -2px rgba(0, 0, 0, 0.025);

    /* Font */
    --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

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

body {
    font-family: var(--font-family);
    color: var(--gray-9);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    cursor: pointer;
    border: none;
    background: none;
}

/* Utilities */
.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 var(--spacing-md);
}

/* Header */
.main-header {
    background: var(--color-white);
    border-bottom: 1px solid var(--gray-2);
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    font-size: 2.4rem;
    font-weight: 700;
    color: var(--gray-9);
    letter-spacing: -0.5px;
}

.logo .highlight {
    color: hsl(var(--primary));
}

.main-nav {
    display: flex;
    gap: var(--spacing-lg);
}

.nav-link {
    font-size: 1.5rem;
    font-weight: 500;
    color: var(--gray-6);
    transition: color 0.2s;
}

.nav-link:hover,
.nav-link.active {
    color: var(--gray-9);
}

/* Content Section */
.board-section {
    padding-bottom: 6.5rem;
}

.section-header {
    margin-bottom: var(--spacing-xl);
}

.section-header h2 {
    font-size: 3.6rem;
    font-weight: 800;
    margin-bottom: var(--spacing-sm);
    letter-spacing: -0.03em;
    color: hsl(var(--foreground));
    /* Explicitly darker */
    position: relative;
    display: inline-block;
}

.section-header h2::after {
    content: '';
    display: block;
    width: 3rem;
    /* Short accent bar */
    height: 4px;
    background-color: hsl(var(--primary));
    margin-top: 0.5rem;
    border-radius: 2px;
}

.section-desc {
    color: var(--gray-6);
}

/* Grid Layout */
.grid-layout {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: var(--spacing-lg);
}

/* Card Component (Mantine Style) */
.card {
    background: var(--color-white);
    border: 1px solid var(--gray-2);
    border-radius: var(--radius-md);
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    display: flex;
    flex-direction: column;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-hover);
}

.card-image-wrapper {
    position: relative;
    height: 200px;
    overflow: hidden;
    background-color: var(--gray-1);
    /* Placeholder color */
}

.card-image {
    display: block;
    width: 100%;
    max-width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.card:hover .card-image {
    transform: scale(1.05);
}

.badge {
    position: absolute;
    top: var(--spacing-sm);
    right: var(--spacing-sm);
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(4px);
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    font-size: 1.2rem;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--gray-7);
    box-shadow: var(--shadow-sm);
}

/* Badge Color Variations based on category (Simple CSS implementation) */
.badge[data-category="Design"] {
    color: #e03131;
}

.badge[data-category="Tech"] {
    color: #1971c2;
}

.badge[data-category="Lifestyle"] {
    color: #2f9e44;
}

.card-content {
    padding: var(--spacing-md);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.card-title {
    font-size: 1.6rem;
    font-weight: 600;
    margin-bottom: var(--spacing-xs);
    line-height: 1.4;
    color: var(--gray-9);
}

.card-summary {
    font-size: 1.3rem;
    color: var(--gray-6);
    margin-bottom: var(--spacing-lg);
    line-height: 1.6;
    flex-grow: 1;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid var(--gray-1);
    padding-top: var(--spacing-md);
    margin-top: auto;
}

.footer-info {
    display: flex;
    flex-direction: column;
    margin-right: auto;
    padding-left: 5px;
}

.author-name {
    font-size: 1.3rem;
    font-weight: 500;
    color: var(--gray-7);
}

.post-date {
    font-size: 1.2rem;
    color: var(--gray-4);
}

.icon-btn {
    color: var(--gray-4);
    padding: 4px;
    border-radius: var(--radius-sm);
    transition: color 0.2s, background 0.2s;
}

.icon-btn:hover {
    color: hsl(var(--primary));
    background: var(--primary-light);
}

/* Button */
.btn-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    height: 2.5rem;
    /* Fixed height */
    padding: 0 1rem;
    /* Horizontal padding only */
    border-radius: var(--radius);
    font-weight: 500;
    transition: opacity 0.2s, transform 0.2s;
}

.btn-back {
    margin-top: 2rem;
    padding: 0 1.5rem;
}

.btn-back:hover {
    opacity: 0.9;
    transform: translateY(-2px);
}


/* Footer */
.main-footer {
    margin-top: var(--spacing-xl);
    padding: var(--spacing-xl) 0;
    border-top: 1px solid var(--gray-2);
    text-align: center;
    color: var(--gray-5);
    font-size: 1.4rem;
}

/* Loading */
.loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--gray-2);
    border-radius: 50%;
    border-top-color: hsl(var(--primary));
    animation: spin 1s linear infinite;
    margin: 50px auto;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

/* Pagination */
.pagination {
    display: flex;
    justify-content: center;
    gap: 5px;
    margin-top: 3rem;
    padding-bottom: 2rem;
}

.page-btn {
    padding: 0.5rem 0.8rem;
    border: 1px solid #ddd;
    background: white;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.5rem;
    color: var(--text-gray);
    transition: all 0.2s;
}

.page-btn:hover {
    background: #f0f0f0;
    color: hsl(var(--primary));
    border-color: hsl(var(--primary));
}

.page-btn.active {
    background: hsl(var(--primary));
    color: white;
    border-color: hsl(var(--primary));
}

/* Responsive */
@media (max-width: 768px) {
    .grid-layout {
        grid-template-columns: 1fr;
    }
}

/* Shadcn UI Style Implementation */
:root {
    --background: 0 0% 100%;
    --foreground: 222.2 84% 4.9%;
    --card: 0 0% 100%;
    --card-foreground: 222.2 84% 4.9%;
    --popover: 0 0% 100%;
    --popover-foreground: 222.2 84% 4.9%;
    --primary: 221.2 83.2% 53.3%;
    --primary-foreground: 210 40% 98%;
    --secondary: 210 40% 96.1%;
    --secondary-foreground: 222.2 47.4% 11.2%;
    --muted: 210 40% 96.1%;
    --muted-foreground: 215.4 16.3% 46.9%;
    --accent: 210 40% 96.1%;
    --accent-foreground: 222.2 47.4% 11.2%;
    --destructive: 0 84.2% 60.2%;
    --destructive-foreground: 210 40% 98%;
    --border: 214.3 31.8% 91.4%;
    --input: 214.3 31.8% 91.4%;
    --ring: 221.2 83.2% 53.3%;
    --radius: 0.5rem;
}

.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    /* Slightly darker */
    backdrop-filter: blur(4px);
    z-index: 9999;
    /* Ensure it's on top of Bootstrap navbar */
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease-out;
}

.dialog-content {
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    border-radius: var(--radius);
    border: 1px solid hsl(var(--border));
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    width: 100%;
    max-width: 425px;
    padding: 1.5rem;
    position: relative;
    animation: slideIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.dialog-header {
    display: flex;
    flex-direction: column;
    text-align: left;
    margin-bottom: 1.5rem;
}

.dialog-title {
    font-size: 1.8rem;
    font-weight: 600;
    line-height: 1;
    margin: 0;
    letter-spacing: -0.025em;
}

.dialog-description {
    font-size: 1.4rem;
    color: hsl(var(--muted-foreground));
    margin-top: 0.375rem;
    line-height: 1.25rem;
}

.dialog-body {
    display: grid;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.dialog-label {
    font-size: 1.4rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
    display: block;
    text-align: left;
}

.dialog-input {
    display: flex;
    height: 2.5rem;
    width: 100%;
    border-radius: var(--radius);
    border: 1px solid hsl(var(--input));
    background-color: hsl(var(--background));
    padding: 0.5rem 0.75rem;
    font-size: 1.4rem;
    transition: box-shadow 0.2s;
}

.dialog-input:focus {
    outline: none;
    box-shadow: 0 0 0 2px hsl(var(--ring));
    border-color: hsl(var(--ring));
}

.dialog-footer {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-start;
    gap: 0.5rem;
}

.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    font-size: 1.4rem;
    font-weight: 500;
    height: 2.5rem;
    padding: 0 1rem;
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border: none;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-primary:hover {
    opacity: 0.9;
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    font-size: 1.4rem;
    font-weight: 500;
    height: 2.5rem;
    padding: 0 1rem;
    background-color: hsl(var(--background));
    color: hsl(var(--foreground));
    border: 1px solid hsl(var(--input));
    cursor: pointer;
    transition: background-color 0.2s;
}

.btn-outline:hover {
    background-color: hsl(var(--accent));
    color: hsl(var(--accent-foreground));
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(10px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Magazine Header */
html {
    font-size: 62.5% !important;
    /* Force 10px root for this page */
}

/* Magazine Header */
.magazine-header {
    text-align: center;
    padding: 6rem 0 1.5rem;
    /* Reduced padding for visibility */
    margin-top: 2rem;
    margin-bottom: 2rem;

    /* Full-width Breakout */
    width: 100vw;
    margin-left: calc(50% - 50vw);

    background-color: #ffffff;
    /* Dot pattern with Fade-to-White at Top and Bottom */
    background-image:
        linear-gradient(to bottom,
            rgba(255, 255, 255, 1) 0%,
            rgba(255, 255, 255, 0) 20%,
            rgba(255, 255, 255, 0) 80%,
            rgba(255, 255, 255, 1) 100%),
        radial-gradient(#e1e4e8 1px, transparent 1px);
    background-size: 100% 100%, 20px 20px;

    border-bottom: none;
    position: relative;
}

.magazine-header::after {
    display: none;
    /* Remove separator line */
}

.header-badge {
    display: inline-block;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--primary);
    background: var(--primary-light);
    padding: 0.4rem 1.2rem;
    border-radius: 2rem;
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.main-title {
    font-family: 'Inter', sans-serif;
    font-size: 4.2rem;
    /* Increased size */
    font-weight: 800;
    /* Extra bold */
    color: #111;
    /* Darker black */
    margin-bottom: 0.5rem;
    letter-spacing: -0.03em;
    /* Tight tracking */
    line-height: 1.1;
}

.title-highlight {
    color: #154492;
    /* Requested color */
}

.sub-title {
    font-size: 1.6rem;
    color: var(--gray-6);
    font-weight: 400;
    letter-spacing: -0.01em;
    margin-bottom: 3rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    line-height: 1.6;
}

@media (min-width: 768px) {
    .main-title {
        font-size: 4.5rem;
        /* Bigger on desktop */
    }
}

/* Standard Search Bar */
.search-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 2rem;
    margin-top: 2rem;
    z-index: 50;
}

.search-bar {
    position: relative;
    width: 320px;
    height: 48px;
    background: white;
    border: 1px solid var(--gray-4);
    border-radius: 9999px;
    display: flex;
    align-items: center;
    overflow: hidden;
    transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.search-bar:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.search-icon {
    position: absolute;
    left: 1.5rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-6);
    font-size: 1.4rem;
    pointer-events: none;
}

.search-input {
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    outline: none;
    padding: 0 1.5rem 0 3.5rem;
    /* Left padding for icon */
    font-size: 1.4rem;
    color: var(--gray-9);
    opacity: 1;
    /* Always visible */
}