/* ==========================================================================
   Layout system B — APP
   --------------------------------------------------------------------------
   Used by: northbound ($3,200)
   Reference: a product, not a brochure. Think Linear or Stripe: a utility bar,
   a bento grid of unequal tiles, numbers treated as graphics, and a sidebar
   that stays put while you read.

   WHAT MAKES THIS DIFFERENT FROM THE OTHER FOUR
     · a sticky SUB-NAV under the header, with tab-filtering
     · a bento grid: tiles of 2x, 1x and wide spans, never an even row of three
     · metrics presented as large figures with a unit, like a dashboard
     · a sticky buy panel on the product page that follows you down
     · a comparison table with a highlighted column
     · NOTHING is centred. Every section is left-aligned to a 12-column grid.

   Requires core.css.
   ========================================================================== */

.app-shell {
  width: min(1280px, 100% - 48px);
  margin-inline: auto;
}

/* ------------------------------------------------------------- utility bar */
.app-util {
  border-bottom: 1px solid var(--d-line);
  font-size: 0.8rem;
  color: var(--d-muted);
}

.app-util .app-shell {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 22px;
  min-height: 42px;
}

.app-util b { color: var(--d-ink); font-weight: 600; }
.app-util .app-spacer { margin-left: auto; }

/* --------------------------------------------------------------- sub nav */
.app-subnav {
  position: sticky;
  top: 68px;
  z-index: 30;
  background: color-mix(in srgb, var(--d-bg) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--d-line);
}

.app-subnav .app-shell {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.app-subnav .app-shell::-webkit-scrollbar { display: none; }

.app-subnav a {
  padding: 14px 16px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--d-muted);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 2px solid transparent;
  transition: color 0.18s ease, border-color 0.18s ease;
}

.app-subnav a:hover { color: var(--d-ink); }
.app-subnav a[aria-current="page"] {
  color: var(--d-ink);
  border-bottom-color: var(--d-accent);
}

/* ------------------------------------------------------------- the bento */
.app-bento {
  display: grid;
  gap: 16px;
  grid-template-columns: 1fr;
  margin: clamp(28px, 4vw, 46px) 0;
}

@media (min-width: 760px) {
  .app-bento { grid-template-columns: repeat(6, 1fr); }
  .app-tile-2 { grid-column: span 3; }
  .app-tile-3 { grid-column: span 2; }
  .app-tile-wide { grid-column: span 6; }
  .app-tile-tall { grid-row: span 2; }
  .app-tile-half { grid-column: span 3; }
}

.app-tile {
  position: relative;
  border: 1px solid var(--d-line);
  border-radius: var(--d-radius);
  background: var(--d-surface);
  padding: 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
  transition: transform 0.26s cubic-bezier(0.16, 0.84, 0.28, 1),
              border-color 0.26s ease;
}

.app-tile:hover {
  transform: translate3d(0, -3px, 0);
  border-color: color-mix(in srgb, var(--d-ink) 24%, transparent);
}

.app-tile-dark {
  background: var(--d-ink);
  color: var(--d-bg);
  border-color: var(--d-ink);
}

.app-tile-dark .app-kicker,
.app-tile-dark p { color: color-mix(in srgb, var(--d-bg) 74%, transparent); }

.app-tile-accent {
  background: color-mix(in srgb, var(--d-accent) 10%, var(--d-surface));
  border-color: color-mix(in srgb, var(--d-accent) 30%, transparent);
}

.app-kicker {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--d-muted);
}

.app-tile h3 {
  font-size: clamp(1.15rem, 1.9vw, 1.5rem);
  margin: 0;
}

.app-tile p {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--d-muted);
}

.app-tile-img {
  aspect-ratio: 16 / 9;
  border-radius: calc(var(--d-radius) - 4px);
  background:
    radial-gradient(circle at 34% 30%,
      color-mix(in srgb, var(--d-accent) 26%, var(--d-surface)),
      var(--d-surface) 72%);
  margin-bottom: 6px;
}

/* --------------------------------------------------------------- metrics */
.app-metrics {
  display: grid;
  gap: 1px;
  background: var(--d-line);
  border: 1px solid var(--d-line);
  border-radius: var(--d-radius);
  overflow: hidden;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
}

.app-metric {
  background: var(--d-surface);
  padding: 24px 22px;
}

