/* ========================================
   HEALTHCARE DOCUMENT INTELLIGENCE (OCR)
   Page styles — extends css/style.css
   ======================================== */

:root {
    --ocr-blue: #4a9eff;
    --ocr-teal: #00d4aa;
    --ocr-warn: #ffb84a;
    --ocr-blue-soft: rgba(74, 158, 255, 0.12);
    --ocr-teal-soft: rgba(0, 212, 170, 0.12);
    --ocr-warn-soft: rgba(255, 184, 74, 0.12);
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}


/* ========================================
   SHARED PAGE ATOMS
   ======================================== */

.ocr-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-xs);
    border: 1px solid rgba(255, 99, 71, 0.5);
    background: rgba(255, 99, 71, 0.06);
    color: var(--color-primary);
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 0.4rem 0.9rem;
    border-radius: 2px;
    margin-bottom: var(--space-md);
}

.ocr-badge::before {
    content: '';
    width: 6px;
    height: 6px;
    background: var(--color-primary);
    border-radius: 50%;
    animation: ocrBlink 1.6s step-end infinite;
}

@keyframes ocrBlink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.15; }
}

.ocr-note {
    display: flex;
    gap: var(--space-sm);
    align-items: flex-start;
    margin-top: var(--space-md);
    padding: var(--space-sm) 1.25rem;
    border-left: 2px solid var(--ocr-teal);
    background: var(--ocr-teal-soft);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: var(--color-text-muted);
    font-size: 0.95rem;
    max-width: 720px;
}

.ocr-note strong {
    color: var(--color-text);
    font-weight: 600;
}

.ocr-eyebrow--blue {
    color: var(--ocr-blue);
}

.ocr-eyebrow--blue::before {
    background: var(--ocr-blue);
}

.ocr-eyebrow--teal {
    color: var(--ocr-teal);
}

.ocr-eyebrow--teal::before {
    background: var(--ocr-teal);
}


/* ========================================
   HERO
   ======================================== */

.ocr-hero {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    padding-top: var(--header-height);
    overflow: hidden;
}

.ocr-hero::before {
    content: '';
    position: absolute;
    top: -20%;
    right: -10%;
    width: 60vw;
    height: 60vw;
    max-width: 900px;
    max-height: 900px;
    background: radial-gradient(circle, rgba(74, 158, 255, 0.10) 0%, transparent 65%);
    pointer-events: none;
}

.ocr-hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(to right, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
        linear-gradient(to bottom, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
    background-size: 56px 56px;
    mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 0%, transparent 75%);
    -webkit-mask-image: radial-gradient(ellipse 90% 70% at 50% 30%, #000 0%, transparent 75%);
    pointer-events: none;
}

.ocr-hero__inner {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-lg) var(--space-md);
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    gap: var(--space-lg);
    align-items: center;
    width: 100%;
}

.ocr-hero__content {
    max-width: 640px;
    animation: heroFadeUp 0.9s cubic-bezier(0.16, 1, 0.3, 1) 0.1s both;
}

.ocr-hero__title {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 3.9vw, 3.4rem);
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -0.025em;
    margin-bottom: var(--space-sm);
}

.ocr-hero__title span {
    background: linear-gradient(135deg, var(--color-primary) 0%, #ff9b7a 60%, var(--ocr-warn) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.ocr-hero__lead {
    font-size: 1.05rem;
    color: var(--color-text-muted);
    margin-bottom: 0.9rem;
    max-width: 560px;
}

.ocr-hero__lead strong {
    color: var(--color-text);
    font-weight: 600;
}

.ocr-hero__formats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: var(--space-md);
}

.ocr-chip {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.02);
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    transition: var(--transition-fast);
}

.ocr-chip:hover {
    color: var(--color-text);
    border-color: rgba(74, 158, 255, 0.5);
    background: var(--ocr-blue-soft);
}

.ocr-hero__cta {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
}

.ocr-hero__visual {
    position: relative;
    animation: heroImageAppear 1.1s cubic-bezier(0.16, 1, 0.3, 1) 0.35s both;
}


/* ========================================
   HERO SCANNER ANIMATION
   ======================================== */

