/* ==========================================================================
   ERRORMATIC — SHARED PAGE COMPONENTS
   Used by more than one page (home, about hub, service pages, etc).
   Load after base.css, before the page-specific stylesheet.
   ========================================================================== */

/* ---------- Section shell ---------- */
section { padding-block: var(--sp-8); position: relative; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--sp-5);
  margin-bottom: var(--sp-6);
}
.section-head h2 { max-width: 16ch; }
.section-head p { color: var(--c-slate); max-width: 38ch; font-size: var(--fs-body-lg); }

.hero-actions { display: flex; gap: var(--sp-3); margin-top: var(--sp-5); flex-wrap: wrap; }

/* ---------- Trust / logos marquee ---------- */
.trust-strip {
  padding-block: var(--sp-5);
  background: var(--c-ink);
  border-top: 1px solid var(--c-line);
  border-bottom: 1px solid var(--c-line);
}
.trust-strip .container { display: flex; align-items: center; gap: var(--sp-6); }
.trust-strip .eyebrow { flex-shrink: 0; color: var(--c-circuit); }
.marquee { overflow: hidden; flex: 1; mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.marquee-track { display: flex; gap: var(--sp-7); width: max-content; animation: marqueeScroll 28s linear infinite; }
.marquee-track span { font-family: var(--f-mono); font-size: 1.05rem; color: var(--c-slate-on-dark); white-space: nowrap; text-transform: uppercase; letter-spacing: 0.04em; }
@keyframes marqueeScroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }

/* ---------- Stats ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-top: 1px solid var(--c-line);
  border-left: 1px solid var(--c-line);
}
.stat-card { padding: var(--sp-6) var(--sp-4); border-right: 1px solid var(--c-line); border-bottom: 1px solid var(--c-line); }
.stat-card .stat-num {
  font-family: var(--f-display);
  font-size: var(--fs-h2);
  font-weight: 600;
  display: flex;
  align-items: baseline;
  gap: 2px;
  background: var(--grad-brand);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stat-card .stat-label { color: var(--c-slate); font-size: 0.9375rem; margin-top: var(--sp-2); }
@media (max-width: 860px) { .stats-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---------- CTA band ---------- */
.cta-band {
  background: var(--grad-dark);
  color: var(--c-text);
  border-radius: var(--r-lg);
  margin-inline: var(--container-pad);
  padding: var(--sp-8) var(--sp-6);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.cta-band > * { position: relative; z-index: 1; }
.cta-band h2 { color: var(--c-text); max-width: 20ch; margin-inline: auto; }
.cta-band p { color: var(--c-slate-on-dark); margin-top: var(--sp-3); }
.cta-band .hero-actions { justify-content: center; }
.cta-band .btn-primary { background: var(--c-text); color: var(--c-ink); box-shadow: none; }
.cta-band .btn-primary:hover { background: var(--c-circuit); color: var(--c-ink); box-shadow: 0 8px 28px var(--glow-circuit); }
.cta-band .btn-ghost { border-color: var(--c-line); color: var(--c-text); }

/* Only pre-hide reveal content when JS is confirmed running (html.js,
   set inline in <head>) — keeps content visible for no-JS/blocked-CDN cases. */
.js [data-reveal] { opacity: 0; transform: translateY(24px); }

/* ---------- Hub grid (About hub, Services hub — same link-card pattern) ---------- */
.hub-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--c-line);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.hub-card {
  background: var(--c-paper-raised);
  padding: var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  min-height: 220px;
  border: 1px solid var(--c-line);
  transition: box-shadow var(--dur-fast), transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast);
}
.hub-card:hover { box-shadow: var(--shadow-lg), 0 12px 32px var(--glow-signal); transform: translateY(-4px); border-color: var(--c-signal); }
.hub-card .idx { font-family: var(--f-mono); font-size: 0.8125rem; color: var(--c-slate); }
.hub-card h3 { font-size: var(--fs-h5); margin-top: auto; }
.hub-card p { color: var(--c-slate); font-size: 0.9375rem; }
.hub-card .go { display: flex; align-items: center; gap: var(--sp-2); font-family: var(--f-mono); font-size: 0.8125rem; margin-top: var(--sp-2); color: var(--c-signal); }
.hub-card .go svg { width: 14px; height: 14px; transition: transform var(--dur-fast) var(--ease-out); }
.hub-card:hover .go svg { transform: translate(3px, -3px); }
@media (max-width: 860px) { .hub-grid { grid-template-columns: 1fr; } }

/* ---------- Portfolio grid (Home featured work, Service page project samples) ----------
   Layer order (z-index): photo (1) → gradient scrim + title (2).
   Drop a real project photo in as <img class="thumb-img" src="..."> inside
   .thumb; the placeholder gradient behind it shows until then. */
.portfolio-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--sp-4); }
.portfolio-card { position: relative; border-radius: var(--r-md); overflow: hidden; aspect-ratio: 4 / 3; cursor: pointer; transition: box-shadow var(--dur-fast); }
.portfolio-card:hover { box-shadow: 0 16px 40px var(--glow-signal); }
.portfolio-card .thumb {
  position: absolute; inset: 0;
  z-index: 1;
  background: linear-gradient(135deg, var(--c-ink) 0%, var(--c-ink-soft) 100%);
  display: flex; align-items: center; justify-content: center;
  transition: transform var(--dur-med) var(--ease-out);
}
.portfolio-card .thumb-img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.portfolio-card:hover .thumb { transform: scale(1.05); }
.portfolio-card .thumb-mark { font-family: var(--f-display); font-size: 3rem; font-weight: 600; color: rgba(244, 246, 251, 0.15); }
.portfolio-card .overlay {
  position: absolute; inset: 0;
  z-index: 2;
  background: linear-gradient(0deg, rgba(4, 6, 14, 0.94) 0%, rgba(4, 6, 14, 0.4) 45%, rgba(4, 6, 14, 0) 72%);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding: var(--sp-4);
  color: var(--c-text);
}
.portfolio-card .cat { font-family: var(--f-mono); font-size: 0.75rem; color: var(--c-circuit); text-transform: uppercase; letter-spacing: 0.06em; }
.portfolio-card .title { font-family: var(--f-display); font-size: var(--fs-h5); font-weight: 600; margin-top: 4px; }
@media (max-width: 860px) { .portfolio-grid { grid-template-columns: 1fr; } }

