:root {
    --paper-bg: #dcdcdc;
    --ink: #111111;
    --rust: #bb5a42;
    --slate: #2b3a4a;
    --lavender: #6e6b78;
    --gold: #d49e54;
    --line-color: #111111;

    --font-sans: 'Helvetica Neue', 'Helvetica', 'Arial', sans-serif;
    --font-mono: 'Courier New', Courier, monospace;

    --spacing-unit: 1rem;
    --border-width: 1px;
}

html.darkmode {
    --paper-bg: #111111;
    --ink: #dcdcdc;
    --line-color: #333333;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

body {
    background-color: var(--paper-bg);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 16px;
    line-height: 1.4;
    overflow-x: hidden;
    width: 100vw;
    position: relative;
    cursor: crosshair;
}

body::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    opacity: 0.06;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
}

.u-uppercase { text-transform: uppercase; letter-spacing: 0.02em; }
.u-bold { font-weight: 700; }
.u-mono { font-family: var(--font-mono); font-size: 0.85rem; }
.u-border-bottom { border-bottom: var(--border-width) solid var(--line-color); }
.u-border-top { border-top: var(--border-width) solid var(--line-color); }
.u-border-right { border-right: var(--border-width) solid var(--line-color); }
.u-pad { padding: var(--spacing-unit); }

.grid-container {
    display: grid;
    grid-template-columns: 280px 1fr;
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    border-right: var(--border-width) solid var(--line-color);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    background-color: var(--paper-bg);
    z-index: 100;
}

.logo-area {
    height: 120px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-bottom: var(--border-width) solid var(--line-color);
}

.logo-symbol {
    width: 40px;
    height: 40px;
    position: relative;
}

.logo-symbol span {
    display: block;
    width: 12px;
    height: 12px;
    border: 1px solid var(--ink);
    border-radius: 50%;
    position: absolute;
}

.logo-symbol span:nth-child(1) { top: 0; left: 50%; transform: translateX(-50%); }
.logo-symbol span:nth-child(2) { bottom: 0; left: 0; }
.logo-symbol span:nth-child(3) { bottom: 0; right: 0; }

@keyframes dot-orbit-top {
    0%   { transform: translate(-50%, 0px); }
    16%  { transform: translate(calc(-50% + 1px), -1.5px); }
    33%  { transform: translate(calc(-50% + 2px), -1px); }
    52%  { transform: translate(calc(-50% + 1px), 0.5px); }
    70%  { transform: translate(calc(-50% - 1px), 1px); }
    84%  { transform: translate(calc(-50% - 2px), -0.5px); }
    100% { transform: translate(-50%, 0px); }
}

@keyframes dot-orbit-left {
    0%   { transform: translate(0px, 0px); }
    14%  { transform: translate(-1px, -1px); }
    31%  { transform: translate(1px, -2px); }
    49%  { transform: translate(2px, -1px); }
    67%  { transform: translate(1px, 1px); }
    86%  { transform: translate(-1px, 1px); }
    100% { transform: translate(0px, 0px); }
}

@keyframes dot-orbit-right {
    0%   { transform: translate(0px, 0px); }
    13%  { transform: translate(1px, -1px); }
    28%  { transform: translate(2px, -0.5px); }
    46%  { transform: translate(1px, 1px); }
    63%  { transform: translate(-1px, 2px); }
    82%  { transform: translate(-2px, 0px); }
    100% { transform: translate(0px, 0px); }
}

@keyframes dot-bounce {
    0%   { margin-top: 0px; }
    22%  { margin-top: -1px; }
    45%  { margin-top: 0.5px; }
    63%  { margin-top: -1.5px; }
    81%  { margin-top: 0px; }
    100% { margin-top: -0.5px; }
}

@media (min-width: 1025px) {
    .logo-symbol span:nth-child(1) {
        animation: dot-orbit-top 7.4s ease-in-out infinite, dot-bounce 3.1s ease-in-out infinite;
        animation-delay: -1.1s, -0.7s;
    }

    .logo-symbol span:nth-child(2) {
        animation: dot-orbit-left 8.3s ease-in-out infinite, dot-bounce 2.8s ease-in-out infinite;
        animation-delay: -2.5s, -1.4s;
    }

    .logo-symbol span:nth-child(3) {
        animation: dot-orbit-right 7.9s ease-in-out infinite, dot-bounce 3.6s ease-in-out infinite;
        animation-delay: -3.3s, -2.1s;
    }
}

@media (prefers-reduced-motion: reduce) {
    .logo-symbol span {
        animation: none !important;
    }
}

@keyframes logo-flash-3 {
    0%   { opacity: 1; }
    14%  { opacity: 0; }
    28%  { opacity: 1; }
    43%  { opacity: 0; }
    57%  { opacity: 1; }
    71%  { opacity: 0; }
    85%  { opacity: 1; }
    100% { opacity: 1; }
}

.logo-area:hover .logo-symbol {
    animation: logo-flash-3 0.5s step-start forwards !important;
}

/* ── Sidebar collapse system (Push/Pull) ──────────────────────────────────── */

/* Grid and sidebar animate together */
.grid-container {
    transition: grid-template-columns 0.35s ease;
}

.sidebar {
    overflow: hidden; /* prevents content spill when column width → 0 */
    transition: transform 0.35s ease;
}

/* Collapsed state: column shrinks to 0, sidebar slides left */
body.sidebar-collapsed .grid-container {
    grid-template-columns: 0px 1fr;
}

body.sidebar-collapsed .sidebar {
    transform: translateX(-100%);
}

