/* ============================================================
   pmt.report - Pragmatic Magic Theory Report
   Editorial / Swiss academic-paper layout
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
    --paper-white:   #ffffff;
    --print-black:   #1a1a1a;
    --abstract-gray: #f5f5f5;
    --citation-blue: #0055cc;
    --rule-gray:     #e8e8e8;
    --metadata-gray: #666666;
    --heading-dark:  #333333;
    --note-red:      #8b0000;

    --font-display:  "Playfair Display", Georgia, "Times New Roman", serif;
    --font-body:     "Source Serif 4", Georgia, "Times New Roman", serif;
    --font-meta:     "Source Sans 3", "Helvetica Neue", Arial, sans-serif;

    --measure:       720px;
    --measure-narrow: 640px;
}

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

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    background: var(--paper-white);
}

body {
    margin: 0;
    padding: 0;
    background: var(--paper-white);
    color: var(--print-black);
    font-family: var(--font-body);
    font-size: 1rem;
    line-height: 1.8;
    font-weight: 400;
    counter-reset: section figure table reference;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img,
svg {
    max-width: 100%;
    display: block;
}

/* ---------- Paper container ---------- */
.paper {
    max-width: var(--measure);
    margin: 0 auto;
    padding: 64px 32px 96px;
    background: var(--paper-white);
}

/* ---------- Paper header (title + authors) ---------- */
.paper-header {
    text-align: center;
    border-bottom: 2px solid var(--print-black);
    padding-bottom: 24px;
    margin-bottom: 40px;
    position: relative;
}

/* the second of the double-rule under the title block */
.paper-header::after {
    content: "";
    display: block;
    position: absolute;
    left: 0;
    right: 0;
    bottom: -6px;
    border-bottom: 1px solid var(--print-black);
}

.journal-title {
    font-family: var(--font-meta);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.28em;
    margin: 0 0 6px;
    color: var(--print-black);
    font-weight: 600;
}

.journal-meta {
    font-family: var(--font-meta);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--metadata-gray);
    margin: 0 0 28px;
    font-weight: 400;
}

.paper-title {
    font-family: var(--font-display);
    font-weight: 700;
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    line-height: 1.22;
    color: var(--print-black);
    margin: 0 auto 24px;
    max-width: var(--measure-narrow);
    letter-spacing: -0.005em;
}

.paper-authors {
    font-family: var(--font-body);
    font-size: 1.05rem;
    color: var(--print-black);
    margin: 0 0 10px;
    line-height: 1.5;
}

.paper-authors sup {
    font-family: var(--font-meta);
    font-size: 0.7em;
    color: var(--metadata-gray);
    font-weight: 500;
    margin: 0 1px;
}

.paper-affiliations {
    font-family: var(--font-meta);
    font-size: 0.82rem;
    color: var(--metadata-gray);
    margin: 0 auto 14px;
    max-width: var(--measure-narrow);
    line-height: 1.55;
}

.paper-affiliations sup {
    font-family: var(--font-meta);
    color: var(--metadata-gray);
    font-weight: 500;
}

.paper-correspondence,
.paper-dates {
    font-family: var(--font-meta);
    font-size: 0.82rem;
    color: var(--metadata-gray);
    margin: 0 0 6px;
    line-height: 1.5;
}

.paper-dates {
    margin-top: 12px;
    font-style: italic;
}

/* ---------- Abstract block ---------- */
.abstract-block {
    border: 1px solid var(--rule-gray);
    background: var(--abstract-gray);
    padding: 24px 28px;
    margin: 40px 0;
    max-width: var(--measure-narrow);
    margin-left: auto;
    margin-right: auto;
}

.abstract-label {
    font-family: var(--font-meta);
    text-transform: uppercase;
    letter-spacing: 0.22em;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--heading-dark);
    margin: 0 0 12px;
}

.abstract-text {
    font-family: var(--font-body);
    font-size: 0.97rem;
    line-height: 1.75;
    color: var(--print-black);
    margin: 0 0 14px;
    text-align: justify;
    hyphens: auto;
}

.abstract-text em {
    font-style: italic;
}

.abstract-keywords {
    font-family: var(--font-meta);
    font-size: 0.82rem;
    color: var(--metadata-gray);
    margin: 14px 0 0;
    border-top: 1px solid var(--rule-gray);
    padding-top: 12px;
    line-height: 1.55;
}

.abstract-keywords .kw-label {
    font-weight: 600;
    color: var(--heading-dark);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-right: 4px;
}

/* ---------- Body / sections ---------- */
.paper-body {
    counter-reset: section figure table;
}

