/*
 * DNDN customization for Ghost Source 1.7.6
 * Brand styles live in this standalone stylesheet, leaving Source's built CSS intact.
 * The homepage is independent of the Magazine/Highlight admin layout setting.
 */

:root {
    --dndn-ink: #20202D;
    --dndn-muted: #585866;
    --dndn-soft: #F4F4F5;
    --dndn-tint: #F4F3FE;
    --dndn-border: #ECECEE;
    --dndn-accent: var(--ghost-accent-color, #6557DD);
    --font-sans: "Pretendard Variable", Pretendard, "Apple SD Gothic Neo", sans-serif;
    --color-primary-text: var(--dndn-ink);
    --color-secondary-text: var(--dndn-muted);
    --color-border: var(--dndn-border);
}

body,
body button,
body input,
body textarea,
body select,
body .is-title,
body .is-body {
    font-family: var(--font-sans) !important;
    word-break: keep-all;
}

/* Site navigation: Source's dynamic Ghost navigation and built-in search remain intact. */
.gh-navigation {
    height: 84px;
    border-bottom: 1px solid var(--dndn-border);
}
.gh-navigation-logo img { max-height: 36px; }
.gh-navigation-menu a { font-weight: 600; }
.gh-navigation-menu a:hover { color: var(--dndn-accent); }


/* v4: the navigation stays visible while scrolling content. */
#gh-navigation {
    position: sticky;
    top: 0;
    z-index: 10000;
    background: var(--background-color, #fff);
    border-bottom: 1px solid var(--dndn-border);
}

/* A distinct brand CTA at the far right; retain Search immediately to its left. */
#gh-navigation .dndn-nav-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    min-height: 42px;
    padding: 10px 19px;
    border-radius: 8px;
    background: #7066F4;
    color: #fff;
    font-size: 1.45rem;
    font-weight: 700;
    line-height: 1.4;
    white-space: nowrap;
    text-decoration: none;
    transition: background-color 180ms ease;
}
#gh-navigation .dndn-nav-cta:hover,
#gh-navigation .dndn-nav-cta:focus-visible {
    background: #584EDD;
    color: #fff;
}
#gh-navigation .dndn-nav-cta:focus-visible {
    outline: 2px solid #7066F4;
    outline-offset: 3px;
}

/* On mobile the CTA appears as the final item inside the expanded menu. */
@media (max-width: 767px) {
    #gh-navigation .gh-navigation-actions .dndn-nav-cta {
        display: none;
    }
    #gh-navigation.is-open .gh-navigation-actions .dndn-nav-cta {
        display: inline-flex;
        width: min(100%, 280px);
        min-height: 48px;
        margin: 10px auto 0;
        font-size: 1.6rem;
    }
}

/* Hero */
.dndn-home { padding-bottom: 100px; }
.dndn-hero { padding-top: 70px; padding-bottom: 62px; }
.dndn-hero-inner { max-width: 1200px; }
.dndn-eyebrow,
.dndn-section-kicker {
    font-size: 1.25rem;
    font-weight: 750;
    letter-spacing: 0.105em;
    color: var(--dndn-accent);
}
.dndn-hero h1 {
    margin-top: 0;
    color: var(--dndn-ink);
    font-size: clamp(3.3rem, 4.3vw, 5.8rem);
    line-height: 1.27;
    font-weight: 760;
    letter-spacing: -0.052em;
}
.dndn-hero-description {
    margin-top: 18px;
    font-size: clamp(1.5rem, 1.35vw, 1.85rem);
    line-height: 1.65;
    color: var(--dndn-muted);
    letter-spacing: -0.015em;
}

/* Shared section headings */
.dndn-home .gh-inner,
.dndn-archive > .gh-inner { max-width: 1200px; }
.dndn-section { margin-bottom: 83px; }
.dndn-section-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 24px;
    margin-bottom: 29px;
    padding-bottom: 18px;
    border-bottom: 1px solid var(--dndn-border);
}
.dndn-section-heading h1,
.dndn-section-heading h2 {
    margin-top: 0;
    color: var(--dndn-ink);
    font-size: clamp(2.4rem, 2.3vw, 3.0rem);
    font-weight: 740;
    letter-spacing: -0.038em;
    line-height: 1.33;
}
.dndn-section-description {
    flex-shrink: 1;
    color: var(--dndn-muted);
    text-align: right;
    font-size: 1.45rem;
    line-height: 1.6;
}

