/* IntelliClerk — Brief Draft, Step 2 (the completed brief).
   Layered over dashboard-v3.css, form.css, and new-brief.css, in that order.
   The ruled text area, the mini buttons, and the form foot come from those;
   this file adds the tabs, the paged sheets, and the adjustments log. */

/* The step this draft has reached, above the matter it belongs to. */
.step-line {
    display: block;
    margin-bottom: 0.5rem;
}

/* ---------- regenerate ---------- */

/* Sits above the tabs because it acts on all of them: what is changed in any
   section is not in the draft until the draft is made again. */
.regen {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    flex-wrap: wrap;
    margin-top: 2.4rem;
    padding: 0.9rem 1.25rem;
    background: var(--vellum);
    border: 1px solid var(--rule);
    border-radius: var(--radius-card);
    transition: border-color 160ms ease, background 160ms ease;
}

.regen__read {
    display: flex;
    align-items: baseline;
    gap: 0.65rem;
    flex-wrap: wrap;
}

/* Hollow while the draft matches the record; filled once it does not. */
.regen__mark {
    width: 0.6rem;
    height: 0.6rem;
    flex: 0 0 auto;
    align-self: center;
    border: 1px solid var(--rule);
    background: transparent;
}

.regen__state {
    font-family: var(--data);
    font-size: 0.8125rem;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.regen__detail {
    font-family: var(--data);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    color: var(--muted);
}

/* Pending: the one place on the page that asks for something. */
.regen[data-state="pending"] {
    border-color: var(--ochre);
    background: rgba(166, 100, 28, 0.06);
}

.regen[data-state="pending"] .regen__mark {
    background: var(--ochre-deep);
    border-color: var(--ochre-deep);
}

.regen[data-state="pending"] .regen__state {
    color: var(--ochre-deep);
    font-weight: 700;
}

.regen[data-state="working"] .regen__mark {
    background: var(--steel);
    border-color: var(--steel);
}

.regen[data-state="done"] .regen__mark {
    background: var(--moss);
    border-color: var(--moss);
}

.regen[data-state="done"] .regen__state {
    color: var(--moss);
}

/* Nothing to regenerate from, so the button says so rather than inviting a
   press that would do nothing. */
.regen__btn[disabled] {
    color: var(--muted);
    background: transparent;
    border-color: var(--rule-soft);
    cursor: not-allowed;
}

.regen__btn[disabled]:hover {
    color: var(--muted);
    background: transparent;
    border-color: var(--rule-soft);
}

@media (max-width: 40rem) {
    .regen {
        align-items: stretch;
    }

    .regen__btn {
        justify-content: center;
    }
}

/* ---------- folder tabs ---------- */

.tabs {
    display: flex;
    align-items: flex-end;
    gap: 0.35rem;
    flex-wrap: wrap;
    margin: 2.6rem 0 0;
    padding-left: 1.5rem;
}

/* Each section is a tab on the same folder: the selected one joins the sheet
   below by painting over the leaf's top border. */
.sheet-tab {
    position: relative;
    bottom: -1px;
    font-family: var(--data);
    font-size: 0.8125rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--muted);
    background: var(--parchment);
    border: 1px solid var(--rule);
    border-bottom-color: var(--rule);
    border-radius: var(--radius-card) var(--radius-card) 0 0;
    padding: 0.6rem 1.1rem 0.55rem;
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease;
}

.sheet-tab:hover {
    color: var(--ink);
    background: var(--vellum);
}

.sheet-tab[aria-selected="true"] {
    color: var(--ink);
    background: var(--vellum);
    border-bottom-color: var(--vellum);
    box-shadow: inset 0 3px 0 var(--brass);
}

.sheet-tab__count {
    margin-left: 0.5rem;
    color: var(--muted);
    font-weight: 400;
}

/* ---------- panels ---------- */

.panel {
    margin: 0 0 3rem;
    padding: var(--leaf-pad) var(--leaf-pad) 1.75rem var(--gutter);
}

.panel:focus-visible {
    outline: 2px solid var(--ochre);
    outline-offset: 3px;
}

.panel__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.75rem 1.5rem;
    flex-wrap: wrap;
    padding-bottom: 0.7rem;
    border-bottom: 1px solid var(--ink);
}

.panel__title {
    font-family: var(--display);
    font-size: 1.5rem;
    font-weight: 400;
    margin: 0;
}

.panel__note {
    font-family: var(--data);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.panel__acts {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
}

/* ---------- summary ---------- */

.digest {
    margin: 0;
}

.digest__term {
    margin-top: 1.9rem;
    font-family: var(--data);
    font-size: 0.75rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}

.digest__def {
    margin: 0.55rem 0 0;
    max-width: 46rem;
    font-size: 1.0625rem;
    line-height: 1.65;
}

.digest__def p + p {
    margin-top: 0.8rem;
}

/* Argument headings run in capitals in the brief itself; held to a readable
   size here so the summary stays a summary. */
.digest__point {
    display: block;
    margin-bottom: 0.35rem;
    font-family: var(--data);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--ink);
}

/* ---------- paged sheets ---------- */

