/*
 * Healthier Essex — shared components: top bar, buttons, footer,
 * overlays (menu / admin access / site settings), toggles.
 */

/* ---------- Top navigation bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 36px;
}
.topbar__actions {
  display: flex;
  align-items: center;
  gap: var(--btn-gap);
}

/* Homepage symbol (Path 5) — 25 × 25, spins on hover like Place+ */
.logo-plus {
  display: block;
  width: 25px;
  height: 25px;
  color: var(--logo-fg);
  transition: transform 0.5s var(--ease-soft);
}
.logo-plus svg {
  width: 100%;
  height: 100%;
}
.logo-plus:hover {
  transform: rotate(90deg);
}

/* Circular buttons — R 36px, line weight 1px */
.btn-circle {
  position: relative;
  display: inline-flex;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--btn-bg);
  color: var(--btn-fg);
  flex: 0 0 auto;
  transition: transform 0.25s var(--ease-soft);
}
.btn-circle svg {
  width: 100%;
  height: 100%;
}
.btn-circle:hover {
  transform: scale(1.06);
}
/* Accessibility symbol: centre dot R small 4px / hover 8px (Button styles) */
.btn-circle .btn-dot {
  fill: var(--btn-fg);
  transform-box: fill-box;
  transform-origin: center;
  transition: transform 0.25s var(--ease-soft);
}
.btn-circle:hover .btn-dot,
.btn-circle:focus-visible .btn-dot {
  transform: scale(2);
}

/* On-hover tag (GT America Mono 12/12, padding 4, 8px below the button) */
.btn-circle[data-tag]::after {
  content: attr(data-tag);
  position: absolute;
  top: calc(100% + var(--btn-gap));
  padding: var(--btn-pad);
  border-radius: 2px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: 12px;
  line-height: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.btn-circle[data-tag]:hover::after,
.btn-circle[data-tag]:focus-visible::after {
  opacity: 1;
}
/* Note 1: left button (side by side) → centred; right / margin-aligned → right aligned */
.btn-circle[data-tag-align="center"]::after {
  left: 50%;
  transform: translateX(-50%);
}
.btn-circle[data-tag-align="right"]::after {
  right: 0;
}
.btn-circle[data-tag-align="left"]::after {
  left: 0;
}

/* Small text button — H 20px / W hug, padding 4, radius 2 */
.tag {
  display: inline-flex;
  align-items: center;
  gap: var(--btn-pad);
  height: 20px;
  padding: var(--btn-pad);
  border-radius: 2px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: 12px;
  line-height: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
  white-space: nowrap;
}
.tag svg {
  width: 8px;
  height: 9px;
}
.tag--ghost {
  background: rgba(208, 208, 208, 0.1);
  color: var(--fg);
}
button.tag:hover {
  filter: brightness(1.08);
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--footer-bg);
  color: var(--footer-fg);
  padding: var(--margin);
  overflow: clip;
}
.footer__grid {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: 53px;
}
.footer__brand {
  display: flex;
  flex-direction: column;
  gap: var(--gutter);
  align-items: flex-start;
}
.footer__wordmark {
  width: 105px;
  height: 34px;
}
.footer__client {
  width: 149px;
  height: 36px;
}
.footer__main {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 341px;
  gap: 48px;
}
.footer__top {
  display: grid;
  grid-template-columns: 242px minmax(0, 1fr);
  gap: 163px;
  align-items: start;
}
.footer__contact p + p {
  margin-top: 20px;
}
.footer__contact .footer__block + .footer__block {
  margin-top: 40px;
}
.footer__contact a {
  text-decoration: underline;
  text-underline-position: from-font;
}
.footer__contact a:hover {
  color: var(--c-lime);
}
:root[data-theme="contrast"] .footer__contact a:hover {
  color: #fff;
}
.footer__settings {
  display: flex;
  align-items: center;
  gap: var(--gutter);
  padding-block: 10px;
  max-width: 375px;
}
.footer__settings .btn-circle {
  --btn-bg: var(--c-lime);
  --btn-fg: var(--c-aubergine);
}
.footer__bottom {
  display: grid;
  grid-template-columns: 242px 257px minmax(0, 1fr);
  gap: 162px 148px;
  align-items: end;
}
.footer__bottom > :last-child {
  justify-self: end;
}
/* The footer is dark in every theme, so it keeps the original Essex blue (6.5:1 on black) */
.site-footer .link-essex {
  color: var(--c-blue);
}
:root[data-theme="contrast"] .site-footer .link-essex {
  color: var(--c-grey);
  text-decoration: underline;
}
.site-footer .link-essex:hover {
  text-decoration: underline;
}