.scanner {
    position: relative;
    max-width: 520px;
    margin-left: auto;
}

.scanner__stack {
    position: relative;
}

.scanner__ghost {
    position: absolute;
    inset: 0;
    background: var(--color-bg-card);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
}

.scanner__ghost--1 {
    transform: translate(10px, 10px) rotate(1.4deg);
    opacity: 0.55;
}

.scanner__ghost--2 {
    transform: translate(20px, 20px) rotate(2.8deg);
    opacity: 0.28;
}

.scanner__page {
    position: relative;
    background: linear-gradient(180deg, #f6f5f2 0%, #efeee9 100%);
    border-radius: var(--radius-sm);
    padding: 1.4rem 1.5rem 1.6rem;
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.55);
    overflow: hidden;
    color: #2a2a33;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    line-height: 1.5;
}

.scanner__page::after {
    /* scan texture */
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.035) 0 1px, transparent 1px 3px);
    pointer-events: none;
    mix-blend-mode: multiply;
}

.scanner__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding-bottom: 0.6rem;
    margin-bottom: 0.9rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}

.scanner__facility {
    font-weight: 500;
    font-size: 0.78rem;
    letter-spacing: -0.01em;
}

.scanner__doctype {
    font-size: 0.6rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #6b6b78;
}

.dfield {
    position: relative;
    display: block;
    padding: 0.18rem 0.3rem;
    margin: 0 -0.3rem;
}

.dfield__k {
    color: #6b6b78;
    display: inline-block;
    min-width: 88px;
}

.dfield__v {
    color: #1c1c24;
}

/* the extraction bounding box */
.dfield::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 1.5px solid var(--ocr-blue);
    background: rgba(74, 158, 255, 0.13);
    border-radius: 3px;
    opacity: 0;
    transform: scale(0.985);
    animation: oboxIn 9s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

/* the field label chip */
.dfield::before {
    content: attr(data-label);
    position: absolute;
    top: -0.62rem;
    right: 0.15rem;
    z-index: 2;
    font-size: 0.5rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fff;
    background: var(--ocr-blue);
    padding: 0.1rem 0.35rem;
    border-radius: 2px;
    opacity: 0;
    transform: translateY(3px);
    animation: labelIn 9s cubic-bezier(0.16, 1, 0.3, 1) infinite;
    white-space: nowrap;
}

.dfield--warn::after {
    border-color: var(--ocr-warn);
    border-style: dashed;
    background: rgba(255, 184, 74, 0.16);
}

.dfield--warn::before {
    background: #b06a00;
}

.dfield--1::after, .dfield--1::before { animation-delay: 0.55s; }
.dfield--2::after, .dfield--2::before { animation-delay: 0.95s; }
.dfield--3::after, .dfield--3::before { animation-delay: 1.3s; }
.dfield--4::after, .dfield--4::before { animation-delay: 1.65s; }
.dfield--5::after, .dfield--5::before { animation-delay: 2.5s; }
.dfield--6::after, .dfield--6::before { animation-delay: 3.35s; }

@keyframes oboxIn {
    0%, 6% { opacity: 0; transform: scale(0.985); }
    11%, 82% { opacity: 1; transform: scale(1); }
    90%, 100% { opacity: 0; transform: scale(1); }
}

@keyframes labelIn {
    0%, 7% { opacity: 0; transform: translateY(3px); }
    13%, 82% { opacity: 1; transform: translateY(0); }
    90%, 100% { opacity: 0; transform: translateY(0); }
}

.scanner__prose {
    margin: 0.9rem 0;
}

.scanner__bar {
    display: block;
    height: 6px;
    border-radius: 2px;
    background: rgba(0, 0, 0, 0.12);
    margin-bottom: 0.42rem;
}

.scanner__hand {
    display: block;
    font-family: 'Segoe Script', 'Bradley Hand', 'Comic Sans MS', cursive;
    font-size: 0.82rem;
    color: #26418f;
    transform: rotate(-0.7deg);
    letter-spacing: 0.01em;
}

.scanner__sigrow {
    margin-top: 1.1rem;
    padding-top: 0.7rem;
    border-top: 1px dashed rgba(0, 0, 0, 0.16);
}