/* Collapse tab — absolute on sidebar's right border, vertically near System card */
.sidebar-toggle {
    display: none;
    position: absolute;
    right: 0;
    top: 55%;
    transform: translateY(-50%);
    background: var(--paper-bg);
    border-top: var(--border-width) solid var(--line-color);
    border-bottom: var(--border-width) solid var(--line-color);
    border-left: var(--border-width) solid var(--line-color);
    border-right: none;
    cursor: pointer;
    padding: 1.1rem 0.55rem;
    color: var(--ink); /* black in light mode */
    font-size: 0.85rem;
    line-height: 1;
    opacity: 0.7;
    transition: opacity 0.2s ease;
    z-index: 1;
}

html.darkmode .sidebar-toggle { color: var(--ink); }
.sidebar-toggle:hover { opacity: 1; }
/* outline starts transparent; on :focus it snaps red, blur() fades it back */
.sidebar-toggle {
    outline: 2px solid transparent;
    outline-offset: 2px;
    transition: opacity 0.2s ease, outline-color 0.5s ease;
}
.sidebar-toggle:focus { outline-color: #ff0000; }

@media (min-width: 1025px) {
    .sidebar-toggle { display: flex; }
}

/* Reopen tab — fixed to left edge, only shows when sidebar is collapsed */
.sidebar-open-tab {
    display: none;
    position: fixed;
    top: 50%;
    left: 0;
    transform: translateY(-50%) translateX(-100%);
    background: var(--paper-bg);
    border: var(--border-width) solid var(--line-color);
    border-left: none;
    padding: 1.1rem 0.55rem;
    cursor: pointer;
    color: var(--ink); /* black in light mode */
    font-size: 0.85rem;
    z-index: 200;
    transition: transform 0.35s ease, opacity 0.2s ease;
    opacity: 0;
}

html.darkmode .sidebar-open-tab { color: var(--ink); }
.sidebar-open-tab:hover { opacity: 1 !important; }
/* same flash-and-fade treatment as collapse tab */
.sidebar-open-tab {
    outline: 2px solid transparent;
    outline-offset: 2px;
    transition: transform 0.35s ease, opacity 0.2s ease, outline-color 0.5s ease;
}
.sidebar-open-tab:focus { outline-color: #ff0000; }

@media (min-width: 1025px) {
    .sidebar-open-tab { display: flex; }
    body.sidebar-collapsed .sidebar-open-tab {
        transform: translateY(-50%) translateX(0);
        opacity: 0.7;
    }
}

.meta-block {
    padding: 1.5rem;
    border-bottom: var(--border-width) solid var(--line-color);
}

.meta-label {
    font-size: 0.75rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    display: block;
}

.meta-value {
    font-size: 1.1rem;
    font-family: var(--font-sans);
    line-height: 1.2;
}

.nav-links {
    margin-top: auto;
    display: flex;
    flex-direction: column;
}

.nav-item {
    padding: 1rem 1.5rem;
    border-top: var(--border-width) solid var(--line-color);
    text-decoration: none;
    color: var(--ink);
    font-weight: 500;
    display: flex;
    justify-content: space-between;
    transition: background 0.2s;
}

.nav-item:hover {
    background-color: white;
}


.nav-item span:last-child {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    opacity: 0.6;
}

/* Resources flyout */
.nav-resources {
    position: relative;
    cursor: default;
}

/* Fix: flyout div is the last child, so span:last-child doesn't match — target directly */
.nav-resources > span {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    opacity: 0.6;
}

.resources-flyout {
    position: absolute;
    left: 100%;
    bottom: 0;
    background: var(--paper-bg);
    border: var(--border-width) solid var(--line-color);
    min-width: 160px;
    display: flex;
    flex-direction: column;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-6px);
    transition: opacity 0.2s ease, transform 0.2s ease;
    z-index: 200;
}

.nav-resources:hover .resources-flyout {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(0);
}

.flyout-link {
    padding: 0.85rem 1.5rem;
    text-decoration: none;
    color: var(--ink);
    font-weight: 500;
    font-size: 0.95rem;
    border-bottom: var(--border-width) solid var(--line-color);
    display: block;
    transition: background 0.2s;
    white-space: nowrap;
}

.flyout-link:last-child {
    border-bottom: none;
}

.flyout-link:hover {
    background: white;
}

/* Footer contact link */
.footer-contact {
    font-size: 0.8rem;
    color: var(--ink);
    text-decoration: none;
    opacity: 0.7;
    transition: opacity 0.2s;
    align-self: flex-end;
}

.footer-contact:hover {
    opacity: 1;
}

.main-content {
    display: flex;
    flex-direction: column;
}

.hero {
    min-height: 80vh;
    display: flex;
    flex-direction: column;
    border-bottom: var(--border-width) solid var(--line-color);
    overflow: hidden;
}

.hero-header {
    padding: 4rem;
    flex-grow: 1;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    position: relative;
}

.hero-text {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* ── 3D LLM Visualization ─────────────────────────────────────────────── */
.llm-viz-container {
    width: 280px;
    height: 280px;
    flex: 0 0 auto;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    align-self: center;
    margin-right: 6rem;
}

.llm-viz-link {
    display: block;
    width: 100%;
    height: 100%;
}

.llm-viz {
    width: 100%;
    height: 100%;
    border: none;
    background: transparent;
}

h1 {
    font-size: 5rem;
    font-weight: 400;
    line-height: 0.9;
    letter-spacing: -0.03em;
    max-width: 90%;
    margin-bottom: 2rem;
}

.hero-sub {
    font-family: var(--font-mono);
    font-size: 1rem;
    max-width: 600px;
    line-height: 1.6;
    border-left: 1px solid var(--ink);
    padding-left: 1.5rem;
}

/* ── Hero CTA Cards ─────────────────────────────────────────────────── */
.hero-cards {
    display: flex;
    gap: 1rem;
    margin-top: 2rem;
}

.hero-card {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ink);
    background: transparent;
    border: var(--border-width) solid var(--line-color);
    padding: 0.9rem 1.25rem;
    cursor: pointer;
    text-align: left;
    -webkit-appearance: none;
    appearance: none;
    transition: opacity 0.15s ease;
    white-space: nowrap;
}

.hero-card:hover {
    opacity: 0.5;
}

@keyframes trusted-by-scroll {
    from {
        transform: translateX(0);
    }
    to {
        transform: translateX(calc(-50% - (var(--trusted-loop-gap) / 2)));
    }
}

.trusted-by {
    padding: 0.9rem 4rem 0.9rem;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 1.2rem;
}

.trusted-by__label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.65;
    white-space: nowrap;
}

