.typography-lab-screen {
    --lab-demo-weight: 525;
    gap: 1rem;
    padding-bottom: 2rem;
}

.typography-lab-screen[data-lab-font="current"] {
    --lab-font: "Segoe UI", Tahoma, Geneva, Verdana, Arial, sans-serif;
}

.typography-lab-screen[data-lab-font="system"] {
    --lab-font: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", sans-serif;
}

.typography-lab-screen[data-lab-font="source-sans"] {
    --lab-font: "Source Sans 3", system-ui, sans-serif;
}

.typography-lab-screen[data-lab-font="ibm-plex"] {
    --lab-font: "IBM Plex Sans", system-ui, sans-serif;
}

.typography-lab-screen[data-lab-font="manrope"] {
    --lab-font: Manrope, system-ui, sans-serif;
}

.typography-lab-intro,
.typography-lab-toolbar,
.typography-lab-layout,
.typography-comparison {
    width: min(100%, 1440px);
    margin-inline: auto;
}

.typography-lab-intro {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;
    padding: 1.6rem 0.25rem 0.5rem;
}

.typography-lab-intro > div {
    max-width: 72ch;
}

.typography-lab-context,
.typography-lab-section-heading p,
.typography-section-label {
    margin: 0 0 0.35rem;
    color: var(--active-color);
    font-size: 0.78rem;
    font-weight: 500;
}

.typography-lab-intro h1 {
    margin: 0;
    font-size: 2rem;
    font-weight: 550;
    letter-spacing: -0.015em;
    line-height: 1.12;
    text-wrap: balance;
}

.typography-lab-intro p:last-child {
    margin: 0.65rem 0 0;
    color: var(--muted-color);
    line-height: 1.55;
}

.typography-lab-back {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    flex: none;
    padding-inline: 1rem;
    text-decoration: none;
}

.typography-lab-toolbar {
    padding: 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
}

.typography-font-options {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 0.5rem;
}

.typography-language-options {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.85rem;
    padding-top: 0.85rem;
    border-top: 1px solid var(--border-color);
}

.typography-language-options > span {
    margin-right: 0.25rem;
    color: var(--muted-color);
    font-size: 0.78rem;
    font-weight: 500;
}

.typography-language-options button {
    min-height: 44px;
    padding: 0.55rem 0.85rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    background: #fff;
    font: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
}

.typography-language-options button:hover {
    border-color: rgba(51, 117, 170, 0.55);
}

.typography-language-options button[aria-pressed="true"] {
    border-color: var(--active-color);
    color: var(--active-color-focus);
    background: var(--active-color-light);
}

.typography-font-option {
    min-height: 70px;
    padding: 0.7rem 0.8rem;
    border: 1px solid transparent;
    border-radius: 8px;
    color: var(--text-color);
    background: var(--body-background);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.18s ease, background-color 0.18s ease;
}

.typography-font-option:hover {
    border-color: rgba(51, 117, 170, 0.45);
}

.typography-font-option[aria-pressed="true"] {
    border-color: var(--active-color);
    background: var(--active-color-light);
}

.typography-font-option-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.typography-font-option strong {
    font-size: 0.9rem;
    font-weight: 600;
}

.typography-font-option > span:last-child {
    display: block;
    margin-top: 0.3rem;
    color: var(--muted-color);
    font-size: 0.72rem;
}

.typography-font-option em {
    padding: 0.18rem 0.35rem;
    border-radius: 999px;
    color: var(--active-color-focus);
    background: #fff;
    font-size: 0.65rem;
    font-style: normal;
    font-weight: 600;
}

.typography-font-option em.is-preferred {
    color: #1f7a4b;
}

.typography-lab-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(260px, 0.3fr);
    align-items: start;
    gap: 1rem;
}

.typography-lab-preview,
.typography-lab-notes,
.typography-comparison {
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: #fff;
}

.typography-lab-preview {
    min-width: 0;
    padding: 1.25rem;
    font-family: var(--lab-font);
    font-optical-sizing: auto;
    font-kerning: normal;
}

.typography-lab-section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.typography-lab-section-heading h2,
.typography-lab-section-heading span {
    margin: 0;
}

.typography-lab-section-heading h2 {
    font-size: 1.5rem;
    font-weight: 550;
}

.typography-lab-section-heading span {
    display: block;
    max-width: 62ch;
    margin-top: 0.3rem;
    color: var(--muted-color);
    font-size: 0.9rem;
    line-height: 1.45;
}

.typography-lab-section-heading .primary-action {
    flex: none;
    font-family: inherit;
    font-weight: 550;
}