.scanner__beam {
    position: absolute;
    left: 0;
    right: 0;
    height: 130px;
    top: -140px;
    z-index: 3;
    pointer-events: none;
    background: linear-gradient(180deg, transparent 0%, rgba(74, 158, 255, 0.10) 55%, rgba(74, 158, 255, 0.42) 96%, rgba(255, 255, 255, 0.9) 100%);
    box-shadow: 0 0 24px rgba(74, 158, 255, 0.55);
    animation: beamSweep 9s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

@keyframes beamSweep {
    0% { top: -140px; opacity: 0; }
    3% { opacity: 1; }
    40% { top: 100%; opacity: 1; }
    46%, 100% { top: 100%; opacity: 0; }
}

/* JSON output card */
.scanner__out {
    position: relative;
    z-index: 4;
    margin: -2.2rem -1.2rem 0 auto;
    max-width: 330px;
    background: rgba(12, 12, 20, 0.92);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid rgba(74, 158, 255, 0.28);
    border-radius: var(--radius-sm);
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
    padding: 0.9rem 1rem 1rem;
    font-family: var(--font-mono);
    font-size: 0.68rem;
}

.out__head {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--color-text-dim);
    font-size: 0.6rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding-bottom: 0.6rem;
    margin-bottom: 0.6rem;
    border-bottom: 1px solid var(--color-border);
}

.out__head::before {
    content: '';
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--ocr-teal);
    box-shadow: 0 0 8px var(--ocr-teal);
    animation: ocrBlink 1.4s step-end infinite;
}

.out__row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.5rem;
    align-items: baseline;
    padding: 0.2rem 0;
    opacity: 0;
    transform: translateX(8px);
    animation: outRowIn 9s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}

.out__row:nth-child(2) { animation-delay: 0.75s; }
.out__row:nth-child(3) { animation-delay: 1.15s; }
.out__row:nth-child(4) { animation-delay: 1.5s; }
.out__row:nth-child(5) { animation-delay: 1.85s; }
.out__row:nth-child(6) { animation-delay: 2.7s; }
.out__row:nth-child(7) { animation-delay: 3.55s; }

@keyframes outRowIn {
    0%, 7% { opacity: 0; transform: translateX(8px); }
    12%, 84% { opacity: 1; transform: translateX(0); }
    91%, 100% { opacity: 0; transform: translateX(0); }
}

.out__k {
    color: var(--ocr-blue);
}

.out__v {
    color: #d8d8e4;
}

.out__c {
    color: var(--ocr-teal);
    font-size: 0.6rem;
    white-space: nowrap;
}

.out__row--warn .out__k { color: var(--ocr-warn); }
.out__row--warn .out__c { color: var(--ocr-warn); }


/* ========================================
   PROBLEM SECTION
   ======================================== */

.problem-section {
    border-top: 1px solid var(--color-border);
    background: var(--color-bg-elevated);
}

.problem-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-lg);
    align-items: start;
}

.problem-copy p {
    color: var(--color-text-muted);
    font-size: 1.05rem;
    margin-bottom: var(--space-sm);
}

.problem-copy p:last-child {
    margin-bottom: 0;
}

.problem-copy strong {
    color: var(--color-text);
    font-weight: 600;
}

.gapboard {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-card);
    padding: var(--space-md);
}

.gapboard__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    padding-bottom: var(--space-sm);
    margin-bottom: var(--space-sm);
    border-bottom: 1px solid var(--color-border);
}

.gapboard__title {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-dim);
}

.gapboard__count {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--ocr-warn);
    border: 1px solid rgba(255, 184, 74, 0.4);
    background: var(--ocr-warn-soft);
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
}

.gaplist {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.gapitem {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding: 0.55rem 0.2rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.04);
    font-size: 0.92rem;
    color: var(--color-text-muted);
    opacity: 0;
    transform: translateY(8px);
}

