/* Shared styles for the per-competitor comparison pages (vs-*).
   Extracted from scrivener-alternative.html when the Dabble page became the
   second consumer. Page-specific rules stay in each page inline <style>. */

    /* ===========================================
       VERSUS ARTICLE PAGE STYLES
       Shared by the per-competitor comparison pages.
       Table rules are lifted from compare.html so the two
       pages read as one family.
       =========================================== */

    /* ----- No orphans, page-wide -----
       A single word stranded on its own last line reads as sloppy
       typesetting, and on a page whose whole argument is "we are the
       careful ones" it undercuts the copy.

       `text-wrap: pretty` tells the browser to avoid a short final line
       by rebalancing the breaks above it. It costs nothing when
       unsupported: the text simply wraps the old way.

       Headings get `balance` instead, which evens out line lengths
       across the whole heading rather than only fixing the last line.

       This block is the template for the other per-competitor pages.
       Keep it at the top so it is not buried under component styles. */

    /* NOTE: `text-wrap` is inherited but only ACTS on the block container that
       lays out the line. Setting it on an inline <span> does nothing; it has to
       go on the block ancestor (here `.vs-related a`, which is display:block). */
    .vs-hero__sub,
    .vs-verdict p,
    .vs-body p,
    .vs-body li,
    .vs-related a,
    .vs-note,
    .final-cta__subtext {
      text-wrap: pretty;
    }

    .vs-hero__headline,
    .vs-body h2,
    .vs-body h3,
    .vs-related h2,
    .final-cta__headline {
      text-wrap: balance;
    }

    /* ----- Breadcrumb ----- */

    .vs-crumb {
      padding-top: var(--space-8);
      font-size: var(--text-xs);
      color: rgb(var(--muted-foreground));
    }

    .vs-crumb ol {
      list-style: none;
      margin: 0;
      padding: 0;
      display: flex;
      flex-wrap: wrap;
      gap: var(--space-2);
      align-items: center;
    }

    .vs-crumb a {
      color: rgb(var(--muted-foreground));
      text-decoration: underline;
      text-underline-offset: 2px;
    }

    .vs-crumb a:hover { color: rgb(var(--cta)); }

    .vs-crumb [aria-current] { color: rgb(var(--foreground)); }

    /* ----- Vertical rhythm -----
       The shared `.section` class applies `--section-gap` (80px) top AND
       bottom. Three stacked sections therefore put ~160px of dead space
       between the verdict and the price cards, which read as a broken page
       rather than a breath. The intro owns its own tighter spacing instead,
       and the article body starts right after it. */

    .vs-intro {
      padding: 0 0 var(--space-10);
    }

    .vs-main {
      padding: 0 0 var(--space-12);
    }

    /* The first heading supplies its own top margin; the intro above already
       provided the gap, so zero it out rather than stacking the two. */
    .vs-body > h2:first-child {
      margin-top: 0;
    }

    /* ----- Hero ----- */

    .vs-hero {
      padding-top: var(--space-6);
      padding-bottom: var(--space-6);
      text-align: center;
    }

    .vs-hero__kicker {
      display: inline-block;
      font-family: 'IBM Plex Mono', ui-monospace, SFMono-Regular, monospace;
      font-size: var(--text-xs);
      font-weight: 500;
      letter-spacing: 0.22em;
      text-transform: uppercase;
      color: rgb(var(--cta));
      margin-bottom: var(--space-5);
    }

    .vs-hero__headline {
      font-family: 'Newsreader', ui-serif, Georgia, serif;
      font-size: clamp(2.25rem, 5vw, 3.5rem);
      font-weight: 500;
      line-height: 1.08;
      letter-spacing: -0.02em;
      color: rgb(var(--foreground));
      margin-bottom: var(--space-5);
      max-width: 900px;
      margin-left: auto;
      margin-right: auto;
      text-wrap: balance;
    }

    .vs-hero__headline em {
      font-style: italic;
      font-weight: 400;
      color: rgb(var(--cta));
    }

    .vs-hero__sub {
      max-width: 880px;
      margin: 0 auto;
      color: rgb(var(--muted-foreground));
      line-height: 1.6;
      text-wrap: pretty;
    }

    /* The "and" that carries the whole positioning: manuscript AND world. */
    .vs-hero__sub .vs-and {
      font-weight: 600;
      color: rgb(var(--foreground));
      text-decoration: underline;
      text-decoration-thickness: 2px;
      text-underline-offset: 3px;
      text-decoration-color: rgb(var(--cta));
    }

    /* Freshness signal. Kept high on the page (winning comparison pages all
       carry a visible check date above the fold) but out of the hero stack,
       where the monospace line was competing with the headline. */
    .vs-checked {
      max-width: 780px;
      margin: 0 auto var(--space-3);
      font-family: 'IBM Plex Mono', ui-monospace, monospace;
      font-size: var(--text-xs);
      color: rgb(var(--muted-foreground));
      letter-spacing: 0.04em;
      text-align: right;
    }

    /* ----- Verdict block (answer-first) ----- */

    .vs-verdict {
      max-width: 780px;
      margin: 0 auto;
      padding: var(--space-8);
      background: rgb(var(--background-accent));
      border: 1px solid rgb(var(--border));
      border-left: 4px solid rgb(var(--cta));
    }

    .vs-verdict h2 {
      font-family: 'IBM Plex Mono', ui-monospace, monospace;
      font-size: var(--text-xs);
      font-weight: 600;
      letter-spacing: 0.18em;
      text-transform: uppercase;
      color: rgb(var(--cta));
      margin: 0 0 var(--space-4);
    }

    .vs-verdict p {
      font-size: var(--text-base);
      line-height: var(--leading-relaxed);
      color: rgb(var(--foreground));
      margin: 0 0 var(--space-4);
    }

    .vs-verdict p:last-child { margin-bottom: 0; }

    /* ----- Prose body ----- */

    .vs-body {
      max-width: 780px;
      margin: 0 auto;
    }

    /* ----- Heading hierarchy -----
       The shared scale puts --text-2xl at 1.4rem and --text-lg at 1.2rem.
       Three pixels apart in the same face at the same weight, so section
       headings and subheadings read as the same level and a long article
       turns into an undifferentiated list.

       So h2 jumps to --text-3xl (1.8rem) and carries a rule beneath it: a
       hairline the width of the column with a thick rust segment at the
       left, echoing the accent bar on the verdict box. h3 stays at 1.2rem
       and plain. The gap is now 50% in size plus a graphic marker, which
       survives skimming. */

    .vs-body h2 {
      font-family: 'Source Serif 4', ui-serif, Georgia, serif;
      font-size: var(--text-3xl);
      font-weight: 600;
      line-height: 1.2;
      letter-spacing: -0.01em;
      margin: var(--space-12) 0 var(--space-5);
      padding-bottom: var(--space-3);
      border-bottom: 1px solid rgb(var(--border));
      position: relative;
      scroll-margin-top: calc(var(--header-height) + 16px);
    }

    .vs-body h2::after {
      content: '';
      position: absolute;
      left: 0;
      bottom: -2px;
      width: 68px;
      height: 3px;
      background: rgb(var(--cta));
    }

    .vs-body h3 {
      font-family: 'Source Serif 4', ui-serif, Georgia, serif;
      font-size: var(--text-lg);
      font-weight: 600;
      margin: var(--space-8) 0 var(--space-3);
      color: rgb(var(--foreground));
    }

    @media (max-width: 640px) {
      /* Scale h2 down for a narrow column, but NOT to --text-2xl (1.4rem):
         that lands 2px off h3 and reintroduces the exact problem this block
         exists to solve. Matches the calc idiom in css/typography.css. */
      .vs-body h2 { font-size: calc(var(--text-3xl) * 0.85); }
    }

    .vs-body p {
      font-size: var(--text-base);
      line-height: var(--leading-relaxed);
      color: rgb(var(--foreground));
      margin-bottom: var(--space-4);
    }

    .vs-body ol,
    .vs-body ul {
      margin: 0 0 var(--space-4) var(--space-6);
      padding: 0;
    }

    .vs-body li {
      font-size: var(--text-base);
      line-height: var(--leading-relaxed);
      color: rgb(var(--foreground));
      margin-bottom: var(--space-3);
    }

    .vs-body a {
      color: rgb(var(--cta));
      text-decoration: underline;
      text-underline-offset: 2px;
    }

    .vs-body strong { font-weight: 600; }

    /* ----- Head-to-head price cards ----- */

    .vs-prices {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: var(--space-4);
      max-width: 560px;
      /* 14px of top padding is headroom for the badge, which sits at -12px. */
      margin: var(--space-8) auto 0;
      padding-top: 14px;
    }

    .vs-price {
      display: flex;
      flex-direction: column;
      align-items: center;
      padding: var(--space-6) var(--space-4);
      border: 1px solid rgb(var(--border));
      background: rgb(var(--paper));
      text-align: center;
    }

    .vs-price--highlight {
      border: 2px solid rgb(var(--cta));
      background: rgb(var(--card));
      box-shadow: -5px 5px 0 0 rgba(205, 110, 44, 0.2);
      position: relative;
    }

    .vs-price__badge {
      position: absolute;
      top: -12px;
      left: 50%;
      transform: translateX(-50%);
      background: rgb(var(--cta));
      color: #fff;
      font-size: 0.65rem;
      font-weight: 600;
      padding: 2px 10px;
      letter-spacing: 0.05em;
      text-transform: uppercase;
      white-space: nowrap;
    }

    .vs-price__name {
      font-weight: 600;
      font-size: var(--text-sm);
      margin-bottom: var(--space-2);
    }

    .vs-price__amount {
      font-size: var(--text-3xl);
      font-weight: 700;
      line-height: 1.1;
      margin-bottom: var(--space-1);
    }

    .vs-price--highlight .vs-price__amount { color: rgb(var(--cta)); }

    .vs-price__note {
      font-size: var(--text-xs);
      color: rgb(var(--muted-foreground));
    }

    .vs-price--highlight .vs-price__note {
      font-size: var(--text-sm);
      color: rgb(var(--foreground));
      font-weight: 500;
    }

    /* ----- Comparison tables (from compare.html) ----- */

    .vs-scroll { position: relative; }

    .vs-scroll-hint {
      display: none;
      text-align: center;
      font-size: var(--text-xs);
      color: rgb(var(--muted-foreground));
      padding: var(--space-2) 0;
    }

    .vs-table {
      width: 100%;
      min-width: 520px;
      border-collapse: separate;
      border-spacing: 0;
      font-size: var(--text-sm);
      table-layout: fixed;
      margin-bottom: var(--space-4);
    }

    .vs-table col.vs-col-feature { width: 30%; }

    .vs-table thead th {
      background: rgb(var(--background));
      font-weight: 600;
      font-size: var(--text-sm);
      padding: var(--space-3);
      text-align: center;
      box-shadow: 0 5px 0 0 rgba(0, 0, 0, 0.15);
      vertical-align: bottom;
    }

    .vs-table thead th:first-child { text-align: left; }

    .vs-table thead th.vs-pp-head { background: rgb(251, 236, 215); }

    .vs-table tbody td {
      padding: var(--space-4) var(--space-3);
      border-bottom: 1px solid rgb(var(--border));
      text-align: center;
      vertical-align: middle;
      line-height: 1.4;
    }

    .vs-table tbody th[scope="row"] {
      padding: var(--space-4) var(--space-3);
      border-bottom: 1px solid rgb(var(--border));
      text-align: left;
      font-weight: 500;
      font-size: var(--text-sm);
      vertical-align: middle;
      line-height: 1.4;
    }

    .vs-table tbody td.vs-pp { background: rgba(205, 110, 44, 0.05); }

    .vs-yes { color: rgb(var(--foreground)); font-weight: 500; }

    .vs-no { color: rgb(var(--muted-foreground)); opacity: 0.55; }

    .vs-detail {
      display: block;
      font-size: 0.7rem;
      font-weight: 400;
      color: rgb(var(--muted-foreground));
      margin-top: 2px;
      line-height: 1.3;
    }

    /* ----- Floated screenshots -----
       Cut left or right with prose wrapping around them, and clickable to
       open full size. `shape-outside` is deliberately NOT used: these are
       rectangular screenshots, so a plain float gives the right result.

       The figure stays a plain <figure><img> in the HTML, so a crawler with
       no JavaScript still gets the image and its caption. The lightbox is
       progressive enhancement layered on top. */

    .vs-shot {
      margin: 0 0 var(--space-4);
      max-width: 300px;
      cursor: zoom-in;
    }

    .vs-shot--right {
      float: right;
      margin-left: var(--space-6);
    }

    .vs-shot--left {
      float: left;
      margin-right: var(--space-6);
    }

    /* Screenshots vary wildly in shape: Minipen is 1067x2234, Flowstate is
       2632x1504. Left at natural height a tall one runs far past its
       paragraph and leaves a column of dead space beside the next heading,
       which `clear: both` then pushes down. So every thumbnail is cropped to
       one consistent 4:3 band from the top left, where the interesting part
       of a UI screenshot lives. The lightbox shows the whole uncropped
       image, which is what the caption invites. */
    .vs-shot img {
      display: block;
      width: 100%;
      aspect-ratio: 4 / 3;
      object-fit: cover;
      object-position: top left;
      border: 1px solid rgb(var(--border));
      background: rgb(var(--paper));
      transition: border-color .15s, box-shadow .15s;
    }

    .vs-shot:hover img,
    .vs-shot:focus-visible img {
      border-color: rgb(var(--cta));
      box-shadow: -4px 4px 0 0 rgba(205, 110, 44, 0.18);
    }

    .vs-shot figcaption {
      font-size: var(--text-xs);
      color: rgb(var(--muted-foreground));
      margin-top: var(--space-2);
      line-height: 1.4;
    }

    /* A heading must never wrap around a floated figure. */
    .vs-body h2,
    .vs-body h3 {
      clear: both;
    }

    /* ----- Lightbox (same behaviour as the homepage) ----- */

    .vs-lb {
      display: flex;
      position: fixed;
      inset: 0;
      z-index: 60;
      background: rgba(28, 22, 14, .74);
      align-items: center;
      justify-content: center;
      padding: clamp(16px, 4vw, 56px);
      opacity: 0;
      visibility: hidden;
      transition: opacity .28s ease, visibility .28s ease;
    }

    .vs-lb.lb-open { opacity: 1; visibility: visible; }

    .vs-lb__panel {
      background: rgb(var(--paper));
      border: 1px solid rgb(var(--border));
      box-shadow: 0 50px 90px -30px rgba(0, 0, 0, .6);
      max-width: 1040px;
      width: 100%;
      max-height: 92vh;
      overflow: auto;
      transform: scale(.93);
      transition: transform .32s cubic-bezier(.2, .7, .2, 1);
    }

    .vs-lb.lb-open .vs-lb__panel { transform: scale(1); }

    .vs-lb__figure {
      position: relative;
      background: #1C160E;
      border-bottom: 1px solid rgb(var(--border));
    }

    .vs-lb__figure img {
      width: 100%;
      max-height: 70vh;
      object-fit: contain;
      display: block;
    }

    .vs-lb__close {
      position: absolute;
      top: 12px;
      right: 12px;
      width: 36px;
      height: 36px;
      border: none;
      background: rgba(252, 248, 240, .92);
      color: rgb(var(--foreground));
      font-size: 20px;
      line-height: 1;
      cursor: pointer;
    }

    .vs-lb__cap {
      padding: var(--space-5) var(--space-6);
      font-size: var(--text-sm);
      line-height: var(--leading-relaxed);
      color: rgb(var(--foreground));
      margin: 0;
    }

    @media (max-width: 640px) {
      /* Floats collapse on a narrow column: a 300px image beside body text
         leaves an unreadable gutter. Full width, centered, in flow. */
      .vs-shot--left,
      .vs-shot--right {
        float: none;
        margin: 0 auto var(--space-5);
        max-width: 100%;
      }
    }

    /* ----- "Choose X if" decision cards -----
       This is the block AI Overviews reshape answers into, and it is the
       last thing a reader looks at before deciding, so it gets weight
       rather than sitting as two more subheadings in a wall of prose.
       Bulleted rather than comma-run: easier to scan, and structured
       content is extracted more reliably than a sentence. */

    .vs-choose {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: var(--space-5);
      margin: var(--space-8) 0;
      clear: both;
    }

    .vs-choose__card {
      display: flex;
      flex-direction: column;
      padding: var(--space-6);
      border: 1px solid rgb(var(--border));
      background: rgb(var(--paper));
    }

    .vs-choose__card--pp {
      border: 2px solid rgb(var(--cta));
      background: rgb(var(--card));
      box-shadow: -5px 5px 0 0 rgba(205, 110, 44, 0.2);
    }

    /* Overrides the article h3 rules: inside a card it is a card title. */
    .vs-body .vs-choose__card h3 {
      font-size: var(--text-xl);
      margin: 0 0 var(--space-4);
      padding-bottom: var(--space-3);
      border-bottom: 1px solid rgb(var(--border));
    }

    .vs-body .vs-choose__card--pp h3 {
      color: rgb(var(--cta));
      border-bottom-color: rgba(205, 110, 44, 0.35);
    }

    .vs-body .vs-choose__card ul {
      list-style: none;
      margin: 0 0 var(--space-4);
      padding: 0;
      flex: 1;
    }

    .vs-body .vs-choose__card li {
      position: relative;
      padding-left: var(--space-5);
      margin-bottom: var(--space-3);
      font-size: var(--text-sm);
      line-height: 1.5;
    }

    .vs-body .vs-choose__card li::before {
      content: '';
      position: absolute;
      left: 0;
      top: 0.55em;
      width: 7px;
      height: 7px;
      background: rgb(var(--muted-foreground));
    }

    .vs-body .vs-choose__card--pp li::before { background: rgb(var(--cta)); }

    .vs-body .vs-choose__note {
      margin: 0;
      padding-top: var(--space-4);
      border-top: 1px solid rgb(var(--border));
      font-size: var(--text-sm);
      font-style: italic;
      color: rgb(var(--muted-foreground));
    }

    @media (max-width: 700px) {
      .vs-choose { grid-template-columns: 1fr; gap: var(--space-4); }
    }

    /* ----- Methodology note ----- */

    .vs-note {
      max-width: 780px;
      margin: var(--space-10) auto 0;
      padding: var(--space-6);
      background: rgb(var(--background-accent));
      border: 1px solid rgb(var(--border));
      font-size: var(--text-xs);
      color: rgb(var(--muted-foreground));
      line-height: var(--leading-relaxed);
    }

    .vs-note strong { color: rgb(var(--foreground)); }

    .vs-note a { color: rgb(var(--cta)); text-decoration: underline; }

    /* ----- Related comparisons ----- */

    .vs-related {
      max-width: 780px;
      margin: var(--space-10) auto 0;
    }

    /* Deliberately between the article's h2 (1.8rem) and its h3 (1.2rem):
       this is a navigation block, not a section of the argument, so it
       should not compete with the real section headings or wear their
       rust accent rule. It does need to outrank the h3s above it. */
    .vs-related h2 {
      font-family: 'Source Serif 4', ui-serif, Georgia, serif;
      font-size: var(--text-2xl);
      font-weight: 600;
      margin-bottom: var(--space-4);
    }

    .vs-related ul {
      list-style: none;
      margin: 0;
      padding: 0;
      display: grid;
      gap: var(--space-3);
    }

    .vs-related li { margin: 0; }

    .vs-related a {
      display: block;
      padding: var(--space-4);
      border: 1px solid rgb(var(--border));
      background: rgb(var(--paper));
      color: rgb(var(--foreground));
      text-decoration: none;
      transition: border-color .15s, background .15s;
    }

    .vs-related a:hover {
      border-color: rgb(var(--cta));
      background: rgb(var(--card));
    }

    .vs-related a strong {
      display: block;
      font-weight: 600;
      margin-bottom: 2px;
    }

    .vs-related a span {
      font-size: var(--text-sm);
      color: rgb(var(--muted-foreground));
    }

    /* ----- Closing call to action ----- */

    /* Two asks side by side. main.css styles a single centered button here, so
       the row lives on this page rather than site-wide. */
    .final-cta__actions {
      display: flex;
      justify-content: center;
      align-items: center;
      gap: var(--space-4);
      flex-wrap: wrap;
    }

    /* ----- Responsive ----- */

    @media (max-width: 768px) {
      .vs-hero { padding-top: var(--space-4); padding-bottom: var(--space-8); }
      /* h2 sizing lives in the heading-hierarchy block above. It must NOT be
         set here: this rule is later in the file, so it silently beat the
         640px rule and collapsed h2 back to within 2px of h3. */
      .vs-verdict { padding: var(--space-6); }
      .vs-scroll-hint { display: block; }
      .vs-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    }

    @media (max-width: 560px) {
      .vs-scroll { overflow-x: visible; }
      .vs-scroll-hint { display: none; }

      .vs-table,
      .vs-table tbody,
      .vs-table tr { display: block; width: 100%; min-width: unset; }

      .vs-table thead { display: none; }

      .vs-table tbody tr {
        border: 1px solid rgb(var(--border));
        margin-bottom: var(--space-3);
        background: rgb(var(--paper));
      }

      .vs-table tbody th[scope="row"] {
        display: block;
        background: rgb(var(--background-accent));
        border-bottom: 1px solid rgb(var(--border));
        padding: var(--space-3) var(--space-4);
        font-weight: 600;
      }

      .vs-table tbody td {
        display: flex;
        align-items: baseline;
        gap: var(--space-3);
        padding: var(--space-2) var(--space-4);
        border-bottom: 1px solid rgb(var(--border));
        text-align: left;
        background: transparent;
      }

      .vs-table tbody td:last-child { border-bottom: none; }

      .vs-table tbody td::before {
        content: attr(data-label);
        font-size: var(--text-xs);
        font-weight: 600;
        color: rgb(var(--muted-foreground));
        min-width: 76px;
        flex-shrink: 0;
      }

      .vs-table tbody td.vs-pp { background: rgba(205, 110, 44, 0.07); }
      .vs-table tbody td.vs-pp::before { color: rgb(var(--cta)); }

      .vs-detail { display: inline; margin-left: 4px; }

      .vs-prices { grid-template-columns: 1fr; }

      /* Stack the two closing buttons rather than letting them shrink. */
      .final-cta__actions { flex-direction: column; }
      .final-cta__actions .btn { width: 100%; }
    }