.app-metric b {
  display: block;
  font-family: var(--d-font);
  font-size: clamp(1.7rem, 3.4vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1;
  margin-bottom: 6px;
}

.app-metric b i {
  font-style: normal;
  font-size: 0.44em;
  color: var(--d-muted);
  margin-left: 4px;
  letter-spacing: 0;
}

.app-metric span {
  font-size: 0.82rem;
  color: var(--d-muted);
  line-height: 1.45;
  display: block;
}

/* ------------------------------------------------------ product buy panel */
.app-buy {
  display: grid;
  gap: clamp(26px, 4vw, 54px);
  align-items: start;
}

@media (min-width: 900px) {
  .app-buy { grid-template-columns: 1.25fr 0.75fr; }
}

.app-buy-sticky {
  position: sticky;
  top: 132px;
  border: 1px solid var(--d-line);
  border-radius: var(--d-radius);
  background: var(--d-surface);
  padding: 26px;
}

@media (max-width: 899px) {
  .app-buy-sticky { position: static; top: auto; }
}

.app-buy-price {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}

.app-buy-price b {
  font-family: var(--d-font);
  font-size: 2.1rem;
  font-weight: 600;
  letter-spacing: -0.035em;
}

.app-buy-price s { color: var(--d-muted); font-size: 0.95rem; }

.app-opt {
  display: grid;
  gap: 8px;
  margin: 18px 0;
}

.app-opt-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.app-opt-row button {
  padding: 9px 15px;
  border: 1px solid var(--d-line);
  border-radius: calc(var(--d-radius) - 4px);
  background: var(--d-surface);
  font-size: 0.87rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.16s ease, background-color 0.16s ease;
}

.app-opt-row button[aria-pressed="true"] {
  border-color: var(--d-ink);
  background: color-mix(in srgb, var(--d-ink) 6%, var(--d-surface));
}

/* ------------------------------------------------- comparison with a winner */
.app-compare {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.9rem;
  border: 1px solid var(--d-line);
  border-radius: var(--d-radius);
  overflow: hidden;
}

.app-compare th,
.app-compare td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--d-line);
}

.app-compare thead th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--d-muted);
  background: color-mix(in srgb, var(--d-ink) 4%, var(--d-bg));
}

/* the column that wins gets marked, rather than left to the reader */
.app-compare .app-wins {
  background: color-mix(in srgb, var(--d-accent) 8%, transparent);
  font-weight: 600;
}

.app-compare thead .app-wins {
  color: var(--d-accent);
  background: color-mix(in srgb, var(--d-accent) 14%, transparent);
}

.app-compare tr:last-child td { border-bottom: 0; }

/* ------------------------------------------------------------------ plans */
.app-plans {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: stretch;
}

.app-plan {
  border: 1px solid var(--d-line);
  border-radius: var(--d-radius);
  background: var(--d-surface);
  padding: 26px 24px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.24s ease, transform 0.24s cubic-bezier(0.16, 0.84, 0.28, 1);
}

.app-plan:hover { transform: translate3d(0, -3px, 0); }

.app-plan-featured {
  border-color: var(--d-accent);
  box-shadow: 0 0 0 1px var(--d-accent);
}

.app-plan-tag {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--d-accent);
  margin-bottom: 12px;
}

.app-plan b {
  font-family: var(--d-font);
  font-size: 2rem;
  letter-spacing: -0.035em;
  line-height: 1;
}

.app-plan b small {
  font-size: 0.4em;
  font-weight: 400;
  color: var(--d-muted);
  letter-spacing: 0;
}

.app-plan ul {
  list-style: none;
  padding: 0;
  margin: 18px 0 22px;
  display: grid;
  gap: 9px;
  font-size: 0.89rem;
  color: var(--d-muted);
}

.app-plan ul li { padding-left: 20px; position: relative; }

.app-plan ul li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: color-mix(in srgb, var(--d-accent) 60%, transparent);
}

.app-plan .d-btn { margin-top: auto; }

/* -------------------------------------------------------------- sections */
.app-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 22px;
}

.app-head h2 { margin: 0; }

.app-head a {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--d-accent);
  text-decoration: none;
}

.app-head a:hover { text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 640px) {
  .app-subnav { top: 62px; }
  .app-tile { padding: 20px; }
}
