/* ==========================================================================
   1. Reset & Variables
   ========================================================================== */

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

:root {
    --color-bg: #FFFFFF;
    --color-surface: #E8F0ED;
    --color-text-primary: #0D0D0D;
    --color-text-muted: #555555;
    --color-border: #D0D0D0;
    --color-accent: #0D0D0D;

    --font-display: 'Cormorant Garamond', 'Georgia', serif;
    --font-body: 'DM Sans', 'Helvetica Neue', Arial, sans-serif;

    --max-width: 1280px;
    --max-width-narrow: 720px;
    --gap: 2rem;
    --gap-lg: 3rem;
    --radius: 0.75rem;
    --radius-pill: 2rem;

    --section-pad-y: 6rem;
    --section-pad-x: 2rem;
}

html {
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
    overflow-x: hidden;
}

body {
    font-family: var(--font-body);
    font-weight: 300;
    font-size: 1rem;
    line-height: 1.7;
    color: var(--color-text-primary);
    background-color: var(--color-bg);
    overflow-x: hidden;
}

.site-wrapper {
    overflow-x: hidden;
    width: 100%;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.site-wrapper > main {
    flex: 1;
}

img {
    max-width: 100%;
    height: auto;
    display: block;
}

a {
    color: inherit;
    text-decoration: none;
}

ul, ol {
    list-style: none;
}

/* ==========================================================================
   2. Typography Scale
   ========================================================================== */

.display-xl {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(3rem, 7vw, 6rem);
    line-height: 1.05;
    letter-spacing: -0.02em;
}

.display-l {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(2rem, 4vw, 3.5rem);
    line-height: 1.1;
    letter-spacing: -0.01em;
}

h2, .h2 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 2rem;
    line-height: 1.2;
}

h3, .h3 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.5rem;
    line-height: 1.3;
}

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

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

/* ==========================================================================
   3. Layout Utilities
   ========================================================================== */

.container {
    width: 100%;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 0 var(--section-pad-x);
}

.container--narrow {
    max-width: var(--max-width-narrow);
}

.post-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--gap-lg);
}

/* Prevent grid children from overflowing */
.post-grid > * {
    min-width: 0;
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: var(--gap);
}

.section-title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 2rem;
    margin-bottom: var(--gap-lg);
}

/* ==========================================================================
   4. Nav Component
   ========================================================================== */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
}

.nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 4.5rem;
    gap: 2rem;
}

.nav__logo {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 1.4rem;
    white-space: nowrap;
}

.nav__links {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.nav__links a {
    font-size: 0.9rem;
    font-weight: 400;
    transition: opacity 0.2s;
}

.nav__links a:hover {
    opacity: 0.6;
}

/* Dropdown */
.nav__dropdown {
    position: relative;
}

.nav__dropdown-toggle {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 400;
    background: none;
    border: none;
    cursor: pointer;
    color: inherit;
    padding: 0;
    transition: opacity 0.2s;
}

.nav__dropdown-toggle:hover {
    opacity: 0.6;
}

.nav__dropdown-arrow {
    transition: transform 0.2s;
}

.nav__dropdown.is-open .nav__dropdown-arrow {
    transform: rotate(180deg);
}

/* Desktop: open dropdown on hover */
@media (min-width: 769px) {
    .nav__dropdown:hover .nav__dropdown-menu {
        display: block;
    }
    .nav__dropdown:hover .nav__dropdown-arrow {
        transform: rotate(180deg);
    }
}

.nav__dropdown-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 0.75rem;
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    border-radius: var(--radius);
    padding: 0.5rem 0;
    min-width: 160px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    z-index: 101;
}

/* Invisible bridge so cursor doesn't lose hover crossing the gap */
.nav__dropdown-menu::before {
    content: '';
    position: absolute;
    top: -0.75rem;
    left: -1rem;
    right: -1rem;
    height: 0.75rem;
}

.nav__dropdown.is-open .nav__dropdown-menu {
    display: block;
}

.nav__dropdown-menu li {
    padding: 0;
}

