/* home/footer-dock.css
 *
 * One footer for the whole site, and the widget each of its items opens.
 *
 * Before this the home page ended in a tall stack of links and /about ended
 * in a different, shorter one. Three links overlapped, three did not, the
 * socials were orange on one and grey on the other, and the order was
 * different, so a visitor who moved between them could not learn where
 * anything was. scripts/footer-dock.js builds one footer and every page
 * gets it.
 *
 * The footer is a footer: it sits at the bottom of the page. Clicking an
 * item opens that item, and only that item, as a widget in the bottom right
 * corner, built to match the download card in the top right: same width,
 * same column, same gradient, same border, same radius, same shadow, same
 * round arrow chips. The card comes down from behind the header and these
 * come up from under the fold, over the same half second.
 *
 * Every value it needs is declared on .ns-dock-root and .ns-footer rather
 * than taken from the page. home.css and styles.css carry different values
 * under the same token names, and a footer that reads whichever it lands
 * next to is a footer that looks like two different footers again.
 */

.ns-dock-root,
.ns-footer {
  --d-ground: #1a1a1a;
  --d-surface: #2d2a2a;
  --d-raised: #3a3737;
  --d-primary: #00A86B;
  --d-primary-hi: #1fc988;
  --d-cream: #fff3b1;
  --d-text: #ffffff;
  --d-text-2: #e0e0e0;
  --d-muted: #989797;
  --d-border: rgba(255, 255, 255, 0.2);
  --d-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
  --d-fast: 140ms ease;

  /* The card on the home page is 348px and sits 1.25rem from the right. The
     widgets are the same, so they open in the card's own column. */
  --d-w: 348px;
  --d-gap: 1.25rem;

  /* On a phone the card is a bar along the bottom of the screen and its
     height changes as it opens. footer-dock.js measures it and writes it
     here, so a widget always sits clear of it. Zero where there is no card. */
  --d-cta-h: 0px;

  font-family: var(--d-font);
}
.ns-dock-root *, .ns-footer * { box-sizing: border-box; }
.ns-dock-root a, .ns-footer a { text-decoration: none; }

/* A reset, because this lands on pages that did not expect it.
 *
 * styles.css carries `h2 { text-align: center }` and `p { margin-bottom:
 * 1rem }` as bare element rules, so a widget on /about or the blog was
 * centring its headings while the same widget on the home page left them
 * alone. That is the complaint this whole file exists to answer, arriving
 * by a different door.
 *
 * :where() contributes no specificity, so this whole selector weighs the
 * same as one class and every rule below it wins on order rather than on a
 * specificity fight. Keep it first in the file. */
.ns-dock-root :where(h1, h2, h3, p, ul, ol, li, img, a, button, details, summary, nav, div, span),
.ns-footer :where(h1, h2, h3, p, ul, ol, li, img, a, button, nav, div, span) {
  margin: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  text-align: inherit;
  letter-spacing: normal;
  text-transform: none;
  line-height: inherit;
  background: none;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  float: none;
  /* Not width or height. An <img> carries its size as an attribute, CSS
     beats a presentational attribute, and `width: auto` here rendered the
     footer logo at the file's own 120px instead of the 40 it asks for. */
}

/* The footer the page shipped with. It stays in the HTML so a crawler reads
   those links and anyone whose JavaScript did not run gets an ordinary
   working footer. :not(.ns-footer) so this does not hide the one we just
   put there. */
html.ns-docked body > footer:not(.ns-footer),
html.ns-docked .site-footer { display: none; }

/* ---------------------------------------------------------------- footer */

.ns-footer {
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  background: var(--d-ground);
  color: var(--d-muted);
  padding: 2.25rem 1.25rem 2.5rem;
  text-align: center;
  line-height: 1.5;
}
.ns-footer-top { margin-bottom: 1.1rem; }
.ns-footer-top img { display: block; width: 40px; height: 40px; margin: 0 auto 0.5rem; border-radius: 10px; }
.ns-footer-brand { margin: 0; font-weight: 800; font-size: 1.05rem; color: var(--d-cream); }
.ns-footer-tagline { margin: 0.1rem 0 0; font-size: 0.85rem; color: var(--d-muted); }

.ns-footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.35rem 0.5rem;
  margin: 0 auto 1.1rem;
  max-width: 44rem;
}
/* Each item opens its own widget. They are links, so they still go
   somewhere with no JavaScript, and they read as the pressable things they
   are rather than as underlined prose. */
