/* Ngo Hoang Nguyen theme — homepage section styles (Phase 4).
 *
 * Consumes the Phase 2 semantic tokens, so both colour schemes work with no
 * per-scheme duplication. Classes are theme-scoped; no icon/font/image assets are
 * added. Every interactive control inherits the global :focus-visible ring and the
 * reduced-motion / forced-colors handling from theme.css. Layouts use logical
 * properties for direction-awareness. */

/* ---- shared shell ---- */
.home-sections {
    display: flex;
    flex-direction: column;
}

.section {
    padding-block: var(--nhn-space-section);
}

.section__inner {
    inline-size: 100%;
    max-inline-size: var(--nhn-content-width);
    margin-inline: auto;
    padding-inline: var(--nhn-space-5);
}
.section__inner--measure { max-inline-size: var(--nhn-prose-width); }
.section__inner--wide { max-inline-size: var(--nhn-content-width); }

.section--align-center { text-align: center; }

/* Backgrounds (token-driven; flip automatically in dark). */
.section--bg-surface { background-color: var(--nhn-surface); }
.section--bg-muted,
.section--bg-tint { background-color: var(--nhn-surface-muted); }
.section--bg-accent {
    background-color: var(--nhn-accent);
    color: var(--nhn-accent-contrast);
}
.section--bg-accent :is(h1, h2, h3, .section-header__title, .cta__title) {
    color: var(--nhn-accent-contrast);
}
.section--bg-accent .section-header__subtitle,
.section--bg-accent .cta__subtitle { color: var(--nhn-accent-contrast); opacity: 0.9; }

/* ---- section header ---- */
.section-header {
    max-inline-size: var(--nhn-prose-width);
    margin-block-end: var(--nhn-space-8);
}
.section--align-center .section-header { margin-inline: auto; }
.section-header__title { font-size: var(--nhn-h2); margin: 0; }
.section-header__subtitle {
    margin-block: var(--nhn-space-3) 0;
    color: var(--nhn-text-muted);
    font-size: var(--nhn-text-lg);
}

/* ---- buttons ---- */
.section-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-block-size: 2.75rem;
    padding: var(--nhn-space-2) var(--nhn-space-5);
    font-weight: var(--nhn-weight-semibold);
    text-decoration: none;
    border-radius: var(--nhn-radius-md);
    border: 2px solid transparent;
    transition: transform var(--nhn-duration-fast) var(--nhn-ease);
}
.section-btn--solid {
    background-color: var(--nhn-accent);
    color: var(--nhn-accent-contrast);
}
.section-btn--pill {
    background-color: var(--nhn-accent);
    color: var(--nhn-accent-contrast);
    border-radius: var(--nhn-radius-pill);
}
.section-btn--outline {
    background-color: transparent;
    color: var(--nhn-accent-ink);
    border-color: var(--nhn-accent-ink);
}
.section-btn:hover { transform: translateY(-2px); }
/* On an accent panel, keep buttons visible against the accent background. */
.section--bg-accent .section-btn--solid,
.section--bg-accent .section-btn--pill {
    background-color: var(--nhn-surface);
    color: var(--nhn-accent-ink);
}
.section--bg-accent .section-btn--outline {
    color: var(--nhn-accent-contrast);
    border-color: var(--nhn-accent-contrast);
}

/* ---- media ---- */
.section-media {
    display: block;
    inline-size: 100%;
    block-size: auto;
    border-radius: var(--nhn-radius-lg);
}

/* ---- hero (Mulan "Home" panel: full-height, centered, optional masked media) ---- */
.section--hero {
    position: relative;
    overflow: hidden;
    /* Mulan .start-page is a full-height (100vh) centered intro. Use svh/dvh with
       a vh fallback so mobile browser chrome and zoom stay reflow-safe. */
    min-block-size: 100vh;
    min-block-size: 100svh;
    display: grid;
    place-items: center;
    padding-block: var(--nhn-space-10);
    background-color: var(--nhn-surface-muted);
}
/* Zoom / short-viewport safety: never force full height when the viewport is
   short or the user has zoomed in — content must reflow, not clip. */
