/* Founders' Agreement: a draft circulated for markup.
   One standard serif, upright throughout, black type on white paper, and two inks:
   blue for what a founder fills in, red for suggested edits and results. */


:root {
    --desk: #DDE1E6;
    --paper: #FFFFFF;
    --type: #1A1A1A;
    --soft: #5B6068;
    --rule: #C4C9D0;
    --ink: #1E4BA8; /* ballpoint blue: founders' answers */
    --red: #A4271F; /* redline: edits and results */
    --red-wash: #F6E4E2;
    --gap: #EEF1F5;
    --face: "Times New Roman", Times, "Liberation Serif", serif;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root {
        --desk: #15181D;
        --paper: #23262C;
        --type: #E9E6DF;
        --soft: #A3A8B0;
        --rule: #444A53;
        --ink: #8FB0F2;
        --red: #F08A80;
        --red-wash: #43262A;
        --gap: #2D3138;
        color-scheme: dark;
    }
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--desk);
    color: var(--type);
    font: 17px/1.65 var(--face);
}

button, input, textarea {
    font: inherit;
    color: inherit;
}

/* plain buttons: a printed box, not a pill */
.btn {
    border: 1px solid var(--type);
    background: var(--paper);
    padding: .45em 1.1em;
    border-radius: 2px;
    cursor: pointer;
}

.btn:hover {
    background: var(--gap);
}

.btn.primary {
    background: var(--type);
    color: var(--paper);
}

.btn.primary:hover {
    background: var(--soft);
    border-color: var(--soft);
}

.btn.danger {
    border-color: var(--red);
    color: var(--red);
}

.linkish {
    background: none;
    border: 0;
    padding: 0;
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}

:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

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

.error {
    color: var(--red);
    min-height: 1.6em;
    margin: .6em 0 0;
}

/* ---------- sign in ---------- */
.login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px 16px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--paper);
    padding: 56px 44px 40px;
}

.login-card h1 {
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1.2;
    margin: 0;
}

.login-card p.muted {
    margin: .2em 0 2.4em;
}

.login-card label {
    display: block;
    margin-bottom: .2em;
}

.login-card input {
    width: 100%;
    padding: .35em 0;
    border: 0;
    border-bottom: 1px solid var(--type);
    background: transparent;
    color: var(--ink);
}

.login-card input:focus-visible {
    outline: none;
    border-bottom-width: 2px;
}

.login-card .btn {
    margin-top: 1.6em;
}

/* ---------- the page ---------- */
.doc {
    max-width: 820px;
    margin: 48px auto 64px;
    background: var(--paper);
    padding: 72px 84px 64px;
    box-shadow: 0 1px 0 var(--rule), 0 0 0 1px var(--rule);
}

.doc h2 {
    font-size: 1.05rem;
    font-weight: 700;
    margin: 2.4em 0 .5em;
}

.doc h3 {
    font-size: 1rem;
    font-weight: 400;
    margin: 1.8em 0 .4em;
}

#doc-body > .center:first-child {
    margin-bottom: 2.8em;
}

#doc-body > .center:first-child p {
    line-height: 1.5;
}

#doc-body > .center:first-child p:first-child::first-line {
    font-size: 1.7rem;
    font-weight: 700;
    line-height: 1.8;
}

.doc .center {
    text-align: center;
}

.doc p {
    margin: .4em 0;
}

.doc ol, .doc ul {
    padding-left: 0;
    margin: .5em 0;
}

.doc ol {
    list-style: none;
}

.doc ol > li {
    display: grid;
    grid-template-columns: 3.1rem minmax(0, 1fr);
    margin: .65em 0;
}

.doc ol > li > .num {
    font-variant-numeric: lining-nums;
}

.doc ul {
    padding-left: 1.3rem;
}

.doc ul > li {
    margin: .25em 0;
}

.doc .ref {
    color: inherit;
    text-decoration: none;
}

.doc .gap {
    background: var(--gap);
    padding: 0 .3em;
    color: var(--soft);
}

.doc .sigline {
    display: inline-block;
    width: 11rem;
    border-bottom: 1px solid var(--type);
}

.doc .table-wrap {
    overflow-x: auto;
    margin: 1em 0;
}

.doc table {
    border-collapse: collapse;
    font-size: .92rem;
    min-width: 100%;
}

