/*
 * DEV-2.12 | SET-08 Interface Settings
 *
 * Owner:
 * - Interface Settings page layout
 * - Browser-local Work Home summary-card display preference hook
 * - V2 typography token scaling
 *
 * No Business Logic / API / DB ownership.
 */

.v2-theme .settings-interface[hidden] {
    display: none !important;
}

.v2-theme .settings-interface {
    display: grid;
    gap: 18px;
    margin-top: 18px;
}

.v2-theme .settings-interface__toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.v2-theme .settings-interface__toolbar h2,
.v2-theme .settings-interface__panel-header h3 {
    margin: 0;
    color: var(--v2-color-ink-950);
    font-weight: var(--v2-font-weight-bold);
}

.v2-theme .settings-interface__toolbar h2 {
    font-size: var(--v2-font-size-20);
}

.v2-theme .settings-interface__toolbar p,
.v2-theme .settings-interface__panel-header p {
    margin: 5px 0 0;
    color: var(--v2-color-ink-600);
    font-size: var(--v2-font-size-12);
    line-height: 1.55;
}

.v2-theme .settings-interface__panel {
    overflow: hidden;
    border: 1px solid var(--v2-color-border);
    border-radius: var(--v2-radius-xl);
    background: var(--v2-color-surface);
    box-shadow: var(--v2-shadow-card);
}

.v2-theme .settings-interface__panel-header {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--v2-color-border-soft);
    background: var(--v2-color-surface-soft);
}

.v2-theme .settings-interface__panel-header h3 {
    font-size: var(--v2-font-size-16);
}

.v2-theme .settings-interface__scope {
    flex: 0 0 auto;
    padding: 5px 9px;
    border-radius: var(--v2-radius-pill);
    background: var(--v2-color-brand-050);
    color: var(--v2-color-brand-800);
    font-size: var(--v2-font-size-10);
    font-weight: var(--v2-font-weight-bold);
}

.v2-theme .settings-interface__card-list {
    display: grid;
}

.v2-theme .settings-interface__card-row {
    min-width: 0;
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr) auto auto 42px;
    align-items: center;
    gap: 13px;
    min-height: 72px;
    padding: 11px 18px;
    border-bottom: 1px solid var(--v2-color-border-soft);
    transition: background var(--v2-motion-fast) var(--v2-ease-standard);
}

.v2-theme .settings-interface__card-row:last-child {
    border-bottom: 0;
}

.v2-theme .settings-interface__card-row:hover {
    background: var(--v2-color-brand-050);
}

.v2-theme .settings-interface__card-row.is-off {
    background: var(--v2-color-surface-muted);
}

.v2-theme .settings-interface__card-code {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    border: 1px solid var(--v2-color-border);
    border-radius: var(--v2-radius-pill);
    background: var(--v2-color-surface);
    color: var(--v2-color-brand-800);
    font-size: var(--v2-font-size-11);
    font-weight: var(--v2-font-weight-bold);
}

