/* ==========================================================================
   Home 06 — "Services & Packages"
   Markup: resources/views/components/packages/*.blade.php
   Data: config/site.php (services) · config/packages_section.php (copy, look)

   Grid: 1 column → 2 (640) → 3 + 2 (960) → 5 in a row (1280), where subgrid
   lines up every card's rows. Tones come from base.css [data-tone], the same
   colour per service as section 03.
   Motion: transform/opacity only; reduced motion is handled in base.css.
   ========================================================================== */

.pkg {
  --pkg-pad: calc(var(--hdr-inset) + var(--hdr-pad));
  --pkg-tile-shadow: 0 8px 18px -10px rgb(15 23 42 / 0.30), 0 1px 3px rgb(15 23 42 / 0.08);

  background: var(--warm-50);
  border-top: 1px solid var(--color-border);
  padding-block: clamp(56px, 7vw, 112px);
  scroll-margin-top: var(--bar-h);
}

.pkg__wrap {
  max-width: var(--hdr-max);
  margin-inline: auto;
  padding-inline: var(--pkg-pad);
}

/* ---- Head ---------------------------------------------------------------- */

.pkg__head {
  display: grid;
  gap: 24px 48px;
  margin-bottom: clamp(24px, 3vw, 36px);
}

@media (min-width: 1200px) {
  .pkg__head {
    grid-template-columns: minmax(0, 1fr) minmax(460px, 580px);
    align-items: center;
  }
}

.pkg__title {
  margin: 14px 0 0;
  color: var(--ink-900);
  font-family: var(--font-serif);
  font-size: clamp(2.5rem, 1.5rem + 3.9vw, 4.25rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.pkg__title-accent { color: var(--blue-600); }

.pkg__lede {
  max-width: 44rem;
  margin-top: 16px;
  color: var(--slate-700);
  font-size: clamp(1.0625rem, 0.98rem + 0.35vw, 1.25rem);
  line-height: 1.5;
}

.pkg__lede span { display: block; }

/* ---- Consultation callout ------------------------------------------------------ */

.pkg-call {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px 16px;
  padding: 18px;
  border: 1px solid var(--color-border);
  border-radius: var(--r-xl);
  background: var(--paper);
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.04), 0 20px 40px -32px rgb(15 23 42 / 0.40);
}

.pkg-call__icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--color-primary-soft);
  color: var(--blue-600);
}

.pkg-call__title {
  color: var(--ink-900);
  font-size: 1rem;
  font-weight: 700;
}

.pkg-call__text {
  margin-top: 4px;
  color: var(--slate-600);
  font-size: 0.875rem;
  line-height: 1.45;
}

/* Ink, so the section's blue stays on the serif accent; full width on phones. */
.pkg-call__btn {
  grid-column: 1 / -1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding-inline: 20px;
  border-radius: var(--r-md);
  background: var(--ink-900);
  color: var(--paper);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--t-fast) var(--ease-out), transform var(--t-fast) var(--ease-out);
}

.pkg-call__btn:hover { background: var(--slate-800); }
.pkg-call__btn:active { transform: translateY(1px); }
.pkg-call__btn:focus-visible { outline-offset: 3px; }
.pkg-call__btn .icon { transition: transform var(--t-base) var(--ease-out); }
.pkg-call__btn:hover .icon { transform: translateX(3px); }

@media (min-width: 640px) {
  .pkg-call { grid-template-columns: auto minmax(0, 1fr) auto; padding: 18px 20px; }
  .pkg-call__btn { grid-column: auto; }
}

/* ---- Filter ------------------------------------------------------------------ */

.pkg-filter {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-bottom: clamp(18px, 2.4vw, 28px);
}

html:not(.js) .pkg-filter { display: none; }

.pkg-filter__track {
  display: flex;
  gap: 8px;
  min-width: 0;
  padding: 6px;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
  border: 1px solid var(--color-border);
  border-radius: 16px;
  background: var(--paper);
}

.pkg-filter__track::-webkit-scrollbar { display: none; }

.pkg-filter__tab {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding-inline: 14px 16px;
  scroll-snap-align: start;
  border: 0;
  border-radius: 11px;
  background: none;
  color: var(--slate-700);
  font-size: 0.9375rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color var(--t-base) var(--ease-out), color var(--t-base) var(--ease-out);
}

.pkg-filter__tab:focus-visible { outline-offset: -2px; }

@media (hover: hover) {
  .pkg-filter__tab:hover { background: var(--slate-100); color: var(--ink-900); }
}