@media (max-width: 1100px) {
  .footer__top {
    gap: 48px;
  }
  .footer__bottom {
    grid-template-columns: 1fr 1fr;
    gap: 24px 48px;
  }
  .footer__bottom > :last-child {
    justify-self: start;
  }
}
@media (max-width: 760px) {
  .footer__grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .footer__top {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .footer__main {
    min-height: 0;
  }
}

/* ---------- Overlays (Menu / Admin access / Site settings) ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
}
.overlay[data-open="true"] {
  display: block;
}
.overlay__scrim {
  position: absolute;
  inset: 0;
  background: rgba(18, 18, 18, 0.55);
}
.overlay__panel {
  position: absolute;
  inset: 0;
  overflow: auto;
}

/* Menu */
.overlay--menu .overlay__panel {
  background: var(--c-aubergine);
  color: var(--c-grey);
  padding: var(--margin) var(--margin) 40px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  animation: overlay-in 0.35s var(--ease-soft) both;
}
:root[data-theme="light"] .overlay--menu .overlay__panel {
  background: var(--c-grey);
  color: var(--c-aubergine);
}
:root[data-theme="contrast"] .overlay--menu .overlay__panel {
  background: var(--c-grey);
  color: var(--c-black);
}
.menu__photo {
  position: absolute;
  top: 0;
  bottom: 0;
  left: calc(58.33% + 2.33px);
  right: 0;
  overflow: hidden;
  pointer-events: none;
}
.menu__photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  animation: photo-in 0.8s var(--ease-soft) both;
}
:root[data-simplified="true"] .menu__photo img {
  animation: none;
}
:root[data-theme="contrast"] .menu__photo img {
  filter: grayscale(1) contrast(1.1);
}
.menu__body {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  flex: 1 1 auto;
  min-height: 0;
  max-width: 590px;
}
.menu__links {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.menu__links a,
.menu__links span {
  display: block;
  white-space: nowrap;
  transition: color 0.2s, transform 0.3s var(--ease-soft);
}
.menu__links a:hover {
  color: var(--accent-text);
  transform: translateX(8px);
}
:root[data-theme="contrast"] .menu__links a:hover {
  color: var(--c-black);
  text-decoration: underline;
}
.menu__links span {
  color: var(--fg-muted-alt);
}
:root[data-theme="light"] .menu__links span,
:root[data-theme="contrast"] .menu__links span {
  color: var(--fg-muted);
}
.menu__foot {
  display: flex;
  align-items: flex-end;
  gap: 40px;
  padding-top: 40px;
}
.menu__contact {
  flex: 1 0 0;
}
.menu__contact p + p {
  margin-top: 20px;
}
.menu__contact .footer__block + .footer__block {
  margin-top: 40px;
}
.menu__contact a {
  text-decoration: underline;
  text-underline-position: from-font;
}
.menu__brand {
  display: flex;
  flex-direction: column;
  gap: var(--gutter);
  align-items: flex-start;
}
.menu__brand img {
  width: 186px;
  height: 43px;
}
.menu__brand a {
  white-space: nowrap;
}
.menu__brand a:hover {
  text-decoration: underline;
}
@media (max-width: 900px) {
  .menu__photo {
    display: none;
  }
  .menu__foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 24px;
  }
}

