/* ==========================================================================
   Projects: engineering depth
   Demo buttons, architecture diagrams, the "behind the scenes" tabs, CI rows,
   code samples and the card hover. Loaded after style.css and built on its
   tokens; every class here starts with "eng-". Behaviour: engineering.js.
   ========================================================================== */

:root {
  --eng-ai: #6a3dd1;
  --eng-ai-soft: #f1ebff;
  --eng-data: #0e7490;
  --eng-data-soft: #e2f5fa;
  --eng-track: #c9d1e6;
  --eng-arrow: #7a83a3;
  --eng-glow: color-mix(in srgb, var(--brand) 38%, var(--line));
  --eng-band-bg: linear-gradient(180deg, #f3f6fc 0%, #ffffff 100%);
  --eng-foot-bg: #fafbfe;
  /* code stays dark in both themes, like an editor */
  --eng-code-bg: #0b1024;
  --eng-code-bar: #111834;
  --eng-code-line: #1f2847;
  --eng-code-ink: #dce3fb;
  --eng-code-dim: #b3bddf;

  /* flow arrows are masks, so they take the theme colour from background-color */
  --eng-arrow-left: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 12H5'/%3E%3Cpath d='m11 18-6-6 6-6'/%3E%3C/svg%3E");
  --eng-arrow-down: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v15'/%3E%3Cpath d='m6 13 6 6 6-6'/%3E%3C/svg%3E");
  --eng-arrow-both-h: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12h16'/%3E%3Cpath d='m8 8-4 4 4 4'/%3E%3Cpath d='m16 8 4 4-4 4'/%3E%3C/svg%3E");
  --eng-arrow-both-v: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 4v16'/%3E%3Cpath d='m8 8 4-4 4 4'/%3E%3Cpath d='m8 16 4 4 4-4'/%3E%3C/svg%3E");
}

:root[data-theme="dark"] {
  --eng-ai: #c4b5fd;
  --eng-ai-soft: #221a47;
  --eng-data: #5fd6ea;
  --eng-data-soft: #0b2833;
  --eng-track: #2e3960;
  --eng-arrow: #8b94b3;
  --eng-band-bg: linear-gradient(180deg, #0f1631 0%, #0d1329 100%);
  --eng-foot-bg: #0f1630;
  --eng-code-bg: #070b1c;
  --eng-code-bar: #0c1226;
  --eng-code-line: #1c2546;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --eng-ai: #c4b5fd;
    --eng-ai-soft: #221a47;
    --eng-data: #5fd6ea;
    --eng-data-soft: #0b2833;
    --eng-track: #2e3960;
    --eng-arrow: #8b94b3;
    --eng-band-bg: linear-gradient(180deg, #0f1631 0%, #0d1329 100%);
    --eng-foot-bg: #0f1630;
    --eng-code-bg: #070b1c;
    --eng-code-bar: #0c1226;
    --eng-code-line: #1c2546;
    }
}

/* the accessibility menu's high contrast: black, white and yellow */
html:root.a11y-contrast {
  --eng-ai: #dcc2ff;
  --eng-ai-soft: #000;
  --eng-data: #00e5ff;
  --eng-data-soft: #000;
  --eng-track: #fff;
  --eng-arrow: #fff;
  --eng-glow: #ffe600;
  --eng-band-bg: #000;
  --eng-foot-bg: #000;
  --eng-code-bg: #000;
  --eng-code-bar: #000;
  --eng-code-line: #fff;
  --eng-code-ink: #fff;
  --eng-code-dim: #fff;
}

/* a component that sets display must still disappear when [hidden] */
#projects [hidden] {
  display: none !important;
}

/* ---------- demo + screenshots buttons ---------- */

/* secondary on purpose: the showcase at the top of the section is the main way into the demo,
   and the consultation button stays the one primary action on the page */
.eng-demo {
  gap: 12px;
  min-height: 52px;
  padding-inline: 10px 20px;
  white-space: normal;
  line-height: 1.2;
  text-align: start;
}

.eng-demo__icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex: none;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  transition: background-color 0.2s ease, color 0.2s ease;
}

.eng-demo:hover .eng-demo__icon {
  background: var(--brand);
  color: var(--surface);
}

