/* Amp Factory (30 Oct 2026). Each Amp is the slim v7 Amp with its front panel recoloured from the
   palette and its job lettered (brand/assets/amp-family/factory/), never coral, OS teal or the
   Mine and Solve phase colours. The eyes are drawn here, as on the Workshop: a dark ring, paper
   white and a pupil glancing up and right, with a quiet blink that stops under reduced motion. */

/* The Amp and its eyes, placed on the cropped body (eyes at 25.4% and 63.3% across, 29.7% down) */
.af-art { position: relative; display: block; width: 100%; max-width: 176px; margin: 0 auto; }
.af-art img { display: block; width: 100%; height: auto; aspect-ratio: 800 / 910; }
.af-eye { position: absolute; top: 29.66%; width: 30.07%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; overflow: hidden;
  background: radial-gradient(circle closest-side, var(--ha-paper) 73.5%, var(--ha-ink) 74.5%); }
.af-eye:nth-of-type(1) { left: 25.37%; }
.af-eye:nth-of-type(2) { left: 63.31%; }
.af-pupil { position: absolute; left: 45.7%; top: 26.1%; width: 31.8%; height: 31.8%; border-radius: 50%; background: var(--ha-ink); }
.af-lid { position: absolute; inset: 13%; border-radius: 50%; background: #D6CBC0; /* the Amp's cream body */ transform: scaleY(0); }
@media (prefers-reduced-motion: no-preference) {
  .af-lid { animation: af-blink 9s ease-in-out infinite; animation-delay: var(--af-d, 0s); }
  .af-amp:nth-child(2) .af-lid { --af-d: -3.1s; }
  .af-amp:nth-child(3) .af-lid { --af-d: -5.4s; }
  .af-amp:nth-child(4) .af-lid { --af-d: -1.7s; }
  .af-amp:nth-child(5) .af-lid { --af-d: -7.2s; }
  .af-amp:nth-child(6) .af-lid { --af-d: -4.3s; }
  .af-card .af-lid { --af-d: -6.1s; }
}
@keyframes af-blink { 0%, 96.4%, 100% { transform: scaleY(0); } 97.6% { transform: scaleY(1); } }

body.ha-inner main :is(.af-hero, .af-making, #stuart, .af-commission).ip-sec { padding-inline: 0; }

/* One factory floor: enamel sign, sawtooth glazing and a real scrollable conveyor. */
.af-hero .ip-in { display: block; padding-top: 48px; padding-bottom: 64px; }
.af-factory { --af-line: color-mix(in srgb, var(--ha-paper) 28%, transparent); --af-amp-height: 210px; --af-track-inset: 44px; }
.af-roof { display: block; width: 100%; height: clamp(48px, 6.4vw, 92px); overflow: visible; }
.af-roof-shell { fill: var(--ha-ink-raised); stroke: var(--af-line); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.af-roof-glass { fill: color-mix(in srgb, var(--ha-paper) 9%, var(--ha-ink)); stroke: var(--af-line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.af-roof-bars { fill: none; stroke: var(--af-line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.af-building { position: relative; border: 1px solid var(--af-line); border-top: 0; border-radius: 0 0 12px 12px; background: repeating-linear-gradient(90deg, transparent 0 47px, color-mix(in srgb, var(--ha-paper) 3%, transparent) 47px 48px); }
.af-hero-copy { position: relative; z-index: 1; max-width: 680px; padding: 24px 24px 0; margin: 0 auto; text-align: center; }
.af-sign { position: relative; display: inline-block; padding: 22px 48px 26px; color: var(--ha-ink); background: var(--ha-paper); border: 5px solid var(--ha-ink-raised); outline: 1px solid var(--af-line); border-radius: 8px; box-shadow: inset 0 0 0 2px var(--ha-ink), 0 8px 0 color-mix(in srgb, var(--ha-ink) 60%, transparent); }
.af-sign::before, .af-sign::after { content: ''; position: absolute; top: 12px; bottom: 12px; width: 6px; background: radial-gradient(circle at 50% 3px, var(--ha-ink-soft) 0 2px, transparent 2.8px), radial-gradient(circle at 50% calc(100% - 3px), var(--ha-ink-soft) 0 2px, transparent 2.8px); }
.af-sign::before { left: 13px; } .af-sign::after { right: 13px; }
body.ha-inner main .ip-sec.dark .af-sign h1 { margin: 0; color: var(--ha-ink); font: 800 clamp(36px, 4.7vw, 64px)/1 var(--ha-font-sans); font-size: clamp(36px, 4.7vw, 64px) !important; letter-spacing: -.04em; }
.af-hero .ip-lede { max-width: 44ch; margin: 24px auto 0; font-size: clamp(17px, 1.55vw, 21px); }
.af-shelf { position: relative; margin-top: 26px; isolation: isolate; }
.af-lights { position: absolute; inset: -18px 12% auto; display: flex; justify-content: space-between; z-index: -1; pointer-events: none; }
.af-lights i { position: relative; width: 50px; height: 12px; border-radius: 30px 30px 3px 3px; background: var(--ha-ink-raised); border-bottom: 2px solid var(--ha-paper-face); }
.af-lights i::before { content: ''; position: absolute; width: 1px; height: 32px; bottom: 12px; left: 50%; background: var(--af-line); }
.af-lights i::after { content: ''; position: absolute; top: 12px; left: -85px; width: 220px; height: 200px; clip-path: polygon(39% 0, 61% 0, 100% 100%, 0 100%); background: linear-gradient(color-mix(in srgb, var(--ha-paper-face) 6%, transparent), transparent); }
body.ha-inner main .ip-sec .af-track { list-style: none; margin: 0; display: flex; gap: 34px; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; scroll-snap-type: x proximity; padding: 20px var(--af-track-inset) 64px; }
.af-track::-webkit-scrollbar { display: none; }
.af-track:focus-visible { outline: 2px solid var(--ha-bloom); outline-offset: -3px; }
body.ha-inner main .af-shelf[data-auto="true"] .af-track { scroll-snap-type: none; }
.af-amp { position: relative; flex: 0 0 190px; display: grid; grid-template-rows: var(--af-amp-height); justify-items: center; scroll-snap-align: start; scroll-margin-inline: 44px; text-decoration: none; color: var(--ha-paper); }
.af-amp .af-art { width: 184px; max-width: 100%; margin: 0; align-self: end; }
/* The supplied panel already carries the name; retain a text equivalent only for assistive tech. */
.af-name { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.af-belt { position: absolute; z-index: -1; left: 20px; right: 20px; top: calc(20px + var(--af-amp-height) - 2px); height: 31px; border: 1px solid var(--af-line); border-radius: 18px; background: var(--ha-ink-raised); box-shadow: 0 -4px 0 var(--ha-meta-on-dark), 0 -7px 0 var(--ha-ink); }
.af-belt span { position: absolute; inset: 5px 6px; border-radius: 14px; background: radial-gradient(circle at 10px 10px, var(--ha-ink) 0 3px, var(--ha-meta-on-dark) 3.5px 7px, var(--ha-ink) 7.5px 9px, transparent 9.5px) 0 0 / 27px 20px repeat-x; }
.af-shelf[data-running="true"] .af-belt span { animation: af-rollers 1.35s linear infinite; }
@keyframes af-rollers { to { background-position: -27px 0; } }
.af-console { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 24px; border-top: 1px solid var(--af-line); border-radius: 0 0 11px 11px; background: var(--ha-ink-raised); }
.af-directory-link { display: inline-flex; align-items: center; gap: 16px; min-height: 44px; color: var(--ha-paper); font: 700 15px/1.3 var(--ha-font-sans); text-decoration: none; }
.af-directory-link span { color: var(--ha-bloom); font-size: 22px; }
.af-directory-link:focus-visible { outline: 2px solid var(--ha-bloom); outline-offset: 3px; }
.af-nav { display: flex; gap: 8px; align-items: center; }
.af-position { font: 500 12px/1 var(--ha-font-mono); font-variant-numeric: tabular-nums; color: var(--ha-vapour); min-width: 65px; }
.af-arrow, .af-motion { min-height: 44px; border-radius: 6px; border: 1px solid var(--af-line); background: var(--ha-ink); color: var(--ha-paper); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.af-arrow { width: 44px; }
.af-arrow svg, .af-motion svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.af-motion { gap: 8px; padding: 0 14px; font: 700 13px/1 var(--ha-font-sans); min-width: 152px; }
.af-motion .af-stop-icon, .af-motion[aria-pressed="true"] .af-run-icon { display: none; }
.af-motion[aria-pressed="true"] .af-stop-icon { display: block; }
.af-motion[aria-pressed="true"] { color: var(--ha-paper); }
.af-arrow:hover:not(:disabled), .af-motion:hover:not(:disabled) { border-color: var(--ha-paper); }
.af-arrow:disabled, .af-motion:disabled { opacity: .4; cursor: default; }
.af-arrow:focus-visible, .af-motion:focus-visible { outline: 2px solid var(--ha-bloom); outline-offset: 3px; }

/* How an Amp is made: four stations joined by drawn arrows, ending in the OS eyes */
.af-line { list-style: none; margin: clamp(36px, 4vw, 52px) 0 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.af-line li { color: var(--ha-ink); position: relative; background: var(--ha-card); border: 1px solid var(--ha-hairline); border-radius: 14px; padding: 24px 22px; }
body.ha-inner main .ip-sec .af-line h3 { font: 800 22px/1.15 var(--ha-font-sans); letter-spacing: -.02em; color: var(--ha-ink); }
.af-line p { margin-top: 8px; font: 500 16px/1.45 var(--ha-font-sans); color: var(--ha-support-on-paper); }
.af-line .af-os { background: var(--ha-ink-raised); border-color: color-mix(in srgb, var(--ha-paper) 24%, transparent); }
body.ha-inner main .ip-sec .af-line .af-os h3 { color: var(--ha-white); }
.af-line .af-os p { color: var(--ha-vapour); }
.af-line .af-os a { color: var(--ha-white); text-underline-offset: 3px; }
.af-line .af-os a:focus-visible { outline: 2px solid var(--ha-bloom); outline-offset: 2px; }
.af-os img { position: absolute; right: 20px; top: 20px; display: block; width: 36px; height: 36px; }
.af-line .af-os h3 { padding-right: 48px; }
.af-lead { margin-top: 28px; font: 700 clamp(18px, 1.5vw, 21px)/1.4 var(--ha-font-sans); color: var(--ha-paper); }
.af-making .ip-h2 .soft { color: var(--ha-vapour); }
.af-line li::before { content: ""; position: absolute; left: 22px; top: -5px; width: 10px; height: 10px; border: 2px solid var(--ha-paper); border-radius: 50%; background: var(--ha-ink); }

/* Stuart */
.af-story { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: clamp(32px, 4vw, 64px); align-items: center; }
.af-photo { margin: 0; border-radius: 16px; overflow: hidden; aspect-ratio: 4 / 3; }
.af-photo img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 60%; display: block; }
.af-story .ip-p { margin-top: 18px; color: var(--ha-support-on-paper); }

/* One commissioning route, through the existing Amp conversation. */
.af-commission .ip-in { padding-top: 0; }
.af-commission .ip-p { max-width: 50ch; margin-top: 22px; }
.af-brief-cta { margin-top: 28px; white-space: normal; }
#conversation { scroll-margin-top: 96px; }

@media (max-width: 1000px) {
  .af-line { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
  .af-story { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 760px) {
  .af-hero .ip-in { padding-top: 34px; padding-bottom: 40px; }
  .af-factory { --af-amp-height: 178px; --af-track-inset: 22px; overflow: hidden; }
  .af-roof { width: 200%; height: 60px; }
  .af-hero-copy { padding: 22px 14px 0; }
  .af-sign { padding: 19px 22px 21px; border-width: 4px; }
  .af-hero .ip-lede { margin-top: 22px; }
  body.ha-inner main .ip-sec .af-track { gap: 26px; }
  .af-amp { flex-basis: 160px; scroll-margin-inline: 22px; }
  .af-amp .af-art { width: 156px; }
  .af-lights { inset-inline: 8%; }
  .af-lights i:nth-child(2) { visibility: hidden; }
  .af-console { padding: 12px 10px; gap: 8px; flex-wrap: wrap; }
  .af-directory-link { font-size: 14px; gap: 8px; }
  .af-nav { margin-left: auto; }
  .af-position { display: none; }
  .af-motion { min-width: 44px; padding-inline: 10px; }
  .af-motion span { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
}
@media (max-width: 640px) {
  .af-line { grid-template-columns: minmax(0,1fr); gap: 10px; }
  .af-line li { padding: 20px; }
}
@media (max-width: 540px) {
  body.ha-inner main .ip-sec.dark .af-sign h1 { font-size: clamp(26px,8.5vw,42px) !important; }
}
.af-art[data-ha-live-eyes] .af-pupil { transition: transform 100ms ease-out; }
.af-art[data-ha-live-eyes]:not(.is-art-ready) .af-eye { visibility: hidden; }
@media (prefers-reduced-motion: reduce) { .af-art[data-ha-live-eyes] .af-pupil { transition: none; } }
