/* Homepage hero and report viewer. The viewer shows real Clams output:
   CLI reports in the terminal tab, agent-skill PDFs in the PDF tab. */

/* Homepage hero: centered copy and install, and the viewer full
   width beneath so wide report output (CSV, JSON) has room. Scoped to the
   homepage; /downloads/ keeps the two-column hero. */
.hero.hero--stacked {
    padding-top: clamp(64px, 7vw, 120px);
}

.hero--stacked .hero-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: clamp(4rem, 6vw, 5.5rem);
    justify-items: center;
}

.hero--stacked .hero-content {
    width: min(100%, 900px);
    max-width: none;
    align-items: center;
    text-align: center;
}

.hero--stacked .hero-title {
    font-size: clamp(3.4rem, 6vw, 6rem);
    margin-bottom: 1.5rem;
}

.hero--stacked .hero-tagline {
    margin: 0 auto 0.85rem;
    text-wrap: balance;
}

/* What the install command gives you, said right before it. */
.hero--stacked .hero-subline {
    max-width: 760px;
    margin: 0 auto 2.5rem;
    font-size: clamp(0.95rem, 1.1vw, 1.05rem);
    line-height: 1.6;
    opacity: 0.75;
    text-wrap: balance;
}

.hero--stacked .hero-commands {
    width: min(100%, 520px);
    text-align: left;
}

.hero--stacked .hero-visual {
    width: min(100%, 1120px);
    margin-inline: auto;
}



/* ===== Report viewer =====
   Controls live on the page; the window is a plain terminal (or a
   document viewer for PDFs) showing real Clams output. */

.report-viewer {
    --rv-fg: #f1eee7;
    --rv-muted: rgba(241, 238, 231, 0.74);
    --rv-screen: #161815;
    --rv-ink: var(--color-text);
    --rv-line: rgba(33, 36, 32, 0.14);
    --rv-body-height: clamp(340px, 36vw, 500px);
    /* One vertical rhythm: toggle, controls, window. */
    --rv-gap: 1.25rem;
    text-align: left;
}

/* The stage: one light panel holding the controls and the window, so the
   controls read as the demo's, not as loose pills on the hero. */
.report-viewer {
    padding: clamp(1.25rem, 2.5vw, 2rem);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-xl);
    background: var(--color-paper-strong);
    box-shadow: var(--shadow-sm);
}

.report-viewer :focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: 2px;
}

/* Mode switch: Terminal | PDF */
.rv-modes {
    display: flex;
    width: max-content;
    margin: 0 auto var(--rv-gap);
    padding: 3px;
    gap: 2px;
    border: 1px solid var(--rv-line);
    border-radius: var(--radius-pill);
    background: rgba(255, 253, 248, 0.7);
}

.rv-modes button,
.rv-chips button,
.rv-formats button {
    font-family: var(--font-mono);
    color: var(--rv-ink);
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease,
        transform 120ms var(--ease-out);
}

.rv-modes button {
    padding: 6px 18px;
    border-radius: var(--radius-pill);
    font-size: 0.8rem;
}

.rv-modes button[aria-selected="true"],
.rv-chips button[aria-selected="true"],
.rv-formats button[aria-selected="true"] {
    color: var(--color-background);
    background: var(--rv-ink);
}

.rv-modes button:active,
.rv-chips button:active,
.rv-formats button:active {
    transform: scale(0.97);
}

@media (hover: hover) and (pointer: fine) {
    .rv-chips button:not([aria-selected="true"]):hover,
    .rv-formats button:not([aria-selected="true"]):hover {
        border-color: rgba(33, 36, 32, 0.3);
    }
}

.rv-panel[hidden] {
    display: none;
}

/* Report chips then --format, centered as one group under the mode switch:
   the order the flags take in the command. */
.rv-toolbar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    margin-bottom: var(--rv-gap);
    font-size: 0.78rem;
}

.rv-chips {
    display: flex;
    flex: 0 1 auto;
    min-width: 0;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 2px;
}

