/*
Theme Name:  DailyPuffing
Author:      DailyPuffing
Description: A modern, clean CBD and cannabis health blog theme built with Tailwind CSS. Covers strains, products, wellness guides, and dispensary news.
Version:     1.0.0
License:     GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: CBDHealthGuide
Tags:        blog, health, cannabis, cbd, one-column, custom-logo, custom-menu, featured-images, threaded-comments, translation-ready
*/

/* ===================================================================
   Custom utilities — everything Tailwind CDN can't provide at runtime
   =================================================================== */

html { scroll-behavior: smooth; }
body { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }

/* ── Header wood-grain texture (fine grain lines over a brown gradient) ──── */
.site-header-wood {
    background-color: #2b1810;
    background-image:
        repeating-linear-gradient(90deg, rgba(0,0,0,.08) 0px, rgba(0,0,0,.08) 1px, transparent 1px, transparent 3px),
        linear-gradient(180deg, #4a3220, #2b1810);
}

/* ── Page background: aged-paper texture ──────────────────────────────────── */
.site-body-parchment {
    background-color: #f4ecd8;
    background-image:
        radial-gradient(ellipse at 20% 20%, rgba(139,111,71,.06), transparent 55%),
        radial-gradient(ellipse at 80% 70%, rgba(139,111,71,.06), transparent 55%),
        repeating-linear-gradient(45deg, rgba(120,90,50,.025) 0px, rgba(120,90,50,.025) 1px, transparent 1px, transparent 3px);
}

/* ── Article card wood frame: thick bevelled border + floating shadow ───── */
.card-wood-frame {
    border: 6px solid #3d2817;
    border-radius: 10px;
    box-shadow:
        inset 2px 2px 0 rgba(255,255,255,.10),
        inset -2px -2px 0 rgba(0,0,0,.35),
        0 10px 24px rgba(43,24,16,.28),
        0 3px 6px rgba(43,24,16,.18);
    transition: box-shadow .3s ease, transform .3s ease;
}
.card-wood-frame:hover {
    box-shadow:
        inset 2px 2px 0 rgba(255,255,255,.10),
        inset -2px -2px 0 rgba(0,0,0,.35),
        0 16px 32px rgba(43,24,16,.35),
        0 4px 10px rgba(43,24,16,.22);
    transform: translateY(-2px);
}

/* ── Display headings: decorative serif for structural titles, but keep
   in-article prose subheadings in the readable body sans for long-form
   legibility ─────────────────────────────────────────────────────────────── */
h1, h2 { font-family: 'Cinzel', serif; }
.prose h1, .prose h2, .prose h3, .prose h4 { font-family: 'Inter', sans-serif; }

/* ── Nav dropdowns (desktop hover menu) ───────────────────────────────────── */
.menu-item-has-children { position: relative; }
.primary-menu-desktop .menu-item-has-children > .sub-menu {
    display: none !important;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 200px;
    background: #3d2817;
    border: 1px solid rgba(212,175,55,.4);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,.35);
    padding: 6px 0;
    z-index: 100;
    list-style: none;
}
.primary-menu-desktop .menu-item-has-children:hover > .sub-menu,
.primary-menu-desktop .menu-item-has-children.is-open > .sub-menu {
    display: block !important;
}
.sub-menu li a {
    display: block;
    padding: 8px 16px;
    font-size: .875rem;
    color: #f1dfa8;
    white-space: nowrap;
    text-decoration: none;
}
.sub-menu li a:hover { color: #2b1810; background: #d4af37; }

/* ── Nav dropdowns (mobile menu — always expanded, tap-friendly) ─────────── */
.mobile-menu .sub-menu {
    list-style: none;
    padding-left: 1rem;
}
.mobile-menu .sub-menu li a { white-space: normal; }
.mobile-menu > li > a {
    display: block;
    padding: 10px 4px;
    font-weight: 600;
    color: #f1dfa8;
}
.mobile-menu > li > a:hover { color: #d4af37; }
.mobile-menu .sub-menu li a { color: #e8c874; }
.mobile-menu .sub-menu li a:hover { color: #d4af37; }

/* Card lift on hover */
.hover-card {
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.hover-card:hover {
    box-shadow: 0 10px 25px -5px rgba(0,0,0,.1), 0 8px 10px -6px rgba(0,0,0,.1);
    transform: translateY(-2px);
}

/* Hide scrollbar for horizontal carousels */
.hide-scroll::-webkit-scrollbar { display: none; }
.hide-scroll { -ms-overflow-style: none; scrollbar-width: none; }

/* ===================================================================
   WordPress Core Alignments
   =================================================================== */
.alignleft  { float: left;  margin: 0 1.5rem 1rem 0; }
.alignright { float: right; margin: 0 0 1rem 1.5rem; }
.aligncenter { display: block; margin: 0 auto 1rem; }
.wp-caption { max-width: 100%; }
.wp-caption-text { font-size: .85rem; color: #6b7280; margin-top: .25rem; }

/* ===================================================================
   Pagination
   =================================================================== */
.nav-links {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-size: .875rem;
    font-weight: 600;
}
.nav-links a, .nav-links span {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
    padding: .5rem 1rem;
    border: 2px solid #a3841f;
    border-radius: 9999px;
    color: #a3841f;
    transition: background-color .15s;
}
.nav-links a:hover { background-color: #f7efd8; }
.nav-links .current { background-color: #a3841f; color: #fff; }

/* ===================================================================
   Comments
   =================================================================== */
.comment-list { list-style: none; padding: 0; }
.comment-body {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: .75rem;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
}
.comment-author .fn { font-weight: 700; color: #111827; }
.comment-metadata { font-size: .75rem; color: #6b7280; margin-top: .25rem; }
.comment-content { margin-top: .75rem; color: #374151; font-size: .9375rem; }
.reply a {
    font-size: .8125rem;
    font-weight: 600;
    color: #a3841f;
    margin-top: .5rem;
    display: inline-block;
}

/* ===================================================================
   Post Meta Row (.post-meta)
   =================================================================== */

.post-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    font-size: .875rem;
    color: #6b7280;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid #e5e7eb;
}
.post-meta span {
    display: flex;
    align-items: center;
    gap: .25rem;
}
.post-meta a {
    font-weight: 600;
    color: #374151;
    text-decoration: none;
    transition: color .15s;
}
.post-meta a:hover { color: #a3841f; }

@media (max-width: 640px) {
    .post-meta { gap: .625rem; }
}

/* ===================================================================
   Post Content Typography (.prose)
   =================================================================== */

/*
 * Constrain the body-copy column to a comfortable reading measure.
 * Uses 'article .prose' (specificity 0,1,2) to beat Tailwind's
 * max-w-none utility (0,1,0) regardless of injection order.
 */
article .prose {
    max-width: 72ch;
    font-family: "Inter", sans-serif;
}

/* ── Headings ──────────────────────────────────────────────────── */
.prose h2,
.prose h3,
.prose h4 {
    font-family: "Inter", sans-serif;
    font-weight: 700;
    color: #111827;
    line-height: 1.25;
}

.prose h2 {
    font-size: 1.75rem;
    margin-top: 2.5rem;
    margin-bottom: 1rem;
    padding-bottom: .375rem;
    border-bottom: 2px solid #f1dfa8; /* brand-100 — subtle underline accent */
}

.prose h3 {
    font-size: 1.375rem;
    margin-top: 2rem;
    margin-bottom: .75rem;
}

.prose h4 {
    font-size: 1.125rem;
    color: #a3841f; /* brand-600 — visual step down via colour, not just size */
    margin-top: 1.5rem;
    margin-bottom: .5rem;
}

/* ── Paragraphs ────────────────────────────────────────────────── */
.prose p {
    line-height: 1.75;
    margin-bottom: 1.5rem;
    color: #374151;
}

/* ── Lists ─────────────────────────────────────────────────────── */
.prose ul,
.prose ol {
    padding-left: 1.75rem;
    margin-bottom: 1.5rem;
    line-height: 1.75;
    color: #374151;
}
.prose ul { list-style-type: disc; }
.prose ol { list-style-type: decimal; }

.prose li { margin-bottom: .5rem; }

.prose li > ul,
.prose li > ol {
    margin-top: .375rem;
    margin-bottom: 0;
}

/* ── Blockquote ────────────────────────────────────────────────── */
.prose blockquote {
    border-left: 4px solid #c9a227; /* brand-500 */
    background-color: #f7efd8;      /* brand-50 */
    border-radius: 0 .5rem .5rem 0;
    padding: .875rem 1.25rem;
    margin: 2rem 0;
    font-style: italic;
    color: #7c6418; /* brand-700 */
}
.prose blockquote p { margin-bottom: 0; color: inherit; }
.prose blockquote p:not(:last-child) { margin-bottom: .75rem; }

/* ── Inline emphasis ───────────────────────────────────────────── */
.prose strong {
    font-weight: 700;
    color: #111827;
}
.prose em { font-style: italic; }

/* ── Links ─────────────────────────────────────────────────────── */
.prose a {
    color: #a3841f; /* brand-600 */
    text-decoration: none;
    font-weight: 500;
    transition: color .15s, text-underline-offset .15s;
}
.prose a:hover {
    color: #7c6418; /* brand-700 */
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* ── Images ────────────────────────────────────────────────────── */
.prose img {
    max-width: 100%;
    height: auto;
    border-radius: .75rem; /* rounded-xl — matches prose-img:rounded-xl in template */
    display: block;
    margin-top: 2rem;
    margin-bottom: 2rem;
}
.prose figure { margin: 2rem 0; }
.prose figcaption {
    font-size: .875rem;
    color: #6b7280;
    text-align: center;
    margin-top: .5rem;
}

/* ── Code ──────────────────────────────────────────────────────── */
.prose code {
    font-family: ui-monospace, SFMono-Regular, Consolas, "Cascadia Code", monospace;
    font-size: .875em;
    background-color: #f1f5f9;
    color: #7c6418; /* brand-700 */
    padding: .125em .375em;
    border-radius: .25rem;
    word-break: break-word;
}

.prose pre {
    font-family: ui-monospace, SFMono-Regular, Consolas, "Cascadia Code", monospace;
    font-size: .875rem;
    background-color: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: .75rem;
    padding: 1.25rem 1.5rem;
    overflow-x: auto;
    line-height: 1.7;
    margin: 2rem 0;
}
.prose pre code {
    background: none;
    padding: 0;
    font-size: inherit;
    color: #374151;
    border-radius: 0;
    word-break: normal;
}

/* ── Horizontal rule ───────────────────────────────────────────── */
.prose hr {
    border: none;
    border-top: 2px solid #e5e7eb;
    margin: 3rem 0;
}

/* ── Table scroll wrapper (injected by cbdhg_wrap_tables()) ───── */
.cbdhg-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    margin: 2rem 0;
}
.cbdhg-table-wrap .prose table,
.cbdhg-table-wrap table {
    margin: 0;
    min-width: 500px; /* keeps table at natural width; wrapper scrolls on narrow screens */
}

/* ── Tables ────────────────────────────────────────────────────── */
.prose table {
    width: 100%;
    table-layout: fixed; /* even column widths instead of sizing to content */
    border-collapse: collapse;
    font-size: .9375rem;
    margin: 2rem 0;
    border: 1px solid #e5e7eb;
}
.prose thead { background-color: #f7efd8; } /* brand-50 */
.prose th {
    font-weight: 700;
    color: #111827;
    text-align: left;
    padding: .625rem .875rem;
    /* WP core's block-library CSS puts a dark border on every side of
       every cell — zero it out first so only our own bottom divider shows. */
    border: 0 !important;
    border-bottom: 2px solid #f1dfa8 !important; /* brand-100 */
    word-break: normal;
    overflow-wrap: break-word;
}
.prose td {
    padding: .625rem .875rem;
    border: 0 !important;
    border-bottom: 1px solid #e5e7eb !important;
    color: #374151;
    vertical-align: top;
    word-break: normal;
    overflow-wrap: break-word;
}
/* Tailwind Typography zeroes border-bottom on the <tr> element for the last
   row — override on the row itself so the collision algorithm sees a 1px
   solid border regardless of which element "wins" at the outer edge. */
.prose table tr {
    border-bottom: 1px solid #e5e7eb !important;
}
.prose tbody tr:hover { background-color: #f9fafb; }

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 640px) {
    article .prose { max-width: 100%; }
    .prose h2 { font-size: 1.5rem;    margin-top: 2rem; }
    .prose h3 { font-size: 1.25rem;   margin-top: 1.75rem; }
    .prose h4 { font-size: 1.0625rem; margin-top: 1.25rem; }
    .prose pre {
        border-radius: .5rem;
        padding: 1rem;
    }
}

/* ── Table shrink-to-fit + "Enlarge" popup (assets/js/tables.js) ──
   On narrow viewports the table is scaled down to the wrapper's width
   instead of scrolling; a badge appears (only when scaling was actually
   needed) to pop the full-size table into a scrollable modal. */
.cbdhg-table-wrap { position: relative; }
.cbdhg-table-wrap table { transform-origin: top left; }

.cbdhg-table-enlarge {
    display: none;
    align-items: center;
    gap: .3rem;
    position: absolute;
    top: .5rem;
    right: .5rem;
    padding: .35rem .7rem;
    background: rgba(255,255,255,.95);
    border: 1px solid #e5e7eb;
    border-radius: 9999px;
    font-size: .75rem;
    font-weight: 600;
    color: #7c6418; /* brand-700 */
    box-shadow: 0 1px 2px rgba(0,0,0,.06);
    cursor: pointer;
}
.cbdhg-table-enlarge i { font-size: .9rem; }
.cbdhg-table-wrap.has-overflow .cbdhg-table-enlarge { display: inline-flex; }

.cbdhg-table-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
}
.cbdhg-table-modal.is-open { display: flex; }
.cbdhg-table-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(17,24,39,.6);
}
.cbdhg-table-modal-panel {
    position: relative;
    background: #fff;
    border-radius: .75rem;
    width: 100%;
    max-width: 720px;
    max-height: 85vh;
    box-shadow: 0 20px 50px rgba(0,0,0,.25);
}
.cbdhg-table-modal-close {
    position: absolute;
    top: .6rem;
    right: .6rem;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 9999px;
    background: #f3f4f6;
    border: none;
    font-size: 1.1rem;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
}
.cbdhg-table-modal-scroll {
    overflow: auto;
    max-height: 85vh;
    padding: 2.75rem 1rem 1.25rem;
}
.cbdhg-table-modal-scroll.prose table {
    table-layout: auto;
    width: auto;
    min-width: 100%;
}
body.cbdhg-modal-open { overflow: hidden; }
