/* Additions: tech-stack badges, infrastructure diagram, credential hexagons.
   Kept separate from h.css on purpose; link it with a ?v= query and bump it on every change,
   because _headers caches .css for a year. */

:root {
  --ok: #5fd38d;
}

button.btn {
  font-family: inherit;
  cursor: pointer;
}

button.btn:disabled {
  opacity: 0.55;
  cursor: progress;
}

.btn-sm {
  padding: 0.42rem 0.75rem;
  font-size: 0.74rem;
}

.ico {
  width: 1rem;
  height: 1rem;
  fill: currentColor;
  flex: none;
}

/* ---------- Tech-stack badge wall ---------- */

.stack {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.2rem 1.8rem;
  margin-top: 0.6rem;
}

.stack-title {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.6rem;
}

.stack-title::before {
  content: "// ";
  opacity: 0.6;
}

.chips {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  padding: 0.32rem 0.62rem;
  border: 1px solid var(--line);
  background: rgba(24, 28, 33, 0.78);
  color: var(--text);
  font-size: 0.76rem;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.chip .ico,
.chip i {
  width: 1rem;
  height: 1rem;
  font-size: 1rem;
  line-height: 1;
  color: var(--muted);
  transition: color 0.2s ease;
}

.chip:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--brand, #d9dee5) 65%, transparent);
}

.chip:hover .ico,
.chip:hover i {
  color: var(--brand, #d9dee5);
}

/* ---------- Infrastructure diagram ---------- */

.infra-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.2rem;
}

.infra-tab {
  font: inherit;
  font-size: 0.82rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line);
  padding: 0.5rem 0.95rem;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.infra-tab:hover {
  color: var(--accent-2);
  border-color: var(--accent);
}

.infra-tab[aria-selected="true"] {
  color: #101010;
  background: var(--accent-2);
  border-color: var(--accent-2);
  font-weight: 700;
}

.infra-panel {
  display: grid;
  gap: 1.35rem;
  margin-top: 1rem;
  padding: 1.5rem 1.1rem 1.1rem;
  border: 1px solid var(--line);
  background: rgba(16, 18, 21, 0.74);
  backdrop-filter: blur(6px);
}

.infra-panel[hidden] {
  display: none;
}

.lane {
  position: relative;
  padding: 1.25rem 0.8rem 0.8rem;
  border: 1px dashed rgba(217, 222, 229, 0.3);
}

.lane-run {
  border-style: solid;
  border-color: rgba(217, 222, 229, 0.42);
}

.lane-label {
  position: absolute;
  top: -0.62rem;
  left: 0.8rem;
  padding: 0 0.45rem;
  background: #14181d;
  font-size: 0.64rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.lane-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.35rem 1rem;
}

.lane-pair .lane {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.flow {
  display: flex;
  align-items: stretch;
}

.node {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.7rem 0.35rem;
  font: inherit;
  text-align: center;
  color: var(--text);
  background: rgba(24, 28, 33, 0.94);
  border: 1px solid rgba(217, 222, 229, 0.3);
  cursor: pointer;
  transition: transform 0.2s ease, border-color 0.25s ease, background 0.25s ease, box-shadow 0.25s ease;
}

.node .ico,
.node > i {
  width: 1.35rem;
  height: 1.35rem;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--accent-2);
}

.node .txt {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  min-width: 0;
}

.node b {
  font-size: 0.76rem;
  letter-spacing: 0.02em;
}

.node small {
  font-size: 0.62rem;
  color: var(--muted);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.node:hover {
  transform: translateY(-2px);
  border-color: var(--accent-2);
}

.node:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 2px;
}

.node.is-selected {
  border-color: var(--accent-2);
  background: rgba(43, 50, 60, 0.96);
}

.node.is-active {
  border-color: #eef2f7;
  background: rgba(52, 60, 72, 0.98);
  box-shadow: 0 0 18px rgba(217, 222, 229, 0.38);
  animation: nodePulse 0.9s ease-in-out infinite alternate;
}

.node.is-done {
  border-color: rgba(95, 211, 141, 0.7);
}

.node.is-done::after {
  content: "\2713";
  position: absolute;
  top: 3px;
  right: 6px;
  font-size: 0.64rem;
  color: var(--ok);
}

@keyframes nodePulse {
  from { box-shadow: 0 0 6px rgba(217, 222, 229, 0.2); }
  to { box-shadow: 0 0 20px rgba(217, 222, 229, 0.5); }
}

.link {
  position: relative;
  flex: 0 0 clamp(16px, 2.6vw, 36px);
  align-self: center;
  height: 2px;
  background: repeating-linear-gradient(90deg, rgba(217, 222, 229, 0.5) 0 6px, transparent 6px 11px);
  background-size: 11px 2px;
  animation: dashFlow 1.4s linear infinite;
}

.link::after {
  content: "";
  position: absolute;
  right: -1px;
  top: -3px;
  border-left: 6px solid rgba(217, 222, 229, 0.5);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
}

.link.lit {
  background-image: repeating-linear-gradient(90deg, #eef2f7 0 6px, transparent 6px 11px);
}

.link.lit::after {
  border-left-color: #eef2f7;
}

@keyframes dashFlow {
  to { background-position: 11px 0; }
}

@keyframes dashFlowV {
  to { background-position: 0 11px; }
}

/* prometheus -> grafana / alertmanager */
.fork {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(16px, 2.6vw, 36px) minmax(0, 1fr);
  gap: 0.6rem 0;
  align-items: center;
}

.fork .src { grid-column: 1; grid-row: 1 / 3; align-self: stretch; }
.fork .l1 { grid-column: 2; grid-row: 1; }
.fork .t1 { grid-column: 3; grid-row: 1; }
.fork .l2 { grid-column: 2; grid-row: 2; }
.fork .t2 { grid-column: 3; grid-row: 2; }

.infra-console {
  margin-top: 1rem;
  border: 1px solid var(--line);
  background: #0b0d10;
}

.console-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.74rem;
  color: var(--muted);
}