.trusted-by__marquee {
    overflow: hidden;
    min-width: 0;
    position: relative;
}

.trusted-by__track {
    --trusted-loop-gap: clamp(8rem, 18vw, 16rem);
    display: flex;
    align-items: center;
    gap: var(--trusted-loop-gap);
    width: max-content;
    white-space: nowrap;
    animation: trusted-by-scroll 24s linear infinite;
    will-change: transform;
}

.trusted-by__group {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: clamp(4.5rem, 11vw, 11rem);
    padding-left: clamp(4rem, 12vw, 10rem);
}

.trusted-by__item {
    display: inline-block;
    font-size: 0.9rem;
    letter-spacing: 0.005em;
    opacity: 0.85;
}

/* ── AI Pulse ticker ───────────────────────────────────────────────────────── */
@keyframes ai-pulse-scroll {
    from { transform: translateX(0); }
    to   { transform: translateX(calc(-50% - (var(--pulse-loop-gap) / 2))); }
}

.ai-pulse {
    padding: 0.85rem 4rem;
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 1.2rem;
    border-bottom: var(--border-width) solid var(--line-color);
}

.ai-pulse__label {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    opacity: 0.65;
    white-space: nowrap;
}

.ai-pulse__marquee {
    overflow: hidden;
    min-width: 0;
    position: relative;
}

.ai-pulse__marquee::before,
.ai-pulse__marquee::after {
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    width: 2rem;
    z-index: 1;
    pointer-events: none;
}
.ai-pulse__marquee::before { left: 0;  background: linear-gradient(to right,  var(--paper-bg), transparent); }
.ai-pulse__marquee::after  { right: 0; background: linear-gradient(to left, var(--paper-bg), transparent); }

.ai-pulse__track {
    --pulse-loop-gap: clamp(5rem, 10vw, 10rem);
    display: flex;
    align-items: center;
    gap: var(--pulse-loop-gap);
    width: max-content;
    white-space: nowrap;
    animation: ai-pulse-scroll 200s linear infinite;
    will-change: transform;
}

.ai-pulse__group {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
    gap: clamp(3rem, 7vw, 7rem);
    padding-left: clamp(2rem, 6vw, 5rem);
}

.ai-pulse__item {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    line-height: 1;
    font-weight: 400;
    letter-spacing: 0.02em;
    opacity: 0.65;
    color: var(--ink);
    text-decoration: none;
    transition: opacity 0.15s ease, color 0.15s ease;
}

.ai-pulse__item:hover { opacity: 1; color: #ff0000; }


.work-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-bottom: var(--border-width) solid var(--line-color);
}

.case-study {
    border-right: var(--border-width) solid var(--line-color);
    min-height: 80vh;
    position: relative;
    display: flex;
    flex-direction: column;
    transition: all 0.3s ease;
    background-color: var(--paper-bg);
    cursor: pointer;
    overflow: hidden;
}

.case-study:last-child { border-right: none; }


.cs-header {
    padding: 1.5rem;
    border-bottom: var(--border-width) solid var(--line-color);
    background: var(--paper-bg);
    z-index: 2;
    position: relative;
}

.cs-meta {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    margin-bottom: 1rem;
    display: flex;
    justify-content: space-between;
}

.cs-title {
    font-size: 2rem;
    line-height: 1;
    font-weight: 400;
    margin-bottom: 0.5rem;
}

.cs-role {
    font-size: 0.9rem;
    opacity: 0.7;
}

.cs-image {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    z-index: 0;
    filter: grayscale(100%) contrast(110%);
    transition: filter 0.4s ease;
}

.cs-tiffany .cs-image {
    background-image: url('https://images.unsplash.com/photo-1618005182384-a83a8bd57fbe?q=80&w=2564&auto=format&fit=crop');
    box-shadow: inset 0 0 0 2000px rgba(43, 58, 74, 0.7);
}

.cs-apple .cs-image {
    background-image: url('/assets/cs02-bg.jpg');
    background-position: center center;
    box-shadow: inset 0 0 0 2000px rgba(20, 30, 40, 0.55);
}

.cs-wc .cs-image {
    background-image: url('/assets/cs03-bg.jpg');
    background-position: center center;
    box-shadow: inset 0 0 0 2000px rgba(120, 100, 90, 0.45);
}

.case-study:hover .cs-image {
    filter: grayscale(0%) contrast(100%);
}

.cs-spine-text {
    position: absolute;
    bottom: 2rem;
    left: 1.5rem;
    writing-mode: vertical-rl;
    transform: rotate(180deg);
    color: rgba(255,255,255,0.9);
    font-family: var(--font-sans);
    font-size: 3rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.4s ease;
    mix-blend-mode: overlay;
}

.case-study:hover .cs-spine-text {
    opacity: 1;
    transform: rotate(180deg) translateY(-10px);
}

.split-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-bottom: var(--border-width) solid var(--line-color);
}

.text-block {
    padding: 4rem;
    border-right: var(--border-width) solid var(--line-color);
}

.text-block p {
    font-size: 1.5rem;
    line-height: 1.5;
    margin-bottom: 2rem;
}

.small-header {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    text-transform: uppercase;
    margin-bottom: 1.5rem;
    display: block;
    padding-bottom: 2px;
    position: relative;
}

.hero-text .small-header::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: -100vw;
    height: 1px;
    background: var(--ink);
}

.list-group {
    list-style: none;
    margin-top: 2rem;
}

