/* Editorial design — inspired by leerob.com */

@font-face {
  font-family: "STIX Two Text";
  src: url("../fonts/stix-var-latin.50787b9fd0c0.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "STIX Two Text";
  src: url("../fonts/stix-var-latin-ext.dbdb8e60a41e.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "STIX Two Text";
  src: url("../fonts/STIXTwoText-Italic.24435cc1ce4f.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #ffffff;
  --fg: #171717;
  --muted: #737373;
  --border: #e5e5e5;
  --surface: #fafafa;
  --ring: #a1a1a1;
  --code-bg: #111111;
  --code-fg: #f5f5f5;
  --code-border: #171717;
  --code-kw: #c4b5fd;
  --code-str: #86efac;
  --code-cm: #a3a3a3;
  --selection: #e5e5e5;
  /* Content column — a bit wider than classic ~65ch measure */
  --measure: 84ch;
  --page-pad: clamp(1.25rem, 5vw, 2.5rem);
  --page-pad-top: clamp(3rem, 10vh, 6rem);
  --font: "STIX Two Text", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, SFMono-Regular, "Cascadia Code", Menlo, Consolas, monospace;
  --blob-core: rgba(250, 249, 246, 0.14);
  --blob-mid: rgba(168, 176, 186, 0.16);
  --blob-rim: rgba(122, 132, 144, 0.26);
  --blob-edge: rgba(88, 96, 108, 0.32);
  --blob-stroke: rgba(62, 68, 78, 0.28);
  --blob-spec: rgba(255, 255, 255, 0.18);
  --blob-grain: rgba(48, 50, 54, 0.22);
  --blob-blend: normal;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    /* Soft charcoal — not pure black */
    --bg: #1a1a1a;
    --fg: #e8e8e8;
    --muted: #9a9a9a;
    --border: #333333;
    --surface: #242424;
    --ring: #7a7a7a;
    --code-bg: #121212;
    --code-fg: #ececec;
    --code-border: #3d3d3d;
    --code-kw: #c4b5fd;
    --code-str: #86efac;
    --code-cm: #8a8a8a;
    --selection: #2e2e2e;
    --blob-core: rgba(42, 42, 44, 0.2);
    --blob-mid: rgba(120, 126, 134, 0.16);
    --blob-rim: rgba(156, 162, 170, 0.22);
    --blob-edge: rgba(188, 192, 198, 0.26);
    --blob-stroke: rgba(210, 214, 218, 0.22);
    --blob-spec: rgba(255, 255, 255, 0.08);
    --blob-grain: rgba(230, 230, 232, 0.18);
    --blob-blend: normal;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
  background: var(--bg);
}

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

.ambient-blob {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  mix-blend-mode: var(--blob-blend);
}

.page {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--measure);
  margin: 0 auto;
  padding: var(--page-pad-top) var(--page-pad) 4.5rem;
  view-transition-name: page-sheet;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 17px;
  font-weight: 400;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection {
  background: var(--selection);
  color: var(--fg);
}

a {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  text-decoration-color: color-mix(in srgb, var(--fg) 40%, transparent);
}

a:hover {
  text-decoration-color: var(--fg);
}

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

/* —— Page —— */
.page h1 {
  margin: 0 0 1.15rem;
  font-size: 26px;
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.page h2 {
  margin: 1.85rem 0 0.65rem;
  font-size: 1.22rem;
  font-weight: 500;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

.page h3 {
  margin: 1.35rem 0 0.35rem;
  font-size: 1.08rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  scroll-margin-top: 1.25rem;
}

.meta {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
}

.byline {
  margin: -0.55rem 0 1.25rem;
}

.byline a {
  color: var(--muted);
  text-decoration-color: color-mix(in srgb, var(--muted) 55%, transparent);
}

.byline a:hover {
  color: var(--fg);
  text-decoration-color: var(--fg);
}

.page p {
  margin: 0 0 1.1rem;
}

.page p:last-child {
  margin-bottom: 0;
}

.page ul,
.page ol {
  margin: 0 0 1.1rem;
  padding-left: 1.15rem;
}

.page li {
  margin-bottom: 0.4rem;
  padding-left: 0.15rem;
}

.page li::marker {
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

.footnote {
  margin-top: 2.25rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.5;
}

.section-list {
  list-style: disc;
  padding-left: 1.15rem;
  margin: 0 0 1.25rem;
}

.section-list li {
  margin: 0 0 0.5rem;
}

/* —— Experience / roles —— */
.role {
  margin-bottom: 1.85rem;
}

.role-head {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.15rem 1rem;
  margin-bottom: 0.35rem;
}

.page h2.role-title,
.role-title {
  font-weight: 500;
  margin: 0;
  flex: 1 1 12rem;
  min-width: 0;
  line-height: 1.3;
}

.role-dates {
  color: var(--muted);
  font-size: 0.95rem;
  flex: 0 1 auto;
  line-height: 1.3;
}

.role-note {
  margin-bottom: 0.35rem;
  margin-top: 0;
}

.role ul {
  margin-top: 0.25rem;
}

/* —— Sidenotes (margin notes; stack under the line on mobile) —— */
.li-sidenote,
.text-sidenote {
    display: flex;
  flex-direction: column;
}

.text-sidenote {
  margin: 0 0 1.1rem;
}

.text-sidenote .text-main {
  margin: 0;
}

.li-sidenote .li-main,
.text-sidenote .text-main {
  order: 1;
}

.li-sidenote .sidenote,
.text-sidenote .sidenote {
  order: 2;
}

.sidenote-mark {
  font-size: 0.68em;
  font-weight: 500;
  vertical-align: super;
  line-height: 0;
  color: var(--muted);
  margin-left: 0.1em;
}

.sidenote {
  display: block;
  box-sizing: border-box;
  margin: 0.55rem 0 0.15rem;
  padding: 0.35rem 0 0.35rem 0.75rem;
  border-left: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
  list-style: none;
}

.sidenote-num {
  font-weight: 500;
  margin-right: 0.3em;
  color: var(--muted);
}

.sidenote-num::after {
  content: ":";
}

/* Desktop: float into the margin; clear so notes never overlap */
@media (min-width: 1100px) {
  .page {
    overflow: visible;
  }

  .notes-flow {
    padding-left: 0;
  }

  .notes-flow > li:not(.li-sidenote) {
    margin-left: 1.15rem;
  }

  .notes-flow > .li-sidenote {
    display: contents;
  }

  .notes-flow > .li-sidenote .li-main {
    display: list-item;
    list-style: disc;
    margin-left: 1.15rem;
    order: unset;
  }

  .notes-flow > .li-sidenote .sidenote,
  .text-sidenote .sidenote {
    float: right;
    clear: right;
    width: 12.75rem;
    margin: 0.1rem -14.5rem 0.85rem 1.25rem;
    padding: 0;
    border-left: 0;
    order: unset;
  }

  .text-sidenote {
    display: block;
    overflow: visible;
  }

  .text-sidenote .text-main {
    order: unset;
  }
}

.arch-list {
  margin: 0 0 1.15rem;
  padding-left: 1.15rem;
}

.arch-list li {
  margin-bottom: 0.75rem;
}

.arch-list strong {
  font-weight: 500;
}

/* —— Skills table —— */
.skills-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 1rem;
}

.skills-table th,
.skills-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.5rem 0.75rem 0.5rem 0;
  border-bottom: 1px solid var(--border);
}

.skills-table th {
  font-weight: 500;
  width: 9.5rem;
}

.skills-table td {
  word-break: break-word;
}

/* —— Diagram —— */
.diagram,
.arch-diagram {
  margin: 1.25rem 0 1.4rem;
  padding: 0.95rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.diagram-label {
  font-family: var(--mono);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.25rem;
}

.diagram-sublabel {
  margin: 0 0 0.85rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.arch-business {
  padding: 1.25rem 1.15rem 1.15rem;
  border: 1px dashed var(--border);
  border-radius: 8px;
}

.arch-agentic {
  width: 100%;
  text-align: center;
  border-style: dashed;
}

/* Must beat .diagram-node { margin: 0 } — same specificity otherwise kills the gap */
.diagram-node.arch-agentic {
  margin: 0 0 1.5rem;
}

.arch-agentic .diagram-node-desc {
  text-align: center;
}

.arch-rail {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: 0.4rem;
  margin-top: 0.25rem;
}

.arch-diagram .arch-rail .diagram-node {
  flex: 1 1 5.75rem;
  min-width: 0;
}

.diagram-node {
  display: block;
  width: 100%;
  margin: 0;
  padding: 0.7rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: default;
  text-align: left;
  font: inherit;
  color: inherit;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.15s ease;
}

.diagram-node:hover,
.diagram-node.is-active {
  border-color: var(--fg);
}

.diagram-node:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.diagram-node-title {
  display: block;
  font-weight: 500;
  font-size: 0.9rem;
  letter-spacing: -0.01em;
  margin-bottom: 0.15rem;
}

.diagram-node-desc {
  display: block;
  font-size: 0.82rem;
  line-height: 1.4;
  color: var(--muted);
}

.diagram-arrow {
    display: flex;
    align-items: center;
  color: var(--muted);
  font-size: 0.9rem;
  padding: 0 0.05rem;
  user-select: none;
}

.diagram-caption {
  margin: 0.8rem 0 0;
  font-size: 0.88rem;
  color: var(--muted);
  min-height: 2.6em;
  line-height: 1.45;
}

/* —— Code —— */
.code-block {
  margin: 1.25rem 0;
  padding: 1rem 1.05rem;
  background: var(--code-bg);
  color: var(--code-fg);
  border: 1px solid var(--code-border);
    border-radius: 8px;
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.55;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.code-block .kw { color: var(--code-kw); }
.code-block .str { color: var(--code-str); }
.code-block .cm { color: var(--code-cm); }

/* —— Home desktop: leerob air —— */
.page-home {
  padding-top: clamp(3.5rem, 12vh, 7rem);
  padding-right: var(--page-pad);
  padding-bottom: 3rem;
  padding-left: var(--page-pad);
}

.page article > h1 {
  animation: home-name 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.page article > h1::after {
  content: "";
  display: block;
  width: 2.75rem;
  height: 1px;
  margin-top: 0.55rem;
  background: var(--fg);
  opacity: 0.28;
  transform: scaleX(0);
  transform-origin: left center;
  animation: home-rule 0.55s 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.page article > p,
.page article > section,
.page article > table,
.page article > ul > li {
  animation: home-rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.page article > p:nth-of-type(1) { animation-delay: 0.18s; }
.page article > p:nth-of-type(2) { animation-delay: 0.28s; }
.page article > p:nth-of-type(3) { animation-delay: 0.36s; }
.page article > p:nth-of-type(n+4) { animation-delay: 0.42s; }

.page article > section:nth-of-type(1) { animation-delay: 0.32s; }
.page article > section:nth-of-type(2) { animation-delay: 0.4s; }
.page article > section:nth-of-type(3) { animation-delay: 0.48s; }
.page article > section:nth-of-type(n+4) { animation-delay: 0.54s; }

.page article > table { animation-delay: 0.34s; }

.page-home .section-list li:nth-child(1) { animation-delay: 0.46s; }
.page-home .section-list li:nth-child(2) { animation-delay: 0.52s; }
.page-home .section-list li:nth-child(3) { animation-delay: 0.58s; }
.page-home .section-list li:nth-child(4) { animation-delay: 0.64s; }
.page-home .section-list li:nth-child(5) { animation-delay: 0.7s; }
.page-home .section-list li:nth-child(6) { animation-delay: 0.76s; }
.page-home .section-list li:nth-child(7) { animation-delay: 0.82s; }
.page-home article > p:nth-of-type(4) { animation-delay: 0.9s; }

@keyframes home-name {
  from {
    opacity: 0;
    transform: translateY(0.7rem);
    letter-spacing: 0.045em;
  }
  to {
    opacity: 1;
    transform: none;
    letter-spacing: -0.02em;
  }
}

@keyframes home-rise {
  from {
    opacity: 0;
    transform: translateY(0.55rem);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes home-rule {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

/* —— Mobile —— */
@media (max-width: 720px) {
  :root {
    --page-pad: 1.25rem;
    --page-pad-top: 2rem;
    --measure: 100%;
  }

  body {
    font-size: 17px;
    line-height: 1.5;
    padding-left: env(safe-area-inset-left, 0px);
    padding-right: env(safe-area-inset-right, 0px);
  }

  .page {
    max-width: none;
    width: 100%;
    box-sizing: border-box;
    /* Clear browser chrome + notch — safe-area alone is not enough for the URL bar */
    padding-top: max(3.25rem, env(safe-area-inset-top, 0px) + 2.75rem);
    padding-right: 1.25rem;
    padding-bottom: calc(2.5rem + env(safe-area-inset-bottom, 0px));
    padding-left: 1.25rem;
  }

  /* Inner pages: normal scroll and type — never lock to the viewport */
  .page:not(.page-home) {
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .page:not(.page-home) h1 {
    font-size: 25px;
    line-height: 1.15;
    margin-bottom: 1rem;
  }

  /* Home ONLY: one screen, no scroll — type/spacing scale with viewport; margins on all sides */
  body:has(.page-home) {
    height: 100svh;
    max-height: 100svh;
    overflow: hidden;
    padding-left: 0;
    padding-right: 0;
  }

  .page-home {
    height: 100svh;
    max-height: 100svh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    box-sizing: border-box;
    padding-top: max(1.75rem, env(safe-area-inset-top, 0px) + 1.35rem);
    padding-right: max(1.85rem, env(safe-area-inset-right, 0px) + 1.5rem);
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom, 0px) + 1.15rem);
    padding-left: max(1.85rem, env(safe-area-inset-left, 0px) + 1.5rem);
    font-size: clamp(11.5px, 1.35vh + 0.35rem, 15.5px);
    line-height: 1.35;
  }

  .page-home article {
    flex: 0 1 auto;
    min-height: 0;
    max-height: 100%;
    margin-block: auto;
  }

  .page-home h1 {
    font-size: clamp(18px, 2.35vh + 0.4rem, 24px);
    line-height: 1.12;
    letter-spacing: -0.02em;
    margin: 0 0 clamp(0.3rem, 1.1vh, 0.65rem);
  }

  .page-home p {
    margin: 0 0 clamp(0.28rem, 0.95vh, 0.55rem);
  }

  .page-home .section-list {
    margin: 0 0 clamp(0.28rem, 0.95vh, 0.55rem);
  }

  .page-home .section-list li {
    margin-bottom: clamp(0.04rem, 0.35vh, 0.14rem);
  }

  .page h2,
  .role-title {
    font-size: 1.15rem;
  }

  .page h3 {
    font-size: 1.05rem;
  }

  .page h2.role-title,
  .role-title {
    margin: 0;
    /* flex-grow: 1 stretches the title vertically in a column and leaves a huge gap */
    flex: 0 1 auto;
    width: 100%;
  }

  .role-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.05rem;
    margin-bottom: 0.35rem;
  }

  .role-dates {
    white-space: normal;
    margin: 0;
  }

  .role > p:first-of-type,
  .role > ul:first-of-type {
    margin-top: 0;
  }

  .role ul {
    margin-top: 0.15rem;
  }

  .role {
    margin-bottom: 1.5rem;
  }

  .skills-table,
  .skills-table tbody,
  .skills-table tr,
  .skills-table th,
  .skills-table td {
    display: block;
    width: 100%;
  }

  .skills-table tr {
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
  }

  .skills-table th,
  .skills-table td {
    border-bottom: none;
    padding: 0;
  }

  .skills-table th {
    width: auto;
    margin-bottom: 0.2rem;
    font-size: 0.92rem;
  }

  .skills-table td {
    font-size: 0.98rem;
    color: var(--muted);
  }

  .arch-rail {
    flex-direction: column;
  }

  .arch-rail .diagram-arrow {
    display: none;
  }

  .arch-diagram .arch-rail .diagram-node {
    width: 100%;
  }

  .diagram,
  .arch-diagram {
    padding: 0.8rem 0.7rem;
    border-radius: 6px;
  }

  .arch-business {
    padding: 1.1rem 1rem 1rem;
  }

  .diagram-caption {
    min-height: 0;
  }

  .code-block {
    font-size: 0.78rem;
    border-width: 1.5px;
    border-radius: 6px;
  }
}

@media (max-width: 380px) {
  .page {
    padding-top: max(3rem, env(safe-area-inset-top, 0px) + 2.5rem);
    padding-right: 1.15rem;
    padding-bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
    padding-left: 1.15rem;
  }

  .page-home {
    padding-right: max(1.75rem, env(safe-area-inset-right, 0px) + 1.4rem);
    padding-left: max(1.75rem, env(safe-area-inset-left, 0px) + 1.4rem);
  }
}

/* Short phones: scale type harder; keep tighter vertical + wider sides */
@media (max-width: 720px) and (max-height: 720px) {
  .page-home {
    font-size: clamp(11.5px, 1.4vh + 0.3rem, 15px);
    line-height: 1.35;
    padding-top: max(1.5rem, env(safe-area-inset-top, 0px) + 1.2rem);
    padding-bottom: max(1.35rem, env(safe-area-inset-bottom, 0px) + 1rem);
    padding-right: max(1.85rem, env(safe-area-inset-right, 0px) + 1.5rem);
    padding-left: max(1.85rem, env(safe-area-inset-left, 0px) + 1.5rem);
  }

  .page-home h1 {
    font-size: clamp(17px, 2.1vh + 0.35rem, 22px);
  }
}

@view-transition {
  navigation: none;
}

::view-transition {
  background: var(--bg);
}

::view-transition-group(page-sheet) {
  animation: none;
}

::view-transition-image-pair(page-sheet) {
  isolation: isolate;
}

::view-transition-old(page-sheet),
::view-transition-new(page-sheet) {
  mix-blend-mode: normal;
  animation-duration: 0.48s;
  animation-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  animation-fill-mode: both;
}

::view-transition-old(page-sheet) {
  z-index: 2;
  transform-origin: 0 100%;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
  animation-name: sheet-out;
}

::view-transition-new(page-sheet) {
  z-index: 1;
  animation: none;
}

html.book-back ::view-transition-old(page-sheet),
html:active-view-transition-type(book-back) ::view-transition-old(page-sheet) {
  transform-origin: 100% 100%;
  animation-name: sheet-out-back;
}

@keyframes sheet-out {
  to {
    transform: translateX(-110%) rotate(-5deg);
  }
}

@keyframes sheet-out-back {
  to {
    transform: translateX(110%) rotate(5deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .page {
    view-transition-name: none;
  }
}

.page-stats {
  max-width: min(1320px, 100%);
}

.stats-kpis {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
  margin: 0 0 1.4rem;
}

.stats-kpi {
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.stats-kpi-value {
  display: block;
  font-size: 1.45rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.stats-kpi-label {
  display: block;
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.stats-map {
  width: 100%;
  height: min(72vh, 640px);
  margin: 0 0 0.4rem;
  border: 0;
  border-radius: 0;
  overflow: hidden;
  background: transparent;
}

.stats-map,
.stats-map .maplibregl-map,
.stats-map .maplibregl-canvas,
.stats-map .maplibregl-canvas-container {
  background: transparent !important;
}

.stats-map canvas {
  display: block;
  cursor: grab;
  filter: drop-shadow(0 22px 48px rgba(20, 24, 28, 0.18));
}

.stats-globe-hint {
  margin: 0 0 1.5rem;
  font-size: 0.85rem;
}

.stats-map .maplibregl-ctrl-attrib {
  background: transparent;
  color: var(--muted);
  font-size: 0.68rem;
  opacity: 0.7;
}

.stats-map .maplibregl-ctrl-group {
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  border: 1px solid var(--border);
  box-shadow: none;
}

.stats-map .maplibregl-ctrl button {
  background-color: transparent;
}

.stats-map-popup .maplibregl-popup-content {
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--fg);
  box-shadow: none;
  font-family: var(--font);
}

.stats-map-popup .maplibregl-popup-tip {
  border-top-color: var(--border);
}

.stats-map-tip {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  font-size: 0.9rem;
  line-height: 1.35;
}

.stats-map-tip span {
  color: var(--muted);
  font-size: 0.82rem;
}

.stats-cols {
  display: grid;
  grid-template-columns: 1.3fr 0.7fr;
  gap: 1.5rem;
  margin-bottom: 1.75rem;
}

.stats-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  table-layout: auto;
}

.stats-table th,
.stats-table td {
  text-align: left;
  padding: 0.5rem 1.1rem 0.5rem 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  white-space: nowrap;
}

.stats-table th:last-child,
.stats-table td:last-child {
  padding-right: 0;
}

.stats-table th {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.82rem;
}

.stats-mono {
  font-family: var(--mono);
  font-size: 0.82rem;
}

.stats-clip {
  max-width: 14rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stats-table-wide {
  width: max-content;
  min-width: 100%;
}

.stats-gate {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.45rem;
  max-width: 22rem;
}

.stats-gate input {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--fg);
  font: inherit;
}

.stats-gate button {
  margin-top: 0.35rem;
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--fg);
  border-radius: 8px;
  background: var(--fg);
  color: var(--bg);
  font: inherit;
  cursor: pointer;
}

@media (max-width: 900px) {
  .stats-kpis {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 720px) {
  .stats-kpis,
  .stats-cols {
    grid-template-columns: 1fr;
  }

  .stats-kpis {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-map {
    height: 360px;
  }
}
