/* nellamugisha.com components: wordmark, CTAs, modal, toast, tooltip, popover, form states, gallery,
   lightbox, slider, accordion, share and reveal. Tokens come from styles.css. Mobile first: base rules are
   the phone layout and min-width queries add to them. Scripts: assets/js/ (one module per component). */

/* ---- Closing wordmark: her name as the page's last word ---- */
.nm-wordmark-wrap { container-type: inline-size; overflow: hidden; border-top: var(--b) solid var(--line); background: var(--paper-2); }
.nm-wordmark {
  /* "Nella Mugisha" sets 6.6× its font size wide at this tracking; 7.4 leaves room for the block and shadow. */
  margin: 0; padding: .12em 0 .2em; text-align: center; white-space: nowrap; user-select: none; pointer-events: none;
  font: 900 min(calc(100cqi / 7.4), 200px)/1 var(--display); letter-spacing: -.05em;
  color: var(--ink); text-shadow: .045em .045em 0 var(--red);
}
.nm-wordmark-block {
  display: inline-block; margin-left: .12em; padding: 0 .08em .04em;
  background: var(--red); color: var(--on-red); text-shadow: none;
  border: max(2px, .02em) solid var(--line); box-shadow: .05em .05em 0 var(--shadow); transform: rotate(-1.5deg);
}

/* ---- Marquee: her three themes, a slow ticker; static under reduced motion ---- */
.nm-marquee { overflow: hidden; border-bottom: var(--b) solid var(--line); background: var(--red); color: var(--on-red); }
.nm-marquee-track { display: flex; width: max-content; gap: 0; margin: 0; padding: 14px 0; list-style: none; }
.nm-marquee-track li { font: 600 15px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; padding: 0 22px; }
.nm-marquee-track li::after { content: "●"; content: "●" / ""; color: var(--on-red); margin-left: 44px; font-size: 11px; vertical-align: 2px; }
@media (prefers-reduced-motion: no-preference) {
  .nm-marquee-track { animation: nm-marquee 38s linear infinite; }
  .nm-marquee:hover .nm-marquee-track { animation-play-state: paused; }
  /* The highlight lands like a stamp on first paint. */
  h1 .hl::before { animation: nm-stamp .45s cubic-bezier(.2, 1.4, .4, 1) .15s both; }
}
@keyframes nm-marquee { to { transform: translateX(-50%); } }
@keyframes nm-stamp { from { transform: rotate(-6deg) scale(1.25); opacity: 0; } }

/* ---- CTA card: one action mid-page ---- */
.nm-cta-card {
  display: grid; gap: 18px; margin: 56px 0; padding: 32px;
  background: var(--red); color: var(--on-red);
  border: var(--b) solid var(--line); border-radius: var(--r); box-shadow: var(--off) var(--off) 0 var(--shadow);
}
.nm-cta-card h2 { color: var(--on-red); font-size: clamp(26px, 3.4vw, 36px); margin: 0; }
.nm-cta-card p { margin: 0; max-width: 34em; }
.nm-cta-card .btn { justify-self: start; --shadow: var(--line); }
.nm-cta-card .btn-ghost { background: var(--card); }
@media (min-width: 821px) {
  .nm-cta-card { grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding: 32px 36px; }
}

/* ---- Mobile action bar: one tap to invite her, phones only (actionbar.js) ---- */
.nm-actionbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 9;
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: var(--paper); border-top: var(--b) solid var(--line);
  transform: translateY(110%);
}
.nm-actionbar.is-shown { transform: none; }
.nm-actionbar .btn { width: 100%; justify-content: center; }
@media (prefers-reduced-motion: no-preference) { .nm-actionbar { transition: transform .25s ease; } }
@media (min-width: 821px) { .nm-actionbar { display: none; } }

