/* Studio Olivers Contact Dock
   ==========================

   Every colour, size, corner, blur, easing and duration is a custom property
   on .sodock, below. To make a version for a client, change these and leave
   the rest of the file alone. The settings page fills in the colours and
   fonts marked "(settings)", so change those there.

   Sizes are in px rather than rem on purpose: Bricks and some other themes
   shrink rem (html { font-size: 62.5% }), which would shrink the dock too.

   Every selector starts with .sodock, so the site's own styles for buttons,
   links and headings can't reach in and restyle it. */

.sodock {
  /* Colours */
  --sodock-accent: #ee382b;                    /* (settings) the button, the line under the person, focus rings */
  --sodock-button-text: #ffffff;               /* (settings) words on the button */
  --sodock-dock: rgb(212 210 212 / 0.6);       /* (settings) frosted glass round the button */
  --sodock-text: #131213;                      /* (settings) sheet text, the main card and the cross */
  --sodock-card: #f1efed;                      /* (settings) Call and WhatsApp cards, close button */
  --sodock-online: #2bd4a4;                    /* (settings) status dot in working hours */
  --sodock-away: #b8b8b8;                      /* (settings) status dot outside them */
  --sodock-panel: #ffffff;                     /* the sheet itself */
  --sodock-quiet-text: #474747;                /* role, "Prefer to email?" and the response line */
  --sodock-primary-subtext: #b8b8b8;           /* small line on the dark main card */
  --sodock-primary-text: #ffffff;              /* title on the dark main card */
  --sodock-overlay: rgb(19 18 19 / 0.5);       /* darkens the page behind the open sheet */
  --sodock-focus: var(--sodock-accent);        /* keyboard focus ring */

  /* Type. Fonts come from the site unless set on the settings page, which
     adds --sodock-font and --sodock-font-heading. Left unset on purpose:
     an unset font here means "use the site's font". */
  --sodock-text-button: 16px;
  --sodock-text-body: clamp(18px, 16.8px + 0.2vw, 20px);
  --sodock-text-small: 14px;
  --sodock-text-heading: clamp(36px, 28px + 2.2vw, 52px);
  --sodock-weight-button: 500;
  --sodock-weight-strong: 600;
  --sodock-weight-heading: 600;
  --sodock-leading-heading: 1;
  --sodock-leading-tight: 1.05;
  --sodock-leading-snug: 1.2;
  --sodock-tracking-heading: -0.02em;

  /* Size and spacing */
  --sodock-bottom: clamp(12px, 8px + 1vw, 20px);          /* gap below the dock and the sheet */
  --sodock-gutter: clamp(16px, 9.6px + 1.2vw, 28px);      /* sheet's side margins */
  --sodock-frame: 8px;                                    /* frosted frame round the button */
  --sodock-button-height: 52px;
  --sodock-button-pad: 24px;                              /* space either side of the button's words */
  --sodock-frame-phone: 6px;                              /* the same on phones, slimmer */
  --sodock-button-height-phone: 44px;
  --sodock-panel-pad: 24px;
  --sodock-panel-max-width: 560px;                        /* the sheet never gets wider than this */
  --sodock-avatar-size: 60px;
  --sodock-dot-size: 0.24;                                /* status dot, as a share of the photo's width */
  --sodock-dot-inset: 0.03;                               /* how far in from the photo's corner it sits */
  --sodock-close-size: 48px;
  --sodock-close-icon: 20px;
  --sodock-touch: 44px;                                   /* smallest tap target */
  --sodock-arrow: 20px;
  --sodock-space-3xs: 4px;
  --sodock-space-2xs: 8px;
  --sodock-space-xs: 12px;
  --sodock-space-s: 16px;
  --sodock-space-m: 24px;
  --sodock-rule: 1px;                                     /* line under the person */

  /* Corners */
  --sodock-radius: 12px;                                  /* the button and the sheet */
  --sodock-radius-card: 8px;

  /* Glass */
  --sodock-blur: 12px;                                    /* behind the dock */
  --sodock-blur-sheet: 8px;                               /* the page behind the open sheet */

  /* Layers. High, so it sits over most theme headers and chat bubbles. */
  --sodock-z: 9990;
  --sodock-z-sheet: 100000;

  /* Motion. The script reads these, so changing them here changes the animation. */
  --sodock-ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --sodock-ease-unfold: cubic-bezier(0.77, 0, 0.175, 1);
  --sodock-duration-fast: 300ms;
  --sodock-duration-base: 600ms;
  --sodock-stagger: 80ms;
  --sodock-hide-speed: 1.6;                               /* folding away runs this many times faster */
  --sodock-reveal-distance: 24px;                         /* how far things rise as they come in */
  --sodock-hover-lift: -2px;

  font-family: var(--sodock-font);
}