.rv-chips::-webkit-scrollbar {
    display: none;
}

.rv-chips button {
    padding: 6px 13px;
    border-color: var(--rv-line);
    border-radius: var(--radius-pill);
    background: rgba(255, 253, 248, 0.6);
}

.rv-format-group {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    gap: 6px;
}

.rv-format-label {
    font-family: var(--font-mono);
    color: var(--rv-ink);
    opacity: 0.75;
}

.rv-formats {
    display: flex;
    gap: 2px;
}

.rv-formats button {
    padding: 5px 10px;
    border-radius: 6px;
}

/* The window: a plain macOS-style terminal. */
.report-viewer .glow-anchor::before {
    opacity: 0.45;
}

.rv-window {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: var(--rv-screen);
    box-shadow: 0 24px 60px rgba(12, 14, 12, 0.22), 0 4px 14px rgba(12, 14, 12, 0.12);
}

.rv-titlebar {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 34px;
    background: #22241f;
    border-bottom: 1px solid rgba(0, 0, 0, 0.4);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 0.75rem;
    color: var(--rv-muted);
}

.rv-lights {
    position: absolute;
    left: 12px;
    display: flex;
    gap: 7px;
}

.rv-lights i {
    width: 11px;
    height: 11px;
    border-radius: 50%;
    background: rgba(241, 238, 231, 0.2);
}

.rv-screen {
    position: relative;
    display: flex;
    flex-direction: column;
    height: calc(var(--rv-body-height) + 30px);
    color: var(--rv-fg);
}

.rv-prompt,
.rv-output {
    font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
    font-size: 0.74rem;
    line-height: 1.55;
}

.rv-prompt {
    display: flex;
    gap: 8px;
    padding: 12px 48px 0 14px;
}

.rv-prompt code {
    flex: 1;
    min-width: 0;
    font: inherit;
    color: var(--rv-fg);
    background: none;
    padding: 0;
    overflow-wrap: anywhere;
}

.rv-dollar {
    color: var(--rv-muted);
}

/* Copy sits quietly in the corner, like the copy button on a code block. */
.rv-copy {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: rgba(241, 238, 231, 0.08);
    color: var(--rv-muted);
    cursor: pointer;
    opacity: 0;
    transition: opacity 150ms ease, color 150ms ease, transform 120ms var(--ease-out);
}

.rv-screen:hover .rv-copy,
.rv-copy:focus-visible,
.rv-copy.is-copied {
    opacity: 1;
}

@media (hover: none) {
    .rv-copy {
        opacity: 1;
    }
}

.rv-copy:active {
    transform: scale(0.94);
}

.rv-copy svg {
    width: 14px;
    height: 14px;
}

.rv-copy.is-copied {
    color: #f2c77f;
}

.rv-output {
    flex: 1;
    min-height: 0;
    margin: 0;
    padding: 10px 14px 16px;
    overflow-y: auto;
    overflow-x: hidden;
    /* Soft-wrap at the window edge on whole words, like a terminal. Only
       unbreakable runs (paths, IDs) split mid-token. */
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    tab-size: 2;
    color: var(--rv-fg);
    background: none;
    border: 0;
    border-radius: 0;
    scrollbar-color: rgba(241, 238, 231, 0.25) transparent;
}

.rv-output code {
    display: block;
    font: inherit;
    color: inherit;
    background: none;
    padding: 0;
    transition: opacity 150ms ease;
}

.rv-output.is-swapping code,
.rv-paper.is-swapping img {
    opacity: 0;
}

.rv-output .more {
    display: block;
    margin-top: 0.75em;
    color: var(--rv-muted);
}

.rv-output .more a {
    color: inherit;
}

/* Caption under the window, inside the stage: this is a sample, not the
   full set. */
.rv-more {
    margin: var(--rv-gap) 0 0;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--rv-ink);
}

.rv-more a {
    color: var(--color-primary);
    text-decoration: underline;
    text-decoration-color: rgba(143, 7, 9, 0.35);
    text-underline-offset: 3px;
}

