/* Matosic configurator-specific styles.
 * Inherits the cream/system-font/handmade aesthetic from styles.css.
 * Adds the components that don't exist on the marketing landing:
 * keyboard visualization, connect panel, key editor, layer tabs.
 */

:root {
    --key-bg: #f6eed8;       /* cream keycap face */
    --key-border: #c9b88a;    /* maple/wood tan */
    --key-bg-active: #a4b59a; /* sage — selected key state, matches caps */
    --key-bg-hover: #f0e7cb;  /* hover lift */
    --key-shadow: 0 1px 0 #c0b07f, 0 2px 4px rgba(26, 36, 25, 0.06);
    --key-shadow-active: inset 0 1px 2px rgba(26, 36, 25, 0.12);
    --panel-bg: #f6eed8;
    --panel-border: #d4c89e;
    --status-green: #6b9162;  /* leaf green — connection-live indicator */
}

/* On the configurator, main goes wider to host the two-column layout
 * (configurator on the left, info or editor on the right). The header
 * itself stays at the landing's 620px width to preserve nav alignment
 * between Product and Configure (the earlier fix). */

main:has(.configure-page) {
    max-width: 1080px;
    padding-top: 56px;       /* tighter than landing's 80px */
    padding-bottom: 80px;
}

/* Keep the header and the narrow text blocks at the landing's width,
 * centered within the wider main. */

main:has(.configure-page) > article > .site-nav,
main:has(.configure-page) > article > .narrow-block {
    max-width: 620px;
    margin-left: auto;
    margin-right: auto;
}

/* Tight heading block on configure (utility page, not a hero) */

.narrow-block.configure-heading {
    margin-bottom: 28px;
}

.narrow-block.configure-heading h1 {
    font-size: 28px;
    line-height: 1.2;
    margin-bottom: 0;
}

/* Two-column layout for the configurator + sidebar.
 * Stacks single-column under ~900px viewport. */

.config-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 340px;
    gap: 32px;
    align-items: start;
    margin-bottom: 56px;
}

@media (max-width: 900px) {
    main:has(.configure-page) {
        max-width: 620px;
    }
    .config-layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

/* Info pane (the "how to" sidebar) */

.info-pane {
    padding: 24px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
}

.info-title {
    font-family: ui-monospace, SF Mono, Menlo, Consolas, monospace;
    font-size: 11px;
    font-weight: 600;
    color: var(--text);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 28px;
    margin-bottom: 10px;
}

.info-pane > .info-title:first-child {
    margin-top: 0;
}

.info-list {
    font-size: 13.5px;
    color: var(--text);
    line-height: 1.7;
    margin: 0 0 4px 18px;
    padding: 0;
}

.info-list li {
    margin-bottom: 4px;
    color: var(--text-soft);
}

.info-list li strong {
    color: var(--text);
    font-weight: 600;
}

.info-dl {
    margin: 0;
}

.info-dl dt {
    font-size: 13.5px;
    font-weight: 600;
    color: var(--text);
    margin-top: 12px;
}

.info-dl dt:first-child {
    margin-top: 0;
}

.info-dl dd {
    font-size: 13.5px;
    color: var(--text-soft);
    line-height: 1.6;
    margin: 2px 0 0 0;
}

.info-pane p {
    font-size: 13.5px;
    color: var(--text-soft);
    line-height: 1.7;
    margin: 0 0 12px 0;
}

.info-pane p:last-child {
    margin-bottom: 0;
}

.info-pane p strong {
    color: var(--text);
    font-weight: 600;
}

.info-pane code {
    font-family: ui-monospace, SF Mono, Menlo, Consolas, monospace;
    font-size: 12px;
    background: var(--code-bg, #efeae0);
    padding: 1px 5px;
    border-radius: 3px;
    color: var(--accent);
    white-space: nowrap;
}

.info-pane a {
    color: var(--text);
    text-decoration: underline;
    text-decoration-color: var(--accent);
    text-underline-offset: 3px;
}

.info-pane a:hover {
    color: var(--accent);
}

/* Header is shared with the landing page via .site-nav in styles.css. */

/* CTA buttons (also used in configurator) */

.cta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 20px;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    border-radius: 4px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all 0.15s ease;
    text-decoration: none;
}

.cta-primary {
    background: var(--text);
    color: var(--bg);
    border-color: var(--text);
}

.cta-primary:hover {
    background: var(--accent);
    border-color: var(--accent);
}

.cta-secondary {
    background: transparent;
    color: var(--text);
    border-color: var(--rule);
}

.cta-secondary:hover {
    border-color: var(--text-soft);
}

/* Connect panel — status strip, not a hero. Kept tight so the layer
 * tabs and the board itself dominate the viewport. */

.connect-panel {
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 6px;
    padding: 8px 14px;
    margin-bottom: 10px;
}

.connect-state {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    padding: 4px 0;
}

.connect-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-faint);
    flex-shrink: 0;
}

