/* AnatoliaCore UI refresh — 2026-10-31
   Loaded after the page bundle and seo-fixes.css on every page.
   Goal: calmer type scale, readable line lengths, consistent components,
   monochrome partner logos, and layouts without stretched empty cards.
   Rules that could collide with the homepage design are scoped with
   body:not([data-archetype="home"]). */

:root {
    --ui-ink: #eef6f9;
    --ui-text: #a9bfcc;
    --ui-muted: #8aa3b3;
    --ui-accent: #6cc6da;
    --ui-accent-soft: rgba(108, 198, 218, 0.08);
    --ui-line: rgba(126, 190, 214, 0.14);
    --ui-line-strong: rgba(126, 205, 220, 0.26);
    --ui-tile: rgba(8, 26, 40, 0.72);
    --ui-measure: 70ch;
}

/* ---------- Rhythm ---------- */

body:not([data-archetype="home"]) {
    --section-padding: clamp(3.5rem, 2.25rem + 3.2vw, 5.5rem);
}

body:not([data-archetype="home"]) .section-header {
    margin-bottom: clamp(2rem, 1.4rem + 1.6vw, 3rem);
}

/* ---------- Page hero ---------- */

body:not([data-archetype="home"]) .page-hero-title {
    font-size: clamp(2.1rem, 1.3rem + 2.8vw, 3.75rem);
    line-height: 1.05;
    letter-spacing: -0.04em;
    text-wrap: balance;
}

body:not([data-archetype="home"]) .page-hero-description {
    font-size: clamp(1rem, 0.94rem + 0.3vw, 1.15rem);
    line-height: 1.7;
    color: #a6bac7;
    text-wrap: pretty;
}

/* experience.js rewrites data-scene-label in English on every page;
   the localized label lives in data-hero-label. */
.page-hero .container[data-hero-label]::before {
    content: attr(data-hero-label);
}

.page-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1.75rem;
}

.breadcrumb {
    flex-wrap: wrap;
    row-gap: 0.25rem;
}

.breadcrumb a,
.breadcrumb .separator {
    white-space: nowrap;
}

/* ---------- Section headings ---------- */

body:not([data-archetype="home"]) .section-header .section-title {
    font-size: clamp(1.75rem, 1.15rem + 1.9vw, 2.75rem);
    line-height: 1.1;
    letter-spacing: -0.035em;
}

body:not([data-archetype="home"]) .section-description {
    font-size: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
    color: var(--ui-muted);
}

body:not([data-archetype="home"]) .section-label {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    font-family: var(--font-mono, monospace);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.16em;
    color: var(--ui-accent);
}

body:not([data-archetype="home"]) .section-label::before {
    content: "";
    width: 1.25rem;
    height: 1px;
    background: currentColor;
    opacity: 0.7;
}

body:not([data-archetype="home"]) .proof-heading h2 {
    font-size: clamp(1.85rem, 1.2rem + 2vw, 3rem);
    line-height: 1.08;
}

/* ---------- Cards ---------- */

.seo-card {
    padding: clamp(1.25rem, 0.95rem + 1vw, 2rem);
}

/* Cards are not links: no lift on hover, just a quiet border change. */
.seo-card:hover,
.faq-item:hover {
    transform: none;
    box-shadow: none;
}

.seo-card.seo-rich:hover {
    border-color: rgba(115, 169, 192, 0.22);
}

.seo-card:not(.seo-rich) .section-title {
    font-size: 1.1875rem;
    line-height: 1.3;
    letter-spacing: -0.012em;
    margin-bottom: 0.85rem;
    color: var(--ui-ink);
}

.seo-card p {
    color: var(--ui-text);
    line-height: 1.7;
}

.seo-card > p + p {
    margin-top: 0.9rem;
}

/* ---------- Long-form (rich) content ---------- */

.seo-rich {
    counter-reset: ui-sec;
}

.seo-card.seo-rich > .section-title {
    font-size: clamp(1.3rem, 1.05rem + 0.75vw, 1.7rem);
    line-height: 1.22;
    letter-spacing: -0.025em;
    margin: 2.6rem 0 0.9rem;
    max-width: 36ch;
    color: var(--ui-ink);
    counter-increment: ui-sec;
}

