/* Masters of Info Support — component stylesheet (MOIS)
   Plain CSS for ASP.NET Razor Pages. Needs the token variables (tokens.css) loaded first.
   Theme: set data-theme="dark" | "light" on <html>. Prefix: m-  */
/* The source stylesheet's Google Fonts @import is dropped on purpose: Space Grotesk and
   JetBrains Mono are self-hosted via @font-face in tokens.css (fonts.googleapis.com is
   unreachable from this environment, and the import would block rendering). */

.m-root, body { background: var(--bg); color: var(--text); font-family: var(--font-sans); font-size: 15px; line-height: 1.5; }
.m-mono { font-family: var(--font-mono); }
.m-container { max-width: 1280px; margin: 0 auto; padding-inline: var(--space-8); }
:where(a, button, input, select, textarea, label):focus-visible { outline: none; box-shadow: var(--focus-ring); }
.m-eyebrow { font-family: var(--font-mono); font-size: 14px; color: var(--accent-text); }
.m-label-mono { font-family: var(--font-mono); font-size: 12px; font-weight: 500; letter-spacing: .06em; text-transform: uppercase; color: var(--subtle); }
.m-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Button ---------- */
.m-btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: 44px; padding: 0 18px; border-radius: var(--radius-pill); border: 1px solid transparent; font: 600 15px/1 var(--font-sans); text-decoration: none; cursor: pointer; white-space: nowrap; transition: filter .15s, background-color .15s; }
.m-btn svg { width: 16px; height: 16px; flex: none; }
.m-btn--primary { background: var(--accent); color: var(--on-accent); }
.m-btn--primary:hover { filter: brightness(1.08); }
.m-btn--contrast { background: var(--text); color: var(--bg); }
.m-btn--contrast:hover { filter: brightness(.92); }
.m-btn--ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.m-btn--ghost:hover { background: var(--raised); }
.m-btn--danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.m-btn--lg { min-height: 48px; padding: 0 24px; }
.m-btn--sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.m-btn--icon { width: 44px; padding: 0; }
.m-btn[disabled], .m-btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; filter: none; }

/* ---------- Pill / Tag ---------- */
.m-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: var(--radius-pill); font: 500 12px/1.3 var(--font-mono); background: var(--raised); color: var(--muted); white-space: nowrap; }
.m-pill--info { background: var(--info-soft); color: var(--info); }
.m-pill--success { background: var(--success-soft); color: var(--success); }
.m-pill--warning { background: var(--warning-soft); color: var(--warning); }
.m-pill--danger { background: var(--danger-soft); color: var(--danger); }
.m-pill--you { background: var(--magenta-soft); color: var(--magenta-text); }
.m-pill__dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.m-tag { display: inline-block; padding: 2px 7px; border-radius: var(--radius-sm); font: 700 11px/1.4 var(--font-mono); background: var(--magenta); color: var(--on-magenta); letter-spacing: .04em; }
.m-live { font: 500 12px/1 var(--font-mono); color: var(--success); display: inline-flex; align-items: center; gap: 6px; }
.m-live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* ---------- Navbar ---------- */
.m-nav { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) 40px; padding-block: 20px; }
.m-brand { display: flex; align-items: center; gap: var(--space-3); color: var(--text); text-decoration: none; }
.m-brand__mark { width: 40px; height: 40px; border-radius: var(--radius-md); background: var(--accent); color: var(--on-accent); display: grid; place-items: center; }
.m-brand__mark svg { width: 22px; height: 22px; }
.m-brand__word { font: 700 17px/1 var(--font-mono); }
.m-brand__word b { color: var(--magenta); font-weight: 700; }
.m-nav__links { display: flex; flex-wrap: wrap; gap: var(--space-1); flex: 1 1 auto; margin: 0; padding: 0; list-style: none; }
.m-nav__link { display: inline-flex; align-items: center; min-height: 40px; padding: 0 16px; border-radius: var(--radius-pill); color: var(--muted); text-decoration: none; }
.m-nav__link:hover { color: var(--text); }
.m-nav__link[aria-current="page"] { background: var(--raised); color: var(--text); font-weight: 600; }
/* margin-left:auto below works around the source stylesheet putting flex:1 1 auto on
   .m-nav__links, which never actually grows: that <ul> sits inside a plain <nav> wrapper (see
   Navbar's own markup), not as a direct flex child of .m-nav. Without it, brand + links +
   end-controls all pack to the left of .m-nav instead of the controls sitting at the far right. */
