/* ============================================================
   LANGELLA THEME — Custom Ghost Theme
   Brand: Reds on grey, black + blue/yellow tertiary
   ============================================================ */

/* --- Variables --- */
:root {
    --bg-light: #e6e6e6;
    --bg-white: #ffffff;
    --red-bright: #ff3131;
    --red-medium: #c63232;
    --red-dark: #861313;
    --black: #2d2d2d;
    --white: #ffffff;
    --blue: #296aa5;
    --yellow: #facc15;
    --grey-100: #f7f7f7;
    --grey-200: #e6e6e6;
    --grey-300: #d4d4d4;
    --grey-500: #888888;
    --grey-700: #444444;
    --grey-900: #1a1a1a;
    --font: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
    --container: 1200px;
    --container-narrow: 760px;
    --radius: 8px;
    --shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    --shadow-hover: 0 4px 20px rgba(0, 0, 0, 0.12);
    --transition: 0.2s ease;
}

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* --- Base --- */
html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: var(--font);
    color: var(--black);
    background: var(--bg-white);
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--red-bright); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--red-dark); }

/* Reset link colours inside Tailwind-styled nav/footer */
.no-underline, .no-underline:hover { text-decoration: none; }

/* --- Layout --- */
.container { max-width: var(--container); margin: 0 auto; padding: 0 24px; }
.container-narrow { max-width: var(--container-narrow); margin: 0 auto; padding: 0 24px; }
.section { padding: 80px 0; }
.section-light { background: var(--grey-100); }
.section-dark { background: var(--grey-900); color: var(--white); }
.section-dark .section-title { color: var(--white); }
.section-dark a { color: var(--yellow); }
.section-dark a:hover { color: var(--white); }
.section-title { font-size: 2rem; font-weight: 800; margin-bottom: 40px; text-align: center; color: var(--black); letter-spacing: -0.02em; }
.section-cta { text-align: center; margin-top: 48px; }
.lead-text { font-size: 1.25rem; line-height: 1.6; color: var(--grey-700); margin-bottom: 16px; }

/* --- Buttons --- */
.btn {
    display: inline-block; padding: 12px 28px; border-radius: var(--radius);
    font-weight: 600; font-size: 0.95rem; transition: all var(--transition);
    text-align: center; cursor: pointer; border: 2px solid transparent;
}
.btn-primary {
    background: var(--red-bright); color: var(--white); border-color: var(--red-bright);
}
.btn-primary:hover {
    background: var(--red-medium); border-color: var(--red-medium); color: var(--white);
}
.btn-outline {
    background: transparent; color: var(--black); border-color: var(--grey-300);
}
.btn-outline:hover {
    border-color: var(--red-bright); color: var(--red-bright);
}
.btn-outline-light {
    background: transparent; color: var(--white); border-color: rgba(255,255,255,0.4);
}
.btn-outline-light:hover {
    border-color: var(--white); color: var(--white);
}
.btn-large { padding: 16px 40px; font-size: 1.1rem; }

/* ============================================================
   HEADER — Navigation
   ============================================================ */

/* --- Hamburger toggle --- */
.mobile-nav-toggle { background: none; border: none; cursor: pointer; padding: 8px; }
.hamburger {
    display: block; width: 24px; height: 2px; background: var(--black);
    position: relative; transition: var(--transition);
}
.hamburger::before, .hamburger::after {
    content: ''; position: absolute; width: 24px; height: 2px;
    background: var(--black); left: 0; transition: var(--transition);
}
.hamburger::before { top: -7px; }
.hamburger::after { top: 7px; }
.mobile-nav-toggle.active .hamburger { background: transparent; }
.mobile-nav-toggle.active .hamburger::before { transform: rotate(45deg); top: 0; }
.mobile-nav-toggle.active .hamburger::after { transform: rotate(-45deg); top: 0; }