.ns-footer-links a {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--d-text-2);
  background: var(--d-surface);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.38rem 0.95rem;
  cursor: pointer;
  transition: background var(--d-fast), color var(--d-fast),
              border-color var(--d-fast), transform var(--d-fast);
}
.ns-footer-links a:hover {
  background: var(--d-raised);
  border-color: var(--d-primary);
  color: var(--d-text);
  transform: translateY(-1px);
}
.ns-footer-links a[aria-expanded="true"] {
  background: var(--d-primary);
  border-color: var(--d-primary);
  color: #06120d;
}
.ns-footer-copy { margin: 0; font-size: 0.75rem; color: var(--d-muted); }

/* ---------------------------------------------------------------- widget */

.ns-dock-root {
  position: fixed;
  right: var(--d-gap);
  bottom: var(--d-gap);
  z-index: 80;
  width: var(--d-w);
  /* An anchor, nothing more. With nothing open, clicks pass straight
     through to the page underneath. */
  pointer-events: none;
}

/* The scrim is a child of the widget's root, not a sibling.
 *
 * The root is positioned and carries a z-index, which makes it a stacking
 * context, and a z-index set on anything inside it only orders it against
 * its siblings in there. A scrim outside the root therefore painted over
 * every widget on a phone no matter how high the widget's own z-index was,
 * which is why the panel came up grey and would not answer a tap. In here
 * the panel paints above it simply by coming after it. */
.ns-scrim {
  position: fixed;
  inset: 0;
  pointer-events: auto;
  background: rgba(0, 0, 0, 0.6);
  border: 0;
  padding: 0;
  opacity: 0;
  transition: opacity 300ms ease-out;
}
.ns-scrim.is-in { opacity: 1; }
.ns-scrim[hidden] { display: none; }

.ns-panel {
  text-align: left;
  position: relative;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-height: min(68svh, 560px);
  background: linear-gradient(180deg, var(--d-raised) 0%, var(--d-surface) 62%);
  border: 1px solid var(--d-border);
  border-radius: 18px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
  /* Up from under the fold, the way the card comes down from behind the
     header. Same half second, same easing, so they are one family. */
  transform: translateY(16px);
  opacity: 0;
  transition: transform 500ms cubic-bezier(0.16, 1, 0.3, 1), opacity 500ms ease-out;
}
.ns-panel.is-in { transform: translateY(0); opacity: 1; }

.ns-panel-head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 0.8rem 0.6rem 1rem;
  flex: 0 0 auto;
}
.ns-panel-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
  color: var(--d-cream);
  flex: 1 1 auto;
}
.ns-panel-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  flex: 0 0 auto;
  font-family: inherit;
  font-size: 1.15rem;
  line-height: 1;
  color: var(--d-text-2);
  background: rgba(255, 255, 255, 0.07);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  transition: background var(--d-fast), color var(--d-fast);
}
.ns-panel-close:hover { background: rgba(255, 255, 255, 0.16); color: var(--d-text); }

.ns-panel-body {
  /* A flex item will not shrink below the height of its own content unless
     it is told it may, and without that the panel grows past its max-height
     instead of scrolling inside it. */
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}
.ns-list { display: flex; flex-direction: column; gap: 0.4rem; }

.ns-block-line {
  margin: 0 0 0.45rem;
  font-size: 0.8rem;
  line-height: 1.45;
  color: var(--d-text-2);
}

/* The one filled button, for the one thing worth pressing: the address a
   person writes to. It is the card's own primary button. */
.ns-cta-mail {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  width: 100%;
  font-size: 0.9rem;
  font-weight: 800;
  color: #06120d;
  background: var(--d-primary);
  border-radius: 999px;
  padding: 0.4rem 0.4rem 0.4rem 1.1rem;
  min-height: 44px;
  box-shadow: 0 6px 18px rgba(0, 168, 107, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.28);
  transition: background var(--d-fast), box-shadow var(--d-fast), transform var(--d-fast);
}
.ns-chip {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(6, 18, 13, 0.85);
  color: var(--d-primary-hi);
  transition: background var(--d-fast), color var(--d-fast), transform var(--d-fast);
}
.ns-chip svg { width: 15px; height: 15px; }
.ns-cta-mail:hover {
  background: var(--d-primary-hi);
  box-shadow: 0 10px 26px rgba(0, 168, 107, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.32);
  transform: translateY(-1px);
}
.ns-cta-mail:hover .ns-chip { transform: translateX(3px); }

