/* /brain/: the app gallery. Tokens, type, header, footer and buttons come from /styles.css. */
.brain-gallery { max-width: calc(var(--wide) + 2 * var(--gutter)); padding-top: 52px; }
.gallery-intro { display: grid; grid-template-columns: minmax(0, 1fr) 360px; align-items: center; gap: 32px; margin-bottom: 44px; }
.gallery-intro .eyebrow { margin-bottom: 14px; }
.gallery-intro h1 { font-size: clamp(44px, 5.9vw, 76px); }
.gallery-intro h1 .verb { display: inline; margin: 0; padding: 0; border: 0; background: none; font: inherit; color: inherit; letter-spacing: inherit; cursor: default; }
html.js .gallery-intro h1 .verb { cursor: pointer; transition: color 240ms var(--ease-out); }
html.js .gallery-intro h1 .verb:hover { color: var(--brand-text); }
.gallery-intro h1 .verb[aria-pressed="true"] { color: var(--brand-text); }
.gallery-intro h1 .verb:focus-visible { outline-offset: 4px; border-radius: 6px; }
.gallery-intro .lead { margin-top: 20px; max-width: 48ch; }
.gallery-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 32px; }   /* sits under the quick tiles: the apps come first */
.quick-apps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; scroll-margin-top: 100px; }
.quick-apps > a { display: flex; align-items: center; gap: 12px; padding: 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); color: var(--ink); text-decoration: none; }
.quick-apps > a:hover { border-color: var(--brand-text); background: var(--brand-tint); }
.quick-apps img { flex: none; width: 40px; height: 40px; border-radius: 9px; }
.quick-apps strong { display: block; font-size: 17px; line-height: 1.25; }
.quick-apps span > span { display: block; margin-top: 3px; color: var(--ink-soft); font-size: 15px; }
.hub-services { margin-top: 56px; padding: clamp(22px, 4vw, 48px); border: 1px solid var(--line); border-radius: 24px; background: var(--brand-tint); scroll-margin-top: 100px; }
.hub-builder { display: flex; align-items: center; gap: 22px; }
.hub-portrait { flex: none; width: 88px; height: 88px; border-radius: 50%; object-fit: cover; }
.hub-builder .eyebrow { margin-bottom: 10px; }
.hub-builder h2 { max-width: 26ch; font-size: clamp(30px, 3.8vw, 46px); }
.hub-intro { max-width: 66ch; margin-top: 22px; color: var(--ink-soft); }
.hub-service-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 28px; }
.hub-service { display: flex; flex-direction: column; align-items: flex-start; gap: 16px; padding: clamp(20px, 3vw, 28px); background: var(--surface); border: 1px solid var(--line); border-radius: 18px; }
.hub-service > p { color: var(--ink-soft); }
.hub-service .hub-price { margin-top: auto; padding-top: 4px; color: var(--ink); font-weight: 700; }
.hub-price span { display: block; font-size: 16px; font-weight: 400; color: var(--ink-soft); }
.hub-service .btn { margin-top: 4px; }
.hub-workshops { margin-top: 22px; color: var(--ink-soft); }
.hub-contact { display: flex; flex-wrap: wrap; align-items: center; gap: 14px 24px; margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--line); }
.hub-contact a { overflow-wrap: anywhere; }
.hub-referral { margin-top: 20px; font-size: 16px; color: var(--ink-soft); }
@media (max-width: 900px) {
  .quick-apps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .quick-apps { gap: 10px; }
  .quick-apps > a { gap: 10px; padding: 12px; }
  .quick-apps strong { font-size: 16px; }
  .quick-apps img { width: 32px; height: 32px; }
  .hub-service-grid { grid-template-columns: minmax(0, 1fr); }
  .hub-builder { flex-direction: column; align-items: flex-start; gap: 16px; }
  .hub-services { margin-top: 40px; }
}
.brain-assembly { position: relative; width: 360px; height: 240px; }
.assembly-lines { width: 100%; height: 100%; color: var(--brand-text); }
.assembly-lines path { stroke: currentColor; stroke-width: 1.5; opacity: .38; }
.assembly-lines circle { stroke: currentColor; opacity: .14; }
/* Each icon is a plain link to its app (mouse/touch convenience; the quick tiles carry the accessible links).
   The lift lives on the img because the arrive animation holds transform: none on the link. */
