/* Public site styles. Layout/spacing comes from Tailwind CDN utilities;
   everything color-related uses the variables defined in theme.css. */

html {
    background-color: var(--color-bg-page);
}

body {
    font-family: var(--font-body);
    background-color: var(--color-bg-page);
    color: var(--color-text-primary);
}

/* Large headings use the display serif; small uppercase-label headings
   (sidebar box titles, footer column titles) stay on the sans stack so they
   still read as UI chrome rather than editorial copy. */
h1,
h2:not(.uppercase) {
    font-family: var(--font-display);
    letter-spacing: -0.01em;
}

h1 em, h2 em {
    font-style: italic;
    color: var(--color-primary);
    font-weight: inherit;
}

/* ---- Header / nav ---- */

header {
    backdrop-filter: blur(8px);
    box-shadow: var(--shadow-sm);
}

.site-brand {
    font-family: var(--font-display);
    letter-spacing: -0.01em;
    text-decoration: none;
}

.nav-link {
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.9375rem;
}

.nav-link:hover {
    color: var(--color-primary);
}

.theme-toggle {
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid var(--color-border);
    border-radius: 9999px;
    background: var(--color-bg-surface);
    color: var(--color-text-primary);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    transition: border-color 0.15s ease, transform 0.15s ease;
}

.theme-toggle:hover {
    border-color: var(--color-primary);
    transform: translateY(-1px);
}

/* Toggle icon: sun in light, moon in dark, half-circle for system */
.theme-toggle::before {
    content: "\2600\FE0E"; /* sun */
}

[data-theme="dark"] .theme-toggle::before {
    content: "\263D\FE0E"; /* moon */
}

/* Social links (YouTube): header icon button mirrors the theme toggle's shape */
.social-icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border: 1px solid var(--color-border);
    border-radius: 9999px;
    background: var(--color-bg-surface);
    color: var(--color-text-secondary);
    transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.social-icon-link:hover {
    border-color: #ff0033;
    color: #ff0033;
    transform: translateY(-1px);
}

.nav-link-youtube,
.footer-social-link,
.author-bio-social {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.author-bio-social {
    margin-top: 0.5rem;
}

.nav-burger {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0 7px;
    background: none;
    border: 1px solid var(--color-border);
    border-radius: 6px;
    cursor: pointer;
}

.nav-burger span {
    display: block;
    height: 2px;
    border-radius: 1px;
    background: var(--color-text-primary);
}

.mobile-nav[hidden] {
    display: none;
}

.mobile-nav {
    display: flex;
    flex-direction: column;
    padding: 0.5rem 1rem 1rem;
    border-top: 1px solid var(--color-border);
    background: var(--color-bg-surface);
}

.mobile-nav .nav-link {
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--color-border-light);
}

/* ---- Cards / badges / links ---- */

.post-card {
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
}

.post-card:hover {
    box-shadow: var(--shadow-xl);
    transform: translateY(-4px);
    border-color: var(--color-primary);
}

.post-card-image {
    height: 11rem;
}

.card-title-link {
    color: var(--color-heading);
    text-decoration: none;
}

.card-title-link:hover {
    color: var(--color-primary);
}

.category-badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 9999px;
    background: var(--color-primary-light);
    color: var(--color-primary);
    font-weight: 600;
    text-decoration: none;
    font-size: 0.6875rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

[data-theme="dark"] .category-badge {
    color: var(--color-primary-hover);
}

.read-more {
    color: var(--color-primary);
    text-decoration: none;
}

