/* GRC audit report mockup: paper sheets on a cool gray desk, one accent. */

:root {
    --desk: #E6E9EE;
    --paper: #FFFFFF;
    --ink: #14171C;
    --muted: #4A525E;
    --rule: #D3D8DF;
    --accent: #0B4F9C;
    --accent-hover: #083D7A;
    --accent-tint: #E4ECF6;
    --private-bg: #EEF0F3;
    --private-ink: #3F4650;
    --private-edge: #6B7380;

    /* Cover sheet */
    --navy: #0F1B2D;
    --navy-rule: rgba(232, 237, 244, 0.2);
    --on-navy: #E8EDF4;
    --on-navy-muted: #A9B4C4;
    --accent-on-navy: #6EA8EE;
    --accent-on-navy-hover: #93BEF3;

    /* Reviewer marks only: stamp, ticks, margin note, highlighter */
    --stamp-red: #B42318;
    --stamp-red-on-navy: #F2766B;
    --highlight: #FFE066;

    --sans: "IBM Plex Sans", system-ui, sans-serif;
    --mono: "IBM Plex Mono", ui-monospace, monospace;

    --gutter: 16px;
    --sheet-pad: clamp(20px, 5vw, 64px);
    --radius: 4px;
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

*,
*::before,
*::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    scroll-padding-top: 84px;
}

@media (prefers-reduced-motion: no-preference) {
    html { scroll-behavior: smooth; }
}

body {
    margin: 0;
    background: var(--desk);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 1rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent-tint); color: var(--ink); }

h1, h2, h3 { margin: 0; line-height: 1.2; text-wrap: balance; }
p { margin: 0; }

.mono {
    font-family: var(--mono);
    font-variant-numeric: tabular-nums;
}

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

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: 2px;
}

/* Skip link */
.skip-link {
    position: absolute;
    left: var(--gutter);
    top: -100px;
    z-index: 20;
    padding: 12px 16px;
    background: var(--ink);
    color: var(--paper);
    border-radius: var(--radius);
    text-decoration: none;
}
.skip-link:focus { top: 12px; }

/* Top bar */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(230, 233, 238, 0.94);
    border-bottom: 1px solid var(--rule);
}
.topbar-inner {
    max-width: 880px;
    margin: 0 auto;
    padding: 10px var(--gutter);
    display: flex;
    align-items: center;
    gap: 16px;
}
.topbar-name {
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
}
.topbar-doc {
    font-size: 0.8125rem;
    color: var(--muted);
    margin-right: auto;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 20px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    font: 500 0.9375rem/1 var(--sans);
    text-decoration: none;
    cursor: pointer;
    transition: transform 160ms var(--ease-out), background-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(20, 23, 28, 0.12); }
.btn:active { transform: translateY(0); box-shadow: none; }
.btn-primary { background: var(--accent); color: var(--paper); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--paper); color: var(--ink); border-color: var(--ink); }
.btn-small { padding: 0 14px; font-size: 0.875rem; }

.text-link,
.row-link,
.toc a {
    color: var(--accent);
    text-decoration-line: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
    transition: text-decoration-thickness 120ms ease;
}
.text-link:hover,
.row-link:hover { text-decoration-thickness: 2px; color: var(--accent-hover); }
.text-link {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
}

/* Sheets */
main { padding: 24px var(--gutter) 0; }

.sheet {
    max-width: 880px;
    margin: 0 auto 24px;
    padding: var(--sheet-pad);
    padding-top: 20px;
    background: var(--paper);
    border-radius: 2px;
    box-shadow: 0 1px 2px rgba(20, 23, 28, 0.06), 0 8px 28px rgba(20, 23, 28, 0.07);
}

.sheet-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 12px;
    margin-bottom: clamp(28px, 5vw, 48px);
    border-bottom: 1px solid var(--rule);
    font-size: 0.75rem;
    color: var(--muted);
}

.sheet-title {
    font-size: clamp(1.5rem, 3.2vw, 2rem);
    font-weight: 600;
    letter-spacing: -0.02em;
}
.sheet-title .code {
    font-size: 0.7em;
    font-weight: 500;
    color: var(--accent);
    margin-right: 0.35em;
    letter-spacing: 0;
}

.objective {
    margin-top: 12px;
    margin-bottom: 32px;
    color: var(--muted);
    max-width: 65ch;
}
.label {
    display: inline-block;
    margin-right: 8px;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--ink);
}

.sub-title {
    margin: 40px 0 16px;
    font-size: 1.0625rem;
    font-weight: 600;
}

/* Cover: the one dark sheet */
.sheet-cover {
    position: relative;
    padding-top: 0;
    padding-bottom: var(--sheet-pad);
    background: var(--navy);
    color: var(--on-navy);
    overflow: hidden;
}
.sheet-cover ::selection { background: var(--accent-on-navy); color: var(--navy); }
.sheet-cover :focus-visible { outline-color: var(--accent-on-navy); }

.classification {
    margin: 0 calc(var(--sheet-pad) * -1) 20px;
    padding: 8px var(--sheet-pad);
    background: var(--on-navy);
    color: var(--navy);
    font-size: 0.8125rem;
    font-weight: 500;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.3em;
}

