/*
 * bar.css — The global top bar, the same on both versions of the site
 * ─────────────────────────────────────────
 * CHLOE on the far left, MA on the far right (both in the Caslon wordmark),
 * the buttons centred between them: the Lo-fi / Hi-fi switch, then one
 * square icon button (Menu on lo-fi, Sound on hi-fi).
 * Lo-fi pages get the markup from initBar() in shared.js; the hi-fi page has
 * it in its own index.html. Needs tokens.css. Selectors are doubled up with
 * .site-bar so they win over the hi-fi site's own .bar styles.
 */
.site-bar {
  /* laid out across the whole window, scrollbar or not, so its buttons sit in
     exactly the same place on lo-fi (which scrolls) and hi-fi (which doesn't) */
  position: fixed; top: 0; left: 0; width: 100vw; z-index: 800;
  height: var(--bar-h);
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: var(--s-3);
  padding: 0 var(--gutter);
  background: var(--c-paper); color: var(--c-ink);
  border-bottom: 1px solid var(--c-hair);
  view-transition-name: site-bar;
}
/* It's one bar across every page and both versions: on a link the page under it
   changes, the bar holds still (only the switch's highlight moves across) */
@view-transition { navigation: auto; }
::view-transition-group(site-bar) { animation: none; z-index: 1; }
::view-transition-old(site-bar) { animation: 160ms ease both vt-bar-out; }
::view-transition-new(site-bar) { animation: 160ms ease both vt-bar-in; }
@keyframes vt-bar-out { to { opacity: 0; } }
@keyframes vt-bar-in { from { opacity: 0; } }
.site-bar .site-bar__mark {
  margin: 0; justify-self: start;
  font: var(--type-wordmark); letter-spacing: var(--track-wordmark); text-transform: none;
  color: inherit; text-decoration: none;
}
.site-bar .site-bar__mark--end { justify-self: end; }
a.site-bar__mark:hover { opacity: 0.7; }

.site-bar .site-bar__tools { display: flex; align-items: center; gap: var(--s-2); flex-shrink: 0; }

/* Lo-fi / Hi-fi: two joined square buttons, the current one inked in */
.site-bar .site-bar__switch { display: flex; height: 40px; border: 1px solid var(--c-border); }
.site-bar .site-bar__switch a {
  display: inline-flex; align-items: center; padding: 0 var(--s-4);
  font: 400 14px/1.4 var(--f-label); font-stretch: var(--f-stretch, semi-condensed);
  letter-spacing: 0.14em; text-transform: uppercase; white-space: nowrap;   /* "Lo-fi" never breaks at its hyphen */
  color: var(--c-ink); text-decoration: none;
  transition: background var(--dur-fast) var(--ease-out-strong), color var(--dur-fast) var(--ease-out-strong);
}
.site-bar .site-bar__switch a + a { border-left: 1px solid var(--c-border); }
.site-bar .site-bar__switch a:hover { background: var(--c-slot); }
.site-bar .site-bar__switch a[aria-current="page"] { background: var(--c-ink); color: var(--c-paper); }

/* One square icon button */
.site-bar .site-bar__tools .site-bar__icon {
  width: 40px; height: 40px; padding: 0;
  display: grid; place-items: center;
  border: 1px solid var(--c-border); border-radius: 0;
  background: transparent; color: var(--c-ink); cursor: pointer;
  transition: border-color var(--dur-fast), background var(--dur-fast), transform var(--dur-fast) var(--ease-out-strong);
}
.site-bar .site-bar__tools .site-bar__icon:hover { border-color: var(--c-ink); background: var(--c-slot); }
.site-bar .site-bar__tools .site-bar__icon:active,
.site-bar .site-bar__switch a:active { transform: scale(0.94); }
.site-bar .site-bar__icon svg { display: block; width: 24px; height: 24px; }
/* A labelled link button (Resume): icon and word, the word dropped on phones */
.site-bar .site-bar__tools .site-bar__link {
  height: 40px; padding: 0 var(--s-3);
  display: inline-flex; align-items: center; gap: var(--s-2);
  border: 1px solid var(--c-border);
  font: 400 var(--f-stretch) 14px/1.4 var(--f-label); letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--c-ink); text-decoration: none;
  transition: border-color var(--dur-fast), background var(--dur-fast), transform var(--dur-fast) var(--ease-out-strong);
}
.site-bar .site-bar__tools .site-bar__link:hover { border-color: var(--c-ink); background: var(--c-slot); }
.site-bar .site-bar__tools .site-bar__link:active { transform: scale(0.94); }
.site-bar .site-bar__link svg { display: block; width: var(--icon); height: var(--icon); flex: none; }
@media (max-width: 640px) {
  .site-bar .site-bar__tools .site-bar__link { width: 40px; padding: 0; justify-content: center; }
  .site-bar .site-bar__link span { display: none; }
}
/* A toggle (Sound): inked in while it's on, like the current page in the switch */
.site-bar .site-bar__tools .site-bar__icon[aria-pressed="true"] { background: var(--c-ink); border-color: var(--c-ink); color: var(--c-paper); }
.site-bar .site-bar__tools .site-bar__icon[aria-pressed="true"]:hover { background: var(--c-paper); color: var(--c-ink); }
.site-bar .site-bar__tools .site-bar__icon[aria-pressed="false"] { color: var(--c-mute); }