.rv-more a:hover {
    text-decoration-color: currentColor;
}

/* CSV: a spreadsheet window, the way an accountant opens the file. Lettered
   columns, numbered rows, both pinned; long cells clip like a real sheet. */
.rv-sheet-wrap {
    height: calc(var(--rv-body-height) + 30px);
    overflow: auto;
    background: #fff;
    scrollbar-color: rgba(33, 36, 32, 0.3) transparent;
}

.rv-sheet {
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
    font-family: Arial, Helvetica, sans-serif;
    font-size: 13px;
    line-height: 1.3;
    color: #1d1f1b;
    transition: opacity 150ms ease;
}

.rv-sheet th,
.rv-sheet td {
    height: 21px;
    padding: 0 6px;
    border-right: 1px solid #e2e3e3;
    border-bottom: 1px solid #e2e3e3;
    white-space: nowrap;
    overflow: hidden;
    text-align: left;
    font-weight: 400;
}

/* General format: numbers right, text left. Text clips hard at the cell
   edge, or spills into empty cells to its right. */
.rv-sheet td.n {
    text-align: right;
}

.rv-sheet td.s {
    overflow: visible;
    position: relative;
    z-index: 1;
}

/* Column letters and row numbers: the spreadsheet's own chrome. */
.rv-sheet thead th,
.rv-sheet tbody th {
    position: sticky;
    background: #f8f9fa;
    color: #5f6368;
    font-size: 11px;
    text-align: center;
}

.rv-sheet thead th {
    top: 0;
    z-index: 3;
    border-bottom-color: #c4c7c5;
}

.rv-sheet tbody th {
    left: 0;
    z-index: 2;
    border-right-color: #c4c7c5;
}

.rv-sheet thead th.rv-corner {
    left: 0;
    z-index: 4;
}

/* A sheet always has a selected cell: A1, with its column and row lit. */
.rv-sheet th.hl {
    background: #d3e3fd;
    color: #041e49;
}

.rv-sheet td.sel {
    box-shadow: inset 0 0 0 2px #1a73e8;
}

.rv-sheet-wrap.is-swapping .rv-sheet {
    opacity: 0;
}

/* PDF: a document viewer window, the same height as the terminal's screen. */
.rv-paper {
    height: calc(var(--rv-body-height) + 30px);
    overflow: auto;
    padding: 18px;
    background: #2a2c27;
    scrollbar-color: rgba(241, 238, 231, 0.25) transparent;
}

.rv-paper img {
    display: block;
    width: 100%;
    height: auto;
    margin: 0 0 18px;
    background: #fff;
    border-radius: 2px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    transition: opacity 150ms ease;
}

.rv-page {
    display: block;
    cursor: zoom-in;
}

.rv-page:last-child img {
    margin-bottom: 0;
}

@media (max-width: 640px) {
    /* Break at the sentence, never mid-phrase. */
    .hero--stacked .hero-subline span {
        display: block;
    }

    .report-viewer {
        --rv-body-height: 360px;
        padding: 0.75rem;
        border-radius: var(--radius-lg);
    }

    .rv-format-label {
        display: none;
    }

    /* A centered row that overflows clips its first chip; on phones the
       chips align left, scroll, and fade at the edge instead. */
    .rv-toolbar {
        justify-content: flex-start;
        gap: 12px;
    }

    .rv-chips {
        flex: 1;
        mask-image: linear-gradient(90deg, #000 calc(100% - 24px), transparent);
    }

    .rv-prompt,
    .rv-output {
        font-size: 0.72rem;
    }

    /* Thumb-sized targets on phones. */
    .rv-modes button {
        min-height: 44px;
    }

    .rv-chips button,
    .rv-formats button {
        min-height: 40px;
    }

    .rv-paper {
        padding: 10px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .rv-output code,
    .rv-sheet,
    .rv-paper img {
        transition: none;
    }
}
