@import url('https://fonts.googleapis.com/css2?family=Crimson+Pro:ital,wght@0,400;0,600;1,400&display=swap');
@font-face {
    font-family: "Courier Prime";
    font-weight: normal;
    font-style: normal;
    src: url("../font/courier-prime.ttf") format("truetype");
}

:root {
    /* --border: #999; */
    /* --light: #f4f4f4; */
    --panel-gap: 1rem;
    --max-width: 800px;
    /* --code-bg: #f4f4f4; */
    --border: #cfcfcf;
    --light: #f8f8f8;
    --code-bg: #f7f7f5;
    --code-border: #d8d8d3;
    --code-text: #222;
}

body {
    font-family: "Crimson Pro", serif;
    max-width: var(--max-width);
    margin: 0 auto;
    padding: 2rem;
    line-height: 1.25;
}

header {
    text-align: center;
    margin-top: 3rem;
    margin-bottom: 3rem;
}

h1 {
    font-size: 1.8rem;
    font-weight: bold;
    margin-bottom: 0.8rem;
    letter-spacing: 0.05em;
}

h2 {
    font-size: 1.4rem;
    font-weight: bold;
    padding-bottom: 0.3rem;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    letter-spacing: 0.05em;
}

h3 {
    font-size: 1.2rem;
    font-weight: bold;
    margin-top: 1rem;
    letter-spacing: 0.05em;
}

h4 {
    font-size: 0.9rem;
    margin-top: 1rem;
    letter-spacing: 0.05em;
}

section {
    margin: 2.5rem 0;
}
section[id] {
    scroll-margin-top: 5rem;
}

.mainmatter {
    counter-reset: chapter;
}
.mainmatter > section {
    counter-increment: chapter;
    counter-reset: section;
}
.mainmatter > section > h1::before {
    content: counter(chapter) ". ";
}
.mainmatter h2 {
    counter-increment: section;
    counter-reset: subsection;
}
.mainmatter h2::before {
    content: counter(chapter) "." counter(section) ". ";
}
.mainmatter h3 {
    counter-increment: subsection;
}
.mainmatter h3::before {
    content: counter(chapter) "." counter(section) "." counter(subsection) ". ";
}

.appendix {
    counter-reset: appendix;
}
.appendix > section {
    counter-increment: appendix;
}
.appendix > section > h1::before {
    content: "Dodatek " counter(appendix, upper-alpha) ". ";
}

.doc-page {
    max-width: 1000px;
}
.doc-layout {
    display: flex;
    gap: 2.5rem;
    align-items: flex-start;
    margin-top: 2rem;
}
.doc-content {
    flex: 1;
    min-width: 0;
}
.doc-content pre,
.doc-content .equation {
    overflow-x: auto;
}
.doc-content h1.unnumbered,
.doc-content h2.unnumbered {
    counter-increment: none;
}
.doc-content h1.unnumbered::before 
.doc-content h2.unnumbered::before {
    content: none;
}

.sidebar-title {
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #222;
    margin: 0 0 0.8rem;
    font-size: 0.95rem;
    padding-bottom: 0.3rem;
}
.doc-sidebar {
    width: 200px;
    flex-shrink: 0;
    position: sticky;
    top: 2rem;
    align-self: flex-start;
    font-size: 0.85rem;
    color: #555;
    line-height: 1.4;
    height: calc(100vh - 4rem);
    overflow-y: auto;
    padding-right: 0.5rem;
    counter-reset: toc-main toc-appendix;
}
.doc-sidebar ul {
    list-style: none;
    padding: 0;
    margin: 0;
}
.doc-sidebar li {
    margin-bottom: 0.4rem;
}
.doc-sidebar a {
    display: block;
    padding: 0.2rem 0;
    color: #666;
    border-left: 2px solid transparent;
    padding-left: 0.5rem;
    transition: border-color 0.2s, color 0.2s;
    background-size: 0% 0px;
}
.doc-sidebar a:hover,
.doc-sidebar a:focus {
    color: #111;
    border-left-color: var(--border);
}
.doc-sidebar ul ul {
    margin-bottom: 0.5rem;
    padding-left: 0.4rem;
    list-style: none;
}
.doc-sidebar ul ul li {
    margin-bottom: 0.2rem;
    font-size: 0.8rem;
}
.doc-sidebar ul ul a {
    font-weight: normal;
    font-size: 0.8rem;
    color: #777;
    border-left: 2px solid transparent;
    padding-left: 0.8rem;
    background-size: 0% 0px;
}
.doc-sidebar ul ul a:hover,
.doc-sidebar ul ul a:focus {
    color: #333;
    border-left-color: var(--border);
}
.doc-sidebar > ul > li > a {
    font-weight: bold;
    color: #222;
    font-size: 0.9rem;
    border-left: 2px solid transparent;
    padding-left: 0.5rem;
    display: block;
    margin-bottom: 0.1rem;
}
.doc-sidebar > ul > li > a:hover {
    border-left-color: var(--border);
}