.seo-card.seo-rich > .section-title:first-child,
.seo-card.seo-rich > .section-label + .section-title {
    margin-top: 0;
}

.seo-card.seo-rich > .section-label + .section-title {
    counter-increment: none;
}

/* Mono index (01, 02 …): per card on service pages (cards with two or more
   headings), continuous across the whole article on guides. */
body[data-archetype="guide"] main {
    counter-reset: ui-sec;
}

body[data-archetype="guide"] .seo-rich {
    counter-reset: none;
}

.seo-card.seo-rich:has(> .section-title ~ .section-title) > .section-title::before,
body[data-archetype="guide"] .seo-card.seo-rich > .section-title::before {
    content: counter(ui-sec, decimal-leading-zero);
    display: block;
    margin-bottom: 0.55rem;
    font-family: var(--font-mono, monospace);
    font-size: 0.75rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    color: var(--ui-accent);
}

body[data-archetype="guide"] .seo-card.seo-rich > .section-label + .section-title::before {
    content: none;
}

.seo-rich p,
.seo-rich li {
    font-size: 1.0625rem;
    line-height: 1.75;
    color: var(--ui-text);
}

.seo-rich p {
    margin-bottom: 0;
}

.seo-card p + .related-links,
.seo-card p + .meta-chips {
    margin-top: 1rem;
}

.seo-rich > p,
.seo-rich > ul,
.seo-rich > ol,
.seo-rich > .seo-list,
.seo-rich > .decision-note {
    max-width: var(--ui-measure);
}

.seo-rich strong {
    color: #d9e9ef;
    font-weight: 600;
}

.seo-card p a:not(.btn),
.seo-card li a:not(.btn),
.seo-card td a:not(.btn),
.faq-item p a:not(.btn) {
    color: #8fd8e8;
    text-decoration: underline;
    text-decoration-color: rgba(143, 216, 232, 0.4);
    text-underline-offset: 0.18em;
}

.seo-card p a:not(.btn):hover,
.seo-card li a:not(.btn):hover,
.seo-card td a:not(.btn):hover,
.faq-item p a:not(.btn):hover {
    color: #ffffff;
    text-decoration-color: currentColor;
}

.seo-card .seo-list + p,
.seo-card ul + p,
.seo-card table + p {
    margin-top: 1rem;
}

/* Full-width rich cards read as a two-column document:
   heading on the left, content on the right. */
@media (min-width: 1100px) {
    .container > .seo-card.seo-rich:has(> .section-title:first-child):not(:has(> .section-label)) {
        display: grid;
        grid-template-columns: minmax(200px, 1fr) minmax(0, 46rem);
        column-gap: clamp(2rem, 4vw, 4.5rem);
        row-gap: 1rem;
        align-items: start;
    }

    .container > .seo-card.seo-rich:has(> .section-title:first-child):not(:has(> .section-label)) > * {
        grid-column: 2;
        max-width: none;
        margin-top: 0;
        margin-bottom: 0;
    }

    /* Spanning two rows lets a tall heading sit beside the first two
       blocks instead of pushing the second one down. */
    .container > .seo-card.seo-rich:has(> .section-title:first-child):not(:has(> .section-label)) > .section-title {
        grid-column: 1;
        grid-row: span 2;
        max-width: none;
    }

    .container > .seo-card.seo-rich:has(> .section-title:first-child):not(:has(> .section-label)) > .section-title:not(:first-child),
    .container > .seo-card.seo-rich:has(> .section-title:first-child):not(:has(> .section-label)) > .section-title:not(:first-child) + * {
        margin-top: 1.25rem;
        padding-top: 2rem;
        border-top: 1px solid var(--ui-line);
    }
}

/* ---------- Cards inside grids: equal height, actions on the bottom edge ---------- */

.seo-grid > .seo-card {
    display: flex;
    flex-direction: column;
}

.seo-grid > .seo-card > .partner-actions:last-child,
.seo-grid > .seo-card > .btn:last-child {
    margin-top: auto;
}

.seo-grid > .seo-card > .partner-actions:last-child {
    padding-top: 1.25rem;
}

.seo-grid > .seo-card > .btn:last-child {
    align-self: flex-start;
}