/* Editorial recommendations: 1 hero card on the left, 3 compact cards on the right. */
.dndn-featured-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-template-rows: repeat(3, auto);
    column-gap: 32px;
    row-gap: 22px;
}
.dndn-featured-grid > .gh-card:first-child { grid-row: span 3; }
.dndn-featured-grid .gh-card-link { gap: 13px; height: 100%; }
.dndn-featured-grid .gh-card-image {
    overflow: hidden;
    border-radius: 12px;
    aspect-ratio: 16 / 9;
    background: var(--dndn-tint);
}
.dndn-featured-grid > .gh-card:not(:first-child) .gh-card-link {
    flex-direction: row;
    align-items: flex-start;
    gap: 17px;
}
.dndn-featured-grid > .gh-card:not(:first-child) .gh-card-image {
    width: 42%;
    flex: 0 0 42%;
    aspect-ratio: auto;
    align-self: flex-start;
}
.dndn-featured-grid > .gh-card:not(:first-child) .gh-card-image img {
    position: static;
    inset: auto;
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}
.dndn-featured-grid > .gh-card:not(:first-child) .gh-card-image.dndn-image-placeholder {
    aspect-ratio: 16 / 9;
}
.dndn-featured-grid > .gh-card:not(:first-child) .gh-card-wrapper { min-width: 0; }
.dndn-featured-grid .gh-card-tag,
.dndn-post-grid .gh-card-tag {
    display: block;
    margin-bottom: 7px;
    font-size: 1.25rem;
    font-weight: 670;
    color: var(--dndn-accent);
    letter-spacing: 0;
    text-transform: none;
}
.dndn-featured-grid .gh-card-title {
    font-size: clamp(1.7rem, 1.6vw, 2.1rem);
    font-weight: 720;
    line-height: 1.43;
    letter-spacing: -0.026em;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.dndn-featured-grid > .gh-card:first-child .gh-card-title {
    font-size: clamp(2.1rem, 2.2vw, 2.9rem);
    line-height: 1.4;
}
.dndn-featured-grid .gh-card-excerpt,
.dndn-post-grid .gh-card-excerpt {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    color: var(--dndn-muted);
    margin-top: 9px;
    font-size: 1.43rem;
    line-height: 1.63;
    letter-spacing: -0.014em;
}
.dndn-featured-grid > .gh-card:not(:first-child) .gh-card-excerpt { display: none; }
.dndn-featured-grid .gh-card-meta,
.dndn-post-grid .gh-card-meta { margin-top: 10px; color: #81818D; }

/* All latest posts: always a 3-column thumbnail grid, irrespective of Source feed setting. */
.dndn-post-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 49px 26px;
}
.dndn-post-grid .gh-card-link { gap: 15px; }
.dndn-post-grid .gh-card-image {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 12px;
    background: var(--dndn-soft);
}
.dndn-post-grid .gh-card-title {
    font-size: clamp(1.73rem, 1.4vw, 2.02rem);
    line-height: 1.47;
    font-weight: 710;
    letter-spacing: -0.025em;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.dndn-post-grid .gh-card-link:hover .gh-card-title,
.dndn-featured-grid .gh-card-link:hover .gh-card-title {
    color: var(--dndn-accent);
    opacity: 1;
}
.dndn-post-grid .gh-card-image img,
.dndn-featured-grid .gh-card-image img {
    transition: transform 240ms ease;
}
@media (hover: hover) {
    .dndn-post-grid .gh-card-link:hover .gh-card-image img,
    .dndn-featured-grid .gh-card-link:hover .gh-card-image img { transform: scale(1.035); }
}

/* Image placeholder keeps a visual card even when there is no feature image. */
.dndn-image-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    background: linear-gradient(145deg, #F4F3FE 0%, #EDECF9 100%) !important;
    color: #5148B7;
}
.dndn-placeholder-wordmark {
    font-weight: 800;
    font-size: clamp(2.5rem, 4vw, 5rem);
    letter-spacing: -0.07em;
}
.dndn-placeholder-dot { color: #6557DD; }
.dndn-placeholder-caption { font-size: 1.05rem; font-weight: 680; letter-spacing: 0.11em; }

/* Navigation to older articles */
.dndn-more { display: flex; justify-content: center; margin-top: 57px; }
.dndn-more a,
.dndn-pagination a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 13px 25px;
    border: 1px solid #DAD9E4;
    border-radius: 9px;
    color: var(--dndn-ink);
    background: #fff;
    font-size: 1.5rem;
    font-weight: 670;
    transition: border-color 180ms ease, background-color 180ms ease;
}
.dndn-more a:hover,
.dndn-pagination a:hover { border-color: var(--dndn-accent); background: var(--dndn-tint); }
.dndn-more svg { width: 17px; height: 17px; }
.dndn-archive { padding-top: 62px; padding-bottom: 110px; }
.dndn-back { color: var(--dndn-muted); font-weight: 600; font-size: 1.4rem; }
.dndn-back:hover { color: var(--dndn-accent); }
.dndn-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 65px;
    gap: 16px;
    font-size: 1.35rem;
}
.dndn-page-count { color: var(--dndn-muted); }

/* The single footer is managed in Ghost Code Injection > Site Footer.
   Do not add a theme footer here. Removing min-height avoids an empty
   viewport between short archives and the injected footer outside .gh-viewport. */
.gh-viewport { min-height: 0; }

/* Unify the left/right edges of navigation, homepage, and tag/author feeds.
   All use Ghost's existing .gh-outer horizontal padding. */
#gh-navigation .gh-navigation-inner,
.dndn-home .gh-inner,
.dndn-archive > .gh-inner,
.tag-template .gh-archive.gh-inner,
.author-template .gh-archive.gh-inner,
.tag-template .gh-container-inner,
.author-template .gh-container-inner {
    max-width: 1200px;
}

/* Source's default archives indent lists by two/three 16-column tracks.
   Keep the tag title, dividers and cards aligned with the same container. */
.tag-template .gh-archive:not(.has-sidebar):not(.has-image) .gh-archive-inner,
.author-template .gh-archive:not(.has-sidebar):not(.has-image) .gh-archive-inner {
    grid-column: 1 / -1;
}
:is(.tag-template, .author-template) .gh-container:not(.has-sidebar)
:is(.gh-container-title, .gh-main, .gh-more) {
    grid-column: 1 / -1;
}

/* Article feature images should match the standard 720px article text column.
   This is intentionally restricted to POSTS, not tag headers or full-width
   images/cards inside the post body. Original image aspect ratio is preserved. */
.post-template .gh-article-header .gh-article-image {
    grid-column: main;
    width: 100%;
    max-width: 100%;
}
.post-template .gh-article-header .gh-article-image img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: contain;
}

