/* --------------------------------------------------------------------------
   Pattern Recognition Group · CAIDAS · JMU Würzburg
   A small, typographic theme: paper, ink, one accent, and hairline rules.
   -------------------------------------------------------------------------- */

:root {
  color-scheme: light dark;

  /* Cool grey-blue paper, kept a step deeper than the usual near-white so the
     page sits below screen glare without losing the institutional blue cast.
     Depth ladder (swap --paper / --hero-bg / --surface together):
       #eef2f6 / #f7f9fb / #ffffff  – the original, brightest
       #eaf0f5 / #f6f9fc / #fdfeff  – one step lighter than here
       #e5eaee / #f7f9fb / #fbfcfd  – default: about 8 points darker than original
       #dee4ea / #f3f6f9 / #f9fbfc  – clearly deeper, slate-ish
       #d6dde4 / #eff3f7 / #f7f9fb  – near "dark paper", strongest reduction */
  --paper: #e5eaee;
  --ink: #1d1d1b;
  --muted: #5c6670;
  --faint: #848b93;
  --rule: #d3dae1;
  --rule-soft: #e4e9ee;
  --accent: #002f67;
  --open: #2f6b4f;
  --taken: #8a5a52;

  /* Theme-dependent surfaces. */
  --surface: #fbfcfd;
  --hero-bg: #f7f9fb;
  --logo-chip: transparent;
  --logo-chip-pad: 0;
  --hero-image-filter: none;

  --sans: "Roboto", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --serif: var(--sans);
  --mono: "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;

  --measure: 43rem;

  /* How tall the projects pane grows before it starts scrolling. Raise it for
     fewer visible rows, lower it for more; `none` disables scrolling entirely. */
  --table-max-height: 26rem;
}

/* Follow the system until the visitor picks a theme in the header. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --paper: #151514;
    --ink: #e8e5de;
    --muted: #a39e94;
    --faint: #7a756c;
    --rule: #35332e;
    --rule-soft: #282722;
    --accent: #9dbdd8;
    --open: #79b394;
    --taken: #c08f85;

    --surface: #171a1f;
    --hero-bg: #1a1d22;
    --logo-chip: #fcfbf8;
    --logo-chip-pad: 0.3rem 0.55rem;
    --hero-image-filter: brightness(0.88) saturate(0.95);
  }
}

/* Explicit choice from the theme toggle. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #151514;
  --ink: #e8e5de;
  --muted: #a39e94;
  --faint: #7a756c;
  --rule: #35332e;
  --rule-soft: #282722;
  --accent: #9dbdd8;
  --open: #79b394;
  --taken: #c08f85;
  --surface: #171a1f;
  --hero-bg: #1a1d22;
  --logo-chip: #fcfbf8;
  --logo-chip-pad: 0.3rem 0.55rem;
  --hero-image-filter: brightness(0.88) saturate(0.95);
}

:root[data-theme="light"] {
  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 0.95rem;
  line-height: 1.66;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

@media (min-width: 900px) {
  body {
    font-size: 0.95rem;
  }
}

.wrap {
  width: min(calc(100% - 3rem), var(--measure));
  margin-inline: auto;
}

::selection {
  background: var(--ink);
  color: var(--paper);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.skip-link {
  position: absolute;
  top: -4rem;
  left: 1rem;
  z-index: 10;
  padding: 0.55rem 0.8rem;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 0.75rem;
  text-decoration: none;
}

.skip-link:focus {
  top: 1rem;
}

/* Header ------------------------------------------------------------------ */

.site-header {
  padding: 1.4rem 0;
  background: var(--surface);
  border-bottom: 3px solid var(--accent);
}

.site-header .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem 1.5rem;
}

.site-title {
  font-family: var(--sans);
  font-size: 1.00rem;
  font-weight: 650;
  letter-spacing: 0.1em;
  color: var(--ink);
}

.site-actions {
  display: flex;
  align-items: center;
  gap: 1.35rem;
}

.site-logos {
  display: flex;
  align-items: center;
  gap: 1.15rem;
  padding: var(--logo-chip-pad);
  background: var(--logo-chip);
  border-radius: 2px;
}

.site-logos a {
  display: inline-flex;
  align-items: center;
  opacity: 0.92;
}

.site-logos a:hover,
.site-logos a:focus-visible {
  opacity: 1;
}

.site-logos img {
  display: block;
  width: auto;
  height: 2.5rem;
}

.site-logos a:first-child img {
  height: 3.25rem;
}

.theme-toggle {
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--rule);
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  color: var(--ink);
  border-color: var(--faint);
}

.theme-toggle svg {
  width: 15px;
  height: 15px;
}

/* Page -------------------------------------------------------------------- */

main {
  padding: 2.6rem 0 5.5rem;
}

/* Hero card: text on the blank left half, tissue on the diagonally cut
   right half — contained in the text column, not full-bleed. */
.page-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 38%);
  margin-bottom: 3.2rem;
  background: var(--hero-bg);
  overflow: hidden;
}