.connect-dot-live {
    background: var(--status-green);
    box-shadow: 0 0 0 3px rgba(107, 145, 98, 0.18);
}

.connect-text {
    flex: 1;
    min-width: 160px;
}

.connect-title {
    font-size: 13.5px;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 1px;
    line-height: 1.3;
}

.connect-sub {
    font-size: 11.5px;
    color: var(--text-soft);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    margin: 0;
    line-height: 1.3;
}

/* CTA buttons inside the connect strip are smaller than page-level CTAs. */
.connect-panel .cta {
    padding: 6px 12px;
    font-size: 12.5px;
}

/* Layer tabs */

.layer-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 14px;
    border-bottom: 1px solid var(--rule);
    padding-bottom: 0;
}

.layer-tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 8px 16px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text-soft);
    cursor: pointer;
    transition: all 0.15s ease;
    margin-bottom: -1px;
}

.layer-tab:hover {
    color: var(--text);
}

.layer-tab-active {
    color: var(--text);
    border-bottom-color: var(--accent);
}

/* Board (keyboard visualization) */

.board-area {
    margin-bottom: 20px;
}

.board {
    display: flex;
    align-items: center;
    gap: 28px;
    padding: 24px;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    border-radius: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.board-keys {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}

.key {
    width: 92px;
    height: 92px;
    background: var(--key-bg);
    border: 1px solid var(--key-border);
    border-radius: 6px;
    box-shadow: var(--key-shadow);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-family: inherit;
    padding: 8px;
    transition: all 0.15s ease;
}

.key:hover {
    background: var(--key-bg-hover);
    transform: translateY(-1px);
}

.key:active,
.key.key-selected {
    background: var(--key-bg-active);
    box-shadow: var(--key-shadow-active);
    transform: translateY(0);
}

.key.key-selected {
    border-color: var(--accent);
}

.key-glyph {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 14px;
    color: var(--text);
    font-weight: 500;
}

.key-label {
    font-size: 11px;
    color: var(--text-soft);
    line-height: 1.2;
    text-align: center;
}

.key-fn .key-glyph {
    color: var(--accent);
}

.key-empty .key-glyph {
    color: var(--text-faint);
    font-weight: 400;
}

.key-empty .key-label {
    color: var(--text-faint);
}

/* Encoder */

.encoder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.encoder-ring {
    width: 92px;
    height: 92px;
    border-radius: 50%;
    background: var(--key-bg);
    border: 1px solid var(--key-border);
    box-shadow: var(--key-shadow);
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-family: inherit;
    transition: all 0.15s ease;
}

.encoder-ring:hover {
    background: var(--key-bg-hover);
    transform: translateY(-1px);
}

.encoder-ring.key-selected {
    border-color: var(--accent);
    background: var(--key-bg-active);
}

.encoder-icon {
    font-size: 22px;
    color: var(--text);
}

.encoder-label {
    font-size: 10px;
    color: var(--text-soft);
}

.encoder-click {
    background: transparent;
    border: 1px dashed var(--key-border);
    border-radius: 4px;
    padding: 6px 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 11px;
    color: var(--text-soft);
    cursor: pointer;
    transition: all 0.15s ease;
}

.encoder-click:hover {
    border-color: var(--accent);
    color: var(--text);
}

.encoder-click.key-selected {
    border-color: var(--accent);
    border-style: solid;
    background: var(--key-bg-active);
    color: var(--text);
}

.board-hint {
    text-align: center;
    font-size: 13px;
    color: var(--text-soft);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    margin-top: 16px;
    margin-bottom: 0;
}

/* Editor panel — now lives INSIDE the info-pane sidebar.
 * Strips its own background / border since the parent provides them.
 * When a key is selected, configure.js hides #infoContent and shows the
 * editor in the same right-column slot — no scrolling needed. */

.editor {
    background: transparent;
    border: none;
    margin: 0;
    overflow: visible;
}

.editor-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 0 12px 0;
    border-bottom: 1px solid var(--rule);
    background: transparent;
    margin-bottom: 12px;
}