.sodock *,
.sodock *::before,
.sodock *::after {
  box-sizing: border-box;
}

/* The dock
   -------- */

/* Full-width strip that only centres the dock; clicks pass through it */
.sodock .sodock__wrap {
  position: fixed;
  left: 0;
  right: 0;
  bottom: var(--sodock-bottom);
  z-index: var(--sodock-z);
  display: flex;
  justify-content: center;
  margin: 0;
  padding: 0;
  pointer-events: none;
}

.sodock .sodock__dock {
  display: flex;
  margin: 0;
  padding: var(--sodock-frame);
  /* the button's corners plus the frame round it, so the two curves run evenly */
  border-radius: calc(var(--sodock-radius) + var(--sodock-frame));
  background: var(--sodock-dock);
  -webkit-backdrop-filter: blur(var(--sodock-blur));
  backdrop-filter: blur(var(--sodock-blur));
  white-space: nowrap;
  pointer-events: auto;
  /* Hidden until the script brings it in; visibility keeps it out of the Tab
     order. If the script never takes over (it failed to load, or a speed
     plugin delays it), the dock shows anyway after 3 seconds as a plain link. */
  opacity: 0;
  visibility: hidden;
  animation: sodock-fallback 0s linear 3s forwards;
}

.sodock.sodock--live .sodock__dock {
  animation: none;
}

@keyframes sodock-fallback {
  to {
    opacity: 1;
    visibility: visible;
  }
}

.sodock .sodock__cta,
.sodock .sodock__cta:visited,
.sodock .sodock__cta:hover,
.sodock .sodock__cta:focus {
  display: inline-flex;
  align-items: center;
  height: var(--sodock-button-height);
  margin: 0;
  padding: 0 var(--sodock-button-pad);
  border: 0;
  border-radius: var(--sodock-radius);
  background: var(--sodock-accent);
  box-shadow: none;
  color: var(--sodock-button-text);
  font-family: var(--sodock-font);
  font-size: var(--sodock-text-button);
  font-weight: var(--sodock-weight-button);
  font-style: normal;
  line-height: 1;
  letter-spacing: normal;
  text-transform: none;
  text-decoration: none;
  cursor: pointer;
  /* hover uses translate, so it never fights the script's transforms */
  transition: translate var(--sodock-duration-fast) var(--sodock-ease-out);
}

@media (hover: hover) {
  .sodock .sodock__cta:hover {
    translate: 0 var(--sodock-hover-lift);
  }
}

/* Phones: slimmer, so it takes less of the screen. A 44px button (still a
   comfortable tap) in a thinner frosted frame. */
@media (max-width: 36em) {
  .sodock .sodock__dock {
    padding: var(--sodock-frame-phone);
    border-radius: calc(var(--sodock-radius) + var(--sodock-frame-phone));
  }

  .sodock .sodock__cta,
  .sodock .sodock__cta:visited,
  .sodock .sodock__cta:hover,
  .sodock .sodock__cta:focus {
    height: var(--sodock-button-height-phone);
  }
}

/* The contact sheet
   ----------------- */

.sodock .sodock__sheet {
  position: fixed;
  inset: 0;
  z-index: var(--sodock-z-sheet);
  margin: 0;
  padding: 0;
}

.sodock .sodock__sheet[hidden] {
  display: none;
}

.sodock .sodock__backdrop {
  position: absolute;
  inset: 0;
  background: var(--sodock-overlay);
  -webkit-backdrop-filter: blur(var(--sodock-blur-sheet));
  backdrop-filter: blur(var(--sodock-blur-sheet));
}

/* Only as tall as its contents, sitting where the dock sits */
.sodock .sodock__panel {
  position: absolute;
  left: var(--sodock-gutter);
  right: var(--sodock-gutter);
  bottom: var(--sodock-bottom);
  max-width: var(--sodock-panel-max-width);
  max-height: calc(100% - 2 * var(--sodock-bottom));
  margin: 0 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: var(--sodock-panel-pad);
  border-radius: var(--sodock-radius);
  background: var(--sodock-panel);
  color: var(--sodock-text);
  font-family: var(--sodock-font);
  font-size: var(--sodock-text-body);
  line-height: var(--sodock-leading-snug);
  text-align: left;
}