.doc th, .doc td {
    text-align: left;
    padding: .35em .7em .35em 0;
    border-bottom: 1px solid var(--rule);
    vertical-align: top;
}

.doc th {
    font-weight: 700;
    border-bottom-color: var(--type);
}

.doc .center table {
    margin: 0 auto;
}

.doc p.sign {
    margin: 1.6em 0;
}

/* ---------- filling in the draft ----------
   An option reads [fair value / nominal value]; choosing one strikes out the other. */
.q-wrap {
    display: inline;
}

.q-wrap.block {
    display: block;
    margin: .4em 0;
}

.choices .keep {
    white-space: nowrap;
}

.choices .bracket, .choices .slash {
    color: var(--soft);
}

.choices .slash {
    padding: 0 .3em;
}

.choice {
    display: inline;
    white-space: normal;
    background: none;
    border: 0;
    padding: 0;
    margin: 0;
    cursor: pointer;
    text-align: left;
    line-height: inherit;
    text-decoration: underline dotted var(--soft);
    text-underline-offset: 4px;
}

.choice:hover:not(:disabled) {
    color: var(--ink);
    text-decoration-color: var(--ink);
}

.choice[aria-checked="true"] {
    color: var(--ink);
    text-decoration: none;
}

.choices.decided .choice[aria-checked="false"] {
    color: var(--soft);
    text-decoration: line-through 1.5px var(--red);
}

.choice:disabled {
    cursor: default;
}

/* a blank is a dotted line written on in blue */
.q input, .q textarea {
    border: 0;
    border-bottom: 1px dotted var(--soft);
    background: transparent;
    color: var(--ink);
    padding: 0 .2em;
    border-radius: 0;
}

.q input::placeholder, .q textarea::placeholder {
    color: var(--soft);
    opacity: .8;
}

.q input:focus-visible, .q textarea:focus-visible {
    outline: none;
    border-bottom: 1.5px solid var(--ink);
    background: var(--gap);
}

.q input[type="number"] {
    width: 3.2em;
    text-align: left;
    -moz-appearance: textfield;
}

.q input[type="number"]::-webkit-inner-spin-button, .q input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.q input[type="text"] {
    width: 13em;
    max-width: 100%;
}

.q input[type="date"] {
    width: 9.5em;
}

.q input:disabled, .q textarea:disabled {
    border-bottom-style: solid;
    border-bottom-color: transparent;
    -webkit-text-fill-color: var(--ink);
    opacity: 1;
}

.q textarea {
    display: block;
    width: 100%;
    min-height: 4.95em;
    resize: vertical;
    line-height: 1.65;
    border: 0;
    background-image: repeating-linear-gradient(transparent 0 calc(1.65em - 1px), var(--rule) calc(1.65em - 1px) 1.65em);
}

/* ---------- suggested edits (redline) ---------- */
mark.sugg {
    background: none;
    color: inherit;
    cursor: pointer;
    text-decoration: underline 2px var(--red);
    text-underline-offset: 3px;
    text-decoration-skip-ink: none;
}

mark.sugg.mine {
    background: var(--red-wash);
}

mark.sugg:hover {
    background: var(--red-wash);
}

.sel-btn {
    position: absolute;
    z-index: 30;
    background: var(--paper);
    color: var(--type);
    border: 1px solid var(--type);
    border-radius: 2px;
    padding: .3em .8em;
    font-size: .9rem;
    cursor: pointer;
    box-shadow: 3px 3px 0 var(--rule);
    white-space: nowrap;
}

.sel-btn:disabled {
    color: var(--soft);
    border-color: var(--rule);
    cursor: default;
}

.popover {
    position: absolute;
    z-index: 40;
    width: min(400px, calc(100vw - 32px));
    background: var(--paper);
    color: var(--type);
    border: 1px solid var(--type);
    border-radius: 2px;
    box-shadow: 4px 4px 0 var(--rule);
    padding: 16px 18px;
    font-size: .95rem;
    line-height: 1.5;
}

.popover .pop-loc {
    font-weight: 700;
    margin: 0 0 .5em;
}

.popover blockquote {
    margin: 0 0 .8em;
    padding-left: .8em;
    border-left: 2px solid var(--rule);
    color: var(--soft);
    max-height: 7.5em;
    overflow: auto;
}

