/* Adapted from Osmo Supply: Directional Button Hover, Directional List Hover,
   Underline Link Animation and Step-by-step Timeline. See DESIGN.md. */

/* The response moves inside the original target; text and focus stay in place. */
[data-btn-hover] {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  --osmo-button-fill: var(--color-ink);
  --osmo-button-text: var(--color-paper);
}
[data-btn-hover] > :not(.osmo-button-circle) { position: relative; z-index: 1; }
.osmo-button-circle {
  position: absolute;
  z-index: 0;
  pointer-events: none;
  left: 50%;
  top: 50%;
  width: 215%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--osmo-button-fill);
  transform: translate(-50%, -50%) scale(0);
  transition: transform 420ms cubic-bezier(.625,.05,0,1);
}
[data-btn-hover]:focus-visible { color: var(--osmo-button-text); }
[data-btn-hover]:focus-visible .osmo-button-circle { transform: translate(-50%, -50%) scale(1); }
.contact-band [data-btn-hover] {
  --osmo-button-fill: var(--color-paper);
  --osmo-button-text: var(--color-ink);
}

[data-directional-hover-item] { position: relative; isolation: isolate; overflow: hidden; }
[data-directional-hover-item] > :not([data-directional-hover-tile]) { position: relative; z-index: 1; }
[data-directional-hover-tile] {
  position: absolute;
  z-index: -1;
  inset: 0;
  pointer-events: none;
  background: var(--color-accent);
  transform: translateY(-101%);
  transition: transform 300ms cubic-bezier(.16,1,.3,1);
}
[data-directional-hover-item][data-status^="enter"],
[data-directional-hover-item][data-status^="enter"]:hover { color: var(--color-ink); }

/* Osmo's underline draws from the start and retracts towards the end. */
.text-link[data-underline-link] { position: relative; text-decoration: none; border-bottom-color: transparent; }
.text-link[data-underline-link]::before {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 1px;
  background: currentColor;
  transform-origin: right;
  transform: scaleX(0);
  transition: transform 350ms cubic-bezier(.625,.05,0,1);
}
.text-link[data-underline-link]:focus-visible::before { transform-origin: left; transform: scaleX(1); }

/* The complete line and all text are visible in the unenhanced state. */
.method-timeline { position: relative; width: 100%; }
.method-timeline [data-step-timeline-line] {
  position: absolute;
  top: 20px;
  bottom: 20px;
  left: 19px;
  width: 2px;
  pointer-events: none;
  background: var(--color-rule);
}
.method-timeline [data-step-timeline-fill] {
  position: absolute;
  inset: 0;
  background: var(--color-focus);
  transform-origin: top;
}
.method-timeline [data-step-timeline-marker] {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex: none;
  width: 40px;
  height: 40px;
  background: var(--color-paper);
  border: 1px solid var(--color-rule);
  border-radius: 50%;
  color: var(--color-muted);
  font: 500 var(--text-sm)/1 var(--font-body);
  font-variant-numeric: tabular-nums;
  transition: background-color 220ms, color 220ms, border-color 220ms;
}
.method-timeline [data-status="active"] [data-step-timeline-marker] {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-ink);
}
.method-timeline [data-current] [data-step-timeline-marker] { outline: 2px solid var(--color-focus); outline-offset: 4px; }
.method-timeline .method-strips li {
  display: flex;
  gap: var(--space-lg);
  border: 0;
  padding: var(--space-sm) 0;
  line-height: 1.25;
  letter-spacing: -.025em;
}
.method-timeline .method-strips li::before { content: none; }
.method-panel .method-timeline [data-step-timeline-line] { background: var(--color-dark-rule); }
.method-panel .method-timeline [data-step-timeline-fill] { background: var(--color-accent); }
.method-panel .method-timeline [data-step-timeline-marker] { background: var(--color-ink); color: var(--color-paper); border-color: var(--color-dark-rule); }
.method-panel .method-timeline [data-status="active"] [data-step-timeline-marker] { background: var(--color-accent); color: var(--color-ink); border-color: var(--color-accent); }
.method-panel .method-timeline [data-current] [data-step-timeline-marker] { outline-color: var(--color-accent); }
.process-layout { display: grid; grid-template-columns: minmax(0,.8fr) minmax(0,1.2fr); gap: var(--space-2xl); }
.process-layout .steps-list { display: grid; grid-template-columns: 1fr; gap: var(--space-2xl); padding: 0; margin: 0; list-style: none; }
.process-layout .steps-list > li { display: grid; grid-template-columns: 40px minmax(0,1fr); gap: var(--space-xs) var(--space-lg); padding: 0; border: 0; }
.process-layout .steps-list > li::before { content: none; }
.process-layout [data-step-timeline-marker] { grid-column: 1; grid-row: 1; }
.process-layout .steps-list h3 { margin: 4px 0 var(--space-xs); grid-column: 2; grid-row: 1; line-height: 1.25; }
.process-layout .steps-list p { grid-column: 2; }