.m-nav__end { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.m-team-chip { display: inline-flex; align-items: center; gap: var(--space-2); padding: 6px 14px 6px 6px; border-radius: var(--radius-pill); background: var(--raised); font-size: 14px; color: var(--text); text-decoration: none; }

/* ---------- Avatar ---------- */
.m-avatar { width: 44px; height: 44px; border-radius: var(--radius-pill); display: inline-grid; place-items: center; font: 700 15px/1 var(--font-mono); background: var(--accent); color: var(--on-accent); flex: none; }
.m-avatar--sm { width: 28px; height: 28px; font-size: 12px; }
.m-avatar--you { background: var(--magenta); color: var(--on-magenta); }
.m-avatar--empty { background: transparent; border: 1px dashed var(--line-strong); }

/* ---------- Theme toggle ---------- */
.m-theme-toggle .m-icon-sun { display: none; }
[data-theme="dark"] .m-theme-toggle .m-icon-sun { display: block; }
[data-theme="dark"] .m-theme-toggle .m-icon-moon { display: none; }

/* ---------- Panel ---------- */
.m-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-xl); padding: var(--space-6); display: flex; flex-direction: column; gap: var(--space-4); }
.m-panel--lg { padding: var(--space-7); gap: var(--space-5); }
.m-panel__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: var(--space-3); }
.m-panel__title { margin: 0; font-size: 20px; font-weight: 700; line-height: 1.25; }
.m-panel--lg .m-panel__title { font-size: 28px; letter-spacing: -.02em; }

/* ---------- Hero ---------- */
.m-hero { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-2xl); padding: var(--space-14); min-height: 340px; box-sizing: border-box; display: flex; align-items: center; }
.m-hero__art { position: absolute; right: 0; top: 0; width: 60%; height: 100%; pointer-events: none; }
.m-hero__art .trace { fill: none; stroke: var(--accent); stroke-width: 2; opacity: .5; }
.m-hero__art .trace--m { stroke: var(--magenta); }
.m-hero__art .via { fill: var(--accent); }
.m-hero__art .via--m { fill: var(--magenta); }
.m-hero__body { position: relative; display: flex; flex-direction: column; gap: 18px; max-width: 660px; }
.m-hero__title { margin: 0; font-size: 76px; line-height: .92; font-weight: 700; letter-spacing: -.04em; }
.m-hero__title .cut { background: var(--text); color: var(--bg); padding: 0 3px; }
.m-hero__title .glitch { box-shadow: inset 0 -10px 0 var(--magenta); }
.m-hero__title .year { color: var(--accent-text); }
.m-hero__lede { margin: 0; font-size: 18px; color: var(--muted); max-width: 520px; }
@media (max-width: 720px) { .m-hero { padding: var(--space-8); } .m-hero__title { font-size: 48px; } .m-hero__art { opacity: .35; width: 100%; } }

/* ---------- Steps ---------- */
.m-steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: var(--space-3); counter-reset: step; }
.m-step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-3); counter-increment: step; }
.m-step::before { content: counter(step, decimal-leading-zero); font: 400 13px/1 var(--font-mono); color: var(--accent-text); }
.m-step__title { font-size: 18px; font-weight: 600; }
.m-step__text { font-size: 14px; color: var(--muted); }
.m-step .m-btn { align-self: flex-start; }