/* ---- Modal: native <dialog> (assets/js/components/modal.js) ---- */
.nm-modal {
  width: min(100% - 32px, 560px); max-height: min(100% - 32px, 90vh); padding: 0; overflow: auto;
  color: var(--ink); background: var(--card);
  border: var(--b) solid var(--line); border-radius: var(--r); box-shadow: 8px 8px 0 var(--shadow);
}
.nm-modal::backdrop { background: rgb(20 19 22 / .6); }
.nm-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 20px 0; }
.nm-modal-head h2 { font-size: 26px; margin: 0; }
.nm-modal-body { padding: 16px 20px 24px; }
.nm-modal .contact-form { box-shadow: none; border: 0; padding: 0; background: none; max-width: none; }
.nm-close {
  flex: none; display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; cursor: pointer;
  font: 700 22px/1 var(--sans); color: var(--ink); background: var(--paper);
  border: 1.5px solid var(--line); border-radius: 50%; box-shadow: 3px 3px 0 var(--shadow);
}
.nm-close:active { transform: translate(3px, 3px); box-shadow: none; }
@media (prefers-reduced-motion: no-preference) {
  .nm-modal[open] { animation: nm-rise .22s ease-out; }
}
@keyframes nm-rise { from { opacity: 0; transform: translateY(12px); } }
@media (min-width: 481px) { .nm-modal-head { padding: 24px 28px 0; } .nm-modal-body { padding: 16px 28px 28px; } }

/* ---- Toast: one at a time, bottom of the screen (assets/js/components/toast.js) ---- */
.nm-toast {
  position: fixed; inset: auto max(16px, env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  margin: 0; width: auto; max-width: 420px; padding: 14px 52px 14px 18px;
  color: var(--ink); background: var(--card); border: var(--b) solid var(--line); border-left: 8px solid var(--ok);
  border-radius: var(--r); box-shadow: var(--off) var(--off) 0 var(--shadow);
}
.nm-toast[data-tone="error"] { border-left-color: var(--red); }
.nm-toast-title { margin: 0; font-weight: 700; }
.nm-toast-body { margin: 2px 0 0; color: var(--ink-2); font-size: 16px; }
.nm-toast-body:empty { display: none; }
.nm-toast .nm-close { position: absolute; top: 8px; right: 8px; width: 32px; height: 32px; font-size: 18px; box-shadow: none; }
@media (prefers-reduced-motion: no-preference) { .nm-toast:popover-open { animation: nm-rise .2s ease-out; } }
@media (min-width: 821px) { .nm-toast { inset-inline-start: auto; } }

/* ---- Tooltip: [data-tip], on hover and focus, precise pointers; decoration ---- */
:where([data-tip]) { position: relative; }
@media (hover: hover) and (pointer: fine) {
  [data-tip]::after {
    content: attr(data-tip); position: absolute; left: 50%; top: calc(100% + 10px); z-index: 30;
    translate: -50% -4px; opacity: 0; pointer-events: none; white-space: nowrap;
    font: 600 12px/1.2 var(--mono); letter-spacing: .06em; text-transform: uppercase;
    color: var(--paper); background: var(--ink); padding: 7px 9px; border-radius: 4px;
  }
  [data-tip]:is(:hover, :focus-visible)::after { opacity: 1; translate: -50% 0; transition: opacity .15s .3s, translate .15s .3s; }
  [data-tip-pos="left"]::after { left: auto; right: 0; translate: 0 -4px; }
  [data-tip-pos="left"]:is(:hover, :focus-visible)::after { translate: 0 0; }
}

/* ---- Popover: native [popover], anchored to its button where supported ---- */
.nm-popover {
  width: min(100% - 32px, 340px); margin: auto; padding: 16px 18px;
  color: var(--ink); background: var(--card); border: var(--b) solid var(--line); border-radius: var(--r);
  box-shadow: var(--off) var(--off) 0 var(--shadow); font-size: 16px; line-height: 1.5;
}
.nm-popover p { margin: 0 0 8px; }
.nm-popover p:last-child { margin: 0; }
@supports (position-area: bottom) {
  .nm-popover { margin: 8px 0; position-area: bottom span-right; position-try-fallbacks: flip-block, flip-inline; }
}
.nm-info {
  display: inline-grid; place-items: center; width: 28px; height: 28px; margin-left: 8px; padding: 0; vertical-align: middle; cursor: pointer;
  font: 700 15px/1 var(--display); color: var(--ink); background: var(--card); border: 1.5px solid var(--line); border-radius: 50%;
}
.nm-info:hover { background: var(--red); color: var(--on-red); }

/* ---- Form states added by assets/js/components/form.js ---- */
.contact-form [aria-busy="true"] { opacity: .7; cursor: progress; }
.nm-form-summary:focus { outline: 3px solid var(--red-ink); outline-offset: 3px; }

/* ---- Gallery and lightbox ---- */
.gallery a[data-nm-lightbox] { display: block; color: inherit; text-decoration: none; }
.gallery a[data-nm-lightbox]:hover img { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--shadow); }
.gallery a[data-nm-lightbox] img { transition: transform .15s, box-shadow .15s; }
/* The viewer itself is styled in media.css, loaded on pages with a gallery. */