.pkg-filter__tab[aria-pressed="true"] {
  background: var(--blue-600);
  color: var(--paper);
  box-shadow: 0 8px 18px -10px rgb(37 99 235 / 0.65);
}

.pkg-filter__tab[aria-pressed="true"]:focus-visible { outline-color: var(--ink-900); }

/* Logos sit on a small paper chip so they read on the blue active pill too. */
.pkg-filter__tab .pkg-mark--logo {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--paper);
}

.pkg-filter__tab .pkg-mark--logo svg { width: 15px; height: 15px; }
.pkg-filter__tab .pkg-mark--icon { display: grid; }

.pkg-filter__note {
  display: none;
  position: relative;
  flex-shrink: 0;
  padding-bottom: 20px;
  color: var(--slate-700);
  font-family: var(--font-hand);
  font-size: 1.0625rem;
  line-height: 1.25;
  transform: rotate(-6deg);
}

.pkg-filter__note span { display: block; }

.pkg-filter__note svg {
  position: absolute;
  left: -64px;
  bottom: -6px;
  width: 60px;
  height: 30px;
  color: var(--ink-900);
}

@media (min-width: 1280px) {
  .pkg-filter__note { display: block; margin-left: 56px; }
}

/* Phones: the track runs off the edge (fade hints at more) instead of wrapping. */
@media (max-width: 639.98px) {
  .pkg-filter { margin-inline: calc(-1 * var(--pkg-pad)); }
  .pkg-filter__track {
    flex: 1;
    padding-inline: var(--pkg-pad);
    border-inline: 0;
    border-radius: 0;
    background: none;
    border: 0;
    scroll-padding-inline: var(--pkg-pad);
    -webkit-mask-image: linear-gradient(90deg, #000 88%, transparent);
    mask-image: linear-gradient(90deg, #000 88%, transparent);
  }
  .pkg-filter__tab {
    border: 1px solid var(--color-border);
    background: var(--paper);
  }
  .pkg-filter__tab[aria-pressed="true"] { border-color: var(--blue-600); }
}

/* ---- Grid -------------------------------------------------------------------- */

.pkg__grid {
  display: grid;
  gap: 16px;
}

@media (min-width: 640px) {
  .pkg__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pkg-card:last-child {
    grid-column: 1 / -1;
    justify-self: center;
    width: calc(50% - 8px);
  }
}

@media (min-width: 960px) {
  .pkg__grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .pkg-card { grid-column: span 2; }
  .pkg-card:nth-child(n + 4) { grid-column: span 3; }
  .pkg-card:last-child { justify-self: stretch; width: auto; }
}

@media (min-width: 1280px) {
  .pkg__grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    grid-template-rows: repeat(7, auto);
    row-gap: 0;
  }
  .pkg-card,
  .pkg-card:nth-child(n + 4),
  .pkg-card:last-child {
    grid-column: auto;
    grid-row: span 7;
    display: grid;
    grid-template-rows: subgrid;
  }
}

/* ---- Card -------------------------------------------------------------------- */

.pkg-card { scroll-margin-top: calc(var(--bar-h) + 16px); }

.pkg-card__body {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 22px 20px 20px;
  border: 1px solid var(--tone-line);
  border-radius: var(--r-xl);
  background: linear-gradient(180deg, color-mix(in srgb, var(--tone-bg) 70%, var(--paper)) 0%, var(--paper) 58%);
  box-shadow: 0 1px 2px rgb(15 23 42 / 0.04), 0 14px 30px -26px rgb(15 23 42 / 0.32);
  transition:
    transform var(--t-base) var(--ease-out),
    border-color var(--t-base) var(--ease-out),
    opacity var(--t-base) var(--ease-out);
}

/* Lift shadow on a pseudo-element so only its opacity animates. */
.pkg-card__body::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  box-shadow: 0 28px 50px -30px rgb(15 23 42 / 0.42);
  opacity: 0;
  transition: opacity var(--t-base) var(--ease-out);
  pointer-events: none;
}

@media (min-width: 1280px) {
  .pkg-card__body {
    grid-row: 1 / -1;
    display: grid;
    grid-template-rows: subgrid;
  }
  .pkg-card__title { align-self: end; }
}

/* Hover (pointer devices) and the filter's pick share one look. */
.pkg-card.is-picked .pkg-card__body { transform: translateY(-4px); border-color: var(--tone-edge); }
.pkg-card.is-picked .pkg-card__body::before { opacity: 1; }
.pkg-card.is-picked .pkg-card__cta { background: var(--ink-900); border-color: var(--ink-900); color: var(--paper); }

