/* ------------------------------------------------------------------
   Carey Group v3: the navigation layer, loaded by every page.
   The brand becomes a link. On desktop the five sections become buttons,
   and each opens a shutter under the header: the section name, its pages
   as ruled rows, and a photograph of the page under the pointer. Below
   1024px the burger opens a sheet with one row per section that expands
   in place. Everything is set in the tokens carey.css declares; nothing
   here introduces a new colour, a radius or a shadow.
   ------------------------------------------------------------------ */

/* ---------- brand ---------- */

.brand { color: inherit; }
.brand:hover { color: inherit; }

/* ---------- desktop: the top row ---------- */

.nav-desktop { gap: 28px; }

/* below 1280px the brand line and the seven top links no longer fit side by
   side, so the line steps out and the mark stands alone, as it does on phones */
@media (max-width: 1279px) {
  .brand-div,
  .brand-line { display: none; }
}

.nav-top {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  padding: 10px 0;
  background: none;
  border: 0;
  cursor: pointer;
  color: var(--bone);
  font-family: var(--display);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.01em;
  text-transform: none;
}
.nav-caret { flex: 0 0 auto; transition: transform var(--ui) var(--ease-out); }
.nav-top[aria-expanded="true"] .nav-caret { transform: rotate(180deg); }

/* the same hairline indicator the plain links draw, on the buttons too */
.nav-top::after,
.nav-link::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4px;
  height: 1px;
  background: var(--gold);
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform var(--ui) var(--ease-out);
}
.nav-link { position: relative; padding: 10px 0; }
.nav-top:focus-visible::after,
.nav-link:focus-visible::after { transform: scaleX(1); }
.nav-top[aria-expanded="true"]::after { transform: scaleX(1); }

/* the section you are in, and the page you are on, stay marked */
.nav-top.is-current,
.nav-link.is-current,
.nav-link[aria-current="page"] { color: var(--bone); }
.nav-top.is-current::after,
.nav-link.is-current::after { transform: scaleX(1); background: var(--gold-dim); }

@media (hover: hover) and (pointer: fine) {
  .nav-top:hover { color: var(--gold); }
  .nav-top:hover::after,
  .nav-link:hover::after { transform: scaleX(1); }
}

/* ---------- desktop: the shutter a section opens ----------
   Positioned against the header, so it spans the page rather than the
   button. Three columns: the section name, its pages as ruled rows, and
   the photograph. The photo frame is always five rows tall, so every
   section's panel is the same height and moving between them never
   makes the panel jump. */

.nav-item { position: static; }

.nav-dd {
  --dd-row: 56px;
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 3;
  background: var(--ink);
  border-bottom: 1px solid var(--rule);
  /* covered until nav.js lifts the edge */
  clip-path: inset(0 0 100% 0);
}
.nav-dd.is-open { clip-path: inset(0 0 0% 0); }

.nav-dd-inner {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 5fr) minmax(0, 4fr);
  column-gap: 56px;
  align-items: start;
  padding-block: 40px 48px;
}

.nav-dd-name {
  margin: 0;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(30px, 2.8vw, 40px);
  line-height: 0.96;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--bone);
  text-wrap: balance;
}

.nav-dd-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--rule);
}
.nav-dd-list li { border-bottom: 1px solid var(--rule); }

/* doubled up on .nav-desktop to set aside the top row's link treatment */
.nav-desktop .nav-dd-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: var(--dd-row);
  /* the arrow rests 4px short of the rule's end, so its nudge never crosses the focus ring */
  padding: 8px 4px 8px 0;
  color: var(--bone);
  font-family: var(--display);
  font-weight: 700;
  font-size: 15px;
  line-height: 1.2;
  letter-spacing: 0.01em;
  text-transform: none;
}
.nav-desktop .nav-dd-list a::after { content: none; }
.nav-desktop .nav-dd-list a:focus-visible { outline-offset: 0; }
.nav-dd-list a svg {
  flex: 0 0 auto;
  color: var(--ash);
  transition: color var(--press) ease, transform var(--ui) var(--ease-out);
}

.nav-desktop .nav-dd-list a[aria-current="page"],
.nav-dd-list a[aria-current="page"] svg,
.nav-desktop .nav-dd-list a:focus-visible,
.nav-dd-list a:focus-visible svg { color: var(--gold); }
.nav-dd-list a:focus-visible svg { transform: translateX(4px); }

@media (hover: hover) and (pointer: fine) {
  .nav-desktop .nav-dd-list a:hover,
  .nav-dd-list a:hover svg { color: var(--gold); }
  .nav-dd-list a:hover svg { transform: translateX(4px); }
}

.nav-dd-media {
  height: calc(5 * (var(--dd-row) + 1px) + 1px);
  overflow: hidden;
  background: var(--ink-2);
}
.nav-dd-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* the header goes solid while a panel shows, so the two read as one bar,
   and it rises over the three flying chevrons */
.site-header.dd-open { z-index: 20; }
.site-header.dd-open::before { opacity: 1; }