/* ---------- Stat ---------- */
.m-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-3); }
.m-stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.m-stat__value { font: 700 30px/1.1 var(--font-mono); }
.m-stat__value small { font-size: 14px; color: var(--subtle); font-weight: 500; }
.m-stat--accent .m-stat__value { color: var(--accent-text); }

/* ---------- Set chip ---------- */
.m-set { width: 40px; height: 40px; border-radius: var(--radius-md); display: inline-grid; place-items: center; font: 700 17px/1 var(--font-mono); background: var(--raised); color: var(--text); flex: none; }
.m-set--running { background: var(--accent); color: var(--on-accent); }
.m-set--scored { background: var(--success-soft); color: var(--success); box-shadow: inset 0 0 0 1.5px var(--success); }
.m-set--rejected { background: var(--danger-soft); color: var(--danger); box-shadow: inset 0 0 0 1.5px var(--danger); }
.m-set--lg { width: 56px; height: 56px; font-size: 24px; border-radius: var(--radius-lg); }

/* ---------- Table ---------- */
.m-table-wrap { overflow-x: auto; }
.m-table { width: 100%; border-collapse: collapse; font-size: 15px; }
.m-table th { text-align: left; padding: 0 var(--space-3) var(--space-3) 0; font: 500 12px/1.3 var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--subtle); }
.m-table td { padding: var(--space-3) var(--space-3) var(--space-3) 0; border-top: 1px solid var(--line); vertical-align: middle; }
.m-table .num { font-family: var(--font-mono); font-weight: 500; }
.m-table .meta { font-size: 14px; color: var(--subtle); }
.m-table .end { text-align: right; padding-right: 0; }

/* ---------- File picker ---------- */
.m-file { position: relative; display: inline-flex; align-items: center; gap: var(--space-2); min-height: 40px; padding: 0 16px; border-radius: var(--radius-pill); border: 1px solid var(--line-strong); font-size: 14px; color: var(--text); cursor: pointer; max-width: 260px; }
.m-file:hover { background: var(--raised); }
.m-file input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.m-file:focus-within { box-shadow: var(--focus-ring); }
.m-file svg { width: 14px; height: 14px; flex: none; }
.m-file__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--font-mono); font-size: 13px; }
.m-file--chosen { border-style: solid; border-color: var(--accent); }
.m-drop { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: var(--space-8); border: 2px dashed var(--line-strong); border-radius: var(--radius-lg); text-align: center; cursor: pointer; }
.m-drop:hover, .m-drop:focus-within { border-color: var(--accent); }
.m-drop input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---------- Form field ---------- */
.m-field { display: flex; flex-direction: column; gap: 6px; }
.m-field__label { font-size: 14px; font-weight: 600; }
.m-input { min-height: 44px; padding: 0 14px; border-radius: var(--radius-md); border: 1px solid var(--line-strong); background: var(--bg); color: var(--text); font: 400 15px/1 var(--font-sans); }
.m-input::placeholder { color: var(--subtle); }
.m-field__help { font-size: 13px; color: var(--subtle); }
.m-field--error .m-input { border-color: var(--danger); }
.m-field--error .m-field__help { color: var(--danger); }
.m-check { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; min-height: 44px; cursor: pointer; }
.m-check input { width: 18px; height: 18px; accent-color: var(--accent); }

/* ---------- Notice ---------- */
.m-notice { display: flex; flex-direction: column; gap: 6px; padding: var(--space-4); border-radius: var(--radius-lg); background: var(--raised); }
.m-notice__meta { display: flex; align-items: center; gap: var(--space-2); font: 400 12px/1 var(--font-mono); color: var(--subtle); }
.m-notice__body { font-size: 15px; }
.m-notice--strip { flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); border-radius: 0; padding: 12px var(--space-8); background: var(--surface); border-bottom: 1px solid var(--line); }
.m-notice--strip .m-notice__body { flex: 1 1 360px; }

