/**
 * Reveals are scoped to html.anim, set by a one-line script in the head.
 * If that script never runs, nothing is ever hidden and the page reads as
 * plain prerendered HTML — the failure mode is "no animation", never
 * "no content".
 *
 * do9.in — the styles the React bundle used to apply at runtime.
 *
 * Loaded after the main stylesheet, which supplies every token used here
 * (--color-ink, --color-rule and the rest). Content is legible without
 * this file; it adds motion, the mobile sheet and the enquiry dialog.
 */

/* ------------------------------------------------------------------
   Reveals
   Only engaged when motion is welcome, so a reduced-motion reader gets
   the finished state immediately rather than a transition they did not ask for.
------------------------------------------------------------------ */
@media (prefers-reduced-motion: no-preference) {
  .anim .rv {
    opacity: 0;
    transform: translateY(26px);
    transition: opacity .85s cubic-bezier(.22, 1, .36, 1),
                transform .85s cubic-bezier(.22, 1, .36, 1);
  }
  .anim .rv.in { opacity: 1; transform: none; }

  .anim .wd {
    display: inline-block;
    transform: translateY(110%);
    transition: transform .95s cubic-bezier(.22, 1, .36, 1);
  }
  .anim .wd.in { transform: none; }

  .anim .rl {
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 1s cubic-bezier(.22, 1, .36, 1);
  }
  .anim .rl.in { transform: none; }
}

/* ------------------------------------------------------------------
   Header
------------------------------------------------------------------ */
#main-navigation-header {
  transition: transform .5s cubic-bezier(.22, 1, .36, 1),
              border-color .4s ease,
              padding .4s ease;
}
#main-navigation-header.scrolled { border-color: var(--color-rule); }
#main-navigation-header.retreat { transform: translateY(-100%); }

.do9-progress {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  width: 100%;
  background: var(--color-ink);
  transform: scaleX(0);
  transform-origin: left;
  opacity: 0;
  transition: opacity .3s ease;
}
#main-navigation-header.scrolled .do9-progress { opacity: 1; }

body.menu-open { overflow: hidden; }

/* ------------------------------------------------------------------
   Mobile sheet
   Full height rather than a dropdown: a five-item menu hanging off the
   top of a phone screen is harder to hit than a page that owns the view.
------------------------------------------------------------------ */
#do9-drawer {
  position: fixed;
  inset: 73px 0 0;
  z-index: 40;
  background: var(--color-paper);
  display: flex;
  flex-direction: column;
}
#do9-drawer[hidden] { display: none; }
#do9-drawer nav { flex: 1; overflow-y: auto; padding: 16px 24px 0; }

.do9-drawer-link {
  display: flex;
  align-items: baseline;
  gap: 16px;
  width: 100%;
  padding: 24px 0;
  border-bottom: 1px solid var(--color-rule);
  color: var(--color-body);
  text-decoration: none;
}
.do9-drawer-link[aria-current] { color: var(--color-ink); }
.do9-drawer-index {
  font-size: .625rem;
  font-weight: 600;
  letter-spacing: .18em;
  color: var(--color-muted);
  font-variant-numeric: tabular-nums;
}

.do9-drawer-foot {
  border-top: 1px solid var(--color-rule);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.do9-drawer-call {
  text-align: center;
  font-size: .8125rem;
  color: var(--color-muted);
  text-decoration: none;
}

@media (min-width: 768px) {
  #do9-drawer { display: none; }
}

/* ------------------------------------------------------------------
   Enquiry dialog
------------------------------------------------------------------ */
#do9-dialog { position: fixed; inset: 0; z-index: 80; }
#do9-dialog[hidden] { display: none; }

.do9-dialog-scrim {
  position: absolute;
  inset: 0;
  background: rgba(17, 17, 17, .55);
  backdrop-filter: blur(2px);
  animation: do9-fade .3s ease;
}
@keyframes do9-fade { from { opacity: 0; } }

.do9-dialog-panel {
  position: absolute;
  inset: auto 0 0;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--color-paper);
  padding: 40px 24px 32px;
  animation: do9-rise .45s cubic-bezier(.22, 1, .36, 1);
}
@keyframes do9-rise { from { transform: translateY(24px); opacity: 0; } }

@media (min-width: 720px) {
  .do9-dialog-panel {
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    width: min(640px, calc(100vw - 48px));
    padding: 48px;
  }
  @keyframes do9-rise {
    from { transform: translate(-50%, calc(-50% + 20px)); opacity: 0; }
  }
}

.do9-dialog-x {
  position: absolute;
  top: 14px;
  right: 16px;
  width: 44px;
  height: 44px;
  font-size: 26px;
  line-height: 1;
  color: var(--color-muted);
  background: none;
  border: 0;
  cursor: pointer;
}
.do9-dialog-x:hover { color: var(--color-ink); }

.do9-dialog-form { display: flex; flex-direction: column; margin-top: 32px; }
.do9-dialog-form label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .16em;
  color: var(--color-muted);
  margin-top: 22px;
}
.do9-dialog-form label[for="q-company-website"] { position: absolute; left: -9999px; }

.do9-dialog-form input,
.do9-dialog-form select,
.do9-dialog-form textarea {
  width: 100%;
  margin-top: 10px;
  padding: 11px 0;
  border: 0;
  border-bottom: 1px solid var(--color-rule);
  background: transparent;
  color: var(--color-ink);
  font-family: inherit;
  font-size: 1rem;          /* 16px keeps iOS Safari from zooming on focus */
  border-radius: 0;
  transition: border-color .25s ease;
}
.do9-dialog-form input:focus,
.do9-dialog-form select:focus,
.do9-dialog-form textarea:focus {
  outline: none;
  border-bottom-color: var(--color-ink);
}
.do9-dialog-form textarea { resize: vertical; }

.do9-hp { position: absolute; left: -9999px; width: 0; height: 0; overflow: hidden; }

.do9-dialog-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid var(--color-rule);
}
.do9-dialog-actions p { font-size: .75rem; color: var(--color-muted); margin: 0; }

.do9-sent { padding: 8px 0 4px; }

/* Keyboard users must be able to see where they are. */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--color-ink);
  outline-offset: 3px;
}

/* ------------------------------------------------------------------
   Client links
   Expanded to a 44px touch target with a pseudo-element, so the tap
   area grows without pushing the caption lines apart. Same trick the
   rest of the site uses for quiet links.
------------------------------------------------------------------ */
#clients-section figcaption a {
  position: relative;
  display: inline-block;
}
#clients-section figcaption a::after {
  content: '';
  position: absolute;
  inset: -14px -10px;
}