.nav__dropdown-menu a {
    display: block;
    padding: 0.6rem 1.25rem;
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--color-text-muted);
    transition: color 0.2s;
}

.nav__dropdown-menu a:hover {
    color: var(--color-text-primary);
    opacity: 1;
}

.nav__actions {
    display: flex;
    align-items: center;
    gap: 1.25rem;
}

.nav__toggle {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    width: 28px;
    height: 28px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

.nav__toggle span {
    display: block;
    width: 100%;
    height: 1.5px;
    background: var(--color-text-primary);
    transition: all 0.3s;
}

/* ==========================================================================
   5. Hero Section
   ========================================================================== */

.hero {
    padding: var(--section-pad-y) 0;
    padding-bottom: calc(var(--section-pad-y) * 0.8);
}

.hero__grid {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: var(--gap-lg);
    align-items: end;
}

.hero__grid > * {
    min-width: 0;
}

.hero__title {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(3rem, 7vw, 6rem);
    line-height: 1.05;
    letter-spacing: -0.02em;
}

.hero__description {
    padding-bottom: 0.5rem;
}

.hero__description p {
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
    font-size: 1.05rem;
    line-height: 1.7;
}

/* ==========================================================================
   6. Post Card
   ========================================================================== */

.post-card {
    display: flex;
    flex-direction: column;
}

.post-card__image-link {
    display: block;
    overflow: hidden;
    border-radius: var(--radius);
    aspect-ratio: 16 / 10;
    margin-bottom: 1.25rem;
}

.post-card__image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.post-card__image-link:hover .post-card__image {
    transform: scale(1.03);
}

.post-card__image--placeholder {
    background: var(--color-surface);
    width: 100%;
    height: 100%;
}

.post-card__body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.post-card__category {
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    transition: opacity 0.2s;
}

.post-card__category:hover {
    opacity: 0.6;
}

.post-card__title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.4rem;
    line-height: 1.25;
}

.post-card__title a {
    transition: opacity 0.2s;
}

.post-card__title a:hover {
    opacity: 0.6;
}

.post-card__excerpt {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card__meta {
    font-size: 0.8rem;
    font-weight: 300;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.25rem;
}

.post-card__meta-sep {
    opacity: 0.4;
}

/* ==========================================================================
   7. Sage/Mint Section
   ========================================================================== */

.sage-section {
    background: var(--color-surface);
    padding: var(--section-pad-y) 0;
}

.sage-section__grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    align-items: start;
}

.sage-section__grid > * {
    min-width: 0;
}

.sage-section__title {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: clamp(2rem, 4vw, 3rem);
    line-height: 1.15;
    margin-bottom: 1.5rem;
}

.sage-section__text p {
    color: var(--color-text-muted);
    margin-bottom: 2rem;
    font-size: 1.05rem;
    line-height: 1.7;
}

.sage-section__visual {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

.sage-section__card {
    background: var(--color-bg);
    padding: 2rem;
    border-radius: var(--radius);
}

.sage-section__card-num {
    display: block;
    font-size: 0.8rem;
    font-weight: 400;
    color: var(--color-text-muted);
    margin-bottom: 0.75rem;
    letter-spacing: 0.05em;
}

.sage-section__card h3 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
}

.sage-section__card p {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    line-height: 1.6;
}

/* ==========================================================================
   8. CTA Banner
   ========================================================================== */

.cta-banner {
    background: var(--color-text-primary);
    color: var(--color-bg);
    padding: var(--section-pad-y) 0;
    text-align: center;
}

.cta-banner__title {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(2rem, 4vw, 3.5rem);
    line-height: 1.15;
    margin-bottom: 1.5rem;
}

.cta-banner__text {
    color: rgba(255, 255, 255, 0.7);
    font-size: 1.05rem;
    line-height: 1.7;
    margin-bottom: 2rem;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

/* ==========================================================================
   9. Footer
   ========================================================================== */

.site-footer {
    border-top: 1px solid var(--color-border);
    padding: 4rem 0;
}

.footer__inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
}

