:root {
    color-scheme: light;

    --font-body: "Source Sans 3", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    --font-display: "Source Serif 4", Georgia, "Times New Roman", serif;

    --bg: #f3f2f2;
    --bg-soft: #eceef1;
    --surface: #ffffff;
    --surface-2: #f6f8fb;
    --text: #201f1d;
    --text-muted: #4a5563;
    --line: #d5dae2;
    --line-strong: #b7c1cf;

    --brand: #002e5d;
    --brand-2: #003da5;
    --brand-ink: #e6eef7;
    --accent: #a8c4e5;
    --accent-soft: #bdd6e6;
    --link: #003da5;
    --link-hover: #002e5d;

    --shadow-soft: 0 8px 28px rgba(0, 30, 60, 0.08);
    --shadow-card: 0 12px 38px rgba(0, 30, 60, 0.12);
}

:root[data-theme="dark"] {
    color-scheme: dark;

    --bg: #10141b;
    --bg-soft: #131a24;
    --surface: #171e29;
    --surface-2: #1d2635;
    --text: #edf2f8;
    --text-muted: #a9b7c9;
    --line: #2c3748;
    --line-strong: #3b4a60;

    --brand: #12457e;
    --brand-2: #2e6cb5;
    --brand-ink: #d9e7f6;
    --accent: #7ba7d9;
    --accent-soft: #5d86b8;
    --link: #8db8e8;
    --link-hover: #b4d3f2;

    --shadow-soft: 0 12px 32px rgba(0, 0, 0, 0.35);
    --shadow-card: 0 16px 40px rgba(0, 0, 0, 0.42);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    background:
        radial-gradient(circle at 2% -8%, rgba(0, 46, 93, 0.12), transparent 32%),
        radial-gradient(circle at 102% 3%, rgba(0, 61, 165, 0.10), transparent 30%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-soft) 100%);
    color: var(--text);
    font-family: var(--font-body);
    letter-spacing: 0.01em;
    line-height: 1.65;
}

.page-header {
    position: relative;
    overflow: hidden;
    padding: 3rem 1.5rem 4rem;
    text-align: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
    background:
        linear-gradient(120deg, rgba(0, 26, 54, 0.97), rgba(0, 46, 93, 0.95) 52%, rgba(0, 38, 80, 0.96)),
        linear-gradient(200deg, rgba(168, 196, 229, 0.14), transparent 48%);
    box-shadow: var(--shadow-soft);
}

.page-header::before,
.page-header::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.page-header::before {
    width: 340px;
    height: 340px;
    right: -120px;
    top: -140px;
    background: radial-gradient(circle, rgba(189, 214, 230, 0.2), transparent 70%);
}

.page-header::after {
    width: 260px;
    height: 260px;
    left: -120px;
    bottom: -130px;
    background: radial-gradient(circle, rgba(189, 214, 230, 0.12), transparent 68%);
}

.page-header > * {
    position: relative;
}

.page-header__eyebrow {
    margin: 0 0 0.8rem;
    color: var(--accent-soft);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.22em;
    text-transform: uppercase;
}

.project-name {
    margin: 0 auto;
    max-width: 20ch;
    color: #f2f7fc;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(2.4rem, 6vw, 3.6rem);
    line-height: 1.1;
}

.project-tagline {
    max-width: 52ch;
    margin: 1rem auto 0.3rem;
    color: #dce8f4;
    font-weight: 600;
    font-size: 1.05rem;
}


.page-header__links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.55rem;
    margin-top: 1.6rem;
}

.btn-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.5rem 1.05rem;
    border: 1px solid rgba(189, 214, 230, 0.55);
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #f2f7fc;
    font-size: 0.88rem;
    font-weight: 600;
    text-decoration: none;
    transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.btn-pill:hover,
.btn-pill:focus-visible {
    transform: translateY(-1px);
    background: rgba(189, 214, 230, 0.2);
    border-color: var(--accent-soft);
}

.main-content {
    position: relative;
    max-width: 1000px;
    margin: -1.8rem auto 2.5rem;
    padding: 2.2rem 2.3rem;
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow-soft);
}

.main-content h2 {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.45rem;
    line-height: 1.25;
    border-bottom: 1px solid var(--line);
    padding-bottom: 0.4rem;
    margin: 2rem 0 0.9rem;
}

.main-content h2:first-child {
    margin-top: 0;
}

.section-number {
    color: var(--brand-2);
    font-weight: 600;
    margin-right: 0.35rem;
}

.main-content a {
    color: var(--link);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, var(--link) 45%, transparent);
    text-underline-offset: 0.14em;
    transition: color 180ms ease, text-decoration-color 180ms ease;
}

.main-content a:hover,
.main-content a:focus-visible {
    color: var(--link-hover);
    text-decoration-color: var(--link-hover);
}

