/* Page styles for the hg design shell: body.hg.hg-guides
   Linked after homeguide.css when a view sets
     <% content_for :design, "hg" %>
     <% content_for :hg_page, "guides" %>

   Start EVERY selector with .hg-guides (for example: .hg-guides .hero { ... }).
   This file is also linked on un-migrated pages by stylesheet_link_tag :app,
   so an unscoped selector would restyle them; test/integration/hg_shell_test.rb
   fails if one slips in. Use the tokens from homeguide.css (var(--ink),
   var(--s-6), ...). No :root, no @import, no CSS nesting (Safari 15.4 floor).
   Prefix @keyframes names with hg-guides-.

   Used by guides/index, guides/show and guides/_cta. The article body is
   <article class="guide-article prose">: .prose (homeguide.css) sets the plain
   h2 / h3 / p / ul / ol / a styles, and this file adds what the articles use
   on top of that (lede, tables, key takeaways, callouts, the call to action). */

/* ---- Paper header: crumb, Fraunces H1, lead or meta ------------------------ */
.hg-guides .guide-head { padding-block: var(--s-5) var(--s-8); }
.hg-guides .guide-col { max-width: calc(43rem + 2 * var(--gutter)); }   /* the reading column: about 68 characters of body text */
.hg-guides .guide-breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--s-2); margin-bottom: var(--s-2); font-size: var(--text-small); color: var(--ink-3); }
.hg-guides .guide-breadcrumb a { display: inline-flex; align-items: center; min-height: 44px; color: var(--ink-2); font-weight: 500; text-decoration: none; }
.hg-guides .guide-breadcrumb a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.hg-guides .guide-breadcrumb [aria-current="page"]:not(.sr-only) { display: inline-flex; align-items: center; min-height: 44px; }
.hg-guides .guide-crumb-sep { color: var(--line-strong); }
.hg-guides .guide-head-intro { margin-top: var(--s-4); max-width: 62ch; }
.hg-guides .guide-main .guide-head { padding-bottom: var(--s-6); }
.hg-guides .guide-main .guide-head h1 { font-size: clamp(1.75rem, 1.3rem + 1.9vw, 2.5rem); }
.hg-guides .guide-meta { display: flex; align-items: center; gap: var(--s-2); margin-top: var(--s-4); padding-bottom: var(--s-6); border-bottom: 1px solid var(--line-strong); font-size: var(--text-small); color: var(--ink-3); }
.hg-guides .guide-meta .icon { width: 16px; height: 16px; }
@media (max-width: 719px) { .hg-guides .guide-head-intro { font-size: 1.0625rem; } }
@media (min-width: 900px) {
  .hg-guides .guide-head { padding-block: var(--s-10) var(--s-14); }
  .hg-guides .guide-main .guide-head { padding-block: var(--s-8) var(--s-8); }
  .hg-guides .guide-meta { padding-bottom: var(--s-8); }
}

/* ---- Guide cards (index grid, "More guides") ------------------------------- */
.hg-guides .guide-grid { display: grid; gap: var(--s-4); list-style: none; }
.hg-guides .guide-card { display: flex; flex-direction: column; height: 100%; padding: 22px 20px 12px; color: var(--ink); text-decoration: none; transition: border-color .15s, box-shadow .15s, transform .15s; }
.hg-guides .guide-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-2); transform: translateY(-1px); }
.hg-guides .guide-card-flag { align-self: flex-start; margin-bottom: var(--s-3); }
.hg-guides .guide-card h2, .hg-guides .guide-card h3 { font: 500 1.375rem/1.2 var(--font-display); letter-spacing: -.015em; text-wrap: balance; }
.hg-guides .guide-card p { margin-top: 10px; margin-bottom: var(--s-3); color: var(--ink-2); font-size: .9375rem; line-height: 1.55; text-wrap: pretty; }
.hg-guides .guide-card-meta { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); min-height: 44px; margin-top: auto; border-top: 1px solid var(--line); font-size: var(--text-small); color: var(--ink-3); }
.hg-guides .guide-card-time, .hg-guides .guide-card-go { display: inline-flex; align-items: center; gap: 6px; }
.hg-guides .guide-card-time .icon { width: 15px; height: 15px; }
.hg-guides .guide-card-go { color: var(--green-600); font-weight: 600; }
.hg-guides .guide-card-go .icon { width: 16px; height: 16px; stroke-width: 2; transition: transform .15s; }
.hg-guides .guide-card:hover .guide-card-go .icon { transform: translateX(3px); }
.hg-guides .guide-index-body { padding-bottom: var(--s-14); }
.hg-guides .guide-index-cta { margin-top: var(--s-10); }
@media (min-width: 720px) {
  .hg-guides .guide-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-5); }
  .hg-guides .guide-card { padding: 26px 24px 14px; }
}
@media (min-width: 1040px) {
  .hg-guides .guide-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s-6); }
  /* 8 guides in 3 columns: the first one takes two, so every row is full. */
  .hg-guides .guide-grid-lead { grid-column: span 2; }
  .hg-guides .guide-grid-lead .guide-card h2 { font-size: var(--text-display-3); max-width: 24ch; }
  .hg-guides .guide-grid-lead .guide-card p { font-size: 1.0625rem; max-width: 60ch; }
  .hg-guides .guide-index-body { padding-bottom: var(--s-24); }
  .hg-guides .guide-index-cta { margin-top: var(--s-14); }
}