.toc-mainmatter {
    counter-reset: toc-h1;
}
.toc-mainmatter > li {
    counter-increment: toc-h1;
    counter-reset: toc-h2;
}
.toc-mainmatter > li > a::before {
    content: counter(toc-h1) ". ";
}
.toc-mainmatter > li > ul > li {
    counter-increment: toc-h2;
    counter-reset: toc-h3;
}
.toc-mainmatter > li > ul > li > a::before {
    content: counter(toc-h1) "." counter(toc-h2) " ";
}
.toc-mainmatter > li > ul > li > ul > li {
    counter-increment: toc-h3;
}
.toc-mainmatter > li > ul > li > ul > li > a::before {
    content: counter(toc-h1) "." counter(toc-h2) "." counter(toc-h3) " ";
}

.toc-appendix {
    counter-reset: appendix-h1;
}
.toc-appendix > li {
    counter-increment: appendix-h1;
    counter-reset: appendix-h2;
}
.toc-appendix > li > a::before {
    content: "Dodatek " counter(appendix-h1, upper-alpha) ". ";
}
.toc-appendix > li > ul > li {
    counter-increment: appendix-h2;
}
.toc-appendix > li > ul > li > a::before {
    content: counter(appendix-h1, upper-alpha) "." counter(appendix-h2) " ";
}

.back-top {
    margin-top: 2rem;
    font-size: 0.8rem;
}

.back-top a {
    color: #999;
}

.doc-nav {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    flex-shrink: 0;
    margin-bottom: 1.5rem;
    padding-bottom: 0.5rem;
}
.doc-nav a {
    text-decoration: none;
    color: inherit;
}

.project-list {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}
.project-title {
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
    margin: 0 0 0.3rem 0;
    font-size: 1.1rem;
    font-weight: bold;
    text-transform: none;
}
.project h3 {
    margin: 0 0 0.3rem 0;
    font-size: 1.1rem;
    font-weight: bold;
}
.project h3 a {
    text-decoration: none;
    color: inherit;
}
.project h3 a:hover {
    text-decoration: underline;
}
.project p {
    margin: 0;
    font-size: 0.95rem;
    color: #444;
}

.lang-links {
    font-family: "Courier Prime", monospace;
    font-size: 0.85rem;
    font-weight: normal;
    opacity: 0.9;
}
.lang-links a {
    text-decoration: none;
    color: inherit;
}
.lang-links a.active {
    text-decoration: none;
    opacity: 1;
    font-weight: bold;
}
.lang-links a:hover {
    text-decoration: none;
    opacity: 1;
}

#contact ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

#contact li {
    margin: 0.3rem 0;
}

a {
    color: #555;
    text-decoration: none;
    background-image: linear-gradient(currentColor, currentColor);
    background-position: 0% 100%;
    background-repeat: no-repeat;
    background-size: 100% 1px;
    transition: background-size 0.2s;
}
a:hover {
    color: #111;
    background-size: 100% 1px;
}

footer {
    color: #888;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
    margin-top: 2rem;
    font-size: 0.9rem;
    padding-top: 1.5rem;
}

.footer-right {
    text-align: left;
    color: #666;
}
.footer-right p {
    margin: 0.15rem 0;
    font-family: "Courier Prime", monospace;
}
.footer-email a {
    color: #666;
    text-decoration: none;
    font-family: "Courier Prime", monospace;
}
.footer-email a:hover {
    font-family: "Courier Prime", monospace;
    text-decoration: underline;
}