.console-title {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
}

.dots {
  display: inline-flex;
  gap: 5px;
}

.dots i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(167, 175, 186, 0.4);
}

.console-actions {
  display: flex;
  gap: 0.5rem;
}

.console-out {
  margin: 0;
  padding: 0.85rem 0.95rem;
  min-height: 11.5rem;
  max-height: 15rem;
  overflow: auto;
  font: inherit;
  font-size: 0.8rem;
  line-height: 1.7;
  white-space: pre-wrap;
  color: var(--text);
}

.console-out .dim { color: var(--muted); }
.console-out .ok { color: var(--ok); }

.infra-note {
  margin-top: 0.7rem;
  font-size: 0.72rem;
  color: var(--muted);
}

/* ---------- Credential hexagons ---------- */

.badge-wall {
  display: flex;
  flex-wrap: wrap;
  gap: 1.2rem 1.5rem;
  margin: 1.1rem 0 0.4rem;
}

.hex {
  width: 116px;
  text-align: center;
}

.hex-shape {
  --hex: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  position: relative;
  width: 96px;
  height: 108px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  clip-path: var(--hex);
  background: linear-gradient(145deg, rgba(236, 239, 244, 0.95), rgba(139, 149, 163, 0.35) 45%, rgba(230, 233, 239, 0.75));
  transition: transform 0.25s ease, filter 0.25s ease;
}

.hex-shape::before {
  content: "";
  position: absolute;
  inset: 2px;
  clip-path: var(--hex);
  background: linear-gradient(160deg, #1d232b, #12151a);
}

.hex-shape::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, 0.3) 50%, transparent 62%);
  transform: translateX(-130%);
  transition: transform 0.75s ease;
}

.hex:hover .hex-shape {
  transform: translateY(-3px);
  filter: drop-shadow(0 10px 14px rgba(217, 222, 229, 0.18));
}

.hex:hover .hex-shape::after {
  transform: translateX(130%);
}

.hex-body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.hex-body i {
  font-size: 1.5rem;
  line-height: 1;
  color: var(--accent-2);
}

.hex-body b {
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}

.hex figcaption {
  margin-top: 0.55rem;
  font-size: 0.66rem;
  line-height: 1.45;
  color: var(--muted);
}

/* ---------- Responsive ---------- */

@media (max-width: 860px) {
  .stack,
  .lane-pair {
    grid-template-columns: 1fr;
  }

  .flow,
  .fork {
    display: flex;
    flex-direction: column;
    align-items: stretch;
  }

  .node {
    flex-direction: row;
    justify-content: flex-start;
    gap: 0.75rem;
    padding: 0.55rem 0.8rem;
    text-align: left;
  }

  .link {
    flex: 0 0 18px;
    width: 2px;
    height: 18px;
    margin-left: 1.4rem;
    align-self: flex-start;
    background: repeating-linear-gradient(180deg, rgba(217, 222, 229, 0.5) 0 6px, transparent 6px 11px);
    background-size: 2px 11px;
    animation-name: dashFlowV;
  }

  .link.lit {
    background-image: repeating-linear-gradient(180deg, #eef2f7 0 6px, transparent 6px 11px);
  }

  .link::after {
    right: auto;
    left: -3px;
    top: auto;
    bottom: -2px;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 6px solid rgba(217, 222, 229, 0.5);
    border-bottom: 0;
  }

  .link.lit::after {
    border-top-color: #eef2f7;
  }
}

@media (max-width: 980px) {
  .hero-visual {
    margin-top: 1.4rem;
  }
}

@media (max-width: 680px) {
  .infra-panel {
    padding: 1.3rem 0.7rem 0.8rem;
  }

  /* the diagram is tall on a phone, so keep the console in view while scrolling it */
  .infra-console {
    position: sticky;
    bottom: 0.5rem;
    z-index: 6;
    box-shadow: 0 -10px 24px rgba(0, 0, 0, 0.55);
  }

  .console-out {
    min-height: 5.5rem;
    max-height: 8.5rem;
  }

  .hex {
    width: 104px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .link,
  .node.is-active {
    animation: none;
  }

  .hex-shape,
  .hex-shape::after,
  .chip,
  .node {
    transition: none;
  }
}

/* ---------- Hero portrait: half human, half machine ---------- */

.hv-stage {
  position: relative;
  transform-origin: 50% 55%;
  will-change: transform;
}

.hv-fx {
  position: absolute;
  pointer-events: none;
}

/* inside the silhouette: the photo's own alpha is the mask, so wires only exist "inside" him */
.hv-in {
  inset: 0;
  width: 100%;
  height: 100%;
  -webkit-mask: url("s.logo.png") center / 100% 100% no-repeat;
  mask: url("s.logo.png") center / 100% 100% no-repeat;
}

/* around him: cloud, server rack, cables, data bits (must match PAD in hero-fx.js) */
.hv-out {
  left: -16%;
  top: -10%;
  width: 132%;
  height: 116%;
}

/* the overlays have to stay registered with the photo, so the old zoom-on-hover moves to the stage */
.hero-visual img:hover,
.hero-visual img:focus-visible {
  transform: none;
  filter: none;
  opacity: 0.96;
}
