/* ==========================================================================
   The danielesambu.com chrome: header, footer, buttons, filters, metrics.
   --------------------------------------------------------------------------
   Rules below the "From the site" line are copied from the site's
   assets/css/site.css (sections 1, 4, 5 and 7) so the Leka docs and the
   replay viewer carry the same header and footer as every other page on
   danielesambu.com. They read only from site-tokens.css.

   The block at the end resets what Doxygen's own stylesheets would
   otherwise leak into the header and footer (list bullets, link colours,
   heading sizes), since those pages load doxygen.css first.
   ========================================================================== */

/* ---- From the site ------------------------------------------------------ */

/* 1. Font fallbacks --------------------------------------------------------
   Local fonts resized to the web fonts' metrics, so text keeps its size and
   line breaks when the web font arrives. Values measured with fontTools
   from the Google Fonts files. */
@font-face {
  font-family: "Newsreader Fallback";
  src: local("Georgia");
  size-adjust: 96.07%;
  ascent-override: 76.51%;
  descent-override: 27.58%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "Inter Fallback";
  src: local("Arial"), local("ArialMT");
  size-adjust: 107.48%;
  ascent-override: 90.14%;
  descent-override: 22.44%;
  line-gap-override: 0%;
}
@font-face {
  font-family: "JetBrains Mono Fallback";
  src: local("Menlo"), local("Courier New");
  size-adjust: 99.66%;
  ascent-override: 102.35%;
  descent-override: 30.1%;
  line-gap-override: 0%;
}

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

.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: 100;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  background: var(--ink);
  color: var(--paper);
  font-size: var(--step-n1);
  font-weight: var(--weight-medium);
  text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; color: var(--paper); }

/* Small technical labels: dates, metrics, tags. The "nerdy" signal. */
.mono {
  font-family: var(--font-mono);
  font-size: var(--step-n1);
  font-feature-settings: "zero" 1;
}
.eyebrow {
  display: block;
  font-family: var(--font-mono);
  font-size: var(--step-n2);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--ink-3);
}

/* 4. Header and nav -------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
          backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: var(--hairline) solid var(--line);
}
.site-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-right: auto;
  color: var(--ink);
  text-decoration: none;
}
.brand:hover { color: var(--ink); }
.brand__mark { width: 38px; height: 25px; flex: none; }
.brand__name {
  font-family: var(--font-serif);
  font-size: var(--step-1);
  line-height: 1;
  letter-spacing: -0.01em;
  white-space: nowrap;
}

/* The mark: lifted wings, green edges and veins, gold cells. */
.mark__edge { fill: var(--wing-edge); }
.mark__cell { fill: var(--gold); }
.mark__vein { stroke: var(--wing-edge); }

/* Navigation: four sections (Work, Writing, Math, Life) from _data/nav.yml.
   Wide screens: each section is a small menu. Narrow screens: one sheet
   with every section open, no nested toggles. */
.site-nav__list {
  display: flex;
  align-items: center;
  gap: var(--space-1) var(--space-5);
  margin: 0;
  padding: 0;
  list-style: none;
}
.site-nav__link,
.footer-nav a {
  position: relative;
  display: inline-block;
  padding-block: var(--space-2);
  color: var(--ink-2);
  font-size: var(--step-n1);
  font-weight: var(--weight-medium);
  text-decoration: none;
}
button.site-nav__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding-inline: 0;
  border: 0;
  background: none;
  font-family: inherit;
  line-height: inherit;
  cursor: pointer;
}
/* Growing gold underline: the one hover signature for navigation. */
.site-nav__link::after,
.footer-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4px;
  height: 1.5px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur) var(--ease);
}
.site-nav__link:hover,
.footer-nav a:hover { color: var(--ink); }
.site-nav__link:hover::after,
.footer-nav a:hover::after { transform: scaleX(1); }
.site-nav__link[aria-current="page"],
.is-current > .nav-group__toggle { color: var(--ink); }
.site-nav__link[aria-current="page"]::after,
.is-current > .nav-group__toggle::after { transform: scaleX(1); background: var(--accent); }