.placeholder {
    margin: 1rem 0;
    padding: 1rem 1.2rem;
    border: 1px dashed var(--line-strong);
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text-muted);
    font-style: italic;
}

.affiliation-strip {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.6rem;
    margin: 0 0 1.4rem;
}

.affiliation-strip img {
    height: 52px;
    width: auto;
}

.site-footer {
    max-width: 1000px;
    margin: 0 auto 2.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.site-footer a {
    color: var(--link);
}

.site-footer__ai {
    margin-top: 0.3rem;
    font-size: 0.78rem;
    opacity: 0.8;
}

@media (max-width: 700px) {
    .main-content {
        margin: -1.2rem 0.8rem 2rem;
        padding: 1.5rem 1.1rem;
        border-radius: 12px;
    }
}

@media (prefers-reduced-motion: no-preference) {
    .page-header,
    .main-content {
        animation: riseIn 540ms ease-out both;
    }

    .main-content {
        animation-delay: 100ms;
    }
}

html.reduce-motion *,
html.reduce-motion *::before,
html.reduce-motion *::after {
    animation: none !important;
    transition: none !important;
}

@keyframes riseIn {
    from {
        opacity: 0;
        transform: translateY(8px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==========================================================================
   Polyglot page: demo players, flow diagram, model table, infrastructure.
   Everything above this line is the shared site base.
   ========================================================================== */

:root {
    --good: #0f7b52;
    --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
}

:root[data-theme="dark"] {
    --good: #4cc38a;
}

[hidden] {
    display: none !important;
}

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

:focus-visible {
    outline: 2px solid var(--link);
    outline-offset: 2px;
}

.page-header :focus-visible {
    outline-color: #f2f7fc;
}

:lang(hi) {
    font-family: "Source Sans 3", "Kohinoor Devanagari", "Noto Sans Devanagari", "Nirmala UI", "Mangal", sans-serif;
}

:lang(ja) {
    font-family: "Source Sans 3", "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", "Meiryo", "Noto Sans JP", sans-serif;
}

.main-content h2:not(:first-child) {
    margin-top: 2.6rem;
}

.lede {
    margin: 0 0 1.2rem;
    font-size: 1.08rem;
    color: var(--text-muted);
}

/* ------------------------------------------------------------------ demo */
.demo-note {
    margin: 0 0 1rem;
    padding: 0.7rem 1rem;
    border: 1px dashed var(--line-strong);
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text-muted);
    font-size: 0.93rem;
}

.demo-source {
    margin: 0 0 1.4rem;
    padding: 1.2rem 1.4rem 1.3rem;
    border: 1px solid var(--line);
    border-left: 4px solid var(--brand-2);
    border-radius: 0 14px 14px 0;
    background: var(--surface-2);
    transition: box-shadow 180ms ease, border-color 180ms ease;
}

.demo-source.is-playing {
    border-color: var(--brand-2);
    box-shadow: var(--shadow-card);
}

.demo-label {
    margin: 0 0 0.5rem;
    color: var(--text-muted);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.demo-quote {
    margin: 0 0 1rem;
    font-family: var(--font-display);
    font-size: clamp(1.15rem, 2.6vw, 1.45rem);
    font-weight: 600;
    line-height: 1.4;
}

.demo-source audio {
    display: block;
    width: 100%;
}

.demo-source.is-pending audio {
    opacity: 0.55;
}

.is-placeholder {
    color: var(--text-muted);
    font-style: italic;
    font-weight: 400;
}

.demo-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem 1rem;
    margin: 0 0 1rem;
}

.demo-hint {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.btn-solid {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.55rem 1.25rem 0.55rem 1.05rem;
    border: 1px solid var(--brand-2);
    border-radius: 999px;
    background: var(--brand-2);
    color: #ffffff;
    font: inherit;
    font-size: 0.92rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    cursor: pointer;
    transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.btn-solid svg {
    width: 1rem;
    height: 1rem;
    fill: currentColor;
}

.btn-solid:hover:not(:disabled) {
    transform: translateY(-1px);
    background: var(--brand);
    border-color: var(--brand);
}

.btn-solid:disabled {
    background: var(--surface-2);
    border-color: var(--line-strong);
    color: var(--text-muted);
    cursor: not-allowed;
}

.btn-solid[aria-pressed="true"] .i-play,
.btn-solid[aria-pressed="false"] .i-stop {
    display: none;
}

.demo-divider {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin: 0.4rem 0 1.4rem;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
}

.demo-divider::before,
.demo-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line-strong);
}

.lang-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 17.5rem), 1fr));
    gap: 1rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.lang-card {
    display: flex;
    flex-direction: column;
    padding: 1.1rem 1.2rem 1.15rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface-2);
    transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.lang-card.is-playing {
    transform: translateY(-2px);
    border-color: var(--brand-2);
    box-shadow: 0 0 0 2px color-mix(in srgb, var(--brand-2) 55%, transparent), var(--shadow-card);
}