.read-more:hover {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

.tag-pill {
    display: inline-block;
    padding: 0.2rem 0.7rem;
    border: 1px solid var(--color-border);
    border-radius: 9999px;
    color: var(--color-text-secondary);
    font-size: 0.8125rem;
    text-decoration: none;
}

.tag-pill:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.btn-primary {
    background: var(--color-primary);
    color: var(--color-primary-text);
    border: none;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-weight: 600;
    box-shadow: 0 8px 20px color-mix(in srgb, var(--color-primary) 22%, transparent);
    transition: background-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary:hover {
    background: var(--color-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 10px 24px color-mix(in srgb, var(--color-primary) 30%, transparent);
}

.panel-dark .btn-primary,
.premium-cta .btn-primary,
.mh-cta-mid .btn-primary {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

/* ---- Soft cards (subtle shadow instead of a hard border) ---- */

.soft-card {
    box-shadow: var(--shadow-sm);
}

.card-elevated {
    box-shadow: var(--shadow-md);
}

/* ---- Icon anchors: theme-aware visual markers (reuse primary color tokens,
   so no separate dark-mode overrides are needed). ---- */

.icon-anchor {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    width: 2.5rem;
    height: 2.5rem;
    border-radius: 9999px;
    background: var(--color-primary-light);
    color: var(--color-primary);
}

.icon-anchor svg {
    width: 1.25rem;
    height: 1.25rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.icon-anchor-lg {
    width: 3.25rem;
    height: 3.25rem;
}

.icon-anchor-lg svg {
    width: 1.75rem;
    height: 1.75rem;
}

/* ---- Hero: subtle gradient panel + decorative dot pattern ---- */

.hero-panel {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--color-bg-accent), var(--color-bg-surface));
}

.pattern-dots {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, var(--color-primary) 1px, transparent 1px);
    background-size: 22px 22px;
    opacity: var(--pattern-opacity);
    pointer-events: none;
}

/* ---- Post/featured card fallback visual (shown when no image is set,
   so every card keeps a visual anchor per design guidelines) ---- */

.post-card-fallback {
    height: 11rem;
}

/* ---- Pagination ---- */

.page-link {
    display: inline-block;
    min-width: 2.25rem;
    padding: 0.35rem 0.65rem;
    text-align: center;
    border: 1px solid var(--color-border);
    border-radius: 9999px;
    color: var(--color-text-secondary);
    text-decoration: none;
    font-size: 0.875rem;
    transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.page-link:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.page-current {
    background: var(--color-primary);
    border-color: var(--color-primary);
    color: var(--color-primary-text);
}

/* ---- Post body (editor HTML) ---- */

.post-hero {
    max-height: 24rem;
}

.post-content {
    color: var(--color-text-primary);
    line-height: 1.75;
    font-size: 1.0625rem;
}

.post-content p,
.post-content ul,
.post-content ol,
.post-content blockquote,
.post-content pre {
    margin: 0 0 1.25rem;
}

.post-content h2,
.post-content h3,
.post-content h4 {
    color: var(--color-heading);
    line-height: 1.3;
    margin: 2rem 0 0.75rem;
    font-weight: 700;
}

.post-content h2 { font-size: 1.5rem; }
.post-content h3 { font-size: 1.25rem; }
.post-content h4 { font-size: 1.125rem; }

.post-content ul,
.post-content ol {
    padding-left: 1.5rem;
}

.post-content ul { list-style: disc; }
.post-content ol { list-style: decimal; }

.post-content li {
    margin-bottom: 0.4rem;
}

.post-content a {
    color: var(--color-primary);
    text-decoration: underline;
}

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

.post-content img {
    max-width: 100%;
    height: auto;
    border-radius: 1rem;
    margin: 1.5rem auto;
}

.post-content blockquote {
    border-left: 4px solid var(--color-primary);
    padding: 0.25rem 0 0.25rem 1.25rem;
    color: var(--color-text-secondary);
    font-style: italic;
}

.post-content pre {
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    border-radius: 1rem;
    padding: 1rem;
    overflow-x: auto;
    font-size: 0.875rem;
}

.post-content code {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border-light);
    border-radius: 4px;
    padding: 0.1rem 0.35rem;
    font-size: 0.875em;
}

.post-content pre code {
    border: none;
    padding: 0;
    background: none;
}

.post-content table {
    display: block;
    overflow-x: auto;
    border-collapse: collapse;
    width: 100%;
    margin: 0 0 1.25rem;
    font-size: 0.95rem;
}

.post-content th,
.post-content td {
    border: 1px solid var(--color-border);
    padding: 0.5rem 0.75rem;
    text-align: left;
    vertical-align: top;
}

.post-content th {
    background: var(--color-bg-surface);
    color: var(--color-heading);
    font-weight: 700;
}

/* ---- Hero ---- */

.hero-secondary-cta {
    border: 1px solid var(--color-border);
    color: var(--color-text-primary);
    background: var(--color-bg-surface);
    text-decoration: none;
}

.hero-secondary-cta:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

/* ---- Featured post ---- */

.featured-post {
    box-shadow: var(--shadow-lg);
}

.featured-badge {
    display: inline-block;
    color: var(--color-accent-gold);
    font-weight: 700;
    font-size: 0.8125rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

/* ---- Trust / testimonials ---- */

.testimonial {
    box-shadow: var(--shadow-sm);
}

/* ---- Recommended products ---- */

.recommended-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

.product-card-image {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    background: #fff; /* retailer product shots are cut out on white */
    border-radius: 0.75rem;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.product-card-image img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.product-card .read-more {
    margin-top: auto;
}

.product-card {
    box-shadow: var(--shadow-sm);
    text-decoration: none;
    transition: box-shadow 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
}

.product-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-3px);
    border-color: var(--color-primary);
}

/* ---- Premium CTA ---- */

.premium-cta {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    background: linear-gradient(155deg, var(--color-primary), var(--color-primary-hover));
    color: var(--color-primary-text);
    box-shadow: var(--shadow-xl);
}

.premium-cta::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image: radial-gradient(circle, color-mix(in srgb, var(--color-primary-text) 60%, transparent) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.12;
    pointer-events: none;
}

.premium-cta .btn-primary {
    background: var(--color-primary-text);
    color: var(--color-primary);
}

.premium-cta .btn-primary:hover {
    background: var(--color-bg-surface);
}

/* ---- Share buttons ---- */

.share-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 9999px;
    background: var(--color-bg-surface);
    border: 1px solid var(--color-border);
    color: var(--color-text-secondary);
    font-size: 0.8125rem;
    font-weight: 700;
    text-decoration: none;
    line-height: 1;
}

.share-btn:hover {
    border-color: var(--color-primary);
    color: var(--color-primary);
}

.share-btn-sm {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.6875rem;
}

/* ---- Newsletter ---- */

.newsletter-input:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
}

