.preview {
    max-height: calc(100vh - 48px);
    max-width: 900px;
    padding: 15px;
    margin: 0 auto;
    color: var(--text-color);
    background-color: transparent;
    display: none;
    overflow: scroll;
    font-family: var(--font-text);
    box-sizing: border-box;
}

.preview:focus {
    outline:none;
}

.preview.on {
    display: block;
}

/* titles */

.preview h1, .preview h2, .preview h3, .preview h4, .preview h5, .preview h6 {
    width: 100%;
    font-family: var(--font-title);
    color: var(--title-color);
    padding-top: 15px;
}

/* .preview h1, .preview h2 {
    border-bottom: 1px solid var(--border-light-color);
} */

/* rules */
.preview hr {
    border: 0;
    border-bottom: 1px solid var(--border-light-color);
    width: 100%;
    margin-top: 30px;
    margin-bottom: 30px;
}

/* text effects */

.preview del:hover {
    text-decoration: none;
}

/* quotes */

.preview blockquote {
    border-left: 2px solid var(--border-light-color);
    padding-left: 15px;
}

.preview .quote-label {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    font-size: large;
}

.preview blockquote.quote-generic,
.preview blockquote.quote-blue,
.preview blockquote.quote-green,
.preview blockquote.quote-purple,
.preview blockquote.quote-yellow,
.preview blockquote.quote-red {
    padding: 10px 15px 10px 15px;
    border-radius: 15px;
    box-shadow: var(--shadow);
}

.preview blockquote.quote-generic {
    border: 1px solid var(--border-light-color);
    background-color: var(--background-color-3);
}

.preview blockquote.quote-blue {
    border: 1px solid var(--quote-blue);
    background-color: var(--quote-blue-bg);
}

.preview .quote-blue-label {
    color: var(--quote-blue);
}

.preview blockquote.quote-green {
    border: 1px solid var(--quote-green);
    background-color: var(--quote-green-bg);
}

.preview .quote-green-label {
    color: var(--quote-green);
}

.preview blockquote.quote-purple {
    border: 1px solid var(--quote-purple);
    background-color: var(--quote-purple-bg);
}

.preview .quote-purple-label {
    color: var(--quote-purple);
}

.preview blockquote.quote-yellow {
    border: 1px solid var(--quote-yellow);
    background-color: var(--quote-yellow-bg);
}

.preview .quote-yellow-label {
    color: var(--quote-yellow);
}

.preview blockquote.quote-red {
    border: 1px solid var(--quote-red);
    background-color: var(--quote-red-bg);
}

.preview .quote-red-label {
    color: var(--quote-red);
}

.preview .code-container {
    position: relative;
    margin: 20px 0;
    border-radius: 10px;
    background-color: var(--background-color-2);
    max-width: 100%;
    overflow-x: scroll;
    padding: 0;
}

.preview .code-container .code-head {
    position: absolute;
    top: 8px;
    right: 12px;
    z-index: 2;
    background: none;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-editor);
    justify-content: end;
    border-radius: 8px;
}

.preview .code-container pre,
.preview .code-container pre.ghcodeblock {
    margin: 0;
    border-radius: 10px;
    background: none;
    box-shadow: none;
    max-width: 100%;
    overflow-x: auto;
    padding: 18px 10px 10px 10px;
    position: relative;
}

.preview .code-container code {
    background: transparent;
    padding: 0;
    border-radius: 0;
    font-size: medium;
}

.preview .code-container .code-head button {
    border: 0;
    padding: 0;
    width: 24px;
    height: 24px;
    border-radius: 100px;
    background-color: var(--background-color-2);
    cursor: pointer;
}

.preview .code-head {
    all: unset;
}

.preview code {
    background-color: var(--background-color-2);
    padding: 2px;
    padding-left: 10px;
    padding-right: 10px;
    border-radius: 8px;
    font-family: var(--font-editor);
    font-size: medium;
}

.preview .colorSwatch {
    display: inline-block;
    width: .7em;
    height: .7em;
    vertical-align: middle;
    border-radius: 30px;
}

/* images */

.preview .media-container {
    position: relative;
    display: inline-block;
}

.preview .media-container div {
    position: absolute;
    top: 10px;
    left: 15px;
    color: white;
    font-size: large;
    display: none;
    opacity: 0%;
    z-index: 2;
    transition: opacity 1s;
    max-width: 80%;
    box-sizing: border-box;
    text-shadow: 0px 0px 10px black;
}