.eng-demo__icon .icon {
  width: 14px;
  height: 14px;
  margin-inline-start: 2px; /* optical centre of the triangle */
  fill: currentColor;
  stroke-width: 1.5;
}

.eng-demo__text {
  display: grid;
  gap: 3px;
}

.eng-demo__sub {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 500;
  line-height: 1.2;
}

.eng-shots {
  min-height: 52px;
  padding-inline: 20px;
  font-size: 0.95rem;
}

/* ---------- "behind the scenes" ---------- */

/* full-width rows under the two columns of a big card */
.eng-band,
.eng-foot {
  grid-column: 1 / -1;
  min-width: 0;
}

.eng-foot {
  padding: 6px clamp(20px, 3.5vw, 40px);
  border-top: 1px solid var(--line);
  background: var(--eng-foot-bg);
}

.eng-deep {
  margin: 0 0 20px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  transition: border-color 0.2s ease;
}

.eng-deep[open],
.eng-deep:hover {
  border-color: var(--eng-glow);
}

.eng-foot .eng-deep {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: none;
}

.eng-deep__summary {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 16px;
  border-radius: 14px;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.96rem;
  list-style: none;
  cursor: pointer;
}

.eng-foot .eng-deep__summary {
  min-height: 56px;
  padding-inline: 4px;
  border-radius: 10px;
}

.eng-deep__summary::-webkit-details-marker {
  display: none;
}

.eng-deep__summary > .icon:first-child {
  color: var(--brand);
}

.eng-deep__hint {
  overflow: hidden;
  min-width: 0;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 500;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.eng-deep__hint::before {
  content: "·";
  margin-inline-end: 10px;
}

.eng-deep__chev {
  margin-inline-start: auto;
  transition: transform 0.25s ease;
}

.eng-deep[open] .eng-deep__chev {
  transform: rotate(180deg);
}

.eng-deep__summary:hover .eng-deep__label {
  color: var(--brand);
}

.eng-tabs {
  padding: 2px 16px 18px;
}

.eng-foot .eng-tabs {
  padding: 2px 0 26px;
}

/* tabs are built by engineering.js; without it the panels simply stack */
.eng-tablist {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  width: fit-content;
  max-width: 100%;
  margin: 2px 0 18px;
  padding: 4px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.eng-foot .eng-tablist {
  background: var(--surface);
}

.eng-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--ink-2);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.eng-tab .icon {
  width: 16px;
  height: 16px;
}

.eng-tab:hover {
  color: var(--brand);
}

.eng-tab[aria-selected="true"] {
  background: var(--brand-soft);
  color: var(--brand);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 32%, transparent);
}

.eng-tab:focus-visible {
  outline-offset: 1px;
}

.eng-panel {
  min-width: 0;
}

.eng-panel:focus-visible {
  outline-offset: 6px;
}

.eng-panel + .eng-panel {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px dashed var(--line);
}

.eng-tabs.is-tabbed .eng-panel + .eng-panel {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.eng-panel__title {
  margin: 0 0 12px;
  font-size: 1rem;
}

.eng-tabs.is-tabbed .eng-panel__title {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.eng-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.eng-list li {
  position: relative;
  padding-inline-start: 16px;
  color: var(--ink-2);
  font-size: 0.95rem;
  line-height: 1.6;
}

.eng-list li::before {
  content: "";
  position: absolute;
  top: 0.65em;
  inset-inline-start: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand);
}

.eng-panel > * + * {
  margin-top: 16px;
}

/* ---------- architecture diagrams ---------- */

.eng-band {
  position: relative;
  isolation: isolate;
  padding: clamp(22px, 3.4vw, 40px) clamp(20px, 3.5vw, 40px) clamp(22px, 3vw, 34px);
  border-top: 1px solid var(--line);
  background: var(--eng-band-bg);
}

.eng-band::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background-image: radial-gradient(var(--grid-dot) 1px, transparent 1px);
  background-size: 20px 20px;
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 70%);
  mask-image: linear-gradient(180deg, #000, transparent 70%);
}

.eng-arch {
  display: grid;
  gap: 18px;
  min-width: 0;
  margin: 0;
}

.eng-arch__head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px 28px;
}

.eng-arch__kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--brand);
  font-size: 0.82rem;
  font-weight: 700;
}