@media (max-height: 34rem) {
    .section--hero { min-block-size: auto; }
}
.hero__bg {
    position: absolute;
    inset: 0;
    inline-size: 100%;
    block-size: 100%;
    object-fit: cover;
    z-index: 0;
}
.hero__mask { position: absolute; inset: 0; background-color: var(--nhn-hero-overlay); z-index: 1; }
/* Media mode paints a dark underlay beneath the image so the white hero text stays
   readable while the image is loading and in the missing/failed-image state. */
.hero--has-media { background-color: var(--nhn-ink-800); }
.hero__inner { position: relative; z-index: 2; text-align: center; }
.hero__content { max-inline-size: var(--nhn-content-width); margin-inline: auto; }

.hero__eyebrow {
    margin: 0 0 var(--nhn-space-3);
    color: var(--nhn-accent-ink);
    font-weight: var(--nhn-weight-semibold);
    letter-spacing: var(--nhn-tracking-wide);
    text-transform: uppercase;
    font-size: var(--nhn-text-sm);
}
.hero__title {
    font-size: clamp(2.5rem, 1rem + 6vw, 4.375rem);
    font-weight: var(--nhn-weight-semibold);
    margin: 0 0 var(--nhn-space-4);
    letter-spacing: -0.01em;
}
.hero__subtitle {
    font-size: clamp(1.25rem, 1rem + 1.4vw, 1.875rem);
    color: var(--nhn-text-muted);
    margin: 0;
}
.hero__ctas { display: flex; flex-wrap: wrap; gap: var(--nhn-space-3); justify-content: center; margin-block-start: var(--nhn-space-8); }
/* Mulan hero actions (.home-buttons .bt-submit): pill buttons, ~150px min-width.
   Accent-filled primary + outline secondary. Real anchors, keyboard-focusable. */