.page-hero__inner {
  align-self: center;
  padding: 2.6rem 2.2rem 2.6rem 2.6rem;
}

.page-hero .page-title {
  font-size: clamp(1.8rem, 3.2vw, 2.45rem);
  margin-bottom: 0.9rem;
}

.page-hero__media {
  position: relative;
  min-height: 16rem;
}

.page-hero__media img {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 52% 45%;
  clip-path: polygon(16% 0, 100% 0, 100% 100%, 0 100%);
  filter: var(--hero-image-filter);
}

.page-title {
  max-width: 15em;
  margin: 0 0 0.85rem;
  font-family: var(--serif);
  font-size: clamp(2.15rem, 4.8vw, 2.85rem);
  font-weight: 400;
  line-height: 1.1;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.page-lede {
  max-width: 35rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.62;
}

/* Prose ------------------------------------------------------------------- */

.prose p {
  margin: 0 0 1.15rem;
}

.prose h2 {
  margin: 3.6rem 0 1.15rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--rule);
  font-family: var(--sans);
  font-size: 1.3rem;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink);
}

.prose h2:first-child {
  margin-top: 0;
}

.prose h3 {
  margin: 2.2rem 0 0.7rem;
  font-family: var(--serif);
  font-size: 1.08rem;
  font-weight: 650;
  line-height: 1.35;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover,
a:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.18em;
  text-decoration-thickness: 1px;
}

.prose a[href^="mailto:"] {
  font-weight: 600;
  overflow-wrap: anywhere;
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 0.18em;
}

.prose a[href^="mailto:"]:hover {
  text-decoration-color: currentColor;
}

strong {
  font-weight: 650;
}

/* Tables: booktabs, no vertical rules ------------------------------------- */

.prose table {
  width: 100%;
  margin: 0 0 2.4rem;
  border-collapse: collapse;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--ink);
  font-family: var(--sans);
  font-size: 0.9rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

.prose thead th {
  padding: 0.6rem 0.7rem 0.55rem;
  border-bottom: 1px solid var(--ink);
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-align: left;
  text-transform: uppercase;
  vertical-align: bottom;
}

.prose tbody td {
  padding: 0.78rem 0.7rem;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: top;
}

.prose tbody tr:last-child td {
  border-bottom: 0;
}

.prose tbody tr:hover {
  background: rgba(28, 38, 48, 0.035);
}

.prose table th:first-child,
.prose table td:first-child {
  text-align: center;
}

.prose tbody td:first-child {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
}

.prose tbody td:last-child {
  color: var(--muted);
  font-size: 0.86rem;
}

/* Projects pane: the table keeps its own height and scrolls inside it, so the
   list can grow without pushing the application instructions off screen.
   The wrapper is added by the script in _layouts/default.html; without
   JavaScript the table simply renders at full height. */

.table-scroll {
  /* `direction: rtl` moves the scrollbar to the left edge; the table below
     switches back to LTR, so only the bar changes side. */
  direction: rtl;
  max-height: var(--table-max-height, 26rem);
  margin: 0 0 2.4rem;
  overflow-y: auto;
}

/* Quiet by design: a thin, faint thumb on a transparent track — no arrows, no
   track fill — that only firms up while the pointer is over the list. */
.table-scroll::-webkit-scrollbar {
  width: 10px;
}

.table-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.table-scroll::-webkit-scrollbar-thumb {
  background-color: var(--rule);
  border-radius: 999px;
}

.table-scroll:hover::-webkit-scrollbar-thumb {
  background-color: var(--faint);
}

/* Firefox has no ::-webkit- scrollbars; these only apply there. */
@supports (-moz-appearance: none) {
  .table-scroll {
    scrollbar-width: thin;
    scrollbar-color: var(--rule) transparent;
  }

  .table-scroll:hover {
    scrollbar-color: var(--faint) transparent;
  }
}

.table-scroll > table {
  direction: ltr;
  margin-bottom: 0;
}

.table-scroll thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--paper);
  /* Collapsed table borders scroll away with the body, so the header rules are
     painted onto the sticky cells instead. */
  box-shadow: inset 0 1px 0 var(--ink), inset 0 -1px 0 var(--ink);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--faint);
}

.status--open::before {
  background: var(--open);
}

.status--taken::before {
  background: transparent;
  box-shadow: inset 0 0 0 1px var(--taken);
}

/* Project-type legend: one small line under the projects table ------------ */

.prose .project-types {
  margin: -1.15rem 0 2.6rem;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.7rem;
  line-height: 1.7;
  letter-spacing: 0.01em;
}

.prose .project-types strong {
  color: var(--ink);
  font-weight: 600;
}

/* Lists -------------------------------------------------------------------- */

.prose ul,
.prose ol {
  margin: 0 0 1.4rem;
  padding-left: 1.35rem;
}

.prose li {
  margin: 0.35rem 0;
  padding-left: 0.2rem;
}