.seo-grid > .seo-card > :has(+ .btn:last-child) {
    margin-bottom: 1.25rem;
}

/* ---------- Lists ---------- */

.seo-list {
    gap: 0.6rem;
}

.seo-list li {
    padding-left: 1.4rem;
    line-height: 1.65;
}

.seo-list li::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 0.6em;
    width: 6px;
    height: 6px;
    border: 1.5px solid var(--ui-accent);
    transform: rotate(45deg);
}

/* ---------- Grids ---------- */

.seo-grid {
    gap: clamp(1rem, 0.7rem + 1vw, 1.75rem);
}

.seo-grid > :only-child {
    grid-column: 1 / -1;
}

@media (min-width: 961px) {
    /* Exactly two or four cards: use two columns instead of leaving gaps. */
    .seo-grid:not(:has(> [style*="span 2"])):has(> :nth-child(2):last-child),
    .seo-grid:not(:has(> [style*="span 2"])):has(> :nth-child(4):last-child) {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    /* A lone card in the last row takes the full row. */
    .seo-grid:not(:has(> [style*="span 2"])) > .seo-card:last-child:nth-child(3n + 1):not(:only-child) {
        grid-column: 1 / -1;
    }

    /* Wide rich card + narrow side cards: side cards stack at the top
       instead of stretching to the rich card's height. */
    .seo-grid:has(> [style*="span 2"]) {
        grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr);
        grid-template-rows: auto auto auto 1fr;
        align-items: start;
    }

    .seo-grid:has(> [style*="span 2"]) > [style*="span 2"] {
        grid-column: 1 !important;
        grid-row: 1 / -1;
    }

    .seo-grid:has(> [style*="span 2"]) > :not([style*="span 2"]) {
        grid-column: 2;
    }

    /* Partner profile: logo card on the left. */
    .seo-grid:has(> .seo-card > .logo-plate) {
        grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.75fr);
    }

    .seo-grid:has(> .seo-card > .logo-plate) > [style*="span 2"] {
        grid-column: 2 !important;
    }

    .seo-grid:has(> .seo-card > .logo-plate) > :not([style*="span 2"]) {
        grid-column: 1;
    }
}

/* Service scope row: summary card a little wider than the others. */
@media (min-width: 1100px) {
    .seo-grid--scope {
        grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr) minmax(0, 0.95fr);
    }
}

/* ---------- Closing call-to-action band ---------- */

.cta-band {
    padding: clamp(3rem, 2rem + 3vw, 5rem) 0;
    border-top: 1px solid rgba(126, 205, 220, 0.08);
    border-bottom: 0;
    background: var(--color-primary, #071321);
    text-align: left;
}

.cta-panel {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 1.5rem 3rem;
    padding: clamp(1.75rem, 1.2rem + 2.2vw, 3.25rem);
    border: 1px solid rgba(126, 205, 220, 0.24);
    border-radius: 4px;
    background:
        radial-gradient(70% 160% at 100% 0%, rgba(86, 191, 226, 0.14), transparent 60%),
        linear-gradient(145deg, rgba(14, 35, 52, 0.95), rgba(5, 18, 29, 0.95));
    overflow: hidden;
}

.cta-panel::before {
    content: "";
    position: absolute;
    top: -1px;
    bottom: -1px;
    left: -1px;
    width: 2px;
    background: #56bfe2;
    opacity: 0.75;
}

.cta-band .section-label {
    margin-bottom: 0.85rem;
}

.cta-band .cta-title {
    margin: 0 0 0.6rem;
    color: var(--ui-ink);
    font-size: clamp(1.5rem, 1.1rem + 1.3vw, 2.35rem);
    line-height: 1.12;
    letter-spacing: -0.03em;
}

.cta-band .cta-text {
    max-width: 60ch;
    margin: 0;
    color: var(--ui-text);
    font-size: 1.0625rem;
    line-height: 1.7;
}

.cta-band .cta-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.75rem;
    margin: 0;
}

@media (max-width: 860px) {
    .cta-panel {
        grid-template-columns: 1fr;
    }

    .cta-band .cta-actions {
        justify-content: flex-start;
    }
}

/* ---------- Link tiles ---------- */

.intent-links-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 0.75rem;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
}