.badge-link {
    display: block;
    line-height: 0;
    background-image: none;
    background-size: 0;
}
.badge-link img {
    display: block;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
    width: 88px;
    height: 31px;
    opacity: 0.75;
    transition: opacity 0.2s;
    padding-right: 1rem;
}
.badge-link:hover img {
    opacity: 1;
    background-size: 0;
}

pre {
    font-family: "Courier Prime", monospace;
    font-size: 0.85rem;
    color: var(--code-text);
    background: var(--code-bg);
    border: 1px solid var(--code-border);
    border-left: 4px solid #999;
    border-radius: 5px;
    padding: 0.4rem 0.8rem;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.75),
        0 1px 2px rgba(0,0,0,.04);
}
pre code {
    background: none;
    padding: 0;
    border-radius: 0;
}
p code,
li code,
td code {
    font-family: "Courier Prime", monospace;
    font-size: 0.9em;
    background: #f5f5f3;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: .05em .2em;
    white-space: nowrap;
}
pre::selection,
pre code::selection {
    background: #b8d9ff;
}
code::selection {
    background: #cce3ff;
}
pre + p {
    margin-top: 1.2rem;
}
p + pre {
    margin-top: 0.9rem;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin: 1rem 0;
}
th, td {
    border: 1px solid var(--border);
    padding: 0.6rem;
    text-align: left;
    vertical-align: top;
}
th {
    background: var(--code-bg);
}
tr:nth-child(even) td {
    background: #fafafa;
}

.keyword-grid {
    display: inline-block;
}

.keyword-grid pre {
    margin-top: 0.5rem;
}

manuscript {
    display: block;
    counter-reset: spread;
    font-family: "Courier Prime", monospace;
    font-size: 0.95rem;
    line-height: 1.5;
}
.manuscript-meta {
    margin-bottom: 2rem;
    font-size: 0.9rem;
    color: #555;
}
.manuscript-meta div {
    margin: 0.15rem 0;
}

spread {
    display: block;
    counter-increment: spread;
    counter-reset: panel;
    margin-top: 3rem;
    padding-top: 1rem;
}
spread::before {
    display: block;
    content: "STRONA " counter(spread);
    font-weight: bold;
    font-size: 1.2rem;
}

panel {
    display: block;
    counter-increment: panel;
    margin: 1.5rem 0 0.8rem;
    padding: 0.5rem 0;
}
panel::before {
    display: block;
    content: "PANEL " counter(panel);
    font-weight: bold;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.3rem;
}
panel[mood]::after {
    content: " [" attr(mood) "]";
    font-size: 0.85rem;
    font-weight: normal;
    color: #777;
    margin-left: 0.4rem;
}

character {
    text-transform: uppercase;
    font-weight: bold;
}

dialogue {
    display: flex;
    align-items: baseline;
    margin: 0.8rem 0 0.8rem 2rem;
}
dialogue::before {
    content: attr(speaker);
    text-transform: uppercase;
    font-weight: bold;
    font-size: 0.95rem;
    color: #222;
    text-align: right;
    width: 12rem;
    flex-shrink: 0;
    margin-right: 0.8rem;
    white-space: nowrap;
}
dialogue::after {
    content: " [" attr(trait) "]";
    font-size: 0.85rem;
    color: #777;
    margin-left: 0.4rem;
    white-space: nowrap;
}
dialogue:not([trait])::after {
    content: none;
}

sfx {
    display: grid;
    grid-template-columns: 12rem 1fr;
    gap: 0.8rem;
    margin: 0.8rem 0 0.8rem 2rem;
    align-items: baseline;
}
sfx::before {
    content: "SFX";
    text-transform: uppercase;
    font-weight: bold;
    font-size: 0.9rem;
    color: #555;
    text-align: right;
}

narration {
    display: block;
    margin: 1.2rem 0 1.2rem 2rem;
    padding-left: 1rem;
    border-left: 2px solid var(--border);
    font-style: normal;                   /* no more italics */
    color: #333;
    position: relative;
}
narration::before {
    content: "NARRACJA";
    display: block;
    font-weight: bold;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: #888;
    margin-bottom: 0.2rem;
}

.status {
    font-family: "Courier Prime", monospace;
    font-size: 0.9rem;
    color: #555;
    margin: 1.2rem 0 2rem 0;
}
.prompt {
    color: #888;
}
.cursor {
    color: #aaa;
    animation: blink 1s step-end infinite;
}
@keyframes blink {
    50% { opacity: 0; }
}
