/*
 * MaLGa academic page - shared stylesheet.
 * Source of truth: Malga-Vision/malga-academic-page-template (static/malga/).
 * Do not edit this file inside a paper page: change it in the template and copy it over,
 * so every page keeps the same look. Page-specific tweaks go in static/css/page.css.
 */

@font-face { font-family: "Fira Sans"; src: url("fonts/FiraSans-Regular.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url("fonts/FiraSans-Italic.woff2") format("woff2"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url("fonts/FiraSans-Medium.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url("fonts/FiraSans-SemiBold.woff2") format("woff2"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Fira Sans"; src: url("fonts/FiraSans-Bold.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Roboto Slab"; src: url("fonts/RobotoSlab-Light.woff2") format("woff2"); font-weight: 300; font-display: swap; }
@font-face { font-family: "Roboto Slab"; src: url("fonts/RobotoSlab-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Roboto Slab"; src: url("fonts/RobotoSlab-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  /* MaLGa brand */
  --coral: #fe6767;
  --coral-dark: #dc5a59;
  --coral-light: #fea4a4;
  --coral-wash: #fff1f1;
  --link: #b84545;          /* darker coral: 5.3:1 on white, readable at body size */
  --night: #0f0e36;         /* UniGe night blue */
  --night-line: #414164;

  /* neutrals */
  --ink: #333;
  --ink-strong: #222;
  --muted: #666;
  --line: #e2e2e2;
  --line-soft: #eee;
  --paper: #fff;
  --paper-alt: #fafafa;

  --sans: "Fira Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --slab: "Roboto Slab", Georgia, serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  --wrap: 1024px;
  --measure: 46rem;
  --gutter: 1.5rem;
  --header-h: 4rem;
  --ease: 135ms cubic-bezier(.4, 0, .2, 1);
}

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

html { font-size: 112.5%; scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 1rem); -webkit-text-size-adjust: 100%; }
@media (max-width: 768px) { html { font-size: 100%; } }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; animation: none !important; } }

body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1rem/1.6 var(--sans); font-variant-numeric: lining-nums; overflow-wrap: break-word; }
img, video, svg { display: block; max-width: 100%; height: auto; }
h1, h2, h3, h4 { font-family: var(--slab); font-weight: 400; color: var(--ink-strong); line-height: 1.15; margin: 0 0 .6em; }
p, ul, ol, dl, table, pre, figure { margin: 0 0 1rem; }
sup { line-height: 0; }
strong, b { font-weight: 600; }
hr { border: 0; border-top: 1px solid var(--line); margin: 2rem 0; }

a { color: var(--link); font-weight: 500; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: .18em; text-decoration-color: color-mix(in srgb, var(--link) 40%, transparent); }
a:hover { color: var(--night); text-decoration-color: currentColor; }
:focus-visible { outline: 3px solid var(--coral); outline-offset: 2px; }

.wrap { width: 100%; max-width: calc(var(--wrap) + 2 * var(--gutter)); margin: 0 auto; padding: 0 var(--gutter); }
.measure { max-width: var(--measure); }
.skip-link { position: absolute; left: -9999px; top: 0; background: var(--night); color: #fff; padding: .5rem 1rem; z-index: 100; }
.skip-link:focus { left: 1rem; top: .5rem; color: #fff; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Icons (inline SVG sprite) ---------- */
.icon { width: 1.1em; height: 1.1em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon--fill { fill: currentColor; stroke: none; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, .975); box-shadow: 0 1px 1px rgba(0, 0, 0, .07); }
.site-header .wrap { display: flex; align-items: center; gap: 1.5rem; height: var(--header-h); }
.site-header__logo { flex: none; display: block; }
.site-header__logo img { height: 2.1rem; width: auto; }
.site-nav { margin-left: auto; display: flex; gap: .25rem; overflow-x: auto; scrollbar-width: none; }
.site-nav::-webkit-scrollbar { display: none; }
.site-nav a { color: var(--ink); font-weight: 500; font-size: .85rem; text-decoration: none; padding: .35rem .6rem; white-space: nowrap; border-bottom: 2px solid transparent; }
.site-nav a:hover, .site-nav a[aria-current="true"] { color: var(--ink-strong); border-bottom-color: var(--coral); }
@media (max-width: 640px) {
  .site-header .wrap { gap: .75rem; }
  .site-header__logo img { height: 1.7rem; }
  .site-nav { mask-image: linear-gradient(to right, #000 85%, transparent); }
}

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: 4.5rem 0 3.5rem; border-bottom: 1px solid var(--line-soft); }
.hero::after { /* MaLGa node-and-arc motif, the one decorative element of the page */
  content: ""; position: absolute; top: 1.5rem; right: max(-6rem, calc((100vw - var(--wrap)) / 2 - 14rem)); width: 30rem; height: 30rem;
  background: url("img/graph-motif.svg") no-repeat center / contain; opacity: .55; pointer-events: none; z-index: 0;
}
.hero .wrap { position: relative; z-index: 1; }
.hero__venue { max-width: 44rem; margin: 0 0 1.5rem; font-size: .85rem; font-weight: 500; color: var(--ink); }
.hero__venue::before { content: ""; display: inline-block; width: .7rem; height: .7rem; margin-right: .5rem; border: 2px solid var(--coral); border-radius: 50%; vertical-align: -.05em; }
.hero__venue em { font-style: normal; color: var(--link); white-space: nowrap; margin-right: .35rem; }
.hero h1 { max-width: 44rem; margin: 0 0 1.75rem; }
.hero__acronym { display: block; font-weight: 700; font-size: 3.4rem; letter-spacing: -.01em; line-height: 1; margin-bottom: .35em; }
.hero__title { display: block; font-weight: 300; font-size: 1.85rem; line-height: 1.2; }
.hero__title:only-child { font-weight: 400; font-size: 2.3rem; line-height: 1.15; }
.authors { margin: 0 0 .35rem; font-size: 1.05rem; max-width: 44rem; }
.authors a, .authors span { white-space: nowrap; }
.authors a { color: var(--ink-strong); text-decoration-color: var(--coral-light); }
.authors a:hover { color: var(--link); }
.authors sup, .affiliations sup { font-size: .7em; color: var(--muted); margin-left: .05em; }
.affiliations { margin: 0 0 .25rem; color: var(--muted); font-size: .9rem; max-width: 44rem; }
.affiliations span { display: inline-block; margin-right: 1rem; }
.author-note { margin: 0; color: var(--muted); font-size: .8rem; }
.links { display: flex; flex-wrap: wrap; gap: .5rem; margin: 2rem 0 0; padding: 0; list-style: none; }
@media (max-width: 768px) {
  .hero { padding: 3rem 0 2.5rem; }
  .hero::after { width: 18rem; height: 18rem; top: .5rem; right: -7rem; opacity: .35; }
  .hero__acronym { font-size: 2.5rem; }
  .hero__title { font-size: 1.4rem; }
  .hero__title:only-child { font-size: 1.65rem; }
}

/* ---------- Buttons (MaLGa: square, uppercase) ---------- */
.button { display: inline-flex; align-items: center; gap: .5em; padding: .55em .9em; border: 1px solid var(--ink); background: var(--paper); color: var(--ink-strong); font: 500 .8rem/1 var(--sans); letter-spacing: .04em; text-transform: uppercase; text-decoration: none; border-radius: 0; transition: background var(--ease), color var(--ease), border-color var(--ease); }
.button:hover { background: var(--night); border-color: var(--night); color: #fff; }
.button:active { transform: translate(1px, 1px); }
.button .icon { color: var(--coral-dark); transition: color var(--ease); }
.button:hover .icon { color: var(--coral-light); }
.button--primary { background: var(--night); border-color: var(--night); color: #fff; }
.button--primary .icon { color: var(--coral-light); }
.button--primary:hover { background: var(--ink-strong); border-color: var(--ink-strong); }
.button[aria-disabled="true"] { border-style: dashed; border-color: var(--line); color: var(--muted); pointer-events: none; }
.button[aria-disabled="true"] .icon { color: var(--muted); }

/* ---------- Sections ---------- */
.section { padding: 4rem 0; }
.section--alt { background: var(--paper-alt); border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }
.section + .section--alt, .section--alt + .section { border-top: 0; }
.section__title { position: relative; font-style: italic; font-size: 1.9rem; padding-left: 1.6rem; margin-bottom: 1.5rem; }
.section__title::before { content: ""; position: absolute; left: 0; top: .32em; width: .7rem; height: .7rem; border: 2px solid var(--coral); border-radius: 50%; }
.section__lead { max-width: var(--measure); font-size: 1.1rem; color: var(--ink); }
.section h3 { font-size: 1.3rem; margin-top: 2.25rem; }
.section h3:first-child { margin-top: 0; }
.prose { max-width: var(--measure); }
.prose p { text-align: left; hyphens: auto; }
.prose ul, .prose ol { padding-left: 1.25rem; }
.prose li + li { margin-top: .35rem; }
.abstract p { font-size: 1.05rem; line-height: 1.7; }
.tldr { max-width: var(--measure); margin: 2rem 0 0; font: 400 1.15rem/1.55 var(--slab); color: var(--ink-strong); }
.tldr strong { font-weight: 700; }
.eq { margin: 1.25rem 0; padding: .75rem 1rem; background: var(--paper-alt); border: 1px solid var(--line-soft); overflow-x: auto; white-space: nowrap; text-align: center; font: 400 1.05rem/2 var(--slab); }
.section--alt .eq { background: var(--paper); }
.button small { font-size: .85em; text-transform: none; letter-spacing: 0; color: var(--muted); }
@media (max-width: 768px) { .section { padding: 2.75rem 0; } .section__title { font-size: 1.55rem; } }

/* ---------- Figures ---------- */
.figure { margin: 2rem 0; }
.figure__frame { background: var(--paper); border: 1px solid var(--line); padding: 1rem; }
.figure__frame img, .figure__frame video { margin: 0 auto; }
.figure__frame > img + img, .figure__frame > video + img { margin-top: .5rem; }
.figure--plain .figure__frame { border: 0; padding: 0; background: none; }
.figure figcaption { margin-top: .75rem; font-size: .85rem; color: var(--muted); max-width: var(--measure); }
.figure figcaption strong { color: var(--ink); }
.figure-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; }
.figure-grid .figure { margin: 0; }
.teaser { padding: 2.5rem 0 3rem; background: var(--paper-alt); border-bottom: 1px solid var(--line-soft); }
.teaser .figure { margin: 0; }
.teaser .figure figcaption { max-width: none; }

/* ---------- Highlights (MaLGa spot cards) ---------- */
.highlights { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1rem; margin: 2rem 0 0; padding: 0; list-style: none; }
.highlights li { background: var(--paper); border: 1px solid var(--line-soft); padding: 1.5rem; }
.highlights h3 { margin: 0 0 .5rem; font-size: 1.1rem; font-style: italic; color: var(--link); }
.highlights p { margin: 0; font-size: .92rem; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr)); gap: 1rem; margin: 2rem 0; padding: 0; list-style: none; }
.stats li { background: var(--line-soft); padding: 1.25rem; }
.stats strong { display: block; font: 700 1.9rem/1.1 var(--slab); color: var(--ink-strong); }
.stats span { font-size: .85rem; color: var(--muted); }

/* ---------- Tables ---------- */
.table-block { margin: 2rem 0; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-top: 2px solid var(--ink); border-bottom: 2px solid var(--ink); }
.data-table { width: 100%; border-collapse: collapse; margin: 0; font-size: .85rem; font-variant-numeric: tabular-nums; }
.data-table caption { caption-side: top; text-align: left; font-size: .85rem; color: var(--muted); padding: 0 0 .6rem; }
.table-block > .table-caption { font-size: .85rem; color: var(--muted); margin: 0 0 .6rem; max-width: var(--measure); }
.table-block > .table-caption strong { color: var(--ink); }
.data-table th, .data-table td { padding: .5rem .65rem; text-align: center; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table thead th { font-weight: 600; color: var(--ink-strong); border-bottom: 1px solid var(--ink); vertical-align: bottom; }
.data-table thead tr + tr th { font-weight: 500; color: var(--muted); }
.data-table th[scope="row"], .data-table td.left, .data-table th.left { text-align: left; }
.data-table tbody th[scope="row"] { font-weight: 400; color: var(--ink-strong); }
.data-table tr.ours th[scope="row"] { font-weight: 600; }
.data-table tbody tr:last-child > * { border-bottom: 0; }
.data-table tbody th[scope="rowgroup"] { text-align: left; font-weight: 600; background: var(--paper-alt); color: var(--ink-strong); }
.data-table .best { font-weight: 700; color: var(--ink-strong); }
.data-table .second { text-decoration: underline; text-underline-offset: .2em; }
.data-table tr.ours > * { background: var(--coral-wash); }
.data-table tr.group-start > * { border-top: 1px solid var(--ink); }
.table-note { font-size: .78rem; color: var(--muted); margin-top: .5rem; }

/* ---------- Media ---------- */
.media-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: 1.5rem; }
.media-card { margin: 0; }
.media-card h3 { font-size: 1.1rem; margin: 0 0 .75rem; }
.media-card a.preview { display: block; border: 1px solid var(--line); background: var(--paper); transition: box-shadow var(--ease); }
.media-card a.preview:hover { box-shadow: 0 1px 3px 1px rgba(152, 176, 194, .2), 0 2px 8px 4px rgba(60, 64, 67, .1); }
.media-card video { width: 100%; background: #000; }
.media-card p { font-size: .85rem; color: var(--muted); margin: .6rem 0 0; }
.placeholder { display: grid; place-items: center; aspect-ratio: 16 / 9; border: 1px dashed var(--line); background: var(--paper); color: #999; font: 400 1.4rem var(--slab); }
.placeholder span { transform: rotate(-6deg); }

/* ---------- FAQ ---------- */
.faq { max-width: var(--measure); border-top: 1px solid var(--line); }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; list-style: none; display: flex; gap: 1rem; justify-content: space-between; align-items: baseline; padding: 1rem 0; font-weight: 500; color: var(--ink-strong); }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font: 300 1.4rem/1 var(--slab); color: var(--coral-dark); flex: none; }
.faq details[open] summary::after { content: "\2212"; }
.faq details > div { padding: 0 0 1rem; }
.faq details > div p:last-child { margin-bottom: 0; }

/* ---------- Citation ---------- */
.cite { display: flex; flex-direction: column; align-items: flex-end; gap: .5rem; max-width: 100%; }
.cite pre { margin: 0; width: 100%; padding: 1.25rem; background: var(--paper); border: 1px solid var(--line); overflow-x: auto; font: .78rem/1.6 var(--mono); color: var(--ink-strong); white-space: pre; }
.cite__copy[data-copied="true"] { background: var(--night); color: #fff; border-color: var(--night); }

/* ---------- Related work (graph timeline) ---------- */
.related { position: relative; margin: 0; padding: 0 0 0 1.75rem; list-style: none; max-width: var(--measure); }
.related::before { content: ""; position: absolute; left: .3rem; top: .5rem; bottom: .5rem; width: 1px; background: var(--coral-light); }
.related li { position: relative; padding: 0 0 1.25rem; }
.related li:last-child { padding-bottom: 0; }
.related li::before { content: ""; position: absolute; left: -1.75rem; top: .35rem; width: .65rem; height: .65rem; background: var(--paper); border: 2px solid var(--coral); border-radius: 50%; }
.related li[aria-current="page"]::before { background: var(--coral); }
.related__venue { display: block; font-size: .78rem; font-weight: 500; color: var(--muted); }
.related__title { font-family: var(--slab); font-size: 1.02rem; color: var(--ink-strong); }
a.related__title { text-decoration-color: var(--coral-light); }
a.related__title:hover { color: var(--link); }
.related__here { font-size: .78rem; color: var(--link); margin-left: .4rem; font-weight: 500; }
.related p { margin: .15rem 0 0; font-size: .85rem; color: var(--muted); }

/* ---------- Footer ---------- */
.site-footer { background: var(--night); color: #ccc; padding: 3.5rem 0 2rem; font-size: .85rem; }
.site-footer a { color: #fff; text-decoration-color: rgba(255, 255, 255, .35); }
.site-footer a:hover { color: var(--coral-light); }
.site-footer__grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; }
.site-footer__logo img { width: 13rem; height: auto; margin-bottom: 1rem; }
.site-footer h2 { font: italic 400 1.05rem/1.3 var(--slab); color: #fff; margin: 0 0 .75rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; }
.site-footer li + li { margin-top: .35rem; }
.site-footer__legal { margin-top: 2.5rem; padding-top: 1.25rem; border-top: 1px solid var(--night-line); font-size: .78rem; color: #aaa; display: flex; flex-wrap: wrap; gap: .5rem 1.5rem; justify-content: space-between; }
@media (max-width: 768px) { .site-footer__grid { grid-template-columns: 1fr; } }

@media print {
  .site-header, .site-nav, .cite__copy, .hero::after { display: none !important; }
  .section, .teaser { padding: 1.5rem 0; }
  a { color: inherit; }
}