.typography-live-control {
    display: grid;
    grid-template-columns: minmax(190px, 0.55fr) minmax(220px, 1fr);
    align-items: center;
    gap: 0.65rem 1rem;
    padding: 1rem 0;
    border-bottom: 1px solid var(--border-color);
}

.typography-live-control label {
    color: var(--muted-color);
    font-size: 0.78rem;
    font-weight: 500;
}

.typography-live-control input[type="text"] {
    width: 100%;
    min-height: 42px;
    padding: 0.55rem 0.7rem;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-color);
    background: #fff;
    font: inherit;
}

.typography-live-control input[type="range"] {
    width: 100%;
    accent-color: var(--active-color);
}

.typography-live-control output {
    color: var(--text-color);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.typography-live-sample {
    grid-column: 1 / -1;
    margin: 0.35rem 0 0;
    overflow-wrap: anywhere;
    font-size: 1.65rem;
    font-variation-settings: "wght" var(--lab-demo-weight);
    font-weight: var(--lab-demo-weight);
    line-height: 1.2;
}

.typography-character-set {
    grid-column: 1 / -1;
    margin: 0;
    padding: 0.7rem 0.8rem;
    border-radius: 8px;
    color: var(--muted-color);
    background: var(--body-background);
    font-size: 0.92rem;
    font-variation-settings: "wght" 450;
    font-weight: 450;
    line-height: 1.55;
    overflow-wrap: anywhere;
}

.typography-weight-scale {
    display: grid;
    gap: 0;
    padding: 0.85rem 0 1rem;
}

.typography-weight-scale p {
    display: grid;
    grid-template-columns: 3.5rem minmax(0, 1fr);
    gap: 0.75rem;
    margin: 0;
    padding: 0.42rem 0;
    border-bottom: 1px solid rgba(220, 227, 234, 0.7);
    font-variation-settings: "wght" var(--sample-weight);
    font-weight: var(--sample-weight);
}

.typography-weight-scale p:last-child {
    border-bottom: 0;
}

.typography-weight-scale p > span:first-child {
    color: var(--muted-color);
    font-size: 0.75rem;
    font-variant-numeric: tabular-nums;
    font-weight: 400;
}

.typography-product-sample {
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 8px;
}

.typography-product-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
}

.typography-product-header h2,
.typography-product-header p {
    margin: 0;
}

.typography-product-header > div > span {
    color: var(--active-color);
    font-size: 0.76rem;
    font-weight: 500;
}

.typography-product-header h2 {
    margin-top: 0.2rem;
    font-size: 1.3rem;
    font-weight: 600;
    line-height: 1.18;
}

.typography-product-header p {
    margin-top: 0.35rem;
    color: var(--muted-color);
    font-size: 0.86rem;
    font-weight: 400;
}

.typography-access-badge {
    padding: 0.3rem 0.5rem;
    border-radius: 999px;
    color: var(--active-color-focus);
    background: var(--active-color-light);
    font-size: 0.72rem;
    font-weight: 550;
}

.typography-facts {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin: 0;
    border-block: 1px solid var(--border-color);
    background: var(--body-background);
}

.typography-facts div {
    padding: 0.75rem 1rem;
    border-right: 1px solid var(--border-color);
}

.typography-facts div:last-child {
    border-right: 0;
}

.typography-facts dt {
    color: var(--muted-color);
    font-size: 0.72rem;
    font-weight: 450;
}

.typography-facts dd {
    margin: 0.25rem 0 0;
    font-size: 1rem;
    font-variant-numeric: tabular-nums;
    font-weight: 575;
}

.typography-product-body {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
}

.typography-product-body h3,
.typography-product-body p {
    margin: 0;
}

.typography-product-body h3 {
    font-size: 1.08rem;
    font-weight: 575;
}

.typography-product-body p {
    max-width: 68ch;
    margin-top: 0.4rem;
    color: var(--muted-color);
    font-size: 0.86rem;
    font-weight: 400;
    line-height: 1.5;
}

.typography-sample-actions {
    display: flex;
    gap: 0.5rem;
    flex: none;
}

.typography-sample-actions button {
    min-height: 42px;
    padding: 0.65rem 0.85rem;
    border: 0;
    border-radius: 8px;
    font: inherit;
    font-weight: 550;
    cursor: pointer;
}

.typography-sample-primary {
    color: #fff;
    background: var(--active-color);
}

.typography-sample-secondary {
    color: var(--active-color-focus);
    background: var(--active-color-light);
}

.typography-table-wrap {
    overflow-x: auto;
    border-top: 1px solid var(--border-color);
}

.typography-table-wrap table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.82rem;
}

.typography-table-wrap th,
.typography-table-wrap td {
    padding: 0.65rem 0.8rem;
    border-bottom: 1px solid var(--border-color);
    text-align: left;
    white-space: nowrap;
}

