/* ==========================================================================
   Shared components (task 5): section head, project/product card, compact
   service panel, accordion, closing CTA band, inverse button.
   Mobile-first, min-width queries only. Diagonals use the V angle (--v-slope).
   ========================================================================== */

/* ------------------------------------------------------------ Section head */
.section-head { display: grid; justify-items: start; gap: var(--space-4); margin-bottom: var(--space-7); }
.section-head .display { max-width: 18ch; }
.section-head__links { display: flex; flex-wrap: wrap; column-gap: var(--space-6); }
.section-head__link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--tap-target-min);
  font-weight: var(--font-weight-semibold);
  text-decoration: none;
}
.section-head__link:hover { text-decoration: underline; }
@media (min-width: 960px) {
  .section-head { grid-template-columns: minmax(0, 1fr) auto; align-items: end; column-gap: var(--space-gutter); margin-bottom: var(--space-8); }
  .section-head .label { grid-column: 1 / -1; }
  .section-head__links { padding-bottom: 0.1em; }
}

/* -------------------------------------------------------- Stat (counter)
   Big number + mono label; used on Home (proof strip) and About. */
.stat { display: flex; align-items: flex-end; gap: var(--space-4); }
.stat__num { font-size: var(--font-size-3xl); line-height: 0.8; font-variant-numeric: tabular-nums; }
.stat .label { max-width: 14ch; padding-bottom: 0.2em; }

/* ---------------------------------------------------------- Inverse button
   White on the red CTA band (text #0A0D14 on #FFF). */
.button--inverse { background: var(--brand-white); color: var(--color-text-inverse); }
.button--inverse:hover { background: var(--color-bg-inverse); }
.button--inverse::after { background: linear-gradient(90deg, transparent, rgb(191 10 48 / 0.18), transparent); }

/* --------------------------------------------------- Project / product card */
.card {
  --notch: 1.25rem;
  display: flex;
  flex-direction: column;
  height: 100%;
  color: inherit;
  text-decoration: none;
}
.card__media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: var(--color-bg-secondary);
  /* corner notch at the V angle (bottom right, leaning like the V stripes) */
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - var(--notch) / var(--v-slope)), calc(100% - var(--notch)) 100%, 0 100%);
}
.card__media picture, .card__media img { width: 100%; height: 100%; }
.card__media img { object-fit: cover; transition: transform var(--duration-slower) var(--easing-out); }
.card:hover .card__media img, .card:focus-visible .card__media img { transform: scale(1.03); }
.card__media::after {
  content: "";
  position: absolute;
  z-index: 3;
  inset: -20% auto -20% 0;
  width: 35%;
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / 0.18) 45%, rgb(255 255 255 / 0.28) 50%, rgb(255 255 255 / 0.18) 55%, transparent);
  transform: translateX(-150%) skewX(calc(-1 * var(--v-lean)));
  pointer-events: none;
}
.card:hover .card__media::after,
.card:focus-visible .card__media::after {
  transform: translateX(400%) skewX(calc(-1 * var(--v-lean)));
  transition: transform var(--duration-sweep) var(--easing-out);
}
.card:focus-visible { box-shadow: none; }
.card:focus-visible .card__media { outline: 2px solid var(--color-border-focus); outline-offset: -2px; }
.card:focus-visible .card__title { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.15em; }

.card__body {
  display: grid;
  align-content: start;
  gap: var(--space-2);
  padding-top: var(--space-5);
  border-top: 0;
}
.card__meta { display: flex; align-items: center; gap: var(--space-3); min-height: 1.5rem; }
.card__num { color: var(--color-text-link); }
.card__logo { height: 1.25rem; width: auto; margin-left: auto; opacity: 0.85; }
.card__title {
  font-size: var(--font-size-xl);
  font-stretch: var(--font-stretch-display);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-tight);
  letter-spacing: var(--letter-spacing-tight);
  text-transform: uppercase;
  margin-top: var(--space-2);
}
.card__descriptor { color: var(--color-text-secondary); }
.card__spec {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2) var(--space-3);
  margin-top: var(--space-3);
  padding-top: var(--space-3);
  border-top: var(--border-width-hairline) solid var(--color-border-primary);
}
.card__spec-value {
  font-family: var(--font-family-numeric);
  font-size: var(--font-size-lg);
  font-stretch: var(--font-stretch-label);
  font-weight: var(--font-weight-bold);
  font-variant-numeric: tabular-nums;
}
.card__cta {
  margin-top: var(--space-2);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-link);
}
@media (min-width: 960px) {
  .card { --notch: 2rem; }
}
@media (prefers-reduced-motion: reduce) {
  .card__media::after { display: none; }
  .card:hover .card__media img, .card:focus-visible .card__media img { transform: none; }
}