/* --- Desktop dropdown panels --- */
.dropdown-panel {
    display: none; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
    min-width: 220px; background: var(--bg-white); border: 1px solid var(--grey-200);
    border-radius: var(--radius); box-shadow: 0 8px 30px rgba(0,0,0,0.12);
    padding: 8px 0; margin-top: 8px; z-index: 100;
}
.nav-dropdown.open .dropdown-panel { display: block; }
/* Invisible bridge so hover doesn't break between trigger and panel */
.dropdown-panel::before {
    content: ''; position: absolute; top: -12px; left: 0; right: 0; height: 12px;
}
.dropdown-item {
    display: block; padding: 10px 20px; font-size: 0.875rem; font-weight: 500;
    color: var(--black); white-space: nowrap; transition: all var(--transition);
    text-decoration: none;
}
.dropdown-item:hover { background: var(--grey-100); color: var(--red-bright); }
.dropdown-item-hub {
    font-weight: 700; border-bottom: 1px solid var(--grey-200);
    margin-bottom: 4px; padding-bottom: 12px;
}
/* Rotate chevron when open */
.nav-dropdown.open .material-symbols-outlined { transform: rotate(180deg); }
.nav-dropdown .material-symbols-outlined { transition: transform var(--transition); }

/* --- Mobile nav panel --- */
.mobile-nav {
    display: none; position: fixed; top: 64px; left: 0; right: 0; bottom: 0;
    background: var(--bg-white); z-index: 99; padding: 16px 24px;
    overflow-y: auto;
}
.mobile-nav.active { display: block; }
.mobile-nav-list { list-style: none; }
.mobile-nav-list > li { border-bottom: 1px solid var(--grey-200); }
.mobile-nav-list > li > a {
    display: block; padding: 14px 0; font-size: 1.05rem;
    font-weight: 500; color: var(--black);
}

/* --- Mobile accordion (Services / Case Studies) --- */
.mobile-accordion-toggle {
    display: flex; align-items: center; justify-content: space-between;
    width: 100%; padding: 14px 0; background: none; border: none;
    cursor: pointer; font-size: 1.05rem;
}
.mobile-accordion-link {
    font-weight: 500; color: var(--black); text-decoration: none;
    font-size: 1.05rem; pointer-events: none;
}
.mobile-accordion-icon {
    font-size: 20px; color: var(--grey-500);
    transition: transform 0.25s ease;
}
.mobile-accordion.open .mobile-accordion-icon { transform: rotate(180deg); }
.mobile-accordion-panel {
    list-style: none; max-height: 0; overflow: hidden;
    transition: max-height 0.3s ease;
    padding-left: 16px; border-left: 3px solid var(--red-bright);
    margin-left: 4px; margin-bottom: 8px;
}
.mobile-accordion-panel li { border-bottom: none; }
.mobile-accordion-panel a {
    display: block; padding: 10px 0; font-size: 0.95rem;
    font-weight: 400; color: var(--grey-700);
}
.mobile-accordion-panel a:hover { color: var(--red-bright); }

/* --- Mobile CTAs --- */
.mobile-nav-cta { padding-top: 20px; border-bottom: none !important; }
.mobile-nav-secondary {
    border-bottom: none !important; padding-top: 8px;
}
.mobile-nav-secondary a {
    color: var(--blue); font-weight: 600; font-size: 0.95rem;
}

/* ============================================================
   HERO
   ============================================================ */
.hero {
    padding: 100px 0 80px;
    background: linear-gradient(135deg, var(--grey-100) 0%, var(--bg-white) 100%);
}
.hero-content { max-width: 700px; }
.hero h1 {
    font-size: 3.5rem; font-weight: 800; line-height: 1.1;
    letter-spacing: -0.03em; margin-bottom: 24px; color: var(--black);
}
.text-red { color: var(--red-bright); }
.hero-subtitle {
    font-size: 1.25rem; line-height: 1.6; color: var(--grey-700);
    margin-bottom: 40px;
}
.hero-actions { display: flex; gap: 16px; flex-wrap: wrap; }

@media (max-width: 768px) {
    .hero { padding: 60px 0 48px; }
    .hero h1 { font-size: 2.2rem; }
    .hero-subtitle { font-size: 1.1rem; }
}

/* ============================================================
   SERVICES GRID
   ============================================================ */