/* Every other row. The card's device row, exactly: a bar on a dark ground
   with a coloured left edge, so a list reads as a list and not as a stack
   of competing buttons. */
.ns-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--d-text);
  background: var(--d-ground);
  border: 1px solid var(--d-border);
  border-left: 3px solid var(--d-row, var(--d-border));
  border-radius: 10px;
  padding: 0.5rem 0.7rem;
  min-height: 42px;
  transition: background var(--d-fast), border-color var(--d-fast), transform var(--d-fast);
}
.ns-row:hover { background: var(--d-raised); transform: translateX(2px); }
.ns-row-icon { width: 18px; height: 18px; flex: 0 0 auto; color: var(--d-row, var(--d-muted)); }
.ns-row-name { font-size: 0.85rem; font-weight: 700; min-width: 0; }
.ns-row-note {
  margin-left: auto;
  padding-left: 0.5rem;
  font-size: 0.68rem;
  color: var(--d-muted);
  white-space: nowrap;
}


.ns-copy {
  margin: 0.5rem 0 0;
  font-size: 0.68rem;
  line-height: 1.45;
  color: var(--d-muted);
}

/* A heading that drops down. Descriptions, episode notes and the legal text
   all sit behind one of these in a small font, so a widget opens as a list
   of headings rather than as a wall of prose. */
.ns-fold {
  background: var(--d-ground);
  border: 1px solid var(--d-border);
  border-left: 3px solid var(--d-row, #6aa9ff);
  border-radius: 10px;
}
.ns-fold-head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  padding: 0.5rem 0.7rem;
  cursor: pointer;
  list-style: none;
  min-height: 40px;
}
.ns-fold-head::-webkit-details-marker { display: none; }
/* The chevron, drawn once rather than relying on the browser's own marker,
   which is a different shape and colour in each of them. */
.ns-fold-head::after {
  content: '';
  margin-left: auto;
  align-self: center;
  flex: 0 0 auto;
  width: 6px; height: 6px;
  border-right: 2px solid var(--d-muted);
  border-bottom: 2px solid var(--d-muted);
  transform: translateY(-2px) rotate(45deg);
  transition: transform var(--d-fast);
}
.ns-fold[open] > .ns-fold-head::after { transform: translateY(1px) rotate(-135deg); }
.ns-fold-head:hover { background: var(--d-raised); border-radius: 8px; }
.ns-fold-title { font-size: 0.82rem; font-weight: 700; color: var(--d-text); }
.ns-fold-note { font-size: 0.66rem; color: var(--d-muted); white-space: nowrap; }
.ns-fold-body { display: flex; flex-direction: column; gap: 0.3rem; padding: 0 0.7rem 0.6rem; }
.ns-fold-inner { border-left-width: 2px; border-left-color: rgba(255, 255, 255, 0.18); }
.ns-fold-inner .ns-fold-title { font-size: 0.76rem; font-weight: 600; color: var(--d-text-2); }

/* The first line of About. The only line in any widget that is allowed to
   be bigger than the rest, because it is the sentence the page is for. */
.ns-lead {
  margin: 0 0 0.4rem;
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.3;
  color: var(--d-cream);
}

/* The second of the three opening lines. Quieter than the first, louder
   than the third, so they read in the order they were written. */
.ns-sub {
  margin: 0 0 0.35rem;
  font-size: 0.84rem;
  font-weight: 700;
  line-height: 1.4;
  color: var(--d-text);
}

/* The phrase in a paragraph the eye should land on. Cream, because that is
   what every heading in here already is, so emphasis reads as part of the
   same voice rather than as a link. */
.ns-em { font-weight: 700; color: var(--d-cream); }

/* A value: the word, then what it means, on the line under it. */
.ns-value { display: flex; flex-direction: column; padding: 0.15rem 0; }
.ns-value-name { font-size: 0.78rem; font-weight: 700; color: var(--d-cream); }
.ns-value-line { font-size: 0.72rem; line-height: 1.45; color: var(--d-text-2); }

/* The two ways in, written out. They say what the card says, in the same
   order, so a parent who reads About and a parent who opens the card are
   not told two different things. */
