/* Enhancements layered on top of the base sheets: type tuning, touch comfort,
   gentle motion, the data preview in the demo, case notes and the contact form. */

/* --- Type tuning for Instrument Sans / Instrument Serif --- */
:root { interpolate-size: allow-keywords; }
body { font-optical-sizing: auto; }
.intro-title, .section-intro h2, .about h2 { letter-spacing: -.045em; }
.service h3 { letter-spacing: -.04em; }
.contact h2 { letter-spacing: -.05em; }
.intro-title em, .about h2 em { font-style: italic; font-size: 1.12em; line-height: .9; letter-spacing: -.025em; }
.contact h2 > span { font-size: 1.1em; letter-spacing: 0; }
.journey-stop { font-size: 20px; }
.visual-signature { font-size: 19px; }
.flow-connector.active .transfer-time { font-weight: 400; }

/* --- Domino mark: the two leaning tiles that form the "y" of the wordmark; the short one is the accent --- */
.engine-diagram .engine-star, .brand-intro-star { color: #fff1da; --mark-z: #e2e8be; }
.journey-cursor[data-surface='card'], .journey-cursor[data-surface='terracotta'] { --cursor-color: #fff1da; --mark-z: #e2e8be; }
.journey-cursor[data-surface='paper'] { --cursor-color: var(--ink); --mark-z: #ca603f; }
.journey-cursor[data-surface='dark'] { --cursor-color: var(--surface); --mark-z: #ca603f; }
.about-asterisk { --mark-z: var(--surface); }
.about-asterisk svg { display: block; width: 1em; height: 1em; }
.brand-intro-domino { position: absolute; z-index: 3; pointer-events: none; }
.brand-intro-domino > div { width: 100%; height: 100%; }

/* --- Hero card: labels follow the domino run — the trigger, the falling tile, the next one in line --- */
.system-card .marker-two { top: 77%; left: 36%; right: auto; }
.system-art .marker-three { top: 60%; bottom: auto; left: auto; right: 12%; }
/* The marker belongs to the mark: once the mark has left the card, it stays out of sight. */
.mark-away .engine-diagram .mark-runner { visibility: hidden; }

/* --- Accordion opens smoothly where the browser supports it --- */
.service::details-content { block-size: 0; overflow: clip; transition: block-size .4s cubic-bezier(.2, .7, .2, 1), content-visibility .4s allow-discrete; }
.service[open]::details-content { block-size: auto; }

/* --- Hero: layers drift with the pointer, the star's card stays put --- */
.system-card-back { translate: calc(var(--px, 0) * -10px) calc(var(--py, 0) * -8px); }
.system-note { translate: calc(var(--px, 0) * 14px) calc(var(--py, 0) * 10px); }
.system-card .orbit-marker { translate: calc(var(--px, 0) * 7px) calc(var(--py, 0) * 6px); }
.visual-signature, .visual-caption { translate: calc(var(--px, 0) * -6px) calc(var(--py, 0) * -4px); }
.system-note { transition: box-shadow .3s; }
.intro-visual:hover .system-note { box-shadow: 0 12px 18px -12px #292b2590; }
.intro-primary { transition: background .2s, transform .2s, translate .35s cubic-bezier(.2, .7, .2, 1); }
.flow-play { transition: background .2s, translate .35s cubic-bezier(.2, .7, .2, 1); }

/* --- Sections ease in as they are reached --- */
.reveal-ready [data-reveal] { opacity: 0; translate: 0 20px; transition: opacity .7s cubic-bezier(.2, .7, .2, 1), translate .7s cubic-bezier(.2, .7, .2, 1); transition-delay: var(--reveal-delay, 0ms); }
.reveal-ready [data-reveal].is-visible { opacity: 1; translate: none; }
.motion-paused [data-reveal] { opacity: 1; translate: none; transition: none; }

/* --- Demo: each step shows the sample data it is handling --- */
.step-preview { margin: 16px 0 0; min-height: 6.4em; padding: 10px 12px; border: 1px dashed var(--line); border-radius: 5px; background: #ffffff55; color: var(--muted); font: 11px/1.6 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; transition: border-color .3s, background .3s, color .3s; }
.step-preview:empty::before { content: '· · ·'; opacity: .6; }
.flow-step.active .step-preview { border-style: solid; border-color: #c8765c; background: var(--surface); color: var(--ink); }
.flow-step.active .step-preview::after { content: '▍'; color: var(--accent); animation: caret-blink 1s steps(2, jump-none) infinite; }
.flow-step.done .step-preview { border-style: solid; border-color: #c6cba9; background: var(--surface); color: var(--ink); }
@keyframes caret-blink { from { opacity: 1; } to { opacity: 0; } }

/* --- Case notes --- */
.cases { margin-top: 80px; scroll-margin-top: 40px; }
.cases-head { display: flex; align-items: baseline; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.cases-head h3 { font-size: clamp(28px, 2.8vw, 38px); line-height: 1.1; font-weight: 400; letter-spacing: -.04em; }
.cases-head .eyebrow { color: var(--muted); text-align: right; }
.case-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.case { display: flex; flex-direction: column; gap: 18px; padding: 26px 24px 24px; background: var(--paper); border: 1px solid var(--line); border-radius: 8px; transition: translate .3s cubic-bezier(.2, .7, .2, 1), border-color .3s, box-shadow .3s; }
.case:hover { translate: 0 -4px; border-color: #c8765c; box-shadow: 0 16px 26px -22px #332b2490; }
.case-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; font: 10px var(--mono); letter-spacing: .04em; color: var(--muted); }
.case-top span:last-child { padding: 6px 11px; border: 1px solid var(--line); border-radius: 100px; color: var(--accent); }
.case h4 { margin: 0; font-size: 24px; line-height: 1.15; font-weight: 400; letter-spacing: -.035em; }
.case dl { display: grid; gap: 14px; margin: 0; }
.case dt { margin-bottom: 4px; font: 10px var(--mono); letter-spacing: .04em; color: var(--muted); }
.case dd { margin: 0; font-size: 14px; line-height: 1.55; }
.case dl > div:last-child { padding-top: 14px; border-top: 1px solid var(--line); }
.case dl > div:last-child dt { color: var(--accent); }

/* --- Contact form --- */
.contact-form { display: grid; grid-template-columns: 1fr 1fr; gap: 26px 36px; max-width: 780px; margin: 0 0 56px; }
.field { display: grid; gap: 6px; }
.field--wide, .form-actions, .form-note { grid-column: 1 / -1; }
.field label { font: 10px var(--mono); letter-spacing: .045em; }
.field input, .field textarea { width: 100%; padding: 10px 0; border: 0; border-bottom: 1px solid #f7f3eb90; border-radius: 0; background: transparent; color: inherit; font: 17px/1.5 var(--sans); transition: border-color .2s, box-shadow .2s; }
.field textarea { min-height: 104px; resize: vertical; }
.field input:focus-visible, .field textarea:focus-visible { outline: none; border-bottom-color: var(--sage); box-shadow: 0 2px 0 var(--sage); }
.field input:-webkit-autofill { -webkit-text-fill-color: var(--surface); caret-color: var(--surface); box-shadow: 0 0 0 100px var(--accent) inset; }
.form-trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-actions { display: flex; align-items: center; gap: 16px 26px; flex-wrap: wrap; }
.form-submit { display: flex; align-items: center; gap: 24px; min-height: 52px; padding: 15px 22px; border-radius: 6px; background: var(--surface); color: var(--ink); font-size: 14px; transition: background .2s, translate .35s cubic-bezier(.2, .7, .2, 1); }
.form-submit:hover { background: var(--sage); }
.form-submit span { font-size: 18px; }
.form-status { font-size: 14px; line-height: 1.5; }
.form-status a { text-decoration: underline; text-underline-offset: 4px; }
.form-note { font-size: 12px; line-height: 1.5; opacity: .85; }

@media (max-width: 1100px) {
  .case-grid { grid-template-columns: 1fr; }
  .case { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 14px 32px; }
  .case-top { grid-column: 1 / -1; }
}

/* --- Small screens: nothing below 10px, comfortable touch targets --- */
@media (max-width: 800px) {
  .section-topline > .eyebrow, .intro-footer > .eyebrow, .intro-scroll, .intro-footer .motion-toggle, .brand-signal-replay,
  .flow-overview .eyebrow, .flow-step .eyebrow, .flow-count, .step-state, .service-tags span { font-size: 10px; }
  .intro .header-caption { font-size: 9px; }
  .menu-toggle, .menu-close { min-height: 44px; }
  .intro-secondary { padding: 14px 0; }
  .intro-scroll, .intro-footer .motion-toggle, .brand-signal-replay, .back-top { min-height: 44px; }
  .text-link { padding: 12px 0; }
  .email-link { display: inline-block; padding: 11px 0; }
  .copy-email { width: 44px; height: 44px; }
  .journey-stop, .playground .journey-stop, .about .journey-stop, .contact .journey-stop { font-size: 17px; }
  .cases { margin-top: 60px; }
  .cases-head { flex-direction: column; gap: 8px; }
  .cases-head .eyebrow { text-align: left; }
  .case { display: flex; }
  .contact-form { grid-template-columns: 1fr; gap: 22px; margin-bottom: 44px; }
  .form-submit { width: 100%; justify-content: space-between; }
}
@media (max-width: 480px) {
  .section-topline > .eyebrow:last-child { font-size: 10px; max-width: 150px; }
  .intro-eyebrow { font-size: 10px; letter-spacing: .02em; }
  .intro-description { font-size: 15px; }
  .intro-primary, .intro-secondary { font-size: 12px; }
  .intro-primary { padding: 16px 17px; }
  .system-card-top, .system-card-bottom { font-size: 9px; }
  .system-note { font-size: 11px; }
  .section-intro > p, .service-content > p, .about-copy { font-size: 15px; }
  .flow-step p { font-size: 13px; }
  .scenario-tabs button span { font-size: 12px; }
  .demo-note { font-size: 11px; }
  .approach-grid p, .contact-bottom > p { font-size: 14px; }
  .site-footer { font-size: 10px; }
  .step-preview { font-size: 10.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .reveal-ready [data-reveal] { opacity: 1; translate: none; }
  .system-card-back, .system-note, .system-card .orbit-marker, .visual-signature, .visual-caption { translate: none; }
}
