/* ==========================================================================
   pSEO examples directory (/programmatic-seo/examples and the pages under it).
   Loaded only on those pages, after styles.css. Colours and fonts come from
   the :root tokens in styles.css.
   Phone layouts are still to be designed: below 900px things just stack.
   ========================================================================== */

.dir { max-width: 1240px; margin: 0 auto; padding: 0 24px; box-sizing: border-box; font-size: 15px; line-height: 1.5; }
.dir a { color: var(--accent); text-decoration: none; }
.dir a:hover { color: #C9CEFF; }
.vh { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* "pSEO examples" in the site header, on every directory page */
.nav-link[aria-current="true"] { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: 6px; }


/* ---------- Search boxes ---------- */

.sbox {
  display: flex; align-items: center; gap: 12px;
  background: var(--pane); border: 1px solid rgba(236, 238, 250, 0.18); border-radius: 999px;
  height: 60px; padding: 0 8px 0 22px; box-sizing: border-box;
}
.sbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(159, 168, 255, 0.16); }
.sbox svg { flex: 0 0 auto; }
.sbox input {
  flex: 1; min-width: 0; height: 100%; background: transparent; border: 0; outline: 0;
  color: var(--text); font: inherit; font-size: 16px;
}
.sbox input::placeholder { color: #A9AED0; opacity: 1; }
.sbox input::-webkit-search-cancel-button { filter: invert(0.8); }
.sbox-btn {
  height: 44px; border: 0; border-radius: 999px; background: var(--accent); color: var(--bg);
  font: inherit; font-weight: 800; font-size: 15px; padding: 0 22px; cursor: pointer;
}
.sbox--small { height: 48px; border-radius: 12px; padding: 0 16px; gap: 10px; border-color: var(--line); }
.sbox--small input { font-size: 15px; }


/* ---------- Home ---------- */

.dir-hero { max-width: 1040px; margin: 0 auto; padding: 64px 0 0; text-align: center; }
.dir-hero h1 { font-size: clamp(40px, 5vw, 60px); line-height: 1; letter-spacing: -0.035em; text-wrap: balance; }
.dir-hero p { margin: 16px auto 0; color: var(--muted); font-size: 18px; max-width: 780px; text-wrap: balance; }
.dir-hero .sbox { margin: 32px auto 0; max-width: 680px; text-align: left; }

.browse { padding: 64px 0 0; }
.browse-head { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-bottom: 20px; }
.browse-head h2 { font-size: 26px; }
.browse .tiles--top { margin-top: -16px; } /* no heading above (v1): tiles start 48px under the search box */

.xtabs { display: flex; gap: 4px; flex-wrap: wrap; padding: 4px; background: var(--pane); border: 1px solid rgba(236, 238, 250, 0.1); border-radius: 999px; }
.xtab {
  border: 0; border-radius: 999px; padding: 9px 16px; background: transparent; color: var(--muted);
  font: inherit; font-size: 14px; white-space: nowrap; cursor: pointer;
}
.xtab span { opacity: 0.6; }
.xtab[aria-selected="true"] { background: var(--accent); color: var(--bg); font-weight: 700; }

.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.tile {
  display: flex; flex-direction: column; background: var(--card); border: 1px solid rgba(236, 238, 250, 0.12);
  border-top: 3px solid var(--accent); border-radius: 16px; padding: 14px 16px 16px; color: var(--text);
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.dir a.tile { color: var(--text); }
.tile:hover { transform: translateY(-3px); border-color: rgba(159, 168, 255, 0.5); border-top-color: var(--accent); }
.tile-thumbs { display: flex; gap: 8px; }
.tile-thumb { flex: 1 1 0; min-width: 0; border-radius: 8px; background: var(--shot); padding: 7px 7px 0; }
.tile-thumb img { width: 100%; height: auto; aspect-ratio: 8 / 5; object-fit: cover; object-position: top; border-radius: 4px 4px 0 0; background: #E9EBF5; }
.tile-thumb--empty { aspect-ratio: 8 / 5; }
.tile-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-top: 16px; }
.tile-text { min-width: 0; }
.tile-name { display: block; font-family: var(--font-display); font-weight: 700; font-size: 19px; line-height: 1.2; letter-spacing: -0.02em; }
.tile-ex { display: block; font-size: 13px; color: var(--faint); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* 4px and the logo row's 14px: Ryan's spacing tweak, 4 Nov */
.tile-ex q, .tile-ex b { color: var(--muted); font-weight: 400; }
/* Page type tiles: one line of examples. A second example that doesn't fit wraps onto a
   hidden second line (so it disappears whole); a first example that doesn't fit gets "…". */
.tile-eg { display: flex; flex-wrap: wrap; height: 1.5em; white-space: normal; }
.tile-eg1 { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile-eg2 { flex: 0 0 auto; white-space: nowrap; }
/* The word that changes from page to page ("{Ohio} paycheck calculator"), styled like the
   {slot} in card titles. Tiles show a real value in braces (a specific example); cards show the
   placeholder name (they describe a whole program). On hover it cycles through other values (directory.js). */
.tile-slot {
  display: inline-block; position: relative; vertical-align: baseline; line-height: 1.2; text-align: center;
  color: var(--accent); background: rgba(159, 168, 255, 0.14); border: 1px dashed rgba(159, 168, 255, 0.55);
  border-radius: 4px; padding: 0 3px; font-weight: 600;
  clip-path: inset(0 round 4px); /* a window: the rolling word is only visible inside the pill */
}
.tile-word { display: inline-block; }
/* The braces are decoration: '/ ""' keeps screen readers from reading them out (the first line is for older browsers) */
.tile-word::before { content: "{"; content: "{" / ""; }
.tile-word::after { content: "}"; content: "}" / ""; }
/* The roll: the current word slides up and out while the next one slides in from below */
.tile-word--next { position: absolute; left: 0; right: 0; top: 0; transform: translateY(110%); }
.tile-slot.is-rolling .tile-word { transition: transform 0.32s cubic-bezier(0.2, 0.7, 0.2, 1); transform: translateY(-110%); }
.tile-slot.is-rolling .tile-word--next { transform: translateY(0); }
.tile-cos { display: flex; align-items: center; gap: 8px; margin-top: 14px; }
.logo-stack { display: flex; padding-left: 6px; flex: 0 0 auto; }
.logo-stack img { width: 22px; height: 22px; border-radius: 50%; background: #fff; margin-left: -6px; box-shadow: 0 0 0 2px var(--card); object-fit: contain; }
.tile-names { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tile-more { font-size: 13px; color: var(--faint); white-space: nowrap; flex: 0 0 auto; margin-left: -4px; }
.tile-arrow { flex: 0 0 auto; }

.miss-tile {
  background: var(--pane); border: 1px dashed rgba(236, 238, 250, 0.2); border-radius: 16px; padding: 20px 22px;
  display: flex; flex-direction: column; justify-content: center; gap: 6px;
}
.miss-tile strong { font-size: 16px; }
.miss-tile p { font-size: 14px; color: var(--muted); line-height: 1.45; }
.miss-tile a { font-weight: 700; font-size: 14px; margin-top: 4px; }

/* The lead card at the end of the home grids fills the rest of the last row.
   --s4 / --s3 / --s2: how many columns that is with 4, 3 or 2 columns (set in the HTML). */
.tiles .lead-card { grid-column: span var(--s3, 1); align-content: center; } /* home: centred in the row's height (galleries keep text top, buttons bottom) */
.tiles .lead-card .lead-text p:last-child { max-width: 620px; }

@media (max-width: 1179px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tiles .lead-card { grid-column: span var(--s3, 1); }
}
@media (max-width: 859px) {
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tiles .lead-card { grid-column: span var(--s2, 1); }
}
@media (max-width: 559px) {
  .tiles { grid-template-columns: minmax(0, 1fr); }
  .tiles .lead-card { grid-column: auto; }
}


/* ---------- Lead card ("I build pSEO programs like these") ---------- */

/* Text and buttons sit side by side when the card is wide, and stack when it's one column wide */
.lead-card {
  background: var(--accent); color: var(--bg); border-radius: 16px; padding: 24px 20px;
  display: flex; flex-wrap: wrap; align-items: center; align-content: space-between; gap: 16px 32px;
}
.lead-text { flex: 1 1 300px; display: flex; flex-direction: column; gap: 12px; }
.lead-title { font-family: var(--font-display); font-weight: 700; font-size: 25px; line-height: 1.08; letter-spacing: -0.03em; }
.lead-card p { font-size: 14px; line-height: 1.45; color: var(--accent-ink); }
.lead-card .lead-title { color: var(--bg); font-size: 25px; }
.dir .lead-card p a { color: var(--bg); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.lead-actions { flex: 1 0 210px; max-width: 280px; display: flex; flex-direction: column; gap: 8px; }
.dir .lead-actions a { display: block; text-align: center; border-radius: 999px; font-size: 14px; line-height: 1.4; white-space: nowrap; }
.dir .lead-actions .lead-dm { background: var(--bg); color: var(--text); font-weight: 800; padding: 9px 18px; }
.dir .lead-actions .lead-wps { border: 1.5px solid var(--bg); color: var(--bg); font-weight: 700; padding: 8px 14px; font-size: 13px; }
.dir .lead-actions a:hover { opacity: 0.88; }


/* ---------- Gallery pages (page types and categories) ---------- */

.g-head { padding: 36px 0 0; }
.crumbs { font-size: 13px; color: var(--faint); display: flex; gap: 8px; flex-wrap: wrap; }
/* Links quiet, the page you're on brightest */
.dir .crumbs a { color: var(--faint); transition: color 0.12s ease; }
.dir .crumbs a:hover { color: var(--accent); }
.crumbs [aria-current] { color: var(--text); font-weight: 600; }
.g-title-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; margin-top: 10px; }
.g-title-row > div:first-child { max-width: 760px; }
.g-head h1 { font-size: clamp(34px, 4vw, 48px); line-height: 1.02; letter-spacing: -0.035em; }
.g-head .g-intro { margin-top: 12px; color: var(--muted); font-size: 17px; }
.g-stats { display: flex; gap: 32px; }
.g-stat-n { font-family: var(--font-display); font-weight: 700; font-size: 30px; line-height: 1; }
.g-stat-l { font-size: 13px; color: var(--faint); margin-top: 4px; }

.g-tools { display: flex; gap: 12px; margin-top: 28px; flex-wrap: wrap; align-items: center; }
.g-tools .sbox { flex: 1 1 420px; }

/* Sideways-scrolling chips (page types or categories) */
.chips { position: relative; margin-top: 18px; }
.chips-row { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 0 0 2px; scroll-behavior: smooth; }
.chips-row::-webkit-scrollbar { display: none; }
.dir .chip {
  flex: 0 0 auto; padding: 8px 14px; border-radius: 10px; background: var(--pane); border: 1px solid var(--line);
  color: var(--muted); font-size: 14px; white-space: nowrap;
}
.dir .chip:hover { color: var(--text); border-color: rgba(159, 168, 255, 0.5); }
.dir .chip[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--bg); font-weight: 700; }
.chips-fade { position: absolute; top: 0; bottom: 0; width: 120px; pointer-events: none; }
.chips-fade--r { right: 0; background: linear-gradient(90deg, rgba(13, 15, 28, 0), var(--bg) 55%); }
.chips-fade--l { left: 0; background: linear-gradient(270deg, rgba(13, 15, 28, 0), var(--bg) 55%); }
.chips-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%;
  border: 1px solid rgba(236, 238, 250, 0.22); background: var(--card); display: grid; place-items: center; cursor: pointer; padding: 0;
}
.chips-arrow--r { right: 0; }
.chips-arrow--l { left: 0; }
.chips-arrow:hover { border-color: var(--accent); }
.chips:not(.can-r) .chips-arrow--r, .chips:not(.can-r) .chips-fade--r,
.chips:not(.can-l) .chips-arrow--l, .chips:not(.can-l) .chips-fade--l { display: none; }

.g-main { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; align-items: start; padding: 28px 0 0; }

/* Filter panel: stays in view while the grid scrolls */
.filter {
  position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--pane); border: 1px solid rgba(236, 238, 250, 0.1); border-radius: 16px; padding: 20px; box-sizing: border-box;
  scrollbar-width: thin; scrollbar-color: rgba(236, 238, 250, 0.2) transparent;
}
.filter-head { display: flex; justify-content: space-between; align-items: center; }
.filter-head h2 { font-size: 16px; letter-spacing: -0.01em; }
.filter-clear { background: transparent; border: 0; color: var(--accent); font: inherit; font-size: 13px; cursor: pointer; padding: 0; }
.filter-group { border-top: 1px solid rgba(236, 238, 250, 0.1); margin-top: 16px; padding-top: 14px; }
.filter-group-title { font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.filter-opts { display: flex; flex-direction: column; }
.dir .fopt { display: flex; align-items: center; gap: 10px; padding: 6px 0; color: var(--text); font-size: 14px; line-height: 1.35; }
.dir .fopt:hover { color: #fff; }
.dir .fopt.is-zero { color: var(--faint); }
.fopt-box { width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid rgba(236, 238, 250, 0.35); box-sizing: border-box; flex: 0 0 auto; display: grid; place-items: center; }
.fopt[aria-current="true"] .fopt-box { background: var(--accent); border-color: var(--accent); }
.fopt[aria-current="true"] .fopt-box::after { content: ""; width: 8px; height: 4px; border: solid var(--bg); border-width: 0 0 2.5px 2.5px; transform: translate(0, -1px) rotate(-45deg); }
.fopt-label { flex: 1; }
.fopt-n { color: var(--faint); font-size: 12px; }
.fopt.is-extra:not([aria-current="true"]) { display: none; }
.filter-group.show-all .fopt.is-extra { display: flex; }
.filter-more { background: transparent; border: 0; padding: 6px 0; color: var(--accent); font: inherit; font-size: 13px; cursor: pointer; text-align: left; }

.g-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; min-height: 30px; }
.g-count { font-size: 14px; color: var(--muted); }
.g-count strong { color: var(--text); }
.pill {
  display: inline-flex; align-items: center; gap: 6px; background: rgba(159, 168, 255, 0.14); border: 1px solid rgba(159, 168, 255, 0.35);
  color: var(--text); border-radius: 999px; padding: 5px 10px 5px 12px; font: inherit; font-size: 13px; cursor: pointer;
}
.pill:hover { border-color: var(--accent); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; transition: opacity 0.12s ease; }
.grid.is-loading { opacity: 0.55; }
.g-empty { grid-column: 1 / -1; background: var(--pane); border: 1px dashed rgba(236, 238, 250, 0.2); border-radius: 16px; padding: 28px; text-align: center; color: var(--muted); }
.g-empty strong { display: block; color: var(--text); font-size: 16px; margin-bottom: 4px; }
.g-empty button { margin-top: 12px; }

.more { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 32px; }
.more-status { font-size: 13px; color: var(--faint); }
.more-btn {
  background: var(--pane); border: 1px solid rgba(236, 238, 250, 0.18); color: var(--text); border-radius: 999px;
  padding: 12px 22px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.more-btn:hover { border-color: var(--accent); }

.dir-end { height: 72px; }


/* ---------- Example card ("B2 refined" on the design canvas) ---------- */

.xcard {
  display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; overflow: hidden; color: var(--text); transition: border-color 0.18s ease;
}
.xcard:hover { border-color: rgba(159, 168, 255, 0.5); }

/* Speed: the browser skips laying out cards until they're near the screen. They stay in the
   HTML, so search engines, Ctrl+F and screen readers still see them. Until a card has been
   shown, its height is estimated (the second number), then the real height is remembered. */
.xcard { content-visibility: auto; contain-intrinsic-size: auto 289px auto 445px; } /* a card's real size on desktop, minus its 1px border */

/* Company row */
.xcard-head { display: flex; align-items: center; gap: 8px; padding: 10px 14px 9px; font-size: 14px; color: var(--muted); min-width: 0; }
.xcard-logo { width: 20px; height: 20px; border-radius: 5px; background: #fff; flex: 0 0 auto; object-fit: contain; }
.xcard-logo--ini { display: grid; place-items: center; background: var(--tint); color: #fff; font-size: 11px; font-weight: 800; }
.xcard-coname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.xcard-tag { margin-left: auto; flex: 0 0 auto; background: rgba(159, 168, 255, 0.14); color: var(--accent); border-radius: 999px; padding: 2px 9px; font-size: 12px; font-weight: 600; white-space: nowrap; }

/* Screenshot of the first example */
.xcard-shot { display: block; background: var(--shot); padding: 11px 14px 0; }
.xcard-shot img, .xcard-noshot {
  display: block; width: 100%; height: auto; aspect-ratio: 8 / 5; object-fit: cover; object-position: top;
  border-radius: 6px 6px 0 0; background: #E9EBF5;
}
.xcard-noshot {
  display: grid; place-items: center; background: color-mix(in srgb, var(--tint) 30%, var(--card));
  font-family: var(--font-display); font-weight: 700; font-size: 44px; color: rgba(255, 255, 255, 0.85);
}

.xcard-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }

/* Title: up to 2 lines, with room for 2 lines on every card so rows line up */
.xcard-title {
  font-family: var(--font-body); font-weight: 700; font-size: 17px; line-height: 1.35; letter-spacing: 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: calc(2 * 1.35em);
}
.dir .xcard-title a { color: var(--text); }
.dir .xcard-title a:hover { color: #C9CEFF; }
/* The {slot} never splits across lines: if it doesn't fit, the whole thing moves to the next line */
.xcard-title .slot {
  color: var(--accent); background: rgba(159, 168, 255, 0.14); border: 1px dashed rgba(159, 168, 255, 0.55);
  border-radius: 6px; padding: 0 5px; white-space: nowrap;
}

/* "77 industries, for example:" */
.xcard-count { font-size: 15px; line-height: 1.2; color: var(--muted); }
.xcard-count strong { font-family: var(--font-display); font-weight: 700; font-size: 28px; line-height: 1; color: var(--text); letter-spacing: -0.02em; margin-right: 4px; }

/* Example pages: one line each, cut off with "..." when long; room for 3 rows on every card */
.xcard-ex { list-style: none; margin: -2px 0 0; padding: 0; border-top: 1px solid rgba(236, 238, 250, 0.1); min-height: calc(3 * 36px); }
.dir .xcard-ex a {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 7px 0;
  border-bottom: 1px solid rgba(236, 238, 250, 0.1); color: var(--text); font-size: 14px; line-height: 21px;
}
.xcard-exname { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xcard-arr { flex: 0 0 auto; color: var(--faint); }
.dir .xcard-ex a:hover, .dir .xcard-ex a:hover .xcard-arr { color: var(--accent); }
.xcard a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }


/* ---------- Narrow screens (first phone pass, 4 Nov) ---------- */

/* The filter's fold-away button: phones and tablets only */
.filter-toggle { display: none; }

@media (max-width: 899px) {
  .g-main { grid-template-columns: minmax(0, 1fr); gap: 16px; padding-top: 20px; }
  .g-stats { gap: 24px; }
  /* The filter folds into one button above the results and opens in place,
     so the first cards show without scrolling past the whole list */
  .filter { position: static; max-height: none; overflow: visible; padding: 0; }
  .filter-toggle {
    display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 0 16px; box-sizing: border-box;
    background: transparent; border: 0; border-radius: 16px; color: var(--text); font: inherit; font-size: 15px; font-weight: 600;
    text-align: left; cursor: pointer;
  }
  .filter-toggle-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .filter-toggle-chev { flex: 0 0 auto; transition: transform 0.15s ease; }
  .filter.is-open .filter-toggle-chev { transform: rotate(180deg); }
  .filter-body { display: none; padding: 0 16px 8px; }
  .filter.is-open .filter-body { display: block; }
  .filter-head { display: none; } /* the button says "Filter"; the pill above the cards removes a filter */
  .filter-group { margin-top: 0; }
  .dir .fopt { padding: 11px 0; } /* about 42px tall, easier to tap */
  .filter-more { padding: 12px 0; }
}

@media (max-width: 559px) {
  .dir-hero p { font-size: 16px; }
  .g-head .g-intro { font-size: 15px; }
}

/* The smallest phones (320px): slightly smaller card text, so every title fits in 2 lines
   and every count line in 1 (checked on all cards, 4 Nov) */
@media (max-width: 359px) {
  .xcard-title { font-size: 15.5px; }
  .xcard-count { font-size: 13.5px; }
  .xcard-count strong { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .tile, .xcard, .filter-toggle-chev { transition: none; }
  .tile:hover { transform: none; }
  .chips-row { scroll-behavior: auto; }
}