.reveal--visible .gapitem {
    animation: gapIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.gapitem:nth-child(1) { animation-delay: 0.05s; }
.gapitem:nth-child(2) { animation-delay: 0.13s; }
.gapitem:nth-child(3) { animation-delay: 0.21s; }
.gapitem:nth-child(4) { animation-delay: 0.29s; }
.gapitem:nth-child(5) { animation-delay: 0.37s; }
.gapitem:nth-child(6) { animation-delay: 0.45s; }
.gapitem:nth-child(7) { animation-delay: 0.53s; }
.gapitem:nth-child(8) { animation-delay: 0.61s; }
.gapitem:nth-child(9) { animation-delay: 0.69s; }

@keyframes gapIn {
    to { opacity: 1; transform: translateY(0); }
}

.gapitem__mark {
    flex: 0 0 auto;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 1.5px solid var(--ocr-warn);
    color: var(--ocr-warn);
    display: grid;
    place-items: center;
    font-size: 0.62rem;
    font-weight: 700;
}

.gapitem:last-child {
    border-bottom: none;
}

.gapboard__foot {
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--color-border);
    font-size: 0.9rem;
    color: var(--color-text-dim);
    font-style: italic;
}


/* ========================================
   DOCUMENT TYPE MARQUEE
   ======================================== */

.marquee {
    position: relative;
    overflow: hidden;
    margin-top: var(--space-md);
    mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
    -webkit-mask-image: linear-gradient(to right, transparent, #000 12%, #000 88%, transparent);
}

.marquee__track {
    display: flex;
    gap: 0.75rem;
    width: max-content;
    margin-bottom: 0.75rem;
    animation: marqueeLeft 48s linear infinite;
}

.marquee__track--reverse {
    animation: marqueeRight 42s linear infinite;
}

.marquee:hover .marquee__track {
    animation-play-state: paused;
}

@keyframes marqueeLeft {
    from { transform: translateX(0); }
    to { transform: translateX(-50%); }
}

@keyframes marqueeRight {
    from { transform: translateX(-50%); }
    to { transform: translateX(0); }
}

.doctype {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    flex: 0 0 auto;
    border: 1px solid var(--color-border);
    background: var(--color-bg-card);
    border-radius: var(--radius-sm);
    padding: 0.7rem 1.1rem;
    font-size: 0.9rem;
    color: var(--color-text-muted);
    transition: var(--transition-fast);
}

.doctype:hover {
    color: var(--color-text);
    border-color: rgba(255, 99, 71, 0.4);
    transform: translateY(-2px);
}

.doctype svg {
    width: 15px;
    height: 15px;
    flex: 0 0 auto;
    color: var(--color-primary);
    opacity: 0.85;
}


/* ========================================
   SOURCE-LINKED EXTRACTION EXPLORER
   ======================================== */

.explorer {
    display: grid;
    grid-template-columns: 1.02fr 1fr;
    gap: var(--space-md);
    align-items: stretch;
}

.docview {
    position: relative;
    background: linear-gradient(180deg, #f7f6f3 0%, #eeede8 100%);
    border-radius: var(--radius-md);
    padding: 1.75rem 1.9rem 2rem;
    color: #2a2a33;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    line-height: 1.65;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.docview::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: var(--radius-md);
    background: repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.03) 0 1px, transparent 1px 3px);
    pointer-events: none;
    mix-blend-mode: multiply;
}

.docview__head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: var(--space-sm);
    padding-bottom: 0.8rem;
    margin-bottom: 1.1rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.14);
}

.docview__facility {
    font-size: 0.9rem;
    font-weight: 500;
}

.docview__stamp {
    font-size: 0.6rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #6b6b78;
    border: 1px solid rgba(0, 0, 0, 0.2);
    padding: 0.15rem 0.45rem;
    border-radius: 2px;
}

.docview__row {
    display: flex;
    gap: 0.6rem;
    margin-bottom: 0.25rem;
}

.docview__k {
    color: #6b6b78;
    min-width: 104px;
    flex: 0 0 auto;
}

.docview__block {
    margin-top: 1rem;
}

.docview__label {
    font-size: 0.6rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: #8a8a96;
    display: block;
    margin-bottom: 0.15rem;
}

.docview__hand {
    font-family: 'Segoe Script', 'Bradley Hand', 'Comic Sans MS', cursive;
    color: #26418f;
    font-size: 0.9rem;
}

