/* ==========================================================================
   Home hub — tool dashboard (index only)
   ========================================================================== */

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.hub-page .page-wrapper {
    width: min(1320px, calc(100% - 48px));
}

/* Header */
.hub-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    min-height: 72px;
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--rule);
}

.hub-header-left,
.hub-header-right {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    flex-wrap: wrap;
}

.hub-brand {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    color: var(--ink);
    text-decoration: none;
}

.hub-brand:hover {
    color: var(--ink);
}

.hub-brand img {
    width: 32px;
    height: 32px;
    display: block;
    object-fit: contain;
}

.hub-brand-name {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.hub-brand-tag {
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    padding-left: var(--space-3);
    border-left: 1px solid var(--rule);
}

.hub-nav-link {
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px 0;
    min-height: 40px;
    transition: color var(--motion-hover) var(--ease-cut);
}

.hub-nav-link:hover,
.hub-nav-link:focus-visible {
    color: var(--signal);
    outline: none;
}

.hub-theme-toggle {
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--signal-ink);
    background: var(--signal);
    border: 1px solid var(--signal);
    border-radius: var(--r-sm);
    padding: 8px 12px;
    min-height: 40px;
    cursor: pointer;
    transition: background var(--motion-hover) var(--ease-cut);
}

.hub-theme-toggle:hover {
    background: var(--signal-hover);
    border-color: var(--signal-hover);
}

.hub-theme-toggle:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

/* Hero */
.hub-hero {
    display: grid;
    grid-template-columns: 1fr minmax(240px, 340px);
    gap: var(--space-8);
    align-items: center;
    padding: var(--space-10) 0 var(--space-8);
}

.hub-hero-label {
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: var(--space-4);
}

.hub-hero-title {
    font-size: clamp(54px, 6vw, 86px);
    font-weight: 620;
    line-height: 0.95;
    letter-spacing: -0.055em;
    margin: 0 0 var(--space-5);
    max-width: 11ch;
}

.hub-hero-title .signal {
    color: var(--signal);
}

.hub-hero-copy {
    max-width: 28rem;
    color: var(--ink-2);
    font-size: 15px;
    line-height: 1.65;
    margin: 0;
}

.hub-hero-panel {
    position: relative;
    padding: var(--space-6);
    border: 1px solid var(--rule);
    border-radius: var(--r-sm);
    background: var(--surface);
    min-height: 200px;
}

.hub-hero-panel::before {
    content: '';
    position: absolute;
    top: 12px;
    left: 12px;
    width: 14px;
    height: 14px;
    border-top: 2px solid var(--signal);
    border-left: 2px solid var(--signal);
    pointer-events: none;
}

.hub-hero-panel::after {
    content: '';
    position: absolute;
    bottom: 12px;
    right: 12px;
    width: 14px;
    height: 14px;
    border-bottom: 2px solid var(--signal);
    border-right: 2px solid var(--signal);
    pointer-events: none;
}

.hub-panel-lines {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.hub-panel-line {
    font-size: clamp(18px, 2.2vw, 24px);
    font-weight: 600;
    letter-spacing: -0.03em;
    line-height: 1.15;
    color: var(--ink);
}

.hub-panel-divider {
    height: 1px;
    background: var(--rule);
    margin: var(--space-2) 0;
}

.hub-panel-meta {
    font-family: var(--font-mono);
    font-size: 9px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    line-height: 1.6;
}

/* Tool grid — 3 equal columns; row2 has 2 cards same width as row1 */
.hub-tools {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-3);
    align-items: stretch;
}

.hub-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
    padding: 24px;
    border: 1px solid var(--rule);
    border-radius: var(--r-sm);
    background: var(--surface);
    color: var(--ink);
    text-decoration: none;
    transition:
        border-color var(--motion-hover) var(--ease-cut),
        background var(--motion-hover) var(--ease-cut),
        transform var(--motion-hover) var(--ease-cut);
}

.hub-card--link {
    cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
    .hub-card--link:hover,
    .hub-card--primary:focus-within {
        border-color: color-mix(in srgb, var(--signal) 45%, var(--rule));
        background: color-mix(in srgb, var(--signal) 4%, var(--surface));
        transform: translateY(-2px);
    }

    .hub-card--link:hover .hub-cta-arrow,
    .hub-card--link:hover .hub-cta-outline .hub-cta-arrow {
        transform: translateX(4px);
    }

    .hub-card--external:hover .hub-cta-external {
        transform: translate(3px, -3px);
    }
}