.newsletter-message.is-success { color: var(--color-success); }
.newsletter-message.is-error { color: var(--color-error); }

/* ---- Blog hero: full-bleed breakout (same 100vw trick as the homepage hero),
   photo background with a centered scrim so the heading stays legible. ---- */

.blog-hero {
    position: relative;
    isolation: isolate;
    width: 100vw;
    max-width: 100vw;
    left: 50%;
    transform: translateX(-50%);
    /* Cancels out <main>'s py-10 top padding so the hero sits flush under the
       header instead of leaving a gap (same trick as .mh-hero on the homepage). */
    margin-top: -2.5rem;
    overflow: clip;
    border-radius: 0 0 clamp(1.5rem, 4vw, 3rem) clamp(1.5rem, 4vw, 3rem);
    background-image: url('/images/blog-hero.png');
    background-repeat: no-repeat;
    background-position: center;
    background-size: cover;
}

.blog-hero-overlay {
    position: absolute;
    inset: 0;
    background: color-mix(in srgb, var(--color-bg-page) 85%, transparent);
}

/* ---- Page hero: full-bleed breakout (same 100vw trick as .blog-hero/.mh-hero, so static
   pages match the edge-to-edge hero treatment used elsewhere) with a photo background
   (background-position is set inline per page, admin-configurable, default "center bottom")
   and a spotlight scrim — only the area behind the text is tinted, so the rest of the photo
   stays visible instead of being washed out edge to edge. ---- */

.page-hero {
    position: relative;
    isolation: isolate;
    width: 100vw;
    max-width: 100vw;
    left: 50%;
    transform: translateX(-50%);
    /* Cancels out <main>'s py-10 top padding so the hero sits flush under the
       header instead of leaving a gap (same trick as .mh-hero on the homepage). */
    margin-top: -2.5rem;
    overflow: clip;
    border-radius: 0 0 clamp(1.5rem, 4vw, 3rem) clamp(1.5rem, 4vw, 3rem);
    background-repeat: no-repeat;
    background-size: cover;
}

.page-hero::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 4rem;
    background: linear-gradient(to bottom, transparent, var(--color-bg-page));
    pointer-events: none;
}

.page-hero-overlay {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 65% 85% at center,
        color-mix(in srgb, var(--color-bg-page) 90%, transparent) 0%,
        color-mix(in srgb, var(--color-bg-page) 55%, transparent) 50%,
        transparent 100%);
}

.blog-hero::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 4rem;
    background: linear-gradient(to bottom, transparent, var(--color-bg-page));
    pointer-events: none;
}

/* ---- Blog sidebar ---- */

.category-checkbox {
    accent-color: var(--color-primary);
    width: 1rem;
    height: 1rem;
}

.search-input {
    border: 1px solid var(--color-border);
    background: var(--color-bg-page);
    color: var(--color-text-primary);
    border-radius: 0.75rem;
    padding: 0.5rem 0.75rem;
}

.search-input:focus {
    outline: 2px solid var(--color-primary);
    outline-offset: 1px;
    border-color: var(--color-primary);
}

.sidebar-list a {
    color: var(--color-text-secondary);
    text-decoration: none;
}

.sidebar-list a:hover {
    color: var(--color-primary);
}

.sidebar-count {
    color: var(--color-text-muted);
    font-size: 0.75rem;
}

.recent-post-thumb {
    width: 3.5rem;
    height: 3.5rem;
    object-fit: cover;
    border-radius: 0.75rem;
    flex-shrink: 0;
}

/* ---- Reading progress bar (post pages only; filled by js/main.js on scroll) ---- */

#reading-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: transparent;
    z-index: 50;
}

#reading-progress-fill {
    display: block;
    height: 100%;
    width: 0%;
    background: var(--color-primary);
    transition: width 0.1s linear;
}

/* ---- Author bio ---- */

.author-bio-avatar {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 9999px;
    object-fit: cover;
}

/* ---- Authors & team ---- */

/* Each admin can pick an accent color in their profile; it arrives as --author-accent. */
.author-accent {
    border-top: 4px solid var(--author-accent);
}

.author-accent .author-role,
.author-accent .author-links a {
    color: var(--author-accent);
}

.author-profile-avatar {
    width: 7.5rem;
    height: 7.5rem;
    border-radius: 9999px;
    object-fit: cover;
    box-shadow: var(--shadow-md);
}

.author-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.post-byline-author {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
    text-decoration-color: var(--color-border);
    text-underline-offset: 3px;
}

.post-byline-author:hover {
    color: var(--color-heading);
    text-decoration-color: currentColor;
}

/* ---- Misc ---- */

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
