/* Elaine Liman - component styles (nav bar, case-study table of contents, buttons). Load after tokens.css. */


/* ---------- Navbar (top bar that floats on scroll) ---------- */
/* At the top of the page: a Parcel band, logo and links on the content edges.
   Once the page scrolls, the consumer's script adds .is-floating and the same bar
   narrows into a frosted pill over the middle 10 columns, nav-offset from the top. */

.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  padding: var(--space-3) var(--page-pad);
  background-color: var(--surface);
  pointer-events: none; /* only the bar itself takes clicks */
  font-family: var(--font-body);
  transition: background-color 0.3s ease-out;
}
.navbar-inner {
  pointer-events: auto;
  box-sizing: border-box;
  width: min(var(--content-max), 100%);
  height: var(--nav-height);
  margin: 0 auto;
  padding: 0;
  display: flex;
  align-items: center;
  gap: var(--space-4);
  border-radius: var(--radius-nav);
  box-shadow: inset 0 0 0 1px transparent; /* the hairline, drawn inside so it doesn't shift the content edge */
  transition: width 0.65s cubic-bezier(0.23, 1, 0.32, 1), padding 0.65s cubic-bezier(0.23, 1, 0.32, 1), transform 0.65s cubic-bezier(0.23, 1, 0.32, 1), background-color 0.3s ease-out, box-shadow 0.3s ease-out;
}

/* Floating: the middle 10 of 12 columns (10 columns + 9 gutters), centred */
.navbar.is-floating { background-color: transparent; }
.navbar.is-floating .navbar-inner,
.navbar.open .navbar-inner {
  padding: 0 var(--space-3) 0 var(--space-4);
  background-color: var(--surface-glass);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow: inset 0 0 0 1px var(--line);
}
.navbar.is-floating .navbar-inner {
  width: calc(min(var(--content-max), 100%) * 5 / 6 - var(--space-4) / 6);
  transform: translateY(calc(var(--nav-offset) - var(--space-3)));
}
/* Tablet and mobile: the pill keeps the full content width, 16px from the top */
@media (max-width: 1023px) {
  .navbar.is-floating .navbar-inner { width: min(var(--content-max), 100%); transform: none; }
}

.logo {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--logo);
  text-decoration: none;
  white-space: nowrap;
}
.logo:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }

.nav-menu { margin-left: auto; display: flex; align-items: center; }
.nav-links { list-style: none; margin: 0; padding: 0; display: flex; gap: var(--space-3); }
.nav-links li { margin: 0; }
.nav-links a {
  font-size: 16px;
  line-height: 24px;
  font-weight: 500;
  color: var(--ink-muted);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s;
}
.nav-links a:hover { color: var(--ink); }
.nav-links a[aria-current] { color: var(--accent); }
.nav-links a:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }

.menu-toggle {
  display: none;
  width: 40px; height: 40px;
  margin-left: auto;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: none;
  cursor: pointer;
}
.menu-toggle span { display: block; width: 22px; height: 2px; margin: 5px auto; background: var(--ink); transition: transform 0.2s, opacity 0.2s; }
.menu-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Mobile: links hide behind the menu button; .open grows the bar into a rounded panel.
   .navbar--compact forces this layout at any width. */
