/* ==========================================================================
   UI REFINEMENTS — loaded last, so it wins.
   --------------------------------------------------------------------------
   Fixes from the 10 Sep design review:
     1. Header was ~140px tall with a 720px logo.
     2. Hero was a tall, pale, empty column of centred text with no imagery.
     3. Card grids were misaligned — ragged rows, clipped tiles, and every
        headline printed twice.
   ========================================================================== */

/* ==========================================================================
   1. HEADER — compact
   ========================================================================== */
.nav__bar { padding-top: 10px; padding-bottom: 10px; gap: var(--s-4); }

/* WordPress prints its own markup for the site logo, so it needs sizing by
   its own class, not ours. Without this it renders at its natural 720px. */
.custom-logo-link { display: inline-flex; align-items: center; line-height: 0; }
.custom-logo,
.logo__img {
  height: 30px !important;
  width: auto !important;
  max-width: min(46vw, 300px);
  display: block;
}
.logo--footer .logo__img { height: 26px !important; }

.nav__search { padding: 7px 12px; font-size: var(--t-xs); }
.nav__search span:first-of-type { max-width: 15ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav .btn--aurora { padding: 8px 16px; font-size: var(--t-xs); }

/* Pill rail: lighter, tighter, and it scrolls rather than wrapping. */
.pills { border-top: 1px solid var(--line); }
.pills__scroll {
  gap: 6px; padding-top: 8px; padding-bottom: 8px;
  overflow-x: auto; scrollbar-width: none; flex-wrap: nowrap;
}
.pills__scroll::-webkit-scrollbar { display: none; }
.pill { padding: 5px 12px; font-size: 12px; white-space: nowrap; }

/* Shrink further once the page moves. */
.nav.is-stuck .nav__bar { padding-top: 6px; padding-bottom: 6px; }
.nav.is-stuck .custom-logo, .nav.is-stuck .logo__img { height: 26px !important; }
.nav.is-stuck .pills { display: none; }

@media (max-width: 900px) {
  .nav__search span:first-of-type, .nav__search .kbd { display: none; }
  .custom-logo, .logo__img { height: 26px !important; }
}

/* ==========================================================================
   2. HERO — two columns, image-led
   ========================================================================== */
.hero { padding-block: clamp(36px, 5vw, 72px); overflow: hidden; }

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(0, 1fr);
  gap: clamp(28px, 4vw, 56px);
  align-items: center;
}
.hero__copy { text-align: left; max-width: 660px; }

/* The old hero centred everything and clamped enormous. Left-aligned and a
   step smaller reads as a publication rather than a landing page. */
.hero__title {
  text-align: left;
  font-size: clamp(2.1rem, 3.8vw, 3.35rem);
  line-height: 1.02;
  letter-spacing: -.035em;
  margin-top: var(--s-4);
}
/* Each line is its own block, and balanced so a short last line like
   "noise." is not left stranded on a row of its own. */
.hero__title > span, .hero__title > em { display: block; text-wrap: balance; }
.hero__sub {
  text-align: left; margin-left: 0; margin-right: 0;
  max-width: 52ch; font-size: var(--t-md);
}
.hero .searchbar { margin-left: 0; margin-right: 0; max-width: 540px; }
.hero .searchbar__field { padding: 6px 6px 6px 16px; }

.hero__chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: var(--s-5); }
.hero__chips .chip {
  padding: 6px 13px; border-radius: var(--r-pill); font-size: 12.5px;
  border: 1px solid var(--line); color: var(--ink-2); background: var(--paper);
  transition: border-color .2s var(--ease-out), color .2s var(--ease-out), transform .2s var(--ease-out);
}
.hero__chips .chip:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }

.hero__stats {
  justify-content: flex-start; gap: var(--s-7);
  margin-top: var(--s-7); padding-top: var(--s-6);
  border-top: 1px solid var(--line);
}
.hero__stats .stat__n { font-size: var(--t-2xl); }

/* --------------------------------------------------------------------------
   2b. THE HERO VISUAL
   A workspace photograph with real tool records being compared on top of it.
   The animation is the product argument, not decoration: three tools rise in,
   their scores fill, and a verdict lands. CSS-only, so a deferred script can
   never leave the hero empty.
   -------------------------------------------------------------------------- */
.hero__visual { position: relative; }
.hv { position: relative; aspect-ratio: 4 / 3.4; }

.hv__glow {
  position: absolute; inset: 6% 4% 10% 8%;
  background: conic-gradient(from 200deg, var(--violet), var(--cyan), var(--rose), var(--amber), var(--violet));
  filter: blur(58px); opacity: .34; border-radius: 50%;
  animation: hvGlow 14s var(--ease) infinite alternate;
}
@keyframes hvGlow { to { transform: rotate(24deg) scale(1.08); opacity: .46; } }