.docview__sig {
    margin-top: 1.2rem;
    padding-top: 0.8rem;
    border-top: 1px dashed rgba(0, 0, 0, 0.2);
    display: flex;
    justify-content: space-between;
    gap: var(--space-sm);
    color: #6b6b78;
}

/* highlightable source region */
.src {
    position: relative;
    background: transparent;
    color: inherit;
    border-radius: 3px;
    padding: 0.05rem 0.2rem;
    margin: 0 -0.2rem;
    transition: background 220ms ease, box-shadow 220ms ease;
}

.src.is-active {
    background: rgba(74, 158, 255, 0.22);
    box-shadow: 0 0 0 1.5px var(--ocr-blue);
}

.src.is-active::after {
    content: attr(data-tag);
    position: absolute;
    top: -0.78rem;
    left: 0;
    font-size: 0.5rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #fff;
    background: var(--ocr-blue);
    padding: 0.1rem 0.35rem;
    border-radius: 2px;
    white-space: nowrap;
}

.src--warn.is-active {
    background: rgba(255, 184, 74, 0.28);
    box-shadow: 0 0 0 1.5px var(--ocr-warn);
}

.src--warn.is-active::after {
    background: #b06a00;
}

/* extracted fields panel */
.fieldpanel {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-card);
    padding: var(--space-md);
    display: flex;
    flex-direction: column;
}

.fieldpanel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-sm);
    padding-bottom: var(--space-sm);
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--color-border);
}

.fieldpanel__title {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-dim);
}

.fieldpanel__hint {
    font-size: 0.72rem;
    color: var(--color-text-dim);
}

.fieldlist {
    display: flex;
    flex-direction: column;
    flex: 1 1 auto;
}

.field {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.7rem 0.75rem;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    color: inherit;
    transition: var(--transition-fast);
}

.field:hover,
.field:focus-visible {
    background: rgba(255, 255, 255, 0.03);
    outline: none;
}

.field.is-active {
    background: var(--ocr-blue-soft);
    border-color: rgba(74, 158, 255, 0.4);
}

.field__top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-sm);
}

.field__name {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-text-dim);
}

.field.is-active .field__name {
    color: var(--ocr-blue);
}

.field__conf {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    color: var(--ocr-teal);
}

.field__val {
    display: block;
    font-size: 0.98rem;
    color: var(--color-text);
    margin-top: 0.15rem;
}

.field__meter {
    display: block;
    height: 2px;
    background: rgba(255, 255, 255, 0.07);
    border-radius: 2px;
    margin-top: 0.5rem;
    overflow: hidden;
}

.field__meter i {
    display: block;
    height: 100%;
    width: 0;
    background: var(--ocr-teal);
    border-radius: 2px;
    transition: width 700ms cubic-bezier(0.16, 1, 0.3, 1);
}

.reveal--visible .field__meter i {
    width: var(--conf, 90%);
}

.field--warn.is-active {
    background: var(--ocr-warn-soft);
    border-color: rgba(255, 184, 74, 0.45);
}

.field--warn.is-active .field__name { color: var(--ocr-warn); }
.field--warn .field__conf { color: var(--ocr-warn); }
.field--warn .field__meter i { background: var(--ocr-warn); }
.field--warn .field__val { color: var(--ocr-warn); }

.fieldpanel__foot {
    margin-top: var(--space-sm);
    padding-top: var(--space-sm);
    border-top: 1px solid var(--color-border);
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.outchip {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.06em;
    color: var(--color-text-muted);
    border: 1px solid var(--color-border);
    padding: 0.28rem 0.6rem;
    border-radius: 2px;
}


/* ========================================
   LANGUAGE / ABBREVIATION DECODER
   ======================================== */

.language-grid {
    display: grid;
    grid-template-columns: 1fr 1.05fr;
    gap: var(--space-lg);
    align-items: center;
}

.decoder {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-card);
    overflow: hidden;
}

.decoder__head {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.9rem var(--space-md);
    border-bottom: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.02);
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--color-text-dim);
}

.decoder__head span {
    margin-left: auto;
    color: var(--ocr-teal);
    letter-spacing: 0.06em;
}

.decoder__body {
    padding: 0.5rem var(--space-md) var(--space-md);
}

.decode {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 0.9rem;
    padding: 0.7rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    opacity: 0;
    transform: translateY(10px);
}

