/* ==========================================================================
   Blog Post Typography & Layout
   Inspired by Help Scout's clean, readable blog design
   ========================================================================== */

/* --------------------------------------------------------------------------
   CSS Custom Properties (Design Tokens)
   -------------------------------------------------------------------------- */
.post {
    --post-color-text: #1f2937;
    --post-color-text-muted: #6b7280;
    --post-color-heading: #111827;
    --post-color-link: #0369a1;
    --post-color-link-hover: #0284c7;
    --post-color-accent: #F97316;
    --post-color-border: #e5e7eb;
    --post-color-bg-subtle: #f9fafb;
    --post-color-bg-code: #f3f4f6;

    --post-font-body: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --post-font-heading: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --post-font-code: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;

    --post-spacing-xs: 0.5rem;
    --post-spacing-sm: 0.75rem;
    --post-spacing-md: 1rem;
    --post-spacing-lg: 1.5rem;
    --post-spacing-xl: 2rem;
    --post-spacing-2xl: 2.5rem;
    --post-spacing-3xl: 3rem;

    --post-radius-sm: 4px;
    --post-radius-md: 8px;
    --post-radius-lg: 12px;
}

/* --------------------------------------------------------------------------
   Base Post Styles
   -------------------------------------------------------------------------- */
.post {
    color: var(--post-color-text);
    font-family: var(--post-font-body);
    font-size: 1.0625rem;
    line-height: 1.7;
    font-weight: 400;
}

/* --------------------------------------------------------------------------
   Links
   -------------------------------------------------------------------------- */
.post a,
.post a:visited {
    color: var(--post-color-link);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
    transition: color 0.15s ease;
}

.post a:hover {
    color: var(--post-color-link-hover);
}

/* --------------------------------------------------------------------------
   Headings - Tighter spacing, balanced text
   -------------------------------------------------------------------------- */
.post h1,
.post h2,
.post h3,
.post h4,
.post h5,
.post h6 {
    font-family: var(--post-font-heading);
    color: var(--post-color-heading);
    font-weight: 700;
    line-height: 1.3;
    text-wrap: balance;
    margin-top: var(--post-spacing-2xl);
    margin-bottom: var(--post-spacing-md);
}

.post h1 {
    font-size: 2.5rem;
    font-weight: 500;
    letter-spacing: -0.02em;
    line-height: 1.2;
    margin-top: 0;
    text-align: left;
}

.post h2 {
    font-size: 1.625rem;
    padding-bottom: var(--post-spacing-sm);
    border-bottom: 1px solid var(--post-color-border);
    margin-top: var(--post-spacing-3xl);
}

.post h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-top: var(--post-spacing-xl);
}

.post h4 {
    font-size: 1.125rem;
    font-weight: 600;
    margin-top: var(--post-spacing-lg);
}

/* First heading after content start shouldn't have top margin */
.post header + h2,
.post > h2:first-child {
    margin-top: 0;
}

/* --------------------------------------------------------------------------
   Paragraphs
   -------------------------------------------------------------------------- */
.post p {
    font-family: var(--post-font-body);
    font-size: 1.0625rem;
    line-height: 1.7;
    margin-bottom: var(--post-spacing-lg);
    color: var(--post-color-text);
}

/* Lead paragraph (meta description shown at top) */
.post header p {
    font-size: 1.1875rem;
    color: var(--post-color-text);
    line-height: 1.6;
    font-weight: 400;
}

/* --------------------------------------------------------------------------
   Lists - Refined styling
   -------------------------------------------------------------------------- */
.post ul,
.post ol {
    margin-top: var(--post-spacing-lg);
    margin-bottom: var(--post-spacing-lg);
    margin-left: 2.5rem;
    padding-left: 1.5rem;
    color: var(--post-color-text);
}

.post ul {
    list-style-type: disc;
}

.post ul ul {
    list-style-type: circle;
    margin-top: var(--post-spacing-sm);
    margin-bottom: var(--post-spacing-sm);
}

.post ol {
    list-style-type: decimal;
}

