/* ===================================================================
   AI Design Hub — Shared Layout CSS
   Standalone pages outside the design system iframe.
   Max content width: 1024px. No right sidebar.
   =================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Lato:wght@300;400;500;600;700&display=swap');

/* ===== Reset & Base ===== */
body.ai-hub {
    margin: 0;
    font-family: Lato, sans-serif;
    background: #FAF8F6;
    color: #0a0a0a;
    -webkit-font-smoothing: antialiased;
}

/* ===== Theme Variables ===== */
body.ai-hub {
    --hub-accent: #C0429F;
    --hub-accent-rgb: 192, 66, 159;
    --hub-accent-light: rgba(192, 66, 159, 0.06);
    --hub-gradient-1: #C0429F;
    --hub-gradient-2: #FA7E3F;
    --hub-gradient-3: #FFEEE3;
    --hub-gradient-4: #C55D27;
}
/* ===== Sticky Horizontal Nav ===== */
.ai-hub__nav {
    position: sticky;
    top: 0;
    z-index: 100;
    background: white;
    border-bottom: 1px solid rgba(40, 30, 20, 0.08);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.ai-hub__nav-inner {
    max-width: 1024px;
    margin: 0 auto;
    padding: 10px 32px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.ai-hub__logo {
    font-size: 15px;
    font-weight: 600;
    color: #435773;
    text-decoration: none;
    white-space: nowrap;
    padding-right: 16px;
    border-right: 1px solid rgba(40, 30, 20, 0.08);
}
.ai-hub__logo:hover { color: #1a78c1; }

.ai-hub__nav-links {
    display: flex;
    gap: 4px;
}
.ai-hub__nav-links a {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    padding: 6px 14px;
    border-radius: 6px;
    font-size: 15px;
    font-weight: 500;
    color: #4a4a4a;
    text-decoration: none;
    transition: all 150ms ease;
    white-space: nowrap;
}
.ai-hub__nav-links a:hover {
    background: rgba(0, 0, 0, 0.04);
    color: #0a0a0a;
}
.ai-hub__nav-links a.active {
    background: var(--hub-accent-light);
    color: var(--hub-accent);
    font-weight: 600;
}

.ai-hub__theme-toggle {
    margin-left: auto;
    display: flex;
    gap: 4px;
}
.ai-hub__theme-btn {
    padding: 5px 12px;
    border: 1px solid rgba(40, 30, 20, 0.12);
    border-radius: 6px;
    background: white;
    font-size: 14px;
    font-weight: 600;
    font-family: Lato, sans-serif;
    cursor: pointer;
    color: #4a4a4a;
    transition: all 150ms ease;
}
.ai-hub__theme-btn:hover { border-color: var(--hub-accent); color: var(--hub-accent); }
.ai-hub__theme-btn--active {
    background: var(--hub-accent);
    color: white;
    border-color: var(--hub-accent);
}

/* ===== Main Content ===== */
.ai-hub__content {
    max-width: 1024px;
    margin: 0 auto;
    padding: 24px 32px 64px;
}

/* ===== Jump Links Bar (sticky anchor nav, scroll-spy driven) ===== */
.ai-hub__jump-links {
    position: sticky;
    top: 46px;
    z-index: 30;
    background: transparent;
    margin-bottom: 24px;
    border-bottom: 1px solid rgba(40, 30, 20, 0.08);
    /* The edge-to-edge bar is always there, just transparent, so it fades in and out
       instead of snapping (animating from "none" flashed the whole page white) */
    box-shadow: 0 0 0 100vmax rgba(255, 255, 255, 0), 0 1px 0 100vmax rgba(40, 30, 20, 0);
    clip-path: inset(0 -100vmax -1px -100vmax);
    transition: background-color 240ms ease, box-shadow 240ms ease, border-color 240ms ease;
    font-size: 15px;
    font-family: Lato, sans-serif;
    display: flex;
    gap: 24px;
    align-items: center;
    flex-wrap: wrap;
}
.ai-hub__jump-links a {
    color: #5f5f5f;
    text-decoration: none;
    padding: 10px 0;
    margin-bottom: -1px;
    border-bottom: 2px solid transparent;
    transition: color 150ms ease, border-color 150ms ease;
}
/* Once stuck, the white bar runs edge to edge like a second row of the main nav */
.ai-hub__jump-links.is-stuck {
    background: #fff;
    border-bottom-color: transparent;
    box-shadow: 0 0 0 100vmax #fff, 0 1px 0 100vmax rgba(40, 30, 20, 0.08);
}
@media (prefers-reduced-motion: reduce) {
    .ai-hub__jump-links { transition: none; }
}
.ai-hub__jump-links a:hover {
    color: var(--hub-accent);
}
.ai-hub__jump-links a.active {
    color: var(--hub-accent);
    font-weight: 600;
    border-bottom-color: var(--hub-accent);
}

/* ===== Soft wash behind the top of every page ===== */
.ai-hub { position: relative; }
.ai-hub-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 460px;
    z-index: -1;
    pointer-events: none;
    overflow: hidden;
    background: linear-gradient(180deg, #FFEEE3 0%, rgba(251, 236, 214, 0.35) 40%, rgba(255, 255, 255, 0) 82%);
}
/* Slow drifting color: Ruby Berry and Cool Magenta glows wander across the wash */
.ai-hub-backdrop::before,
.ai-hub-backdrop::after {
    content: "";
    position: absolute;
    top: -120px;
    width: 900px;
    height: 460px;
    border-radius: 50%;
    filter: blur(40px);
    -webkit-mask-image: linear-gradient(180deg, #000 30%, transparent 85%);
    mask-image: linear-gradient(180deg, #000 30%, transparent 85%);
}
.ai-hub-backdrop::before {
    left: -10%;
    background: radial-gradient(closest-side, rgba(192, 66, 159, 0.18), transparent);
    animation: hub-drift-a 22s ease-in-out infinite alternate;
}
.ai-hub-backdrop::after {
    right: -10%;
    background: radial-gradient(closest-side, rgba(150, 61, 189, 0.14), transparent);
    animation: hub-drift-b 28s ease-in-out infinite alternate;
}
@keyframes hub-drift-a {
    from { transform: translateX(0) scale(1); }
    to { transform: translateX(45vw) scale(1.15); }
}
@keyframes hub-drift-b {
    from { transform: translateX(0) scale(1.1); }
    to { transform: translateX(-45vw) scale(0.95); }
}
@media (prefers-reduced-motion: reduce) {
    .ai-hub-backdrop::before, .ai-hub-backdrop::after { animation: none; }
}

/* ===== Page Header ===== */
.ai-hub__header {
    margin-bottom: 24px;
    padding: 0 0 16px;
}
.ai-hub__title {
    font-size: 28px;
    font-weight: 700;
    color: #0a0a0a;
    margin: 0 0 8px;
}
.ai-hub__subtitle {
    font-size: 18px;
    color: #4B5563;
    line-height: 1.625;
    margin: 0;
    max-width: 48rem;
}

/* ===== Section ===== */
.ai-hub__section {
    margin-bottom: 64px;
    scroll-margin-top: 100px;
    background: white;
    border-radius: 12px;
    padding: 28px 32px;
    border: 1px solid rgba(40, 30, 20, 0.06);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.ai-hub__section:last-of-type { margin-bottom: 0; }
.ai-hub__section-title {
    font-size: 22px;
    font-weight: 700;
    color: #0a0a0a;
    margin: 0 0 8px;
}
.ai-hub__section-desc {
    font-size: 16px;
    color: #5f5f5f;
    line-height: 1.6;
    margin: 0 0 20px;
}

/* ===== Hub Landing Cards ===== */
.ai-hub__cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin: 32px 0;
}
@property --hub-angle {
    syntax: '<angle>';
    initial-value: 0deg;
    inherits: false;
}
@keyframes hub-spin {
    from { --hub-angle: 0deg; }
    to { --hub-angle: 360deg; }
}
.ai-hub__card {
    border-radius: 12px;
    border: 2px solid transparent;
    background: linear-gradient(#fff, #fff) padding-box;
    padding: 28px 24px;
    text-decoration: none;
    color: inherit;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    transition: box-shadow 200ms ease, transform 200ms ease;
    display: block;
}
/* Hover: the prompt box's Ruby gradient spins around the stroke */
.ai-hub__card:hover,
.ai-hub__card:focus-visible {
    background:
        linear-gradient(#fff, #fff) padding-box,
        conic-gradient(from var(--hub-angle), #C0429F, #E082C0, #FBECD6, #E082C0, #C0429F) border-box;
    animation: hub-spin 6s linear infinite;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}
@media (prefers-reduced-motion: reduce) {
    .ai-hub__card:hover, .ai-hub__card:focus-visible { animation: none; transform: none; }
}
.ai-hub__card-icon {
    margin-bottom: 16px;
    display: block;
}
.ai-hub__card-icon svg,
.ai-hub__card-icon img {
    width: 32px;
    height: 32px;
    display: block;
}
.ai-hub__card-title {
    font-size: 18px;
    font-weight: 700;
    color: #0a0a0a;
    margin: 0 0 8px;
}
.ai-hub__card-desc {
    font-size: 16px;
    color: #5f5f5f;
    line-height: 1.5;
    margin: 0 0 12px;
}
.ai-hub__card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.ai-hub__card-tag {
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    background: var(--hub-accent-light);
    color: var(--hub-accent);
}

/* ===== Properties Table (reused from design system) ===== */
/* One table style for every page (also used by .properties-table on Components) */
.ai-hub__table,
.ai-hub__content .properties-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 15px;
    margin: 16px 0;
    font-family: Lato, sans-serif;
}
.ai-hub__table th,
.ai-hub__content .properties-table th {
    text-align: left;
    padding: 10px 14px;
    background: rgba(214, 211, 209, 0.35);
    font-weight: 600;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: #57534E;
    border-bottom: 1px solid rgba(40, 30, 20, 0.1);
}
.ai-hub__table td,
.ai-hub__content .properties-table td {
    padding: 10px 14px;
    border-bottom: 1px solid rgba(40, 30, 20, 0.06);
    font-size: 15px;
    color: #292524;
    vertical-align: top;
}
.ai-hub__table tr:last-child td,
.ai-hub__content .properties-table tr:last-child td { border-bottom: none; }
.ai-hub__table code,
.ai-hub__content .properties-table code {
    font-family: 'SF Mono', Consolas, Monaco, monospace;
    font-size: 13px;
    color: #6E265C;
    background: rgba(192, 66, 159, 0.07);
    padding: 2px 6px;
    border-radius: 4px;
}

/* ===== Token Swatches ===== */
.ai-hub__swatches {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin: 16px 0;
}
.ai-hub__swatch {
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(40, 30, 20, 0.06);
    width: 140px;
    background: white;
}
.ai-hub__swatch-color {
    height: 56px;
}
.ai-hub__swatch-info {
    padding: 8px 10px;
}
.ai-hub__swatch-name {
    font-size: 14px;
    font-weight: 600;
    color: #0a0a0a;
    display: block;
}
.ai-hub__swatch-value {
    font-size: 12px;
    color: #5f5f5f;
    font-family: Consolas, Monaco, monospace;
}

/* ===== Copy Button ===== */
.ai-hub__copy-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border: 1px solid var(--hub-accent);
    border-radius: 6px;
    background: white;
    color: var(--hub-accent);
    font-size: 15px;
    font-weight: 600;
    font-family: Lato, sans-serif;
    cursor: pointer;
    transition: all 150ms ease;
}
.ai-hub__copy-btn:hover {
    background: var(--hub-accent);
    color: white;
}
.ai-hub__copy-btn--copied {
    background: #418A44;
    border-color: #418A44;
    color: white;
}

/* ===== Code Block ===== */
.ai-hub__code {
    background: #1e1e2e;
    color: #cdd6f4;
    border-radius: 8px;
    padding: 16px 20px;
    font-size: 14px;
    line-height: 1.6;
    font-family: Consolas, Monaco, monospace;
    overflow-x: auto;
    margin: 12px 0;
    position: relative;
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
    .ai-hub__nav-inner { padding: 0 16px; gap: 8px; }
    .ai-hub__nav-links { overflow-x: auto; }
    .ai-hub__content { padding: 16px; }
    .ai-hub__cards { grid-template-columns: 1fr; }
    .ai-hub__theme-toggle { display: none; }
}