.site-bar a:focus-visible,
.site-bar button:focus-visible { outline: 2px solid var(--c-ink); outline-offset: 2px; }

/* Menu icon: three lines that turn into a cross while the menu is open */
.site-bar__burger line { transition: transform var(--dur) var(--ease-out), opacity var(--dur-fast); transform-origin: 12px 12px; }
[aria-expanded="true"] .site-bar__burger .b1 { transform: translateY(5px) rotate(45deg); }
[aria-expanded="true"] .site-bar__burger .b2 { opacity: 0; }
[aria-expanded="true"] .site-bar__burger .b3 { transform: translateY(-5px) rotate(-45deg); }

@media (max-width: 899px) {
  .site-bar { gap: var(--s-2); }
  .site-bar .site-bar__mark { font-size: var(--t-lg); }
  .site-bar .site-bar__tools { gap: var(--s-1); }
  .site-bar .site-bar__switch a { padding: 0 var(--s-2); letter-spacing: 0.08em; }
}
@media (prefers-reduced-motion: reduce) {
  .site-bar *, .site-bar__burger line { transition: none !important; }
}

/* The side quest: a small card under the switch, the first time in a visit
   someone picks Hi-fi (initSideQuest in shared.js; the password page has its own copy) */
.site-bar .site-quest {
  position: absolute; top: calc(100% + var(--s-2)); left: 50%; transform: translateX(-50%);
  width: min(320px, calc(100vw - 2 * var(--s-4))); padding: var(--s-4);
  background: var(--c-paper); color: var(--c-ink);
  border: 1px solid var(--c-border); box-shadow: 0 12px 32px rgba(0, 0, 0, 0.14);
  animation: site-quest-in var(--dur-fast) var(--ease-out-strong) both;
}
.site-bar .site-quest[hidden] { display: none; }
@keyframes site-quest-in { from { opacity: 0; transform: translate(-50%, -6px); } }
.site-bar .site-quest__title { margin: 0 0 var(--s-1); font: var(--type-lead); letter-spacing: var(--track-lead); font-weight: 600; line-height: 1.3; }
.site-bar .site-quest__body { margin: 0 0 var(--s-4); font: var(--type-small); letter-spacing: var(--track-small); color: var(--c-mute); }
.site-bar .site-quest__note { margin: 0 0 var(--s-4); padding-top: var(--s-3); border-top: 1px solid var(--c-hair); font: var(--type-small); letter-spacing: var(--track-small); color: var(--c-ink); }
.site-bar .site-quest__actions { display: flex; gap: var(--s-2); }
.site-bar .site-quest__actions > * {
  height: 40px; padding: 0 var(--s-4); display: inline-flex; align-items: center;
  border: 1px solid var(--c-ink); background: transparent; color: var(--c-ink); cursor: pointer;
  font: 400 14px/1 var(--f-label); font-stretch: var(--f-stretch, semi-condensed); letter-spacing: 0.1em; text-transform: uppercase;
  text-decoration: none;
}
.site-bar .site-quest__actions > *:hover { background: var(--c-slot); }
.site-bar .site-quest__actions .site-quest__go { background: var(--c-ink); color: var(--c-paper); }
.site-bar .site-quest__actions .site-quest__go:hover { opacity: 0.85; background: var(--c-ink); }
@media (prefers-reduced-motion: reduce) { .site-bar .site-quest { animation: none; } }

/* The site's cursor, the same on lo-fi, hi-fi and the password page (every
   one of them loads this file): a soft ink arrow with a white outline, so it
   shows on cream, dark sections and photos alike; over anything you can click
   it turns orange, the site's accent. Its point (the click) is the tip. Text
   fields keep the text cursor. Hi-fi's 3D room uses the same two (its
   style.css reads these variables). */