.list-group li {
    padding: 1rem 0;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
}

.list-group li:last-child { border-bottom: none; }

.goods-section {
    background-color: var(--ink);
    color: var(--paper-bg);
    padding: 4rem;
}

.goods-section .small-header { border-color: var(--paper-bg); }

.goods-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    margin-top: 2rem;
}

.goods-card h3 {
    font-size: 2rem;
    margin-bottom: 1rem;
    font-weight: 400;
}

.goods-card p {
    opacity: 0.7;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    line-height: 1.6;
}

footer {
    display: flex;
    flex-direction: column;
    min-height: 300px;
    overflow-x: visible;
    overflow-y: hidden;
}

.footer-bottom {
    padding: 2rem 0 2rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex: 1;
}

/* FOOTER FLIP ANIMATION */

.footer-flip {
    display: block;
    color: var(--ink);
    text-decoration: none;
    overflow-x: visible;
    overflow-y: hidden;
    position: relative;
    height: clamp(5rem, 14vw, 16rem);
    align-self: center;
    flex: 1;
    margin: 0 0 0 1.25rem;
    min-width: 0;
}

.footer-flip__front,
.footer-flip__back {
    display: block;
    font-size: clamp(4rem, 12vw, 14rem);
    font-weight: 700;
    line-height: 1;
    font-family: var(--font-sans);
    letter-spacing: -0.04em;
    white-space: nowrap;
    transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.12s ease;
}

.footer-flip__front {
    display: flex;
    align-items: center;
    gap: clamp(0.35rem, 0.8vw, 1rem);
    transform: translateY(0);
    opacity: 1;
}

.footer-flip__label {
    display: block;
}

.footer-flip__arrow {
    width: 0.9em;
    height: 0.56em;
    flex: 0 0 auto;
    transform: translateY(0.03em);
}