.ns-ways[hidden], .ns-picks[hidden] { display: none; }
.ns-tier {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.15rem;
  width: 100%;
  font-family: inherit;
  text-align: left;
  background: var(--d-ground);
  border: 1px solid var(--d-border);
  border-radius: 10px;
  padding: 0.55rem 0.7rem;
  cursor: pointer;
  transition: background var(--d-fast), border-color var(--d-fast), transform var(--d-fast);
}
.ns-tier:hover { background: var(--d-raised); border-color: var(--d-primary); transform: translateX(2px); }
.ns-tier:active { transform: none; }
.ns-tier-first { border-color: var(--d-primary); }
.ns-tier-head { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.ns-tier-name { font-size: 0.8rem; font-weight: 800; color: var(--d-text); }
.ns-tier-badge {
  font-size: 0.56rem;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  line-height: 1;
  padding: 0.22rem 0.42rem;
  border-radius: 999px;
  background: var(--d-primary);
  color: #06120d;
}
.ns-tier-line { font-size: 0.72rem; line-height: 1.4; color: var(--d-text-2); }

/* The question above the devices, the same one the card asks. */
.ns-step {
  margin: 0.1rem 0 0.2rem;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--d-text-2);
}
.ns-back {
  align-self: flex-start;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--d-muted);
  background: transparent;
  border: 0;
  padding: 0.3rem 0.1rem;
  cursor: pointer;
}
.ns-back:hover { color: var(--d-text); }

/* The small font the folds hold. */
.ns-small {
  margin: 0;
  font-size: 0.72rem;
  line-height: 1.5;
  color: var(--d-text-2);
}
.ns-wait { margin: 0.2rem 0; font-size: 0.72rem; color: var(--d-muted); }

/* The rest of the articles, here rather than on another page. */
.ns-more {
  align-self: flex-start;
  font-family: inherit;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--d-text-2);
  background: transparent;
  border: 1px solid var(--d-border);
  border-radius: 999px;
  padding: 0.3rem 0.8rem;
  margin-top: 0.1rem;
  cursor: pointer;
  transition: background var(--d-fast), color var(--d-fast), border-color var(--d-fast);
}
.ns-more:hover { background: var(--d-primary); border-color: var(--d-primary); color: #06120d; }

/* ---------------------------------------------------------------- a phone */

/* Down here the download card is already a bar across the bottom of the
   screen, so a widget in the corner has nowhere to be. It becomes a sheet
   across the page, riding above whatever height that bar currently is, with
   the scrim behind it. */
@media (max-width: 760px) {
  .ns-dock-root {
    --d-gap: 0.6rem;
    left: var(--d-gap);
    right: var(--d-gap);
    bottom: calc(var(--d-cta-h) + var(--d-gap));
    width: auto;
  }
  /* Two fixed things share the bottom of a small screen, so every pixel one
     of them spends is one the page does not get. Everything here is the
     desktop value with the slack taken out, not a different design. */
  .ns-panel { max-height: 72svh; border-radius: 14px; }
  .ns-panel-head { padding: 0.55rem 0.5rem 0.4rem 0.75rem; }
  .ns-panel-title { font-size: 0.88rem; }
  .ns-panel-close { width: 26px; height: 26px; font-size: 1rem; }
  .ns-panel-body { padding: 0 0.75rem 0.7rem; gap: 0.3rem; }
  .ns-block-line { margin-bottom: 0.3rem; font-size: 0.75rem; line-height: 1.4; }
  .ns-row { min-height: 36px; padding: 0.35rem 0.6rem; }
  .ns-row-name { font-size: 0.8rem; }
  .ns-cta-mail { min-height: 40px; font-size: 0.85rem; }
  .ns-fold-head { min-height: 34px; padding: 0.35rem 0.6rem; }
  .ns-fold-body { padding: 0 0.6rem 0.45rem; }

  .ns-footer { padding: 1.4rem 0.9rem 1.5rem; }
  .ns-footer-top { margin-bottom: 0.8rem; }
  .ns-footer-top img { width: 32px; height: 32px; margin-bottom: 0.35rem; }
  .ns-footer-brand { font-size: 0.95rem; }
  .ns-footer-tagline { font-size: 0.78rem; }
  .ns-footer-links { gap: 0.3rem 0.35rem; margin-bottom: 0.8rem; }
  .ns-footer-links a { font-size: 0.78rem; padding: 0.3rem 0.7rem; }
  .ns-footer-copy { font-size: 0.68rem; }
}

/* On a wide screen the widget is a card in the corner and the page behind it
   stays live, so there is nothing to dim. */
@media (min-width: 761px) {
  .ns-scrim { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .ns-panel, .ns-scrim { transition: none; }
  .ns-footer-links a:hover, .ns-row:hover, .ns-cta-mail:hover { transform: none; }
}