.hub-card--primary {
    border-color: color-mix(in srgb, var(--signal) 25%, var(--rule));
    background: color-mix(in srgb, var(--signal) 3%, var(--surface));
}

.hub-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
    margin-bottom: 10px;
}

.hub-card-index {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    letter-spacing: 0.12em;
    color: var(--muted);
}

.hub-card-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    color: var(--signal);
}

.hub-card-icon svg {
    display: block;
    width: 100%;
    height: 100%;
}

.hub-card-label {
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 8px;
}

.hub-card-title {
    font-size: clamp(28px, 2.2vw, 32px);
    font-weight: 600;
    line-height: 1.02;
    letter-spacing: -0.035em;
    margin: 0 0 8px;
}

.hub-card-desc {
    font-size: 14px;
    line-height: 1.5;
    color: var(--ink-2);
    margin: 0 0 14px;
}

.hub-card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 0;
}

/* Views form */
.hub-views-form {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}

.hub-views-input {
    width: 100%;
    height: 48px;
    min-height: 48px;
    padding: 0 12px;
    margin: 0;
    border: 1px solid var(--rule-strong);
    border-radius: var(--r-sm);
    background: var(--canvas);
    color: var(--ink);
    font-size: 13px;
    outline: none;
    transition: border-color var(--motion-hover) var(--ease-cut);
}

.hub-views-input::placeholder {
    color: var(--muted);
}

.hub-views-input:focus {
    border-color: var(--signal);
    outline: 2px solid var(--focus);
    outline-offset: 1px;
}

.hub-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    width: 100%;
    height: 48px;
    min-height: 48px;
    padding: 0 14px;
    border-radius: var(--r-sm);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    border: none;
    flex-shrink: 0;
    transition:
        background var(--motion-hover) var(--ease-cut),
        border-color var(--motion-hover) var(--ease-cut),
        transform var(--motion-press) var(--ease-cut);
}

.hub-card-body > .hub-cta,
.hub-card-body > .hub-cta-outline {
    margin-top: 0;
}

.hub-cta:active {
    transform: translateY(1px);
}

.hub-cta-primary {
    background: var(--signal);
    color: var(--signal-ink);
    border: 1px solid var(--signal);
}

.hub-cta-primary:hover {
    background: var(--signal-hover);
    border-color: var(--signal-hover);
    color: var(--signal-ink);
}

.hub-cta-outline {
    background: transparent;
    color: var(--ink);
    border: 1px solid color-mix(in srgb, var(--signal) 50%, var(--rule));
}

.hub-cta-outline:hover {
    border-color: var(--signal);
    color: var(--ink);
    background: color-mix(in srgb, var(--signal) 6%, transparent);
}

.hub-cta-arrow,
.hub-cta-external {
    color: var(--signal);
    transition: transform var(--motion-hover) var(--ease-cut);
}

.hub-card-external-host {
    font-family: var(--font-mono);
    font-size: 8px;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    margin: 0 0 8px;
}

.hub-cta:focus-visible {
    outline: 2px solid var(--focus);
    outline-offset: 2px;
}

.hub-features {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    list-style: none;
    margin: auto 0 0;
    padding-top: 12px;
    font-size: 12px;
    line-height: 1.4;
    color: var(--muted);
}

.hub-features li {
    padding: 0;
    flex: 0 1 auto;
}

.hub-features li::before {
    content: '✓ ';
    color: var(--signal);
    font-weight: 700;
}

/* Previews */
.hub-preview {
    margin-bottom: 16px;
    padding: 10px 12px;
    border: 1px solid var(--rule);
    border-radius: var(--r-xs);
    background: var(--canvas);
}

.hub-preview-counter {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-3);
    height: 72px;
    padding: 0 12px;
    box-sizing: border-box;
}

.hub-preview-btn {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--rule-strong);
    border-radius: var(--r-xs);
    color: var(--muted);
    font-size: 14px;
    line-height: 1;
    pointer-events: none;
    user-select: none;
}

.hub-preview-value {
    font-family: var(--font-mono);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--ink);
    min-width: 4.5ch;
    text-align: center;
}

.hub-preview-poll {
    max-height: 125px;
    padding: 8px 10px;
    overflow: hidden;
}

.hub-preview-poll-title {
    font-size: 10px;
    font-weight: 600;
    color: var(--ink-2);
    margin-bottom: 8px;
}

.hub-preview-poll-row {
    margin-bottom: 6px;
}

.hub-preview-poll-row:last-child {
    margin-bottom: 0;
}