.hv__shot {
  position: absolute; inset: 0 0 14% 6%;
  margin: 0; border-radius: var(--r-lg); overflow: hidden;
  box-shadow: 0 28px 70px -28px rgba(20,19,26,.44), 0 2px 8px rgba(20,19,26,.06);
  border: 1px solid rgba(255,255,255,.7);
  animation: hvRise 1s cubic-bezier(.16,1,.3,1) backwards .1s;
}
.hv__shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
@keyframes hvRise { from { opacity: 0; transform: translateY(22px) scale(.98); } }

/* A search sweep passes over the image once, then rests. */
.hv__scan {
  position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 38%, rgba(255,255,255,.5) 50%, transparent 62%);
  transform: translateX(-120%);
  animation: hvScan 5.5s cubic-bezier(.5,0,.2,1) 1.1s infinite;
}
@keyframes hvScan { 0% { transform: translateX(-120%); } 34%, 100% { transform: translateX(120%); } }

/* The comparison cards. */
.hv__stack {
  position: absolute; left: 0; right: 30%; bottom: 3%;
  display: grid; gap: 8px;
}
.hv__card {
  display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center;
  padding: 9px 12px; border-radius: 12px;
  background: color-mix(in oklab, var(--paper) 92%, transparent);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  box-shadow: 0 12px 28px -14px rgba(20,19,26,.3);
  animation: hvCard .8s cubic-bezier(.16,1,.3,1) backwards;
}
.hv__card--1 { animation-delay: .55s; }
.hv__card--2 { animation-delay: .72s; margin-left: 14px; }
.hv__card--3 { animation-delay: .89s; margin-left: 28px; }
@keyframes hvCard { from { opacity: 0; transform: translateX(-16px) translateY(8px); } }

.hv__mark {
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 700; font-size: 13px; color: #fff;
  background: linear-gradient(135deg, var(--accent), color-mix(in oklab, var(--accent) 45%, var(--violet)));
}
.hv__meta { display: grid; line-height: 1.25; min-width: 0; }
.hv__meta b { font-size: 12.5px; color: var(--ink); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hv__meta i { font-style: normal; font-family: var(--font-mono); font-size: 9.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-3); }

/* The score bar fills — "we compared these" in one gesture. */
.hv__bar {
  grid-column: 1 / -1; height: 3px; border-radius: 2px;
  background: color-mix(in oklab, var(--ink) 8%, transparent); overflow: hidden;
}
.hv__bar > span {
  display: block; height: 100%; border-radius: 2px; background: var(--accent);
  transform-origin: 0 50%; animation: hvFill 1.5s cubic-bezier(.16,1,.3,1) backwards;
}
.hv__card--1 .hv__bar > span { width: 88%; animation-delay: 1.0s; }
.hv__card--2 .hv__bar > span { width: 64%; animation-delay: 1.15s; }
.hv__card--3 .hv__bar > span { width: 45%; animation-delay: 1.3s; }
@keyframes hvFill { from { transform: scaleX(0); } }

.hv__verdict {
  /* Sat at bottom:20% and landed straight on the second tool card. Moved to
     the top corner, clear of the stack. */
  position: absolute; right: 0; top: 4%;
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--r-pill);
  background: var(--ink); color: var(--paper);
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .04em;
  box-shadow: 0 14px 32px -12px rgba(20,19,26,.5);
  animation: hvPop .7s cubic-bezier(.34,1.56,.64,1) backwards 1.7s;
}
.hv__verdict svg { color: var(--emerald); flex: none; }
@keyframes hvPop { from { opacity: 0; transform: translateY(10px) scale(.9); } }

@media (max-width: 1000px) {
  .hero__grid { grid-template-columns: 1fr; }
  .hero__visual { order: -1; max-width: 560px; margin-inline: auto; width: 100%; }
  .hv { aspect-ratio: 4 / 3; }
  .hero__copy { max-width: none; }
}
@media (max-width: 620px) {
  .hv__verdict { font-size: 9.5px; padding: 6px 11px; top: 2%; }
  .hv__stack { right: 12%; }
  .hero__stats { gap: var(--s-5); }
}
@media (prefers-reduced-motion: reduce) {
  .hv__glow, .hv__scan { animation: none; }
  .hv__shot, .hv__card, .hv__verdict, .hv__bar > span { animation: none; }
}

/* ==========================================================================
   3. CARDS — aligned rows, one headline, consistent covers
   ========================================================================== */
.card-grid {
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: var(--s-6);
  align-items: stretch;
}
.card { display: flex; flex-direction: column; height: 100%; }

/* Every cover is the same shape, photo or tile — this is what stops the rows
   looking ragged. */
.card__cover { aspect-ratio: 16 / 10; flex: none; overflow: hidden; }
.card__cover img { width: 100%; height: 100%; object-fit: cover; display: block; }