.assembly-icon { position: absolute; display: block; width: 80px; height: 80px; border-radius: 18px; box-shadow: 0 12px 30px -18px var(--shadow); transition: box-shadow 220ms var(--ease-out); }
.assembly-icon img { width: 100%; height: 100%; border-radius: inherit; transition: transform 220ms var(--ease-out); }
.assembly-icon:hover { box-shadow: 0 16px 34px -16px var(--shadow); }
.assembly-icon:hover img { transform: translateY(-4px) scale(1.04); }
.assembly-tl { left: 50px; top: 20px; }
.assembly-tr { right: 50px; top: 20px; }
.assembly-bl { left: 50px; bottom: 20px; }
.assembly-br { right: 50px; bottom: 20px; }
.app-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 28px; scroll-margin-top: 96px; }
.app-card { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--line); border-radius: 22px; overflow: hidden; background: var(--surface); color: var(--ink); text-decoration: none; box-shadow: 0 8px 24px -24px var(--shadow); transition: border-color 220ms, box-shadow 220ms, transform 300ms var(--ease-out); }
.app-card:hover { color: var(--ink); border-color: var(--brand-text); box-shadow: 0 18px 40px -28px var(--shadow); }
.app-card:focus-visible { outline-offset: 5px; }
.app-info { padding: 28px 28px 24px; flex: 1; }
.app-heading { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.app-heading > div { min-width: 0; }
.app-icon { width: 72px; height: 72px; flex: none; border-radius: 16px; }
.app-category { color: var(--brand-text); font-size: 15px; font-weight: 700; margin-bottom: 5px; }
.app-heading h2 { font-size: clamp(28px, 2.7vw, 36px); line-height: 1.08; }
.app-description { color: var(--ink-soft); font-size: 18px; line-height: 1.55; }
.app-preview { margin: 0 20px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--brand-tint); }
.app-preview img { width: 100%; aspect-ratio: 8 / 5; object-fit: cover; transition: transform 650ms var(--ease-out); }
.app-link { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 20px 28px 24px; font-size: 16px; color: var(--ink-soft); }
.app-link > span:first-child { overflow-wrap: anywhere; }
.app-open { padding: 9px 17px; border-radius: 999px; background: var(--brand-tint); color: var(--brand-text); font-weight: 700; min-height: 48px; display: inline-flex; align-items: center; }
.app-card:hover .app-open { background: var(--brand); color: var(--on-brand); }
.brain-gallery .brain-note { margin-top: 32px; }
.brain-gallery .brain-note a { display: inline-block; padding-block: 10px; }
@keyframes icon-arrive { from { opacity: 0; transform: translate3d(var(--arrive-x, 0), var(--arrive-y, 0), 0) rotate(var(--arrive-rotate, 0deg)) scale(.8); } to { opacity: 1; transform: none; } }
@keyframes connect-apps { from { stroke-dashoffset: 700; opacity: 0; } to { stroke-dashoffset: 0; opacity: .38; } }
@keyframes gallery-arrive { from { opacity: .35; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: no-preference) {
  .assembly-tl { --arrive-x: -35px; --arrive-y: -20px; --arrive-rotate: -12deg; }
  .assembly-tr { --arrive-x: 35px; --arrive-y: -20px; --arrive-rotate: 12deg; }
  .assembly-bl { --arrive-x: -35px; --arrive-y: 20px; --arrive-rotate: 10deg; }
  .assembly-br { --arrive-x: 35px; --arrive-y: 20px; --arrive-rotate: -10deg; }
  .assembly-icon { animation: icon-arrive 1.5s var(--ease-out) both; }
  .assembly-tr { animation-delay: .15s; }
  .assembly-bl { animation-delay: .3s; }
  .assembly-br { animation-delay: .45s; }
  .assembly-lines path { stroke-dasharray: 700; animation: connect-apps 2.5s var(--ease-out) .2s both; }
  .app-card.is-arriving { animation: gallery-arrive 650ms var(--ease-out) both; }
  @media (hover: hover) and (pointer: fine) {
    .app-card:hover { transform: translateY(-5px); }
    .app-card:hover .app-preview img { transform: scale(1.025); }
  }
}
@media (max-width: 900px) {
  .gallery-intro { grid-template-columns: minmax(0, 1fr) 260px; gap: 20px; }
  .brain-assembly { width: 260px; height: 174px; }
  .assembly-icon { width: 58px; height: 58px; border-radius: 13px; }
  .assembly-tl { left: 36px; top: 14px; }
  .assembly-tr { right: 36px; top: 14px; }
  .assembly-bl { left: 36px; bottom: 14px; }
  .assembly-br { right: 36px; bottom: 14px; }
  .app-info { padding: 22px; }
  .app-heading { gap: 12px; }
  .app-icon { width: 60px; height: 60px; }
  .app-heading h2 { font-size: 28px; }
  .app-link { padding-inline: 22px; }
}
@media (max-width: 700px) {
  .brain-gallery { padding-top: 32px; }
  .gallery-intro { grid-template-columns: minmax(0, 1fr); gap: 0; margin-bottom: 28px; }
  .brain-assembly { display: none; }
  .gallery-intro h1 { font-size: clamp(40px, 12vw, 60px); }   /* keeps "Breathe. Listen." on one line at 320px */
  .gallery-intro .lead { font-size: 18px; margin-top: 16px; }
  .gallery-actions { margin-bottom: 24px; }
  .app-gallery { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .app-heading h2 { font-size: clamp(28px, 6.5vw, 36px); }
  .app-preview { margin-inline: 14px; }
  .app-card { border-radius: 18px; }
}
@media (prefers-reduced-motion: reduce) {
  .app-card, .app-preview img, .assembly-icon, .assembly-icon img { transition: none; }
  .assembly-icon:hover img { transform: none; }
}

/* ---------- App carousel (replaces the stacked cards when JS is on) ----------
   No JS (or brain.js failed): .carousel-bar is hidden and .app-gallery stays the original stacked grid.
   JS on (html.js): .app-gallery becomes a scroll-snap row, one focused card, neighbours peek. */
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.carousel-slide { display: flex; flex-direction: column; min-width: 0; }
.carousel-slide > .app-card { flex: 1; }
.app-carousel:not(.is-ready) .carousel-bar { display: none; }

html.js .app-carousel { --slide-w: min(580px, 78vw); --slide-gap: 16px; scroll-margin-top: 96px; }
html.js .app-carousel .app-gallery {
  position: relative; display: flex; gap: var(--slide-gap); align-items: stretch;
  overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none;
  padding: 20px calc(50% - var(--slide-w) / 2) 14px; margin-block: -6px 0;
}
html.js .app-carousel .app-gallery::-webkit-scrollbar { display: none; }
html.js .app-carousel .carousel-slide { flex: 0 0 var(--slide-w); scroll-snap-align: center; scroll-snap-stop: always; }
html.js .app-carousel .carousel-slide.is-active > .app-card { border-color: var(--brand-text); box-shadow: 0 22px 44px -28px var(--shadow); }
html.js .app-carousel .app-card:hover { transform: none; }
html.js .app-carousel .app-gallery.is-dragging { scroll-snap-type: none; scroll-behavior: auto; user-select: none; }
html.js .app-carousel .app-gallery.is-dragging .app-card { pointer-events: none; }
@media (hover: hover) and (pointer: fine) {
  html.js .app-carousel .app-gallery { cursor: grab; }
  html.js .app-carousel .app-gallery.is-dragging { cursor: grabbing; }
}

.carousel-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 14px 28px; margin-top: 18px; }
.carousel-dots { display: flex; align-items: center; gap: 4px; }
.carousel-dot { position: relative; width: 44px; height: 44px; padding: 0; border: 0; background: none; cursor: pointer; }
.carousel-dot::before { content: ""; position: absolute; left: 50%; top: 50%; width: 28px; height: 5px; border-radius: 999px; background: var(--line); transform: translate(-50%, -50%); transition: background 240ms var(--ease-out), width 300ms var(--ease-out); }
.carousel-dot:hover::before { background: var(--brand-text); }
.carousel-dot[aria-current="true"]::before { width: 40px; background: var(--brand); }
.carousel-controls { display: flex; align-items: center; gap: 8px; }
.carousel-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 48px; min-height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink); font-weight: 700; font-size: 16px; cursor: pointer; transition: border-color 160ms var(--ease-out), background 160ms var(--ease-out); }
.carousel-btn:hover { border-color: var(--brand); background: var(--brand-tint); }