:root {
  --cursor-rest: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath d='M7 4.5c0-1 1-1.5 1.9-1l15.6 10.4c1 .7.7 2.2-.5 2.4l-7 1.3-3.4 7c-.5 1.1-2 1-2.4-.1L7 5.3z' fill='%23111' stroke='%23fff' stroke-width='3' stroke-linejoin='round'/%3E%3Cpath d='M7 4.5c0-1 1-1.5 1.9-1l15.6 10.4c1 .7.7 2.2-.5 2.4l-7 1.3-3.4 7c-.5 1.1-2 1-2.4-.1L7 5.3z' fill='%23111'/%3E%3C/svg%3E") 7 4, default;
  --cursor-point: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 32 32'%3E%3Cpath d='M7 4.5c0-1 1-1.5 1.9-1l15.6 10.4c1 .7.7 2.2-.5 2.4l-7 1.3-3.4 7c-.5 1.1-2 1-2.4-.1L7 5.3z' fill='%23E36216' stroke='%23fff' stroke-width='3' stroke-linejoin='round'/%3E%3Cpath d='M7 4.5c0-1 1-1.5 1.9-1l15.6 10.4c1 .7.7 2.2-.5 2.4l-7 1.3-3.4 7c-.5 1.1-2 1-2.4-.1L7 5.3z' fill='%23E36216'/%3E%3C/svg%3E") 7 4, pointer;
}
html { cursor: var(--cursor-rest); }
a[href], button:not(:disabled), [role="button"], [role="tab"], summary, label[for], select,
input[type="checkbox"], input[type="radio"], input[type="range"], input[type="submit"], input[type="button"] {
  cursor: var(--cursor-point) !important;
}
input:not([type]), input[type="text"], input[type="password"], input[type="email"], input[type="search"], input[type="url"], input[type="tel"], input[type="number"], textarea, [contenteditable="true"] {
  cursor: text !important;
}



/* ══════════════════════════════════
   SIDE NAVIGATION
══════════════════════════════════ */
.sidenav {
  position: fixed;
  right: 32px; top: 50%;
  transform: translateY(-50%);
  z-index: 200;
  display: flex; flex-direction: column;
  opacity: 0; pointer-events: none;
  transition: opacity 0.8s ease 0.3s;
}

/* Gradient track line — always present, faint */
.sidenav::after {
  content: '';
  position: absolute;
  right: 4px; top: 0; bottom: 0;
  width: 1px;
  background: linear-gradient(to bottom,
    rgba(155,140,248,0.22),
    rgba(249,115,22,0.22),
    rgba(6,182,212,0.22),
    rgba(168,85,247,0.22),
    rgba(132,204,22,0.22)
  );
  z-index: 0; pointer-events: none;
}

.sidenav.ready { opacity: 1; pointer-events: auto; }

.sn-item {
  position: relative;
  display: flex; align-items: center; justify-content: flex-end;
  gap: 16px; padding: 24px 0;
  text-decoration: none; cursor: pointer;
}

/*
  Animated fill bar per segment.
  --sn-from : color of the previous segment (set inline on each item)
  --sn-color: this segment's color
  Together they produce a smooth gradient transition between sections.
*/
.sn-item::before {
  content: '';
  position: absolute; right: 3px; top: 0; bottom: 0; width: 3px;
  background: linear-gradient(to bottom,
    var(--sn-from, var(--sn-color)),
    var(--sn-color)
  );
  border-radius: 2px; z-index: 1;
  opacity: 0; transform: scaleY(0); transform-origin: top;
  transition: opacity 0.6s ease, transform 1.2s cubic-bezier(0.16, 1, 0.3, 1);
  transition-delay: var(--sn-bar-delay, 0ms);
}
.sn-item.sn-filled::before { opacity: 1; transform: scaleY(1); }

.sn-label {
  /* Text kept in DOM for JS to read — not rendered inline */
  display: none;
}

