/* ============================================
   GRAND EVENT — inner pages (cases, case, blog, article). Builds on home.css.
   ============================================ */

[hidden] { display: none !important; }

/* No hero behind the header: it follows the theme from the start */
.page-inner .site-header { color: var(--text); }
.page-inner .site-header:not(.is-scrolled) .bar__logo img { filter: var(--logo-filter); }
.page-inner .site-header:not(.is-scrolled) .menu-btn__icon i { background: var(--bg); }

.page {
    position: relative;
    overflow-x: clip;
    padding: calc(88px + clamp(28px, 5vw, 64px)) 0 clamp(72px, 9vw, 128px);
}
.page::before {
    content: "";
    position: absolute;
    top: -140px;
    left: 50%;
    width: min(960px, 120vw);
    height: 540px;
    transform: translateX(-50%);
    background: radial-gradient(closest-side, color-mix(in srgb, var(--accent) 22%, transparent), transparent);
    filter: blur(40px);
    opacity: 0.45;
    pointer-events: none;
    z-index: -1;
}

.page-head { margin-bottom: clamp(32px, 5vw, 64px); }
.page-head__title {
    margin: 16px 0 16px;
    max-width: 22ch;
    font-family: var(--f-display);
    font-weight: var(--d-weight);
    font-size: calc(clamp(34px, 5.6vw, 84px) * var(--d-scale));
    line-height: 1.02;
    letter-spacing: var(--d-ls);
}
.page-head__title em,
.article__title em {
    font-style: normal;
    background: var(--gold-metal);
    background-size: 220% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: sheen 7s linear infinite;
}
:root[data-theme="light"] .page-head__title em { background-image: var(--gold-metal-ink); }
.page-head .lead { max-width: 60ch; }

.crumbs { display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--faint); }
.crumbs a { color: var(--muted); transition: color 0.2s var(--ease); }
.crumbs a:hover { color: var(--text); }

/* Language pills */
.lang-switch { display: inline-flex; gap: 4px; margin-top: 24px; padding: 4px; border: 1px solid var(--line-2); border-radius: 999px; }
.lang-switch a,
.lang-switch span { padding: 8px 16px; border-radius: 999px; font-size: 13px; font-weight: 600; }
.lang-switch span { background: var(--text); color: var(--bg); }
.lang-switch a { color: var(--muted); transition: color 0.2s var(--ease); }
.lang-switch a:hover { color: var(--text); }

/* ============================================
   CARDS
   ============================================ */

.posts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.posts .post { position: relative; }
.post__title a::after { content: ""; position: absolute; inset: 0; }
.post__more { margin-top: 4px; font-size: 14px; font-weight: 500; color: var(--accent-ink); }
.post__img--empty {
    background:
        radial-gradient(90% 70% at 20% 10%, color-mix(in srgb, var(--accent) 30%, transparent), transparent 60%),
        var(--bg-3);
}
/* First post on the first page gets the wide slot */
.posts--featured .post:first-child { grid-column: span 2; flex-direction: row; }
.posts--featured .post:first-child .post__img { flex: 1.3; aspect-ratio: auto; min-height: 340px; }
.posts--featured .post:first-child .post__body { flex: 1; align-content: center; padding: clamp(24px, 3vw, 40px); }
.posts--featured .post:first-child .post__title { font-size: clamp(24px, 2.2vw, 32px); }

.case-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.case-grid .case { width: auto; max-height: none; }
/* Full list: the newest case takes a wide slot so seven cards fill the rows evenly */
.case-grid--list .case:first-child { grid-column: span 2; aspect-ratio: auto; }
.case-grid .case__media canvas { width: 100%; height: 100%; object-fit: cover; }
.case-grid .case:focus-visible,
.post:focus-within { outline: 2px solid var(--accent); outline-offset: 3px; }

.skeleton {
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%) 0 0 / 200% 100%;
    animation: shimmer 1.4s linear infinite;
}
.case-grid .skeleton { aspect-ratio: 4 / 5; }
@keyframes shimmer { to { background-position: -200% 0; } }

.pager { display: flex; justify-content: center; gap: 10px; margin-top: clamp(40px, 5vw, 64px); }

/* ============================================
   CASE PAGE
   ============================================ */