.footer-flip__arrow path {
    fill: none;
    stroke: currentColor;
    stroke-width: 16;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.footer-flip__back {
    position: absolute;
    top: 0;
    left: 0;
    transform: translateY(100%);
    opacity: 0;
}

.footer-flip:hover .footer-flip__front,
.footer-flip.is-flipped .footer-flip__front {
    transform: translateY(-100%);
    opacity: 0;
}

.footer-flip:hover .footer-flip__back,
.footer-flip.is-flipped .footer-flip__back {
    transform: translateY(0);
    opacity: 1;
}

/* ── Two-flip wrapper: cycles between Try now → and Book now → ───────── */
.footer-flips {
    position: relative;
    flex: 1;
    min-width: 0;
    margin: 0 0 0 1.25rem;
    height: clamp(5rem, 14vw, 16rem);
    align-self: center;
    overflow: hidden;
}

/* Each flip is stacked, slides in/out via JS .is-active class */
.footer-flips .footer-flip {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
    transition: transform 0.18s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.12s ease;
}

.footer-flips .footer-flip.is-active {
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* Reset <button> styles so .footer-flip--book matches <a> appearance */
.footer-flip--book {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    -webkit-appearance: none;
    appearance: none;
}


.archive-tag {
    background: var(--ink);
    color: var(--paper-bg);
    padding: 2px 6px;
    font-size: 0.6rem;
    border-radius: 2px;
    margin-left: 10px;
    vertical-align: middle;
}

@keyframes live-pulse {
    0%   { box-shadow: 0 0 0px 0px rgba(0, 200, 80, 0); }
    40%  { box-shadow: 0 0 8px 3px rgba(0, 200, 80, 0.7); }
    60%  { box-shadow: 0 0 8px 3px rgba(0, 200, 80, 0.7); }
    100% { box-shadow: 0 0 0px 0px rgba(0, 200, 80, 0); }
}

.goods-section .archive-tag {
    background: var(--paper-bg);
    color: var(--ink);
    animation: live-pulse 2.4s ease-in-out infinite;
}

/* HERO LOGO */

@keyframes logo-load-in {
    0%   { opacity: 0; }
    100% { opacity: 1; }
}

@keyframes flash {
    50% { opacity: 0; }
}

.hero-logo {
    margin-bottom: 1.5rem;
    max-width: 32%;
}

.hero-logo svg {
    width: 100%;
    height: auto;
}

.hero-logo svg path {
    fill: var(--ink);
    opacity: 0;
}

.hero-logo svg path:nth-child(1) { animation: logo-load-in .5s 300ms step-start forwards; }
.hero-logo svg path:nth-child(2) { animation: logo-load-in .5s 350ms step-start forwards; }
.hero-logo svg path:nth-child(3) { animation: logo-load-in .5s 400ms step-start forwards; }
.hero-logo svg path:nth-child(4) { animation: logo-load-in .5s 450ms step-start forwards; }

@media (max-width: 1024px) {
    .hero-logo { max-width: 60%; }
}

/* CONTENT FADE-IN (matches v1 load-in) */

.main-content h1,
.main-content h2,
.main-content h3,
.main-content p,
.main-content .small-header,
.main-content .hero-sub,
.main-content .hero-cards,
.main-content .trusted-by,
.main-content .cs-header,
.main-content .cs-role,
.main-content .goods-card,
.main-content footer,
.sidebar .logo-symbol,
.sidebar .meta-label,
.sidebar .meta-value,
.sidebar .nav-item,
.sidebar .theme-toggle,
.sidebar .music-player {
    opacity: 0;
    animation: logo-load-in 2.5s 0.5s ease-in forwards;
}

/* Tablet landscape / iPad in-between range:
   keep footer CTA fully visible before mobile layout kicks in. */
@media (min-width: 1025px) and (max-width: 1400px) {
    .footer-bottom {
        padding-right: 0;
    }
    .footer-flip {
        margin: 0;
        height: clamp(5.5rem, 13vw, 11.5rem);
        min-width: 0;
    }
    .footer-flip__front,
    .footer-flip__back {
        font-size: clamp(4.1rem, 12.8vw, 11rem);
        letter-spacing: -0.035em;
    }
    .footer-flip__front {
        gap: clamp(0.6rem, 1.25vw, 1.6rem);
    }
    .footer-flips {
        margin: 0;
        height: clamp(5.5rem, 13vw, 11.5rem);
    }
    .footer-flips .footer-flip {
        height: 100%;
        margin: 0;
    }
}

@media (max-width: 1024px) {
    .grid-container { grid-template-columns: 1fr; }
    .sidebar {
        position: relative;
        height: auto;
        border-right: none;
        border-bottom: var(--border-width) solid var(--line-color);
        flex-direction: row;
        flex-wrap: wrap;
        z-index: 2147483646; /* keep top mobile header/menu above widget overlays */
    }
    /* Sidebar: logo full-width top row, nav full-width bottom row */
    .logo-area {
        border-right: none;
        border-bottom: var(--border-width) solid var(--line-color);
        width: 100%;
        height: 80px;
        min-width: unset;
        justify-content: flex-end;
        padding-left: 1.5rem;
        padding-right: 1rem;
        position: relative;
        z-index: 2147483646;
    }
    .mobile-menu-btn {
        display: flex !important;
    }
    .meta-block { display: none; }
    .logo-symbol { display: none; }
    .nav-links {
        flex-direction: row;
        width: 100%;
        border-top: none;
    }
    .nav-item {
        flex: 1;
        border-top: none;
        border-right: var(--border-width) solid var(--line-color);
        text-align: center;
        justify-content: center;
    }
    .nav-item:last-child { border-right: none; }

    .hero-header { padding: 2rem; flex-direction: column; }
    .llm-viz-container { display: none; }
    h1 { font-size: 3rem; }
    .trusted-by {
        grid-template-columns: 1fr;
        gap: 0.4rem;
        padding: 0.75rem 2rem 0.8rem;
    }
    .ai-pulse {
        grid-template-columns: 1fr;
        padding: 0.7rem 1.5rem;
        gap: 0.4rem;
    }
    .ai-pulse__track {
        animation-duration: 300s;
    }
    .ai-pulse__item {
        font-size: 0.72rem !important;
        line-height: 1 !important;
        font-weight: 400 !important;
        letter-spacing: 0.01em;
    }
    .trusted-by__label {
        font-size: 0.62rem;
        opacity: 0.55;
    }
    .trusted-by__track {
        --trusted-loop-gap: clamp(4rem, 14vw, 8rem);
        animation-duration: 18s;
    }
    .trusted-by__group {
        gap: clamp(2.8rem, 9vw, 4.8rem);
        padding-left: clamp(1.2rem, 5vw, 3rem);
    }
    .trusted-by__item {
        font-size: 0.78rem;
    }

    .work-grid { grid-template-columns: 1fr; }
    .case-study { border-right: none; border-bottom: var(--border-width) solid var(--line-color); min-height: 50vh; }
    .cs-image { filter: none; }
    .split-section { grid-template-columns: 1fr; }
    .text-block { border-right: none; border-bottom: var(--border-width) solid var(--line-color); padding: 2rem; }
    .goods-grid { grid-template-columns: 1fr; gap: 2rem; }
    .goods-section { padding: 2rem; }

    /* Footer — trusted-by carousel at top, then grid: CTA full-width, copyright/logo below */
    footer {
        display: flex;
        flex-direction: column;
        min-height: auto;
        padding: 0;
    }
    .footer-bottom {
        display: grid;
        grid-template-areas:
            "cta cta"
            "copy logo";
        grid-template-columns: 1fr auto;
        gap: 2rem 1rem;
        padding: 2rem;
        align-items: end;
        flex: 1;
    }
    .footer-flip {
        grid-area: cta;
        margin: 0;
        width: 100%;
        height: clamp(3rem, 16vw, 10rem);
        align-self: start;
    }
    .footer-flip__front,
    .footer-flip__back {
        font-size: clamp(2.5rem, 16vw, 14rem);
    }
    .footer-flips {
        grid-area: cta;
        margin: 0;
        width: 100%;
        height: clamp(3rem, 16vw, 10rem);
        align-self: start;
    }
    .footer-flips .footer-flip {
        grid-area: unset;
        height: 100%;
        width: 100%;
        margin: 0;
    }
    footer .u-mono      { grid-area: copy; align-self: end; }
    .footer-contact     { grid-area: logo; align-self: end; display: block; text-align: right; }

    /* Resources flyout: drop downward on mobile */
    .nav-resources { z-index: 200; }
    .resources-flyout {
        left: 0;
        bottom: auto;
        top: 100%;
        border-left: var(--border-width) solid var(--line-color);
        border-top: none;
        min-width: 100%;
    }

    /* ── Hide desktop nav on mobile, show hamburger ── */
    .nav-links { display: none; }
    .mobile-menu-btn { display: flex; }
}

@media (max-width: 380px) {
    .trusted-by {
        padding-left: 1rem;
        padding-right: 1rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .trusted-by__track {
        animation: none;
        transform: none;
    }
    .trusted-by__marquee {
        overflow-x: auto;
        scrollbar-width: none;
    }
    .trusted-by__marquee::-webkit-scrollbar {
        display: none;
    }
}

/* ── Mobile hamburger button ─────────────────────────────────────────── */
.mobile-menu-btn {
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    gap: 5px;
    width: 48px;
    height: 48px;
    background: none;
    border: none;
    cursor: pointer;
    margin-left: auto;
    margin-right: 0.5rem;
    position: relative;
    z-index: 2147483646; /* keep menu control above any stale widget layers */
    padding: 0;
    flex-shrink: 0;
}

/* The three lines */
.mobile-menu-btn span {
    display: block;
    height: 1.5px;
    background: var(--ink);
    transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1),
                width 0.28s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.2s ease;
    transform-origin: left center;
}

.mobile-menu-btn span:nth-child(1) { width: 22px; }
.mobile-menu-btn span:nth-child(2) { width: 16px; }
.mobile-menu-btn span:nth-child(3) { width: 22px; }

/* When open: lines turn white and morph into ← back arrow */
/* Top line becomes the top arm of the arrow pointing left */
.mobile-menu-btn.is-open span:nth-child(1) {
    width: 14px;
    transform: translateY(1px) rotate(-40deg);
    background: #dcdcdc;
}
/* Middle line becomes the arrow shaft — full width */
.mobile-menu-btn.is-open span:nth-child(2) {
    width: 22px;
    transform: translateX(0);
    background: #dcdcdc;
}
/* Bottom line becomes the bottom arm of the arrow */
.mobile-menu-btn.is-open span:nth-child(3) {
    width: 14px;
    transform: translateY(-1px) rotate(40deg);
    background: #dcdcdc;
}

/* ── No overlay needed — menu is fullscreen ──────────────────────────── */
.mobile-menu-overlay { display: none !important; }

/* ── Mobile menu — fullscreen Pentagram-style takeover ──────────────── */
.mobile-menu {
    position: fixed;
    inset: 0;
    z-index: 2147483645; /* directly below button, above widget layers */
    background: #111111;
    background-image:
        url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.055'/%3E%3C/svg%3E"),
        linear-gradient(160deg, #141414 0%, #0e0e0e 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 0 2rem 2rem;

    /* Hidden state */
    opacity: 0;
    pointer-events: none;
    transform: translateY(-12px);
    transition: opacity 0.32s cubic-bezier(0.16, 1, 0.3, 1),
                transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.mobile-menu.is-open {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* Stagger nav items on open */
.mobile-menu.is-open .mobile-menu-item {
    animation: menu-item-in 0.4s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.mobile-menu.is-open .mobile-menu-item:nth-child(1) { animation-delay: 0.04s; }
.mobile-menu.is-open .mobile-menu-item:nth-child(2) { animation-delay: 0.08s; }
.mobile-menu.is-open .mobile-menu-item:nth-child(3) { animation-delay: 0.12s; }
.mobile-menu.is-open .mobile-menu-item:nth-child(4) { animation-delay: 0.16s; }
.mobile-menu.is-open .mobile-menu-item:nth-child(5) { animation-delay: 0.20s; }
.mobile-menu.is-open .mobile-menu-item:nth-child(6) { animation-delay: 0.24s; }
.mobile-menu.is-open .mobile-menu-item:nth-child(7) { animation-delay: 0.28s; }
.mobile-menu.is-open .mobile-menu-item:nth-child(8) { animation-delay: 0.32s; }

@keyframes menu-item-in {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

.mobile-menu-inner {
    width: 100%;
}

/* One column, large type — Pentagram style */
.mobile-menu-grid {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.mobile-menu-item {
    display: block;
    padding: 0.85rem 0;
    font-family: var(--font-mono);
    font-size: clamp(1.6rem, 8vw, 2.4rem);
    font-weight: 700;
    letter-spacing: -0.01em;
    text-transform: uppercase;
    color: rgba(220,220,220,0.75);
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,0.07);
    transition: color 0.15s, letter-spacing 0.2s;
    opacity: 0; /* reset for animation */
}

.mobile-menu-item:first-child { border-top: 1px solid rgba(255,255,255,0.07); }

.mobile-menu-item:hover {
    color: #ffffff;
    letter-spacing: 0.02em;
}

.mobile-menu-footer {
    margin-top: 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* ─── DARK MODE OVERRIDES ─────────────────────────────────────────────────── */

/* Hero logo: bright red in dark mode (matches v1 production) */
html.darkmode .hero-logo svg path {
    fill: #ff0000;
}

/* Capabilities block */
.text-block--capabilities {
    background-color: #e4e4e4;
}

html.darkmode .text-block--capabilities {
    background-color: #1c1c1c;
}

/* List-group dividers (hardcoded rgba(0,0,0,0.1)) */
html.darkmode .list-group li {
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

/* LLMx Studio section — inverted in dark mode (light bg, dark text) */
html.darkmode .goods-section {
    background-color: #dcdcdc;
    color: #111111;
}

html.darkmode .goods-section .small-header {
    color: #111111;
}

html.darkmode .goods-section .archive-tag {
    background: #111111;
    color: #dcdcdc;
    animation: live-pulse 2.4s ease-in-out infinite;
}

html.darkmode .goods-card p {
    color: #111111;
}

/* Dark mode toggle — pill switch in sidebar */
.theme-toggle {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-top: 1rem;
    cursor: pointer;
    user-select: none;
    width: fit-content;
}

.theme-toggle__label {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink);
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.theme-toggle__track {
    position: relative;
    width: 28px;
    height: 14px;
    background: none;
    border: 1px solid var(--line-color);
    border-radius: 0;
    transition: border-color 0.25s ease;
    flex-shrink: 0;
}

.theme-toggle__thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 8px;
    height: 8px;
    background: var(--ink);
    border-radius: 0;
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1), background 0.25s ease;
}

html.darkmode .theme-toggle__thumb {
    transform: translateX(14px);
}

html.darkmode .theme-toggle__label {
    opacity: 1;
}

/* ── Music Player ─────────────────────────────────────────────────────────── */
.music-player {
    margin-top: 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* "Now Playing" toggle — styled like the theme-toggle label */
.music-now-playing {
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink);
    opacity: 0.6;
    padding: 0;
    transition: color 0.15s ease, opacity 0.2s ease;
}

.music-now-playing:hover { color: #ff0000; opacity: 1; }

.music-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

/* `display:flex` above overrides the native [hidden] attr — restore it */
.music-controls[hidden] { display: none; }

.music-btn {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--ink);
    font-size: 0.7rem;
    font-family: var(--font-mono);
    padding: 0.2rem;
    opacity: 0.5;
    transition: opacity 0.15s ease;
    line-height: 1;
}

.music-btn:hover { opacity: 1; }

.music-btn--play {
    font-size: 0.85rem;
    opacity: 0.8;
}

/* ── Ask LLMx ───────────────────────────────────────────────────────────── */
/* ─────────────────────────────────────────────────────────────────────────
   GPT MODAL — Dark Liquid Glass
   ───────────────────────────────────────────────────────────────────────── */

/* ── Ask LLMx trigger button ─────────────────────────────────────── */
.ask-llmx-trigger {
    margin-top: 1rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--line-color);
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: none;
    border-left: none;
    border-right: none;
    border-bottom: none;
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 0.66rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    cursor: pointer;
    opacity: 0.75;
    transition: opacity 0.15s ease, color 0.15s ease;
    width: 100%;
    text-align: left;
    padding-left: 0;
    padding-right: 0;
    padding-bottom: 0;
}

.ask-llmx-trigger:hover {
    opacity: 1;
    color: #ff0000;
}

.ask-llmx-trigger__dot {
    font-size: 0.5rem;
    color: #ff0000;
    opacity: 1;
}

/* ── Backdrop ────────────────────────────────────────────────────────── */
.ask-llmx-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px) saturate(140%);
    -webkit-backdrop-filter: blur(6px) saturate(140%);
    z-index: 1000;
}

.ask-llmx-backdrop[hidden] {
    display: none;
}

/* ── Modal Shell — Dark Glass ────────────────────────────────────────── */
.ask-llmx-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(580px, 92vw);
    max-height: 82vh;

    /* Dark frosted glass */
    background: rgba(15, 15, 15, 0.78);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);

    /* Glass rim + inset top-edge catch-light */
    border: 1px solid rgba(255, 255, 255, 0.10);
    border-radius: 10px;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.15),
        inset 0 -1px 0 rgba(255, 255, 255, 0.04),
        0 24px 64px rgba(0, 0, 0, 0.75),
        0 4px 16px rgba(0, 0, 0, 0.45);

    display: flex;
    flex-direction: column;
    gap: 0;
    z-index: 1001;
    padding: 1.6rem;
    will-change: transform;
}

.ask-llmx-modal[hidden] {
    display: none;
}

/* Light mode glass override */
:root:not(.darkmode) .ask-llmx-modal {
    background: rgba(240, 240, 240, 0.85);
    border: 1px solid rgba(0, 0, 0, 0.10);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.80),
        inset 0 -1px 0 rgba(0, 0, 0, 0.05),
        0 24px 64px rgba(0, 0, 0, 0.22),
        0 4px 16px rgba(0, 0, 0, 0.12);
}