.sheet-cover .sheet-head {
    color: var(--on-navy-muted);
    border-bottom-color: var(--navy-rule);
}

.cover-body { margin-bottom: clamp(48px, 7vw, 72px); }
.sheet-cover h1 {
    font-size: clamp(3.5rem, 14vw, 7.5rem);
    font-weight: 600;
    letter-spacing: -0.035em;
    line-height: 0.95;
}
.cover-bio {
    margin-top: 28px;
    max-width: 58ch;
    font-size: clamp(1.0625rem, 1.6vw, 1.25rem);
    line-height: 1.6;
}

.sheet-cover .btn-primary { background: var(--accent-on-navy); color: var(--navy); }
.sheet-cover .btn-primary:hover { background: var(--accent-on-navy-hover); }
.sheet-cover .btn-secondary { background: transparent; color: var(--on-navy); border-color: var(--on-navy-muted); }
.sheet-cover .btn-secondary:hover { border-color: var(--on-navy); background: rgba(232, 237, 244, 0.08); }
.sheet-cover .btn:hover { box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35); }
.cover-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 32px;
}

.doc-control {
    position: relative;
    border: 1.5px solid var(--on-navy-muted);
    border-radius: var(--radius);
}
.doc-control .kv-row + .kv-row { border-top-color: var(--navy-rule); }
.doc-control .kv dt { color: var(--on-navy-muted); }
.doc-control-title {
    padding: 10px 16px;
    border-bottom: 1.5px solid var(--on-navy-muted);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.kv { margin: 0; }
.kv-row {
    display: grid;
    grid-template-columns: 128px 1fr;
    gap: 16px;
    padding: 12px 16px;
}
.kv-row + .kv-row { border-top: 1px solid var(--rule); }
.kv dt {
    font-family: var(--mono);
    font-size: 0.8125rem;
    color: var(--muted);
    padding-top: 2px;
}
.kv dd { margin: 0; }
.rev-value { font-weight: 500; }

/* Contents */
.toc {
    list-style: none;
    margin: 32px 0 0;
    padding: 0;
    border-top: 1px solid var(--rule);
}
.toc li { border-bottom: 1px solid var(--rule); }
.toc a {
    display: flex;
    align-items: baseline;
    gap: 16px;
    min-height: 56px;
    padding: 16px 4px;
    color: var(--ink);
    text-decoration: none;
    transition: background-color 160ms var(--ease-out);
}
.toc a:hover { background: var(--accent-tint); }
.toc a:hover .toc-name { text-decoration: underline; text-underline-offset: 0.2em; }
.toc-code { width: 3.5rem; flex: none; color: var(--accent); font-weight: 500; }
.toc-name { font-size: 1.125rem; font-weight: 500; }
.toc-leader {
    flex: 1;
    border-bottom: 1.5px dotted var(--private-edge);
    transform: translateY(-4px);
}
.toc-page { color: var(--muted); font-size: 0.875rem; }

/* ID-1 */
.lede {
    font-family: var(--mono);
    font-size: 0.875rem;
    padding: 12px 0;
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
    margin-bottom: 28px;
}
.prose { max-width: 68ch; }
.prose p + p { margin-top: 1em; }

.tags {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.tags li {
    padding: 4px 10px;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    font-size: 0.875rem;
}

/* Tables */
.table-scroll {
    overflow-x: auto;
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    -webkit-overflow-scrolling: touch;
}
.register {
    width: 100%;
    min-width: 640px;
    border-collapse: collapse;
    font-size: 0.9375rem;
}
.register-compact { min-width: 480px; }
.register th,
.register td {
    padding: 12px 16px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--rule);
}
.register tbody tr:last-child > * { border-bottom: 0; }
.register thead th {
    background: #F4F6F8;
    font-family: var(--mono);
    font-size: 0.75rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted);
}
.register tbody th { font-weight: 600; min-width: 168px; }
.register tbody tr { transition: background-color 160ms var(--ease-out); }
.register tbody tr:hover { background: #F7F9FB; }
.ref { color: var(--muted); white-space: nowrap; font-size: 0.8125rem; }
.register td:nth-child(3) { color: var(--muted); min-width: 260px; }
.register-compact td:nth-child(3) { color: var(--ink); min-width: 0; }
.register-compact td.muted { color: var(--muted); }

.row-link,
.row-nolink {
    display: flex;
    align-items: center;
    width: fit-content;
    min-height: 44px;
    margin-bottom: -10px;
    font-weight: 400;
    font-size: 0.875rem;
    white-space: nowrap;
}
.row-nolink { color: var(--muted); }

/* Status chips: label and lightness carry the meaning, not hue */
.chip {
    display: inline-flex;
    align-items: center;
    padding: 3px 9px;
    border: 1.5px solid;
    border-radius: 3px;
    font: 500 0.75rem/1.4 var(--mono);
    letter-spacing: 0.02em;
    white-space: nowrap;
}
.chip-production { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.chip-published { background: var(--paper); border-color: var(--accent); color: var(--accent); }
.chip-private { background: var(--private-bg); border-color: var(--private-edge); border-style: dashed; color: var(--private-ink); }

.legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px 28px;
    margin: 20px 0 0;
    font-size: 0.875rem;
    color: var(--muted);
}
.legend div { display: flex; align-items: center; gap: 10px; }
.legend dd { margin: 0; }

/* AW-3 */
.attest {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--rule);
}
.attest-item {
    display: grid;
    grid-template-columns: 88px 1fr;
    gap: 16px;
    padding: 20px 0;
    border-bottom: 1px solid var(--rule);
}
.attest-item .ref { padding-top: 3px; }
.attest-body h3 { font-size: 1.125rem; font-weight: 600; }
.attest-body p:not(.meta) { margin-top: 8px; max-width: 65ch; }
.meta {
    margin-top: 4px;
    font-size: 0.8125rem;
    color: var(--muted);
}