.lang-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.6rem;
    margin-bottom: 0.7rem;
}

.lang-card__name {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.08rem;
    font-weight: 700;
    line-height: 1.25;
    color: var(--brand-2);
}

:root[data-theme="dark"] .lang-card__name {
    color: var(--link);
}

.lang-card__native {
    display: block;
    color: var(--text-muted);
    font-size: 0.86rem;
}

.lang-card__text {
    flex: 1;
    margin: 0 0 0.8rem;
    font-size: 1.08rem;
    line-height: 1.55;
}

.lang-card__text:lang(hi) {
    line-height: 1.75;
}

.lang-card__text:lang(ja) {
    line-height: 1.8;
}

.lang-card__back {
    margin: 0 0 1rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--line);
    color: var(--text-muted);
    font-size: 0.84rem;
    line-height: 1.5;
}

.lang-card__back-label {
    display: block;
    margin-bottom: 0.15rem;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.lang-card__player {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: auto;
}

.play-btn {
    flex: none;
    display: grid;
    place-items: center;
    width: 2.7rem;
    height: 2.7rem;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--brand-2);
    color: #ffffff;
    cursor: pointer;
    transition: transform 160ms ease, background 160ms ease;
}

.play-btn svg {
    width: 1.05rem;
    height: 1.05rem;
    fill: currentColor;
}

.play-btn:hover:not(:disabled) {
    transform: scale(1.07);
    background: var(--brand);
}

.play-btn:disabled {
    background: var(--line);
    color: var(--text-muted);
    cursor: not-allowed;
}

.play-btn[aria-pressed="true"] .i-play,
.play-btn[aria-pressed="false"] .i-pause {
    display: none;
}

.play-track {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: var(--line);
    overflow: hidden;
}

.play-track > span {
    display: block;
    width: var(--p, 0%);
    height: 100%;
    border-radius: inherit;
    background: var(--brand-2);
}

.play-status {
    flex: 1;
    color: var(--text-muted);
    font-size: 0.84rem;
    font-style: italic;
}

.eq {
    flex: none;
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 16px;
    margin-top: 0.2rem;
    opacity: 0;
    transition: opacity 180ms ease;
}

.eq span {
    display: block;
    width: 3px;
    height: 100%;
    border-radius: 1px;
    background: var(--brand-2);
    transform: scaleY(0.5);
    transform-origin: bottom;
}

:root[data-theme="dark"] .eq span {
    background: var(--link);
}

.is-playing .eq {
    opacity: 1;
}

@media (prefers-reduced-motion: no-preference) {
    .is-playing .eq span {
        animation: eq 820ms ease-in-out infinite alternate;
    }

    .is-playing .eq span:nth-child(2) { animation-delay: -280ms; }
    .is-playing .eq span:nth-child(3) { animation-delay: -560ms; }
    .is-playing .eq span:nth-child(4) { animation-delay: -140ms; }
}

@keyframes eq {
    from { transform: scaleY(0.2); }
    to { transform: scaleY(1); }
}

/* ------------------------------------------------------------------ flow */
.flow-wrap {
    margin: 1.3rem 0 0.6rem;
}

.flow {
    display: block;
    width: 100%;
    height: auto;
}

.flow--tall {
    display: none;
    max-width: 420px;
    margin: 0 auto;
}

.flow text {
    font-family: var(--font-body);
}

.fl-node {
    fill: var(--surface-2);
    stroke: var(--line-strong);
    stroke-width: 1.2;
}

.fl-node--gate {
    stroke: color-mix(in srgb, var(--good) 60%, var(--line-strong));
}

.fl-node--io {
    fill: var(--brand);
    stroke: var(--brand-2);
}

.fl-node--lane {
    fill: var(--surface);
    stroke-dasharray: 5 4;
}

.fl-lane {
    fill: none;
    stroke: var(--line-strong);
    stroke-width: 1.4;
    stroke-dasharray: 6 5;
}

.fl-gatebar {
    fill: var(--good);
}

.fl-badge {
    fill: var(--brand-2);
}

.fl-n--gate .fl-badge {
    fill: var(--good);
}

.fl-badge-text {
    fill: #ffffff;
    font-size: 13px;
    font-weight: 700;
}

.fl-n--gate .fl-badge-text {
    fill: var(--surface);
}

.fl-bar {
    fill: var(--accent);
}

.fl-title {
    fill: var(--text);
    font-family: var(--font-display);
    font-size: 16px;
    font-weight: 700;
}

.fl-model {
    fill: var(--link);
    font-size: 12.5px;
    font-weight: 700;
}

.fl-desc {
    fill: var(--text-muted);
    font-size: 12px;
}

