/* The embedded halves of /guides/ai-home and /guides/home-assistant (src/content/pages/ai-home.html and home-assistant.html), on the story
   page's light .lab-embed band. Static: no script, no animation. Illustrations are inline SVG or plain HTML/CSS. */
.ah { padding-bottom: clamp(24px, 4vw, 56px); }
.ah figure { margin: 0; }
.ah-fig { min-width: 0; }
.ah-frame {
  padding: clamp(12px, 3vw, 24px); border: 1px solid var(--line); border-radius: var(--radius-lg);
  background: radial-gradient(120% 90% at 85% 10%, rgba(246, 226, 184, 0.28), rgba(255, 255, 255, 0) 60%), #fff;
}
figure.ah-fig > figcaption { margin-top: 10px; font-size: 0.85rem; color: var(--muted); }
.ah-svg { display: block; width: 100%; max-width: 460px; height: auto; margin-inline: auto; color: var(--ink); }
.ah-svg text { font-family: var(--font); fill: var(--ink); }
.ah-svg .ah-muted { fill: var(--muted); }
.ah-svg .ah-box { fill: #fff; stroke: var(--line-strong); stroke-width: 1.5; }
.ah-svg .ah-box--hub { fill: var(--black); stroke: var(--black); }
.ah-svg text.ah-hubtext { fill: #fff; }
.ah-svg .ah-box--warm { fill: var(--cream); stroke: var(--warm); }
.ah-svg .ah-line { fill: none; stroke: var(--charcoal); stroke-width: 2; }
.ah-svg .ah-line--dash { stroke-dasharray: 6 6; stroke: var(--amber); }


.ah-examples { list-style: none; margin: 1rem 0; padding: 0 !important; display: grid; gap: 8px; }
.ah-examples li { padding: 10px 14px; border-left: 3px solid var(--amber); background: var(--stone); border-radius: 0 var(--radius) var(--radius) 0; }
.ah-examples strong { display: block; font-size: 0.78rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 600; }

.ah-prompt { margin: 1rem 0; padding: 12px 14px; background: var(--cream); border: 1px solid var(--warm); border-radius: var(--radius); }

.ah-table-wrap { overflow-x: auto; margin: 1.25rem 0; }
.ah-table { width: 100%; min-width: 560px; border-collapse: collapse; }
.ah-table th, .ah-table td { padding: 12px 14px 12px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.ah-table thead th { font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); font-weight: 600; border-bottom-color: var(--line-strong); }
.ah-table tbody th { font-weight: 600; width: 28%; }
.ah-table--wide { min-width: 680px; }

.ah-parts { list-style: none; margin: 1.5rem 0; padding: 0; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); }
.ah-parts li { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: #fff; }
.ah-parts h3 { font-size: 1.15rem; margin-bottom: 0.4em; }
.ah-parts p { margin: 0 0 0.6em; color: var(--charcoal); }
.ah-options { display: grid; gap: 12px; margin: 1rem 0; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }
.ah-option { padding: 14px 16px; background: var(--cream); border: 1px solid var(--warm); border-radius: var(--radius); }
.ah-option h4 { margin: 0 0 0.3em; font-size: 1rem; }
.ah-option p { margin: 0; }
.ah-line-box { margin: 1.25rem 0; padding: 14px 16px; border-left: 3px solid var(--black); background: var(--stone); font-weight: 500; }

.ah-section { padding: clamp(32px, 6vw, 72px) 0; border-top: 1px solid var(--line); scroll-margin-top: calc(var(--header-height) + 8px); }
.ah-text > h3 { margin: 1.2em 0 0.3em; font-size: 1.1rem; font-weight: 600; }
.ah-text > h3:first-child { margin-top: 0; }
.ah-text > ul { margin: 0.6em 0 1em; padding-left: 1.2em; }
.ah-text li { margin-bottom: 0.5em; }
.ah-section > .ah-fig { margin-top: 28px; }
.ah-cta { margin: 0; padding: clamp(28px, 5vw, 48px) 0; border-top: 1px solid var(--line); display: grid; gap: 16px; }
.ah-cta p { margin: 0; max-width: 40rem; }
.ah-section:first-of-type { border-top: 0; }
.ah-section > h2 { font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2.2rem); margin-bottom: 0.5em; }
.ah-section p, .ah-text > ul { max-width: 44rem; }
.ah-split { display: grid; gap: clamp(20px, 3vw, 40px); }
@media (min-width: 960px) { .ah-split { grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); align-items: start; } }
.ah-split > * { min-width: 0; }
.ah-routes { display: grid; gap: 16px; margin: 1.25rem 0; grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.ah-routes > div { padding: 18px; border: 1px solid var(--line); border-radius: var(--radius-lg); }
.ah-routes h3 { font-size: 1.2rem; }
.ah-routes p { margin: 0; }

.ah-footnote { margin: 0; padding-block: 24px 24px; font-size: 0.85rem; color: var(--muted); max-width: 52rem; }

/* Illustrations drawn in the style of the Home Assistant app (colours and sizes follow its Apache-2.0 frontend defaults).
   Scoped to .ha-mock so the rest of the page keeps Tunable's brand. Drawn here: not screenshots, no logo, no web font. */
.ha-mock { --c: #9e9e9e; font-family: Roboto, "Noto Sans", system-ui, sans-serif; font-size: 14px; line-height: 1.4; color: #212121; text-align: left; }
.ha-mock *, .ha-mock *::before, .ha-mock *::after { box-sizing: border-box; }
.ha-mock svg { display: block; }
.ha-amber { --c: #ffc107; } .ha-purple { --c: #926bc7; } .ha-heat { --c: #ff6f22; } .ha-green { --c: #4caf50; } .ha-red { --c: #f44336; } .ha-blue { --c: #03a9f4; } .ha-off { --c: #9e9e9e; }

.ha-tile { display: flex; flex-direction: column; gap: 10px; padding: 10px 8px; min-height: 56px; background: #fff; border: 1px solid rgba(0, 0, 0, 0.12); border-radius: 12px; min-width: 0; }
.ha-tile__row { display: flex; align-items: center; gap: 8px; min-width: 0; }
.ha-ic { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: var(--c); background: color-mix(in srgb, var(--c) 20%, transparent); }
.ha-ic svg { width: 24px; height: 24px; }
.ha-tile__t { display: flex; flex-direction: column; min-width: 0; }
.ha-tile__t b { font-size: 14px; font-weight: 500; line-height: 1.6; overflow-wrap: anywhere; }
.ha-tile__t span { font-size: 12px; color: #727272; line-height: 1.3; }
.ha-slider { position: relative; display: block; height: 36px; border-radius: 8px; background: color-mix(in srgb, var(--c) 20%, transparent); overflow: hidden; }
.ha-slider i { position: absolute; inset: 0 auto 0 0; width: var(--v, 40%); background: var(--c); }
.ha-slider i::after { content: ""; position: absolute; right: 6px; top: 50%; width: 4px; height: 18px; margin-top: -9px; border-radius: 2px; background: #fff; }
.ha-slider--cct { background: linear-gradient(90deg, #ffb74d, #fff3e0 50%, #9ecbff); }
.ha-slider--cct i { width: var(--v, 30%); background: none; }
.ha-slider--cct i::after { right: -2px; width: 6px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35); }
.ha-slider__scale { display: flex; justify-content: space-between; margin-top: -4px; font-size: 11px; color: #727272; }
.ha-pill { display: flex; align-items: center; justify-content: space-between; height: 36px; padding: 0 12px; border-radius: 18px; background: #eee; font-weight: 500; font-size: 14px; }
.ha-pill span { font-size: 18px; color: #727272; }

.ha-heading { display: flex; align-items: center; gap: 8px; margin: 0 4px 8px; font-size: 16px; font-weight: 700; }
.ha-heading svg { width: 20px; height: 20px; color: #212121; }
.ha-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ha-grid--tall > .ha-tile--feat { grid-row: span 2; }
.ha-wide { grid-column: 1 / -1; }
.ha-chips { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.ha-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; background: #fff; border: 1px solid rgba(0, 0, 0, 0.12); border-radius: 18px; font-size: 13px; }
.ha-chip svg { width: 18px; height: 18px; color: #009ac7; }

.ha-phone { max-width: 340px; margin-inline: auto; padding: 8px; border-radius: 34px; background: #e9ebf3; border: 1px solid #d5d8e4; }
.ha-phone__screen { overflow: hidden; border-radius: 28px; background: #fafafa; }
.ha-phone__bar { padding: 18px 16px 14px; background: #03a9f4; color: #fff; font-size: 20px; display: flex; justify-content: space-between; align-items: center; }
.ha-phone__body { padding: 16px 10px 20px; display: grid; gap: 20px; }
.ha-dash { max-width: 560px; padding: 14px; border-radius: 14px; background: #fafafa; border: 1px solid rgba(0, 0, 0, 0.12); display: grid; gap: 12px; }
.ha-dash__bar { margin: -14px -14px 2px; padding: 12px 16px; background: #fff; border-bottom: 1px solid rgba(0, 0, 0, 0.12); border-radius: 14px 14px 0 0; font-size: 18px; }
.ha-dash .ha-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 190px), 1fr)); }

.ha-assist { max-width: 400px; margin-inline: auto; padding: 18px 18px 16px; border-radius: 24px; background: #fff; box-shadow: 0 2px 16px rgba(0, 0, 0, 0.14); }
.ha-assist__head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.ha-assist__head b { display: block; font-size: 24px; font-weight: 400; line-height: 1.2; }
.ha-assist__head small { color: #727272; font-size: 12px; }
.ha-assist__head svg { width: 24px; height: 24px; }
.ha-msgs { display: grid; gap: 12px; }
.ha-msg { margin: 0; padding: 8px 12px; border-radius: 16px; max-width: 86%; font-size: 15px; line-height: 1.35; }
.ha-msg--bot { justify-self: start; background: #e4e6e6; }
.ha-msg--you { justify-self: end; background: #00a9f4; color: #fff; }
.ha-assist__foot { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; padding: 8px 12px; background: #f4f4f4; border-bottom: 2px solid #03a9f4; }
.ha-assist__foot small { display: block; color: #03a9f4; font-size: 11px; }
.ha-assist__foot span { color: #727272; }
.ha-assist__foot svg { width: 22px; height: 22px; color: #727272; }

.ha-pair { display: grid; gap: 16px; margin-top: 8px; }
@media (min-width: 720px) { .ha-pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }
.ha-pair > * { min-width: 0; }
.ha-editor { padding: 16px; border-radius: 14px; background: #fafafa; border: 1px solid rgba(0, 0, 0, 0.12); }
.ha-editor h4 { margin: 14px 0 8px; font-size: 18px; font-weight: 400; color: #212121; }
.ha-editor h4:first-child { margin-top: 0; }
.ha-editor h4 small { font-size: 12px; }
.ha-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: #fff; border: 1px solid rgba(0, 0, 0, 0.12); border-radius: 12px; font-size: 14px; min-width: 0; }
.ha-row > svg { flex: none; width: 22px; height: 22px; color: #727272; }
.ha-row__label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ha-row__tag { display: inline-block; margin-left: 4px; padding: 2px 8px; border-radius: 8px; background: #e4e4e4; color: #727272; font-size: 13px; white-space: nowrap; }
.ha-row__menu { color: #212121; font-weight: 700; letter-spacing: 1px; }
.ha-btn { display: inline-block; margin-top: 8px; padding: 8px 14px; border-radius: 20px; background: #5599c8; color: #fff; font-size: 13px; font-weight: 500; }
.ha-yaml { margin: 0; padding: 12px 0; overflow-x: auto; background: #f5f5f5; border: 1px solid rgba(0, 0, 0, 0.12); border-radius: 12px; font-size: 12.5px; line-height: 1.6; color: #212121; max-width: 100%; counter-reset: ln; }
.ha-yaml code { display: block; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; min-width: max-content; }
.ha-yaml .l { display: block; padding-right: 14px; counter-increment: ln; }
.ha-yaml .l::before { content: counter(ln); display: inline-block; width: 2.6em; margin-right: 10px; padding-right: 8px; text-align: right; color: #9a9a9a; border-right: 1px solid #ddd; }
.ha-yaml .k { color: #e07b00; }
.ha-yaml-head { margin: 0 0 6px; font-size: 13px; color: #727272; }

/* Phones: the "smart on its own" diagram fills the column so its smallest label (16 units) draws at 11px or more. */
@media (max-width: 600px) {
  .ah-frame { padding: 8px; }
  .ah-svg { max-width: none; }
}

/* Five-step explainer (data-explain): a list of steps, each with a small line drawing. With ai-home.js it becomes
   a player: one step on a dark stage at a time, its drawing animating, with a progress bar per step. */
.ah-explain { margin: 1.4rem 0 1rem; }
.ah-explain__steps { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.ah-explain__step { display: grid; grid-template-columns: minmax(120px, 200px) 1fr; gap: 20px; align-items: center; padding: 16px 20px; border: 1px solid #e3e0d8; border-radius: 16px; background: #fff; }
.ah-explain__step h3 { margin: 0 0 0.3em; }
.ah-explain__step p { margin: 0 0 0.5em; }
.ah-explain__n { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: #8a6a2f; }
.ah-explain__art svg { display: block; width: 100%; height: auto; }
.ah-explain .ex-line { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ah-explain .ex-dash { stroke-dasharray: 5 6; }
.ah-explain .ex-solid { fill: currentColor; }
.ah-explain .ex-box { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linejoin: round; }
.ah-explain .ex-text { fill: currentColor; font: 600 12px/1 var(--font, sans-serif); }
.ah-explain .ex-glow { fill: #f2b65e; opacity: 0.55; }
.ah-explain .ex-node, .ah-explain .ex-dot { fill: #e9a95a; stroke: none; }
.ah-explain .ex-tick { fill: none; stroke: #1a1408; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.ah-explain .ex-pulse { fill: #e9a95a; opacity: 0; }
@media (max-width: 560px) { .ah-explain__step { grid-template-columns: 1fr; } .ah-explain__art { max-width: 220px; } }

.ah-explain.is-player { border-radius: 22px; background: #0e0e10; color: #f3f1ec; overflow: hidden; }
.is-player .ah-explain__steps { display: block; position: relative; min-height: clamp(300px, 34vw, 400px); }
.is-player .ah-explain__step { position: absolute; inset: 0; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(20px, 4vw, 56px); padding: clamp(22px, 4vw, 52px); border: 0; border-radius: 0; background: none; opacity: 0; visibility: hidden; transition: opacity 0.5s ease, visibility 0s 0.5s; }
.is-player .ah-explain__step.is-on { opacity: 1; visibility: visible; transition: opacity 0.5s ease; }
.is-player .ah-explain__art { max-width: 420px; justify-self: center; width: 100%; color: #f3f1ec; }
.is-player .ah-explain__step h3 { font-size: clamp(1.5rem, 1rem + 1.8vw, 2.4rem); font-weight: 300; letter-spacing: -0.02em; color: #fff; }
.is-player .ah-explain__step p { color: rgba(243, 241, 236, 0.78); max-width: 34rem; }
.is-player .ah-explain__n { color: #e9a95a; }
.is-player .ah-explain__step .text-link { color: #fbe3b8; }
.is-player .ah-explain__words > * { opacity: 0; transform: translateY(10px); }
.is-player .is-on .ah-explain__words > * { opacity: 1; transform: none; transition: opacity 0.5s ease, transform 0.5s ease; }
.is-player .is-on .ah-explain__words > :nth-child(2) { transition-delay: 0.15s; }
.is-player .is-on .ah-explain__words > :nth-child(3) { transition-delay: 0.3s; }
.is-player .is-on .ah-explain__words > :nth-child(4) { transition-delay: 0.45s; }
.ah-explain__bar { display: flex; align-items: center; gap: 10px; padding: 12px clamp(14px, 3vw, 28px) 16px; border-top: 1px solid rgba(243, 241, 236, 0.12); }
.ah-explain__btn { flex: none; width: 36px; height: 36px; padding: 0; border: 1px solid rgba(243, 241, 236, 0.3); border-radius: 50%; background: none; color: #f3f1ec; font: inherit; font-size: 1.3rem; line-height: 1; cursor: pointer; }
.ah-explain__btn:hover { background: rgba(243, 241, 236, 0.12); }
.ah-explain__btn[data-act="toggle"]::before { content: ""; display: inline-block; width: 10px; height: 12px; border-inline: 3px solid currentColor; }
.ah-explain__btn[data-act="toggle"].is-paused::before { width: 0; height: 0; border-block: 7px solid transparent; border-inline: 11px solid currentColor; border-inline-end: 0; margin-left: 3px; }
.ah-explain__track { flex: 1; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; margin: 0; padding: 0; list-style: none; }
.ah-explain__track button { display: grid; gap: 7px; width: 100%; padding: 4px 0; border: 0; background: none; color: rgba(243, 241, 236, 0.55); font: inherit; font-size: 0.78rem; text-align: left; cursor: pointer; }
.ah-explain__track button span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ah-explain__track button.is-on { color: #fff; }
.ah-explain__track i { display: block; height: 3px; border-radius: 2px; background: linear-gradient(90deg, #e9a95a calc(var(--f, 0) * 100%), rgba(243, 241, 236, 0.22) 0); }
.ah-explain__track .is-done i { background: #e9a95a; }
.ah-explain :focus-visible { outline: 2px solid #e9a95a; outline-offset: 3px; }
@media (max-width: 700px) {
  .is-player .ah-explain__steps { min-height: 470px; }
  .is-player .ah-explain__step { grid-template-columns: 1fr; align-content: start; gap: 12px; }
  .is-player .ah-explain__art { max-width: 240px; justify-self: start; }
  .ah-explain__track button span { display: none; }
}
/* The drawings come alive on the step that is playing. */
@media (prefers-reduced-motion: no-preference) {
  .is-player .ex-draw { stroke-dasharray: 700; stroke-dashoffset: 700; }
  .is-player .ex-draw.ex-dash { stroke-dasharray: 5 6; stroke-dashoffset: 0; opacity: 0; }
  .is-player .ex-a1, .is-player .ex-a2, .is-player .ex-a3, .is-player .ex-a4 { opacity: 0; }
  .is-player .is-on .ex-draw { animation: ah-ex-draw 1.6s ease forwards 0.2s; }
  .is-player .is-on .ex-draw.ex-dash { animation: ah-ex-in 0.6s ease forwards 0.4s; }
  .is-player .is-on .ex-a1 { animation: ah-ex-in 0.6s ease forwards 0.7s; }
  .is-player .is-on .ex-a2 { animation: ah-ex-in 0.6s ease forwards 1.3s; }
  .is-player .is-on .ex-a3 { animation: ah-ex-in 0.6s ease forwards 1.9s; }
  .is-player .is-on .ex-a4 { animation: ah-ex-in 0.6s ease forwards 2.5s; }
  .is-player .is-on .ex-glow { animation: ah-ex-glow 0.9s ease forwards; }
  .is-player .is-on .ex-glow.ex-a1 { animation-delay: 0.7s; } .is-player .is-on .ex-glow.ex-a2 { animation-delay: 1.3s; } .is-player .is-on .ex-glow.ex-a3 { animation-delay: 1.9s; }
  .is-player .is-on .ex-pulse { animation: ah-ex-pulse 1.8s linear infinite 1s; }
  @keyframes ah-ex-draw { to { stroke-dashoffset: 0; } }
  @keyframes ah-ex-in { from { opacity: 0; } to { opacity: 1; } }
  @keyframes ah-ex-glow { from { opacity: 0; } to { opacity: 0.6; } }
  @keyframes ah-ex-pulse { 0% { opacity: 0; transform: translateX(0); } 15% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; transform: translateX(52px); } }
}
