/* Catchall Help — tapps-software.com/catchall/help/
   The site's palette, type and header/footer are copied from /style.css rather than linked, so these
   pages keep working if the home page's stylesheet changes, and can be previewed straight from disk.
   Keep the :root values in step with /style.css if the site's colours change. */

:root {
  --ink: #2b2622;
  --paper: #fbf8f4;
  --paper-alt: #f2ece2;
  --accent: #0f4e82;
  --accent-dark: #0b0d29;
  --muted: #786f64;
  --line: #e5dccc;
  --max-width: 760px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Helvetica, Arial, sans-serif;
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
}

a { color: var(--accent-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* Header and footer, as on the home page. */

header.site {
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

header.site .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6em;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.1;
  color: var(--ink);
}

.brand:hover { text-decoration: none; }

.brand-icon {
  flex-shrink: 0;
  border-radius: 9px;
}

.accented { color: var(--accent); }

nav.site-nav a {
  margin-left: 24px;
  color: var(--muted);
  font-size: 0.95rem;
}

nav.site-nav a:first-child { margin-left: 0; }
nav.site-nav a:hover { color: var(--ink); }

footer.site {
  border-top: 1px solid var(--line);
  padding: 36px 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

footer.site a { margin: 0 10px; }

/* Layout. One column on a phone. From iPad width up, the topics sit in a sidebar beside a reading
   column capped at a comfortable line length; the header and footer widen to match. */

.layout {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

.sidebar { display: none; }

.doc { padding-top: 32px; padding-bottom: 48px; min-width: 0; }

article { max-width: 720px; }

@media (min-width: 900px) {
  :root { --max-width: 1120px; }

  .layout {
    display: grid;
    grid-template-columns: 240px minmax(0, 1fr);
    gap: 56px;
  }

  .sidebar {
    display: block;
    position: sticky;
    top: 0;
    align-self: start;
    max-height: 100vh;
    overflow-y: auto;
    padding: 32px 0 32px;
    font-size: 0.92rem;
  }

  .sidebar h2 {
    border: none;
    padding: 0;
    margin: 22px 0 6px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--muted);
  }

  .sidebar h2:first-child { margin-top: 0; }

  .sidebar ul { list-style: none; padding: 0; margin: 0; }
  .sidebar li { margin: 0; }

  .sidebar a {
    display: block;
    padding: 5px 10px;
    margin-left: -10px;
    border-radius: 8px;
    color: var(--ink);
    line-height: 1.35;
  }

  .sidebar a:hover { background: var(--paper-alt); text-decoration: none; }

  .sidebar a[aria-current="page"] {
    background: var(--paper-alt);
    color: var(--accent-dark);
    font-weight: 600;
  }

  /* The sidebar already offers the contents, so the header and breadcrumb needn't. */
  nav.site-nav a[href="index.html"] { display: none; }
  nav.site-nav a:nth-child(2) { margin-left: 0; }
  .crumb { display: none; }

  .doc { padding-top: 40px; }
  h1 { font-size: 2.3rem; }
}

/* On a large desktop, the contents page lays its sections out in two columns. */
@media (min-width: 1200px) {
  .home { max-width: none; column-count: 2; column-gap: 32px; }
  .home h1, .home > p:first-of-type { column-span: all; }
  /* Padding rather than margin, which a column break swallows — so both columns start level. */
  article.home h2 { break-after: avoid; margin-top: 0; padding-top: 28px; }
  .home ul { break-inside: avoid; }
}

/* The article. */

.crumb {
  margin: 0 0 8px;
  font-size: 0.9rem;
}

.crumb a { color: var(--muted); }
.crumb a::before { content: "\2039\00a0"; }

h1 {
  font-size: 2rem;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0 0 20px;
}

h2 {
  font-size: 1.35rem;
  letter-spacing: -0.01em;
  margin: 44px 0 10px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

h3 {
  font-size: 1.08rem;
  margin: 30px 0 6px;
}

/* Linked to from the app, so the heading shouldn't land hard against the top of Safari's window. */
h2[id], h3[id] { scroll-margin-top: 16px; }

/* Briefly marks the section a link from the app pointed at. */
h2:target, h3:target {
  color: var(--accent-dark);
}

p, li { margin: 0 0 12px; }

ul, ol { padding-left: 22px; margin: 0 0 16px; }

li > p { margin: 0; }

strong { font-weight: 600; }

code {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.9em;
  background: var(--paper-alt);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 1px 5px;
}

/* Tables scroll sideways on a narrow phone rather than squeezing their first column. */

.table-wrap {
  overflow-x: auto;
  margin: 8px 0 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th, td {
  text-align: left;
  vertical-align: top;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}

th {
  background: var(--paper-alt);
  font-weight: 600;
  white-space: nowrap;
}

tr:last-child td { border-bottom: none; }

td:first-child { min-width: 7.5em; }

/* The contents page: each section's links as a card. */

.home h2 {
  border-top: none;
  padding-top: 0;
  margin-top: 32px;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-dark);
}

.home ul {
  list-style: none;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}

.home li {
  margin: 0;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.95rem;
}

.home li:last-child { border-bottom: none; }

.home li a {
  font-weight: 600;
  font-size: 1rem;
}

/* Previous and next. */

.pager {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.pager a {
  display: block;
  max-width: 48%;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-weight: 600;
}

.pager a:hover { border-color: var(--accent); text-decoration: none; }

.pager a span {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.pager .next { text-align: right; margin-left: auto; }

@media (max-width: 560px) {
  h1 { font-size: 1.7rem; }
  nav.site-nav a { margin-left: 14px; font-size: 0.88rem; }
  .pager { flex-direction: column; }
  .pager a { max-width: none; }
  .pager .next { margin-left: 0; }
}