.fl-tag {
    fill: var(--link);
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.12em;
}

.fl-lane-title {
    fill: var(--text);
    font-family: var(--font-display);
    font-size: 15px;
    font-weight: 700;
}

.fl-lane-sub {
    fill: var(--text-muted);
    font-size: 12px;
}

.fl-n--io-voice .fl-title,
.fl-n--io-out .fl-title {
    fill: #f2f7fc;
}

.fl-n--io-voice .fl-desc,
.fl-n--io-out .fl-desc {
    fill: var(--brand-ink);
}

.fl-arrow {
    fill: none;
    stroke: var(--text-muted);
    stroke-width: 2;
    stroke-linecap: round;
}

.fl-arrow--dash {
    stroke-dasharray: 4 4;
}

.fl-head {
    fill: var(--text-muted);
}

.flow-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.4rem;
    margin: 0.4rem 0 1.1rem;
    padding: 0;
    list-style: none;
    color: var(--text-muted);
    font-size: 0.84rem;
}

.flow-legend li {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.swatch {
    display: inline-block;
    width: 1.1rem;
    height: 0.7rem;
    border: 1.5px solid var(--line-strong);
    border-radius: 3px;
    background: var(--surface-2);
}

.swatch--gate {
    border-color: var(--good);
    background: color-mix(in srgb, var(--good) 22%, var(--surface-2));
}

.swatch--lane {
    border-style: dashed;
    background: var(--surface);
}

@media (max-width: 860px) {
    .flow--wide {
        display: none;
    }

    .flow--tall {
        display: block;
    }
}

/* ---------------------------------------------------------------- models */
.table-wrap {
    margin: 1.1rem 0 0.6rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    overflow: hidden;
}

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

table.data caption {
    padding: 0.65rem 0.9rem;
    text-align: left;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
}

table.data th,
table.data td {
    padding: 0.6rem 0.9rem;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--line);
}

table.data thead th {
    background: var(--surface-2);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    white-space: nowrap;
}

table.data tbody tr:last-child td {
    border-bottom: none;
}

table.data tbody tr:hover {
    background: var(--surface-2);
}

table.data td:first-child strong {
    display: block;
    color: var(--link);
}

.model-sub {
    display: block;
    margin-top: 0.1rem;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.licence {
    min-width: 7rem;
}

table.data th:nth-child(1) { width: 27%; }
table.data th:nth-child(2) { width: 29%; }
table.data th:nth-child(3) { width: 24%; }
table.data th:nth-child(4) { width: 20%; }

.footnote {
    margin: 0.4rem 0 0;
    color: var(--text-muted);
    font-size: 0.84rem;
}

@media (max-width: 700px) {
    table.data,
    table.data tbody,
    table.data tr,
    table.data td,
    table.data caption {
        display: block;
    }

    table.data thead {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0, 0, 0, 0);
    }

    table.data tr {
        padding: 0.55rem 0.9rem 0.6rem;
        border-bottom: 1px solid var(--line);
    }

    table.data tbody tr:last-child {
        border-bottom: none;
    }

    table.data td {
        display: grid;
        grid-template-columns: 4.6rem 1fr;
        gap: 0.6rem;
        padding: 0.18rem 0;
        border: 0;
    }

    table.data td::before {
        content: attr(data-label);
        padding-top: 0.15rem;
        color: var(--text-muted);
        font-size: 0.68rem;
        font-weight: 700;
        letter-spacing: 0.08em;
        text-transform: uppercase;
    }

    table.data td:first-child {
        display: block;
        padding-bottom: 0.25rem;
        font-size: 1rem;
    }

    table.data td:first-child::before {
        content: none;
    }
}

/* -------------------------------------------------------- infrastructure */
.infra-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 0.9rem;
    margin: 1.1rem 0;
}

.infra-tile {
    padding: 1rem 1.1rem;
    border: 1px solid var(--line);
    border-top: 3px solid var(--brand-2);
    border-radius: 10px;
    background: var(--surface-2);
}

.infra-tile__k {
    display: block;
    margin-bottom: 0.3rem;
    font-family: var(--font-display);
    font-size: 1.02rem;
    font-weight: 700;
}

.infra-tile p {
    margin: 0;
    color: var(--text-muted);
    font-size: 0.92rem;
    line-height: 1.55;
}

.cta-link {
    font-weight: 600;
}

@media (max-width: 700px) {
    .demo-source {
        padding: 1rem 1.05rem 1.1rem;
    }

    .affiliation-strip img {
        height: 40px;
    }
}

.modes-title {
    margin: 1.8rem 0 0.2rem;
    font-family: var(--font-display);
    font-size: 1.12rem;
    font-weight: 700;
}

.modes-grid {
    margin: 0.8rem 0 2.2rem;
}