.decode:last-child {
    border-bottom: none;
}

.reveal--visible .decode {
    animation: gapIn 0.55s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.decode:nth-child(1) { animation-delay: 0.08s; }
.decode:nth-child(2) { animation-delay: 0.2s; }
.decode:nth-child(3) { animation-delay: 0.32s; }
.decode:nth-child(4) { animation-delay: 0.44s; }
.decode:nth-child(5) { animation-delay: 0.56s; }
.decode:nth-child(6) { animation-delay: 0.68s; }
.decode:nth-child(7) { animation-delay: 0.8s; }

.decode__raw {
    font-family: var(--font-mono);
    font-size: 0.9rem;
    color: var(--color-primary);
    background: rgba(255, 99, 71, 0.08);
    border: 1px solid rgba(255, 99, 71, 0.25);
    border-radius: var(--radius-sm);
    padding: 0.35rem 0.7rem;
    min-width: 92px;
    text-align: center;
}

.decode__out {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--color-text);
    font-size: 0.98rem;
}

.decode__out::before {
    content: '→';
    color: var(--color-text-dim);
    flex: 0 0 auto;
}

.taglist {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: var(--space-md);
}


/* ========================================
   VALIDATION / FLAGGING
   ======================================== */

.validate-grid {
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    gap: var(--space-lg);
    align-items: start;
}

.auditcard {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-card);
    overflow: hidden;
}

.auditcard__head {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 1rem var(--space-md);
    border-bottom: 1px solid var(--color-border);
    background: rgba(255, 255, 255, 0.02);
}

.auditcard__title {
    font-size: 0.95rem;
    font-weight: 600;
}

.auditcard__sub {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: var(--color-text-dim);
    margin-left: auto;
}

.checkrow {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0.9rem;
    padding: 0.8rem var(--space-md);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    opacity: 0;
    transform: translateX(-8px);
}

.reveal--visible .checkrow {
    animation: checkIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.checkrow:nth-child(1) { animation-delay: 0.1s; }
.checkrow:nth-child(2) { animation-delay: 0.3s; }
.checkrow:nth-child(3) { animation-delay: 0.5s; }
.checkrow:nth-child(4) { animation-delay: 0.7s; }
.checkrow:nth-child(5) { animation-delay: 0.9s; }
.checkrow:nth-child(6) { animation-delay: 1.1s; }
.checkrow:nth-child(7) { animation-delay: 1.3s; }

@keyframes checkIn {
    to { opacity: 1; transform: translateX(0); }
}

.checkrow:last-child {
    border-bottom: none;
}

.checkrow__icon {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-size: 0.7rem;
    font-weight: 700;
    flex: 0 0 auto;
}

.checkrow--pass .checkrow__icon {
    color: var(--ocr-teal);
    background: var(--ocr-teal-soft);
    border: 1px solid rgba(0, 212, 170, 0.45);
}

.checkrow--flag .checkrow__icon {
    color: var(--ocr-warn);
    background: var(--ocr-warn-soft);
    border: 1px solid rgba(255, 184, 74, 0.45);
}

.checkrow--review .checkrow__icon {
    color: var(--ocr-blue);
    background: var(--ocr-blue-soft);
    border: 1px solid rgba(74, 158, 255, 0.45);
}

.checkrow__label {
    font-size: 0.95rem;
    color: var(--color-text);
}

.checkrow__meta {
    display: block;
    font-size: 0.78rem;
    color: var(--color-text-dim);
    margin-top: 0.1rem;
}

.checkrow__status {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 0.22rem 0.5rem;
    border-radius: 2px;
    white-space: nowrap;
}

.checkrow--pass .checkrow__status { color: var(--ocr-teal); background: var(--ocr-teal-soft); }
.checkrow--flag .checkrow__status { color: var(--ocr-warn); background: var(--ocr-warn-soft); }
.checkrow--review .checkrow__status { color: var(--ocr-blue); background: var(--ocr-blue-soft); }

.auditcard__foot {
    padding: 1rem var(--space-md);
    background: rgba(255, 255, 255, 0.02);
    border-top: 1px solid var(--color-border);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    font-size: 0.88rem;
    color: var(--color-text-muted);
}

.auditcard__foot strong {
    color: var(--color-text);
}

.detects {
    display: grid;
    gap: 0.55rem;
}

.detect {
    display: flex;
    gap: 0.7rem;
    align-items: flex-start;
    font-size: 0.98rem;
    color: var(--color-text-muted);
    padding: 0.5rem 0;
}

.detect::before {
    content: '';
    flex: 0 0 auto;
    width: 6px;
    height: 6px;
    margin-top: 0.55rem;
    background: var(--ocr-warn);
    transform: rotate(45deg);
}


/* ========================================
   OUTPUTS
   ======================================== */

.outputs-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
}