.case-hero {
    position: relative;
    display: grid;
    align-content: end;
    min-height: clamp(360px, 62vh, 640px);
    padding: clamp(24px, 4vw, 56px);
    border-radius: var(--radius-lg);
    overflow: hidden;
    isolation: isolate;
    color: #fff;
    border: 1px solid var(--line);
    background: var(--bg-3);
}
.case-hero img { position: absolute; inset: 0; z-index: -2; width: 100%; height: 100%; object-fit: cover; }
.case-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background: linear-gradient(180deg, rgba(8, 8, 9, 0.1) 20%, rgba(8, 8, 9, 0.9) 100%);
}
.case-hero--empty {
    background:
        radial-gradient(90% 70% at 20% 10%, color-mix(in srgb, var(--accent) 35%, transparent), transparent 60%),
        linear-gradient(160deg, #1b1a1d, #0d0d0f);
}
.case-hero .crumbs,
.case-hero .crumbs a { color: rgba(255, 255, 255, 0.7); }
.case-hero__title {
    margin: 14px 0 24px;
    max-width: 18ch;
    font-family: var(--f-display);
    font-weight: var(--d-weight);
    font-size: calc(clamp(36px, 6vw, 96px) * var(--d-scale));
    line-height: 1;
    letter-spacing: var(--d-ls);
}
.case-hero__actions { display: flex; flex-wrap: wrap; gap: 10px; }

.doc { margin-top: clamp(32px, 5vw, 64px); }
.doc__head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 20px; }
.doc__head h2 { font-family: var(--f-display); font-weight: var(--d-weight); font-size: clamp(22px, 2.2vw, 30px); letter-spacing: -0.02em; }
.doc__count { font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--faint); }
.doc__pages { display: grid; gap: clamp(12px, 2vw, 24px); max-width: 1100px; margin-inline: auto; }
.doc__page {
    position: relative;
    overflow: hidden;
    border-radius: clamp(12px, 1.6vw, 20px);
    border: 1px solid var(--line);
    background: var(--bg-2);
    box-shadow: var(--shadow);
}
.doc__page canvas { display: block; width: 100%; height: auto; }
.doc__page.is-loading { animation: shimmer 1.4s linear infinite; background: linear-gradient(100deg, var(--surface) 30%, var(--surface-2) 50%, var(--surface) 70%) 0 0 / 200% 100%; }

.state {
    display: grid;
    justify-items: center;
    gap: 16px;
    padding: clamp(48px, 8vw, 120px) 20px;
    text-align: center;
    color: var(--muted);
}
.state h1, .state h2 { font-family: var(--f-display); font-weight: var(--d-weight); font-size: clamp(28px, 3vw, 44px); letter-spacing: -0.02em; color: var(--text); }

.more-cases { margin-top: clamp(64px, 8vw, 120px); }
.more-cases__head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 24px; }
.more-cases__head h2 { font-family: var(--f-display); font-weight: var(--d-weight); font-size: calc(clamp(30px, 4vw, 60px) * var(--d-scale)); letter-spacing: var(--d-ls); line-height: 1; }

.page .cta-band { margin-top: clamp(64px, 8vw, 120px); }

/* ============================================
   ARTICLE
   ============================================ */