/* The bundle hides ::after on every [data-soft-tilt] element. */
.intent-links-grid .intent-link-card[data-soft-tilt]::after {
    display: inline-block !important;
}

.intent-link-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 3.4rem;
    padding: 0.8rem 1.1rem;
    border: 1px solid rgba(115, 169, 192, 0.22);
    border-radius: 3px;
    background: var(--ui-tile);
    color: #cfe0e7;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.4;
}

.intent-link-card::after {
    content: "\2192";
    margin-left: auto;
    color: var(--ui-accent);
    transition: transform 0.2s ease;
}

.intent-link-card:hover {
    color: #ffffff;
    border-color: rgba(126, 210, 228, 0.55);
    background: rgba(11, 37, 51, 0.9);
}

.intent-link-card:hover::after {
    transform: translateX(3px);
}

.related-links {
    gap: 0.75rem;
}

.container > .related-links {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
}

.seo-card .related-links {
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

.container > .seo-card .related-links {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr));
    margin-top: 0.25rem;
}

.related-links a {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    min-height: 3.4rem;
    padding: 0.8rem 1.1rem;
    color: #cfe0e7;
    font-size: 0.9375rem;
    font-weight: 500;
    line-height: 1.4;
    background: var(--ui-tile);
    text-decoration: none;
}

.related-links a::after {
    content: "\2192";
    flex: none;
    color: var(--ui-accent);
    transition: transform 0.2s ease;
}

.related-links a:hover {
    color: #ffffff;
    transform: none;
    box-shadow: none;
}

.related-links a:hover::after {
    transform: translateX(3px);
}

/* ---------- FAQ ---------- */

.grid:has(> .faq-item) {
    max-width: 880px;
    margin-inline: auto;
    gap: 0.75rem;
}

.faq-item {
    padding: 1.25rem 1.5rem;
}

.faq-item h3 {
    font-size: 1.0625rem;
    line-height: 1.45;
    color: var(--ui-ink);
    margin-bottom: 0.5rem;
}

.faq-item p {
    font-size: 0.975rem;
    line-height: 1.7;
    color: var(--ui-text);
}

/* ---------- Buttons (content pages) ---------- */

body:not([data-archetype="home"]) main .btn {
    min-height: 46px;
    padding: 0.7rem 1.3rem;
    font-size: 0.9375rem;
    line-height: 1.2;
    border-radius: 3px;
    gap: 0.5rem;
}

body:not([data-archetype="home"]) main .btn-sm {
    min-height: 40px;
    padding: 0.55rem 1rem;
    font-size: 0.875rem;
}

.partner-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
}

/* ---------- Tables ---------- */

main table {
    width: 100%;
    margin: 1.5rem 0 0.75rem;
    border: 1px solid var(--ui-line);
    border-collapse: collapse;
    font-size: 0.9375rem;
    line-height: 1.55;
}

main table th {
    padding: 0.75rem 1rem !important;
    border-bottom: 1px solid var(--ui-line-strong) !important;
    background: rgba(108, 198, 218, 0.07);
    color: #e3f1f5;
    font-weight: 600;
    text-align: left;
    vertical-align: bottom;
}

main table td {
    padding: 0.75rem 1rem !important;
    border-bottom: 1px solid var(--ui-line) !important;
    color: var(--ui-text);
    vertical-align: top;
}

main table tr:last-child td {
    border-bottom: 0 !important;
}

main table td:first-child {
    color: #d3e4ea;
    font-weight: 500;
}

/* ---------- Notes and chips ---------- */

.decision-note {
    margin-top: 1.25rem;
    padding: 0.9rem 1.1rem;
    border-left: 2px solid var(--ui-accent);
    background: var(--ui-accent-soft);
    color: #c9dce3;
    font-size: 0.975rem;
    line-height: 1.65;
}

.context-note {
    color: #e0f1f5;
    font-weight: 600;
}

.meta-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.meta-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.38rem 0.75rem;
    border: 1px solid var(--ui-line-strong);
    border-radius: 999px;
    background: rgba(108, 198, 218, 0.06);
    color: #bcd5de;
    font-size: 0.8125rem;
    line-height: 1.35;
}

/* ---------- Partner logos: monochrome on dark ---------- */