.output-card {
    position: relative;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-card);
    padding: var(--space-md);
    overflow: hidden;
    transition: var(--transition-base);
}

.output-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--ocr-blue), var(--ocr-teal));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 420ms cubic-bezier(0.16, 1, 0.3, 1);
}

.output-card:hover {
    transform: translateY(-4px);
    border-color: rgba(74, 158, 255, 0.35);
}

.output-card:hover::before {
    transform: scaleX(1);
}

.output-card__icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    display: grid;
    place-items: center;
    background: var(--ocr-blue-soft);
    color: var(--ocr-blue);
    margin-bottom: var(--space-sm);
}

.output-card__icon svg {
    width: 20px;
    height: 20px;
}

.output-card__title {
    font-size: 1.05rem;
    font-weight: 600;
    margin-bottom: 0.35rem;
}

.output-card__text {
    font-size: 0.92rem;
    color: var(--color-text-muted);
}


/* ========================================
   PIPELINE — HOW IT WORKS
   ======================================== */

.pipeline {
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-md);
    padding-top: 2.5rem;
}

.pipeline__rail {
    position: absolute;
    top: 2.5rem;
    left: 6%;
    right: 6%;
    height: 2px;
    background: rgba(255, 255, 255, 0.08);
    overflow: hidden;
}

.pipeline__rail i {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--color-primary), var(--ocr-warn) 40%, var(--ocr-blue) 75%, var(--ocr-teal));
    transition: width 900ms cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 0 12px rgba(74, 158, 255, 0.6);
}

.pstep {
    position: relative;
    padding-top: 3.5rem;
    text-align: left;
}

.pstep__dot {
    position: absolute;
    top: calc(2.5rem - 15px);
    left: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--color-text-dim);
    background: var(--color-bg);
    border: 1px solid var(--color-border);
    transition: var(--transition-base);
}

.pstep.is-on .pstep__dot {
    color: #fff;
    border-color: var(--ocr-blue);
    background: var(--ocr-blue);
    box-shadow: 0 0 0 6px rgba(74, 158, 255, 0.14);
}

.pstep__title {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 0.4rem;
    color: var(--color-text-muted);
    transition: var(--transition-base);
}

.pstep.is-on .pstep__title {
    color: var(--color-text);
}

.pstep__text {
    font-size: 0.95rem;
    color: var(--color-text-muted);
    margin-bottom: var(--space-sm);
}

.pstep__mini {
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: var(--color-bg-card);
    padding: 0.85rem;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: var(--color-text-dim);
    display: grid;
    gap: 0.4rem;
    opacity: 0.45;
    transition: var(--transition-base);
}

.pstep.is-on .pstep__mini {
    opacity: 1;
    border-color: rgba(74, 158, 255, 0.28);
}

.mini__row {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.mini__row i {
    display: block;
    height: 5px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.14);
    flex: 1 1 auto;
}

.mini__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--color-text-dim);
    flex: 0 0 auto;
}

.pstep.is-on .mini__dot { background: var(--ocr-blue); }
.pstep.is-on .mini__row i { background: rgba(74, 158, 255, 0.35); }
.pstep.is-on .mini__ok { color: var(--ocr-teal); }
.pstep.is-on .mini__warn { color: var(--ocr-warn); }


/* ========================================
   USE CASES — full-width bento band
   Keeps the shared bento grid free of empty
   cells when the card count is odd.
   ======================================== */

.bento__card--wide {
    grid-column: span 3;
}