/* the scrim nav.js adds: the page below the header dims while a panel is open */
.nav-scrim {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  top: var(--header-h);
  z-index: 1;
  background: rgba(14, 11, 10, 0.6);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.nav-scrim.is-on { opacity: 1; visibility: visible; pointer-events: auto; }

@media (prefers-reduced-motion: no-preference) {
  /* the edge travels back up quickly; opening takes the longer, softer curve */
  .nav-dd { transition: clip-path 200ms var(--ease-out); }
  .nav-dd.is-open { transition: clip-path 320ms cubic-bezier(0.32, 0.72, 0, 1); }
  .nav-scrim { transition: opacity 160ms var(--ease-out), visibility 0s linear 160ms; }
  .nav-scrim.is-on { transition: opacity 240ms var(--ease-out), visibility 0s linear 0s; }
}

@media (max-width: 1199px) {
  .nav-dd-inner { column-gap: 40px; }
}

/* below the desktop breakpoint there is no panel to open */
@media (max-width: 1023px) {
  .nav-dd,
  .nav-scrim { display: none; }
}

/* ---------- phones and tablets: the sheet ----------
   Fixed from the header's bottom edge to the foot of the screen. One row
   per section, each expanding in place, only one open at a time; then
   Careers, then the phone and email. Its top hairline sits on the
   header's own, so the two read as a single rule. */

body.menu-lock { overflow: hidden; }

.nav-panel {
  position: fixed;
  left: 0;
  right: 0;
  top: calc(var(--header-h) - 1px);
  bottom: 0;
  display: none;
  background: var(--ink);
  border-top: 1px solid var(--rule);
  overflow-y: auto;
  overscroll-behavior: contain;
  clip-path: inset(0 0 100% 0);
}
.nav-panel.open { display: block; }
.nav-panel.open.is-in { clip-path: inset(0 0 0% 0); }

.sheet-list { list-style: none; margin: 0; padding: 0; }
.sheet-row { border-bottom: 1px solid var(--rule); }

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  min-height: 68px;
  margin: 0;
  padding: 12px 0;
  background: none;
  border: 0;
  cursor: pointer;
  text-align: left;
  color: var(--bone);
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(24px, 7vw, 32px);
  line-height: 1;
  letter-spacing: -0.01em;
  text-transform: none;
}
.sheet-head[aria-expanded="true"],
.sheet-head[aria-current="page"] { color: var(--gold); }
.sheet-head svg { flex: 0 0 auto; color: var(--gold); }

/* the FAQ's plus: a gold hairline cross whose upright turns flat to a minus */
.sheet-plus { position: relative; flex: 0 0 auto; width: 16px; height: 16px; }
.sheet-plus::before,
.sheet-plus::after {
  content: "";
  position: absolute;
  background: var(--gold);
  transition: transform var(--ui) var(--ease-out);
}
.sheet-plus::before { left: 0; top: 8px; width: 16px; height: 1px; }
.sheet-plus::after { top: 0; left: 8px; width: 1px; height: 16px; transform-origin: 50% 50%; }
.sheet-head[aria-expanded="true"] .sheet-plus::after { transform: rotate(90deg); }

/* collapsed rows hold no height and nothing Tab can reach */
.sheet-body {
  display: grid;
  grid-template-rows: 0fr;
  visibility: hidden;
}
.sheet-head[aria-expanded="true"] + .sheet-body {
  grid-template-rows: 1fr;
  visibility: visible;
}
.sheet-body > ul {
  min-height: 0;
  overflow: hidden;
  list-style: none;
  margin: 0;
  padding: 0;
}
.sheet-body li:last-child { padding-bottom: 14px; }
.sheet-body a {
  display: flex;
  align-items: center;
  min-height: 48px;
  color: var(--bone);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 17px;
  line-height: 1.3;
}
.sheet-body a[aria-current="page"] { color: var(--gold); }

.sheet-foot {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding-block: 28px 40px;
}
.sheet-foot a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--stone);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 15px;
}

@media (hover: hover) and (pointer: fine) {
  .sheet-head:hover,
  .sheet-body a:hover,
  .sheet-foot a:hover { color: var(--gold); }
}

@media (prefers-reduced-motion: no-preference) {
  /* the same shutter as the desktop panel, a little slower over the taller sheet */
  .nav-panel { transition: clip-path 220ms var(--ease-out); }
  .nav-panel.is-in { transition: clip-path 380ms cubic-bezier(0.32, 0.72, 0, 1); }
  /* visibility waits for the fold to finish closing, and leads when it opens */
  .sheet-body { transition: grid-template-rows 260ms var(--ease-out), visibility 0s linear 260ms; }
  .sheet-head[aria-expanded="true"] + .sheet-body { transition: grid-template-rows 260ms var(--ease-out), visibility 0s linear 0s; }
}

/* the sheet never survives a resize up to the desktop nav */
@media (min-width: 1024px) {
  .nav-panel,
  .nav-panel.open { display: none; }
}
