/*
 * TAX.hk print stylesheet.
 *
 * Linked from partials/print-styles.blade.php with media="print", so it never
 * blocks rendering and is cached once instead of being re-sent inline with
 * every HTML document (it was 7,905 B of inline <style> on every page).
 *
 * The @media print wrapper is kept so the file is also correct if it is ever
 * linked without a media attribute.
 */
@media print {
    /* ===== Reset & Base ===== */
    *,
    *::before,
    *::after {
        background: transparent !important;
        color: #000 !important;
        box-shadow: none !important;
        text-shadow: none !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    html {
        font-size: 12pt;
    }

    body {
        font-family: Georgia, 'Times New Roman', Times, serif;
        line-height: 1.6;
        color: #000 !important;
        background: #fff !important;
        margin: 0;
        padding: 0;
        width: 100%;
    }

    /* ===== Page Setup ===== */
    @page {
        margin: 2cm 1.5cm;
        size: A4;
    }

    @page :first {
        margin-top: 2.5cm;
    }

    /* ===== Hide Non-Content Elements ===== */
    .top-bar,
    .navbar,
    .mobile-menu-toggle,
    .mobile-menu-content,
    .footer,
    .footer-content,
    .footer-bottom,
    .sidebar,
    .aside,
    .newsletter-widget,
    .newsletter-section,
    .newsletter-form,
    .social-share,
    .social-buttons,
    .social-links,
    .footer-social,
    .share-buttons,
    .breadcrumb-nav,
    .lang-switcher,
    .lang-dropdown,
    .lang-switcher-mobile,
    .auth-links,
    .auth-btn,
    .login-btn,
    .register-btn,
    .logout-btn,
    .user-menu,
    .navbar-cta,
    .navbar-right,
    .pagination-wrapper,
    .pagination-nav,
    .pagination-links,
    .comment-form,
    .cookie-consent,
    .lead-chat,
    .mobile-bottom-nav,
    .mobile-nav,
    .scroll-progress,
    .cursor-glow,
    .floating-orbs,
    .hero-orbs,
    .hero-photo-overlay,
    .ambient-orbs,
    .wave-divider,
    .float-data,
    .particle,
    canvas,
    .search-box,
    .error-search,
    .related-articles,
    .related-tools,
    .cta-section,
    .cta-banner,
    .ad,
    .ads,
    .advertisement,
    [role="banner"] nav,
    [role="navigation"],
    [role="complementary"],
    button:not([type="submit"]),
    video,
    audio,
    iframe,
    embed,
    object,
    noscript {
        display: none !important;
    }

    /* ===== Content Layout ===== */
    .container {
        max-width: 100% !important;
        width: 100% !important;
        padding: 0 !important;
        margin: 0 !important;
    }

    .page-header {
        padding: 0 0 0.5cm 0 !important;
        margin-bottom: 0.5cm !important;
        border-bottom: 2pt solid #000 !important;
    }

    .page-title {
        font-size: 18pt !important;
        margin-bottom: 0.25cm !important;
    }

    .page-subtitle {
        font-size: 11pt !important;
    }

    main,
    .main-content,
    [role="main"],
    article {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        padding: 0 !important;
        float: none !important;
    }

    /* ===== Typography ===== */
    h1 { font-size: 18pt !important; margin: 0.75cm 0 0.35cm !important; }
    h2 { font-size: 15pt !important; margin: 0.6cm 0 0.3cm !important; }
    h3 { font-size: 13pt !important; margin: 0.5cm 0 0.25cm !important; }
    h4 { font-size: 12pt !important; margin: 0.4cm 0 0.2cm !important; }
    h5, h6 { font-size: 11pt !important; margin: 0.3cm 0 0.15cm !important; }

    h1, h2, h3, h4, h5, h6 {
        font-family: 'Helvetica Neue', Arial, sans-serif;
        page-break-after: avoid;
        break-after: avoid;
        orphans: 3;
        widows: 3;
    }

    p, li, dd, dt, blockquote {
        font-size: 11pt !important;
        line-height: 1.65 !important;
        orphans: 3;
        widows: 3;
    }

    p {
        margin-bottom: 0.35cm !important;
    }

    blockquote {
        border-left: 3pt solid #666 !important;
        padding-left: 0.5cm !important;
        margin: 0.4cm 0 !important;
        font-style: italic;
    }

    /* ===== Links: Show URLs ===== */
    a[href] {
        text-decoration: underline !important;
        color: #000 !important;
        word-wrap: break-word;
    }

    a[href]::after {
        content: " (" attr(href) ")";
        font-size: 9pt;
        font-weight: normal;
        color: #555 !important;
        word-break: break-all;
    }

    /* Don't show URL for anchors, javascript, or internal fragment links */
    a[href^="#"]::after,
    a[href^="javascript:"]::after,
    a[href^="mailto:"]::after {
        content: "";
    }

    /* Clean up mailto links */
    a[href^="mailto:"]::after {
        content: " (" attr(href) ")";
        font-size: 9pt;
        color: #555 !important;
    }

    /* Don't show URL for nav links or buttons styled as links */
    .navbar-menu a::after,
    .footer-section a::after,
    .btn::after,
    .error-nav-link::after,
    .breadcrumb-item a::after,
    .pagination-btn::after {
        content: "" !important;
    }

    /* ===== Images ===== */
    img {
        max-width: 100% !important;
        height: auto !important;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    figure {
        page-break-inside: avoid;
        break-inside: avoid;
        margin: 0.4cm 0 !important;
    }

    figcaption {
        font-size: 9pt !important;
        font-style: italic;
        text-align: center;
    }

    /* ===== Tables ===== */
    table {
        border-collapse: collapse !important;
        width: 100% !important;
        page-break-inside: auto;
        font-size: 10pt !important;
    }

    thead {
        display: table-header-group;
    }

    tr {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    th, td {
        border: 1pt solid #ccc !important;
        padding: 0.2cm 0.3cm !important;
        text-align: left !important;
    }

    th {
        font-weight: bold !important;
        background: #f0f0f0 !important;
    }

    /* ===== Code Blocks ===== */
    pre, code {
        font-family: 'Courier New', Courier, monospace !important;
        font-size: 9pt !important;
        border: 1pt solid #ddd !important;
        padding: 0.2cm !important;
        white-space: pre-wrap !important;
        word-wrap: break-word !important;
        page-break-inside: avoid;
    }

    code {
        padding: 0.05cm 0.15cm !important;
        border: none !important;
    }

    /* ===== Lists ===== */
    ul, ol {
        margin: 0.3cm 0 0.3cm 1cm !important;
        padding: 0 !important;
    }

    li {
        margin-bottom: 0.15cm !important;
    }

    /* ===== Cards & Boxes: Flatten for Print ===== */
    .card,
    .tool-card,
    .article-card,
    .consultant-card {
        border: 1pt solid #ccc !important;
        border-radius: 0 !important;
        padding: 0.3cm !important;
        margin-bottom: 0.4cm !important;
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .card::before,
    .card::after {
        display: none !important;
    }

    /* ===== Grid: Linearize for Print ===== */
    .grid,
    .grid-2,
    .grid-3,
    .grid-4 {
        display: block !important;
    }

    .grid > *,
    .grid-2 > *,
    .grid-3 > *,
    .grid-4 > * {
        margin-bottom: 0.4cm !important;
    }

    /* ===== Page Breaks ===== */
    .section {
        page-break-before: auto;
        padding: 0.5cm 0 !important;
    }

    .section-header {
        page-break-after: avoid;
        break-after: avoid;
    }

    /* ===== Animations: Disable ===== */
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }

    /* ===== Print Header: Add URL ===== */
    body::after {
        content: "Printed from TAX.hk - " attr(data-url);
        display: block;
        text-align: center;
        font-size: 8pt;
        color: #999 !important;
        margin-top: 1cm;
        padding-top: 0.3cm;
        border-top: 0.5pt solid #ccc !important;
    }
}