/* Admin access — sits over the page on a translucent grey */
.overlay--admin .overlay__panel {
  background: rgba(208, 208, 208, 0.6);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--c-aubergine);
  padding: var(--margin) var(--margin) 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  gap: 32px;
  animation: overlay-in 0.3s var(--ease-soft) both;
}
.overlay--admin .topbar {
  width: 100%;
  --logo-fg: var(--c-aubergine);
}
.overlay--admin .btn-circle {
  --btn-bg: var(--c-lime);
  --btn-fg: var(--c-aubergine);
}
:root[data-theme="contrast"] .overlay--admin .btn-circle {
  --btn-bg: var(--c-black);
  --btn-fg: var(--c-grey);
}
.admin-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
  width: 590px;
  max-width: 100%;
}
.admin-form__fields {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
}
.admin-form input {
  width: 100%;
  height: 28px;
  padding: var(--btn-pad);
  border: 0;
  border-radius: 2px;
  background: rgba(208, 208, 208, 0.1);
  color: var(--c-aubergine);
  font-family: var(--font-mono);
  font-weight: 300;
  font-size: 12px;
  line-height: 20px;
  text-transform: uppercase;
  letter-spacing: 0;
}
.admin-form input::placeholder {
  color: var(--c-mid-grey);
  text-transform: uppercase;
}
.admin-form input:focus {
  outline: 1px solid var(--c-aubergine);
  background: rgba(208, 208, 208, 0.25);
}
.admin-form__msg {
  min-height: 14px;
  color: var(--c-aubergine);
}
.admin__foot {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: var(--gutter);
}
.admin__foot .btn-circle {
  align-self: flex-end;
}
.admin__foot a:hover {
  text-decoration: underline;
}

/* Site settings — bottom sheet. Figma shows the same dark panel in every
   theme (only the active-toggle colour changes in high contrast). */
.overlay--settings .overlay__panel {
  inset: auto 0 0 0;
  background: var(--c-black);
  color: var(--c-grey);
  --btn-bg: var(--c-lime);
  --btn-fg: var(--c-aubergine);
  padding: 21px var(--margin) var(--margin);
  animation: sheet-in 0.4s var(--ease-soft) both;
}
.settings {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}
.settings__grid {
  display: flex;
  gap: 116px;
  padding-block: var(--margin);
  flex: 1 1 auto;
}
.settings__intro {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  max-width: 490px;
  min-height: 226px;
}
.settings__intro .t-xs {
  font-size: 18px;
  line-height: 18px;
  letter-spacing: -0.02em;
}
.settings__options {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  min-height: 226px;
}
.toggle {
  display: flex;
  align-items: center;
  gap: var(--gutter);
  text-align: left;
}
.toggle__switch {
  position: relative;
  width: 36px;
  height: 18px;
  border-radius: 2px;
  background: var(--c-dark-grey);
  flex: 0 0 auto;
  transition: background 0.25s;
}
.toggle__switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--c-black);
  transition: transform 0.25s var(--ease-soft);
}
.toggle[aria-checked="true"] .toggle__switch {
  background: var(--settings-active);
}
.toggle[aria-checked="true"] .toggle__switch::after {
  transform: translateX(16px);
}
.toggle__label {
  font-weight: 500;
  color: #8a8a8a;             /* on the dark sheet → 5.4:1 */
  transition: color 0.25s;
}
.toggle[aria-checked="true"] .toggle__label {
  color: var(--settings-active);
}
.toggle[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
}
@media (max-width: 900px) {
  .settings__grid {
    flex-direction: column;
    gap: 40px;
  }
  .settings__intro,
  .settings__options {
    min-height: 0;
  }
}

:root[data-theme="contrast"] .overlay--settings .overlay__panel {
  --btn-bg: var(--c-grey);
  --btn-fg: var(--c-black);
}

@keyframes overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes sheet-in {
  from { transform: translateY(24px); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
@keyframes photo-in {
  from { opacity: 0; transform: scale(1.03); }
  to   { opacity: 1; transform: none; }
}