/* A printed page laid on the leaf: plate against vellum, with the measure a
   filing actually keeps. */
.sheet {
    background: var(--plate);
    border: 1px solid var(--rule-soft);
    border-radius: var(--radius-control);
    padding: 2.75rem 3rem 2.25rem;
    margin-top: 1.5rem;
    font-size: 1.0625rem;
    line-height: 1.75;
}

.sheet h3 {
    font-family: var(--data);
    font-size: 0.8125rem;
    letter-spacing: 0.08em;
    line-height: 1.6;
    font-weight: 700;
    margin: 0 0 1rem;
}

.sheet h3 + p {
    margin-top: 0;
}

.sheet p {
    margin: 0 0 1rem;
    text-align: justify;
    hyphens: auto;
}

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

.sheet__caption {
    text-align: center;
    margin-bottom: 2rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--rule-soft);
}

.sheet__court {
    font-family: var(--data);
    font-size: 0.8125rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
}

.sheet__style {
    font-family: var(--display);
    font-size: 1.5rem;
    margin: 0.9rem 0 0.5rem;
}

.sheet__doc {
    font-family: var(--data);
    font-size: 0.875rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink);
    margin-top: 1.1rem;
}

.sheet__sig {
    margin-top: 2.25rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--rule-soft);
    font-family: var(--data);
    font-size: 0.8125rem;
    line-height: 1.9;
    color: var(--muted);
}

.sheet__foot {
    margin-top: 2rem;
    padding-top: 0.9rem;
    border-top: 1px solid var(--rule-soft);
    text-align: center;
    font-family: var(--data);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    color: var(--muted);
}

/* ---------- pager ---------- */

.pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
}

.pager__count {
    font-family: var(--data);
    font-size: 0.75rem;
    letter-spacing: 0.08em;
    color: var(--muted);
    min-width: 8rem;
    text-align: center;
}

.btn-mini[disabled] {
    color: var(--muted);
    background: transparent;
    border-color: var(--rule-soft);
    cursor: not-allowed;
    opacity: 0.65;
}

.btn-mini[disabled]:hover {
    color: var(--muted);
    background: transparent;
    border-color: var(--rule-soft);
}

/* ---------- adjustments ---------- */

.adjust__form {
    padding: 1.5rem 0 0;
}

.adjust__submit {
    display: flex;
    justify-content: flex-end;
    margin-top: 0.9rem;
}

.log {
    list-style: none;
    margin: 2rem 0 0;
    padding: 1.5rem 0 0;
    border-top: 1px solid var(--rule-soft);
}

.log__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-top: 2rem;
}

.entry {
    padding: 1.1rem 0;
    border-bottom: 1px solid var(--rule-soft);
}

.log .entry:last-child {
    border-bottom: 0;
}

.entry__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 0.4rem;
}

.entry__when {
    font-family: var(--data);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.entry__body {
    max-width: 46rem;
    font-size: 1.0625rem;
    line-height: 1.6;
}

/* A modification just entered, before it has been read by the drafter. */
.entry--new {
    animation: leaf-in 420ms ease both;
}

/* ---------- narrow screens ---------- */

@media (max-width: 40rem) {
    .tabs {
        padding-left: 0.5rem;
    }

    .sheet-tab {
        font-size: 0.75rem;
        padding: 0.5rem 0.75rem 0.45rem;
    }

    .panel {
        padding-left: var(--leaf-pad);
    }

    .sheet {
        padding: 1.5rem 1.25rem;
    }

    .sheet p {
        text-align: left;
    }
}

/* ---------- case law ---------- */

.cite__intro {
    max-width: 46rem;
    margin-top: 1.4rem;
}

.cites {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
}

.cite {
    display: grid;
    grid-template-columns: 7.5rem minmax(0, 1fr);
    gap: 1.25rem;
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--rule-soft);
    transition: opacity 140ms ease;
}

.cites .cite:last-child {
    border-bottom: 0;
}

/* ---------- the ignore mark ---------- */

.cite__ignore {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    margin: 0;
    padding-top: 0.2rem;
    cursor: pointer;
    font-family: var(--data);
    font-size: 0.6875rem;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--muted);
    align-self: start;
}

.cite__input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* Drawn rather than native, so it keeps the square corners the status marks
   use. Ochre when set: this withholds authority, it does not approve it. */
.cite__box {
    position: relative;
    width: 0.85rem;
    height: 0.85rem;
    flex: 0 0 auto;
    border: 1px solid var(--rule);
    background: #FFFFFF;
    transition: background 120ms ease, border-color 120ms ease;
}

.cite__input:checked + .cite__box {
    background: var(--ochre-deep);
    border-color: var(--ochre-deep);
}

.cite__input:checked + .cite__box::after {
    content: "";
    position: absolute;
    left: 0.22rem;
    top: 0.05rem;
    width: 0.25rem;
    height: 0.48rem;
    border: solid var(--parchment);
    border-width: 0 1.5px 1.5px 0;
    transform: rotate(42deg);
}

.cite__input:focus-visible + .cite__box {
    outline: 2px solid var(--ochre);
    outline-offset: 2px;
}