.article__head { max-width: 900px; margin-bottom: clamp(28px, 4vw, 48px); }
.article__cat {
    display: inline-flex;
    margin: 20px 0 0;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
    color: var(--accent-ink);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.article__title {
    margin: 18px 0 20px;
    font-family: var(--f-display);
    font-weight: var(--d-weight);
    font-size: calc(clamp(32px, 4.6vw, 72px) * var(--d-scale));
    line-height: 1.06;
    letter-spacing: -0.035em;
}
.article__meta { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 14px; color: var(--muted); }
.article__meta > * + *::before { content: "·"; margin-right: 20px; color: var(--faint); }
.article__meta a { color: var(--accent-ink); }

.article__cover {
    max-width: 1100px;
    margin: 0 0 clamp(32px, 5vw, 64px);
    overflow: hidden;
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    background: var(--bg-3);
}
.article__cover img { display: block; width: 100%; height: auto; max-height: 620px; object-fit: cover; }

/* Long-form text: comfortable measure, clear rhythm */
.prose { max-width: 720px; font-size: clamp(17px, 1.25vw, 19px); line-height: 1.75; color: color-mix(in srgb, var(--text) 88%, var(--muted)); }
.prose > * + * { margin-top: 1.1em; }
/* The admin editor leaves empty paragraphs as spacers: the rhythm above already spaces blocks */
.prose p:empty,
.prose p:has(> br:only-child) { display: none; }
.prose h2 {
    margin-top: 2.2em;
    font-family: var(--f-display);
    font-weight: var(--d-weight);
    font-size: clamp(24px, 2.2vw, 32px);
    line-height: 1.2;
    letter-spacing: -0.02em;
    color: var(--text);
}
.prose h3 { margin-top: 1.8em; font-size: clamp(19px, 1.5vw, 22px); font-weight: 600; line-height: 1.3; color: var(--text); }
.prose h2 + *, .prose h3 + * { margin-top: 0.7em; }
.prose strong { color: var(--text); font-weight: 600; }
.prose a { color: var(--accent-ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.prose ul, .prose ol { padding-left: 1.3em; }
.prose ul { list-style: none; padding-left: 0; }
.prose ul > li { position: relative; padding-left: 1.4em; }
.prose ul > li::before { content: ""; position: absolute; left: 0; top: 0.72em; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.prose ol { list-style: decimal; }
.prose ol > li::marker { color: var(--accent-ink); font-weight: 600; }
.prose li + li { margin-top: 0.5em; }
.prose blockquote {
    margin-inline: 0;
    padding: 20px 24px;
    border-left: 2px solid var(--accent);
    border-radius: 0 16px 16px 0;
    background: var(--surface);
    color: var(--text);
}
.prose img { max-width: 100%; height: auto; border-radius: 16px; }
.prose hr { border: 0; border-top: 1px solid var(--line); margin: 2.4em 0; }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; display: block; overflow-x: auto; }
.prose th, .prose td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.prose th { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); font-weight: 600; }

.faq { max-width: 720px; margin-top: clamp(48px, 6vw, 72px); }
.faq h2 { margin-bottom: 16px; font-family: var(--f-display); font-weight: var(--d-weight); font-size: clamp(24px, 2.2vw, 32px); letter-spacing: -0.02em; }
.faq details { border-top: 1px solid var(--line); }
.faq details:last-child { border-bottom: 1px solid var(--line); }
.faq summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 0;
    font-weight: 600;
    font-size: 17px;
    list-style: none;
    cursor: pointer;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; flex: none; font-size: 22px; font-weight: 300; color: var(--accent-ink); transition: transform 0.25s var(--ease); }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding: 0 0 20px; color: var(--muted); }

.article-cta {
    max-width: 720px;
    margin-top: clamp(48px, 6vw, 72px);
    padding: clamp(28px, 4vw, 44px);
    border-radius: var(--radius-lg);
    border: 1px solid var(--line);
    background:
        radial-gradient(80% 120% at 100% 100%, color-mix(in srgb, var(--accent) 26%, transparent), transparent 60%),
        var(--bg-2);
}
.article-cta h2 { font-family: var(--f-display); font-weight: var(--d-weight); font-size: clamp(22px, 2.2vw, 30px); line-height: 1.15; letter-spacing: -0.02em; }
.article-cta p { margin: 10px 0 24px; color: var(--muted); }

.related { margin-top: clamp(64px, 8vw, 112px); }
.related h2 { margin-bottom: 24px; font-family: var(--f-display); font-weight: var(--d-weight); font-size: calc(clamp(30px, 4vw, 60px) * var(--d-scale)); letter-spacing: var(--d-ls); line-height: 1; }

.back { margin-top: clamp(40px, 5vw, 64px); }

.preview-banner {
    position: fixed;
    left: 50%;
    bottom: 20px;
    z-index: 60;
    transform: translateX(-50%);
    padding: 10px 18px;
    border-radius: 999px;
    background: #e5484d;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    box-shadow: var(--shadow);
}

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

@media (max-width: 1080px) {
    .posts, .case-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .posts--featured .post:first-child { grid-column: 1 / -1; }
}

@media (max-width: 640px) {
    .page { padding-top: calc(72px + 24px); }
    .posts, .case-grid { grid-template-columns: minmax(0, 1fr); }
    .case-grid--list .case:first-child { grid-column: auto; aspect-ratio: 4 / 5; }
    .posts--featured .post:first-child { flex-direction: column; }
    .posts--featured .post:first-child .post__img { flex: none; aspect-ratio: 16 / 10; min-height: 0; }
    .case-hero { min-height: 420px; padding: 22px; }
    .case-hero__actions .btn { flex: 1 1 100%; }
    .more-cases__head { flex-direction: column; align-items: start; }
    .article__meta > * + *::before { margin-right: 12px; }
    .article__meta { gap: 6px 12px; }
}

@media (prefers-reduced-motion: reduce) {
    .skeleton, .doc__page.is-loading { animation: none; }
}
