/* ===========================================================
   Guides: the /guides hub and each guide (src/components/guide.tsx)
   Loaded only on those pages, on top of the inlined site stylesheet, through Layout's
   `stylesheets` prop. Uses the site's tokens throughout, so it follows light and dark mode
   with no rules of its own for either.
   =========================================================== */

.guide {
  /* About 75 characters a line at the body size below. */
  --guide-measure: 40rem;
  --guide-rail: 15rem;
  --guide-gap: 4rem;
}

.guide-head .wrap,
.guide-body {
  max-width: calc(var(--guide-measure) + 3rem);
}

/* Wide screens: the article keeps its reading width and the contents sit beside it in a
   sticky column, so the page fills the screen without lines getting longer. */
@media (min-width: 1100px) {
  .guide-head .wrap,
  .guide-body {
    max-width: calc(var(--guide-measure) + var(--guide-gap) + var(--guide-rail) + 3rem);
  }

  .guide-head .wrap > * {
    max-width: var(--guide-measure);
  }

  .guide-body {
    display: grid;
    grid-template-columns: minmax(0, var(--guide-measure)) var(--guide-rail);
    column-gap: var(--guide-gap);
    align-items: start;
  }

  .guide-body > * {
    grid-column: 1;
  }

  .guide-body > .guide-toc {
    grid-column: 2;
    grid-row: 1 / span 40;
    position: sticky;
    top: 6rem;
    margin-bottom: 0;
  }
}

.guide-head {
  padding: clamp(2rem, 5vw, 3.5rem) 0 0;
}

.guide-head h1 {
  font-size: clamp(2rem, 4.2vw, 3rem);
  margin-bottom: 1.25rem;
}

/* The direct answer to the title: the first thing read, and the line search results quote. */
.guide-answer {
  font-size: 1.2rem;
  line-height: 1.55;
  color: var(--text);
}

.guide-head p:not(.guide-answer) {
  font-size: 1.0625rem;
  line-height: 1.7;
}

/* ---------- Byline ---------- */

.guide-byline {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.guide-byline img {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 25%;
  background: var(--surface-sunken);
}

.guide-byline p {
  margin: 0;
}

.guide-byline-name {
  font-size: 0.9rem;
  color: var(--text);
}

.guide-byline-name a {
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
}

.guide-byline-name a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.guide-byline .page-updated {
  margin-top: 0.1rem;
}

/* ---------- Body ---------- */

.guide-body {
  padding-top: clamp(2rem, 4vw, 2.75rem);
  padding-bottom: clamp(3rem, 6vw, 5rem);
  font-size: 1.0625rem;
  line-height: 1.7;
}

/* The site gives every <section> a landing page's padding; a guide's sections are plain text. */
.guide-body section {
  padding: 0;
}

.guide-body section + section {
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
}

.guide-body h2 {
  font-size: clamp(1.5rem, 2.6vw, 1.95rem);
  margin-bottom: 1rem;
}

.guide-body h3 {
  font-size: 1.15rem;
  margin: 2rem 0 0.6rem;
}

.guide-body p {
  font-size: inherit;
}

.guide-body ul,
.guide-body ol:not(.guide-steps) {
  margin: 0 0 1.25rem;
  padding-left: 1.4rem;
  color: var(--text-muted);
}

.guide-body li + li {
  margin-top: 0.4rem;
}

.guide-body li::marker {
  color: var(--text-faint);
}

.guide-body strong {
  color: var(--text);
  font-weight: 650;
}

/* ---------- Contents ---------- */

.guide-toc {
  margin-bottom: clamp(2.5rem, 5vw, 3.5rem);
  padding: 1.1rem 1.35rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-alt);
}

.guide-toc h2 {
  font-family: var(--font-sans);
  font-size: 0.95rem;
  font-weight: 650;
  letter-spacing: 0;
  margin: 0 0 0.6rem;
}

.guide-body .guide-toc ol {
  margin: 0;
  padding-left: 1.25rem;
  font-size: 0.95rem;
}

.guide-toc li + li {
  margin-top: 0.3rem;
}

.guide-toc a {
  text-decoration: none;
}

.guide-toc a:hover {
  text-decoration: underline;
}

/* ---------- Figures ---------- */

.guide-figure {
  margin: 2rem 0;
}

.guide-figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-sunken);
}

.guide-figure figcaption {
  margin-top: 0.65rem;
  font-size: 0.875rem;
  line-height: 1.5;
  color: var(--text-faint);
}

/* ---------- Tables ---------- */

.guide-table {
  margin: 1.75rem 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.guide-table table {
  width: 100%;
  min-width: 480px;
  border-collapse: collapse;
  font-size: 0.92rem;
  line-height: 1.5;
}

.guide-table th,
.guide-table td {
  text-align: left;
  vertical-align: top;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
}

.guide-table thead th {
  background: var(--bg-alt);
  color: var(--text);
  font-weight: 650;
  border-bottom-color: var(--border-strong);
}

.guide-table tbody tr:last-child > * {
  border-bottom: 0;
}

/* ---------- Steps ---------- */

.guide-steps {
  list-style: none;
  counter-reset: guide-step;
  margin: 1.75rem 0;
  padding: 0;
}

.guide-steps > li {
  counter-increment: guide-step;
  position: relative;
  padding-left: 3rem;
}

.guide-steps > li + li {
  margin-top: 1.5rem;
}

.guide-steps > li::before {
  content: counter(guide-step);
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1;
}

.guide-body .guide-steps h3 {
  margin: 0.2rem 0 0.35rem;
}

.guide-steps > li > div > :last-child {
  margin-bottom: 0;
}

/* ---------- Callouts ---------- */

.guide-callout {
  margin: 1.75rem 0;
  padding: 1rem 1.25rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  background: var(--bg-alt);
  font-size: 0.97rem;
}

.guide-callout-title {
  margin-bottom: 0.35rem;
  color: var(--text);
  font-weight: 650;
}

.guide-callout > :last-child {
  margin-bottom: 0;
}

/* ---------- Questions ---------- */

.guide-body .faq-list {
  max-width: none;
}

.guide-body .faq-item p {
  font-size: 0.97rem;
}

/* ---------- The hub ---------- */

.guides-hub-head {
  padding: clamp(2rem, 5vw, 3.5rem) 0 0;
}

.guides-hub-head .guide-answer {
  max-width: 38rem;
}

.guides-hub-list {
  padding-top: clamp(2rem, 4vw, 3rem);
}

.guides-hub-list .tile-card h2 {
  font-family: var(--font-sans);
  font-size: 1.15rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  margin: 0 0 0.5rem;
}

.guides-hub-list .tile-card h2 a {
  color: var(--text);
  text-decoration: none;
}

/* The whole card is the link target; the heading's link stretches over it. */
.guides-hub-list .tile-card {
  position: relative;
}

.guides-hub-list .tile-card h2 a::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
}

.guides-hub-list .tile-card:hover h2 a {
  color: var(--primary);
}

/* ---------- Phones ---------- */

@media (max-width: 640px) {
  .guide-answer {
    font-size: 1.1rem;
  }

  .guide-body {
    font-size: 1rem;
  }

  .guide-steps > li {
    padding-left: 2.6rem;
  }

  .guide-steps > li::before {
    width: 1.75rem;
    height: 1.75rem;
    font-size: 0.82rem;
  }
}