/* AT-4 */
.log {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--rule);
}
.log-entry {
    display: grid;
    grid-template-columns: 168px 1fr;
    gap: 24px;
    padding: 24px 0;
    border-bottom: 1px solid var(--rule);
}
.log-time {
    font-size: 0.8125rem;
    color: var(--ink);
    padding-top: 3px;
    white-space: nowrap;
}
.log-body h3 { font-size: 1.125rem; font-weight: 600; }
.log-body ul {
    margin: 12px 0 0;
    padding-left: 1.1em;
    max-width: 68ch;
}
.log-body li + li { margin-top: 6px; }
.log-body li::marker { color: var(--muted); }

/* CM-5 */
.signoff-statement { font-size: 1.125rem; font-weight: 500; }
.signature {
    margin: 28px 0 32px;
    max-width: 360px;
}
.signature-name {
    display: block;
    font-style: italic;
    font-size: 2rem;
    line-height: 1.2;
    padding: 0 4px 6px;
    letter-spacing: -0.01em;
}
.signature-line {
    display: block;
    padding-top: 6px;
    border-top: 1.5px solid var(--ink);
    font-size: 0.75rem;
    color: var(--muted);
}
.kv-contact {
    border-top: 1px solid var(--rule);
    border-bottom: 1px solid var(--rule);
}
.kv-contact .kv-row { padding: 4px 0; align-items: center; }
.kv-contact dt { padding-top: 0; }
.kv-contact dd { min-width: 0; overflow-wrap: anywhere; }

/* Reviewer marks */
.ink-stamp {
    position: absolute;
    top: -30px;
    right: 20px;
    width: 176px;
    color: var(--stamp-red-on-navy);
    transform: rotate(-8deg);
    pointer-events: none;
    mix-blend-mode: screen;
}
.ink-stamp-art { display: block; width: 100%; height: auto; overflow: visible; }

.tick {
    display: inline-flex;
    width: 15px;
    height: 15px;
    margin-left: 6px;
    vertical-align: -1px;
    color: var(--stamp-red);
}
.tick svg { width: 100%; height: 100%; }

mark.hl {
    color: inherit;
    padding: 0 2px;
    margin: 0 -2px;
    background-color: transparent;
    background-image: linear-gradient(var(--highlight), var(--highlight));
    background-repeat: no-repeat;
    background-position: 0 60%;
    background-size: 100% 78%;
}
/* Highlighted text in a muted cell reads in full ink, not gray on yellow */
.register mark.hl { color: var(--ink); }

.log-entry { position: relative; }
.margin-note {
    position: absolute;
    top: 64px;
    left: 0;
    width: 152px;
    font-family: "Caveat", cursive;
    font-weight: 500;
    font-size: 1.375rem;
    line-height: 1.1;
    color: var(--stamp-red);
    transform: rotate(-4deg);
    transform-origin: left top;
}

/* Footer */
.page-foot {
    max-width: 880px;
    margin: 0 auto;
    padding: 8px var(--gutter) 40px;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 8px 16px;
    font-size: 0.8125rem;
    color: var(--muted);
}

/* Phone */
@media (max-width: 640px) {
    .topbar-doc { display: none; }
    .topbar-name { margin-right: auto; }
    main { padding-top: 16px; }
    .sheet { margin-bottom: 16px; }
    .sheet-head span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .sheet-head span:last-child { flex: none; white-space: nowrap; }
    .kv-row { grid-template-columns: 1fr; gap: 2px; }
    .kv-contact .kv-row { padding: 8px 0 4px; }
    .attest-item,
    .log-entry { grid-template-columns: 1fr; gap: 6px; }
    .cover-actions .btn { flex: 1 1 100%; }
    .toc-code { width: 3rem; }
    .ink-stamp { width: 152px; top: -36px; right: 10px; }
    .margin-note {
        position: static;
        width: auto;
        margin-top: 10px;
        transform: rotate(-2deg);
    }
}

@media print {
    body { background: #fff; }
    .topbar, .skip-link, .page-foot, .cover-actions { display: none; }
    main { padding: 0; }
    .sheet { box-shadow: none; margin: 0; break-after: page; }
}