.popover label {
    display: block;
    margin: .7em 0 .2em;
}

.popover textarea {
    width: 100%;
    border: 1px solid var(--rule);
    border-radius: 0;
    background: var(--paper);
    padding: .4em .5em;
    resize: vertical;
    color: var(--ink);
}

.popover textarea:focus-visible {
    outline: none;
    border-color: var(--ink);
}

.popover .pop-actions {
    display: flex;
    gap: .5em;
    justify-content: flex-end;
    margin-top: 1em;
}

.popover .pop-actions .spacer {
    flex: 1;
}

.popover .item + .item {
    border-top: 1px solid var(--rule);
    margin-top: .8em;
    padding-top: .8em;
}

.popover .who {
}

.popover .why {
    color: var(--soft);
    margin-top: .25em;
}

.popover .err {
    color: var(--red);
    margin: .5em 0 0;
    min-height: 1.3em;
}

.diff del {
    color: var(--soft);
    text-decoration: line-through 1.5px var(--red);
}

.diff ins {
    color: var(--red);
    text-decoration: underline 1px var(--red);
    text-underline-offset: 3px;
}

/* ---------- results: a short note under the clause ---------- */
.result {
    margin: .5em 0 .9em;
    padding-left: .9em;
    border-left: 2px solid var(--red);
    font-size: .9rem;
    color: var(--soft);
}

.result p {
    margin: .15em 0;
}

.result b {
    font-weight: 700;
    color: var(--type);
}

.result .carried {
    color: var(--red);
}

.result .ink {
    color: var(--ink);
}

/* ---------- end of the document ---------- */
.end {
    margin-top: 3.6em;
    padding-top: .4em;
    border-top: 1px solid var(--type);
}

.end h2 {
    margin-top: 1.8em;
}

.end .hint {
    color: var(--soft);
    margin: 0 0 .6em;
}

.end textarea.notes {
    display: block;
    width: 100%;
    min-height: calc(1.65em * 6);
    border: 0;
    border-top: 1px solid var(--rule);
    padding: 0 .2em;
    background: transparent repeating-linear-gradient(transparent 0 calc(1.65em - 1px), var(--rule) calc(1.65em - 1px) 1.65em);
    line-height: 1.65;
    color: var(--ink);
    resize: vertical;
}

.end textarea.notes:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 4px;
}

.end .sugg-list {
    list-style: none;
    padding: 0;
}

.end .sugg-list li {
    padding: .6em 0;
    border-bottom: 1px solid var(--rule);
}

.end .sugg-list .meta {
    color: var(--soft);
    font-size: .9rem;
}

.end .sugg-list .meta button {
    margin-left: .8em;
    font-size: .9rem;
    color: var(--soft);
}

.end .note-item {
    margin: .8em 0 1.2em;
}

.end .note-item .who {
    color: var(--soft);
}

.end .note-item p {
    white-space: pre-wrap;
    margin: .2em 0;
    color: var(--ink);
}

.status p {
    margin: .4em 0;
}

.status .row {
    display: flex;
    gap: .7em;
    align-items: center;
    flex-wrap: wrap;
    margin: 1.4em 0 .8em;
}

.status .saved {
    color: var(--soft);
    font-size: .9rem;
}

.status .account {
    color: var(--soft);
    font-size: .9rem;
    margin-top: 2.4em;
}

.toast {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 50;
    background: var(--paper);
    color: var(--red);
    border: 1px solid var(--red);
    border-radius: 2px;
    box-shadow: 3px 3px 0 var(--rule);
    padding: .5em 1em;
    max-width: calc(100vw - 32px);
}

@media (max-width: 760px) {
    body {
        font-size: 16px;
    }

    .doc {
        margin: 0;
        padding: 36px 20px 48px;
        box-shadow: none;
    }

    .doc ol > li {
        grid-template-columns: 2.5rem minmax(0, 1fr);
    }

    #doc-body > .center:first-child p:first-child::first-line {
        font-size: 1.4rem;
    }
}

@media print {
    body {
        background: #fff;
    }

    .doc {
        box-shadow: none;
        margin: 0;
        max-width: none;
        padding: 0;
    }

    .end, .sel-btn, .popover, .toast {
        display: none !important;
    }
}