/* ------------------------------------------------- Service panel (compact)
   Image is a parallelogram at the V angle; in a row they read as slanted panels. */
.service-panel {
  --media-h: 4.5rem;
  --cut: calc(var(--media-h) * var(--v-slope));
  display: grid;
  grid-template-columns: 7rem minmax(0, 1fr);
  gap: var(--space-4);
  align-items: start;
  align-content: start;
  height: 100%;
  padding-block: var(--space-4);
  color: inherit;
  text-decoration: none;
}
.service-panel__media {
  position: relative;
  height: var(--media-h);
  overflow: hidden;
  background: var(--color-bg-secondary);
  clip-path: polygon(var(--cut) 0, 100% 0, calc(100% - var(--cut)) 100%, 0 100%);
}
.service-panel__media picture, .service-panel__media img { width: 100%; height: 100%; }
.service-panel__media img {
  object-fit: cover;
  filter: grayscale(0.6) brightness(0.85);
  transition: filter var(--duration-normal) var(--easing-default), transform var(--duration-slower) var(--easing-out);
}
.service-panel:hover .service-panel__media img,
.service-panel:focus-visible .service-panel__media img { filter: none; transform: scale(1.04); }
.service-panel__body { display: grid; gap: var(--space-1); }
.service-panel__num { color: var(--color-text-link); }
.service-panel__title {
  font-size: var(--font-size-md);
  font-stretch: var(--font-stretch-label);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-snug);
}
.service-panel__text { color: var(--color-text-secondary); font-size: var(--font-size-sm); }
.service-panel:focus-visible { box-shadow: none; }
.service-panel:focus-visible .service-panel__media { outline: 2px solid var(--color-border-focus); outline-offset: -2px; }
.service-panel:focus-visible .service-panel__title { text-decoration: underline; text-underline-offset: 0.15em; }

@media (min-width: 640px) {
  .service-panel { --media-h: 8.5rem; grid-template-columns: minmax(0, 1fr); gap: var(--space-4); padding-block: 0; }
}
@media (min-width: 960px) {
  .service-panel { --media-h: 10rem; }
  .service-panel__title { font-size: var(--font-size-lg); }
}
@media (prefers-reduced-motion: reduce) {
  .service-panel:hover .service-panel__media img { transform: none; }
}

/* --------------------------------------------------------------- Accordion */
:root { interpolate-size: allow-keywords; }
.accordion { border-bottom: var(--border-width-hairline) solid var(--color-border-primary); }
.accordion:first-child { border-top: var(--border-width-hairline) solid var(--color-border-primary); }
.accordion__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  min-height: var(--tap-target-min);
  padding-block: var(--space-5);
  cursor: pointer;
  list-style: none;
  font-size: var(--font-size-md);
  font-stretch: var(--font-stretch-label);
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-snug);
  transition: color var(--duration-fast) var(--easing-default);
}
.accordion__summary::-webkit-details-marker { display: none; }
.accordion__summary:hover { color: var(--color-text-link); }
.accordion__summary:focus-visible { box-shadow: var(--shadow-focus); }
/* plus → minus; the horizontal bar is red */
.accordion__icon { position: relative; flex: none; width: 1.25rem; height: 1.25rem; }
.accordion__icon::before, .accordion__icon::after {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 50%;
  height: 2px;
  margin-top: -1px;
  background: currentColor;
  transition: transform var(--duration-normal) var(--easing-out);
}
.accordion__icon::before { background: var(--color-accent-primary); }
.accordion__icon::after { transform: rotate(90deg); }
.accordion[open] .accordion__icon::after { transform: rotate(0deg) scaleX(0); }
.accordion__a { padding-bottom: var(--space-6); padding-right: var(--space-7); }
.accordion__link { display: inline-flex; align-items: center; gap: var(--space-2); min-height: var(--tap-target-min); font-weight: var(--font-weight-semibold); }
/* Smooth open/close where supported (::details-content); instant elsewhere. */
.accordion::details-content {
  block-size: 0;
  overflow: clip;
  transition: block-size var(--duration-slow) var(--easing-out), content-visibility var(--duration-slow) allow-discrete;
}
.accordion[open]::details-content { block-size: auto; }

