/* The shared shell's stylesheet — the sidebar on a page that is not you².

   It carries two things and nothing else: the sidebar itself, and the offset
   the host page needs so its content does not sit under it. Every selector is
   prefixed `y2-`, and every token it needs is declared on `.y2-sidebar`
   rather than on `:root`, because the host application (GoodFood, today) owns
   the page's own tokens and neither design system may tint the other.

   The values are `dashboard/styles.css`'s, so the sidebar an external app
   wears is the same glass panel you² wears — same 224-px panel, same hairline,
   same inset highlight, same accent per app. */

/* The page, beside the sidebar. 12 px gutter + 208 px panel + 12 px gutter. */
html[data-shell] body {
  padding-left: 232px;
}

.y2-sidebar, .y2-menu {
  /* the panel */
  --y2-surface: rgba(255, 255, 255, 0.055);
  --y2-surface-2: rgba(255, 255, 255, 0.09);
  --y2-line: rgba(255, 255, 255, 0.10);
  --y2-line-strong: rgba(255, 255, 255, 0.22);
  --y2-hi: rgba(255, 255, 255, 0.14);
  --y2-blur: blur(20px) saturate(140%);
  --y2-shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
  --y2-panel: rgba(13, 17, 28, 0.72);
  /* type */
  --y2-ink: #f2f4f8;
  --y2-muted: rgba(242, 244, 248, 0.68);
  --y2-faint: rgba(242, 244, 248, 0.44);
  --y2-ghost: rgba(242, 244, 248, 0.30);
  /* The active app's accent, mapped from the palette on <html data-app>.
     accents.css is the single source and speaks neutral `--app-*` tokens; the
     fallbacks are you²'s, for the half-second before the shell has set
     data-app and for any page that somehow loads this sheet without it. */
  --y2-accent: var(--app-accent, #7fb4ff);
  --y2-accent-ink: var(--app-accent-ink, #b5d2ff);
  --y2-accent-mix: var(--app-accent-mix, #9085e9);
  --y2-accent-shine: var(--app-accent-shine, 0 0 22px rgba(127, 180, 255, 0.34));
  --y2-on-accent: var(--app-on-accent, #06121f);
  --y2-ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --y2-t: 0.15s;
  /* the switcher's six dots come from accents.css too, at :root */
}

.y2-sidebar {
  position: fixed;
  left: 12px;
  top: 12px;
  width: 208px;
  height: calc(100vh - 24px);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 15px 11px 12px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 13.5px;
  line-height: 1.5;
  letter-spacing: -0.011em;
  color: var(--y2-muted);
  background: var(--y2-surface);
  backdrop-filter: var(--y2-blur);
  -webkit-backdrop-filter: var(--y2-blur);
  border: 1px solid var(--y2-line);
  border-radius: 16px;
  box-shadow: inset 0 1px 0 var(--y2-hi), var(--y2-shadow);
  overflow-y: auto;
  scrollbar-width: none;
}
.y2-sidebar::-webkit-scrollbar { display: none; }

/* The accent per app — the one thing in the sidebar that says where you are —
   is no longer a table here: `data-app` is on <html>, accents.css answers it,
   and the mapping above is all this sheet needs. `.y2-sidebar[data-app]` is
   still set by shell.js, for anything that wants to read it. */

.y2-sb-brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 0; }
/* the one element with a glow: the identity mark */
.y2-sb-mark {
  width: 29px; height: 29px; border-radius: 10px; flex-shrink: 0;
  background: linear-gradient(135deg, var(--y2-accent), color-mix(in srgb, var(--y2-accent) 45%, var(--y2-accent-mix)));
  box-shadow: var(--y2-accent-shine);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 700; color: var(--y2-on-accent); letter-spacing: -0.03em;
}
.y2-sb-word { font-weight: 700; font-size: 16px; letter-spacing: -0.025em; line-height: 1.1; color: var(--y2-ink); }
.y2-sb-word sup, .y2-sb-item sup { font-size: 0.68em; top: -0.45em; position: relative; }
/* one line or nothing: a wrapped tagline pushes the sidebar out of alignment */
.y2-sb-tag {
  font-size: 10.5px; color: var(--y2-faint); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 140px;
}

.y2-sb-group { display: flex; flex-direction: column; gap: 2px; }
.y2-sb-label {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--y2-ghost); padding: 0 9px 6px;
}
.y2-sb-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 9px; border: 1px solid transparent; background: transparent; cursor: pointer;
  border-radius: 10px; font-family: inherit; font-size: 13px; font-weight: 500;
  color: var(--y2-muted); text-align: left; text-decoration: none; letter-spacing: -0.012em;
  transition: color var(--y2-t), background-color var(--y2-t),
              border-color var(--y2-t), box-shadow var(--y2-t);
}
.y2-sb-item:hover { color: var(--y2-ink); background: var(--y2-surface); }
.y2-sb-item[aria-current] {
  color: var(--y2-ink); background: var(--y2-surface-2); font-weight: 600;
  border-color: var(--y2-line); box-shadow: inset 0 1px 0 var(--y2-hi), var(--y2-accent-shine);
}
.y2-sb-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
  background: var(--sb-dot, var(--y2-faint));
  box-shadow: 0 0 8px var(--sb-dot, transparent);
}
.y2-sb-key {
  margin-left: auto; font-size: 10px; color: var(--y2-ghost);
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  border: 1px solid var(--y2-line); border-radius: 4px; padding: 0 4px; line-height: 15px;
}
.y2-sb-sub { padding-left: 24px; font-size: 12.5px; }
.y2-sb-subhead {
  font-size: 12px; font-weight: 600; color: var(--y2-ink);
  padding: 10px 9px 3px; letter-spacing: -0.015em;
}
.y2-sb-sep { height: 1px; background: var(--y2-line); margin: 0 9px; }