/* ── Header ──────────────────────────────────────────────────────────── */
.ask-llmx__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1.2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    padding-bottom: 0.8rem;
}

.ask-llmx__title-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ask-llmx__title {
    font-family: var(--font-mono);
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: var(--ink);
}

.ask-llmx__status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #22c55e;
    flex-shrink: 0;
    transition: background 0.3s ease;
}

.ask-llmx__status-dot.thinking {
    background: #f97316;
    animation: mic-pulse 0.9s ease-in-out infinite;
}

.ask-llmx__close {
    background: none;
    border: none;
    color: var(--ink);
    font-size: 1.0rem;
    cursor: pointer;
    opacity: 0.55;
    padding: 0;
    line-height: 1;
    transition: opacity 0.15s ease, color 0.15s ease;
    flex-shrink: 0;
}

.ask-llmx__close:hover {
    opacity: 1;
    color: #ff0000;
}

/* ── Divider ─────────────────────────────────────────────────────────── */
.ask-llmx__divider {
    border: none;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin: 0 0 1rem 0;
}

:root:not(.darkmode) .ask-llmx__divider {
    border-top-color: rgba(0, 0, 0, 0.12);
}

/* ── Message list ────────────────────────────────────────────────────── */
.ask-llmx__messages {
    flex: 1 1 auto;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.22) transparent;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    min-height: 60px;
    max-height: 360px;
    margin-bottom: 0.9rem;
    padding-right: 2px;
}