@media (hover: hover) and (pointer: fine) {
  [data-btn-hover]:hover { background: var(--color-accent); border-color: var(--color-accent); color: var(--osmo-button-text); }
  [data-btn-hover]:hover .osmo-button-circle { transform: translate(-50%, -50%) scale(1); }
  .text-link[data-underline-link]:hover::before { transform-origin: left; transform: scaleX(1); }
}
@media (max-width: 760px) {
  .process-layout { grid-template-columns: 1fr; gap: var(--space-xl); }
  .process-layout .steps-list { gap: var(--space-xl); }
  .method-timeline .method-strips li { gap: var(--space-md); }
}
@media (prefers-reduced-motion: reduce) {
  .osmo-button-circle { display: none; }
  [data-btn-hover]:hover, [data-btn-hover]:focus-visible { background: var(--osmo-button-fill); color: var(--osmo-button-text); }
  [data-directional-hover-tile] { display: none; }
  [data-directional-hover-item]:is(:hover,:focus-visible) { background: var(--color-accent); color: var(--color-ink); }
  .method-timeline [data-step-timeline-fill] { transform: none !important; }
}

/* Osmo Collage Focus: the actual product interfaces form the visual evidence. */
.owned-products [data-interactive-collage-list] { align-items: start; }
.owned-products .technology-group > div > a[data-interactive-collage-item] {
  position: relative;
  isolation: isolate;
  overflow: visible;
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--color-rule);
  row-gap: var(--space-md);
}
.owned-products [data-interactive-collage-item] > .product-collage-media {
  position: relative;
  display: block;
  grid-column: 1 / -1;
  grid-row: 1;
  height: clamp(230px, 28vw, 380px);
  margin-bottom: var(--space-md);
  background: var(--color-ink);
  transform-origin: center;
}
.product-collage-media::before {
  content: attr(data-product-label);
  position: absolute;
  left: 4%;
  bottom: 0;
  font: 500 clamp(48px, 7vw, 100px)/1 var(--font-display);
  letter-spacing: -.04em;
  color: var(--color-paper);
  opacity: .16;
}
.product-collage-media > img { position: absolute; height: auto; object-fit: contain; border: 1px solid var(--color-dark-rule); }
.product-collage-primary { width: 90%; top: 9%; left: 4%; transform: rotate(-3deg); }
.product-collage-secondary { width: 65%; right: -1%; bottom: 12%; transform: rotate(4deg); }
.owned-products [data-interactive-collage-item] > .technology-index-logo { grid-column: 1; grid-row: 2; }
.owned-products [data-interactive-collage-item] > h3 { grid-column: 2; grid-row: 2; align-self: center; }
.owned-products [data-interactive-collage-item] > .icon { grid-column: 3; grid-row: 2; align-self: center; }
.owned-products [data-interactive-collage-item] > p { grid-column: 1 / -1; grid-row: 3; }
.product-collage-caption { grid-column: 1 / -1; font-size: var(--text-xs); color: var(--color-muted); }
.owned-products [data-interactive-collage-focus] { z-index: 2; }