.preview .media-container div .alt,
.preview .media-container div .url {
    display: block;
}

.preview .media-container div .url {
    font-size: small;
}

.preview .media-container:hover div {
    display: block;
    opacity: 100%;
}

.preview .media-container img,
.preview .media-container video {
    display: block;
    max-width: 100%;
    border-radius: 10px;
    transition: filter 0.3s;
}

.preview .media-container:hover img,
.preview .media-container:hover video {
    filter: brightness(.6);
}

.preview .media-container:hover video:fullscreen {
    filter: brightness(1);
    border-radius: 0px;
}

.preview .media-container audio + div,
.preview .media-container:hover audio + div {
    display: none !important;
    opacity: 0 !important;
}

/* links */

.preview a {
    color: var(--link-color);
    display: inline-flex;
    align-items: center;
    gap: 5px;
    text-decoration: none;
}

.preview a:hover {
    text-decoration: underline;
}

.preview a img.favicon {
    border: none;
    width: 16px;
    height: 16px;
    border-radius: 2px;
    margin: 0px;
}

/* lists */

.preview li {
    margin-bottom: 10px;
}

.preview input[type="checkbox"] {
    font-family: "Material Symbols Rounded";
    appearance: none;
    min-width: 18px;
    width: 18px;
    height: 18px;
    border: 1px solid var(--border-light-color);
    border-radius: 5px;
    background-color: transparent;
    display: inline-block;
    position: relative;
    transition: background-color 0.3s, border-color 0.3s;
}

.preview input[type="checkbox"]:checked {
    background-color: var(--highlight-color);
    border-color: var(--highlight-color);
}

.preview input[type="checkbox"]:checked::after {
    content: "check";
    color: white;
    font-size: 18px;
    font-weight: 900;
    position: absolute;
    top: -2px;
    left: -1px;
}

.preview .task-list-item-complete {
    color: var(--highlight-color);
}

/* tables */

.preview .table-container, .preview .csv-table-container {
    width: 100%;
    overflow-x: scroll;
}

.preview table {
    margin: 20px 0;
    font-size: 1rem;
    border-spacing: 0;
    border-radius: 10px;
    overflow: hidden;
    border-bottom: 1px solid var(--border-light-color);
    border-right: 1px solid var(--border-light-color);
}

.preview th,
.preview td {
    padding: 12px 15px;
    text-align: left;
    transition: 0.3s;
    border: 1px solid var(--border-light-color);
    border-bottom: 0;
    border-right: 0;
}

.preview thead th {
    background-color: var(--background-color-2);
    color: var(--text-color);
    font-weight: bold;
}

.preview thead th:first-child {
    border-top-left-radius: 10px;
}
.preview thead th:last-child {
    border-top-right-radius: 10px;
}
.preview tbody tr:last-child td:first-child {
    border-bottom-left-radius: 10px;
}
.preview tbody tr:last-child td:last-child {
    border-bottom-right-radius: 10px;
}

.preview tr:hover td,
.preview tr:hover th {
    background-color: var(--background-color-3);
}

.preview table.csv-table tbody tr:first-child td:first-child {
    border-top-left-radius: 10px;
}
.preview table.csv-table tbody tr:first-child td:last-child {
    border-top-right-radius: 10px;
}

/* html stuff */
.preview input:not([type="checkbox"]) {
    background-color: var(--field-color);
    color: var(--text-color);
    border: 1px solid var(--border-light-color);
    padding: 5px 10px;
    border-radius: 8px;
    width: 300px;
    margin: 10px 40px 10px 40px;
}

.preview input:not([type="checkbox"]):focus {
    outline: 2px solid var(--highlight-color);
}

.preview iframe {
    width: 100%;
    justify-self: center;
    border-radius: 10px;
    min-height: 500px;
    border: 0;
}