.services-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(min(220px, 100%), 1fr));
    gap: 24px;
}
.service-card {
    background: var(--bg-white); border: 1px solid var(--grey-200);
    border-radius: var(--radius); padding: 32px 24px;
    transition: all var(--transition); text-decoration: none; color: var(--black);
    display: block;
}
.service-card:hover {
    border-color: var(--red-bright); box-shadow: var(--shadow-hover);
    transform: translateY(-2px); color: var(--black);
}
.service-icon { font-size: 1.8rem; margin-bottom: 16px; color: var(--red-bright); }
.service-card h3 { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; }
.service-card p { font-size: 0.9rem; color: var(--grey-700); line-height: 1.5; }

/* ============================================================
   RESULTS GRID
   ============================================================ */
.results-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
    gap: 24px;
}
.result-card {
    background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius); padding: 40px 32px; text-align: center;
    transition: all var(--transition); text-decoration: none; color: var(--white);
    display: block;
}
.result-card:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--red-bright); transform: translateY(-2px);
    color: var(--white);
}
.result-stat {
    font-size: 3rem; font-weight: 800; color: var(--red-bright);
    line-height: 1; margin-bottom: 8px;
}
.result-label { font-size: 1rem; font-weight: 600; margin-bottom: 8px; }
.result-context { font-size: 0.85rem; color: var(--grey-500); }

/* ============================================================
   POST GRID & CARDS
   ============================================================ */
.post-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));
    gap: 32px;
}
.post-card {
    background: var(--bg-white); border: 1px solid var(--grey-200);
    border-radius: var(--radius); overflow: hidden;
    transition: all var(--transition);
    position: relative; cursor: pointer;
}
.post-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.post-card-image { width: 100%; height: 200px; object-fit: cover; }
.post-card-content { padding: 24px; }
.post-card-tags { display: flex; gap: 8px; margin-bottom: 12px; position: relative; z-index: 1; }
.tag-pill {
    display: inline-block; padding: 4px 12px; border-radius: 20px;
    background: var(--blue); color: var(--white); font-size: 0.75rem;
    font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
    transition: background var(--transition);
}
.tag-pill:hover { background: var(--red-bright); color: var(--white); }
.post-card-title { font-size: 1.2rem; font-weight: 700; line-height: 1.35; margin-bottom: 8px; }
.post-card-title a { color: var(--black); }
.post-card-title a:hover { color: var(--red-bright); }
.post-card-title a::after {
    content: ''; position: absolute; inset: 0; z-index: 0;
}
.post-card-excerpt { font-size: 0.9rem; color: var(--grey-700); line-height: 1.5; margin-bottom: 16px; }
.post-card-meta {
    font-size: 0.8rem; color: var(--grey-500); display: flex; gap: 12px;
}

/* ============================================================
   POST / PAGE CONTENT
   ============================================================ */
.post-header, .page-header-single { padding: 80px 0 40px; }
.post-title, .page-title {
    font-size: 2.6rem; font-weight: 800; line-height: 1.15;
    letter-spacing: -0.03em; margin-bottom: 16px; color: var(--black);
}
.post-excerpt { font-size: 1.2rem; color: var(--grey-700); line-height: 1.6; margin-bottom: 24px; }
.post-meta, .post-card-meta {
    font-size: 0.9rem; color: var(--grey-500);
}
.post-meta .sep { margin: 0 4px; }
.post-tags { margin-bottom: 16px; display: flex; gap: 8px; }

/* Feature image */
.post-feature-image { margin-bottom: 48px; }
.post-feature-image img { width: 100%; max-height: 500px; object-fit: cover; border-radius: var(--radius); }
.post-feature-image figcaption { text-align: center; font-size: 0.85rem; color: var(--grey-500); margin-top: 8px; }