@media (prefers-reduced-motion: no-preference) {
  html.js .app-carousel .carousel-slide { transition: transform 600ms var(--ease-out), opacity 600ms var(--ease-out); transform: scale(.9); opacity: .5; }
  html.js .app-carousel .carousel-slide.is-active { transform: translateY(-6px); opacity: 1; }
}
/* Reduced motion: plain swipeable row. No scaling, no fading. */
@media (prefers-reduced-motion: reduce) {
  html.js .app-carousel .app-gallery { scroll-behavior: auto; }
  .carousel-dot::before, .carousel-btn { transition: none; }
}
@media (max-width: 700px) {
  html.js .app-carousel { --slide-w: 80vw; --slide-gap: 12px; }
  html.js .app-carousel .app-gallery { grid-template-columns: none; }
  .carousel-bar { gap: 12px; }
  .app-description { font-size: 17px; }
}

/* "A moment to understand" strip: one explainer plus a link to the rest, between the apps and the services. */
.hub-learn { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 28px; align-items: center; margin-top: 48px; padding: clamp(20px, 3vw, 32px); border: 1px solid var(--line); border-radius: 24px; background: var(--surface); scroll-margin-top: 100px; }
.hub-learn-video { position: relative; display: block; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #110c0a; }
.hub-learn-video img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; object-fit: cover; }
.hub-learn-play { position: absolute; left: 50%; top: 50%; width: 52px; height: 52px; margin: -26px 0 0 -26px; display: grid; place-items: center; border-radius: 50%; background: var(--brand); color: var(--on-brand); box-shadow: 0 12px 30px -12px var(--shadow); transition: transform 220ms var(--ease-out); }
.hub-learn-play svg { margin-left: 3px; }
.hub-learn-video:hover .hub-learn-play { transform: scale(1.08); }
.hub-learn .eyebrow { margin-bottom: 10px; }
.hub-learn h2 { max-width: 24ch; font-size: clamp(26px, 3.2vw, 38px); line-height: 1.1; }
.hub-learn-intro { margin-top: 14px; max-width: 60ch; color: var(--ink-soft); }
.hub-learn-links { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
@media (max-width: 760px) {
  .hub-learn { grid-template-columns: minmax(0, 1fr); gap: 18px; margin-top: 36px; }
  .hub-learn-video { max-width: 420px; }
}