.post li {
    font-family: var(--post-font-body);
    font-size: 1.0625rem;
    line-height: 1.7;
    margin-bottom: var(--post-spacing-sm);
    padding-left: var(--post-spacing-xs);
}

.post li::marker {
    color: var(--post-color-text-muted);
}

/* Nested lists */
.post li > ul,
.post li > ol {
    margin-top: var(--post-spacing-sm);
}

/* --------------------------------------------------------------------------
   Blockquotes - Clean, modern styling
   -------------------------------------------------------------------------- */
.post blockquote {
    background: var(--post-color-bg-subtle);
    border-left: 4px solid var(--post-color-accent);
    border-radius: 0 var(--post-radius-md) var(--post-radius-md) 0;
    padding: var(--post-spacing-lg) var(--post-spacing-xl);
    margin: var(--post-spacing-xl) 0;
    font-size: 1.0625rem;
    font-style: normal;
    font-weight: 500;
    line-height: 1.7;
    color: var(--post-color-heading);
    position: relative;
    box-shadow: none;
}

.post blockquote::before {
    display: none;
}

.post blockquote p {
    margin-bottom: var(--post-spacing-sm);
    font-size: inherit;
    line-height: inherit;
}

.post blockquote p:last-child {
    margin-bottom: 0;
}

.post blockquote strong {
    color: var(--post-color-heading);
}

/* --------------------------------------------------------------------------
   Code - Inline and blocks
   -------------------------------------------------------------------------- */
.post code {
    font-family: var(--post-font-code);
    font-size: 0.875em;
    background: var(--post-color-bg-code);
    padding: 0.125rem 0.375rem;
    border-radius: var(--post-radius-sm);
    color: #be185d;
}

.post pre {
    background: #1e293b;
    color: #e2e8f0;
    padding: var(--post-spacing-lg);
    border-radius: var(--post-radius-md);
    overflow-x: auto;
    margin: var(--post-spacing-xl) 0;
    font-size: 0.875rem;
    line-height: 1.6;
}

.post pre code {
    background: transparent;
    padding: 0;
    color: inherit;
    font-size: inherit;
}

/* --------------------------------------------------------------------------
   Tables - Clean, readable
   -------------------------------------------------------------------------- */
.post table {
    width: 100%;
    border-collapse: collapse;
    margin: var(--post-spacing-xl) 0;
    font-size: 0.9375rem;
    font-family: var(--post-font-heading);
}

.post table th,
.post table td {
    border: 1px solid var(--post-color-border);
    padding: var(--post-spacing-sm) var(--post-spacing-md);
    text-align: left;
}

.post table th {
    background-color: var(--post-color-bg-subtle);
    color: var(--post-color-heading);
    font-weight: 600;
    font-size: 0.8125rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.post table tr:nth-child(even) {
    background-color: var(--post-color-bg-subtle);
}

.post table tr:hover {
    background-color: #f3f4f6;
}

/* --------------------------------------------------------------------------
   Images
   -------------------------------------------------------------------------- */
.post img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: var(--post-spacing-xl) auto;
    border-radius: var(--post-radius-md);
}

/* --------------------------------------------------------------------------
   Horizontal Rules
   -------------------------------------------------------------------------- */
.post hr {
    border: none;
    border-top: 1px solid var(--post-color-border);
    margin: var(--post-spacing-3xl) 0;
}

/* --------------------------------------------------------------------------
   Callout Boxes - Tip, Note, Warning styles
   -------------------------------------------------------------------------- */
.post .callout,
.post .tip,
.post .note,
.post .warning {
    padding: var(--post-spacing-lg);
    border-radius: var(--post-radius-md);
    margin: var(--post-spacing-xl) 0;
    font-family: var(--post-font-heading);
    font-size: 0.9375rem;
    line-height: 1.6;
}

.post .callout p,
.post .tip p,
.post .note p,
.post .warning p {
    font-family: var(--post-font-heading);
    font-size: 0.9375rem;
    margin-bottom: var(--post-spacing-sm);
}

.post .callout p:last-child,
.post .tip p:last-child,
.post .note p:last-child,
.post .warning p:last-child {
    margin-bottom: 0;
}