.hero__cta {
    display: inline-flex;
    align-items: center;
    gap: var(--nhn-space-2);
    min-inline-size: 150px;
    justify-content: center;
    padding: var(--nhn-space-3) var(--nhn-space-5);
    border-radius: var(--nhn-radius-pill);
    font-weight: var(--nhn-weight-semibold);
    text-decoration: none;
    border: var(--nhn-border-width) solid var(--nhn-accent);
    background-color: var(--nhn-accent);
    color: var(--nhn-accent-contrast);
    transition: background-color var(--nhn-motion, 150ms) ease, color 150ms ease;
}
.hero__cta--ghost {
    background-color: transparent;
    color: var(--nhn-accent-ink);
}
.hero__cta:hover { background-color: var(--nhn-accent-ink); border-color: var(--nhn-accent-ink); color: #fff; }
.hero__cta--ghost:hover { background-color: var(--nhn-accent); color: var(--nhn-accent-contrast); }
.hero--has-media .hero__cta--ghost { color: #fff; border-color: #fff; }
@media (prefers-reduced-motion: reduce) { .hero__cta { transition: none; } }
.hero__highlights {
    list-style: none; margin: var(--nhn-space-6) 0 0; padding: 0;
    display: flex; flex-wrap: wrap; gap: var(--nhn-space-2) var(--nhn-space-4); justify-content: center;
}
.hero__highlight {
    padding: var(--nhn-space-1) var(--nhn-space-3);
    background-color: var(--nhn-surface-muted);
    border-radius: var(--nhn-radius-pill);
    font-size: var(--nhn-text-sm);
    color: var(--nhn-text-strong);
}
/* Over media: white text on the mask. */
.hero--has-media .hero__title,
.hero--has-media .hero__subtitle { color: #fff; }
.hero--has-media .hero__eyebrow { color: var(--nhn-cyan-400); }
.hero--has-media .hero__highlight { background-color: rgba(255, 255, 255, 0.14); color: #fff; }

/* ---- feature grid ---- */
.feature-grid {
    list-style: none; margin: 0; padding: 0;
    display: grid; gap: var(--nhn-grid-gap);
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr));
}
@media (min-width: 62rem) {
    .feature-grid--cols-2 { grid-template-columns: repeat(2, 1fr); }
    .feature-grid--cols-3 { grid-template-columns: repeat(3, 1fr); }
    .feature-grid--cols-4 { grid-template-columns: repeat(4, 1fr); }
}
.feature-card {
    padding: var(--nhn-space-5);
    background-color: var(--nhn-card-surface);
    border: var(--nhn-border-width) solid var(--nhn-border-subtle);
    border-radius: var(--nhn-radius-lg);
    box-shadow: var(--nhn-shadow-sm);
    text-align: start;
}
.feature-card__media { margin: 0 0 var(--nhn-space-4); }
.feature-card__media .section-media { border-radius: var(--nhn-radius-md); }
.feature-card__title { font-size: var(--nhn-h4); margin: 0 0 var(--nhn-space-2); }
.feature-card__title a { color: var(--nhn-heading); text-decoration: none; }
.feature-card__title a:hover { color: var(--nhn-accent-ink); }
.feature-card__text { margin: 0; color: var(--nhn-text-muted); }

/* ---- feature split ---- */
.split__grid { display: grid; gap: var(--nhn-space-8); align-items: center; }
@media (min-width: 48rem) {
    .split__grid:not(.split__grid--single) { grid-template-columns: 1fr 1fr; }
    .split--media-left .split__media { order: 0; }
    .split--media-left .split__body { order: 1; }
    .split--media-right .split__media { order: 1; }
}
.split__media { margin: 0; }
.split__media .section-media { box-shadow: var(--nhn-card-shadow); }
.split__title { font-size: var(--nhn-h2); margin: 0 0 var(--nhn-space-4); }
.split__bullets {
    list-style: none; margin: var(--nhn-space-4) 0; padding: 0;
    display: grid; gap: var(--nhn-space-2);
}
.split__bullet { padding-inline-start: 1.5em; position: relative; }
.split__bullet::before {
    content: ""; position: absolute; inset-inline-start: 0; inset-block-start: 0.55em;
    inline-size: 0.5em; block-size: 0.5em; border-radius: 50%;
    background-color: var(--nhn-accent);
}
.split__body .section-btn { margin-block-start: var(--nhn-space-4); }

/* ---- stats ---- */
.stats {
    list-style: none; margin: 0; padding: 0;
    display: grid; gap: var(--nhn-grid-gap);
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
}
@media (min-width: 48rem) {
    .stats--cols-2 { grid-template-columns: repeat(2, 1fr); }
    .stats--cols-3 { grid-template-columns: repeat(3, 1fr); }
    .stats--cols-4 { grid-template-columns: repeat(4, 1fr); }
}
.stat__number { margin: 0; font-size: var(--nhn-h1); font-weight: var(--nhn-weight-bold); color: var(--nhn-accent-ink); line-height: 1.1; }
.section--bg-accent .stat__number { color: var(--nhn-accent-contrast); }
.stat__label { margin: var(--nhn-space-2) 0 0; color: var(--nhn-text-muted); font-size: var(--nhn-text-sm); }
.section--bg-accent .stat__label { color: var(--nhn-accent-contrast); opacity: 0.9; }

/* ---- testimonials ---- */
.testimonials {
    list-style: none; margin: 0; padding: 0;
    display: grid; gap: var(--nhn-grid-gap);
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
}
@media (min-width: 62rem) {
    .testimonials--cols-1 { grid-template-columns: 1fr; max-inline-size: var(--nhn-prose-width); margin-inline: auto; }
    .testimonials--cols-2 { grid-template-columns: repeat(2, 1fr); }
    .testimonials--cols-3 { grid-template-columns: repeat(3, 1fr); }
}
.testimonial__figure {
    margin: 0; block-size: 100%;
    display: flex; flex-direction: column; gap: var(--nhn-space-3);
    padding: var(--nhn-space-5);
    background-color: var(--nhn-card-surface);
    border: var(--nhn-border-width) solid var(--nhn-border-subtle);
    border-radius: var(--nhn-radius-lg);
    box-shadow: var(--nhn-shadow-sm);
}
.testimonial__rating { margin: 0; font-size: var(--nhn-text-sm); color: var(--nhn-accent-ink); font-weight: var(--nhn-weight-semibold); }
.testimonial__quote { margin: 0; color: var(--nhn-text-strong); font-size: var(--nhn-text-lg); }
.testimonial__author { display: flex; align-items: center; gap: var(--nhn-space-3); margin-block-start: auto; }
.testimonial__author .section-media { inline-size: 3rem; block-size: 3rem; border-radius: 50%; object-fit: cover; flex: none; }
.testimonial__author-text { display: flex; flex-direction: column; }
.testimonial__name { font-weight: var(--nhn-weight-semibold); color: var(--nhn-heading); }
.testimonial__role { font-size: var(--nhn-text-sm); color: var(--nhn-text-muted); }

/* ---- faq (native details) ---- */
.faq__list { display: grid; gap: var(--nhn-space-3); }
@media (min-width: 62rem) { .faq--two-column .faq__list { grid-template-columns: 1fr 1fr; } }
.faq__item {
    border: var(--nhn-border-width) solid var(--nhn-border);
    border-radius: var(--nhn-radius-md);
    background-color: var(--nhn-surface);
    padding-inline: var(--nhn-space-4);
}
.faq__question {
    cursor: pointer;
    padding-block: var(--nhn-space-4);
    font-weight: var(--nhn-weight-semibold);
    color: var(--nhn-heading);
    list-style: none;
    display: flex; align-items: center; justify-content: space-between; gap: var(--nhn-space-3);
}
.faq__question::-webkit-details-marker { display: none; }
.faq__question::after {
    content: ""; flex: none; inline-size: 0.55em; block-size: 0.55em;
    border-inline-end: 2px solid currentColor; border-block-end: 2px solid currentColor;
    transform: rotate(45deg);
    transition: transform var(--nhn-duration-fast) var(--nhn-ease);
}
.faq__item[open] .faq__question::after { transform: rotate(-135deg); }
.faq__answer { padding-block-end: var(--nhn-space-4); color: var(--nhn-text); }

/* ---- cta ---- */
.cta__inner { max-inline-size: var(--nhn-prose-width); margin-inline: auto; }
.cta__title { font-size: var(--nhn-h2); margin: 0 0 var(--nhn-space-3); }
.cta__subtitle { font-size: var(--nhn-text-lg); margin: 0 0 var(--nhn-space-6); }
.section--align-center .cta__subtitle { color: var(--nhn-text-muted); }
.cta__actions { display: flex; flex-wrap: wrap; gap: var(--nhn-space-3); }
.section--align-center .cta__actions { justify-content: center; }

/* ---- post cards + featured (card grids) ---- */
.post-cards {
    list-style: none; margin: 0; padding: 0;
    display: grid; gap: var(--nhn-grid-gap);
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr));
}
@media (min-width: 62rem) {
    .post-cards--cols-1 { grid-template-columns: 1fr; max-inline-size: var(--nhn-prose-width); margin-inline: auto; }
    .post-cards--cols-2 { grid-template-columns: repeat(2, 1fr); }
    .post-cards--cols-3 { grid-template-columns: repeat(3, 1fr); }
}
.post-card__inner,
.featured__item-inner,
.featured__lead {
    block-size: 100%;
    display: flex; flex-direction: column;
    background-color: var(--nhn-card-surface);
    border: var(--nhn-border-width) solid var(--nhn-border-subtle);
    border-radius: var(--nhn-radius-lg);
    box-shadow: var(--nhn-card-shadow);
    overflow: hidden;
}
.post-card__media,
.featured__lead-media,
.featured__item-media { aspect-ratio: 16 / 9; overflow: hidden; }
.post-card__media .section-media,
.featured__lead-media .section-media,
.featured__item-media .section-media { block-size: 100%; object-fit: cover; border-radius: 0; }
.post-card__body,
.featured__lead-body,
.featured__item-body { padding: var(--nhn-space-5); display: flex; flex-direction: column; gap: var(--nhn-space-2); }
.post-card__category,
.featured__category {
    margin: 0; font-size: var(--nhn-text-xs); text-transform: uppercase;
    letter-spacing: var(--nhn-tracking-wide); color: var(--nhn-accent-ink); font-weight: var(--nhn-weight-semibold);
}
.post-card__title,
.featured__lead-title,
.featured__item-title { margin: 0; font-size: var(--nhn-h4); }
.post-card__title a,
.featured__link { color: var(--nhn-heading); text-decoration: none; }
.post-card__title a:hover,
.featured__link:hover { color: var(--nhn-accent-ink); }
.post-card__excerpt,
.featured__excerpt { margin: 0; color: var(--nhn-text-muted); font-size: var(--nhn-text-sm); }
.post-card__date,
.featured__date { margin: auto 0 0; color: var(--nhn-text-muted); font-size: var(--nhn-text-xs); }

