/* mymalta.fyi component styles. Every colour is a token; nothing here is hard-coded. */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: var(--font-sans); font-size: 16px; line-height: 24px; background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: var(--radius-sm); }
.mm-num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

/* Preview scaffolding: two panels, light and dark */
.mm-pair { display: grid; grid-template-columns: 1fr 1fr; }
.mm-pair.is-stack { grid-template-columns: 1fr; }
.mm-panel { background: var(--bg); color: var(--ink); padding: var(--space-5); min-height: 100%; }
.mm-panel-label { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 var(--space-3); }
.mm-stack > * + * { margin-top: var(--space-3); }

/* Header */
.mm-header { background: var(--surface); border-bottom: 1px solid var(--rule); }
.mm-header-in { display: flex; align-items: center; gap: var(--space-6); padding: 0 var(--space-4); height: 56px; max-width: 1120px; margin: 0 auto; }
.mm-logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 20px; letter-spacing: -.01em; }
.mm-logo .mm-mark { width: 28px; height: 28px; flex: none; }
.mm-logo .fyi { color: var(--muted); font-weight: 400; }
.mm-nav { display: flex; gap: var(--space-1); margin-left: auto; }
.mm-nav a { white-space: nowrap; font-size: 15px; line-height: 20px; font-weight: 600; color: var(--ink-2); text-decoration: none; padding: 6px 10px; border-radius: var(--radius-sm); }
.mm-nav a:hover { color: var(--ink); background: var(--surface-2); }
.mm-nav a[aria-current="page"] { color: var(--brand); background: var(--brand-soft); }
.mm-iconbtn { width: 36px; height: 36px; border: 1px solid var(--rule-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.mm-header.is-phone .mm-header-in { height: 52px; gap: var(--space-3); }
.mm-header.is-phone .mm-nav { display: none; }
.mm-header .mm-iconbtn { margin-left: auto; display: none; }
.mm-header.is-phone .mm-iconbtn { display: inline-flex; }

/* Segmented toggle */
.mm-seg { display: inline-flex; padding: 3px; background: var(--surface-2); border-radius: var(--radius-md); gap: 2px; }
.mm-seg button { font: inherit; font-size: 15px; line-height: 20px; font-weight: 600; color: var(--ink-2); background: transparent; border: 0; padding: 6px 14px; border-radius: var(--radius-sm); cursor: pointer; }
.mm-seg button:hover { color: var(--ink); }
.mm-seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: inset 0 0 0 1px var(--rule-strong); }
.mm-seg.is-block { display: flex; } .mm-seg.is-block button { flex: 1; text-align: center; }

/* Filter chips */
.mm-chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.mm-chip { font: inherit; font-size: 14px; line-height: 20px; font-weight: 600; color: var(--ink-2); background: var(--surface); border: 1px solid var(--rule-strong); border-radius: var(--radius-full); padding: 5px 12px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.mm-chip:hover { color: var(--ink); background: var(--surface-2); }
.mm-chip[aria-pressed="true"] { color: var(--brand); background: var(--brand-soft); border-color: var(--brand); }
.mm-chip .x { font-weight: 400; opacity: .8; }
.mm-chip .count { font-family: var(--font-mono); font-size: 12px; color: var(--muted); }
.mm-chip[aria-pressed="true"] .count { color: var(--brand); }

/* Search */
.mm-search { position: relative; display: flex; align-items: center; }
.mm-search svg { position: absolute; left: 12px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.mm-search input { font: inherit; width: 100%; height: 44px; padding: 0 44px 0 40px; background: var(--surface); color: var(--ink); border: 1px solid var(--rule-strong); border-radius: var(--radius-md); }
.mm-search input::placeholder { color: var(--muted); }
.mm-search input:focus { outline: none; border-color: var(--sea); box-shadow: var(--focus-ring); }
.mm-search kbd { position: absolute; right: 10px; font-family: var(--font-mono); font-size: 12px; line-height: 16px; color: var(--muted); border: 1px solid var(--rule); border-radius: var(--radius-sm); padding: 1px 6px; background: var(--surface-2); }
.mm-search.is-hero input { height: 52px; border-radius: var(--radius-lg); font-size: 17px; }
.mm-search-results { margin-top: var(--space-2); background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-md); box-shadow: var(--shadow-pop); overflow: hidden; }
.mm-search-results a { display: flex; justify-content: space-between; gap: var(--space-3); padding: 10px 14px; text-decoration: none; color: var(--ink); border-top: 1px solid var(--rule); }
.mm-search-results a:first-child { border-top: 0; }
.mm-search-results a:hover, .mm-search-results a[aria-selected="true"] { background: var(--surface-2); }
.mm-search-results .kind { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); align-self: center; }
.mm-search-results mark { background: var(--brand-soft); color: var(--brand); border-radius: 2px; }

/* Stat tile */
.mm-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--space-3); }
.mm-tile { background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-md); padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.mm-tile .n { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 36px; line-height: 40px; font-weight: 600; letter-spacing: -.03em; color: var(--ink); }
.mm-tile.is-hero .n { font-size: 48px; line-height: 52px; }
.mm-tile.is-sm .n { font-size: 28px; line-height: 32px; }
.mm-tile .l { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.mm-tile .s { font-size: 13px; line-height: 18px; color: var(--muted); margin-top: auto; }
.mm-tile .s a { color: var(--sea); }
.mm-srcline { display: inline-flex; align-items: center; gap: 5px; }
.mm-cross { color: var(--sea); flex: none; }
.mm-tip .src { display: flex; align-items: center; gap: 5px; }
.mm-tile.is-link { text-decoration: none; color: inherit; }
.mm-tile.is-link:hover { border-color: var(--rule-strong); }

/* Section card */
.mm-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: var(--space-4); }
.mm-card { display: block; background: var(--surface); border: 1px solid var(--rule); border-radius: var(--radius-md); padding: var(--space-5); text-decoration: none; color: var(--ink); min-height: 168px; position: relative; }
.mm-card:hover { border-color: var(--rule-strong); }
.mm-card:hover h3 { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.mm-card .ic { width: 24px; height: 24px; color: var(--ink-2); margin-bottom: var(--space-3); display: block; }
.mm-card h3 { font-size: 19px; line-height: 26px; font-weight: 600; margin: 0 0 var(--space-1); }
.mm-card p { font-size: 14px; line-height: 20px; color: var(--ink-2); margin: 0; }

/* Tooltip */
.mm-tip { background: var(--surface); color: var(--ink); border: 1px solid var(--rule); border-radius: var(--radius-md); box-shadow: var(--shadow-pop); padding: 10px 12px; width: 260px; font-size: 14px; line-height: 20px; }
.mm-tip h4 { margin: 0 0 6px; font-size: 15px; line-height: 20px; font-weight: 600; }
.mm-tip .row { display: flex; justify-content: space-between; gap: var(--space-3); padding: 2px 0; }
.mm-tip .row .k { color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.mm-tip .row .v { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.mm-tip .dot { width: 10px; height: 10px; border-radius: var(--radius-full); display: inline-block; }
.mm-tip .src { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--rule); font-size: 12px; line-height: 16px; color: var(--muted); }
.mm-tip .src a { color: var(--sea); }
.mm-bar { display: flex; height: 8px; border-radius: 2px; overflow: hidden; margin: 6px 0 4px; background: var(--surface-2); }

/* Downloads */
.mm-dl { border: 1px solid var(--rule); border-radius: var(--radius-md); background: var(--surface); overflow: hidden; }
.mm-dl-row { display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: var(--space-3); padding: 12px var(--space-4); border-top: 1px solid var(--rule); text-decoration: none; color: var(--ink); }
.mm-dl-row:first-child { border-top: 0; }
.mm-dl-row:hover { background: var(--surface-2); }
.mm-dl-row .ft { font-family: var(--font-mono); font-size: 11px; line-height: 14px; font-weight: 600; letter-spacing: .04em; width: 40px; height: 32px; border-radius: var(--radius-sm); display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--rule-strong); color: var(--ink-2); }
.mm-dl-row .ft.csv { color: var(--sea); border-color: var(--sea); }
.mm-dl-row .t { font-weight: 600; font-size: 15px; line-height: 20px; }
.mm-dl-row .d { font-size: 13px; line-height: 18px; color: var(--muted); }
.mm-dl-row .m { font-family: var(--font-mono); font-size: 13px; line-height: 18px; color: var(--muted); white-space: nowrap; }
.mm-dl-row .m svg { vertical-align: -3px; margin-left: 6px; color: var(--ink-2); }

/* Footer */
.mm-footer { border-top: 1px solid var(--rule); padding: var(--space-8) var(--space-4) var(--space-6); font-size: 14px; line-height: 20px; color: var(--ink-2); }
.mm-footer-in { max-width: 1120px; margin: 0 auto; display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: var(--space-6); }
.mm-footer h5 { font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 0 0 var(--space-2); }
.mm-footer ul { list-style: none; margin: 0; padding: 0; } .mm-footer li + li { margin-top: 4px; }
.mm-footer a { color: var(--ink-2); text-decoration: none; } .mm-footer a:hover { color: var(--brand); text-decoration: underline; }
.mm-footer .about { max-width: 360px; }
.mm-footer .corr { margin-top: var(--space-6); padding-top: var(--space-4); border-top: 1px solid var(--rule); font-size: 13px; line-height: 18px; color: var(--muted); display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); max-width: 1120px; margin-left: auto; margin-right: auto; }
.mm-footer .corr a { color: var(--sea); text-decoration: underline; }
.mm-footer.is-phone .mm-footer-in { grid-template-columns: 1fr; }

/* Buttons */
.mm-btn { font: inherit; font-size: 15px; line-height: 20px; font-weight: 600; padding: 9px 16px; border-radius: var(--radius-md); border: 1px solid var(--rule-strong); background: var(--surface); color: var(--ink); cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 8px; }
.mm-btn:hover { background: var(--surface-2); }
.mm-btn.is-primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }
.mm-btn.is-primary:hover { filter: brightness(1.08); }

/* Source badge */
.mm-src { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; line-height: 18px; color: var(--sea); background: var(--sea-soft); border-radius: var(--radius-sm); padding: 2px 8px; text-decoration: none; }