.eng-arch__title {
  margin: 4px 0 0;
  font-size: clamp(1.15rem, 2vw, 1.4rem);
}

.eng-arch__cap {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.eng-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 0.8rem;
}

.eng-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.eng-legend__item::before {
  content: "";
  width: 12px;
  height: 12px;
  border-radius: 4px;
  background: var(--brand-soft);
  border: 1.5px solid var(--brand);
}

.eng-legend__item--ext::before {
  background: var(--surface-2);
  border: 1.5px dashed var(--muted);
}

.eng-legend__item--ai::before {
  background: var(--eng-ai-soft);
  border-color: var(--eng-ai);
}

.eng-legend__item--data::before {
  background: var(--eng-data-soft);
  border-color: var(--eng-data);
}

.eng-arch__lanes {
  display: grid;
  gap: 20px;
}

.eng-lane {
  container-type: inline-size;
  display: grid;
  gap: 10px;
  min-width: 0;
}

.eng-lane__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.4;
}

.eng-lane__num {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: none;
  border-radius: 50%;
  background: var(--ink);
  color: var(--bg);
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 1;
}

/* a flow is an ordered list of nodes; default (narrow) layout is a vertical column */
.eng-flow {
  --gap: 20px;
  position: relative;
  isolation: isolate;
  display: grid;
  gap: var(--gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

/* the dashed track the arrows sit on, through the centre of the icons */
.eng-flow::before {
  content: "";
  position: absolute;
  z-index: -1;
  top: 20px;
  bottom: 20px;
  inset-inline-start: 30px;
  border-inline-start: 2px dashed var(--eng-track);
}

.eng-node {
  --k: var(--brand);
  --k-soft: var(--brand-soft);
  position: relative;
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: translate 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.eng-node--ai {
  --k: var(--eng-ai);
  --k-soft: var(--eng-ai-soft);
}

.eng-node--data {
  --k: var(--eng-data);
  --k-soft: var(--eng-data-soft);
}

.eng-node--ext {
  --k: var(--muted);
  --k-soft: var(--surface-2);
  border-style: dashed;
  border-color: color-mix(in srgb, var(--muted) 45%, var(--line));
  box-shadow: none;
}

.eng-node__icon {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--k-soft);
  color: var(--k);
}

.eng-node__icon .icon {
  width: 18px;
  height: 18px;
}

.eng-node__name {
  align-self: end;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
  line-height: 1.35;
}

.eng-node__meta {
  align-self: start;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.eng-node__name:last-child {
  grid-row: 1 / span 2;
  align-self: center;
}

/* arrow to the next node: down in the column */
.eng-node:not(:last-child)::after {
  content: "";
  position: absolute;
  z-index: 1;
  top: 100%;
  inset-inline-start: 21px;
  width: 18px;
  height: var(--gap);
  background: var(--eng-arrow);
  -webkit-mask: var(--eng-arrow-down) center / 16px 16px no-repeat;
  mask: var(--eng-arrow-down) center / 16px 16px no-repeat;
}

.eng-flow--duplex > .eng-node:not(:last-child)::after {
  -webkit-mask-image: var(--eng-arrow-both-v);
  mask-image: var(--eng-arrow-both-v);
}

/* wide enough: a right-to-left row of cards, arrows pointing left */
@container (min-width: 620px) {
  .eng-flow:not(.eng-flow--long) {
    --gap: 34px;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
  }

  .eng-flow:not(.eng-flow--long)::before {
    top: 50%;
    bottom: auto;
    inset-inline: 30px;
    border-inline-start: 0;
    border-top: 2px dashed var(--eng-track);
  }

  .eng-flow:not(.eng-flow--long) > .eng-node {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    align-content: start;
    row-gap: 3px;
    padding: 14px 14px 13px;
  }

  .eng-flow:not(.eng-flow--long) > .eng-node .eng-node__icon {
    grid-row: auto;
    margin-bottom: 7px;
  }

  .eng-flow:not(.eng-flow--long) > .eng-node .eng-node__name,
  .eng-flow:not(.eng-flow--long) > .eng-node .eng-node__meta {
    grid-row: auto;
    align-self: start;
  }

  .eng-flow:not(.eng-flow--long) > .eng-node:not(:last-child)::after {
    top: 50%;
    inset-inline-start: 100%;
    width: var(--gap);
    height: 20px;
    translate: 0 -50%;
    -webkit-mask-image: var(--eng-arrow-left);
    mask-image: var(--eng-arrow-left);
    -webkit-mask-size: 18px 18px;
    mask-size: 18px 18px;
  }

  .eng-flow--duplex:not(.eng-flow--long) > .eng-node:not(:last-child)::after {
    -webkit-mask-image: var(--eng-arrow-both-h);
    mask-image: var(--eng-arrow-both-h);
  }
}

/* five or six nodes need more room before they fit in one row */
@container (min-width: 860px) {
  .eng-flow--long {
    --gap: 30px;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
  }

  .eng-flow--long::before {
    top: 50%;
    bottom: auto;
    inset-inline: 30px;
    border-inline-start: 0;
    border-top: 2px dashed var(--eng-track);
  }

  .eng-flow--long > .eng-node {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    align-content: start;
    row-gap: 3px;
    padding: 14px 13px 13px;
  }

  .eng-flow--long > .eng-node .eng-node__icon {
    grid-row: auto;
    margin-bottom: 7px;
  }

  .eng-flow--long > .eng-node .eng-node__name,
  .eng-flow--long > .eng-node .eng-node__meta {
    grid-row: auto;
    align-self: start;
  }

  .eng-flow--long > .eng-node:not(:last-child)::after {
    top: 50%;
    inset-inline-start: 100%;
    width: var(--gap);
    height: 20px;
    translate: 0 -50%;
    -webkit-mask-image: var(--eng-arrow-left);
    mask-image: var(--eng-arrow-left);
    -webkit-mask-size: 18px 18px;
    mask-size: 18px 18px;
  }
}

.eng-arch__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
}

.eng-arch__group {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.eng-arch__group-title {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.eng-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.eng-chips li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 0.82rem;
  line-height: 1.4;
}

.eng-chips .icon {
  width: 14px;
  height: 14px;
  color: var(--brand);
}

/* ---------- CI: what runs automatically (static facts, not a live status) ---------- */

.eng-ci {
  display: grid;
  gap: 18px;
}

.eng-ci__block {
  container-type: inline-size;
  display: grid;
  gap: 10px;
  min-width: 0;
}

.eng-ci__title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
}

.eng-ci__title .icon {
  color: var(--brand);
}

.eng-pipe {
  --gap: 16px;
  display: grid;
  gap: var(--gap);
  margin: 0;
  padding: 0;
  list-style: none;
}

.eng-pipe__step {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.4;
}

.eng-pipe__step .icon {
  width: 18px;
  height: 18px;
  color: var(--brand);
}

.eng-pipe__step--gate {
  border-color: color-mix(in srgb, var(--brand) 40%, var(--line));
  background: color-mix(in srgb, var(--brand-soft) 55%, var(--surface));
}

.eng-pipe__step:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 100%;
  inset-inline-start: 19px;
  width: 16px;
  height: var(--gap);
  background: var(--eng-arrow);
  -webkit-mask: var(--eng-arrow-down) center / 14px 14px no-repeat;
  mask: var(--eng-arrow-down) center / 14px 14px no-repeat;
}

@container (min-width: 520px) {
  .eng-pipe {
    --gap: 30px;
    display: flex;
    align-items: stretch;
  }

  .eng-pipe__step {
    flex: 0 1 auto;
  }

  .eng-pipe__step:not(:last-child)::after {
    top: 50%;
    inset-inline-start: 100%;
    width: var(--gap);
    height: 18px;
    translate: 0 -50%;
    -webkit-mask-image: var(--eng-arrow-left);
    mask-image: var(--eng-arrow-left);
    -webkit-mask-size: 16px 16px;
    mask-size: 16px 16px;
  }
}

.eng-facts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.eng-facts li {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.eng-facts b {
  display: block;
  direction: ltr;
  text-align: right;
  font-size: 1.2rem;
  line-height: 1.15;
}

.eng-facts span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.35;
}

.eng-ci__note {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.eng-ci__note .icon {
  margin-top: 2px;
}

/* ---------- code samples ---------- */

.eng-code {
  display: grid;
  gap: 10px;
  min-width: 0;
  margin: 0;
}

.eng-code__desc {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.95rem;
  line-height: 1.6;
}

.eng-inline {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 0.85em;
  direction: ltr;
  unicode-bidi: isolate;
}

.eng-code__box {
  overflow: hidden;
  min-width: 0;
  border-radius: 14px;
  background: var(--eng-code-bg);
  border: 1px solid var(--eng-code-line);
  box-shadow: var(--shadow-md);
}

.eng-code__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  padding: 9px 10px 9px 12px;
  background: var(--eng-code-bar);
  border-bottom: 1px solid var(--eng-code-line);
  color: #eef2ff;
}

.eng-code__title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 600;
}

