/* The Team Manic design kit: yellow canvas, black ink, paper cards, thick
   square borders, Knewave for display type and Inter for everything else.
   Pages load the fonts themselves:
   https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Knewave&display=swap */

:root {
  --ink: #222;
  --canvas: #ffd701;
  --paper: #fff7da;
  --paper-bright: #fffdf5;
  --label: #7a4a00;
  --error: #b3261e;
  --ok: #1d6b2f;
  --border: 3px solid var(--ink);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Knewave", "Inter", system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.mm { margin: 0; background: var(--canvas); color: var(--ink); font-family: var(--font); font-size: 16px; line-height: 1.45; -webkit-font-smoothing: antialiased; min-height: 100vh; min-height: 100dvh; }
/* Resets sit inside :where() so they carry no specificity and never outrank
   a component class such as .mm-btn. */
:where(.mm) :where(h1, h2, h3, p, ul, ol, figure) { margin: 0; }
:where(.mm) :where(a) { color: inherit; }
:where(.mm) :where(button, input, select, textarea) { font: inherit; color: inherit; }
:where(.mm) :where(input[type="checkbox"], input[type="radio"]) { width: 20px; height: 20px; margin: 0; flex: none; accent-color: var(--ink); }
.mm [hidden] { display: none !important; }
:where(.mm) :focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.mm-display { font-family: var(--display); font-weight: 400; text-transform: uppercase; letter-spacing: -.025em; line-height: .95; }
.mm-label { font-size: 13px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--label); }
.mm-muted { opacity: .75; }
.mm-stack > * + * { margin-top: var(--gap, 16px); }
.mm-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.mm-spread { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px 14px; }

/* Layout */
.mm-main { width: 100%; max-width: 1100px; margin: 0 auto; padding: 22px 16px 60px; }
.mm-main-narrow { max-width: 560px; }
.mm-title { font-size: clamp(40px, 9vw, 72px); margin-bottom: 18px; }
/* The legal links under the account and member pages: a plain line of links,
   not the site footer (assets/js/site-footer.js), which belongs to the public
   pages. Not on the conversation page, whose composer sits at the bottom of
   the screen. */
.mm-foot { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 20px; padding: 0 16px 28px; }
.mm-foot a { padding: 8px 0; font-size: 13px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase; text-underline-offset: 4px; opacity: .7; }
.mm-foot a:hover, .mm-foot a:focus-visible { opacity: 1; }
.mm-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* Cards */
.mm-card { border: var(--border); background: var(--paper); padding: 18px; }
.mm-card-ink { background: var(--ink); color: var(--canvas); }
.mm-card > h2, .mm-card > h3 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }

/* Buttons */
.mm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: var(--border); background: var(--ink); color: var(--canvas); padding: 12px 18px; font-size: 14px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase; text-decoration: none; cursor: pointer; border-radius: 0; transition: background-color .15s, color .15s; }
.mm-btn:hover { background: #000; }
.mm-btn-light { background: var(--canvas); color: var(--ink); }
.mm-btn-light:hover { background: #ffe34d; }
.mm-btn-ghost { background: transparent; color: var(--ink); }
.mm-btn-ghost:hover { background: rgba(34, 34, 34, .08); }
.mm-btn-small { padding: 7px 11px; font-size: 12px; border-width: 2px; }
.mm-btn-block { display: flex; width: 100%; }
.mm-btn[disabled], .mm-btn[aria-busy="true"] { opacity: .6; cursor: default; }
.mm-btn-danger { background: var(--error); border-color: var(--error); color: #fff; }

/* Forms */
.mm-field { display: block; }
.mm-field > span, .mm-field > label { display: block; margin-bottom: 6px; font-size: 14px; font-weight: 600; }
.mm-input, .mm-select, .mm-textarea { display: block; width: 100%; border: var(--border); background: var(--paper-bright); color: var(--ink); padding: 12px; font-size: 16px; border-radius: 0; }
.mm-textarea { min-height: 120px; resize: vertical; }
.mm-input[aria-invalid="true"], .mm-textarea[aria-invalid="true"] { border-color: var(--error); }
.mm-msg { font-size: 14px; font-weight: 500; min-height: 1.2em; }
.mm-msg:empty { display: none; }
.mm-msg.is-error { color: var(--error); }
.mm-msg.is-ok { color: var(--ok); }
.mm-trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* The strength bar */
.mm-bar { height: 22px; border: var(--border); background: var(--canvas); padding: 2px; }
.mm-bar > i { display: block; height: 100%; background: var(--ink); }

/* Badges */
.mm-badge { display: inline-block; border: 2px solid var(--ink); padding: 2px 7px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; background: var(--paper-bright); white-space: nowrap; }
.mm-badge-ink { background: var(--ink); color: var(--canvas); }
.mm-badge-warn { background: var(--canvas); }
.mm-badge-error { border-color: var(--error); color: var(--error); }
.mm-badge-ok { border-color: var(--ok); color: var(--ok); }

/* Tables */
.mm-table-wrap { border: var(--border); background: var(--paper); overflow-x: auto; }
.mm-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.mm-table th { text-align: left; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--label); padding: 10px 12px; border-bottom: var(--border); white-space: nowrap; }
.mm-table td { padding: 10px 12px; border-bottom: 1px solid rgba(34, 34, 34, .25); vertical-align: top; }
.mm-table tr:last-child td { border-bottom: 0; }
.mm-table tr.is-clickable { cursor: pointer; }
.mm-table tr.is-clickable:hover td { background: var(--paper-bright); }
/* A table whose cells carry data-label="Column name" turns into a list of
   blocks on a phone, one per row, each value under its own label, instead
   of columns too narrow to read. The first cell is the row's title. */
@media (max-width: 719px) {
  .mm-table-stack, .mm-table-stack tbody, .mm-table-stack tr, .mm-table-stack td { display: block; }
  .mm-table-stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .mm-table-stack tr { padding: 12px 14px; border-bottom: 2px solid var(--ink); }
  .mm-table-stack tr:last-child { border-bottom: 0; }
  .mm-table-stack td { padding: 0; border: 0; overflow-wrap: anywhere; }
  .mm-table-stack td + td { margin-top: 6px; }
  .mm-table-stack td:first-child { font-size: 16px; font-weight: 700; }
  .mm-table-stack td[data-label]:not(:first-child) { display: grid; grid-template-columns: minmax(84px, 34%) 1fr; gap: 10px; align-items: baseline; }
  .mm-table-stack td[data-label]:not(:first-child)::before { content: attr(data-label); font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--label); }
  .mm-table-stack td[data-label] > * { justify-self: start; }
  .mm-table-stack td:empty { display: none; }
  .mm-table-stack tr.is-clickable:hover td { background: none; }
  .mm-table-stack tr.is-clickable:hover { background: var(--paper-bright); }
}

/* Empty and loading states */
.mm-empty { border: 3px dashed var(--ink); padding: 28px 18px; text-align: center; font-weight: 500; }
.mm-loading { padding: 28px 0; font-weight: 600; opacity: .7; }

/* Notices */
.mm-notice { border: var(--border); background: var(--ink); color: var(--canvas); padding: 14px 16px; font-weight: 500; }
.mm-notice a { color: var(--canvas); font-weight: 700; }
.mm-notice-light { background: var(--paper); color: var(--ink); }
.mm-notice-light a { color: var(--ink); }

/* Toasts */
.mm-toasts { position: fixed; z-index: 1000; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); }
.mm-toast { border: var(--border); background: var(--ink); color: var(--canvas); padding: 12px 14px; font-size: 14px; font-weight: 600; }
.mm-toast-error { background: var(--error); border-color: var(--error); color: #fff; }

/* App shell */
.mm-shell { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 8px 18px; flex-wrap: wrap; background: var(--ink); color: var(--canvas); padding: 10px 16px; }
.mm-shell-home { display: flex; align-items: center; padding: 2px 12px 2px 0; border-right: 2px solid rgba(255, 215, 1, .35); }
.mm-shell-home img { display: block; height: 30px; width: auto; }
.mm-shell-brand { font-family: var(--display); font-size: 24px; text-transform: uppercase; letter-spacing: -.02em; text-decoration: none; color: var(--canvas) !important; white-space: nowrap; }
.mm-shell-nav { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; --fade-left: 0px; --fade-right: 0px; -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--fade-left), #000 calc(100% - var(--fade-right)), transparent); mask-image: linear-gradient(to right, transparent, #000 var(--fade-left), #000 calc(100% - var(--fade-right)), transparent); }
.mm-shell-nav::-webkit-scrollbar { display: none; }
/* Set by mountShell() while there are links off either edge: the row fades
   out on that side, so it is plain there is more to swipe to. */
.mm-shell-nav.has-more-left { --fade-left: 32px; }
.mm-shell-nav.has-more-right { --fade-right: 32px; }
.mm-shell-nav a { padding: 8px 10px; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; text-decoration: none; color: var(--canvas); white-space: nowrap; border: 2px solid transparent; }
.mm-shell-nav a:hover { border-color: var(--canvas); }
.mm-shell-nav a.is-active { background: var(--canvas); color: var(--ink); }
.mm-shell-side { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.mm-shell-nav a.is-locked::after { content: ""; display: inline-block; width: 11px; height: 13px; margin-left: 6px; vertical-align: -1px; background: currentColor; opacity: .85;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 26'%3E%3Cpath d='M11 0a7 7 0 0 0-7 7v4H2v15h18V11h-2V7a7 7 0 0 0-7-7zm-3 7a3 3 0 0 1 6 0v4H8V7z'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 22 26'%3E%3Cpath d='M11 0a7 7 0 0 0-7 7v4H2v15h18V11h-2V7a7 7 0 0 0-7-7zm-3 7a3 3 0 0 1 6 0v4H8V7z'/%3E%3C/svg%3E") center / contain no-repeat; }
.mm-shell-nav a.is-locked:not(.is-active) { color: rgba(255, 215, 1, .7); }
.mm-shell-switch, .mm-shell-out { border: 2px solid var(--canvas); background: transparent; color: var(--canvas) !important; padding: 6px 10px; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; text-decoration: none; cursor: pointer; white-space: nowrap; }
.mm-shell :focus-visible { outline-color: var(--canvas); }
.mm-shell [data-unread]:not([data-unread="0"])::after { content: attr(data-unread); display: inline-block; margin-left: 6px; min-width: 18px; padding: 0 5px; background: var(--canvas); color: var(--ink); font-size: 11px; line-height: 18px; text-align: center; }
.mm-shell-nav a.is-active[data-unread]::after { background: var(--ink); color: var(--canvas); }

/* Rendered markdown (blog posts, lessons, newsletters) */
.mm-prose { font-size: 17px; line-height: 1.6; overflow-wrap: anywhere; }
.mm-prose > * + * { margin-top: 1em; }
.mm-prose > :first-child { margin-top: 0; }
.mm-prose h2 { font-size: 26px; line-height: 1.2; margin-top: 1.6em; }
.mm-prose h3 { font-size: 20px; line-height: 1.25; margin-top: 1.4em; }
.mm-prose ul, .mm-prose ol { padding-left: 1.3em; }
.mm-prose img { max-width: 100%; height: auto; border: var(--border); }
.mm-prose blockquote { margin: 1em 0; padding: 4px 0 4px 16px; border-left: 6px solid var(--ink); font-style: italic; }
.mm-prose code { background: rgba(34, 34, 34, .1); padding: 1px 5px; font-size: .92em; }
.mm-prose pre { background: var(--ink); color: var(--paper); padding: 14px; overflow-x: auto; }
.mm-prose pre code { background: none; padding: 0; }
.mm-prose a { font-weight: 600; }
/* A table keeps its words whole and scrolls sideways inside its own box when
   it is wider than the page (a phone), rather than breaking mid-word. */
.mm-prose table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; border-collapse: collapse; overflow-wrap: normal; font-size: .92em; line-height: 1.4; }
.mm-prose th, .mm-prose td { border: 2px solid var(--ink); padding: 7px 10px; text-align: left; vertical-align: top; }
.mm-prose th { background: var(--ink); color: var(--canvas); font-size: .82em; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.mm-prose td code { white-space: nowrap; }
.mm-prose iframe, .mm-prose video { max-width: 100%; }

/* Video frame, 16:9 */
.mm-video { position: relative; aspect-ratio: 16 / 9; border: var(--border); background: var(--ink); }
.mm-video iframe, .mm-video video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* On a phone the bar is two rows: the name beside the account buttons, then
   the section links, spread across the screen, in one row that scrolls
   sideways when they don't all fit (the admin's eight). Only the links stay
   stuck to the top while reading; the first row scrolls away with the page,
   which is what the negative `top` does. */
@media (max-width: 719px) {
  .mm-shell { --shell-row: 48px; top: calc(-1 * var(--shell-row)); padding: 0; gap: 0; }
  .mm-shell-home { flex: none; margin-left: 14px; padding: 0 10px 0 0; }
  .mm-shell-home img { height: 26px; }
  .mm-shell-brand { flex: 1 1 0; min-width: 0; overflow: hidden; display: flex; align-items: center; height: var(--shell-row); padding: 0 8px 0 10px; font-size: 22px; }
  /* The name takes the room the logo and the buttons leave, at up to its
     full size: "Team Manic" is 5.3 times as wide as its font size, "Admin"
     2.8 times. */
  .mm-shell-brand { container-type: inline-size; }
  .mm-shell-brand-text { white-space: nowrap; font-size: min(1em, 18.6cqw); }
  .mm-shell-brand-wide { display: none; }
  .mm-shell-brand-text.is-admin { font-size: min(1em, 35cqw); }
  .mm-shell-side { flex: none; height: var(--shell-row); padding-right: 12px; }
  .mm-shell-switch, .mm-shell-out { display: inline-flex; align-items: center; min-height: 34px; }
  .mm-shell-nav { order: 3; flex: 1 0 100%; gap: 0; border-top: 2px solid rgba(255, 215, 1, .28); }
  .mm-shell-nav a { flex: 1 0 auto; display: flex; align-items: center; justify-content: center; min-height: 46px; padding: 0 12px; letter-spacing: .04em; border: 0; }
  .mm-shell-nav a:first-child { padding-left: 16px; }
  .mm-shell-nav a:last-child { padding-right: 16px; }
  /* The member area's five links fit a phone's width without scrolling. */
  .mm-shell-members .mm-shell-nav a { padding: 0 6px; }
  .mm-shell-members .mm-shell-nav a:first-child { padding-left: 14px; }
  .mm-shell-members .mm-shell-nav a:last-child { padding-right: 14px; }
}
/* The narrowest phones: the first row must stay one row (the bar's sticky
   position counts on its height), so the name and the buttons shrink. */
@media (max-width: 379px) {
  .mm-shell-home { margin-left: 10px; padding-right: 8px; }
  .mm-shell-home img { height: 22px; }
  .mm-shell-brand { padding: 0 6px 0 8px; }
  .mm-shell-side { padding-right: 10px; }
  .mm-shell-switch, .mm-shell-out { padding: 6px 7px; letter-spacing: .03em; }
  .mm-shell-side { gap: 6px; }
  .mm-shell-members .mm-shell-nav a { font-size: 12px; letter-spacing: 0; padding: 0 5px; }
}
@media (max-width: 339px) {
  .mm .mm-shell-switch, .mm .mm-shell-out { font-size: 11px; padding: 6px; }
}
/* Fingers need more room than a mouse pointer: the small buttons, the
   footer links and the tick boxes grow to a size that is easy to hit. */
@media (max-width: 719px), (pointer: coarse) {
  .mm-btn-small { min-height: 40px; padding: 8px 13px; }
  .mm-foot { gap: 0 12px; }
  .mm-foot a { padding: 13px 8px; }
  .mm-toasts { bottom: max(18px, env(safe-area-inset-bottom)); }
}
@media (min-width: 720px) {
  .mm-main { padding: 34px 24px 80px; }
  .mm-shell { padding: 12px 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .mm * { transition: none !important; animation: none !important; }
}
