:root {
    --chunky-text: #777;
    --server-bg: hsl(190, 60%, 80%);
    --client-bg: hsl(142, 61%, 82%);
    --server-bg-hover: hsl(288, 28%, 83%);
    --client-bg-hover: hsl(288, 31%, 80%);

    --sam-btn0: hsl(190, 30%, 45%);
    --sam-btn9: hsl(190, 25%, 40%);
    --sam-hov-btn0: hsl(190, 30%, 40%);
    --sam-hov-btn9: hsl(190, 25%, 35%);
    --sam-btn-shadow: hsl(180, 41%, 28%);
    --sam-btn-inset: hsl(180, 45%, 40%);
    --sam-btn-border: hsl(161, 10%, 37%);

    --act-btn0: hsl(37, 96%, 54%);
    --act-btn9: hsl(25, 91%, 54%);
    --act-hov-btn0: hsl(32, 94%, 52%);
    --act-hov-btn9: hsl(21, 88%, 51%);
    --act-btn-shadow: hsl(25, 91%, 40%);
    --act-btn-border: hsl(33, 90%, 45%);
}

/* remove focus rings for non-keyboard users */
body:not(.user-is-tabbing) button:focus,
body:not(.user-is-tabbing) input:focus,
body:not(.user-is-tabbing) select:focus,
body:not(.user-is-tabbing) textarea:focus {
    outline: none;
}

body {
    /* printmode */
    position: relative;
}

.container {
    /* printmode */
    overflow: auto;
}

/* hide keys when there is no room for them */
@media (max-width: 600px) {
    .illustration {
        display: none !important;
    }
    .print-mode {
        display: none;
    }
}

h1:after {
    content: "\00a0❧";
}
h1:before {
    content: "❧\00a0";
}
h1, h3, h5 {
    text-align: center;
    padding: 10px;
    max-width: 800px;
    margin: 0 auto;
}
h5 {
    font-style: italic;
    font-family: serif;
}

pre {
    margin: 1em 0;
    overflow: scroll;
    -ms-overflow-style: scrollbar;
}

pre code {
    font-size: inherit;
    word-break: normal;
    display: block;
    color: white;
    background-color: black;
    padding: 0.5em;
    border-radius: 5px;
    overflow: scroll;
    -ms-overflow-style: scrollbar;
}

ol, ul, dl {
  margin: 1rem 0;
}

tt.longboi {
    word-break: break-all;
}

.ind1 {
    padding-left: 1em;
}
.ind2 {
    padding-left: 2em;
}

.outerblock {
    max-width: 600px;
    margin: 1em auto;
}
.outerblock p {
    text-align: center;
}

.server {
    background-color: var(--server-bg);
}

.client {
    background-color: var(--client-bg);
}

/***** .record and .calculation *****/

.rec-outer {
    max-width: 800px;
    margin: 0.8em auto;
}

.record, .calculation {
    cursor: pointer;
    max-width: 800px;
    padding: 1em;
    border-radius: 1em;
    border: 2px solid transparent;
    box-shadow: 2px 2px 2px rgba(0,0,0,0.3);
}

.record.embedded {
    margin-left: 2em;
}

.embed-arrow {
    position: absolute;
    font-size: 2em;
    color: var(--chunky-text);
}

.illustrated .server.record .rec-label:before {
    content: "❰ ";
    color: var(--chunky-text);
}
.illustrated .client.record .rec-label:before {
    content: "❱ ";
    color: var(--chunky-text);
}
.illustrated .server.record.embedded .rec-label:before,
.illustrated .client.record.embedded .rec-label:before {
    content: "";
}
.illustrated .calculation .rec-label:before {
    content: "± ";
    font-weight: bold;
    color: var(--chunky-text);
}

.rec-label {
    cursor: pointer;
    font-size: 1.3em;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;

    white-space: nowrap;
    text-align: center;
    width: 100%;
    transition: all 0.3s;
}

.record.selected,
.calculation.selected {
    cursor: inherit;
    box-shadow: 2px 2px 2px rgba(0,0,0,0.3);
}

.record.selected .rec-label,
.calculation.selected .rec-label {
    padding: 0 0 10px 0;
    width: 0;
}
.illustrated .record.selected .rec-label:after,
.illustrated .calculation.selected .rec-label:after {
    color: var(--chunky-text);
    content: " ×";
    font-weight: bold;
    cursor: pointer;
}

.record .record-data {
    font-family: Menlo, Monaco, Consolas, "Courier New", monospace;
    display: none;
    position: relative;
}

.record.selected .record-data {
    display: block;
}

.record:hover,
.calculation:hover {
    border: 2px solid #666;
}
.record.selected:hover,
.calculation.selected:hover {
    border: 2px solid transparent;
}

.rec-explanation {
    display: none;
    margin-bottom: 1em;
}
.selected .rec-explanation {
    display: block;
}

.record .illustration,
.calculation .illustration {
    margin: -40px 0 0 0;
    display: none;
    float: right;
}
.record.selected .illustration,
.calculation.selected .illustration {
    display: block;
}

.record > button.annotate-toggle {
    display: none;
}
.record.selected > button.annotate-toggle {
    display: block;
}

/***** .record-data *****/

.client .record-data .string .bytes:hover {
    background-color: var(--client-bg-hover);
}
.server .record-data .string .bytes:hover {
    background-color: var(--server-bg-hover);
}
.record.annotate .record-data .string:hover {
    color: inherit;
}