.ask-llmx__messages::-webkit-scrollbar { width: 4px; }
.ask-llmx__messages::-webkit-scrollbar-track { background: transparent; }
.ask-llmx__messages::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.22);
    border-radius: 2px;
}

:root:not(.darkmode) .ask-llmx__messages {
    scrollbar-color: rgba(0, 0, 0, 0.22) transparent;
}
:root:not(.darkmode) .ask-llmx__messages::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.22);
}

/* ── Message bubbles ─────────────────────────────────────────────────── */
.ask-llmx__message {
    padding: 0.55rem 0.7rem;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    border-radius: 6px;
}

/* User bubble: subtle glass inset */
.ask-llmx__message--user {
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.10);
}

:root:not(.darkmode) .ask-llmx__message--user {
    background: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.10);
}

/* Bot bubble: no bg — reads directly on glass */
.ask-llmx__message--assistant {
    background: transparent;
    border: none;
}

/* Message text: sans for readability; mono stays on UI chrome */
.ask-llmx__message-text {
    font-family: var(--font-sans);
    font-size: 0.84rem;
    line-height: 1.6;
    white-space: pre-wrap;
    margin: 0;
    color: var(--ink);
}

/* ── Source links ────────────────────────────────────────────────────── */
.ask-llmx__sources {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-top: 0.25rem;
}

.ask-llmx__source {
    text-decoration: none;
    color: var(--ink);
    border-bottom: 1px solid rgba(255, 255, 255, 0.25);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    opacity: 0.75;
    transition: opacity 0.15s ease, color 0.15s ease;
}

:root:not(.darkmode) .ask-llmx__source {
    border-bottom-color: rgba(0, 0, 0, 0.25);
}