@media (max-width: 767px) {
  .navbar { padding-left: var(--space-3); padding-right: var(--space-3); }
  .navbar-inner { height: auto; min-height: var(--nav-height); flex-wrap: wrap; row-gap: 0; }
  .navbar.is-floating .navbar-inner, .navbar.open .navbar-inner { padding: 0 var(--space-2) 0 20px; }
  .logo { line-height: 54px; }
  .menu-toggle { display: block; }
  .nav-menu { display: none; }
  .navbar.open .nav-menu { display: flex; flex-basis: 100%; margin: 0; padding: var(--space-1) 0 20px; }
  .navbar.open .nav-links { flex-direction: column; gap: var(--space-1); }
  .navbar.open .nav-links a { font-size: 22px; line-height: 36px; }
  .navbar.open .menu-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .navbar.open .menu-toggle span:nth-child(2) { opacity: 0; }
  .navbar.open .menu-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
}
.navbar--compact { padding-left: var(--space-3); padding-right: var(--space-3); }
.navbar--compact .navbar-inner { height: auto; min-height: var(--nav-height); flex-wrap: wrap; row-gap: 0; }
.navbar--compact.is-floating .navbar-inner, .navbar--compact.open .navbar-inner { width: min(var(--content-max), 100%); padding: 0 var(--space-2) 0 20px; transform: none; }
.navbar--compact .logo { line-height: 54px; }
.navbar--compact .menu-toggle { display: block; }
.navbar--compact .nav-menu { display: none; }
.navbar--compact.open .nav-menu { display: flex; flex-basis: 100%; margin: 0; padding: var(--space-1) 0 20px; }
.navbar--compact.open .nav-links { flex-direction: column; gap: var(--space-1); }
.navbar--compact.open .nav-links a { font-size: 22px; line-height: 36px; }
.navbar--compact.open .menu-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.navbar--compact.open .menu-toggle span:nth-child(2) { opacity: 0; }
.navbar--compact.open .menu-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- Toc (case-study table of contents) ---------- */
/* Markup: <ul class="toc"><li><a href="#overview"><span>Overview</span></a></li>...</ul>
   Right-aligned bars, longest at the current section; hovering or focusing a bar
   shows that one section's title in a small tooltip to its left. */

.toc {
  position: fixed;
  right: var(--toc-offset);
  top: 50%;
  transform: translateY(-50%);
  z-index: 40;
  list-style: none;
  margin: 0;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  font-family: var(--font-body);
}
.toc li { margin: 0; }
.toc a {                      /* a 28px-wide row, so every bar is easy to hit */
  position: relative;
  display: block;
  width: 28px;
  height: 16px;
  text-decoration: none;
}
.toc a::after {               /* the bar, right-aligned in its row */
  content: "";
  position: absolute;
  right: 0; top: 50%;
  width: 20px; height: 2px;
  margin-top: -1px;
  border-radius: var(--radius-pill);
  background: var(--ink-muted);
  opacity: 0.45;
  transition: width 0.25s ease, opacity 0.15s, background-color 0.15s;
}

/* Bar lengths: 28px at the current section, 24px either side of it, 20px for the rest */
.toc li:has(+ li > a[aria-current]) > a::after,
.toc li:has(> a[aria-current]) + li > a::after { width: 24px; }
.toc a[aria-current]::after { width: 28px; background: var(--accent); opacity: 1; }

/* The title: a tooltip to the left of the bars, shown for the hovered or focused bar only.
   Kept in the accessibility tree at rest (opacity, not visibility). .is-hovered forces it (used in the preview). */
.toc a > span {
  position: absolute;
  right: calc(100% + var(--space-3));
  top: 50%;
  transform: translate(4px, -50%);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  background: var(--black-fig);
  color: var(--parcel);
  font-size: 14px;
  line-height: 16px;
  font-weight: 500;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s ease-out, transform 0.15s ease-out;
}
.toc a:hover > span, .toc a:focus-visible > span, .toc a.is-hovered > span { opacity: 1; transform: translate(0, -50%); }
.toc a:hover::after, .toc a:focus-visible::after, .toc a.is-hovered::after { background: var(--ink); opacity: 1; }
.toc a[aria-current]:hover::after, .toc a[aria-current]:focus-visible::after, .toc a[aria-current].is-hovered::after { background: var(--accent); }
.toc a:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

@media (max-width: 1279px) { .toc { display: none; } }

/* ---------- Button (pill) ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-sizing: border-box;
  min-height: 44px;
  padding: 10px 24px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  background: transparent;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.btn:hover { background: var(--ink); border-color: var(--ink); color: var(--surface); }
.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; pointer-events: none; }

.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--ink); border-color: var(--ink); color: var(--surface); }

.btn--field { background: var(--chartreuse); border-color: var(--chartreuse); color: var(--black-fig); }
.btn--field:hover { background: var(--black-fig); border-color: var(--black-fig); color: var(--parcel); }

.btn--sm { min-height: 36px; padding: 6px 16px; font-size: 15px; line-height: 20px; }

.btn .arrow { display: inline-block; transition: transform 0.15s; }
.btn:hover .arrow { transform: translateX(3px); }

@media (prefers-reduced-motion: reduce) {
  .btn, .btn .arrow, .navbar, .navbar-inner, .nav-links a, .menu-toggle span, .toc a::after, .toc a > span { transition: none; }
}