.cite__input:checked ~ .cite__ignore-label {
    color: var(--ochre-deep);
}

/* ---------- the entry ---------- */

.cite__head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.cite__name {
    font-family: var(--display);
    font-size: 1.25rem;
    font-weight: 400;
    margin: 0;
}

.cite__ref {
    margin-top: 0.3rem;
    font-family: var(--data);
    font-size: 0.8125rem;
    letter-spacing: 0.06em;
    color: var(--ink);
}

.cite__for {
    margin-top: 0.6rem;
    max-width: 46rem;
    font-size: 1.0625rem;
    line-height: 1.6;
}

.cite__where {
    margin-top: 0.45rem;
    font-family: var(--data);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    color: var(--muted);
}

/* ---------- the source link ---------- */

.cite__link {
    display: inline-flex;
    align-items: center;
    gap: 0.55em;
    margin-top: 0.9rem;
    font-family: var(--data);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--walnut);
    background: var(--plate);
    border: 1px solid var(--rule);
    border-radius: var(--radius-control);
    padding: 0.4rem 0.8rem;
    text-decoration: none;
    transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.cite__link:hover {
    color: #FFFFFF;
    background: var(--brass);
    border-color: var(--brass);
}

/* Said once in the link, for anyone who cannot see the arrow. */
.cite__new {
    font-weight: 400;
    letter-spacing: 0.06em;
    text-transform: none;
    opacity: 0.75;
}

/* ---------- ignored ---------- */

/* An ignored authority stays legible — counsel must be able to read what is
   being withheld — but reads as struck from the draft. */
.cite--ignored {
    opacity: 0.55;
}

.cite--ignored .cite__name,
.cite--ignored .cite__ref {
    text-decoration: line-through;
}

/* ---------- foot ---------- */

.cite__foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1.6rem 0 0.5rem;
    border-top: 1px solid var(--rule-soft);
}

.cite__tally {
    margin-right: auto;
    font-family: var(--data);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.cite__tally--some {
    color: var(--ochre-deep);
}

.cite__note {
    font-family: var(--data);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    color: var(--moss);
}

@media (max-width: 48rem) {
    .cite {
        grid-template-columns: minmax(0, 1fr);
        gap: 0.6rem;
    }

    .cite__foot {
        justify-content: stretch;
    }

    .cite__tally {
        width: 100%;
        margin-right: 0;
    }
}

/* ---------- addressables ---------- */

.addr__intro {
    max-width: 46rem;
    margin-top: 1.4rem;
}

.addrs {
    list-style: none;
    margin: 0.5rem 0 0;
    padding: 0;
    counter-reset: addr;
}

.addr {
    padding: 1.6rem 0;
    border-bottom: 1px solid var(--rule-soft);
}

.addrs .addr:last-child {
    border-bottom: 0;
}

.addr__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

/* What kind of trouble the flag is, not how bad it is — counsel judges the
   weight, the system only names the defect. */
.addr__kind {
    font-family: var(--data);
    font-size: 0.6875rem;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--walnut);
    border-bottom: 2px solid var(--brass);
    padding-bottom: 0.15rem;
}

/* Where in the draft the flag was raised. */
.addr__where {
    margin-top: 0.5rem;
    font-family: var(--data);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.addr__prompt {
    display: block;
    margin: 0.55rem 0 0.85rem;
    max-width: 46rem;
    font-size: 1.0625rem;
    line-height: 1.6;
    cursor: pointer;
}

.addr__prompt::before {
    counter-increment: addr;
    content: counter(addr) ".";
    font-family: var(--data);
    font-size: 0.875rem;
    color: rgba(27, 46, 74, 0.45);
    margin-right: 0.7rem;
}

.addr__answer {
    min-height: 6.5rem;
}

.addr__foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1.6rem 0 0.5rem;
    border-top: 1px solid var(--rule-soft);
}

.addr__tally {
    margin-right: auto;
    font-family: var(--data);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    color: var(--muted);
}

.addr__tally--some {
    color: var(--walnut);
}

/* Reads only after a submission, so it is empty until it has something to say. */
.addr__note {
    font-family: var(--data);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    color: var(--moss);
}

@media (max-width: 40rem) {
    .addr__foot {
        justify-content: stretch;
    }

    .addr__tally {
        width: 100%;
        margin-right: 0;
    }
}

/* ---------- export ---------- */

/* Export prints the section on screen — every page of it, not just the one
   being read — so a paged document leaves as one document. */
@media print {
    .masthead,
    .page-head,
    .result-line,
    .tabs,
    .pager,
    .panel__acts,
    .adjust__form,
    .colophon {
        display: none !important;
    }

    body {
        background: #FFFFFF;
    }

    .panel {
        margin: 0;
        padding: 0;
        border: 0;
        box-shadow: none;
        background: #FFFFFF;
    }

    .panel::before,
    .panel::after {
        display: none;
    }

    .sheet[hidden] {
        display: block !important;
    }

    .sheet {
        border: 0;
        border-radius: 0;
        padding: 0;
        margin: 0 0 2rem;
        break-after: page;
    }

    .sheet:last-child {
        break-after: auto;
    }
}