/* Post body content */
.post-content, .page-content { padding-bottom: 48px; }
.post-content h2, .page-content h2 {
    font-size: 1.6rem; font-weight: 700; margin: 48px 0 16px;
    color: var(--black); letter-spacing: -0.02em;
}
.post-content h3, .page-content h3 {
    font-size: 1.3rem; font-weight: 700; margin: 32px 0 12px;
    color: var(--black); letter-spacing: -0.01em;
}
.post-content p, .page-content p { margin-bottom: 20px; color: var(--grey-900); }
.post-content ul, .post-content ol,
.page-content ul, .page-content ol {
    margin: 0 0 20px 24px;
}
.post-content li, .page-content li { margin-bottom: 8px; color: var(--grey-900); }
.post-content strong, .page-content strong { color: var(--black); }
.post-content blockquote, .page-content blockquote {
    border-left: 4px solid var(--red-bright); padding: 16px 24px;
    margin: 24px 0; background: var(--grey-100); border-radius: 0 var(--radius) var(--radius) 0;
    font-style: italic; color: var(--grey-700);
}
.post-content hr, .page-content hr {
    border: none; border-top: 1px solid var(--grey-200); margin: 40px 0;
}
.post-content table, .page-content table {
    width: 100%; border-collapse: collapse; margin: 24px 0;
}
.post-content th, .post-content td,
.page-content th, .page-content td {
    padding: 12px 16px; text-align: left; border-bottom: 1px solid var(--grey-200);
}
.post-content th, .page-content th {
    font-weight: 700; background: var(--grey-100);
}
.post-content code, .page-content code {
    font-family: var(--font-mono); background: var(--grey-100);
    padding: 2px 6px; border-radius: 4px; font-size: 0.9em;
}
.post-content a, .page-content a { color: var(--red-bright); text-decoration: underline; }
.post-content a:hover, .page-content a:hover { color: var(--red-dark); }

/* Post footer */
.post-footer { border-top: 1px solid var(--grey-200); padding: 40px 0; }
.author-card { display: flex; gap: 16px; align-items: center; margin-bottom: 40px; }
.author-info { display: flex; gap: 16px; align-items: center; }
.author-avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; }
.author-avatar-large { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; margin-bottom: 16px; }
.author-name { font-weight: 700; margin-bottom: 2px; }
.author-bio { font-size: 0.9rem; color: var(--grey-700); }
.post-cta {
    background: var(--grey-100); border-radius: var(--radius); padding: 32px;
    text-align: center;
}
.post-cta h3 { margin-bottom: 8px; }

/* ============================================================
   PAGE HEADERS
   ============================================================ */
.page-header { text-align: center; margin-bottom: 48px; padding-top: 48px; }
.page-header h1 { font-size: 2.6rem; font-weight: 800; margin-bottom: 16px; letter-spacing: -0.03em; }
.page-description { font-size: 1.15rem; color: var(--grey-700); max-width: 600px; margin: 0 auto; }
.author-header { text-align: center; margin-bottom: 48px; padding-top: 48px; }

/* ============================================================
   CTA BANNER
   ============================================================ */
.section-cta-banner {
    background: linear-gradient(135deg, var(--red-dark) 0%, var(--red-medium) 100%);
    color: var(--white); text-align: center; padding: 80px 0;
}
.section-cta-banner h2 { color: var(--white); font-size: 2rem; margin-bottom: 16px; }
.section-cta-banner p { color: rgba(255, 255, 255, 0.85); font-size: 1.1rem; margin-bottom: 32px; }
.section-cta-banner .btn-primary {
    background: var(--white); color: var(--red-dark); border-color: var(--white);
}
.section-cta-banner .btn-primary:hover {
    background: var(--yellow); color: var(--black); border-color: var(--yellow);
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
    display: flex; justify-content: center; align-items: center;
    gap: 16px; margin-top: 48px;
}
.pagination-info { font-size: 0.9rem; color: var(--grey-500); }

/* ============================================================
   FOOTER (styled via Tailwind in footer.hbs)
   ============================================================ */

/* ============================================================
   GHOST EDITOR CARD WIDTHS (Required by Ghost)
   ============================================================ */
.kg-width-wide {
    max-width: 1040px;
    margin-left: auto;
    margin-right: auto;
}
.kg-width-full {
    max-width: none;
    margin-left: calc(-50vw + 50%);
    margin-right: calc(-50vw + 50%);
    width: 100vw;
}
.kg-width-wide img,
.kg-width-full img {
    width: 100%;
}