.y2-sb-foot {
  margin-top: auto; display: flex; flex-direction: column; gap: 8px;
  padding: 11px 3px 0; border-top: 1px solid var(--y2-line);
}
.y2-sb-foot-row { display: flex; gap: 6px; }
.y2-sidebar .y2-btn {
  flex: 1; font-family: inherit; font-size: 12px; font-weight: 600; letter-spacing: -0.01em;
  border-radius: 999px; padding: 6px 12px; cursor: pointer; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--y2-ink); background: var(--y2-surface); border: 1px solid var(--y2-line);
  box-shadow: inset 0 1px 0 var(--y2-hi);
  transition: background-color var(--y2-t), border-color var(--y2-t);
}
.y2-sidebar .y2-btn:hover { background: var(--y2-surface-2); border-color: var(--y2-line-strong); }
.y2-sb-note { font-size: 10px; color: var(--y2-ghost); padding: 0 6px; line-height: 1.5; }

.y2-sidebar :focus-visible { outline: 2px solid var(--y2-accent); outline-offset: 2px; border-radius: 4px; }

/* Light. The panel is the same primitive with the field behind it inverted. */
html[data-theme="light"] .y2-sidebar,
html[data-theme="light"] .y2-menu {
  --y2-surface: rgba(255, 255, 255, 0.62);
  --y2-surface-2: rgba(255, 255, 255, 0.82);
  --y2-line: rgba(20, 30, 60, 0.10);
  --y2-line-strong: rgba(20, 30, 60, 0.22);
  --y2-hi: rgba(255, 255, 255, 0.95);
  --y2-shadow: 0 12px 34px rgba(30, 40, 80, 0.10);
  --y2-panel: rgba(255, 255, 255, 0.94);
  --y2-ink: #0d1220;
  --y2-muted: rgba(13, 18, 32, 0.68);
  --y2-faint: rgba(13, 18, 32, 0.46);
  --y2-ghost: rgba(13, 18, 32, 0.32);
  /* the accent's light values come from accents.css, keyed on data-theme */
  --y2-on-accent: var(--app-on-accent, #ffffff);
}

/* The menu button and the scrim exist only at narrow widths. The button is the
   shell's own, injected beside the sidebar, because the host page has none we
   could borrow; it floats top-left, and the page gives up a 56-px strip at the
   top so that at rest it covers nothing. */
.y2-menu, .y2-scrim { display: none; }

/* Narrow: the panel is an opaque drawer over the page, closed until the menu
   button opens it; the page keeps its own full width underneath. A tap on the
   scrim, Escape or any link in it closes it again. */
@media (max-width: 900px) {
  html[data-shell] body { padding-left: 0; padding-top: 56px; }
  .y2-sidebar {
    left: 10px; top: 10px; height: calc(100% - 20px);
    background: var(--y2-panel);
    transform: translateX(calc(-100% - 20px));
    transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }
  html[data-y2-open] .y2-sidebar { transform: none; }
  .y2-menu {
    display: inline-flex; align-items: center;
    position: fixed; left: 10px; top: 10px; z-index: 59;
    height: 38px; padding: 0 15px 0 13px;
    font: 600 13px/1 Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    letter-spacing: -0.01em; cursor: pointer;
    color: var(--y2-ink); background: var(--y2-panel);
    backdrop-filter: var(--y2-blur); -webkit-backdrop-filter: var(--y2-blur);
    border: 1px solid var(--y2-line); border-radius: 999px;
    box-shadow: inset 0 1px 0 var(--y2-hi), var(--y2-shadow);
  }
  .y2-scrim {
    display: block; position: fixed; inset: 0; z-index: 58;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0; pointer-events: none; transition: opacity 0.28s;
  }
  html[data-y2-open] .y2-scrim { opacity: 1; pointer-events: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .y2-sb-item { transition: none; }
  .y2-sidebar, .y2-scrim { transition: none; }
}