.nav-group { position: relative; }
.nav-group__label { display: none; }
.nav-group__caret { transition: transform var(--dur) var(--ease); }
.nav-group.is-open .nav-group__caret { transform: rotate(180deg); }

.nav-group__panel {
  position: absolute;
  top: calc(100% + var(--space-2));
  left: calc(var(--space-3) * -1);
  z-index: 60;
  display: none;
  min-width: 17rem;
  margin: 0;
  padding: var(--space-2);
  list-style: none;
  border: var(--hairline) solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: var(--shadow-float);
}
.nav-group.is-open > .nav-group__panel { display: block; animation: nav-in var(--dur) var(--ease); }
/* Without JavaScript, hover and keyboard focus open the menus. */
html:not(.js) .nav-group:hover > .nav-group__panel,
html:not(.js) .nav-group:focus-within > .nav-group__panel { display: block; }
@keyframes nav-in {
  from { opacity: 0; transform: translateY(calc(var(--rise) * -0.5)); }
  to { opacity: 1; transform: none; }
}

.nav-item {
  display: grid;
  gap: 2px;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: background-color var(--dur-fast) var(--ease);
}
.nav-item:hover { background: var(--surface); }
.nav-item__title {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  color: var(--ink);
  font-size: var(--step-n1);
  font-weight: var(--weight-medium);
}
.nav-item__ext { width: 0.9em; height: 0.9em; color: var(--ink-3); }
.nav-item__desc { color: var(--ink-3); font-size: var(--step-n1); line-height: var(--leading-snug); }
.nav-item[aria-current="page"] .nav-item__title { color: var(--accent); }

.site-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.site-header__hi { margin-right: var(--space-3); }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 0;
  border-radius: var(--radius-round);
  background: transparent;
  color: var(--ink-2);
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease), background-color var(--dur-fast) var(--ease);
}
.icon-btn:hover { color: var(--ink); background: var(--surface); }
.icon-btn svg { width: 18px; height: 18px; }

/* The toggle needs JavaScript; without it the OS theme applies. */
html:not(.js) .theme-toggle { display: none; }

/* Show the icon for the theme you would switch to. */
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

.menu-toggle {
  display: none;
  padding: var(--space-2) var(--space-3);
  border: var(--hairline) solid var(--line-strong);
  border-radius: var(--radius);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--step-n1);
  font-weight: var(--weight-medium);
  cursor: pointer;
}

.site-nav__extra { display: none; }

/* Narrow screens: the nav becomes one sheet behind a Menu button, with
   every section listed under a small label. Without JavaScript the sheet
   is simply always shown under the header. */
@media (max-width: 59.99rem) {
  .site-header__inner { flex-wrap: wrap; row-gap: 0; }
  .site-header__hi,
  .js .site-header__actions .btn { display: none; }
  .js .menu-toggle { display: inline-flex; }

  .site-nav {
    order: 3;
    width: 100%;
    padding: var(--space-2) 0 var(--space-5);
  }
  .js .site-nav {
    display: none;
    max-height: calc(100vh - var(--header-h));
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  .js .site-header.is-open .site-nav { display: block; }

  .site-nav__list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 9.5rem), 1fr));
    align-items: start;
    gap: var(--space-5) var(--space-4);
  }
  button.nav-group__toggle { display: none; }
  .nav-group__label {
    display: block;
    margin-bottom: var(--space-2);
    font-family: var(--font-mono);
    font-size: var(--step-n2);
    font-weight: var(--weight-medium);
    letter-spacing: var(--tracking-label);
    text-transform: uppercase;
    color: var(--ink-3);
  }
  .nav-group__panel,
  .nav-group.is-open > .nav-group__panel {
    position: static;
    display: block;
    min-width: 0;
    padding: 0;
    border: 0;
    background: none;
    box-shadow: none;
    animation: none;
  }
  .nav-item { padding: var(--space-1) 0; }
  .nav-item:hover { background: none; }
  .nav-item__title,
  .nav-group--single .site-nav__link {
    padding: 0;
    font-family: var(--font-serif);
    font-size: var(--step-1);
    font-weight: var(--weight-regular);
    color: var(--ink);
  }
  .nav-item__desc { display: none; }
  .nav-group--single .site-nav__link { padding-block: var(--space-1); }
  .nav-group--single .site-nav__link::after { display: none; }
  .nav-group--single .site-nav__link[aria-current="page"] { color: var(--accent); }

  .site-nav__extra {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    margin-top: var(--space-6);
  }
}