.editor-eyebrow {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    color: var(--text-soft);
    margin: 0;
}

.editor-close {
    background: transparent;
    border: none;
    font-size: 22px;
    color: var(--text-soft);
    cursor: pointer;
    padding: 0 6px;
    line-height: 1;
}

.editor-close:hover {
    color: var(--accent);
}

.editor-tabs {
    display: flex;
    border-bottom: 1px solid var(--rule);
    padding: 0;
    margin-bottom: 16px;
    overflow-x: auto;
}

.editor-tab {
    background: transparent;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 8px 12px;
    font-family: inherit;
    font-size: 12.5px;
    color: var(--text-soft);
    cursor: pointer;
    margin-bottom: -1px;
    white-space: nowrap;
    flex-shrink: 0;
}

.editor-tab:hover {
    color: var(--text);
}

.editor-tab-active {
    color: var(--text);
    border-bottom-color: var(--accent);
}

.editor-pane {
    padding: 0;
}

.pane-hint {
    font-size: 13px;
    color: var(--text-soft);
    margin-bottom: 18px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* Shortcut grid (common bindings pane) — single column in the narrow sidebar */

.shortcut-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 6px;
}

.shortcut {
    background: var(--bg);
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 8px 12px;
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 12px;
    transition: all 0.15s ease;
}

.shortcut-keys {
    flex-shrink: 0;
    min-width: 64px;
}

.shortcut:hover {
    border-color: var(--accent);
    background: var(--key-bg-hover);
}

.shortcut-keys {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12.5px;
    color: var(--text);
    font-weight: 500;
    flex-shrink: 0;
    min-width: 64px;
}

.shortcut-desc {
    font-size: 12px;
    color: var(--text-soft);
}

/* Single-key builder pane */

.key-builder {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.modifier-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.modifier-row label {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
}

.key-search input {
    width: 100%;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--rule);
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    outline: none;
}

.key-search input:focus {
    border-color: var(--accent);
}

/* Macro editor pane */

.macro-editor textarea {
    width: 100%;
    min-height: 100px;
    padding: 12px 14px;
    background: var(--bg);
    border: 1px solid var(--rule);
    border-radius: 4px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    color: var(--text);
    outline: none;
    resize: vertical;
}

.macro-editor textarea:focus {
    border-color: var(--accent);
}

/* Layer options pane */

.layer-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.layer-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
}

.layer-options select {
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--rule);
    border-radius: 4px;
    font-family: inherit;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
    max-width: 200px;
}

/* Editor footer */

.editor-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 0 0 0;
    border-top: 1px solid var(--rule);
    background: transparent;
    margin-top: 16px;
}

.editor-footer .cta {
    padding: 8px 14px;
    font-size: 13px;
}

/* Save bar (sticky-ish, appears on unsaved changes) */

.save-bar {
    background: var(--text);
    color: var(--bg);
    border-radius: 8px;
    padding: 14px 20px;
    margin-bottom: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

.save-status {
    font-size: 14px;
    margin: 0;
    color: var(--bg);
}

.save-actions {
    display: flex;
    gap: 10px;
}

.save-bar .cta-secondary {
    color: var(--bg);
    border-color: rgba(248, 246, 241, 0.3);
}

.save-bar .cta-secondary:hover {
    border-color: var(--bg);
}

.save-bar .cta-primary {
    background: var(--accent);
    border-color: var(--accent);
}

.save-bar .cta-primary:hover {
    opacity: 0.9;
}

/* Meta / disclaimer */

.configure-meta {
    padding-top: 32px;
    border-top: 1px solid var(--rule);
    margin-bottom: 60px;
}

.configure-meta p {
    font-size: 14px;
    color: var(--text-soft);
    margin-bottom: 14px;
}

.configure-meta p:last-child {
    margin-bottom: 0;
}

/* Page footer */

.configure-page-footer p {
    font-size: 13px;
    color: var(--text-soft);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    margin: 0;
}

/* Small screens — mobile main padding comes from styles.css */

@media (max-width: 540px) {
    .key {
        width: 78px;
        height: 78px;
    }

    .encoder-ring {
        width: 78px;
        height: 78px;
    }

    .board {
        padding: 24px;
        gap: 24px;
    }

    .editor-tabs {
        overflow-x: auto;
    }
}