/* Archive and other Source pages retain their original layout but use the brand typeface. */
:is(.tag-template, .author-template) .gh-card-title { letter-spacing: -0.025em; }

@media (max-width: 1100px) {
    .dndn-featured-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 25px; }
    .dndn-featured-grid > .gh-card:not(:first-child) .gh-card-link { flex-direction: row; gap: 13px; }
    .dndn-featured-grid > .gh-card:not(:first-child) .gh-card-image { width: 42%; flex-basis: 42%; aspect-ratio: auto; }
    .dndn-post-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767px) {
    .gh-navigation { height: 72px; }
    .gh-navigation-logo img { max-height: 30px; }
    .dndn-home { padding-bottom: 54px; }
    .dndn-hero { padding-top: 46px; padding-bottom: 48px; }
    .dndn-hero h1 { font-size: clamp(2.9rem, 7vw, 3.7rem); }
    .dndn-hero-description { font-size: 1.48rem; }
    .dndn-section { margin-bottom: 59px; }
    .dndn-section-heading { align-items: flex-start; flex-direction: column; gap: 6px; margin-bottom: 22px; }
    .dndn-section-description { text-align: left; font-size: 1.3rem; }
    .dndn-featured-grid { display: flex; flex-direction: column; gap: 29px; }
    .dndn-featured-grid .gh-card-image { aspect-ratio: 16 / 9; }
    .dndn-featured-grid > .gh-card:not(:first-child) .gh-card-link { flex-direction: row; gap: 15px; }
    .dndn-featured-grid > .gh-card:not(:first-child) .gh-card-image { flex: 0 0 38%; width: 38%; aspect-ratio: auto; }
    .dndn-featured-grid > .gh-card:not(:first-child) .gh-card-title { font-size: 1.55rem; }
    .dndn-featured-grid > .gh-card:first-child .gh-card-title { font-size: 2.2rem; }
    .dndn-featured-grid > .gh-card:not(:first-child) .gh-card-meta { display: none; }
    .dndn-post-grid { grid-template-columns: 1fr; gap: 33px; }
    .dndn-post-grid .gh-card-title { font-size: 1.9rem; }
    .dndn-more { margin-top: 40px; }
    .dndn-archive { padding-top: 44px; padding-bottom: 70px; }
    .dndn-pagination { gap: 8px; }
    .dndn-pagination a { font-size: 1.25rem; padding: 10px 13px; }
}