/* ---------------------------------------------------------- CTA band
   A red panel whose right end is cut at the V angle, trailed by white and navy
   stripes in the mark's proportions. Revealed by the stripe wipe (data-wipe). */
.cta-band { padding-top: var(--space-section); }
.cta-band__panel {
  --unit: clamp(0.6rem, 1.4vw, 1.25rem);
  --stripes: calc(var(--unit) * (var(--v-ratio-white) + var(--v-ratio-navy)));
  position: relative;
  isolation: isolate;
  overflow: hidden;
  color: var(--color-text-on-accent);
}
/* Phones: the panel is tall, so a full-height slant would cut into the text.
   Keep it rectangular; the white + navy stripes cut in at the top-right corner. */
.cta-band__bg { position: absolute; z-index: -1; inset: 0; background: var(--v-red); }
.cta-band__bg span { display: none; }
.cta-band__panel::before {
  content: "";
  position: absolute;
  z-index: 0;
  top: 0; right: var(--space-6);
  width: calc(var(--unit) * (var(--v-ratio-white) + var(--v-ratio-navy) + 2));
  height: var(--space-8);
  background: linear-gradient(90deg,
    var(--color-bg-primary) 0 calc(var(--unit)),
    var(--v-white) 0 calc(var(--unit) * (1 + var(--v-ratio-white))),
    var(--color-bg-primary) 0 calc(var(--unit) * (2 + var(--v-ratio-white))),
    var(--v-navy) 0 calc(var(--unit) * (2 + var(--v-ratio-white) + var(--v-ratio-navy))),
    var(--color-bg-primary) 0);
  transform: skewX(calc(-1 * var(--v-lean)));
  transform-origin: top;
}
.cta-band__content {
  position: relative;
  display: grid;
  justify-items: start;
  gap: var(--space-6);
  padding: var(--space-9) var(--space-5) var(--space-8);
}
@media (min-width: 640px) {
  /* A red band whose right end is cut at the V angle, trailed by white and navy stripes. */
  .cta-band__panel::before { display: none; }
  .cta-band__bg {
    inset: 0 calc(var(--stripes) + var(--space-8)) 0 -30%;  /* room on the right so the slanted end shows */
    display: flex;
    background: none;
    transform: skewX(calc(-1 * var(--v-lean)));
    transform-origin: 50% 50%;
  }
  .cta-band__bg span { display: block; }
  .cta-band__bg span:nth-child(1) { flex: 1; background: var(--v-red); }
  .cta-band__bg span:nth-child(2) { width: calc(var(--unit) * var(--v-ratio-white)); margin-left: var(--unit); background: var(--v-white); }
  .cta-band__bg span:nth-child(3) { width: calc(var(--unit) * var(--v-ratio-navy)); margin-left: var(--unit); background: var(--v-navy); }
  .cta-band__content { padding: var(--space-8) calc(var(--stripes) + var(--space-9)) var(--space-8) var(--space-7); }
}
.cta-band__title { font-size: var(--font-size-2xl); max-width: 14ch; }
.cta-band__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3) var(--space-6); }
.cta-band__phone {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--tap-target-min);
  font-family: var(--font-family-mono);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-on-accent);
  text-decoration: underline;
  text-decoration-color: rgb(255 255 255 / 0.5);
}
.cta-band__phone:hover { text-decoration-color: currentColor; }
.cta-band__or { font-family: var(--font-family-body); opacity: 0.85; }
.cta-band__note { font-size: var(--font-size-sm); opacity: 0.9; max-width: 40ch; }
/* white focus ring on red */
.cta-band a:focus-visible { box-shadow: 0 0 0 2px var(--v-red), 0 0 0 4px var(--brand-white); }