/* A status notice (its pill names what happened: Error, Done, Save these) reads as a card nested
   inside a card when it gets the same solid --raised panel as a plain informational .m-notice
   (Instructions, Submissions) — those have no pill and stay as-is. Flattened to an inline accent
   strip instead: no fill, a colored left border keyed to the pill's own variant, and the pill
   sitting beside the message instead of stacked above it. */
.m-notice:has(.m-pill) {
    flex-direction: row;
    align-items: flex-start;
    gap: var(--space-3);
    background: transparent;
    border-radius: var(--radius-sm);
    border-left: 3px solid var(--line);
    padding: 10px var(--space-4);
}

.m-notice:has(.m-pill) .m-pill { flex-shrink: 0; margin-top: 2px; }

.m-notice:has(.m-pill--danger) { border-left-color: var(--danger); }
.m-notice:has(.m-pill--success) { border-left-color: var(--success); }
.m-notice:has(.m-pill--warning) { border-left-color: var(--warning); }
.m-notice:has(.m-pill--info) { border-left-color: var(--info); }

/* ---------- Leaderboard ---------- */
.m-board { display: flex; flex-direction: column; gap: var(--space-3); margin: 0; padding: 0; list-style: none; }
.m-board__row { display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--radius-lg); background: var(--raised); }
.m-board__rank { font: 700 22px/1 var(--font-mono); width: 32px; }
.m-board__team { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-board__score { font: 700 18px/1 var(--font-mono); }
.m-board__row--you { background: var(--magenta-soft); outline: 2px solid var(--magenta); outline-offset: -2px; }
.m-board__row--you .m-board__you { font-size: 12px; font-weight: 500; color: var(--magenta-text); }
.m-board__row--top .m-board__rank { color: var(--warning); }
.m-board__row--open { background: transparent; border: 1px dashed var(--line-strong); color: var(--subtle); }
.m-board__row--open .m-board__team { font-weight: 400; }

/* ---------- Run log ---------- */
.m-log { margin: 0; padding: 0; list-style: none; font-family: var(--font-mono); font-size: 14px; }
.m-log li { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); padding: 10px 0; border-top: 1px solid var(--line); }
.m-log li:first-child { border-top: 0; }
.m-log__time { color: var(--subtle); min-width: 110px; }
.m-log__id { color: var(--muted); min-width: 32px; }
.m-log__sets { display: flex; gap: 4px; flex: 1; }

/* ---------- Roster ---------- */
.m-roster { display: flex; gap: var(--space-2); }
.m-member { display: flex; align-items: center; gap: var(--space-3); font-size: 14px; }
.m-member__email { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Auth card ---------- */
.m-auth { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-2xl); padding: 36px; display: flex; flex-direction: column; gap: var(--space-5); box-sizing: border-box; }
.m-auth__title { margin: 0; font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
.m-auth__alt { font-size: 14px; color: var(--muted); text-align: center; }
.m-auth .m-btn { width: 100%; }

/* Vertically (and horizontally) centers an auth page's card(s) in the viewport instead of
   leaving them pinned to the top, which previously meant a visitor coming from the hero's
   "Get started" button (vertically centered, full height) had to shift focus up the page to
   reach the form. ~90px accounts for the navbar; Login.razor has two cards side by side here,
   TeamLogin.razor just the one. */
.m-auth-page {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: var(--space-6);
    min-height: calc(100vh - 90px);
    box-sizing: border-box;
    padding-block: var(--space-8) var(--space-14);
}

/* ---------- Layout helpers ---------- */
.m-layout { display: flex; flex-wrap: wrap; gap: var(--space-8); align-items: flex-start; }
.m-layout__main { flex: 999 1 640px; min-width: 0; display: flex; flex-direction: column; gap: var(--space-6); }
.m-layout__side { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: var(--space-6); }