@media (hover: hover) {
  .pkg-card__body:hover { transform: translateY(-4px); border-color: var(--tone-edge); }
  .pkg-card__body:hover::before { opacity: 1; }
  .pkg-card__body:hover .pkg-card__mark { transform: translateY(-2px) rotate(-4deg); }
  .pkg-card__body:hover .pkg-card__cta { background: var(--ink-900); border-color: var(--ink-900); color: var(--paper); }
  .pkg-card__body:hover .pkg-card__cta .icon { transform: translateX(3px); }
}

.pkg-card__body:focus-within { border-color: var(--tone-edge); }

/* A pick quiets the other four: colour drains (wash, border, mark, visual) but the
   text keeps full contrast, so every card stays readable. Hover brings one back. */
.pkg__grid[data-picked] .pkg-card:not(.is-picked) .pkg-card__body:not(:hover, :focus-within) {
  border-color: var(--color-border);
  background: var(--paper);
}

.pkg__grid[data-picked] .pkg-card:not(.is-picked) .pkg-card__body:not(:hover, :focus-within) :is(.pkg-card__mark, .pkg-card__viz, .pkg-card__features .icon) {
  opacity: 0.4;
  filter: grayscale(1);
}

.pkg-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.pkg-card__mark {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--paper);
  box-shadow: var(--pkg-tile-shadow);
  color: var(--ink-900);
  transition: transform var(--t-base) var(--ease-out);
}

.pkg-card__mark .pkg-mark { display: grid; }
.pkg-card__mark .pkg-mark--logo svg { width: 30px; height: 30px; }

.pkg-card__mark--solid {
  background: var(--tone-mark);
  color: var(--paper);
}

.pkg-card__num {
  padding: 4px 9px;
  border: 1px solid var(--tone-line);
  border-radius: 8px;
  background: color-mix(in srgb, var(--tone-bg) 80%, var(--paper));
  color: var(--slate-600);
  font-size: 0.75rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
}

.pkg-card__title {
  margin: 18px 0 0;
  color: var(--ink-900);
  font-family: var(--font-serif);
  font-size: 1.625rem;
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.pkg-card__summary {
  margin-top: 8px;
  color: var(--slate-700);
  font-size: 0.9375rem;
  line-height: 1.45;
}

.pkg-card__features {
  display: grid;
  align-content: start;
  gap: 8px;
  margin-top: 16px;
}

.pkg-card__features li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--slate-800);
  font-size: 0.9375rem;
  line-height: 1.35;
}

.pkg-card__features .icon {
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--tone-mark);
}

.pkg-card__viz { margin-top: 18px; }

.pkg-card__pricing {
  margin-top: 14px;
  color: var(--slate-600);
  font-size: 0.8125rem;
  line-height: 1.4;
}

.pkg-card__cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  margin-top: 12px;
  padding-inline: 14px;
  border: 1.5px solid var(--ink-900);
  border-radius: var(--r-md);
  background: var(--paper);
  color: var(--ink-900);
  font-size: 0.9375rem;
  font-weight: 600;
  text-decoration: none;
  transition: background-color var(--t-base) var(--ease-out), color var(--t-base) var(--ease-out);
}

.pkg-card__cta .icon { flex-shrink: 0; transition: transform var(--t-base) var(--ease-out); }
.pkg-card__cta > span:first-child { white-space: nowrap; }

/* Five-up between 1280 and 1439 leaves ~190px per card: tighten so every CTA stays on one line. */
@media (min-width: 1280px) and (max-width: 1439.98px) {
  .pkg-card__body { padding-inline: 16px; }
  .pkg-card__cta { gap: 6px; padding-inline: 8px; font-size: 0.8125rem; }
}

/* The whole card is the link's hit area; the ring goes round the card. */
.pkg-card__cta::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  border-radius: var(--r-xl);
}

.pkg-card__cta:focus-visible { outline: none; }
.pkg-card__cta:focus-visible::after { outline: 2px solid var(--color-focus); outline-offset: 3px; }

/* ---- Mini visuals (decorative) ---------------------------------------------- */

.pkg-viz {
  position: relative;
  display: flex;
  align-items: center;
  height: 96px;
  padding: 12px;
  overflow: hidden;
  border: 1px solid var(--tone-line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--slate-600);
  font-size: 0.6875rem;
  font-weight: 600;
}

.pkg-viz__tile {
  display: grid;
  flex-shrink: 0;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--paper);
  box-shadow: var(--pkg-tile-shadow);
  color: var(--ink-900);
}