.card__body { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.card__title {
  font-size: var(--t-md); line-height: 1.28;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.card__excerpt {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  font-size: var(--t-sm); color: var(--ink-2); line-height: 1.55;
}
/* Meta pinned to the bottom so it lines up across the row. */
.card__foot { margin-top: auto; padding-top: 4px; }

/* The feature card leads a block. Spanning two columns while keeping a 16:10
   cover made it twice as wide AND twice as tall — a tower next to its
   neighbours. Laid out horizontally it stays the height of a normal row. */
.card--feature { grid-column: span 2; flex-direction: row; }
.card--feature .card__cover { width: 50%; aspect-ratio: auto; align-self: stretch; }
.card--feature .card__body { width: 50%; justify-content: center; padding: var(--s-6); }
.card--feature .card__title { font-size: var(--t-lg); -webkit-line-clamp: 3; }
.card--feature .card__excerpt { -webkit-line-clamp: 4; }
@media (max-width: 860px) {
  .card--feature { grid-column: span 1; flex-direction: column; }
  .card--feature .card__cover { width: 100%; aspect-ratio: 16 / 10; }
  .card--feature .card__body { width: 100%; padding: var(--s-4); }
}

/* --------------------------------------------------------------------------
   3b. TYPOGRAPHIC TILE — now a graphic mark, not a second headline
   -------------------------------------------------------------------------- */
.tile {
  position: absolute; inset: 0;
  display: grid; grid-template-rows: auto 1fr auto;
  padding: var(--s-4);
  background:
    radial-gradient(120% 100% at 15% 0%, color-mix(in oklab, var(--accent) 30%, transparent), transparent 64%),
    radial-gradient(100% 100% at 100% 100%, color-mix(in oklab, var(--accent) 20%, transparent), transparent 58%),
    var(--paper-3, #F3F1EC);
  overflow: hidden;
}
.tile__idx {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .12em;
  color: color-mix(in oklab, var(--accent) 78%, var(--ink)); justify-self: start;
}
.tile__mark {
  align-self: center; justify-self: center;
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(3rem, 7vw, 4.6rem); line-height: 1;
  color: color-mix(in oklab, var(--accent) 88%, var(--ink));
  opacity: .9;
}
.tile__cat {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-3); justify-self: start;
}
.tile__word { display: none; }   /* superseded by .tile__mark */

/* ==========================================================================
   4. TOOL CARDS + SECTION RHYTHM
   ========================================================================== */
.tool-grid { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: var(--s-5); align-items: stretch; }
.tool { display: flex; flex-direction: column; height: 100%; }
.tool__desc {
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  flex: 1;
}
.tool__foot { margin-top: auto; }

.block { padding-block: clamp(38px, 4.6vw, 66px); }
.block__head { margin-bottom: var(--s-6); align-items: end; }
.block__title { font-size: clamp(1.4rem, 2.3vw, 1.9rem); }

.phead { padding-block: clamp(40px, 5vw, 76px); }
.phead__inner h1 { font-size: clamp(2rem, 3.8vw, 3rem); line-height: 1.06; }

/* The article hero: the FIGURE owns the ratio (set in section 5) and the image
   fills it. An earlier max-height on the image fought that ratio and left a
   white strip under the photograph. */
.article__hero { margin-block: var(--s-6); }
.article__hero img {
  width: 100%; height: 100%; object-fit: cover; display: block;
}

/* The compare/author grids get the same stretch treatment. */
.compare-grid, .authorgrid { align-items: stretch; }
.compare-card { height: 100%; }

/* ==========================================================================
   5. ARTICLE LAYOUT — one column, one edge, plus a useful rail
   --------------------------------------------------------------------------
   The article previously stacked four different widths: a ~700px centred
   header, a full-width notice, a full-width hero image and a ~720px body.
   Nothing lined up, and on a wide display the reading column left most of the
   screen empty.

   Now there is a single content measure that the header, the notice, the hero
   image and the prose all share, and the spare width on the right carries a
   sticky rail — contents, author, sponsor. The reading measure is unchanged,
   so the typography is still comfortable; it just is not floating in space.
   ========================================================================== */
.article__grid {
  max-width: 1200px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 292px;
  gap: clamp(32px, 4.5vw, 68px);
  align-items: start;
}
.article__main { min-width: 0; }

/* Everything in the main column shares one left edge — this is the fix. */
.article__main > *,
.article__head,
.article .prose,
.article .article__hero,
.article .notice,
.article .authorbox,
.article .a-tags,
.article .share,
.article .disclosure-block {
  max-width: none;
  margin-inline: 0;
}

/* Header aligns with the body rather than being centred above it. */
.article__head { text-align: left; }
.article__head .crumbs { justify-content: flex-start; }
.article__title { font-size: clamp(1.9rem, 3.2vw, 2.85rem); line-height: 1.08; }
.article__dek { font-size: 1.2rem; max-width: 60ch; }
.article .byline { justify-content: flex-start; }

/* The hero image now matches the text column instead of bleeding wider. */
.article .article__hero { aspect-ratio: 16 / 9; margin-block: var(--s-6); }

/* Comfortable measure preserved inside the wider column. */
.article .prose { max-width: 68ch; }
.article .prose h2 { scroll-margin-top: 110px; }

/* -------------------------------------------------------------- the rail */
.article__side { min-width: 0; }
.article__side-inner {
  position: sticky; top: 96px;
  display: grid; gap: var(--s-5);
}

.toc { border-left: 2px solid var(--line); padding-left: var(--s-4); }
.toc__h {
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3); margin-bottom: var(--s-4);
}
.toc__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; counter-reset: toc; }
.toc__list li { counter-increment: toc; }
.toc__list a {
  display: block; font-size: 13px; line-height: 1.4; color: var(--ink-2);
  transition: color .2s var(--ease-out), transform .2s var(--ease-out);
}
.toc__list a::before {
  content: counter(toc, decimal-leading-zero);
  font-family: var(--font-mono); font-size: 10px; color: var(--ink-3); margin-right: 8px;
}
.toc__list a:hover { color: var(--accent, var(--violet)); transform: translateX(2px); }

