/* =========================================================
   TYPOGRAPHY BUILDER
   assets/css/pages/typography-builder/typography-builder.css
   =========================================================
   Styles for the Typography Builder tool.
   Phase 1 — Page Foundation
   Phase 2 — Control Panel

   Class prefix: tb-
   All values use existing CSS variables from the website
   design system. No new design tokens are introduced here.
   ========================================================= */


/* Hero, workspace, sidebar, main, preview-area and mobile-drawer chrome
   now live in the shared shell — assets/css/components/tool-shell.css. */






/* =========================================================
   CONTROLS PANEL (sidebar card)
   ========================================================= */

.tb-controls-panel {
    background: var(--surface-primary);
    border: 1px solid var(--border-primary);
    border-radius: 1rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

/* Last section inside the panel has no bottom border */
.tb-section--no-border {
    border-bottom: none !important;
}

/* ─── Panel header ─── unified in components/tool-shell.css (icon + heading). */


/* =========================================================
   DROPDOWN CARD — Sidebar context overrides
   Base component lives in components/controls.css.
   ========================================================= */

/* Compact padding, full-width inside the sidebar panel */
.tool-dropdown-card {
    padding: 0.5rem 0.875rem;
    min-width: 0;
    width: 100%;
    gap: 0.35rem;
}

/* Spacing between stacked dropdown cards */
.tool-section .tool-dropdown-card+.tool-dropdown-card {
    margin-top: var(--space-2);
}

.tb-advanced-body .tool-dropdown-card+.tool-dropdown-card {
    margin-top: var(--space-2);
}

/* =========================================================
   READING STYLE CARDS (2×2 grid)
   ========================================================= */

.tb-reading-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-2);
}

/* Card layout mirrors the reference: icon at left, title + description
   stacked at right. DOM order is icon → label → desc → check, so a
   2-row grid places them without HTML changes. */
.tb-reading-card {
    display: grid;

    row-gap: 0.15rem;
    align-items: center;
    padding: 0.375rem;
    background: var(--surface-primary);
    border: 1.5px solid var(--border-primary);
    border-radius: 0.75rem;
    cursor: pointer;
    text-align: left;
    position: relative;
    font-family: var(--font-primary);
    transition: border-color var(--transition-fast), background var(--transition-fast);
}

.tb-reading-card:hover {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
}

.tb-reading-card--active {
    border-color: var(--color-primary);
    background: var(--color-primary-soft);
}

.tb-reading-card-icon {
    grid-row: 1 / 3;
    width: 30px;
    height: 30px;
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
}

/* All card icons use the website primary color treatment */
.tb-reading-card-icon--blue,
.tb-reading-card-icon--teal,
.tb-reading-card-icon--green,
.tb-reading-card-icon--purple {
    background: var(--color-primary-soft);
    color: var(--color-primary);
}

.tb-reading-card-label {
    font-size: 0.8125rem;
    font-weight: var(--font-semi-bold);
    color: var(--text-primary);
    line-height: 1.25;
    align-self: end;
}

.tb-reading-card-desc {
    font-size: var(--text-xs);
    color: var(--text-muted);
    line-height: 1.35;
    align-self: start;
}

.tb-reading-card-check {
    position: absolute;
    top: var(--space-2);
    right: var(--space-2);
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--color-primary);
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
}

.tb-reading-card--active .tb-reading-card-check {
    display: flex;
}



/* =========================================================
   ADVANCED CONTROLS — collapsible section
   ========================================================= */

.tb-advanced-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    text-align: left;
}

.tb-advanced-label {
    font-size: 0.75rem;
    font-weight: var(--font-bold);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.tb-advanced-chevron {
    font-size: 1rem;
    color: var(--text-muted);
    line-height: 1;
    display: inline-block;
    transition: transform var(--transition-fast);
    transform: rotate(90deg);
}

.tb-advanced--open .tb-advanced-chevron {
    transform: rotate(-90deg);
}

/* Body hidden by default — shown when .tb-advanced--open on parent section */
.tb-advanced-body {
    display: none;
    flex-direction: column;
    padding-top: var(--space-3);
}

.tb-advanced--open .tb-advanced-body {
    display: flex;
}



/* Health bar styling now lives in the shared shell — tool-shell.css
   (.tool-health-*). The markup uses tool-health-* classes (tb-health-* IDs
   preserved for typography-health.js). */


/* =========================================================
   PREVIEW SYSTEM — tabs + preview area
   ========================================================= */




/* =========================================================
   PREVIEW PANELS
   ========================================================= */

.tb-preview-panel {
    display: none;
    width: 100%;
    min-width: 0;
}

.tb-preview-panel--active {
    display: block;
}

/* Shared neutral chrome palette — inherited by all four preview panels.
   Each preview file aliases these into its own --*-prefix vars so
   internal selectors remain unchanged. Change a color once here. */
.tb-preview-panel {
    --preview-bg:        #ffffff;
    --preview-surface:   #f8fafc;
    --preview-text:      #0f172a;
    --preview-muted:     #64748b;
    --preview-border:    #e2e8f0;
    --preview-accent:    #4f46e5;
    --preview-accent-ct: #ffffff;
}

/* Mobile panel centres the phone frame */
#tb-panel-mobile.tb-preview-panel--active {
    display: flex;
    justify-content: center;
}