.pkg-viz__tile svg { width: 20px; height: 20px; }

.pkg-viz__link {
  flex: 1;
  min-width: 10px;
  height: 0;
  border-top: 2px dashed var(--tone-edge);
}

/* search visibility */
.pkg-viz--search {
  flex-direction: column;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
}

.pkg-viz__bar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 22px;
  padding-inline: 8px;
  border: 1px solid var(--slate-200);
  border-radius: 999px;
  color: var(--slate-400);
}

.pkg-viz__bar i { width: 55%; height: 5px; border-radius: 3px; background: var(--slate-200); }

.pkg-viz__row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 8px;
}

.pkg-viz__row i { height: 5px; border-radius: 3px; background: var(--slate-200); }
.pkg-viz__row i:first-child { width: 42%; }
.pkg-viz__row i:nth-child(2) { width: 22%; }

.pkg-viz__row.is-top { padding-left: 5px; border-left: 3px solid var(--tone-mark); }
.pkg-viz__row.is-top i:first-child { background: color-mix(in srgb, var(--tone-mark) 70%, var(--paper)); }
.pkg-viz__row.is-top .icon { margin-left: auto; color: var(--tone-mark); }

/* campaign → click → conversion */
.pkg-viz--flow { justify-content: space-between; }

.pkg-viz__node {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.pkg-viz--flow .pkg-viz__link { margin: 0 6px 18px; }
.pkg-viz__tile.is-goal { background: var(--tone-mark); color: var(--paper); }

/* Google + Meta → funnel */
.pkg-viz--funnel { gap: 10px; }

.pkg-viz__sources {
  display: grid;
  gap: 8px;
}

.pkg-viz__sources .pkg-viz__tile { width: 32px; height: 32px; }
.pkg-viz__sources .pkg-viz__tile svg { width: 18px; height: 18px; }
.pkg-viz__arrow { flex-shrink: 0; color: var(--slate-400); }

.pkg-viz__cone {
  display: grid;
  flex: 1;
  justify-items: center;
  gap: 5px;
}

.pkg-viz__cone i { height: 16px; border-radius: 5px; background: var(--tone-mark); }
.pkg-viz__cone i:nth-child(1) { width: 100%; opacity: 0.22; }
.pkg-viz__cone i:nth-child(2) { width: 68%; opacity: 0.45; }
.pkg-viz__cone i:nth-child(3) { width: 36%; opacity: 0.9; }

/* n8n → AI → Sheets / CRM */
.pkg-viz--workflow .pkg-viz__tile { width: 34px; height: 34px; }
.pkg-viz--workflow .pkg-viz__link { margin-inline: 4px; }

.pkg-viz__branch {
  position: relative;
  display: grid;
  gap: 8px;
  padding-left: 12px;
}

.pkg-viz__branch::before {
  content: "";
  position: absolute;
  left: 0;
  top: 17px;
  bottom: 17px;
  width: 10px;
  border: 2px dashed var(--tone-edge);
  border-right: 0;
  border-radius: 6px 0 0 6px;
}

.pkg-viz__tile--db { color: var(--blue-600); }

/* page + Core Web Vitals */
.pkg-viz--vitals { gap: 12px; }

.pkg-viz__window {
  position: relative;
  flex: 1;
  align-self: stretch;
  overflow: hidden;
  border: 1px solid var(--slate-200);
  border-radius: 8px;
}

.pkg-viz__window::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 14px;
  background: color-mix(in srgb, var(--tone-mark) 14%, var(--paper));
}

.pkg-viz__dots {
  position: absolute;
  top: 5px;
  left: 6px;
  display: flex;
  gap: 3px;
}

.pkg-viz__dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--tone-mark); opacity: 0.6; }

.pkg-viz__lines {
  position: absolute;
  inset: 24px 8px auto;
  display: grid;
  gap: 6px;
}

.pkg-viz__lines i { height: 5px; border-radius: 3px; background: var(--slate-200); }
.pkg-viz__lines i:nth-child(2) { width: 75%; }
.pkg-viz__lines i:nth-child(3) { width: 55%; }

.pkg-viz__metrics {
  display: grid;
  gap: 7px;
  color: var(--slate-700);
  letter-spacing: 0.04em;
}

.pkg-viz__metrics span { display: flex; align-items: center; gap: 6px; }
.pkg-viz__metrics b { width: 8px; height: 8px; border-radius: 50%; background: var(--tone-mark); }