.paper-section {
    margin: 48px 0 0;
    counter-reset: subsection;
}

.paper-section > h2 {
    counter-increment: section;
    font-family: var(--font-display);
    font-weight: 700;
    color: var(--heading-dark);
    font-size: 1.55rem;
    line-height: 1.3;
    margin: 0 0 18px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--rule-gray);
}

.paper-section > h2::before {
    content: counter(section) ". ";
    color: var(--heading-dark);
    font-weight: 700;
    margin-right: 4px;
}

/* sections that should not be numbered */
#sec-acknowledgements > h2,
#sec-references > h2,
#sec-appendix > h2 {
    counter-increment: none;
}
#sec-acknowledgements > h2::before,
#sec-references > h2::before,
#sec-appendix > h2::before {
    content: "";
    margin: 0;
}

.paper-subsection {
    margin: 26px 0 0;
    counter-reset: subsubsection;
}

.paper-subsection > h3 {
    counter-increment: subsection;
    font-family: var(--font-display);
    font-weight: 600;
    color: var(--heading-dark);
    font-size: 1.15rem;
    line-height: 1.35;
    margin: 18px 0 10px;
}

.paper-subsection > h3::before {
    content: counter(section) "." counter(subsection) " ";
    color: var(--heading-dark);
    font-weight: 600;
    margin-right: 4px;
}

/* paragraphs */
.paper-section p {
    margin: 0 0 16px;
    text-align: justify;
    hyphens: auto;
    color: var(--print-black);
}

.paper-section p em {
    font-style: italic;
}

.paper-section p strong {
    font-weight: 600;
}

/* ---------- Citations (inline links) ---------- */
a.citation {
    color: var(--citation-blue);
    font-family: var(--font-meta);
    font-size: 0.78em;
    text-decoration: none;
    vertical-align: super;
    line-height: 0;
    margin: 0 1px;
    transition: color 120ms ease;
}

a.citation::before { content: "["; }
a.citation::after  { content: "]"; }

a.citation:hover {
    color: var(--print-black);
    text-decoration: underline;
}

a.citation.is-active {
    color: var(--note-red);
}

/* ---------- General links ---------- */
a {
    color: var(--citation-blue);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

a:hover {
    color: var(--print-black);
}

/* ---------- Block quote ---------- */
.paper-quote {
    margin: 24px 0;
    padding: 6px 0 6px 22px;
    border-left: 3px solid var(--rule-gray);
    color: var(--heading-dark);
    font-family: var(--font-body);
    font-style: italic;
    font-size: 1rem;
    line-height: 1.7;
}

.paper-quote cite {
    display: block;
    margin-top: 10px;
    font-family: var(--font-meta);
    font-style: normal;
    font-size: 0.82rem;
    color: var(--metadata-gray);
    letter-spacing: 0.02em;
}

/* ---------- KBD / inline code-like (used for math symbols) ---------- */
.kbd {
    font-family: "Source Serif 4", Georgia, serif;
    font-style: italic;
    font-weight: 600;
    color: var(--print-black);
    padding: 0 2px;
    white-space: nowrap;
}

.kbd sub,
.kbd sup {
    font-style: normal;
    font-weight: 600;
    font-size: 0.75em;
}

/* ---------- Table ---------- */
.paper-table-wrap {
    margin: 28px 0;
    padding: 0;
}

.paper-table {
    width: 100%;
    border-collapse: collapse;
    font-family: var(--font-body);
    font-size: 0.92rem;
    line-height: 1.55;
    border-top: 2px solid var(--print-black);
    border-bottom: 2px solid var(--print-black);
}

.paper-table caption {
    counter-increment: table;
    caption-side: bottom;
    font-family: var(--font-meta);
    font-size: 0.82rem;
    color: var(--metadata-gray);
    margin: 12px 0 0;
    line-height: 1.55;
    text-align: left;
}

.paper-table caption .cap-label {
    font-weight: 600;
    color: var(--heading-dark);
    text-transform: none;
    letter-spacing: 0.02em;
    margin-right: 2px;
}

.paper-table thead tr {
    border-bottom: 1px solid var(--print-black);
}

.paper-table th {
    text-align: left;
    font-family: var(--font-meta);
    font-weight: 600;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--heading-dark);
    padding: 10px 10px;
    vertical-align: bottom;
}

.paper-table th:nth-child(2),
.paper-table th:nth-child(3),
.paper-table th:nth-child(4),
.paper-table th:nth-child(5) {
    text-align: right;
}