/* ── Floating tooltip (single shared element, position: fixed) ── */
.sn-tip {
  position: fixed;
  right: 52px; /* sits left of the dot column */
  pointer-events: none;
  background: rgba(22,20,18,0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: rgba(255,255,255,0.9);
  font: var(--type-meta); letter-spacing: var(--track-meta);
  text-transform: uppercase;
  padding: 4px 12px; border-radius: 999px;
  white-space: nowrap; user-select: none;
  opacity: 0;
  transform: translateX(6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 201;
}
.sn-tip.sn-tip--visible {
  opacity: 1;
  transform: translateX(0);
}

.sn-dot {
  width: 8px; height: 8px; border-radius: 50%;
  border: 1.5px solid transparent; background: transparent;
  flex-shrink: 0; position: relative; z-index: 2;
  transition: background 0.35s ease, border-color 0.35s ease,
              box-shadow 0.35s ease, opacity 0.35s ease,
              transform 0.35s cubic-bezier(0.22,1,0.36,1);
  opacity: 0;
}
.sn-item.sn-active .sn-dot {
  border-color: transparent;
  background: var(--sn-color, var(--c-violet));
  box-shadow: 0 0 10px var(--sn-glow, rgba(155,140,248,0.6));
  opacity: 1;
  transform: scale(1.2);
}

/* Dark-section mode: track flips to white-ish */
.sidenav.sidenav--dark::after {
  background: linear-gradient(to bottom,
    rgba(255,255,255,0.2),
    rgba(255,255,255,0.12)
  );
}
.sidenav.sidenav--dark .sn-dot { border-color: transparent; }

/* Dark-mode tooltip: slightly lighter bg */
.sidenav.sidenav--dark ~ .sn-tip,
.sn-tip.sn-tip--dark {
  background: rgba(255,255,255,0.14);
  color: rgba(255,255,255,0.9);
}

/* ══════════════════════════════════
   FOOTER: the one footer on every lo-fi page (built by initSubFooter in
   shared.js): one centred row, the email as a filled button, LinkedIn
   beside it, then the copyright and city. (It folds to a stack on phones.)
══════════════════════════════════ */
footer.site-footer {
  padding: 20px 48px;
  background: var(--c-night); color: #fff;
  border-top: 1px solid rgba(255,255,255,0.07);
  text-align: center;
}
.site-footer .foot-inner {
  max-width: 1360px; margin: 0 auto;
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 12px 20px;
}
.site-footer .foot-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; }
.site-footer .foot-btn {
  display: inline-flex; align-items: center; gap: var(--s-2);
  height: var(--h-ctl-lg); padding: 0 20px; border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.45); color: #fff; text-decoration: none;
  font: var(--type-caption); letter-spacing: var(--track-caption);
  transition: background 0.25s, color 0.25s, border-color 0.25s, transform 0.25s;
}
.site-footer .foot-btn svg { width: var(--icon); height: var(--icon); flex: none; }
.site-footer .foot-btn:hover { background: rgba(255,255,255,0.12); border-color: #fff; }
.site-footer .foot-btn--fill { background: #fff; border-color: #fff; color: var(--c-night); }
.site-footer .foot-btn--fill:hover { background: var(--c-warm); border-color: var(--c-warm); }
.site-footer .foot-btn:active { transform: scale(0.97); }
.site-footer .foot-btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.site-footer .foot-copy {
  margin: 0;
  font: var(--type-caption); letter-spacing: var(--track-caption); color: var(--c-on-dark-2);
}
@media (max-width: 640px) {
  footer.site-footer { padding: 24px; }
  .site-footer .foot-inner { flex-direction: column; align-items: stretch; }
  .site-footer .foot-actions { flex-direction: column; align-items: stretch; width: 100%; }
  .site-footer .foot-btn { justify-content: center; }
}

/* ══════════════════════════════════
   REVEAL ON SCROLL
══════════════════════════════════ */
.reveal {
  opacity: 0; transform: translateY(32px);
  transition: opacity 0.85s cubic-bezier(0.22,1,0.36,1),
              transform 0.85s cubic-bezier(0.22,1,0.36,1);
}
.reveal.in { opacity: 1; transform: translateY(0); }
/* Motion (shared.js) springs these in itself */
.has-motion .reveal { transition: none; }
.reveal-d1 { transition-delay: 0.1s; }
.reveal-d2 { transition-delay: 0.2s; }
.reveal-d3 { transition-delay: 0.32s; }

/* ══════════════════════════════════
   VIEW TRANSITIONS
   Cross-document hero morph when navigating
   to/from case study pages.
══════════════════════════════════ */

/* Enable cross-document transitions for same-origin navigation */
@view-transition {
  navigation: auto;
}

/* ── Keyframes ── */
@keyframes vt-page-out {
  to { opacity: 0; transform: scale(0.97); }
}
@keyframes vt-page-in {
  from { opacity: 0; transform: translateY(18px); }
}
@keyframes vt-hero-fade-out {
  to { opacity: 0; }
}
@keyframes vt-hero-fade-in {
  from { opacity: 0; }
}

/* Root: old page scale-fades out, new page slides up */
::view-transition-old(root) {
  animation: 0.28s cubic-bezier(0.4, 0, 1, 1) both vt-page-out;
}
::view-transition-new(root) {
  animation: 0.5s 0.18s cubic-bezier(0.22, 1, 0.36, 1) both vt-page-in;
}

/* Shared hero element: controls morph position + size */
::view-transition-group(case-hero) {
  animation-duration: 0.62s;
  animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
}
/* Old snapshot (card) fades out quickly */
::view-transition-old(case-hero) {
  animation: 0.28s ease both vt-hero-fade-out;
}
/* New snapshot (hero img) fades in with a slight delay */
::view-transition-new(case-hero) {
  animation: 0.38s 0.22s ease both vt-hero-fade-in;
}

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root),
  ::view-transition-old(case-hero),
  ::view-transition-new(case-hero) {
    animation-duration: 0.01ms !important;
  }
}

/* below 360px the bar's three parts need the narrower gutter */
@media (max-width: 359px) { .site-bar { padding: 0 var(--s-4); } }