.featured__grid { display: grid; gap: var(--nhn-grid-gap); }
@media (min-width: 62rem) {
    .featured--editorial .featured__grid { grid-template-columns: 1.4fr 1fr; align-items: start; }
}
.featured__list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--nhn-grid-gap); }
@media (min-width: 48rem) {
    .featured--grid .featured__list { grid-template-columns: repeat(2, 1fr); }
}
.featured__lead-title { font-size: var(--nhn-h3); }

/* ---- Mulan #blog card grid (archive / category / tag) ----
   Source: .blog-grid-flex .blog-item / .blog-article — a responsive card grid with
   an accent top strip, optional featured cover, title, date meta, excerpt and a
   directional marker. Core .27 exposes the excerpt + featured image to the archive
   listing (EG-8 closed), so cards can show media/excerpt without any theme query. */
.post-grid {
    list-style: none;
    margin: var(--nhn-space-8) 0 0;
    padding: 0;
    display: grid;
    gap: var(--nhn-space-5);
    grid-template-columns: 1fr;
}
.post-grid__item { display: flex; }
.post-card {
    position: relative;
    display: flex;
    flex-direction: column;
    gap: var(--nhn-space-2);
    inline-size: 100%;
    padding: var(--nhn-space-6);
    padding-block-start: var(--nhn-space-7);
    background-color: var(--nhn-surface);
    border: var(--nhn-border-width) solid var(--nhn-border);
    border-radius: var(--nhn-radius-lg);
    box-shadow: var(--nhn-shadow-sm, 0 1px 2px rgba(0,0,0,0.06));
    overflow: hidden;
    transition: transform var(--nhn-motion, 150ms) ease, box-shadow 150ms ease;
}
.post-card__strip {
    position: absolute;
    inset-block-start: 0;
    inset-inline: 0;
    block-size: 4px;
    background-color: var(--nhn-accent);
}
.post-card:hover,
.post-card:focus-within {
    transform: translateY(-3px);
    box-shadow: var(--nhn-shadow-md, 0 6px 18px rgba(0,0,0,0.10));
}
.post-card__meta {
    margin: 0;
    font-size: var(--nhn-text-sm);
    color: var(--nhn-text-muted);
    letter-spacing: var(--nhn-tracking-wide);
    text-transform: uppercase;
}
.post-card__title { margin: 0; font-size: var(--nhn-text-lg); line-height: 1.3; }
.post-card__title a { color: var(--nhn-text-strong); text-decoration: none; }
.post-card__title a:hover,
.post-card__title a:focus-visible { color: var(--nhn-accent-ink); text-decoration: underline; }
.post-card__more {
    margin-block-start: auto;
    color: var(--nhn-accent-ink);
    font-weight: var(--nhn-weight-semibold);
    font-size: var(--nhn-text-sm);
}
/* Optional featured cover (Core .27 exposes it to the archive listing — EG-8
   closed). Full-bleed to the card edges; the accent strip sits above it. */
.post-card__cover {
    display: block;
    margin: calc(-1 * var(--nhn-space-6)) calc(-1 * var(--nhn-space-6)) var(--nhn-space-1);
    line-height: 0;
}
.post-card__cover img {
    display: block;
    inline-size: 100%;
    block-size: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}
/* R4-H4: keep every archive card the same shape — clamp the title and excerpt to
   two lines each so uneven copy lengths don't stagger card heights within a row.
   Scoped under .post-grid so the shared .post-card__title/__excerpt names used by
   the homepage post-grid section are untouched. */
.post-grid .post-card__title,
.post-grid .post-card__excerpt {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    overflow: hidden;
    overflow-wrap: anywhere;
}
/* R4-H4: a full-width archive (no sidebar) reads best as an even multi-column
   card grid. Tablet gets two columns, desktop three — with no featured/giant
   first card, so sizes stay consistent. DOM/reading/keyboard order unchanged. */
@media (min-width: 48rem) {
    .post-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 64rem) {
    .post-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) { .post-card { transition: none; } }