/* Reset what themes and builders like to add to paragraphs, lists and headings */
.sodock .sodock__panel p,
.sodock .sodock__panel ul,
.sodock .sodock__panel li,
.sodock .sodock__panel h2 {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font-family: inherit;
  font-style: normal;
  letter-spacing: normal;
  text-transform: none;
  list-style: none;
}

.sodock .sodock__panel li::before,
.sodock .sodock__panel li::marker {
  content: none;
}

/* The person on the left, the close button on the right, a line beneath */
.sodock .sodock__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sodock-space-s);
  padding-bottom: var(--sodock-space-s);
  border-bottom: var(--sodock-rule) solid var(--sodock-accent);
}

.sodock .sodock__person {
  display: flex;
  align-items: center;
  gap: var(--sodock-space-s);
  min-width: 0;
}

.sodock .sodock__close {
  margin-left: auto;
}

/* The round photo. The status dot is sized as a share of the photo, so it
   scales with it, and sits on its lower-right edge, overlapping slightly. */
.sodock .sodock__avatar {
  position: relative;
  flex: none;
  display: block;
  width: var(--sodock-avatar-size);
  height: var(--sodock-avatar-size);
}

.sodock .sodock__photo,
.sodock .sodock__initial {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  border-radius: 50%;
}

.sodock .sodock__photo {
  object-fit: cover;
}

/* No photo chosen: the person's first initial in a soft circle */
.sodock .sodock__initial {
  display: grid;
  place-items: center;
  background: var(--sodock-card);
  color: var(--sodock-text);
  font-size: calc(var(--sodock-avatar-size) * 0.4);
  font-weight: var(--sodock-weight-strong);
  line-height: 1;
}

.sodock .sodock__avatar--dot::after {
  content: "";
  position: absolute;
  right: calc(var(--sodock-avatar-size) * var(--sodock-dot-inset));
  bottom: calc(var(--sodock-avatar-size) * var(--sodock-dot-inset));
  width: calc(var(--sodock-avatar-size) * var(--sodock-dot-size));
  height: calc(var(--sodock-avatar-size) * var(--sodock-dot-size));
  border: 2px solid var(--sodock-panel);
  border-radius: 50%;
  background: var(--sodock-online);
  /* waits for the script to work out the time, so it never flicks green to grey */
  visibility: hidden;
}

.sodock .sodock__avatar--dot[data-status]::after {
  visibility: visible;
}

.sodock .sodock__avatar--dot[data-status="away"]::after {
  background: var(--sodock-away);
}

.sodock .sodock__person-text {
  display: grid;
  gap: var(--sodock-space-3xs);
  line-height: var(--sodock-leading-tight);
}

.sodock .sodock__name {
  font-size: var(--sodock-text-body);
  font-weight: var(--sodock-weight-strong);
}

.sodock .sodock__role {
  font-size: var(--sodock-text-small);
  color: var(--sodock-quiet-text);
}

/* The sheet's one big moment */
.sodock .sodock__panel .sodock__heading {
  margin-top: var(--sodock-space-s);
  font-family: var(--sodock-font-heading);
  font-size: var(--sodock-text-heading);
  font-weight: var(--sodock-weight-heading);
  line-height: var(--sodock-leading-heading);
  letter-spacing: var(--sodock-tracking-heading);
}

/* 48px circle with a 20px cross, so it is easy to see and hit */
.sodock .sodock__close,
.sodock .sodock__close:hover,
.sodock .sodock__close:focus,
.sodock .sodock__close:active {
  display: grid;
  place-items: center;
  flex: none;
  width: var(--sodock-close-size);
  height: var(--sodock-close-size);
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--sodock-card);
  box-shadow: none;
  color: var(--sodock-text);
  cursor: pointer;
}

.sodock .sodock__close svg {
  display: block;
  width: var(--sodock-close-icon);
  height: var(--sodock-close-icon);
}

/* Each option is a soft card with an arrow, so it reads as something to tap */
.sodock .sodock__panel .sodock__options {
  display: grid;
  gap: var(--sodock-space-2xs);
  margin-top: var(--sodock-space-s);
}