.post .tip {
    background: #ecfdf5;
    border-left: 4px solid #10b981;
}

.post .note {
    background: #eff6ff;
    border-left: 4px solid #3b82f6;
}

.post .warning {
    background: #fffbeb;
    border-left: 4px solid #f59e0b;
}

/* --------------------------------------------------------------------------
   Callout Quote (Pull quotes)
   -------------------------------------------------------------------------- */
.post .callout-quote {
    font-size: 1.75rem;
    line-height: 1.4;
    color: var(--post-color-text-muted);
    font-family: var(--post-font-body);
    font-weight: normal;
    font-style: italic;
    margin: var(--post-spacing-3xl) 0;
    padding: 0 var(--post-spacing-xl);
    text-align: center;
    border: none;
}

/* --------------------------------------------------------------------------
   CTA Boxes (existing gradient style)
   -------------------------------------------------------------------------- */
.post div[style*="linear-gradient"] {
    border-radius: var(--post-radius-lg) !important;
}

/* --------------------------------------------------------------------------
   Remove H2 content indentation (cleaner look)
   -------------------------------------------------------------------------- */
.post h2 ~ p,
.post h2 ~ ul,
.post h2 ~ ol,
.post h2 ~ div:not(.callout-quote) {
    padding-left: 0;
}

/* --------------------------------------------------------------------------
   H3 styling - Keep subtle hierarchy without heavy indentation
   -------------------------------------------------------------------------- */
.post h3 + p,
.post h3 + p + p,
.post h3 + p + p + p,
.post h3 + p + p + p + p,
.post h3 + blockquote,
.post h3 + p + blockquote,
.post h3 + p + p + blockquote {
    margin-left: 0;
}

/* --------------------------------------------------------------------------
   Stat Grids
   -------------------------------------------------------------------------- */
.post .stat-grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--post-spacing-lg);
}

.post .stat-grid-vs {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: var(--post-spacing-lg);
    align-items: center;
}

/* --------------------------------------------------------------------------
   SVG icons in headings (for ISP logos etc)
   -------------------------------------------------------------------------- */
.post h3 svg {
    vertical-align: middle;
    margin-right: var(--post-spacing-xs);
}

/* --------------------------------------------------------------------------
   Strong and emphasis
   -------------------------------------------------------------------------- */
.post strong {
    font-weight: 600;
    color: var(--post-color-heading);
}

.post em {
    font-style: italic;
}

/* --------------------------------------------------------------------------
   Responsive Styles
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
    .post {
        font-size: 1rem;
    }

    .post h1 {
        font-size: 1.625rem;
    }

    .post h2 {
        font-size: 1.25rem;
        margin-top: var(--post-spacing-xl);
    }

    .post h3 {
        font-size: 1.0625rem;
    }

    .post p,
    .post li {
        font-size: 1rem;
    }

    .post blockquote {
        padding: var(--post-spacing-md) var(--post-spacing-lg);
        margin-left: 0;
        margin-right: 0;
    }

    .post pre {
        padding: var(--post-spacing-md);
        font-size: 0.8125rem;
        border-radius: var(--post-radius-sm);
    }

    .post .callout-quote {
        font-size: 1.375rem;
        padding: 0;
        margin: var(--post-spacing-xl) 0;
    }

    .post .stat-grid-2 {
        grid-template-columns: 1fr;
    }

    .post .stat-grid-vs {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .post .stat-grid-vs > div:nth-child(2) {
        display: none;
    }

    .post table {
        font-size: 0.875rem;
    }

    .post table th,
    .post table td {
        padding: var(--post-spacing-xs) var(--post-spacing-sm);
    }
}

/* --------------------------------------------------------------------------
   Print Styles
   -------------------------------------------------------------------------- */
@media print {
    .post {
        font-size: 12pt;
        line-height: 1.5;
    }

    .post h2 {
        border-bottom: 1px solid #000;
    }

    .post pre {
        background: #f5f5f5;
        color: #000;
        border: 1px solid #ccc;
    }

    .post a {
        color: #000;
        text-decoration: underline;
    }

    .post blockquote {
        border-left-color: #666;
        background: #f9f9f9;
    }
}