.hub-preview-poll-label {
    display: flex;
    justify-content: space-between;
    font-size: 10px;
    color: var(--ink-2);
    margin-bottom: 4px;
}

.hub-preview-poll-bar {
    height: 7px;
    border-radius: var(--r-xs);
    background: var(--rule);
    overflow: hidden;
}

.hub-preview-poll-fill {
    height: 100%;
    border-radius: var(--r-xs);
    background: var(--signal);
}

.hub-preview-poll-fill--alt {
    background: color-mix(in srgb, var(--signal) 55%, var(--olive));
}

.hub-preview-fonts {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    height: 80px;
    max-height: 80px;
    padding: 8px 12px;
    box-sizing: border-box;
}

.hub-preview-aa {
    font-size: 24px;
    font-weight: 600;
    line-height: 1;
    color: var(--signal);
    letter-spacing: -0.04em;
}

.hub-preview-font-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 11px;
    color: var(--muted);
    line-height: 1.4;
}

.hub-preview-font-list span:first-child {
    color: var(--ink-2);
    font-weight: 500;
}

/* Thumbnail tester preview */
.hub-preview-thumb {
    padding: 8px;
    max-height: 140px;
    overflow: hidden;
}

.hub-thumb-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    max-height: 88px;
    background: #181818;
    border: 1px solid color-mix(in srgb, var(--rule) 80%, transparent);
    border-radius: var(--r-xs);
    overflow: hidden;
}

.hub-thumb-ab {
    position: absolute;
    top: 6px;
    left: 6px;
    z-index: 2;
    padding: 2px 5px;
    font-family: var(--font-mono);
    font-size: 8px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--signal-ink);
    background: var(--signal);
    border-radius: 2px;
    line-height: 1.2;
}

.hub-thumb-shape {
    position: absolute;
    border-radius: 2px;
    opacity: 0.55;
}

.hub-thumb-shape--1 {
    top: 28%;
    left: 18%;
    width: 38%;
    height: 22%;
    background: color-mix(in srgb, var(--signal) 35%, #2a2a2a);
}

.hub-thumb-shape--2 {
    bottom: 22%;
    right: 14%;
    width: 28%;
    height: 18%;
    background: #2e2e2e;
    border: 1px solid color-mix(in srgb, var(--signal) 25%, transparent);
}

.hub-thumb-duration {
    position: absolute;
    right: 6px;
    bottom: 6px;
    z-index: 2;
    padding: 2px 5px;
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.04em;
    color: #f1f0e8;
    background: rgba(0, 0, 0, 0.78);
    border-radius: 2px;
    line-height: 1.2;
}

.hub-thumb-meta {
    display: flex;
    align-items: flex-start;
    gap: var(--space-2);
    margin-top: 6px;
}

.hub-thumb-dot {
    flex-shrink: 0;
    width: 6px;
    height: 6px;
    margin-top: 4px;
    border-radius: 50%;
    background: var(--signal);
}

.hub-thumb-bars {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.hub-thumb-bars span {
    display: block;
    height: 4px;
    border-radius: 2px;
    background: var(--rule);
}

.hub-thumb-bars span:first-child {
    width: 88%;
}

.hub-thumb-bars span:last-child {
    width: 62%;
}

/* Second row — compact cards 04 & 05 only */
.hub-card--04 .hub-preview-fonts {
    height: 70px;
    max-height: 70px;
    padding: 12px;
    margin-bottom: 12px;
}

.hub-card--04 .hub-preview-aa {
    font-size: 28px;
}

.hub-card--04 .hub-preview-font-list {
    font-size: 10px;
    line-height: 1.35;
    gap: 1px;
}

.hub-card--04 .hub-features {
    font-size: 11px;
    gap: 4px 14px;
    padding-top: 10px;
    flex-wrap: nowrap;
}

.hub-card--05 .hub-preview-thumb {
    padding: 6px;
    max-height: 112px;
    margin-bottom: 10px;
    overflow: hidden;
}

.hub-card--05 .hub-thumb-frame {
    max-height: 100px;
}

.hub-card--05 .hub-thumb-ab {
    top: 4px;
    left: 4px;
    padding: 1px 4px;
    font-size: 7px;
}

.hub-card--05 .hub-thumb-duration {
    right: 4px;
    bottom: 4px;
    font-size: 8px;
    padding: 1px 4px;
}

.hub-card--05 .hub-thumb-meta {
    margin-top: 4px;
    gap: 4px;
}

.hub-card--05 .hub-thumb-dot {
    width: 5px;
    height: 5px;
    margin-top: 2px;
}

.hub-card--05 .hub-thumb-bars {
    gap: 2px;
}

.hub-card--05 .hub-thumb-bars span {
    height: 3px;
}

.hub-card--05 .hub-thumb-bars span:last-child {
    display: none;
}

.hub-card--05 .hub-card-external-host {
    font-size: 8px;
    margin: 0 0 8px;
    letter-spacing: 0.16em;
}

.hub-card--05 .hub-cta {
    height: 44px;
    min-height: 44px;
}

.hub-card--05 .hub-features {
    font-size: 11px;
    gap: 4px 14px;
    padding-top: 10px;
    flex-wrap: nowrap;
}

@media (max-width: 1100px) {
    .hub-card--04 .hub-features,
    .hub-card--05 .hub-features {
        flex-wrap: wrap;
    }
}

/* Status strip */
.hub-status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-top: var(--space-6);
    padding: var(--space-4) var(--space-5);
    border: 1px solid var(--rule);
    border-radius: var(--r-sm);
    background: var(--surface);
}

.hub-status-left {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    font-size: 13px;
    color: var(--ink-2);
}

.hub-status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px color-mix(in srgb, #4ade80 20%, transparent);
}

.hub-status-help {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-mono);
    font-size: 9px;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--muted);
    background: none;
    border: none;
    cursor: pointer;
    min-height: 40px;
    padding: 0;
    transition: color var(--motion-hover) var(--ease-cut);
}