/* v4: separate injected Site Footer from the last card/read-more section. */
.tag-template .gh-viewport,
.post-template .gh-viewport,
.author-template .gh-viewport {
    padding-bottom: clamp(96px, 10vw, 160px);
}

/* Tag pages use a consistent three-card grid, matching latest posts on the homepage. */
.dndn-tag-page .gh-inner { max-width: 1200px; }
.dndn-tag-page .gh-archive-inner { grid-column: 1 / -1; }
.dndn-tag-list { margin-top: 30px; }
.dndn-tag-list .gh-feed { width: 100%; }
@media (max-width: 767px) {
    .tag-template .gh-viewport,
    .post-template .gh-viewport,
    .author-template .gh-viewport { padding-bottom: 85px; }
    .dndn-tag-list { margin-top: 18px; }
}

@media (prefers-reduced-motion: reduce) {
    .dndn-post-grid .gh-card-image img,
    .dndn-featured-grid .gh-card-image img,
    .dndn-more a,
    .dndn-pagination a { transition: none; }
}


/* v5: reliable Portal-independent post sharing. */
.dndn-share-dialog {
    width: min(440px, calc(100vw - 36px));
    max-width: none;
    border: 1px solid var(--dndn-border);
    border-radius: 16px;
    padding: 0;
    background: #fff;
    color: var(--dndn-ink);
    box-shadow: 0 24px 80px rgba(32,32,45,0.18);
}
.dndn-share-dialog::backdrop { background: rgba(32, 32, 45, 0.5); }
.dndn-share-dialog-content { padding: 26px; }
.dndn-share-dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dndn-share-dialog-header h2 { margin: 0; font-size: 21px; font-weight: 700; }
.dndn-share-close {
    border: 0; background: transparent; color: var(--dndn-muted);
    font-size: 28px; line-height: 1; cursor: pointer; padding: 2px 5px;
}
.dndn-share-hint { margin: 13px 0 22px; color: var(--dndn-muted); font-size: 15px; line-height: 1.6; }
.dndn-share-actions { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
.dndn-share-actions button, .dndn-share-actions a {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 48px; padding: 10px; border: 1px solid #DCDCE0;
    border-radius: 8px; background: #fff; color: var(--dndn-ink);
    font-size: 15px; font-weight: 650; text-decoration: none; cursor: pointer;
}
.dndn-share-actions button:first-child { background: #7066F4; color: #fff; border-color: #7066F4; }
.dndn-share-actions button:focus-visible, .dndn-share-actions a:focus-visible,
.dndn-share-close:focus-visible, .dndn-share-trigger:focus-visible {
    outline: 2px solid #7066F4; outline-offset: 3px;
}
.dndn-share-feedback { margin: 16px 0 0; color: #5148B7; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; }
.dndn-share-feedback:empty { display: none; }
