/* Brand colours: same tokens as the portal (portal/src/reader.css). Light/dark follows the system until the
   visitor flips the header switch, which sets data-theme on <html>. */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }
:root {
  color-scheme: light dark;
  --bg: light-dark(#fbfaf7, #171614);
  --fg: light-dark(#1f1d1a, #ece8e1);
  --muted: light-dark(#5c564d, #b3aca0);
  --accent: light-dark(#6b4f2a, #d9b27c);
  --on-accent: light-dark(#fff, #171614);
  --surface: light-dark(#f2eee6, #23211e);
  --line: light-dark(#e2dccf, #3a3631);
  --radius: 14px;
  --wide: 68rem;
  font: 400 1.0625rem/1.6 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); }
a { color: var(--accent); text-underline-offset: 0.15em; }
a:focus-visible, .button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
img { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.2; text-wrap: balance; }
h1 { font-size: clamp(2rem, 6vw, 3.5rem); margin: 0 0 1rem; letter-spacing: -0.02em; }
h1 em { color: var(--accent); }
h2 { font-size: clamp(1.4rem, 3.5vw, 1.9rem); }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--bg); padding: 0.5rem 1rem; z-index: 1; }

main, .top, .foot { max-width: var(--wide); margin-inline: auto; padding-inline: 1rem; }

/* Phone: wordmark and switches on the first row, menu below. Wider: one row, switches at the far right. */
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; padding-block: 1rem; }
.wordmark { font-weight: 800; font-size: 1.35rem; color: var(--fg); text-decoration: none; letter-spacing: -0.01em; }
/* The Excenter logo, on the Excenter page: E + red X + CENTER, red rule, subtitle in the page's language. */
.excenter { display: inline-flex; flex-direction: column; line-height: 1; }
.ex-word { display: inline-flex; align-items: center; font-size: 1.6rem; letter-spacing: 0.04em; }
.xmark { height: 1.45em; width: auto; margin-inline: 0.02em 0.06em; }
.ex-sub { margin-top: 0.2rem; padding-top: 0.25rem; border-top: 2px solid #d21f2f; font-size: 0.7rem; font-weight: 600; letter-spacing: 0.06em; text-align: right; }
.top nav { display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1.1rem; order: 2; flex-basis: 100%; }
.tools { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; order: 1; }
@media (min-width: 48rem) {
  .top nav { order: 1; flex-basis: auto; margin-left: auto; }
  .tools { order: 2; margin-left: 0; }
}
.theme, .lang { display: inline-flex; align-items: center; gap: 0.45rem; min-height: 2.5rem; padding: 0 0.7rem; border: 1px solid var(--line); border-radius: 999px; background: none; color: var(--fg); font: inherit; text-decoration: none; cursor: pointer; }
.theme { width: 2.5rem; justify-content: center; padding: 0; }
.theme:hover, .lang:hover { border-color: var(--accent); }
.theme:focus-visible, .lang:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.theme svg { width: 1.15rem; height: 1.15rem; fill: currentColor; }
.flag { height: 1rem; width: auto; border-radius: 2px; box-shadow: 0 0 0 1px var(--line); }
/* Narrow phones: flag only, so the switches fit beside the wordmark; the name stays for screen readers. */
@media (max-width: 26rem) {
  .lang span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
/* Show the icon of the theme you'd switch to: a moon in light mode, a sun in dark mode. */
.theme .sun, :root[data-theme="dark"] .theme .moon { display: none; }
:root[data-theme="dark"] .theme .sun { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme .moon { display: none; }
  :root:not([data-theme="light"]) .theme .sun { display: block; }
}
.top nav a:not(.button) { color: var(--fg); text-decoration: none; padding-block: 0.4rem; }
.top nav a:hover, .top nav a[aria-current] { text-decoration: underline; }

.button { display: inline-block; background: var(--accent); color: var(--on-accent); text-decoration: none; font-weight: 600; padding: 0.75rem 1.25rem; border-radius: 999px; border: 2px solid var(--accent); }
.button.ghost { background: transparent; color: var(--accent); }
.button.small { padding: 0.4rem 0.95rem; }

.hero { padding-block: clamp(2.5rem, 9vw, 6rem) 2rem; max-width: 46rem; }
.lead { font-size: 1.2rem; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 0.75rem; margin-top: 1.75rem; }

.cards { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); }
.card { background: var(--surface); border-radius: var(--radius); padding: 1.5rem; scroll-margin-top: 1rem; }
.card h2 { font-size: 1.25rem; margin-top: 0; }

.band { margin-block: 3rem; padding: clamp(1.5rem, 5vw, 3rem); border: 1px solid var(--line); border-radius: var(--radius); }
.band h2 { margin-top: 0; }
.portal { list-style: none; padding: 0; margin: 1.5rem 0 0; display: grid; gap: 0.75rem; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); }
.portal a { display: flex; flex-direction: column; gap: 0.25rem; padding: 1rem 1.25rem; border-radius: var(--radius); background: var(--surface); text-decoration: none; color: var(--fg); height: 100%; }
.portal a:hover strong { text-decoration: underline; }
.portal strong { color: var(--accent); font-size: 1.1rem; }

.company-teaser { max-width: 46rem; margin-bottom: 3rem; }

.logos { display: flex; flex-wrap: wrap; gap: 1rem; }
/* The old logos are JPGs on white: give them a white card so dark mode stays clean. */
.logos img, .clients img { background: #fff; border-radius: 8px; padding: 0.5rem; }
.logos img { width: min(13rem, calc(50% - 0.5rem)); }
.toc { display: flex; flex-wrap: wrap; gap: 0.5rem 1.25rem; margin-top: 1.5rem; }

.prose { max-width: 46rem; border-top: 1px solid var(--line); padding-block: 1rem 2rem; scroll-margin-top: 1rem; }
.bio { display: flex; flex-wrap: wrap; gap: 1.25rem; align-items: flex-start; }
.bio img { width: 9rem; border-radius: 8px; }
.bio > div { flex: 1 1 18rem; }
.bio p:first-child { margin-top: 0; }
.pubs { display: grid; gap: 1.5rem; grid-template-columns: minmax(0, 1fr); }
.pubs img { max-width: min(100%, 24rem); border-radius: var(--radius); }
.clients { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; }
.clients img { width: 9rem; }
.contact { display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1.25rem; }
.contact dt { font-weight: 600; }
.contact dd { margin: 0; }

.books { padding-left: 1.2rem; }
.books span { display: block; color: var(--muted); font-size: 0.95rem; }

/* Book landing page */
.crumbs { padding-top: 1.5rem; color: var(--muted); font-size: 0.95rem; }
.book { max-width: 46rem; padding-bottom: 3rem; }
.book h1 { margin-top: 1rem; }
.book h2 { font-size: 1.25rem; margin-top: 2rem; }
.record { padding: 1.25rem; border: 1px solid var(--line); border-radius: var(--radius); }
.record dd { overflow-wrap: anywhere; }
.orcid-link { display: inline-flex; align-items: center; gap: 0.3rem; font-size: 0.95rem; overflow-wrap: anywhere; }
.orcid { width: 1.1rem; height: 1.1rem; flex: none; }
.pending { color: var(--muted); font-style: italic; }
.cite { padding: 1rem 1.25rem; background: var(--surface); border-radius: var(--radius); overflow-wrap: anywhere; }

.foot { border-top: 1px solid var(--line); padding-block: 1.5rem 2.5rem; color: var(--muted); font-size: 0.95rem; }

@media (max-width: 30rem) {
  .contact { grid-template-columns: 1fr; }
  .contact dd { margin-bottom: 0.5rem; }
}