.hub-status-help:hover,
.hub-status-help:focus-visible {
    color: var(--signal);
    outline: none;
}

.hub-status-help .hub-cta-arrow {
    display: inline-block;
}

/* Footer */
.hub-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    margin-top: var(--space-10);
    padding: var(--space-6) 0 var(--space-8);
    border-top: 1px solid var(--rule);
}

.hub-footer-left {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.hub-footer-left img {
    width: 24px;
    height: 24px;
}

.hub-footer-text {
    font-size: 13px;
    color: var(--muted);
}

.hub-footer-name {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-2);
}

/* Help modal */
.hub-modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
    background: color-mix(in srgb, var(--canvas) 40%, transparent);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.hub-modal-backdrop[hidden] {
    display: none !important;
}

.hub-modal {
    width: min(480px, 100%);
    max-height: min(80vh, 560px);
    overflow: auto;
    padding: var(--space-6);
    border: 1px solid var(--rule-strong);
    border-radius: var(--r-sm);
    background: var(--surface);
    box-shadow: none;
}

.hub-modal h2 {
    font-size: 22px;
    font-weight: 600;
    letter-spacing: -0.03em;
    margin: 0 0 var(--space-4);
}

.hub-modal-list {
    list-style: none;
    margin: 0 0 var(--space-5);
    padding: 0;
}

.hub-modal-list li {
    padding: var(--space-3) 0;
    border-bottom: 1px solid var(--rule);
    font-size: 14px;
    line-height: 1.55;
    color: var(--ink-2);
}

.hub-modal-list li:last-child {
    border-bottom: none;
}

.hub-modal-list strong {
    display: block;
    color: var(--ink);
    font-size: 13px;
    margin-bottom: 2px;
}

.hub-modal-close {
    width: 100%;
}

.hub-form-error {
    color: var(--danger);
    font-size: 12px;
    margin: 0;
}

/* Spacer removed from markup — hide if any legacy instance remains */
.hub-card-spacer {
    display: none;
}

/* Responsive */
@media (max-width: 1100px) {
    .hub-tools {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 900px) {
    .hub-hero {
        grid-template-columns: 1fr;
        padding: var(--space-8) 0 var(--space-6);
    }

    .hub-hero-panel {
        display: none;
    }
}

@media (max-width: 650px) {
    .hub-page .page-wrapper {
        width: calc(100% - 32px);
    }

    .hub-tools {
        grid-template-columns: 1fr;
    }

    .hub-card {
        padding: 20px;
    }

    .hub-card--05 {
        grid-column: auto;
    }

    .hub-card-title {
        font-size: 28px;
    }

    .hub-header {
        min-height: 64px;
    }

    .hub-brand-tag {
        display: none;
    }

    .hub-hero-title {
        font-size: clamp(40px, 11vw, 54px);
    }

    .hub-status {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (prefers-reduced-motion: reduce) {
    .hub-card,
    .hub-cta,
    .hub-cta-arrow,
    .hub-nav-link,
    .hub-status-help {
        transition: none !important;
    }

    .hub-card--link:hover {
        transform: none;
    }
}