.eng-code__lang {
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--eng-code-dim);
  font-family: var(--mono);
  font-size: 0.72rem;
  direction: ltr;
  unicode-bidi: isolate;
}

.eng-code__copy {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #eef2ff;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.eng-code__copy:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.34);
}

.eng-code__copy.is-done {
  color: #9be3b0;
  border-color: rgba(155, 227, 176, 0.5);
}

.eng-code__copy:focus-visible,
.eng-code__pre:focus-visible {
  outline: 2px solid #9aabff;
  outline-offset: 2px;
}

.eng-code__pre:focus-visible {
  outline-offset: -3px;
  border-radius: 4px;
}

.eng-code__pre {
  max-height: min(70vh, 34rem);
  margin: 0;
  padding: 14px 16px 16px;
  overflow: auto;
  color: var(--eng-code-ink);
  font-family: var(--mono);
  font-size: 0.8rem;
  line-height: 1.7;
  text-align: left;
  white-space: pre;
  tab-size: 2;
  direction: ltr;
  unicode-bidi: isolate;
  scrollbar-color: #2c3760 transparent;
}

.eng-code__pre code {
  font: inherit;
}

.eng-code__label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0;
  padding: 10px 14px;
  border-top: 1px solid var(--eng-code-line);
  color: var(--eng-code-dim);
  font-size: 0.8rem;
  line-height: 1.5;
}