.footer__logo {
    font-family: var(--font-display);
    font-weight: 500;
    font-size: 1.3rem;
}

.footer__tagline {
    font-size: 0.9rem;
    color: var(--color-text-muted);
}

.footer__nav {
    display: flex;
    gap: 2rem;
}

.footer__nav a {
    font-size: 0.85rem;
    font-weight: 400;
    transition: opacity 0.2s;
}

.footer__nav a:hover {
    opacity: 0.6;
}

.footer__copy {
    font-size: 0.8rem;
    color: var(--color-text-muted);
}

/* ==========================================================================
   10. Pagination
   ========================================================================== */

.pagination {
    padding: 3rem 0 var(--section-pad-y);
}

.pagination__list {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.pagination__link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2.5rem;
    height: 2.5rem;
    padding: 0 0.75rem;
    font-size: 0.9rem;
    font-weight: 400;
    border: 1.5px solid transparent;
    border-radius: var(--radius-pill);
    transition: all 0.2s;
}

.pagination__link:hover {
    border-color: var(--color-border);
}

.pagination__link--active {
    border-color: var(--color-accent);
    font-weight: 500;
}

.pagination__link--prev,
.pagination__link--next {
    font-size: 0.85rem;
}

.pagination__ellipsis {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 2rem;
    color: var(--color-text-muted);
}

/* ==========================================================================
   11. Buttons
   ========================================================================== */

.btn-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1.5px solid var(--color-accent);
    border-radius: var(--radius-pill);
    padding: 0.6rem 1.5rem;
    font-family: var(--font-body);
    font-size: 0.9rem;
    font-weight: 400;
    cursor: pointer;
    background: transparent;
    color: var(--color-accent);
    transition: all 0.25s ease;
    white-space: nowrap;
}

.btn-pill:hover {
    background: var(--color-accent);
    color: var(--color-bg);
}

.btn-pill--cta {
    border-color: var(--color-accent);
    color: var(--color-accent);
}

.btn-pill--cta:hover {
    background: #96A4A0;
    border-color: #96A4A0;
    color: #FFFFFF;
}

.btn-pill--light {
    border-color: var(--color-bg);
    color: var(--color-bg);
}

.btn-pill--light:hover {
    background: var(--color-bg);
    color: var(--color-text-primary);
}

/* ==========================================================================
   12. Form Elements (Search)
   ========================================================================== */

.search-bar {
    padding: 2rem 0;
}

.search-bar__inner {
    display: flex;
    gap: 1rem;
    max-width: 600px;
}

.search-bar__input {
    flex: 1;
    padding: 0.75rem 1.25rem;
    font-family: var(--font-body);
    font-size: 1rem;
    font-weight: 300;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-pill);
    background: var(--color-bg);
    color: var(--color-text-primary);
    outline: none;
    transition: border-color 0.2s;
}

.search-bar__input:focus {
    border-color: var(--color-accent);
}

.search-bar__input::placeholder {
    color: var(--color-text-muted);
    opacity: 0.7;
}

/* ==========================================================================
   13. Page Header (Archive/Category/Search)
   ========================================================================== */

.page-header {
    padding: 4rem 0 2rem;
}

.page-header__title {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(2.5rem, 5vw, 4rem);
    line-height: 1.1;
    margin-bottom: 0.5rem;
}

.page-header__subtitle {
    font-size: 1rem;
    color: var(--color-text-muted);
}

/* ==========================================================================
   14. Breadcrumb
   ========================================================================== */

.breadcrumb {
    font-size: 0.85rem;
    color: var(--color-text-muted);
    padding: 1.5rem 0;
}

.breadcrumb a {
    transition: opacity 0.2s;
}

.breadcrumb a:hover {
    opacity: 0.6;
}

.breadcrumb__sep {
    margin: 0 0.5rem;
    opacity: 0.4;
}

/* ==========================================================================
   15. Article Header (Single Post)
   ========================================================================== */

.article-header {
    padding: 2rem 0 3rem;
    text-align: center;
}