@media (min-width: 960px) {
  .cta-band__content { padding: var(--space-10) calc(var(--stripes) + var(--space-11)) var(--space-10) var(--space-9); }
  .cta-band__title { font-size: var(--font-size-3xl); max-width: 16ch; }
}

/* --------------------------------------------------------- Page hero (inner)
   Compact title block; three V stripes hang from the top-right and draw in once. */
.page-hero {
  --unit: clamp(0.5rem, 1.6vw, 1.5rem);
  --stripes-w: calc(var(--unit) * (var(--v-ratio-red) + var(--v-ratio-white) + var(--v-ratio-navy) + 1));  /* + 2 half-unit gaps */
  position: relative;
  overflow: hidden;
  padding-block: var(--space-9) var(--space-8);
  border-bottom: var(--border-width-hairline) solid var(--color-border-primary);
}
.page-hero__inner { position: relative; display: grid; justify-items: start; gap: var(--space-4); }
.page-hero__title { font-size: var(--font-size-4xl); }
.page-hero__lead { margin-top: var(--space-2); }
.page-hero__stripes {
  position: absolute;
  top: 0; bottom: 0;
  right: calc(var(--space-page) + var(--space-6));
  display: flex;
  gap: calc(var(--unit) * 0.5);
  transform: skewX(calc(-1 * var(--v-lean)));
  transform-origin: top;
  opacity: 0.9;
}
.page-hero__stripes span { display: block; height: 100%; transform-origin: top; animation: stripe-draw var(--duration-draw) var(--easing-out) both; }
.page-hero__stripes span:nth-child(1) { width: calc(var(--unit) * var(--v-ratio-red)); background: var(--v-red); }
.page-hero__stripes span:nth-child(2) { width: calc(var(--unit) * var(--v-ratio-white)); background: var(--v-white); animation-delay: var(--stagger-stripe); }
.page-hero__stripes span:nth-child(3) { width: calc(var(--unit) * var(--v-ratio-navy)); background: var(--v-navy); animation-delay: calc(var(--stagger-stripe) * 2); }
@keyframes stripe-draw { from { transform: scaleY(0); } to { transform: scaleY(1); } }
/* phones: stripes stay short so they never sit behind the title */
.page-hero__stripes { bottom: auto; height: var(--space-8); }
@media (min-width: 960px) {
  .page-hero { padding-block: var(--space-10) var(--space-9); }
  /* Full height. Anchored at the bottom, so the lean runs away from the text (up and to
     the right), and the text keeps clear of the stripes' footprint. */
  .page-hero__stripes { bottom: 0; height: auto; transform-origin: bottom; }
  .page-hero__inner { padding-right: calc(var(--space-page) + var(--space-6) + var(--stripes-w) + var(--space-6)); }
}
/* arriving through the page transition: the wipe was the entrance, so no second draw */
.vt-arrival .page-hero__stripes span { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .page-hero__stripes span { animation: none; }
}

/* -------------------------------------------------------------------- Tags */
.tags { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.tag {
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-target-min);
  padding-inline: var(--space-4);
  border-radius: var(--border-radius-sm);
  box-shadow: inset 0 0 0 1px var(--color-border-input);
  font-family: var(--font-family-mono);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  letter-spacing: var(--letter-spacing-wide);
  text-transform: uppercase;
  text-decoration: none;
  color: var(--color-text-primary);
  transition: box-shadow var(--duration-fast) var(--easing-default), background-color var(--duration-fast) var(--easing-default);
}
.tag:hover { box-shadow: inset 0 0 0 1px var(--color-text-primary); background: var(--color-bg-tertiary); }
.tag:focus-visible { box-shadow: var(--shadow-focus), inset 0 0 0 1px var(--color-text-primary); }

/* ---------------------------------------------------------- Bullet points
   Short red dash slanted at the V angle. */
.points { display: grid; gap: var(--space-3); padding: 0; list-style: none; color: var(--color-text-secondary); }
.points li { position: relative; padding-left: var(--space-6); }
.points li::before {
  content: "";
  position: absolute;
  left: 0; top: 0.72em;
  width: 1rem; height: 2px;
  background: var(--color-accent-primary);
}