.v2-theme .settings-interface__card-copy {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.v2-theme .settings-interface__card-copy strong {
    overflow: hidden;
    color: var(--v2-color-ink-900);
    font-size: var(--v2-font-size-13);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.v2-theme .settings-interface__card-copy span {
    color: var(--v2-color-ink-600);
    font-size: var(--v2-font-size-10);
}

.v2-theme .settings-interface__toggle {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-width: 82px;
    color: var(--v2-color-ink-700);
    font-size: var(--v2-font-size-11);
    font-weight: var(--v2-font-weight-semibold);
    cursor: pointer;
}

.v2-theme .settings-interface__toggle input {
    width: 17px;
    height: 17px;
    margin: 0;
    accent-color: var(--v2-color-brand-700);
}

.v2-theme .settings-interface__toggle input:disabled {
    cursor: not-allowed;
    opacity: 0.6;
}

.v2-theme .settings-interface__order {
    display: inline-flex;
    gap: 5px;
}

.v2-theme .settings-interface__order .v2-button {
    width: 34px;
    min-width: 34px;
    padding: 0;
}

.v2-theme .settings-interface__position {
    color: var(--v2-color-ink-500);
    font-family: var(--v2-font-mono);
    font-size: var(--v2-font-size-11);
    text-align: right;
}

.v2-theme .settings-interface__font-options {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    padding: 18px;
}

.v2-theme .settings-interface__font-option {
    min-width: 0;
    min-height: 112px;
    display: grid;
    align-content: center;
    gap: 5px;
    padding: 14px;
    border: 1px solid var(--v2-color-border);
    border-radius: var(--v2-radius-lg);
    background: var(--v2-color-surface);
    color: var(--v2-color-ink-800);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition:
        transform var(--v2-motion-fast) var(--v2-ease-standard),
        border-color var(--v2-motion-fast) var(--v2-ease-standard),
        box-shadow var(--v2-motion-fast) var(--v2-ease-standard);
}

.v2-theme .settings-interface__font-option:hover {
    transform: translateY(-1px);
    border-color: #a9d7dc;
}

.v2-theme .settings-interface__font-option.is-active {
    border-color: var(--v2-color-brand-500);
    background: var(--v2-color-brand-050);
    box-shadow: var(--v2-shadow-focus);
}

.v2-theme .settings-interface__font-option strong {
    color: var(--v2-color-ink-950);
    font-size: var(--v2-font-size-16);
}

.v2-theme .settings-interface__font-option span {
    color: var(--v2-color-brand-800);
    font-size: var(--v2-font-size-13);
    font-weight: var(--v2-font-weight-bold);
}

.v2-theme .settings-interface__font-option small {
    color: var(--v2-color-ink-600);
    font-size: var(--v2-font-size-10);
}

.v2-theme .settings-interface__font-preview {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin: 0 18px 18px;
    padding: 12px 14px;
    border: 1px dashed var(--v2-color-border-strong);
    border-radius: var(--v2-radius-md);
    background: var(--v2-color-surface-muted);
}

.v2-theme .settings-interface__font-preview strong {
    color: var(--v2-color-ink-950);
    font-size: var(--v2-font-size-16);
}

.v2-theme .settings-interface__font-preview span {
    color: var(--v2-color-ink-600);
    font-size: var(--v2-font-size-12);
}

.v2-theme .settings-interface__notice,
.v2-theme .settings-interface__state {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border: 1px solid #cfe8e8;
    border-radius: var(--v2-radius-lg);
    background: var(--v2-color-brand-050);
    color: var(--v2-color-ink-700);
    font-size: var(--v2-font-size-11);
}

.v2-theme .settings-interface__notice strong {
    color: var(--v2-color-brand-800);
}

.v2-theme .settings-interface__state[hidden] {
    display: none !important;
}

.v2-theme .settings-interface__state[data-level="success"] {
    border-color: #bfe8cf;
    background: var(--v2-color-success-bg);
    color: var(--v2-color-success);
}

.v2-theme .settings-interface__state[data-level="warning"] {
    border-color: #f1d1ba;
    background: var(--v2-color-warning-bg);
    color: #a85118;
}

/* ------------------------------------------------------------
   Work Home preference hook
   MF-05 remains the owner of the native [hidden] attribute.
   ------------------------------------------------------------ */

.v2-theme .work-home__summary-card.is-interface-hidden {
    display: none !important;
}

.v2-theme .work-home__summary-grid.has-interface-hidden-cards {
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

/* ------------------------------------------------------------
   Global typography scale
   Mature V1 scale values retained: 90 / 100 / 114 / 128%.
   V2 applies the scale by overriding the single visual-foundation token set.
   ------------------------------------------------------------ */

body.v2-theme[data-interface-font-size="small"] {
    font-size: 14.4px;
    --v2-font-size-10: 9px;
    --v2-font-size-11: 9.9px;
    --v2-font-size-12: 10.8px;
    --v2-font-size-13: 11.7px;
    --v2-font-size-14: 12.6px;
    --v2-font-size-16: 14.4px;
    --v2-font-size-18: 16.2px;
    --v2-font-size-20: 18px;
    --v2-font-size-24: 21.6px;
    --v2-font-size-30: 27px;
    --v2-type-page-title-size: 21.6px;
    --v2-type-section-title-size: 16.2px;
    --v2-type-card-title-size: 11.7px;
    --v2-type-body-size: 11.7px;
    --v2-type-small-size: 9.9px;
    --v2-type-kpi-size: 27px;
    --v2-type-table-size: 10.8px;
}

body.v2-theme[data-interface-font-size="large"] {
    font-size: 18.24px;
    --v2-font-size-10: 11.4px;
    --v2-font-size-11: 12.54px;
    --v2-font-size-12: 13.68px;
    --v2-font-size-13: 14.82px;
    --v2-font-size-14: 15.96px;
    --v2-font-size-16: 18.24px;
    --v2-font-size-18: 20.52px;
    --v2-font-size-20: 22.8px;
    --v2-font-size-24: 27.36px;
    --v2-font-size-30: 34.2px;
    --v2-type-page-title-size: 27.36px;
    --v2-type-section-title-size: 20.52px;
    --v2-type-card-title-size: 14.82px;
    --v2-type-body-size: 14.82px;
    --v2-type-small-size: 12.54px;
    --v2-type-kpi-size: 34.2px;
    --v2-type-table-size: 13.68px;
}

body.v2-theme[data-interface-font-size="xlarge"] {
    font-size: 20.48px;
    --v2-font-size-10: 12.8px;
    --v2-font-size-11: 14.08px;
    --v2-font-size-12: 15.36px;
    --v2-font-size-13: 16.64px;
    --v2-font-size-14: 17.92px;
    --v2-font-size-16: 20.48px;
    --v2-font-size-18: 23.04px;
    --v2-font-size-20: 25.6px;
    --v2-font-size-24: 30.72px;
    --v2-font-size-30: 38.4px;
    --v2-type-page-title-size: 30.72px;
    --v2-type-section-title-size: 23.04px;
    --v2-type-card-title-size: 16.64px;
    --v2-type-body-size: 16.64px;
    --v2-type-small-size: 14.08px;
    --v2-type-kpi-size: 38.4px;
    --v2-type-table-size: 15.36px;
}

/* Two accepted visual areas still use one hard-coded font size. */
body.v2-theme[data-interface-font-size="small"] .work-home__summary-value {
    font-size: 27.9px;
}
body.v2-theme[data-interface-font-size="large"] .work-home__summary-value {
    font-size: 35.34px;
}
body.v2-theme[data-interface-font-size="xlarge"] .work-home__summary-value {
    font-size: 39.68px;
}

body.v2-theme[data-interface-font-size="small"] .settings-hub__header h1,
body.v2-theme[data-interface-font-size="small"] .settings-child__heading h1 {
    font-size: 24.3px;
}
body.v2-theme[data-interface-font-size="large"] .settings-hub__header h1,
body.v2-theme[data-interface-font-size="large"] .settings-child__heading h1 {
    font-size: 30.78px;
}
body.v2-theme[data-interface-font-size="xlarge"] .settings-hub__header h1,
body.v2-theme[data-interface-font-size="xlarge"] .settings-child__heading h1 {
    font-size: 34.56px;
}

@media (max-width: 900px) {
    .v2-theme .settings-interface__font-options {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .v2-theme .settings-interface__card-row {
        grid-template-columns: 52px minmax(0, 1fr) auto auto;
    }

    .v2-theme .settings-interface__position {
        display: none;
    }
}

@media (max-width: 640px) {
    .v2-theme .settings-interface__toolbar,
    .v2-theme .settings-interface__panel-header,
    .v2-theme .settings-interface__font-preview {
        align-items: stretch;
        flex-direction: column;
    }

    .v2-theme .settings-interface__font-options {
        grid-template-columns: 1fr;
    }

    .v2-theme .settings-interface__card-row {
        grid-template-columns: 48px minmax(0, 1fr);
    }

    .v2-theme .settings-interface__toggle,
    .v2-theme .settings-interface__order {
        grid-column: 2;
    }
}