.eng-code__label .icon {
  margin-top: 2px;
}

/* pre-tokenised highlighting (no JS highlighter, CSP-safe); all ≥ 4.5:1 on the code background */
.tk-k {
  color: #c9a6ff;
}

.tk-s {
  color: #9be3b0;
}

.tk-n {
  color: #ffc58a;
}

.tk-c {
  color: #8f9abd;
  font-style: italic;
}

.tk-f {
  color: #85d4ff;
}

.tk-r {
  color: #ffa8c8;
}

.tk-t {
  color: #7fe0cf;
}

html.a11y-contrast .eng-code__pre [class^="tk-"] {
  color: #fff;
}

.eng-gh {
  margin: 0;
}

.eng-gh a {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--brand);
  font-size: 0.92rem;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, var(--brand) 40%, transparent);
  text-underline-offset: 4px;
}

.eng-gh a:hover {
  text-decoration-color: currentColor;
}

/* ---------- compact versions inside the Belev Echad minis ---------- */

.mini .eng-deep {
  background: var(--surface);
}

.mini .eng-tablist {
  background: var(--bg);
}

.mini .eng-node {
  padding: 9px 11px;
}

.mini .eng-code__pre {
  font-size: 0.76rem;
}

/* ---------- KPI grids never widen the card (large text, narrow phones) ---------- */

#projects .kpis {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#projects .kpis b {
  overflow-wrap: anywhere;
}

.mini .kpis {
  margin-bottom: 18px;
}

.mini .kpis b {
  font-size: clamp(1rem, 3.4vw, 1.2rem);
}

/* ---------- hover: subtle lift, glow and screenshot zoom (never the only way to see anything) ---------- */

/* .reveal's transition list would otherwise replace the card's own */
.js #projects .project.reveal.is-visible,
.js #projects .org-group.reveal.is-visible {
  transition: opacity 0.8s ease, transform 0.8s cubic-bezier(0.2, 0.7, 0.2, 1), translate 0.35s ease,
    box-shadow 0.35s ease, border-color 0.35s ease;
}

#projects .mini {
  transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
}

#projects .kpis li,
#projects .eng-facts li,
#projects .eng-pipe__step {
  transition: border-color 0.25s ease, background-color 0.25s ease;
}