.prose li::marker {
  color: var(--faint);
  font-family: var(--sans);
  font-size: 0.85em;
}

/* Note -------------------------------------------------------------------- */

.prose blockquote {
  margin: 2.2rem 0;
  padding: 0.1rem 0 0.1rem 1.2rem;
  border-left: 2px solid var(--accent);
  color: var(--muted);
  font-size: 0.93rem;
  line-height: 1.6;
}

.prose blockquote p {
  margin: 0.3rem 0;
}

.prose blockquote strong {
  color: var(--ink);
}

/* Footer ------------------------------------------------------------------- */

.site-footer {
  padding: 1.5rem 0 2.75rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-family: var(--sans);
  font-size: 0.7rem;
  line-height: 1.6;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.35rem 2rem;
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  color: var(--muted);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 0.16em;
}

.site-footer a:hover {
  color: var(--accent);
  text-decoration-color: currentColor;
}

/* Small screens ------------------------------------------------------------ */

@media (max-width: 640px) {
  body {
    font-size: 0.95rem;
  }

  .wrap {
    width: calc(100% - 2.2rem);
  }

  main {
    padding: 2.8rem 0 4rem;
  }

  .site-header {
    padding: 1.15rem 0;
  }

  .page-hero {
    grid-template-columns: 1fr;
    margin-bottom: 2.4rem;
  }

  .page-hero__inner {
    padding: 2rem 1.4rem 1.8rem;
  }

  .page-hero__media {
    height: 9rem;
    min-height: 0;
  }

  .page-hero__media img {
    clip-path: polygon(10% 0, 100% 0, 100% 100%, 0 100%);
  }

  .prose h2 {
    margin-top: 2.8rem;
  }

  /* No inner scrolling on phones: the table becomes a list and the page scrolls. */
  .table-scroll {
    direction: ltr;
    max-height: none;
    overflow: visible;
  }

  /* Four-column project table becomes a compact list. */
  .prose table:is(:has(tbody tr td:nth-child(4)), .table--list) {
    display: block;
    border-bottom: 0;
    font-size: 0.82rem;
  }

  .prose table:is(:has(tbody tr td:nth-child(4)), .table--list) thead {
    display: none;
  }

  .prose table:is(:has(tbody tr td:nth-child(4)), .table--list) tbody,
  .prose table:is(:has(tbody tr td:nth-child(4)), .table--list) tr {
    display: block;
  }

  .prose table:is(:has(tbody tr td:nth-child(4)), .table--list) tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.2rem 0.8rem;
    padding: 0.95rem 0;
    border-bottom: 1px solid var(--rule-soft);
  }

  .prose table:is(:has(tbody tr td:nth-child(4)), .table--list) td {
    display: block;
    padding: 0;
    border: 0;
  }

  .prose table:is(:has(tbody tr td:nth-child(4)), .table--list) td:first-child {
    grid-row: 1;
    grid-column: 1;
    text-align: left;
    font-size: 0.68rem;
  }

  .prose table:is(:has(tbody tr td:nth-child(4)), .table--list) td:nth-child(2) {
    grid-row: 2;
    grid-column: 1 / -1;
    color: var(--ink);
    font-family: var(--serif);
    font-size: 0.98rem;
    line-height: 1.5;
  }

  .prose table:is(:has(tbody tr td:nth-child(4)), .table--list) td:nth-child(3) {
    grid-row: 1;
    grid-column: 2;
    justify-self: end;
  }

  .prose table:is(:has(tbody tr td:nth-child(4)), .table--list) td:last-child {
    grid-row: 3;
    grid-column: 1 / -1;
    color: var(--muted);
    font-size: 0.76rem;
  }

  .prose table:is(:has(tbody tr td:nth-child(4)), .table--list) tbody tr:hover {
    background: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

/* Print -------------------------------------------------------------------- */

@media print {
  body {
    background: #fff;
    color: #000;
    font-size: 11pt;
  }

  .site-header,
  .site-footer,
  .skip-link {
    display: none;
  }

  .page-hero {
    display: block;
    padding: 0 0 1.2rem;
    background: none;
    border-bottom: 0;
  }

  .page-hero__inner {
    padding: 0;
  }

  .page-hero__media {
    display: none;
  }

  main {
    padding: 0;
  }

  .wrap {
    width: 100%;
    max-width: none;
  }

  .prose h2 {
    break-after: avoid;
  }

  .prose table,
  .prose blockquote {
    break-inside: avoid;
  }

  /* Scrolling does not exist on paper: print the whole table. */
  .table-scroll {
    direction: ltr;
    max-height: none;
    overflow: visible;
    /* The script offsets the pane by the live scrollbar width; on paper there
       is no scrollbar, so the offset must go too. */
    margin-left: 0 !important;
  }

  .table-scroll thead th {
    position: static;
    box-shadow: none;
  }

  a {
    color: inherit;
    text-decoration: underline;
  }
}