/* Osmo Highlight Marker: two authored lines, no hidden default content. */
.highlight-marker-line { position: relative; display: inline-block; }
.brand-origin [data-highlight-marker-reveal] { display: grid; gap: var(--space-xs); font-size: clamp(36px, 4.2vw, 64px); line-height: 1.12; max-width: 16ch; }
.brand-origin [data-highlight-marker-reveal] br { display: none; }
.brand-origin [data-highlight-marker-reveal] .highlight-marker-line { font: inherit; letter-spacing: inherit; width: fit-content; max-width: 100%; }
.highlight-marker-bar { position: absolute; inset: -.03em 0; background: var(--color-accent); pointer-events: none; transform: scaleX(0); transform-origin: right center; z-index: 1; }

@media (max-width: 760px) {
  .owned-products [data-interactive-collage-item] > .product-collage-media { height: clamp(200px, 62vw, 400px); }
  .product-collage-secondary { width: 64%; right: 1%; }
  .owned-products .technology-group > div > a[data-interactive-collage-item] + a { padding-top: 0; border-top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .product-collage-primary, .product-collage-secondary { transform: none; }
  .highlight-marker-bar { display: none; }
}

/* Interior pages: the same Osmo techniques take different editorial roles. */
.page-hero .interior-marker-title > .highlight-marker-line {
  display: inline-block;
  max-width: 100%;
  font: inherit;
  letter-spacing: inherit;
  line-height: inherit;
}
.page-hero .interior-marker-title > .highlight-marker-line .highlight-marker-bar { inset: 0; }
.service-directory .service-group { grid-template-columns: minmax(0,.8fr) minmax(0,1.2fr); gap: var(--space-2xl); padding-block: var(--space-xl); }
.service-directory .service-group-heading > h3 { font: 500 clamp(28px, 3.2vw, 46px)/1.14 var(--font-display); letter-spacing: -.025em; max-width: 13ch; }
.service-directory .service-group-heading .section-art { width: min(75%, 240px); margin-top: var(--space-lg); }
.service-directory .service-index > a { grid-template-columns: minmax(0,1fr) 24px; padding: var(--space-lg) var(--space-md); }
.service-directory .service-index > a:first-child { border-top: 1px solid var(--color-rule); }
.service-directory .service-index h4 { font-size: clamp(24px, 2.2vw, 32px); }
body[data-page="software"] .technology-index .technology-group { grid-template-columns: minmax(0,.65fr) minmax(0,1.35fr); column-gap: var(--space-2xl); padding-block: var(--space-xl); }
body[data-page="software"] .technology-group-heading > h2 { font: 500 clamp(28px, 3.2vw, 46px)/1.14 var(--font-display); letter-spacing: -.025em; }
body[data-page="software"] .technology-group-heading .section-art { width: min(75%, 240px); margin-top: var(--space-lg); }
body[data-page="software"] .technology-group > div > a { padding-inline: var(--space-md); }
.founder-portrait { position: relative; background: var(--color-ink); transform-origin: center; }
.founder-portrait .founder-photo { width: 100%; }
.founder[data-interactive-collage-focus] { position: relative; z-index: 1; }
.founder:focus-within h3 { color: var(--color-focus); }
@media (min-width: 1024px) {
  .service-directory .service-group-heading,
  body[data-page="software"] .technology-group-heading,
  .intervention-heading { position: sticky; top: var(--space-lg); align-self: start; }
  .service-directory .service-group { min-height: 460px; }
  body[data-page="software"] .technology-index .technology-group { min-height: 360px; }
}

@media (max-width: 1023px) {
  .service-directory .service-group,
  body[data-page="software"] .technology-index .technology-group { grid-template-columns: minmax(0,1fr); gap: var(--space-lg); }
  .service-directory .service-group-heading .section-art,
  body[data-page="software"] .technology-group-heading .section-art { width: 160px; margin-top: var(--space-sm); }
}
@media (max-width: 760px) {
  .service-directory .service-index > a { padding-inline: 0; }
  body[data-page="software"] .technology-group > div > a { padding-inline: 0; }
  .founder-portrait { max-width: 400px; }
}
/* Osmo Supply licensed derivatives: stacking-cards-3d-css,
   pixelated-scroll-transition, social-share-buttons, burger-menu-button.
   https://www.osmo.supply/resource/stacking-cards-3d-css
   https://www.osmo.supply/resource/pixelated-scroll-transition
   https://www.osmo.supply/resource/social-share-buttons
   https://www.osmo.supply/resource/burger-menu-button */
.project-list[data-project-card-stack] {
  --stack-row: 100svh;
  --stack-top: 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 32px;
  view-timeline-name: --kiwui-case-stack;
}
.project-list[data-project-card-stack] > .project-story {
  grid-column: auto;
  display: block;
  padding: 0;
  border: 1px solid var(--color-rule);
  border-radius: 24px;
  background: var(--color-paper);
  color: var(--color-ink);
  transform-origin: 50% 100%;
  scroll-margin-top: 48px;
}
.project-card-inner {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(0, 1.15fr);
  gap: clamp(32px, 5vw, 72px);
  align-items: start;
  padding: clamp(24px, 4vw, 56px);
}
.project-card-number {
  display: block;
  margin-bottom: 40px;
  color: var(--color-muted);
  font: 500 13px/1.5 var(--font-body);
  letter-spacing: .08em;
}
.project-list[data-project-card-stack] .project-card-inner h3 { font-size: clamp(28px, 3vw, 44px); }
.project-list[data-project-card-stack] .project-description { padding: 0; display: grid; grid-template-columns: 1fr; gap: 24px; }
.project-list[data-project-card-stack] .project-description > div + div { margin-top: 0; }
.project-list[data-project-card-stack] .project-card-inner .project-description dt,
.project-list[data-project-card-stack] .project-card-inner .project-stack dt { color: var(--color-muted); }
.project-list[data-project-card-stack] .project-card-inner p { color: var(--color-ink); margin-top: 0; }
.project-list[data-project-card-stack] .project-stack { margin-top: 28px; }
@supports (animation-timeline: view()) {
  @media (min-width: 1024px) and (prefers-reduced-motion: no-preference) {
    .project-list[data-stack-ready] { grid-auto-rows: var(--stack-row); gap: 0; }
    .project-list[data-stack-ready] > .project-story {
      position: sticky;
      top: var(--stack-top);
      display: flex;
      align-items: center;
      height: min(720px, calc(var(--stack-row) - 2 * var(--stack-top)));
      animation: kiwui-card-stack-away linear forwards;
      animation-timeline: --kiwui-case-stack;
      animation-range: exit-crossing calc(var(--stack-i) * var(--stack-row) - 100svh) exit-crossing calc(var(--stack-i) * var(--stack-row) - var(--stack-top));
    }
    .project-list[data-stack-ready] > .project-story:last-child { animation: none; }
    .project-list[data-stack-ready] > .project-story:focus-within { animation: none; transform: none; filter: none; }
  }
}
@keyframes kiwui-card-stack-away {
  to { transform: perspective(60em) rotateX(25deg) scale(.85); filter: brightness(.75); }
}
@media (max-width: 767px) {
  .project-card-inner { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .project-card-number { margin-bottom: 24px; }
  .project-list[data-project-card-stack] .project-card-inner h3 { margin-bottom: 0; }
}

/* Osmo's responsive pixel grid covers the photograph as it leaves the viewport. */
.photo-band > .pixelated-scroll-transition {
  position: absolute;
  inset: auto 0 0;
  z-index: 1;
  pointer-events: none;
  color: var(--color-paper);
  overflow: hidden;
  max-height: 100%;
}
.photo-band > div { z-index: 2; }
[data-pixelated-scroll-panel] { display: flex; width: 100%; }
[data-pixelated-scroll-column] { display: flex; flex-direction: column; justify-content: flex-end; flex: 1 1 0%; min-width: 0; }
[data-pixelated-scroll-pixel] { display: block; aspect-ratio: 1; width: 100%; background: currentColor; backface-visibility: hidden; }

/* Osmo Social Share appearance, adapted to native Kiwui profile anchors. */
.site-footer .footer-social { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; max-width: 122px; }
.site-footer .footer-social li { margin: 0; }
.site-footer .social-share__button {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 48px;
  height: 48px;
  min-height: 48px;
  padding: 0;
  border: 1px solid var(--color-rule);
  border-radius: 50%;
  background: var(--color-paper);
  color: var(--color-ink);
  position: relative;
  overflow: hidden;
  text-decoration: none;
}
.social-share__icon { display: flex; width: 22px; }
.site-footer .social-share__icon > svg { width: 22px; height: 22px; flex: none; }
.site-footer .social-share__button:is(:hover, :focus-visible) { color: var(--color-ink); background: var(--color-accent); }
@media (prefers-reduced-motion: no-preference) {
  .social-share__button { transition: transform .4s cubic-bezier(.625,.05,0,1), background-color .4s, border-color .4s; }
  .footer-social:has(a:focus-visible) .social-share__button { transform: scale(.9); }
  .footer-social:has(a:focus-visible) .social-share__button:focus-visible { transform: scale(1.1); }
  @media (hover: hover) and (pointer: fine) {
    .footer-social:has(a:hover) .social-share__button { transform: scale(.9); }
    .footer-social:has(a:hover) .social-share__button:hover { transform: scale(1.1); }
  }
}

/* Osmo's three-line departure and cross arrival; aria-expanded owns state. */
.menu-button { flex-flow: column; justify-content: center; align-items: center; gap: 3px; overflow: hidden; }
.menu-button-line { display: block; flex: none; width: 26px; height: 3px; background: currentColor; transform-origin: center; }
.menu-button[aria-expanded="true"] .menu-button-line:nth-child(1) { transform: translateY(6px) rotate(-135deg) scaleX(.9); }
.menu-button[aria-expanded="true"] .menu-button-line:nth-child(2) { transform: scaleX(0); opacity: 0; }
.menu-button[aria-expanded="true"] .menu-button-line:nth-child(3) { transform: translateY(-6px) rotate(135deg) scaleX(.9); }
@media (prefers-reduced-motion: no-preference) {
  .menu-button-line { transition: transform .45s cubic-bezier(.5,.05,.05,.99), opacity .3s; }
  .menu-button[aria-expanded="true"] .menu-button-line:first-child { animation: kiwui-burger-top .7s cubic-bezier(.5,.05,.05,.99) both; }
  .menu-button[aria-expanded="true"] .menu-button-line:last-child { animation: kiwui-burger-bottom .8s cubic-bezier(.5,.05,.05,.99) both; }
}
@keyframes kiwui-burger-top {
  0% { transform: none; opacity: 1; }
  40% { transform: translateX(-1.3em); opacity: 0; }
  41% { transform: translateY(-1.3em) rotate(-135deg) scaleX(.9); opacity: 0; }
  100% { transform: translateY(6px) rotate(-135deg) scaleX(.9); opacity: 1; }
}
@keyframes kiwui-burger-bottom {
  0% { transform: none; opacity: 1; }
  40% { transform: translateX(1.3em); opacity: 0; }
  41% { transform: translateY(-1.4em) rotate(135deg) scaleX(.9); opacity: 0; }
  100% { transform: translateY(-6px) rotate(135deg) scaleX(.9); opacity: 1; }
}