#projects .browser__screen {
  overflow: hidden;
}

#projects .browser__screen img {
  transform-origin: 50% 0;
  transition: scale 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}

#projects .project:focus-within,
#projects .mini:focus-within {
  border-color: var(--eng-glow);
}

@media (hover: hover) and (pointer: fine) {
  #projects .project:hover {
    translate: 0 -3px;
    border-color: var(--eng-glow);
    box-shadow: var(--shadow-md);
  }

  #projects .org-group:hover {
    border-color: color-mix(in srgb, var(--brand) 22%, var(--line));
    box-shadow: var(--shadow-md);
  }

  #projects .mini:hover {
    border-color: var(--eng-glow);
  }

  /* the compact cards aren't links: no hover glow */
  #projects .mini--compact:hover {
    border-color: var(--line);
  }

  #projects .shot:hover .browser__screen img {
    scale: 1.035;
  }

  #projects .kpis li:hover,
  #projects .eng-facts li:hover,
  #projects .eng-pipe__step:hover {
    border-color: var(--eng-glow);
  }

  #projects .eng-node:hover {
    translate: 0 -2px;
    border-color: color-mix(in srgb, var(--k) 50%, var(--line));
    box-shadow: var(--shadow-md);
  }
}

/* on touch screens a tap would leave the lift stuck */
@media (hover: none) {
  #projects .mini:hover,
  #projects .shot:hover .browser,
  #projects .shot:hover .phone {
    transform: none;
  }

  #projects .mini:hover {
    box-shadow: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  #projects .project:hover,
  #projects .eng-node:hover {
    translate: none;
  }

  #projects .mini:hover,
  #projects .btn:hover,
  #projects .shot:hover .browser,
  #projects .shot:hover .phone {
    transform: none;
  }

  #projects .shot:hover .browser__screen img {
    scale: none;
  }
}

html.a11y-nomotion #projects .project:hover,
html.a11y-nomotion #projects .eng-node:hover {
  translate: none;
}

html.a11y-nomotion #projects .mini:hover,
html.a11y-nomotion #projects .btn:hover,
html.a11y-nomotion #projects .shot:hover .browser,
html.a11y-nomotion #projects .shot:hover .phone {
  transform: none;
}

html.a11y-nomotion #projects .shot:hover .browser__screen img {
  scale: none;
}

/* ---------- high contrast ---------- */

html.a11y-contrast .eng-band::before {
  display: none;
}

html.a11y-contrast .eng-node,
html.a11y-contrast .eng-pipe__step,
html.a11y-contrast .eng-code__box,
html.a11y-contrast .eng-deep {
  border-width: 2px;
}

/* ---------- the flagship diagram's preview ---------- */

/* The flagship card's diagram is long (on a phone, two screens of cards), so it opens as a preview
   and the button under it shows all of it. Only with JavaScript (the .js class from theme.js);
   without it the whole diagram shows. Screen readers get all of it either way. */
.eng-peek {
  display: none;
}

.js .eng-band--peek:not(.is-open) .eng-arch {
  max-height: 25rem;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, #000 55%, transparent);
  mask-image: linear-gradient(180deg, #000 55%, transparent);
}

.js .eng-peek {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 46px;
  margin-top: 4px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--brand);
  font: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
}

.eng-peek .icon {
  transition: transform 0.25s ease;
}

.eng-band--peek.is-open .eng-peek .icon {
  transform: rotate(180deg);
}

/* ---------- small screens ---------- */

@media (max-width: 720px) {
  .eng-deep__hint {
    display: none;
  }
}

@media (max-width: 560px) {
  .project__links .eng-demo,
  .project__links .eng-shots {
    flex: 1 1 100%;
    justify-content: center;
  }

  .eng-foot {
    padding-inline: 16px;
  }

  .eng-tab {
    padding: 0 11px;
    font-size: 0.86rem;
  }

  .eng-code__pre {
    font-size: 0.74rem;
  }
}

/* Windows High Contrast: the selected tab's background and underline are dropped; an outline survives */
@media (forced-colors: active) {
  .eng-tab[aria-selected="true"] {
    outline: 3px solid Highlight;
    outline-offset: -3px;
  }
}