/* ---- Article body (on top of .prose) --------------------------------------- */
.hg-guides .guide-article { max-width: none; }
.hg-guides .guide-article > p:first-child { font-size: var(--text-lead); line-height: 1.55; color: var(--ink); }
@media (max-width: 719px) { .hg-guides .guide-article > p:first-child { font-size: 1.125rem; } }
.hg-guides .guide-article h2 { margin-top: 2.2em; font-size: clamp(1.5rem, 1.35rem + .6vw, 1.75rem); }
.hg-guides .guide-article h3 { font-size: 1.1875rem; }
.hg-guides .guide-article h4 { margin-top: 1.4em; font: 600 1.0625rem/1.3 var(--font-sans); color: var(--ink); }
.hg-guides .guide-article li > ul, .hg-guides .guide-article li > ol { margin-top: .4em; }
.hg-guides .guide-article blockquote { padding: 2px 0 2px 16px; border-left: 3px solid var(--gold-500); color: var(--ink-2); }
.hg-guides .guide-article hr { margin-block: 2em; border: 0; border-top: 1px solid var(--line-strong); }

/* Tables: a surface card. On phones the columns are narrow enough for three or
   four to fit a 390px screen; a table that still cannot fit scrolls sideways
   inside its own box instead of pushing the page wider. */
.hg-guides .guide-article table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; margin-block: 1.5em; border: 1px solid var(--line); border-radius: var(--r-md); border-collapse: separate; border-spacing: 0; background: var(--surface); font-size: var(--text-small); line-height: 1.45; }
.hg-guides .guide-article th, .hg-guides .guide-article td { min-width: 5rem; padding: 12px 8px; text-align: left; vertical-align: top; }
.hg-guides .guide-article th:first-child, .hg-guides .guide-article td:first-child { padding-left: 14px; }
.hg-guides .guide-article th:last-child, .hg-guides .guide-article td:last-child { padding-right: 14px; }
.hg-guides .guide-article th { background: var(--paper-deep); color: var(--ink); font-weight: 600; font-size: var(--text-small); line-height: 1.35; }
.hg-guides .guide-article td { border-top: 1px solid var(--line); color: var(--ink-2); }
.hg-guides .guide-article td:first-child { color: var(--ink); font-weight: 500; }
.hg-guides .guide-article thead th:first-child { border-top-left-radius: 11px; }
.hg-guides .guide-article thead th:last-child { border-top-right-radius: 11px; }
@media (min-width: 720px) {
  .hg-guides .guide-article table { display: table; width: 100%; font-size: .9375rem; }
  .hg-guides .guide-article th, .hg-guides .guide-article td,
  .hg-guides .guide-article th:first-child, .hg-guides .guide-article td:first-child,
  .hg-guides .guide-article th:last-child, .hg-guides .guide-article td:last-child { min-width: 0; padding: 14px 16px; }
}