.article-header__category {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--color-text-muted);
    margin-bottom: 1.5rem;
    transition: opacity 0.2s;
}

.article-header__category:hover {
    opacity: 0.6;
}

.article-header__title {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    line-height: 1.08;
    margin-bottom: 1.5rem;
    letter-spacing: -0.02em;
}

.article-header__meta {
    font-size: 0.9rem;
    color: var(--color-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.article-header__meta-sep {
    opacity: 0.4;
}

/* ==========================================================================
   16. Article Hero Image
   ========================================================================== */

.article-hero {
    padding-bottom: 3rem;
}

.article-hero__image {
    width: 100%;
    border-radius: var(--radius);
    max-height: 600px;
    object-fit: cover;
}

/* ==========================================================================
   17. Article Tags
   ========================================================================== */

.article-tags {
    padding: 2rem 0;
    border-top: 1px solid var(--color-border);
}

.article-tags__list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.article-tags__tag {
    font-size: 0.8rem;
    font-weight: 400;
    padding: 0.35rem 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-pill);
    color: var(--color-text-muted);
}

/* ==========================================================================
   18. Related Posts
   ========================================================================== */

.related-posts {
    padding: var(--section-pad-y) 0;
    border-top: 1px solid var(--color-border);
}

/* ==========================================================================
   19. Post Grid Section
   ========================================================================== */

.post-grid-section {
    padding: var(--section-pad-y) 0;
}

/* ==========================================================================
   20. Error Page
   ========================================================================== */

.error-page .display-l {
    font-family: var(--font-display);
    font-weight: 300;
    font-size: 6rem;
    margin-bottom: 1rem;
}

/* ==========================================================================
   Responsive — Tablet
   ========================================================================== */

@media (max-width: 1024px) {
    :root {
        --section-pad-y: 4rem;
        --section-pad-x: 1.5rem;
    }

    .post-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .hero__grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .sage-section__grid {
        grid-template-columns: 1fr;
        gap: 3rem;
    }
}

/* ==========================================================================
   Responsive — Mobile
   ========================================================================== */

@media (max-width: 768px) {
    :root {
        --section-pad-y: 3rem;
        --section-pad-x: 1.25rem;
        --gap-lg: 2rem;
    }

    /* Nav mobile */
    .nav__links {
        display: none;
        position: fixed;
        top: 4.5rem;
        left: 0;
        right: 0;
        bottom: 0;
        background: var(--color-bg);
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 2.5rem;
        z-index: 99;
    }

    .nav__links.is-open {
        display: flex;
    }

    .nav__links a,
    .nav__dropdown-toggle {
        font-size: 1.2rem;
    }

    /* Mobile dropdown — inline, no absolute positioning */
    .nav__dropdown-menu {
        position: static;
        transform: none;
        border: none;
        box-shadow: none;
        padding: 0.5rem 0 0;
        min-width: auto;
        text-align: center;
    }

    .nav__dropdown-menu a {
        padding: 0.4rem 0;
        font-size: 1rem;
    }

    .nav__toggle {
        display: flex;
    }

    .nav__toggle[aria-expanded="true"] span:nth-child(1) {
        transform: rotate(45deg) translate(4.5px, 4.5px);
    }

    .nav__toggle[aria-expanded="true"] span:nth-child(2) {
        opacity: 0;
    }

    .nav__toggle[aria-expanded="true"] span:nth-child(3) {
        transform: rotate(-45deg) translate(4.5px, -4.5px);
    }

    /* Single column grid */
    .post-grid {
        grid-template-columns: 1fr;
    }

    /* Search */
    .search-bar__inner {
        flex-direction: column;
    }

    /* Article */
    .article-header__title {
        font-size: clamp(2rem, 6vw, 3rem);
    }

    .article-hero__image {
        border-radius: 0.5rem;
    }

    /* Pagination */
    .pagination__link {
        min-width: 2.25rem;
        height: 2.25rem;
        padding: 0 0.5rem;
        font-size: 0.85rem;
    }
}
