/* ================== OJS HTML Galley — Publisher grade =======================
   Type system: Source Serif 4 (body) + Inter (headings), fallback to Times.
   If external fonts are not allowed, comment out the @import and the look
   will gracefully fall back to Times New Roman.
============================================================================= */

/* Optional fonts (safe, high legibility). Remove if you need zero external calls. */
@import url('https://fonts.googleapis.com/css2?family=Source+Serif+4:ital,wght@0,400;0,600;0,700;1,400&family=Inter:wght@600;700&display=swap');

/* ---------- Root scale ---------- */
:root{
  --measure: 72ch;
  --base: 18px;           /* body size */
  --lh: 1.65;             /* body line-height */
  --rule: #c8ccd0;        /* hairline color */
  --ink:  #111;           /* text */
  --muted:#555;           /* secondary */
  --link:#1545a5;         /* link */
  --link-visited:#6b2fbf;

  --sans: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Source Serif 4", "Times New Roman", Times, serif;
}

/* ---------- Page frame ---------- */
main.article{
  max-width: var(--measure);
  padding: 1.5rem 1rem 4rem;
  margin: 0 auto;
  hyphens: auto;
}
main.article::before{
  content: "";
  display: block;
  height: 4lh;           /* spacing below site header */
}

/* ---------- Typography ---------- */
html, body{
  font-family: var(--serif) !important;
  font-size: var(--base);
  line-height: var(--lh);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

p{ margin: 0 0 0.95em; }
p:empty{ display:none; }

a{ color: var(--link); text-decoration: underline; }
a:visited{ color: var(--link-visited); }
a:focus{ outline: 2px solid var(--link); outline-offset: 2px; }

strong, b{ font-weight: 700; }
em, i{ font-style: italic; }

/* ---------- Article titles (both languages) ---------- */
.frontmatter{ margin-bottom: 1.25rem; }
.frontmatter .article-title{
  font-family: var(--sans) !important;
  font-size: 1.9rem;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: .002em;
  margin: 0 0 0.75rem;
  color: var(--ink);
}
/* Titolo tradotto: stesso stile e dimensione; leggermente ravvicinato */
.frontmatter .article-title.translated{
  font-size: 1.9rem;
  margin-top: .25rem;
}

/* If you want the IT title slightly stronger than EN (optional): */
/* .frontmatter .article-title.lang-it{ font-weight:800; } */

/* ---------- Byline ---------- */
.byline{
  margin: 0 0 1.1rem;
  color: var(--muted);
}
.byline .author-name{
  font-size: 1.1em;
  font-weight: 700;
}
.byline br{ display: block; content: ""; }

/* ---------- Section headings (numbered in-body) ---------- */
main.article h1, main.article h2, main.article h3{
  font-family: var(--sans) !important;
  font-weight: 700;
  letter-spacing: .0015em;
  color: var(--ink);
}
main.article h1{ font-size:1.65rem; line-height:1.25; margin:1.1em 0 .5em; }
main.article h2{ font-size:1.35rem; line-height:1.30; margin:1.2em 0 .55em; }
main.article h3{ font-size:1.20rem; line-height:1.30; margin:1.0em 0 .45em; }

/* Hoverable anchors for headings with IDs (converter patch below adds IDs) */
main.article h1[id]::after,
main.article h2[id]::after,
main.article h3[id]::after{
  content:"";
  margin-left: .4em;
  border-bottom: 1px dotted transparent;
}
main.article h1[id]:hover::after,
main.article h2[id]:hover::after,
main.article h3[id]:hover::after{
  content:"#"; color:#666;
}

/* ---------- Lists ---------- */
ul, ol{ margin: 0 0 1rem 1.25rem; padding-left: 1.25rem; }
li{ margin: .25rem 0; }

/* ---------- Figures ---------- */
img{ max-width: 100%; height: auto; }
figure{ margin: 1rem 0; }
figcaption{
  font-size: .95em;
  color: #333;
  margin-top: .35rem;
}

/* ---------- Tables ---------- */
.table-scroll{ overflow-x:auto; -webkit-overflow-scrolling:touch; margin:1rem 0; }
.table-scroll table{ width:100%; border-collapse: collapse; }
.table-scroll th, .table-scroll td{
  padding: .55rem .75rem;
  vertical-align: top;
  border-top: 1px solid var(--rule);
}
.table-scroll thead th{
  border-bottom: 2px solid var(--rule);
  font-style: italic;
  font-weight: 400;
}
.table-scroll tbody tr:nth-child(even) td{ background: #fafafa; }

/* ---------- Long direct quotes ---------- */
.long-quote{
  margin: 1rem 0;
  padding-left: 1rem;
  border-left: 3px solid #999;
}

/* ---------- References & Notes: guaranteed divider ---------- */
/* Hard rule (inserted by converter patch): */
hr.ref-notes-divider{
  border: none;
  border-top: 2px solid var(--rule);
  margin: 2.5rem 0 1.25rem;
}
/* Defensive styling if a heading got the class but no hr exists */
.endnotes-heading{
  margin-top: 2.5rem;
  padding-top: 1rem;
  border-top: 2px solid var(--rule);
}
.endnotes-heading + ol,
.endnotes-heading + ul{
  margin-top: .75rem;
  font-size: .97em;
  line-height: 1.6;
  padding-left: 1.25rem;
}
.references-heading{ margin-bottom: .35rem; }

/* Scroll offset per ancore di note e rimandi */
:target{ scroll-margin-top: 2.5rem; }
[id^="footnote-"], [id^="fn-"], [id^="fnref-"]{ scroll-margin-top: 2.5rem; }

/* ---------- Reader mode (bigger text / calmer rhythm) ---------- */
body.reader{ font-size: 19px; line-height: 1.75; }
body.reader p{ margin: 0 0 1.05em; }
body.reader h1{ font-size: 1.85rem; }
body.reader h2{ font-size: 1.50rem; }

/* ---------- Microtypography ---------- */
p{ orphans:3; widows:3; }

/* ---------- Print polish ---------- */
@media print{
  a{ text-decoration:none; color: inherit; }
  hr.ref-notes-divider{ border-top: 1px solid #000; }
  .table-scroll{ overflow: visible; }
}

/* --- Wide tables: overflow horizontally, minimal wrapping --- */
.table-scroll.wide { 
  overflow-x: auto; 
  -webkit-overflow-scrolling: touch; 
  margin: 1rem 0;
  padding-bottom: .25rem;              /* tiny pad so scrollbar doesn't overlay border */
}

/* Let content define the width so it can exceed the page */
.table-scroll.wide > table{
  width: max-content;                  /* key: allow table to be wider than page */
  table-layout: auto;                  /* natural sizing */
  border-collapse: collapse;
}

/* Tighter cell padding on very wide matrices */
.table-scroll.wide th,
.table-scroll.wide td{
  padding: .4rem .6rem;
  vertical-align: top;
}

/* Minimise wrapping (use with care) */
.table-scroll.wide th,
.table-scroll.wide td,
.table-scroll.wide th p,
.table-scroll.wide td p{
  white-space: nowrap;
}

/* If you ever need wrapping back for a specific column, add class="wrap" on that <th>/<td> */
.table-scroll.wide .wrap,
.table-scroll.wide .wrap p{
  white-space: normal;
  overflow-wrap: anywhere;
}

.table-scroll.wide{ mask-image: linear-gradient(to right, black 90%, transparent); }
.table-scroll.wide:focus-within, .table-scroll.wide:hover{ mask-image: none; }

/* Force a line break right after any ORCID link */
.byline a[href*="orcid.org"]::after{
  content:"";
  display:block;
}

/* Journal line (selezionabile) */
.frontmatter .journal-line{
  font-style: italic;
  color: var(--muted);
  margin: 0 0 .35rem;
  text-align: left;
}

/* Neutralise accidental all-italic headings imported from Word */
main.article h1 > em:only-child,
main.article h2 > em:only-child,
main.article h3 > em:only-child,
main.article h1 > i:only-child,
main.article h2 > i:only-child,
main.article h3 > i:only-child{
  font-style: normal;
}

/* (Optional, broader) also cancel partial italics inside headings */
main.article h1 em, main.article h1 i,
main.article h2 em, main.article h2 i,
main.article h3 em, main.article h3 i{
  font-style: normal;
}

/* === FI TABLE LEGIBILITY AND INTERNAL NAVIGATION PATCH === */

/*
   Preserve normal wrapping in prose, but suppress browser hyphenation inside
   tables. Tables receive a controlled minimum width and overflow horizontally
   when the article column is narrower than their readable layout.
*/
.table-scroll{
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-gutter: stable;
  -webkit-overflow-scrolling: touch;
}

.table-scroll > table{
  width: 100%;
  min-width: var(--fi-table-min-width, 52rem);
  table-layout: auto;
}

/* No discretionary hyphenation or mid-word breaking in tabular material. */
.table-scroll th,
.table-scroll td,
.table-scroll th p,
.table-scroll td p{
  -webkit-hyphens: none !important;
  -ms-hyphens: none !important;
  hyphens: none !important;
  word-break: normal !important;
  overflow-wrap: normal !important;
}

.table-scroll th p,
.table-scroll td p{
  margin-bottom: 0;
}

/* Tables 1–2: conceptual and functional mappings. */
.table-scroll.table-1{ --fi-table-min-width: 68rem; }
.table-scroll.table-1 th:nth-child(1),
.table-scroll.table-1 td:nth-child(1){ width: 20%; }
.table-scroll.table-1 th:nth-child(2),
.table-scroll.table-1 td:nth-child(2){ width: 20%; }
.table-scroll.table-1 th:nth-child(3),
.table-scroll.table-1 td:nth-child(3){ width: 28%; }
.table-scroll.table-1 th:nth-child(4),
.table-scroll.table-1 td:nth-child(4){
  width: 32%;
  white-space: normal;
}

.table-scroll.table-2{ --fi-table-min-width: 68rem; }
.table-scroll.table-2 th:nth-child(1),
.table-scroll.table-2 td:nth-child(1){ width: 20%; }
.table-scroll.table-2 th:nth-child(2),
.table-scroll.table-2 td:nth-child(2){ width: 20%; }
.table-scroll.table-2 th:nth-child(3),
.table-scroll.table-2 td:nth-child(3){ width: 28%; }
.table-scroll.table-2 th:nth-child(4),
.table-scroll.table-2 td:nth-child(4){
  width: 32%;
  white-space: normal;
}

/* Tables 3–9: repeated workflow matrices. */
.table-scroll.workflow-table{ --fi-table-min-width: 54rem; }
.table-scroll.workflow-table th:nth-child(1),
.table-scroll.workflow-table td:nth-child(1){
  width: 16%;
  white-space: nowrap;
}
.table-scroll.workflow-table th:nth-child(2),
.table-scroll.workflow-table td:nth-child(2){ width: 54%; }
.table-scroll.workflow-table th:nth-child(3),
.table-scroll.workflow-table td:nth-child(3){
  width: 30%;
  white-space: nowrap;
}

/* Table 10: validation matrix. */
.table-scroll.table-10{ --fi-table-min-width: 64rem; }
.table-scroll.table-10 th:nth-child(1),
.table-scroll.table-10 td:nth-child(1){
  width: 9%;
  white-space: nowrap;
}
.table-scroll.table-10 th:nth-child(2),
.table-scroll.table-10 td:nth-child(2){ width: 23%; }
.table-scroll.table-10 th:nth-child(3),
.table-scroll.table-10 td:nth-child(3){ width: 38%; }
.table-scroll.table-10 th:nth-child(4),
.table-scroll.table-10 td:nth-child(4){ width: 30%; }

/* Tables 11 and 13: two-column mappings. */
.table-scroll.table-11{ --fi-table-min-width: 56rem; }
.table-scroll.table-11 th:nth-child(1),
.table-scroll.table-11 td:nth-child(1){ width: 32%; }
.table-scroll.table-11 th:nth-child(2),
.table-scroll.table-11 td:nth-child(2){ width: 68%; }

.table-scroll.table-13{ --fi-table-min-width: 58rem; }
.table-scroll.table-13 th:nth-child(1),
.table-scroll.table-13 td:nth-child(1){ width: 31%; }
.table-scroll.table-13 th:nth-child(2),
.table-scroll.table-13 td:nth-child(2){ width: 69%; }

/* Table 12: risk matrix. */
.table-scroll.table-12{ --fi-table-min-width: 64rem; }
.table-scroll.table-12 th:nth-child(1),
.table-scroll.table-12 td:nth-child(1){ width: 24%; }
.table-scroll.table-12 th:nth-child(2),
.table-scroll.table-12 td:nth-child(2),
.table-scroll.table-12 th:nth-child(3),
.table-scroll.table-12 td:nth-child(3){
  width: 12%;
  white-space: nowrap;
}
.table-scroll.table-12 th:nth-child(4),
.table-scroll.table-12 td:nth-child(4){ width: 52%; }

/* Table 14: PRISMA flow matrix. */
.table-scroll.table-14{ --fi-table-min-width: 64rem; }
.table-scroll.table-14 th:nth-child(1),
.table-scroll.table-14 td:nth-child(1){
  width: 16%;
  white-space: nowrap;
}
.table-scroll.table-14 th:nth-child(2),
.table-scroll.table-14 td:nth-child(2){ width: 42%; }
.table-scroll.table-14 th:nth-child(3),
.table-scroll.table-14 td:nth-child(3){
  width: 8%;
  white-space: nowrap;
}
.table-scroll.table-14 th:nth-child(4),
.table-scroll.table-14 td:nth-child(4){ width: 34%; }

/* Stable landing position for internal cross-references. */
main.article h1[id],
main.article h2[id],
main.article h3[id],
.table-scroll[id],
.figure-object[id],
.ref-entry[id]{
  scroll-margin-top: 2.5rem;
}

.internal-xref{
  text-decoration-thickness: .08em;
  text-underline-offset: .12em;
}

.table-caption,
.figure-caption{
  scroll-margin-top: 2.5rem;
}

/* Make horizontally scrollable tables keyboard-reachable. */
.table-scroll:focus{
  outline: 2px solid var(--link);
  outline-offset: 2px;
}

@media print{
  .table-scroll{
    overflow: visible;
  }

  .table-scroll > table{
    width: 100%;
    min-width: 0;
  }

  .table-scroll th,
  .table-scroll td{
    white-space: normal !important;
  }
}

/* === END FI TABLE LEGIBILITY AND INTERNAL NAVIGATION PATCH === */

/* === FI ALIGNED ITALIC TABLE HEADERS PATCH === */

/*
   Column headers are semantic <th scope="col"> elements. Their emphasis is
   primarily italic rather than bold: distinction is supplied by typography,
   a restrained neutral field and the lower rule.
*/
.table-scroll thead th{
  background: #f3f3f2;
  color: var(--ink);
  font-style: italic;
  font-weight: 400;
  letter-spacing: .004em;
  vertical-align: bottom;
  border-top: 1px solid var(--rule);
  border-bottom: 2px solid var(--rule);
}

.table-scroll thead th p{
  margin: 0;
  font-style: inherit;
  font-weight: inherit;
  text-align: inherit;
}

/*
   Alignment is attached to both header and body cells in the HTML, so the
   heading always follows the column it describes rather than relying on the
   browser's default centring of <th>.
*/
.table-scroll th.align-left,
.table-scroll td.align-left{
  text-align: left;
}

.table-scroll th.align-center,
.table-scroll td.align-center{
  text-align: center;
}

.table-scroll th.align-right,
.table-scroll td.align-right{
  text-align: right;
}

/* Paragraphs inside cells inherit the alignment of their cell. */
.table-scroll th.align-left p,
.table-scroll td.align-left p,
.table-scroll th.align-center p,
.table-scroll td.align-center p,
.table-scroll th.align-right p,
.table-scroll td.align-right p{
  text-align: inherit;
}

/* Keep the restrained header field independent of tbody zebra striping. */
.table-scroll thead tr:nth-child(even) th,
.table-scroll thead tr:nth-child(odd) th{
  background: #f3f3f2;
}

/* === END FI ALIGNED ITALIC TABLE HEADERS PATCH === */