.paper-table td {
    padding: 8px 10px;
    border-bottom: 1px solid var(--rule-gray);
    color: var(--print-black);
    vertical-align: top;
}

.paper-table tbody tr:last-child td {
    border-bottom: none;
}

.paper-table td:nth-child(2),
.paper-table td:nth-child(3),
.paper-table td:nth-child(4),
.paper-table td:nth-child(5) {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.paper-table tbody tr.is-highlight td {
    background: var(--abstract-gray);
}

/* ---------- Errata note ---------- */
.errata-note {
    border-left: 3px solid var(--note-red);
    padding: 10px 16px;
    background: #fbf6f6;
    color: var(--print-black);
    font-size: 0.95rem;
    margin: 22px 0;
    line-height: 1.7;
}

.errata-note strong {
    color: var(--note-red);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 0.85em;
    margin-right: 4px;
}

/* ---------- References list ---------- */
.references-list {
    counter-reset: reference;
    list-style: none;
    padding: 0;
    margin: 8px 0 0;
    font-family: var(--font-body);
    font-size: 0.92rem;
    line-height: 1.65;
}

.references-list li {
    counter-increment: reference;
    position: relative;
    padding-left: 2.4em;
    margin-bottom: 12px;
    text-indent: 0;
    color: var(--print-black);
}

.references-list li::before {
    content: "[" counter(reference) "]";
    position: absolute;
    left: 0;
    top: 0;
    width: 2.2em;
    color: var(--heading-dark);
    font-family: var(--font-meta);
    font-size: 0.85em;
    font-weight: 600;
}

.references-list li.is-target {
    background: var(--abstract-gray);
    box-shadow: 0 0 0 8px var(--abstract-gray);
    border-radius: 2px;
    transition: background 1500ms ease, box-shadow 1500ms ease;
}

.references-list .ref-authors {
    font-weight: 600;
    color: var(--print-black);
}

.references-list em {
    font-style: italic;
}

/* ---------- Notation list (appendix) ---------- */
.notation-list {
    margin: 8px 0 0;
    padding: 0;
    display: grid;
    grid-template-columns: minmax(80px, 140px) 1fr;
    gap: 8px 24px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    line-height: 1.65;
}

.notation-list dt {
    color: var(--heading-dark);
    padding: 4px 0;
    border-bottom: 1px solid var(--rule-gray);
}

.notation-list dd {
    margin: 0;
    padding: 4px 0;
    border-bottom: 1px solid var(--rule-gray);
    color: var(--print-black);
}

/* ---------- Footer ---------- */
.paper-footer {
    margin-top: 64px;
    padding-top: 24px;
}

.rule-thin {
    border: none;
    border-top: 1px solid var(--rule-gray);
    margin: 0 0 18px;
}

.footer-meta {
    font-family: var(--font-meta);
    font-size: 0.8rem;
    color: var(--metadata-gray);
    margin: 0 0 6px;
    line-height: 1.55;
    text-align: center;
}

/* ---------- Selection ---------- */
::selection {
    background: var(--abstract-gray);
    color: var(--print-black);
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
    .paper {
        padding: 40px 20px 64px;
    }

    .paper-header {
        margin-bottom: 28px;
    }

    .paper-title {
        font-size: clamp(1.4rem, 6vw, 2rem);
    }

    .abstract-block {
        padding: 20px 18px;
        margin: 28px 0;
    }

    .paper-section > h2 {
        font-size: 1.35rem;
    }

    .paper-subsection > h3 {
        font-size: 1.05rem;
    }

    .paper-table {
        font-size: 0.85rem;
    }

    .paper-table th,
    .paper-table td {
        padding: 8px 6px;
    }

    .notation-list {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .notation-list dt {
        border-bottom: none;
        padding-bottom: 0;
        font-weight: 600;
    }

    .notation-list dd {
        padding-top: 2px;
        margin-bottom: 6px;
    }
}

@media (max-width: 480px) {
    .paper {
        padding: 32px 16px 48px;
    }

    body {
        font-size: 0.96rem;
        line-height: 1.7;
    }

    .paper-section p,
    .abstract-text {
        text-align: left;
        hyphens: none;
    }
}

/* ---------- Print ---------- */
@media print {
    body {
        background: #fff;
        color: #000;
        font-size: 10.5pt;
        line-height: 1.5;
    }

    .paper {
        max-width: 100%;
        padding: 0;
        margin: 0;
    }

    a.citation,
    a {
        color: #000;
    }

    .paper-section {
        page-break-inside: avoid;
    }

    .paper-table {
        page-break-inside: avoid;
    }
}