/* Key takeaways: a green-tinted panel with a tick list. */
.hg-guides .guide-keytakeaways { margin-block: 1.75em; padding: 18px 18px 20px; border: 1px solid var(--green-200); border-radius: var(--r-lg); background: var(--green-50); }
.hg-guides .guide-article .guide-keytakeaways h2, .hg-guides .guide-article .guide-keytakeaways h3 { display: flex; align-items: center; gap: 10px; margin: 0 0 var(--s-3); font: 600 var(--text-small)/1.4 var(--font-sans); letter-spacing: .01em; color: var(--gold-700); }
.hg-guides .guide-keytakeaways h2::before, .hg-guides .guide-keytakeaways h3::before { content: ""; width: 22px; height: 2px; border-radius: 2px; background: var(--gold-500); }
.hg-guides .guide-article .guide-keytakeaways ul { margin: 0; padding: 0; list-style: none; }
.hg-guides .guide-keytakeaways li { position: relative; padding-left: 28px; font-size: 1rem; line-height: 1.5; color: var(--ink); }
.hg-guides .guide-keytakeaways li + li { margin-top: 10px; }
.hg-guides .guide-keytakeaways li::before { content: ""; position: absolute; left: 0; top: 3px; width: 18px; height: 18px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232C6146' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat; }
@media (min-width: 720px) { .hg-guides .guide-keytakeaways { padding: 24px 28px 26px; } }

/* Callout: a gold marker, the same shape as the inspector pull quote. */
.hg-guides .guide-callout { margin-block: 1.5em; padding: 14px 16px; border-left: 3px solid var(--gold-500); border-radius: 0 10px 10px 0; background: var(--gold-50); font-size: 1rem; line-height: 1.55; color: var(--ink-2); }
.hg-guides .guide-callout > * + * { margin-top: .75em; }

/* ---- Call to action (guides/_cta) ------------------------------------------- */
.hg-guides .guide-cta { display: grid; gap: var(--s-5); margin-block: 2.25em; padding: 22px 20px; }
.hg-guides .guide-cta-eyebrow { display: flex; align-items: center; gap: 10px; font: 600 var(--text-small)/1.4 var(--font-sans); letter-spacing: .01em; color: var(--gold-700); }
.hg-guides .guide-cta-eyebrow::before { content: ""; width: 22px; height: 2px; border-radius: 2px; background: var(--gold-500); }
.hg-guides .guide-cta-title { margin-top: 10px; font: 500 1.375rem/1.2 var(--font-display); letter-spacing: -.015em; color: var(--ink); text-wrap: balance; }
.hg-guides .guide-cta-text { margin-top: var(--s-2); font-size: 1rem; line-height: 1.5; color: var(--ink-2); text-wrap: pretty; }
.hg-guides .guide-cta-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px var(--s-5); }
/* .prose styles every link green and underlined; the buttons keep their own look. */
.hg-guides .guide-cta .btn { text-decoration: none; font-weight: 600; }
.hg-guides .guide-cta .btn-primary { color: var(--surface); }
.hg-guides .guide-cta .btn-secondary { color: var(--ink); }
.hg-guides .guide-cta .btn-on-dark { color: var(--green-800); }
.hg-guides .guide-cta .link { display: inline-flex; align-items: center; min-height: 44px; }
@media (max-width: 559px) {
  .hg-guides .guide-cta-actions .btn { width: 100%; }
  .hg-guides .guide-cta-actions .link { margin-inline: auto; }
}
@media (min-width: 720px) { .hg-guides .guide-cta { padding: 28px 28px 26px; } }

/* The dark panel that closes a guide and the index. */
.hg-guides .guide-cta-closing { margin-block: 0; padding: 28px 20px; border-radius: var(--r-xl); background: radial-gradient(120% 150% at 100% 0%, var(--green-700) 0%, var(--green-800) 58%); }
.hg-guides .guide-cta-closing .guide-cta-eyebrow { color: var(--gold-400); }
.hg-guides .guide-cta-closing .guide-cta-eyebrow::before { background: var(--gold-400); }
.hg-guides .guide-cta-closing .guide-cta-title { font-size: var(--text-display-3); color: var(--surface); max-width: 22ch; }
.hg-guides .guide-cta-closing .guide-cta-text { color: var(--on-dark-2); max-width: 52ch; }
.hg-guides .guide-end-cta { margin-top: var(--s-14); }
@media (min-width: 720px) { .hg-guides .guide-cta-closing { padding: 40px; } }
@media (min-width: 900px) {
  .hg-guides .guide-index-cta .guide-cta-closing { grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: var(--s-14); padding: 56px 64px; }
  .hg-guides .guide-index-cta .guide-cta-actions { flex-direction: column; align-items: stretch; text-align: center; }
  .hg-guides .guide-index-cta .guide-cta-actions .link { justify-content: center; }
  .hg-guides .guide-index-cta .guide-cta-text { font-size: 1.0625rem; }
}

/* ---- "More guides" band ----------------------------------------------------- */
.hg-guides .guide-more { margin-top: var(--s-14); padding-block: var(--s-14); }
.hg-guides .guide-more-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--s-1) var(--s-6); margin-bottom: var(--s-5); }
.hg-guides .guide-more-all .link { display: inline-flex; align-items: center; min-height: 44px; }
@media (min-width: 900px) {
  .hg-guides .guide-more { margin-top: var(--s-18); padding-block: var(--s-18); }
  .hg-guides .guide-more-head { margin-bottom: var(--s-8); }
}
/* Three "more" cards: one column until there is room for all three in a row. */
@media (min-width: 720px) and (max-width: 899px) { .hg-guides .guide-grid-more { grid-template-columns: minmax(0, 1fr); } }
@media (min-width: 900px) { .hg-guides .guide-grid-more { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