/* 5. Footer ---------------------------------------------------------------- */
.site-footer {
  position: relative;
  margin-top: var(--space-section);
  padding-block: var(--space-8) var(--space-6);
  border-top: var(--hairline) solid var(--line);
  font-size: var(--step-n1);
  overflow: hidden;
}
/* A Kuba lattice, barely there. The one texture in the footer. */
.site-footer::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-color: var(--ink);
  opacity: 0.03;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cg fill='none' stroke='%23000' stroke-width='1.25'%3E%3Cpath d='M0 24 24 0 48 24 24 48Z'/%3E%3Cpath d='M12 24 24 12 36 24 24 36Z'/%3E%3C/g%3E%3Crect x='21' y='21' width='6' height='6' transform='rotate(45 24 24)'/%3E%3C/svg%3E") repeat 0 0 / 48px 48px;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cg fill='none' stroke='%23000' stroke-width='1.25'%3E%3Cpath d='M0 24 24 0 48 24 24 48Z'/%3E%3Cpath d='M12 24 24 12 36 24 24 36Z'/%3E%3C/g%3E%3Crect x='21' y='21' width='6' height='6' transform='rotate(45 24 24)'/%3E%3C/svg%3E") repeat 0 0 / 48px 48px;
  pointer-events: none;
}
.site-footer { isolation: isolate; }

.site-footer__grid {
  display: grid;
  gap: var(--space-7) var(--space-5);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.site-footer__grid > :first-child { grid-column: 1 / -1; }
@media (min-width: 48rem) {
  .site-footer__grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 64rem) {
  .site-footer__grid { grid-template-columns: minmax(0, 1.6fr) repeat(4, minmax(0, 1fr)); }
  .site-footer__grid > :first-child { grid-column: auto; }
}

.site-footer__hello {
  margin-bottom: var(--space-2);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: var(--step-2);
  line-height: var(--leading-snug);
}
.site-footer__email {
  font-family: var(--font-mono);
  font-size: var(--step-n1);
  word-break: break-all;
}
.site-footer__cta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.footer-nav h2 {
  margin-bottom: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--step-n2);
  font-weight: var(--weight-medium);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
  color: var(--ink-3);
}
.footer-nav ul { margin: 0; padding: 0; list-style: none; }
.footer-nav a { padding-block: var(--space-1); font-weight: var(--weight-regular); }
.footer-nav a::after { bottom: 2px; }
.footer-nav .note { color: var(--ink-3); }
.footer-nav--inline { margin-top: var(--space-7); }
.footer-nav--inline ul { display: flex; flex-wrap: wrap; gap: 0 var(--space-5); }

.site-footer__bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--space-2) var(--space-5);
  margin-top: var(--space-8);
  padding-top: var(--space-5);
  border-top: var(--hairline) solid var(--line);
  color: var(--ink-3);
}
.site-footer__closing {
  font-family: var(--font-serif);
  font-size: var(--step-1);
  color: var(--ink-2);
}

/* 7. Buttons, links, tags -------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: var(--space-2) var(--space-5);
  border: var(--hairline) solid transparent;
  border-radius: var(--radius);
  font: inherit;
  font-size: var(--step-n1);
  font-weight: var(--weight-medium);
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--dur-fast) var(--ease), border-color var(--dur-fast) var(--ease), color var(--dur-fast) var(--ease);
}
.btn svg { width: 16px; height: 16px; flex: none; }
.btn--primary { background: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-strong); color: var(--on-accent); }
.btn--ghost { border-color: var(--line-strong); color: var(--ink); background: transparent; }
.btn--ghost:hover { border-color: var(--ink); color: var(--ink); }
.btn--sm { min-height: 36px; padding: var(--space-1) var(--space-4); }

/* A text link with an arrow that nudges on hover. */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
  color: var(--accent);
  font-weight: var(--weight-medium);
  text-decoration: none;
}
.link-arrow svg {
  width: 1em;
  height: 1em;
  transition: transform var(--dur) var(--ease);
}
.link-arrow:hover svg { transform: translateX(3px); }
.link-arrow[href^="http"]:hover svg { transform: translate(2px, -2px); }

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0;
  padding: 0;
  list-style: none;
}
.tag {
  display: inline-block;
  padding: 0.15em 0.55em;
  border: var(--hairline) solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: var(--step-n2);
  line-height: 1.6;
  color: var(--ink-2);
  white-space: nowrap;
}