.typography-table-wrap th {
    color: var(--muted-color);
    background: var(--body-background);
    font-weight: 500;
}

.typography-table-wrap td {
    font-variant-numeric: tabular-nums;
    font-weight: 400;
}

.typography-table-wrap tr:last-child td {
    border-bottom: 0;
}

.typography-preference-status {
    min-height: 1.25rem;
    margin: 0.75rem 0 -0.25rem;
    color: #1f7a4b;
    font-size: 0.78rem;
    font-weight: 500;
}

.typography-lab-notes {
    position: sticky;
    top: 1rem;
    padding: 1.15rem;
}

.typography-lab-notes h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.typography-lab-notes ol {
    display: grid;
    gap: 0.8rem;
    margin: 1rem 0;
    padding-left: 1.25rem;
    color: var(--muted-color);
    font-size: 0.84rem;
    line-height: 1.45;
}

.typography-lab-notes strong {
    color: var(--text-color);
    font-weight: 600;
}

.typography-lab-notes > p {
    margin: 0;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    color: var(--muted-color);
    font-size: 0.76rem;
    line-height: 1.5;
}

.typography-comparison {
    overflow: hidden;
}

.typography-comparison > header {
    padding: 1rem 1.15rem;
    border-bottom: 1px solid var(--border-color);
}

.typography-comparison > header h2,
.typography-comparison > header p {
    margin: 0;
}

.typography-comparison > header h2 {
    font-size: 1.15rem;
    font-weight: 600;
}

.typography-comparison > header p {
    margin-top: 0.25rem;
    color: var(--muted-color);
    font-size: 0.82rem;
}

.typography-comparison-row {
    display: grid;
    grid-template-columns: minmax(230px, 0.35fr) minmax(0, 1fr);
    gap: 1rem;
    padding: 1rem 1.15rem;
    border-bottom: 1px solid var(--border-color);
}

.typography-comparison-row:last-child {
    border-bottom: 0;
}

.typography-comparison-row[data-font-family="current"] {
    font-family: "Segoe UI", Tahoma, Geneva, Verdana, Arial, sans-serif;
}

.typography-comparison-row[data-font-family="system"] {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", sans-serif;
}

.typography-comparison-row[data-font-family="source-sans"] {
    font-family: "Source Sans 3", system-ui, sans-serif;
}

.typography-comparison-row[data-font-family="ibm-plex"] {
    font-family: "IBM Plex Sans", system-ui, sans-serif;
}

.typography-comparison-row[data-font-family="manrope"] {
    font-family: Manrope, system-ui, sans-serif;
}

.typography-comparison-row header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.typography-comparison-row h3,
.typography-comparison-row p {
    margin: 0;
}

.typography-comparison-row h3 {
    font-size: 1rem;
    font-weight: 600;
}

.typography-comparison-row header p {
    margin-top: 0.25rem;
    color: var(--muted-color);
    font-size: 0.75rem;
    line-height: 1.4;
}

.typography-comparison-row header > span {
    flex: none;
    color: var(--muted-color);
    font-size: 0.68rem;
}

.typography-comparison-weights {
    display: grid;
    gap: 0.35rem;
}

.typography-comparison-weights p {
    display: grid;
    grid-template-columns: 2.6rem minmax(0, 1fr);
    gap: 0.6rem;
    font-variation-settings: "wght" var(--sample-weight);
    font-weight: var(--sample-weight);
}

.typography-comparison-weights p > span:first-child {
    color: var(--muted-color);
    font-size: 0.7rem;
    font-weight: 400;
}

@media (max-width: 1120px) {
    .typography-font-options {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .typography-lab-layout {
        grid-template-columns: 1fr;
    }

    .typography-lab-notes {
        position: static;
    }
}

@media (max-width: 720px) {
    .typography-lab-intro,
    .typography-lab-section-heading,
    .typography-product-body {
        align-items: stretch;
        flex-direction: column;
    }

    .typography-font-options,
    .typography-live-control,
    .typography-comparison-row {
        grid-template-columns: 1fr;
    }

    .typography-facts {
        grid-template-columns: 1fr;
    }

    .typography-facts div {
        border-right: 0;
        border-bottom: 1px solid var(--border-color);
    }

    .typography-facts div:last-child {
        border-bottom: 0;
    }

    .typography-sample-actions {
        flex-wrap: wrap;
    }

    .typography-sample-actions button,
    .typography-lab-section-heading .primary-action {
        flex: 1;
    }
}

@media (prefers-reduced-motion: reduce) {
    .typography-font-option,
    .typography-language-options button {
        transition: none;
    }
}
