/* /features/contracts/ only: the body of the hero's live instrument (a contract's document
   register beside the paperwork it produces; js/pages/contracts.js). The instrument's shell
   (stage, board header, activity footer) is .site-instrument in css/public-site.css. */

.ctr-board__body { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 14px; height: 420px; }

/* ---------- The register ---------- */
.ctr-register { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.ctr-register__label { padding: 0 2px 4px; font-family: var(--site-font-mono); font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--site-subtle); }
.ctr-doc {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border: 1px solid var(--site-line);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: border-color .2s ease, background-color .2s ease;
}
.ctr-doc:hover { background: #F7F5FC; }
.ctr-doc.is-active { border-color: var(--site-accent); background: var(--site-panel); }
.ctr-doc__type {
    flex: none;
    width: 34px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    font-family: var(--site-font-mono);
    font-size: 10.5px;
    font-weight: 500;
    color: #fff;
}
.ctr-doc__type--hc  { background: var(--site-accent); }
.ctr-doc__type--pc  { background: #15803D; }
.ctr-doc__type--vo  { background: #2563EB; }
.ctr-doc__type--eot { background: #B45309; }
.ctr-doc__type--dn  { background: #B91C1C; }
.ctr-doc__info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ctr-doc__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; color: var(--site-text); }
.ctr-doc__ref { font-family: var(--site-font-mono); font-size: 10.5px; color: var(--site-subtle); }
.ctr-register__more { padding: 4px 2px 0; font-size: 12px; color: var(--site-subtle); }

/* Status chips: the app's own status names (ProgressClaim / ContractAction / contract status) */
.ctr-chip {
    flex: none;
    padding: 3px 8px;
    border-radius: 999px;
    font-family: var(--site-font-mono);
    font-size: 10px;
    letter-spacing: .05em;
    text-transform: uppercase;
    white-space: nowrap;
}
.ctr-chip--draft     { background: #EEEDF2; color: var(--site-muted); }
.ctr-chip--submitted { background: #E6EEFD; color: #1D4ED8; }
.ctr-chip--review    { background: #FDF0DC; color: #8A4B00; }
.ctr-chip--approved  { background: #E7F5EC; color: #146C43; }
.ctr-chip--progress  { background: var(--site-panel); color: var(--site-accent); }
.ctr-chip.is-popped { animation: ctr-pop .45s cubic-bezier(.34, 1.5, .64, 1); }
@keyframes ctr-pop { 40% { transform: scale(1.18); } }

/* ---------- The desk and the paper ---------- */
.ctr-desk {
    position: relative;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overflow: hidden;
    border: 1px solid var(--site-line);
    border-radius: 10px;
    background-color: var(--site-paper);
}
.ctr-paper {
    position: relative;
    width: min(440px, 100%);
    height: 100%;
    padding: 18px 20px;
    overflow: hidden;
    border: 1px solid #E4E1EA;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 14px 30px -14px rgba(23, 20, 31, .35);
    transform: rotate(-.4deg);
    transition: opacity .22s ease, transform .22s ease;
}
.ctr-paper.is-swapping { opacity: 0; transform: rotate(-.4deg) translateY(10px) scale(.98); }
.ctr-paper.is-thud { animation: ctr-thud .35s ease-out; }
@keyframes ctr-thud { 35% { transform: rotate(-.8deg) scale(.988); } }

.ctr-paper__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 2px solid var(--site-text);
}
.ctr-paper__head > div { min-width: 0; }
.ctr-paper__letterhead { margin-bottom: 4px; font-family: var(--site-font-mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--site-subtle); }
.ctr-paper__title { font-family: var(--site-font-display); font-size: 17px; font-weight: 600; line-height: 1.25; color: var(--site-text); }
.ctr-paper__ref { margin-top: 2px; font-family: var(--site-font-mono); font-size: 10.5px; color: var(--site-subtle); }

.ctr-paper__body { font-family: Georgia, 'Times New Roman', serif; font-size: 12.5px; line-height: 1.45; color: var(--site-text-2); }
.ctr-row { display: flex; justify-content: space-between; gap: 14px; padding: 4px 0; border-bottom: 1px solid #EFEDF3; }
.ctr-row > span:first-child { color: var(--site-muted); }
.ctr-row > span:last-child { font-weight: 700; text-align: right; color: var(--site-text); }
.ctr-paper__label { margin: 10px 0 2px; font-family: var(--site-font-mono); font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--site-accent); }
.ctr-table { width: 100%; border-collapse: collapse; }
.ctr-table td { padding: 4px 0; border-bottom: 1px solid #EFEDF3; }
.ctr-table .num { text-align: right; white-space: nowrap; }
.ctr-table tr.is-total td { padding-top: 6px; border-top: 2px solid var(--site-text); border-bottom: 0; font-weight: 700; color: var(--site-text); }

/* Rubber stamps */
.ctr-paper__stamps { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.ctr-stamp {
    position: absolute;
    left: 50%;
    top: 87%;   /* in the space every paper leaves below its content */
    padding: 5px 14px 6px;
    border: 3px solid currentColor;
    border-radius: 8px;
    font-family: var(--site-font-display);
    font-size: 19px;
    font-weight: 700;
    letter-spacing: .12em;
    line-height: 1.1;
    text-align: center;
    text-transform: uppercase;
    white-space: nowrap;
    opacity: .82;
    transform: translate(-50%, -50%) rotate(-9deg);
    -webkit-mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="120" height="60"><filter id="n"><feTurbulence baseFrequency="0.55" numOctaves="2"/><feColorMatrix values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.62 0.38"/></filter><rect width="120" height="60" filter="url(%23n)"/></svg>');
    mask-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="120" height="60"><filter id="n"><feTurbulence baseFrequency="0.55" numOctaves="2"/><feColorMatrix values="0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.62 0.38"/></filter><rect width="120" height="60" filter="url(%23n)"/></svg>');
    -webkit-mask-size: 120px 60px;
    mask-size: 120px 60px;
}
.ctr-stamp small { display: block; margin-top: 2px; font-family: var(--site-font-mono); font-size: 9px; font-weight: 500; letter-spacing: .08em; }
.ctr-stamp--approved { color: #15803D; }
.ctr-stamp--client { color: var(--site-accent); }
.ctr-stamp.is-slammed { animation: ctr-slam .4s cubic-bezier(.22, 1.3, .36, 1) backwards; }
@keyframes ctr-slam {
    0%  { opacity: 0; transform: translate(-50%, -50%) rotate(-9deg) scale(2.6); }
    55% { opacity: .9; transform: translate(-50%, -50%) rotate(-9deg) scale(.94); }
}

/* ---------- Narrower boards ---------- */
/* Mid widths: the chip goes under the name so the name isn't cut short, and the paper gets a
   little more height because its rows wrap. */
@media (max-width: 1100px) and (min-width: 760.02px) {
    .ctr-board__body { grid-template-columns: 220px minmax(0, 1fr); height: 440px; }
    .ctr-doc { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 4px 10px; }
    .ctr-doc__type { grid-row: span 2; }
    .ctr-doc__ref { display: none; }
    .ctr-doc .ctr-chip { justify-self: start; }
}
@media (max-width: 760px) {
    .ctr-board__body { grid-template-columns: minmax(0, 1fr); height: auto; gap: 10px; }
    /* The register folds into a row of tabs: the type, with its status as a dot. */
    .ctr-register { flex-direction: row; gap: 6px; }
    .ctr-register__label, .ctr-register__more, .ctr-doc__info { display: none; }
    .ctr-doc { flex: 1; justify-content: center; gap: 6px; padding: 6px 4px; }
    .ctr-doc__type { width: auto; height: 22px; padding: 0 6px; font-size: 10px; }
    .ctr-register .ctr-chip { width: 8px; height: 8px; padding: 0; font-size: 0; background: currentColor; }
    .ctr-desk { height: 400px; padding: 10px; }
    .ctr-paper { padding: 14px; }
    .ctr-paper__letterhead, .ctr-paper__ref { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .ctr-paper__body { font-size: 11.5px; }
    .ctr-row { gap: 10px; }
    .ctr-stamp { font-size: 16px; }
}

@media (prefers-reduced-motion: reduce) {
    .ctr-paper, .ctr-doc { transition: none; }
}