/* Filter row: plain words with the same underline as the nav. */
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  margin: 0 0 var(--space-6);
  padding: 0;
  list-style: none;
}
.filter {
  position: relative;
  padding: var(--space-1) 0;
  border: 0;
  background: none;
  color: var(--ink-3);
  font: inherit;
  font-size: var(--step-n1);
  cursor: pointer;
}
.filter::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1.5px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur) var(--ease);
}
.filter:hover { color: var(--ink); }
.filter:hover::after { transform: scaleX(1); }
.filter[aria-pressed="true"] { color: var(--ink); }
.filter[aria-pressed="true"]::after { transform: scaleX(1); background: var(--accent); }

/* Big mono numerals for key metrics. */
.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
  gap: var(--space-6) var(--space-5);
  margin: var(--space-6) 0 0;
}
.metrics dd { margin: 0; }
.metric { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: var(--space-1); }
.metric__value {
  font-family: var(--font-mono);
  font-size: var(--step-2);
  font-weight: var(--weight-regular);
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--ink);
  font-feature-settings: "zero" 1, "tnum" 1;
}
.metric__label { font-size: var(--step-n1); line-height: var(--leading-snug); color: var(--ink-3); }


/* ---- Isolation from Doxygen -------------------------------------------- */
.site-header,
.site-footer {
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: var(--leading);
  color: var(--ink-2);
  text-align: left;
}
.site-footer { font-size: var(--step-n1); }
.site-header *,
.site-footer * { box-sizing: border-box; }
.site-header ul,
.site-footer ul { margin: 0; padding: 0; list-style: none; }
.site-header li,
.site-footer li { margin: 0; padding: 0; }
.site-header p,
.site-footer p { margin: 0; }
.site-header a,
.site-footer a,
.site-header a:hover,
.site-footer a:hover { border-bottom: 0; }
.site-header svg,
.site-footer svg { display: block; max-width: 100%; height: auto; }
.site-header .wrap,
.site-footer .wrap {
  width: 100%;
  max-width: calc(var(--wrap) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.site-footer a { color: var(--accent); }
.site-footer .footer-nav a { color: var(--ink-2); }
.site-footer .footer-nav a:hover { color: var(--ink); }
.site-footer h2 {
  margin: 0 0 var(--space-3);
  padding: 0;
  border: 0;
  line-height: var(--leading-snug);
}
.site-footer .btn--ghost { color: var(--ink); }
.site-header .btn--primary,
.site-footer .btn--primary { color: var(--on-accent); }

/* doxygen-awesome sets every link's colour with
   `color: var(--link-color) !important` and clears its background. Rather
   than out-shout it, each chrome link sets --link-color on itself, which that
   rule then resolves to the site's colour; the background is restored one
   notch more specifically. Outside Doxygen these are inert. */
.skip-link { --link-color: var(--paper); }
.site-header .brand { --link-color: var(--ink); }
.site-header .site-nav__link { --link-color: var(--ink-2); }
.site-header .site-nav__link:hover,
.site-header .site-nav__link[aria-current="page"] { --link-color: var(--ink); }
.site-footer a { --link-color: var(--accent); }
.site-footer .footer-nav a { --link-color: var(--ink-2); }
.site-footer .footer-nav a:hover { --link-color: var(--ink); }
.btn--primary { --link-color: var(--on-accent); }
.btn--ghost,
.site-footer .btn--ghost { --link-color: var(--ink); }
.link-arrow { --link-color: var(--accent); }
.link-arrow:hover { --link-color: var(--accent-strong); }
a.btn--primary { background: var(--accent); }
a.btn--primary:hover { background: var(--accent-strong); }
a.btn--ghost { background: transparent; }