.preview button {
    height: 30px;
    border-radius: 15px;
    padding-left: 10px;
    padding-right: 10px;
    border: 1px solid var(--border-light-color);
    background-color: var(--background-color-3);
    color: var(--text-color);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.preview embed {
    width: 100%;
    height: 600px;
    border-radius: 10px;
}

.preview math {
    display: block;
    max-width: 100%;
    padding: 10px;
    border-radius: 10px;
    background-color: var(--background-color-2);
    font-size: large;
}

.preview video {
    border-radius: 15px;
    cursor: pointer;
}

.preview mark {
    background-color: var(--quote-yellow-bg);
    color: var(--text-color);
    padding: 0 5px;
    border-radius: 5px;
}

.preview mark:nth-of-type(5n+1) {
    background-color: var(--quote-yellow-bg);
}

.preview mark:nth-of-type(5n+2) {
    background-color: var(--quote-green-bg);
}

.preview mark:nth-of-type(5n+3) {
    background-color: var(--quote-blue-bg);
}

.preview mark:nth-of-type(5n+4) {
    background-color: var(--quote-purple-bg);
}

.preview mark:nth-of-type(5n) {
    background-color: var(--quote-red-bg);
}

.preview .banner {
    height: 300px;
    width: 100%;
    object-fit: cover;
}

.preview dt {
    margin-top: 10px;
    margin-bottom: 5px;
}

.preview dt::after {
    opacity: 50%;
    font-style: italic;
}

.preview dd {
    font-style: italic;
    border-left: 1px solid var(--border-light-color);
    margin-left: 20px;
    padding-left: 20px;
}

.preview abbr {
    cursor: help;
}

.preview details {
    border: 1px solid var(--border-light-color);
    border-radius: 15px;
    box-shadow: var(--shadow);
    margin: 20px 0;
    transition: all 0.3s ease-in-out;
    overflow: hidden;
}

.preview details summary {
    background-color: var(--background-color-3);
    color: var(--title-color);
    font-size: large;
    cursor: pointer;
    user-select: none;
    list-style: none;
    align-items: center;
    position: relative;
    padding: 5px;
    border-radius: 10px;
    transition: all 0.3s;

    display: flex;
    align-items: center;
    gap: 10px;
}

.preview details summary::before {
    content: "expand_more";
    font-family: "Material Symbols Rounded";
    font-size: 24px;
    transform: rotate(-90deg);
    transition: transform 0.3s;
}

.preview details[open] summary {
    margin: 7px;
}

.preview details[open] summary::before {
    transform: rotate(0deg);
}

.preview details .content {
    padding: 12px 15px;
    overflow: scroll;
}

.preview input[type="number"] {
  font-size: 14px;
  width: 80px;
}

.preview input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    padding: 0;
    border: 0;
    border-radius: 100px;
}

.preview input[type="range"]:focus {
    outline: none;

    input[type="range"]::-moz-range-thumb,
    input[type="range"]::-webkit-slider-thumb {
        outline: 1px solid var(--highlight-color);
    }
}

.preview input[type="range"]::-moz-range-thumb,
.preview input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 100%;
    outline: 1px solid var(--border-light-color);
    background-color: var(--button-color-2);
}
.preview input[type="range"]::-moz-range-track {
    height: 4px;
    border-radius: 100px;
}
.preview input[type="range"]::-moz-range-progress {
    height: 4px;
    background-color: var(--highlight-color);
    border-radius: 100px;
}

.preview input[type="file"] {
    position: relative;
    width: 100%;
    height: 300px;
    box-sizing: border-box;
    margin: 0;
    border: 2px dashed var(--border-light-color);
    background-color: var(--background-color);
    border-radius: 8px;
    cursor: pointer;
    padding-top: calc(150px - 2ch);
    text-align: center;
}

.preview input[type="file"]::-webkit-file-upload-button,
.preview input[type="file"]::file-selector-button {
    visibility: hidden;
    display: none;
}

.preview input[type="file"]:hover,
.preview input[type="file"]:focus {
    background-color: var(--field-color);
}

.preview textarea {
    width: 100%;
    min-height: 100px;
    background-color: var(--field-color);
    color: var(--text-color);
    border: 1px solid var(--border-light-color);
    box-sizing: border-box;
    border-radius: 8px;
    outline: none;
    resize: vertical;
    padding: 8px;
    box-shadow: var(--shadow);
}

/* custom html */

.preview icon {
    font-family: "Material Symbols Rounded";
    font-size: x-large;
}

.preview blank-space {
    display: block;
    height: 100vh;
}

.preview .small {
    font-size: small;
    opacity: 50%;
    display: block;
}