@media (max-width: 1024px) {
    .bento__card--wide {
        grid-column: span 1;
    }
}


/* ========================================
   MARKETS
   ======================================== */

.markets-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
}

.market-card {
    position: relative;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    background: var(--color-bg-card);
    padding: var(--space-md);
    overflow: hidden;
    transition: var(--transition-base);
}

.market-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 100% 0%, rgba(255, 99, 71, 0.10), transparent 60%);
    opacity: 0;
    transition: var(--transition-base);
    pointer-events: none;
}

.market-card:hover {
    transform: translateY(-4px);
    border-color: rgba(255, 99, 71, 0.3);
}

.market-card:hover::after {
    opacity: 1;
}

.market-card__tag {
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-primary);
    display: block;
    margin-bottom: 0.7rem;
}

.market-card__title {
    font-size: 1.2rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
    line-height: 1.3;
}

.market-card__text {
    font-size: 0.95rem;
    color: var(--color-text-muted);
}


/* ========================================
   TRUST & SAFETY
   ======================================== */

.trust-section {
    border-top: 1px solid var(--color-border);
    background: var(--color-bg-elevated);
}

.trust-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1px;
    background: var(--color-border);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-md);
    overflow: hidden;
}

.trust-item {
    background: var(--color-bg);
    padding: 1.4rem var(--space-sm);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.95rem;
    color: var(--color-text-muted);
    transition: var(--transition-fast);
}

.trust-item:hover {
    background: var(--color-bg-card);
    color: var(--color-text);
}

.trust-item svg {
    width: 18px;
    height: 18px;
    flex: 0 0 auto;
    color: var(--ocr-teal);
}


/* ========================================
   REDUCED MOTION
   ======================================== */

@media (prefers-reduced-motion: reduce) {
    .scanner__beam,
    .dfield::after,
    .dfield::before,
    .out__row,
    .marquee__track,
    .ocr-badge::before,
    .out__head::before {
        animation: none !important;
    }

    .dfield::after,
    .dfield::before,
    .out__row,
    .gapitem,
    .decode,
    .checkrow {
        opacity: 1 !important;
        transform: none !important;
    }

    .scanner__beam { display: none; }
}


/* ========================================
   RESPONSIVE
   ======================================== */

@media (max-width: 1200px) {
    .scanner__out {
        max-width: 300px;
        margin-right: -0.5rem;
    }
}

@media (max-width: 1024px) {
    .ocr-hero {
        min-height: auto;
    }

    .ocr-hero__inner {
        grid-template-columns: 1fr;
    }

    .ocr-hero__content {
        max-width: 100%;
    }

    .scanner {
        max-width: 480px;
        margin: var(--space-md) auto 0;
    }

    .scanner__out {
        margin-right: 0;
    }

    .problem-grid,
    .explorer,
    .language-grid,
    .validate-grid {
        grid-template-columns: 1fr;
    }

    .markets-grid {
        grid-template-columns: 1fr;
    }

    .outputs-grid,
    .trust-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .pipeline {
        grid-template-columns: repeat(2, 1fr);
        gap: var(--space-lg) var(--space-md);
    }

    .pipeline__rail {
        display: none;
    }
}

@media (max-width: 768px) {
    .ocr-hero__inner {
        padding-top: var(--space-lg);
    }

    .scanner {
        max-width: 100%;
    }

    .scanner__ghost--1,
    .scanner__ghost--2 {
        display: none;
    }

    .scanner__page {
        padding: 1.1rem 1.1rem 1.3rem;
        font-size: 0.66rem;
    }

    .dfield__k {
        min-width: 74px;
    }

    .scanner__out {
        max-width: 100%;
        margin: 0.75rem 0 0;
    }

    .docview {
        padding: 1.2rem 1.1rem 1.5rem;
        font-size: 0.72rem;
    }

    .docview__k {
        min-width: 88px;
    }

    .docview__row {
        flex-direction: column;
        gap: 0;
        margin-bottom: 0.5rem;
    }

    .pipeline {
        grid-template-columns: 1fr;
    }

    .outputs-grid,
    .trust-grid {
        grid-template-columns: 1fr;
    }

    .decode {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }

    .decode__raw {
        justify-self: start;
    }
}