.record-data .string {
    position: relative;
}

.record-data .string .label {
    display: none;
    position: absolute;
    background-color: #FAF7DC;
    border-radius: 5px;
    margin: 2px 0;
    padding: 2px 7px;
    line-height: 1.2;
    white-space: nowrap;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    top: -28px;
    box-shadow: 2px 2px 2px rgba(0,0,0,0.3);
}
.record-data .string:hover > .label {
    display: inline;
}

.record-data .string .label:after {
    content: "";
    position: absolute;
    box-shadow: 2px 2px 2px rgba(0,0,0,0.3);
    transform: rotate(45deg);
    bottom: -3px;
    left: 10px;
    border-width: 3px;
    border-style: solid;
    border-color: transparent #FAF7DC #FAF7DC transparent;
}

.record.annotate .string > .explanation,
.record.annotate .decryption > .explanation {
    position: relative;
    display: block;
    font-size: 0.9em;
    color: black;
    margin: 1em 0;
    padding: 1em;
    background-color: #FAF7DC;
    border: 2px solid #e0d998;
    border-radius: 1em;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    box-shadow: 2px 2px 2px rgba(0,0,0,0.3);
}

.record.annotate .string > .explanation:before {
    content: " ";
    position: absolute;
    padding: 5px;
    transform: rotate(45deg);
    top: -7px;
    left: 20px;
    border: 2px solid;
    background-color: #FAF7DC;
    border-color: #e0d998 transparent transparent #e0d998;
}

.record.annotate .string > .label {
    display: none;
}

.record .string > .explanation,
.record .decryption > .explanation {
    display: none;
}

.record .decryption > .label:before {
    content: "⬇ ";
    font-weight: bold;
    color: var(--chunky-text);
}
.record .decryption > .label:after {
    content: " ⬇";
    font-weight: bold;
    color: var(--chunky-text);
}

.string .bytes {
    padding: 0.2em 0;
}

.string.encrypted .bytes {
    text-shadow: 1px 1px 0 red;
}

.string.decrypted .bytes {
    text-shadow: 1px 1px 0 green;
}

.record-data .decryption {
    margin: 1em 0;
}

.record-data .decryption .label {
    text-align: center;
}

/***** processblock *****/

processblock {
    display: block;
    position: relative;
    margin: 1em;
    padding-left: 1em;
    overflow: hidden;
    transition: all 0.3s;
    cursor: pointer;

    font-size: 0.8em;
}

processblock:before {
    content: " ";
    width: 100%;
    height: 100%;
    position: absolute;
    left: 0;
    top: 0;
    pointer-events: none;
}

processblock pre {
    margin: 0;
}

/***** codesample *****/

codesample {
    display: block;
    margin: 1em 0;
}

codesample pre {
    margin: 0;
    height: 0;
}

codesample button.show-code {
    display: block;
    clear: both;
    box-shadow: inset 0 1px 3px 0 var(--sam-btn-inset);
    background: linear-gradient(to bottom, var(--sam-btn0) 1%, var(--sam-btn9) 100%);
    border-radius:5px;
    border: 1px solid var(--sam-btn-border);
    cursor: pointer;
    color: white;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 15px;
    font-weight: bold;
    padding: 11px 23px;
    text-decoration: none;
    text-shadow: 0 -1px 0 var(--sam-btn-shadow);
}

codesample button.show-code:hover:hover {
    background: linear-gradient(to bottom, var(--sam-hov-btn0) 1%, var(--sam-hov-btn9) 100%);
}
codesample button.show-code:active {
    position: relative;
    top: 1px;
}
codesample.show button.show-code {
    display: none;
}
codesample.show pre {
    height: auto;
}

/***** annotation toggle button *****/

button.annotate-toggle {
    margin-bottom: 1em;

    display: inline-block;
    outline: none;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 1em;
    padding: .4em 1.7em .45em;
    text-shadow: 0 1px 1px var(--act-btn-shadow);
    border-radius: .5em;
    box-shadow: 1px 1px 1px rgba(0,0,0,0.3);

    color: #fff;
    border: solid 1px var(--act-btn-border);
    background: linear-gradient(180deg, var(--act-btn0) 1%, var(--act-btn9) 100%);
}
button.annotate-toggle:hover {
    text-decoration: none;
    background: linear-gradient(180deg, var(--act-hov-btn0) 1%, var(--act-hov-btn9) 100%);
}
button.annotate-toggle:active {
    position: relative;
    top: 1px;
}

button#openCloseAll {
    margin-bottom: 0;
    min-width: 8em;
}

/***** print mode *****/
.print-mode {
    cursor: pointer;
    position: absolute;
    padding: 5px;
    bottom: 0;
    right: 0;
}

/***** header ******/

.header {
    width: 100%;
    margin: 0;
    padding: 2px;
    border-bottom: 1px solid grey;
    background-color: bisque;
    color: #444;
    line-height: 20px;
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    font-size: 14px;
    text-align: right;
}
.header a, .header a:visited, .header a:hover {
    text-decoration: none;
    color: #444;
}
.header a.this-page:before {
    content: "❧\00a0";
}
.header a, .header span {
    margin-right: 0.5em;
}
.header a.this-page {
    font-weight: bold;
}