.logo-plate,
.partner-detail-logo {
    border: 1px solid var(--ui-line-strong);
    border-radius: 3px;
    background:
        radial-gradient(120% 140% at 50% 0%, rgba(108, 198, 218, 0.08), transparent 60%),
        rgba(4, 16, 26, 0.75);
    box-shadow: none;
}

.logo-plate {
    min-height: 140px;
    padding: 1.5rem;
}

.logo-plate img,
.partner-detail-logo img {
    filter: brightness(0) invert(1);
    opacity: 0.88;
    transition: opacity 0.2s ease;
}

.logo-plate img {
    max-height: 60px;
    max-width: min(210px, 80%);
}

.partner-detail-logo img {
    max-height: 58px;
    max-width: min(200px, 78%);
}

.partner-detail-card:hover .partner-detail-logo img {
    opacity: 1;
}

/* Partner hub cards (EN/RU hubs load the content bundle, which lacks these). */
.partners-detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(1rem, 0.7rem + 1vw, 1.5rem);
}

.partner-detail-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: clamp(1.25rem, 1rem + 1vw, 2rem);
    text-align: center;
}

.partner-detail-logo {
    width: 100%;
    height: 112px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
    padding: 1rem;
}

.partner-detail-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.partner-detail-name {
    margin-bottom: 0.35rem;
    color: var(--ui-ink);
    font-size: 1.125rem;
    font-weight: 600;
}

.partner-detail-desc {
    color: var(--ui-muted);
    font-size: 0.9rem;
    line-height: 1.6;
}

.partner-detail-card > .btn:last-child,
.partner-detail-card > .partner-detail-link:last-child {
    margin-top: auto;
}

.partner-detail-card > :nth-last-child(2) {
    margin-bottom: 1.25rem;
}

@media (max-width: 1024px) {
    .partners-detail-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 560px) {
    .partners-detail-grid {
        grid-template-columns: 1fr;
    }
}

/* ---------- Guide notes ---------- */

.guide-source-note .seo-card p,
.guide-related-note .seo-card p {
    font-size: 0.975rem;
}

.article-review-note {
    color: #9fb6c2;
}

/* ---------- Sitemap ---------- */

.sitemap-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr));
    gap: 1.25rem;
}

.sitemap-group {
    padding: 1.4rem 1.5rem;
    border: 1px solid rgba(115, 169, 192, 0.22);
    border-radius: 3px;
    background: linear-gradient(145deg, rgba(14, 35, 52, 0.92), rgba(6, 20, 31, 0.94));
}

.sitemap-group-title {
    margin-bottom: 0.85rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--ui-line);
    color: var(--ui-ink);
    font-size: 1.0625rem;
    font-weight: 600;
}

.sitemap-links {
    display: grid;
    gap: 0.1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.sitemap-links a {
    display: block;
    padding: 0.35rem 0;
    color: var(--ui-text);
    font-size: 0.9375rem;
    line-height: 1.45;
}

.sitemap-links a:hover {
    color: #ffffff;
}

/* ---------- Forms ---------- */

.form-privacy-note a {
    color: #8fd8e8;
}

.form-privacy-note a:hover {
    color: #ffffff;
}

/* ---------- Homepage: legibility of small labels ---------- */

[data-archetype="home"] .command-assessment .section-label {
    color: #74bccf;
}

[data-archetype="home"] .command-assessment .assessment-intro small {
    color: #8ea9b6;
}

[data-archetype="home"] .route-map-legend span {
    color: #86a4b0;
}

[data-archetype="home"] .command-coordinate {
    color: #6a91a0;
}

[data-archetype="home"] .metric-label {
    font-size: max(0.7rem, 11px);
}

/* ---------- Small screens ---------- */

@media (max-width: 640px) {
    .seo-rich p,
    .seo-rich li {
        font-size: 1rem;
    }

    .faq-item {
        padding: 1.1rem 1.15rem;
    }

    main table {
        font-size: 0.875rem;
        table-layout: fixed;
    }

    main table th,
    main table td {
        padding: 0.6rem 0.7rem !important;
        overflow-wrap: anywhere;
    }

    .page-hero-actions .btn {
        flex: 1 1 auto;
    }
}