.sodock .sodock__option,
.sodock .sodock__option:visited,
.sodock .sodock__option:hover,
.sodock .sodock__option:focus {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--sodock-space-3xs) var(--sodock-space-s);
  min-height: var(--sodock-touch);
  margin: 0;
  padding: var(--sodock-space-xs) var(--sodock-space-s);
  border: 0;
  border-radius: var(--sodock-radius-card);
  background: var(--sodock-card);
  box-shadow: none;
  color: var(--sodock-text);
  text-decoration: none;
  transition: transform var(--sodock-duration-fast) var(--sodock-ease-out);
}

/* Pressed: sinks in slightly */
.sodock .sodock__option:active {
  transform: scale(0.98);
}

.sodock .sodock__label,
.sodock .sodock__text {
  grid-column: 1;
}

.sodock .sodock__label {
  font-size: var(--sodock-text-body);
  font-weight: var(--sodock-weight-strong);
  line-height: var(--sodock-leading-tight);
}

.sodock .sodock__text {
  font-size: var(--sodock-text-small);
  line-height: var(--sodock-leading-snug);
}

.sodock .sodock__arrow {
  grid-column: 2;
  grid-row: 1 / span 2;
  display: block;
  width: var(--sodock-arrow);
  height: var(--sodock-arrow);
  transition: transform var(--sodock-duration-fast) var(--sodock-ease-out);
}

.sodock .sodock__arrow svg {
  display: block;
  width: 100%;
  height: 100%;
}

.sodock .sodock__option:hover .sodock__arrow,
.sodock .sodock__option:focus-visible .sodock__arrow {
  transform: translate(2px, -2px);
}

/* The main card: dark, light title, grey subtitle, and its → nudges straight right */
.sodock .sodock__option--primary,
.sodock .sodock__option--primary:visited,
.sodock .sodock__option--primary:hover,
.sodock .sodock__option--primary:focus {
  background: var(--sodock-text);
  color: var(--sodock-primary-text);
}

.sodock .sodock__option--primary .sodock__text {
  color: var(--sodock-primary-subtext);
}

.sodock .sodock__option--primary:hover .sodock__arrow,
.sodock .sodock__option--primary:focus-visible .sodock__arrow {
  transform: translateX(3px);
}

/* "Prefer to email?" in grey, the address in bold (no underline) */
.sodock .sodock__panel .sodock__email {
  margin-top: var(--sodock-space-s);
  font-size: var(--sodock-text-small);
  line-height: var(--sodock-leading-snug);
  color: var(--sodock-quiet-text);
}

/* Kept in one piece, and padded so it is at least 24px tall to tap */
.sodock .sodock__email a,
.sodock .sodock__email a:visited,
.sodock .sodock__email a:hover,
.sodock .sodock__email a:focus {
  display: inline-block;
  padding: var(--sodock-space-3xs) 0;
  white-space: nowrap;
  border: 0;
  background: none;
  box-shadow: none;
  color: var(--sodock-text);
  font-weight: var(--sodock-weight-strong);
  text-decoration: none;
}

.sodock .sodock__panel .sodock__note {
  margin-top: var(--sodock-space-2xs);
  font-size: var(--sodock-text-small);
  line-height: var(--sodock-leading-snug);
  color: var(--sodock-quiet-text);
}

/* The button's colour, laid over the panel as it grows, fading to white */
.sodock .sodock__fill {
  position: absolute;
  inset: 0;
  background: var(--sodock-accent);
  opacity: 0;
  pointer-events: none;
}

/* Keyboard focus
   -------------- */

.sodock .sodock__cta:focus-visible,
.sodock .sodock__close:focus-visible,
.sodock .sodock__option:focus-visible,
.sodock .sodock__email a:focus-visible {
  outline: 2px solid var(--sodock-focus);
  outline-offset: 4px;
}

/* Focus moved by the script after a tap or click: no ring until a key is pressed */
.sodock [data-sodock-quiet]:focus-visible {
  outline: none;
}

/* While the sheet is open, the page behind stays still */
html.sodock-locked {
  overflow: hidden;
  scrollbar-gutter: stable;
}

@media (prefers-reduced-motion: reduce) {
  .sodock .sodock__cta,
  .sodock .sodock__option,
  .sodock .sodock__arrow {
    transition: none;
  }

  @media (hover: hover) {
    .sodock .sodock__cta:hover {
      translate: none;
    }
  }
}