.side-card { border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s-5); }
.side-card__label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3);
}
.side-author { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.side-author .authorbox__avatar,
.side-author .authorbox__avatar--initial { width: 40px; height: 40px; font-size: 16px; }
.side-author a { font-size: 13.5px; font-weight: 600; color: var(--ink); display: block; }
.side-author a:hover { color: var(--violet); }
.side-author i { font-style: normal; font-size: 11px; color: var(--ink-3); }
.side-card__link {
  display: inline-block; margin-top: var(--s-4); font-size: 12px;
  color: var(--violet); text-decoration: underline; text-underline-offset: 2px;
}

/* The rail Sponsored Highlight is narrower, so it stacks rather than sits wide. */
.article__side .sponsored { margin: 0; padding: var(--s-5); }
.article__side .sponsored__heading { font-size: var(--t-md); }
.article__side .sponsored__foot { flex-direction: column; align-items: flex-start; gap: 10px; }
.article__side .sponsored__cta { width: 100%; justify-content: center; }

@media (max-width: 1080px) {
  /* Below this the rail has nowhere useful to go, so it follows the article
     and the reading column takes the full width. */
  .article__grid { grid-template-columns: 1fr; max-width: 860px; }
  .article__side-inner { position: static; grid-template-columns: 1fr; }
  .article .prose { max-width: none; }
}

/* ==========================================================================
   6. OTHER SINGLE-COLUMN PAGES — same measure, same edges
   --------------------------------------------------------------------------
   About, Contact, the methodology and every policy page put their heading in
   the full-width wrapper and their body in a narrow one, so the H1 started
   ~100px left of the paragraph beneath it. Both now share one measure.
   ========================================================================== */
.wrap--narrow { max-width: 860px; }
.page .prose--doc, .legal .prose { max-width: none; }

.dmt-narrow .phead__inner { max-width: 860px; margin-inline: auto; }
.dmt-narrow .phead__inner .crumbs { justify-content: flex-start; }

/* The tool page header carries a logo tile, so it aligns on the same edge
   rather than being centred against the fact table below it. */
.dmt-narrow .toolhead { max-width: 860px; }

/* The tool header put the logo tile beside the title, which indented the
   title, description and buttons ~50px past the "At a glance" table below.
   Stacked, so the whole page shares one left edge. */
.dmt-narrow .toolhead { grid-template-columns: 1fr; gap: var(--s-4); }
.dmt-narrow .toolhead__logo { width: 56px; height: 56px; font-size: 24px; }

/* ==========================================================================
   7. AGENCY CREDIT
   In the footer of every page. Quiet enough not to compete with the client's
   own copyright line, but a real link.
   ========================================================================== */
.footer__credit { white-space: nowrap; }
.footer__credit > span[aria-hidden] { margin: 0 6px; opacity: .5; }
.footer__credit a {
  color: var(--ink-2);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-color: color-mix(in oklab, var(--ink-3) 55%, transparent);
  transition: color .2s var(--ease-out), text-decoration-color .2s var(--ease-out);
}
.footer__credit a:hover {
  color: var(--violet);
  text-decoration-color: currentColor;
}
@media (max-width: 620px) {
  /* On a narrow footer it gets its own line rather than crowding the copyright. */
  .footer__credit { display: block; white-space: normal; margin-top: 6px; }
  .footer__credit > span[aria-hidden] { display: none; }
}