/* Ghost card styles */
.kg-image-card { margin: 24px 0; }
.kg-image-card img { border-radius: var(--radius); }
.kg-image-card figcaption {
    text-align: center; font-size: 0.85rem; color: var(--grey-500);
    margin-top: 8px; padding: 0 16px;
}
.kg-embed-card { margin: 24px 0; }
.kg-gallery-card { margin: 24px 0; }
.kg-bookmark-card { margin: 24px 0; }
.kg-bookmark-container {
    display: flex; border: 1px solid var(--grey-200); border-radius: var(--radius);
    overflow: hidden; text-decoration: none; color: var(--black);
}
.kg-bookmark-content { padding: 16px; flex: 1; }
.kg-bookmark-title { font-weight: 700; font-size: 1rem; margin-bottom: 4px; }
.kg-bookmark-description { font-size: 0.85rem; color: var(--grey-700); }
.kg-bookmark-thumbnail { width: 200px; }
.kg-bookmark-thumbnail img { height: 100%; object-fit: cover; }

/* ============================================================
   AUTHOR & TAG EXTRAS
   ============================================================ */
.author-links { margin-top: 12px; }
.author-link {
    display: inline-block; margin-right: 12px;
    color: var(--blue); text-decoration: none; font-size: 0.9rem;
}
.author-link:hover { text-decoration: underline; }
.tag-image {
    margin-top: 24px; max-width: 100%; border-radius: var(--radius);
}

/* ============================================================
   ERROR PAGE
   ============================================================ */
.error-code { font-size: 8rem; font-weight: 800; color: var(--red-bright); line-height: 1; }
.error-message { font-size: 1.2rem; color: var(--grey-700); margin-bottom: 32px; }

/* ============================================================
   ACCESSIBILITY — Focus & Active States
   ============================================================ */
a:focus-visible, button:focus-visible, .btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
    outline: 2px solid var(--red-bright); outline-offset: 2px;
}
.btn:active { transform: scale(0.97); }

/* ============================================================
   ACTIVE PAGE INDICATOR
   ============================================================ */
body.page-about .nav-link[href="/about/"],
body.page-services .nav-link[href="/services/"],
body.page-case-studies .nav-link[href="/case-studies/"],
body.tag-template .nav-link[href="/blog/"],
body.post-template .nav-link[href="/blog/"],
body.page-contact .nav-link[href="/contact/"],
body.page-blog .nav-link[href="/blog/"],
body.home-template .nav-link[href="/"] {
    color: var(--red-bright);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* Prevent horizontal overflow from full-width elements */
body { overflow-x: hidden; }

@media (max-width: 768px) {
    .section { padding: 48px 0; }
    .section-title { font-size: 1.6rem; margin-bottom: 24px; }
    .post-title, .page-title { font-size: 1.8rem; }
    .page-header h1 { font-size: 1.8rem; }
    .post-header, .page-header-single { padding: 48px 0 24px; }
    .page-header { padding-top: 32px; }
    .post-grid { grid-template-columns: 1fr; }
    .services-grid { grid-template-columns: 1fr; }
    .results-grid { grid-template-columns: 1fr; }
    .result-card { padding: 24px 20px; }
    .result-stat { font-size: 2.2rem; }
    .error-code { font-size: 4rem; }
    .section-cta-banner { padding: 48px 0; }
    .section-cta-banner h2 { font-size: 1.5rem; }
    .section-cta-banner p { font-size: 1rem; }
    .lead-text { font-size: 1.1rem; }

    /* Bookmark cards stack vertically */
    .kg-bookmark-container { flex-direction: column; }
    .kg-bookmark-thumbnail { width: 100%; height: 180px; }
    .kg-bookmark-thumbnail img { width: 100%; }

    /* Tables scroll horizontally */
    .post-content table, .page-content table {
        display: block; overflow-x: auto; -webkit-overflow-scrolling: touch;
    }

    /* Post card image shorter on mobile */
    .post-card-image { height: 160px; }

    /* Feature image outside container — constrain */
    .post-feature-image { padding: 0 16px; }
    .post-feature-image img { max-height: 300px; }
}