/* ---- Slider: scroll-snap track, buttons added by assets/js/components/carousel.js ---- */
.nm-carousel-track {
  display: grid; grid-auto-flow: column; grid-auto-columns: 86%; gap: 16px;
  margin: 0; padding: 4px 8px 14px 0;
  overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x mandatory; scrollbar-width: thin;
}
.nm-carousel-track > * { scroll-snap-align: start; min-width: 0; display: flex; }
.nm-carousel-track > * > .card { width: 100%; }
.nm-carousel-controls { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.nm-carousel-controls button {
  display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0; cursor: pointer;
  font: 700 20px/1 var(--sans); color: var(--ink); background: var(--card);
  border: var(--b) solid var(--line); border-radius: 50%; box-shadow: 3px 3px 0 var(--shadow);
}
.nm-carousel-controls button:disabled { opacity: .45; cursor: default; box-shadow: none; }
.nm-carousel-count { font: 600 14px/1 var(--mono); letter-spacing: .1em; color: var(--ink-2); font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: no-preference) { .nm-carousel-track { scroll-behavior: smooth; } }
@media (min-width: 600px) { .nm-carousel-track { grid-auto-columns: calc((100% - 16px) / 2); } }
@media (min-width: 1000px) { .nm-carousel-track { grid-auto-columns: calc((100% - 32px) / 3); gap: 16px; } }

/* ---- Accordion: exclusive <details name>; accordion.js adds deep links ---- */
.nm-faq { border-top: var(--b) solid var(--line); max-width: 48em; margin: 8px 0 24px; }
.nm-faq details { border-bottom: 1.5px dashed color-mix(in srgb, var(--line) 35%, transparent); }
.nm-faq summary {
  list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: 16px; align-items: baseline;
  padding: 18px 0; font: 700 19px/1.35 var(--display);
}
.nm-faq summary::-webkit-details-marker { display: none; }
.nm-faq summary::after { content: "+"; content: "+" / ""; flex: none; font: 600 22px/1 var(--mono); color: var(--red-ink); }
.nm-faq details[open] summary::after { content: "−"; content: "−" / ""; }
.nm-faq details p { margin: 0 0 18px; color: var(--ink-2); max-width: 40em; }

/* ---- Share ---- */
.nm-share { display: inline-flex; margin-top: 24px; }
.nm-share-menu { display: grid; gap: 4px; padding: 8px; }
.nm-share-menu a, .nm-share-menu button {
  display: block; width: 100%; padding: 10px 12px; text-align: left; cursor: pointer;
  font: 600 16px/1.3 var(--sans); color: var(--ink); background: none; border: 0; border-radius: 4px; text-decoration: none;
}
.nm-share-menu a:hover, .nm-share-menu button:hover { background: var(--paper-2); }
html:not(.nm-js) [data-nm-copy] { display: none; }

/* ---- Reveal: rise in once; shown at once without JS, reduced motion or slow data ---- */
@media (prefers-reduced-motion: no-preference) {
  html.nm-reveal-ready [data-nm-reveal]:not(.is-in) { opacity: 0; transform: translateY(18px); }
  html.nm-reveal-ready [data-nm-reveal] { transition: opacity .5s ease, transform .5s ease; }
}

/* ---- Footer: social profiles and the credit (layout.php social_links(), credit()) ---- */
.nm-social-nav { flex-basis: 100%; }
.nm-social { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; margin: 0; padding: 0; }
.nm-social a {
  display: grid; place-items: center; width: 44px; height: 44px; color: var(--ink);
  border: var(--b) solid var(--line); border-radius: 50%; background: var(--card); box-shadow: 3px 3px 0 var(--shadow);
}
.nm-social a:hover { background: var(--red); color: var(--on-red); }
.footer-base { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; flex-basis: 100%; }
.footer-base p { margin: 0; }
.nm-credit { color: var(--ink-2); }
.nm-credit a { font-weight: 700; }
.nm-heart { display: inline-block; vertical-align: -2px; color: var(--red); }
@media (prefers-reduced-motion: no-preference) {
  .nm-social a { transition: transform .15s, box-shadow .15s, background-color .15s; }
  .nm-social a:hover { transform: translate(-2px, -2px) rotate(-4deg); box-shadow: 5px 5px 0 var(--shadow); }
}

/* ---- Speaking: the next-talk card (event_card) and the speaking kit (speaking_kit) ---- */
.nm-speaker-row { margin-top: 48px; }
.nm-speaker-row .cards { grid-template-columns: 1fr; }
.nm-event, .nm-kit {
  display: flex; flex-direction: column; gap: 10px; padding: 24px;
  background: var(--card); border: var(--b) solid var(--line); border-radius: var(--r); box-shadow: var(--off) var(--off) 0 var(--shadow);
}
.nm-event h3, .nm-kit h3 { margin: 0; font-size: clamp(22px, 2.6vw, 28px); }
.nm-event p, .nm-kit p { margin: 0; }
.nm-event-badge {
  align-self: flex-start; padding: 6px 12px; border: var(--b) solid var(--line); border-radius: 999px;
  font: 600 13px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; background: var(--red); color: var(--on-red); transform: rotate(-2deg);
}
.nm-event-past .nm-event-badge { background: var(--paper-2); color: var(--ink); }
.nm-event-date { font: 900 clamp(30px, 4vw, 44px)/1 var(--display); letter-spacing: -.02em; }
.nm-event-where, .nm-event-by { color: var(--ink-2); }
.nm-event-by { font-size: 14px; }
.nm-kit-mark { width: 56px; height: 56px; }
.nm-kit-list { margin: 0 0 6px; padding-left: 1.2em; color: var(--ink-2); }
.nm-kit .btn { align-self: flex-start; margin-top: auto; white-space: nowrap; gap: 10px; }
.nm-kit-size { font: 600 12px/1 var(--mono); letter-spacing: .06em; }
@media (min-width: 821px) { .nm-speaker-row .cards { grid-template-columns: 1.1fr 1fr; } }

/* Header dropdown panel (the open .nav-group in styles.css). */
/* ::before bridges the hover gap; ::after is the caret. */
.nav-drop::before { content: ""; position: absolute; inset: -20px 0 100%; }
.nav-drop::after {
  content: ""; position: absolute; top: -9px; left: 26px; width: 14px; height: 14px; transform: rotate(45deg);
  background: var(--card); border: solid var(--line); border-width: var(--b) 0 0 var(--b); border-radius: 3px 0 0;
}
.nav-wide li:last-child .nav-drop::after { left: auto; right: 26px; }
.nav-drop {
  position: absolute; top: calc(100% + 18px); left: -14px; z-index: 6; width: 320px; margin: 0; padding: 8px; list-style: none;
  display: grid; gap: 2px;
  background: var(--card); border: var(--b) solid var(--line); border-radius: var(--r); box-shadow: var(--off) var(--off) 0 var(--shadow);
}
.nav-drop a { display: grid; gap: 2px; padding: 10px 14px; border-radius: 6px; }
.nav-drop a:hover { background: var(--paper-2); }
/* Current page: a red tint, never the grey hover. */
.nav-drop a[aria-current="page"] { background: color-mix(in srgb, var(--red) 16%, var(--card)); }
.nav-item { font-weight: 700; }
.nav-item-d { font-size: 13px; color: var(--ink-2); }
.nm-event-time, .nm-event-count { font: 600 14px/1.4 var(--mono); }
.nm-event-count { color: var(--red-ink); }
.nm-event-extra { display: grid; gap: 12px; justify-items: start; margin-top: 6px; }
.nm-event-extra .nm-media { justify-self: stretch; }

/* Contact form (page and dialog): topic chips, paired fields, a hint per topic. */
.nm-topics { margin: 0; padding: 0; border: 0; min-width: 0; }
.nm-topics legend { padding: 0; margin-bottom: 10px; font: 600 13px/1.3 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.nm-topics .nm-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.nm-topics .nm-chip { position: relative; display: block; margin: 0; cursor: pointer; font: 600 15px/1.3 var(--sans); letter-spacing: normal; text-transform: none; }
.nm-topics .nm-chip input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.nm-topics .nm-chip span {
  display: block; padding: 9px 16px; background: var(--paper);
  border: var(--b) solid var(--line); border-radius: 999px; box-shadow: 2px 2px 0 var(--shadow);
}
.nm-topics .nm-chip:hover span { background: var(--paper-2); }
.nm-topics .nm-chip input:checked + span { background: var(--red); color: var(--on-red); box-shadow: 3px 3px 0 var(--shadow); }
.nm-topics .nm-chip input:focus-visible + span { outline: 3px solid var(--red-ink); outline-offset: 2px; }
.nm-form-row { display: grid; gap: 20px; }
@media (min-width: 640px) { .nm-form-row { grid-template-columns: 1fr 1fr; } }
.contact-form .hint[data-topic] { display: none; }
.contact-form:has([value="speaking"]:checked) [data-topic="speaking"], .contact-form:has([value="media"]:checked) [data-topic="media"],
.contact-form:has([value="collaboration"]:checked) [data-topic="collaboration"], .contact-form:has([value="other"]:checked) [data-topic="other"] { display: block; }
.nm-form-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding-top: 4px; }
.nm-form-foot .hint { margin: 0; flex: 1 1 16em; }

/* Cookie notice and back-to-top: low, lifted over the phone action bar while it shows; side by side. */
.nm-cookie {
  position: fixed; z-index: 8; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; max-width: 34em; padding: 12px 14px;
  background: var(--card); border: var(--b) solid var(--line); border-radius: var(--r); box-shadow: 4px 4px 0 var(--shadow);
  opacity: 0; transform: translateY(12px); transition: opacity .25s ease, transform .25s ease, bottom .25s ease;
}
.nm-cookie.is-in { opacity: 1; transform: none; }
.nm-cookie p { margin: 0; flex: 1 1 14em; font-size: 14px; line-height: 1.45; }
.nm-cookie .btn { padding: 8px 16px; }
.nm-top {
  position: fixed; z-index: 7; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  display: grid; place-items: center; width: 48px; height: 48px; font: 800 20px/1 var(--sans); color: var(--ink); text-decoration: none;
  background: var(--card); border: var(--b) solid var(--line); border-radius: 50%; box-shadow: 3px 3px 0 var(--shadow);
  opacity: 0; pointer-events: none; transform: translateY(10px); transition: opacity .2s ease, transform .2s ease, bottom .25s ease;
}
.nm-top.is-on { opacity: 1; pointer-events: auto; transform: none; }
.nm-top:hover { background: var(--red); color: var(--on-red); }
.nm-top:focus-visible { outline: 3px solid var(--red-ink); outline-offset: 3px; }
body:has(.nm-actionbar.is-shown) :is(.nm-cookie, .nm-top) { bottom: calc(84px + env(safe-area-inset-bottom, 0px)); }
body:has(.nm-top.is-on) .nm-cookie { right: 72px; }
@media (min-width: 821px) { .nm-cookie { left: 24px; right: auto; bottom: 24px; } body:has(.nm-top.is-on) .nm-cookie { right: auto; } .nm-top { right: 24px; bottom: 24px; } }

/* Phone menu (overrides styles.css): two columns, a caret, never taller than the screen; one-page groups drop the label. */
.menu[open] nav { top: calc(100% + 14px); padding: 14px 18px 16px; }
/* The list scrolls, so the caret is not clipped. */
.menu[open] nav > ul { columns: 2; column-gap: 18px; max-height: calc(100dvh - 150px); overflow-y: auto; overscroll-behavior: contain; }
.menu-group { break-inside: avoid; }
.menu-label { margin: 8px 0 2px; }
.menu-group:has(li:only-child) .menu-label { display: none; }
.menu-group:has(li:only-child) { padding-top: 6px; }
.menu a { display: flex; align-items: center; min-height: 40px; padding: 4px 0; border-bottom: 0; font-size: 16px; line-height: 1.25; }
.menu-group:has(li:only-child) a { font-weight: 700; }
/* The caret is the panel's own: on its edge in every browser, under the Menu button. */
.menu[open] nav::before {
  content: ""; position: absolute; top: -9px; right: 28px; width: 14px; height: 14px; rotate: 45deg;
  background: var(--card); border: solid var(--line); border-width: var(--b) 0 0 var(--b); border-radius: 3px 0 0;
}
@media (prefers-reduced-motion: no-preference) { .menu[open] nav { animation: nm-drop-in .2s cubic-bezier(.2, .8, .2, 1); transform-origin: calc(100% - 40px) 0; } }

/* Footer links: taller tap targets. */
.footer-cols a, .footer-legal-links a { display: inline-block; padding-block: 4px; }