/* ---------- Approach / process steps ---------- */
/* Oversized step numerals — Digital Silk's signature move on process
   sections. Generated with a CSS counter so no markup changes are
   needed; the number sits large and light behind the step content. */
.approach-list { display: flex; flex-direction: column; counter-reset: step-counter; }
.approach-item {
  position: relative;
  counter-increment: step-counter;
  display: grid;
  grid-template-columns: 140px 90px 1fr 1.2fr;
  gap: var(--sp-5);
  padding-block: var(--sp-6);
  border-top: 1px solid var(--c-line);
  align-items: center;
}
.approach-item::before {
  content: counter(step-counter, decimal-leading-zero);
  font-family: var(--f-display);
  font-size: var(--fs-giant);
  font-weight: 600;
  line-height: 0.8;
  color: transparent;
  -webkit-text-stroke: 1.5px rgba(100, 155, 255, 0.5);
}
.approach-item:last-child { border-bottom: 1px solid var(--c-line); }
.approach-item .tag { font-family: var(--f-mono); font-size: 0.8125rem; color: var(--c-signal); text-transform: uppercase; letter-spacing: 0.06em; text-shadow: 0 0 10px currentColor; }
.approach-item h4 { font-size: var(--fs-h5); }
.approach-item p { color: var(--c-slate); }
@media (max-width: 900px) {
  .approach-item { grid-template-columns: 90px 1fr; }
  .approach-item::before { display: none; }
}
@media (max-width: 760px) { .approach-item { grid-template-columns: 1fr; gap: var(--sp-2); } }

/* ---------- Testimonials (Swiper) ---------- */
.testimonial-swiper { overflow: hidden; padding-bottom: var(--sp-6) !important; }
.testimonial-swiper .swiper-slide { height: auto; }
.testimonial-card {
  position: relative;
  height: 100%;
  background: var(--c-paper-raised);
  border: 1px solid var(--c-line);
  border-radius: var(--r-lg);
  padding: var(--sp-6) var(--sp-5) var(--sp-5);
  display: flex;
  flex-direction: column;
  gap: var(--sp-4);
  overflow: hidden;
}
/* Oversized decorative quotation mark, Digital Silk's editorial-quote
   treatment — sits large and faint in the corner, behind the real text. */
.testimonial-card::before {
  content: "\201C";
  position: absolute;
  top: -0.3em;
  left: 0.2em;
  font-family: var(--f-display);
  font-size: 7rem;
  font-weight: 600;
  color: rgba(100, 155, 255, 0.2);
  line-height: 1;
  z-index: 0;
}
.testimonial-card .quote { position: relative; z-index: 1; font-family: var(--f-display); font-size: 1.5rem; font-weight: 500; line-height: var(--lh-snug); }
.testimonial-card .who { position: relative; z-index: 1; display: flex; align-items: center; gap: var(--sp-3); margin-top: auto; }
.testimonial-card .avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--c-circuit-soft); color: var(--c-circuit); display: flex; align-items: center; justify-content: center; font-family: var(--f-display); font-weight: 600; }
.testimonial-card .who-name { font-weight: 600; font-size: 0.9375rem; }
.testimonial-card .who-role { font-size: 0.8125rem; color: var(--c-slate); }
.testimonial-swiper .swiper-pagination-bullet { background: var(--c-line); opacity: 1; width: 8px; height: 8px; }
.testimonial-swiper .swiper-pagination-bullet-active { background: var(--c-signal); }
.swiper-nav-row { display: flex; justify-content: flex-end; gap: var(--sp-2); margin-top: var(--sp-4); }
.swiper-nav-btn {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--c-line);
  display: flex; align-items: center; justify-content: center;
  transition: background var(--dur-fast), border-color var(--dur-fast);
}
.swiper-nav-btn:hover { background: var(--c-signal); color: var(--c-ink); border-color: var(--c-signal); }
.swiper-nav-btn svg { width: 18px; height: 18px; }

/* ==========================================================================
   PERFORMANCE
   ========================================================================== */

/* Skip layout/paint for offscreen sections until they scroll near the
   viewport. contain-intrinsic-size supplies a placeholder height so the
   scrollbar doesn't jump as sections are realised. Progressive enhancement:
   browsers without support simply render as before. */
main > section {
  content-visibility: auto;
  contain-intrinsic-size: auto 600px;
}
/* The hero and the first band must never be deferred — they're above the fold
   and deferring them would delay Largest Contentful Paint. */
main > .hero,
main > .page-intro,
main > .trust-strip {
  content-visibility: visible;
}

/* Promote only the elements that actually animate transform/opacity, so the
   compositor isn't handed layers it doesn't need. */
.hero-canvas, .page-canvas, .marquee-track { will-change: transform; }

/* Reserve space for images so they can't shift layout as they decode. */
.portfolio-card .thumb-img { background: var(--c-paper-raised); }