.ask-llmx__source:hover {
    opacity: 1;
    color: #ff0000;
    border-bottom-color: #ff0000;
}

/* CTA links (Calendly + mailto) — visually distinct from regular source links */
.ask-llmx__source[href*="calendly"],
.ask-llmx__source[href^="mailto"] {
    opacity: 1;
    color: var(--ink);
    border-bottom-color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
    letter-spacing: 0.03em;
}

.ask-llmx__source[href*="calendly"]:hover,
.ask-llmx__source[href^="mailto"]:hover {
    color: #ff0000;
    border-bottom-color: #ff0000;
}

/* ── Thinking indicator ──────────────────────────────────────────────── */
.ask-llmx__thinking {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    opacity: 0.55;
    margin-bottom: 0.5rem;
    color: var(--ink);
    letter-spacing: 0.03em;
}

/* ── Collapse / expand body ──────────────────────────────────────────── */
.ask-llmx__body {
    overflow: hidden;
    max-height: 480px;
    opacity: 1;
    transition: max-height 0.3s ease, opacity 0.25s ease;
}

.ask-llmx-modal--collapsed .ask-llmx__body {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
}

/* Collapsed = no chrome — just chips + input floating bare on the page */
/* Double-class + !important beats light-mode overrides and base modal styles */
.ask-llmx-modal.ask-llmx-modal--collapsed {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    padding: 0 !important;
}

.ask-llmx-modal--collapsed .ask-llmx__header {
    display: none;
}

.ask-llmx-modal--collapsed .ask-llmx__form {
    border-top: none;
    padding-top: 0;
}

.ask-llmx-modal--collapsed .ask-llmx__chips {
    margin-bottom: 0.6rem;
}

/* ── Seed chips ──────────────────────────────────────────────────────── */
.ask-llmx__chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 0.8rem;
}

.ask-llmx__chip {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.13);
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    line-height: 1.2;
    padding: 0.32rem 0.55rem;
    cursor: pointer;
    border-radius: 4px;
    opacity: 0.90;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

:root:not(.darkmode) .ask-llmx__chip {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.14);
}

.ask-llmx__chip:hover {
    color: #ff0000;
    border-color: rgba(255, 0, 0, 0.5);
    background: rgba(255, 0, 0, 0.05);
    opacity: 1;
}

/* ── Input form ──────────────────────────────────────────────────────── */
.ask-llmx__form {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 0.4rem;
    align-items: stretch;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding-top: 0.9rem;
    margin-bottom: 0;
}

:root:not(.darkmode) .ask-llmx__form {
    border-top-color: rgba(0, 0, 0, 0.12);
}

.ask-llmx__input {
    resize: none;
    border: 1px solid rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.05);
    color: var(--ink);
    font-family: var(--font-mono);
    font-size: 0.84rem;
    line-height: 1.5;
    padding: 0.5rem 0.65rem;
    min-height: 42px;
    border-radius: 4px;
    transition: border-color 0.15s ease, background 0.15s ease;
}

:root:not(.darkmode) .ask-llmx__input {
    border-color: rgba(0, 0, 0, 0.14);
    background: rgba(0, 0, 0, 0.04);
}

.ask-llmx__input::placeholder {
    opacity: 0.45;
    color: var(--ink);
}

.ask-llmx__input:focus {
    outline: 1.5px solid #ff0000;
    outline-offset: 2px;
    background: rgba(255, 255, 255, 0.07);
    border-color: rgba(255, 0, 0, 0.35);
}

/* ── Send button — hidden until textarea has content ─────────────────── */
.ask-llmx__send {
    display: none;
    border: none;
    background: #ff0000;
    color: #fff;
    padding: 0.45rem 0.75rem;
    cursor: pointer;
    border-radius: 6px;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease, transform 0.1s ease;
}

.ask-llmx__send.visible {
    display: flex;
}

.ask-llmx__send:hover {
    background: #cc0000;
}

.ask-llmx__send:active {
    transform: scale(0.93);
}

/* ── Focus rings ─────────────────────────────────────────────────────── */
.ask-llmx__send:focus,
.ask-llmx__mic:focus,
.ask-llmx__chip:focus,
.ask-llmx__close:focus,
.ask-llmx__input:focus {
    outline: 1.5px solid #ff0000;
    outline-offset: 2px;
}

:root:not(.darkmode) .ask-llmx__header {
    border-bottom-color: rgba(0, 0, 0, 0.10);
}

/* ── Mic button ──────────────────────────────────────────────────────── */
.ask-llmx__mic {
    border: 1px solid rgba(255, 255, 255, 0.13);
    background: rgba(255, 255, 255, 0.05);
    color: var(--ink);
    padding: 0.45rem 0.7rem;
    cursor: pointer;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

:root:not(.darkmode) .ask-llmx__mic {
    border-color: rgba(0, 0, 0, 0.14);
    background: rgba(0, 0, 0, 0.04);
}

.ask-llmx__mic:hover {
    color: #ff0000;
    border-color: rgba(255, 0, 0, 0.5);
    background: rgba(255, 0, 0, 0.06);
}

.ask-llmx__mic.hidden {
    display: none;
}

.ask-llmx__mic.listening {
    color: #ff0000;
    border-color: rgba(255, 0, 0, 0.6);
    background: rgba(255, 0, 0, 0.08);
    animation: mic-pulse 1s ease-in-out infinite;
}

@keyframes mic-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.5; }
}

/* ── Screen-reader utility ───────────────────────────────────────────── */
.ask-llmx__sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ── Reduced motion ──────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .ask-llmx-modal,
    .ask-llmx-backdrop,
    .ask-llmx__chip,
    .ask-llmx__send,
    .ask-llmx__input,
    .ask-llmx__close,
    .ask-llmx__source,
    .ask-llmx-trigger {
        transition: none;
        animation: none;
    }
}
