/* ==========================================================================
   Wake — baark.dev's shared visual layer (owner-approved 2026-10-30, mockup
   rive-wake-k31/wake-design.html). This sheet holds Wake's layout, structure,
   typography, spacing, components and motion for the shared top bar, the
   repository code page, the review hub and the sign-in gate. Every colour is a scheme variable of
   style.css (16 data-theme schemes, light and dark): Wake never names a
   colour value, so all of it follows the theme picker. Square corners,
   hairlines, mono metadata, one hot accent.
   ========================================================================== */

:root {
  /* The Wake top bar is 52px; sticky offsets across the site follow. */
  --bar-h: 3.25rem;
  --wake-enter: cubic-bezier(.22, 1, .36, 1);
  --wake-move: cubic-bezier(.25, 1, .5, 1);
}

/* ---- The one bar, Wake's language ----------------------------------------
   52px, a hairline under it, the wordmark in wide-tracked mono, the
   repository name in the sans, one chip per menu. Every control keeps its
   feature: channel menu, Clone menu, palette, More, notifications, the
   theme picker, sign in/out. */
.app-bar {
  gap: .55rem;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
}
.app-brand { font: 600 .88rem/1 var(--mono); letter-spacing: .34em; }
.app-brand .app-mark { color: var(--accent); }
.repo-name {
  font: 650 1.04rem/1 var(--sans);
  letter-spacing: -.02em;
  border-radius: 0;
}
.repo-name:hover { background: var(--panel-2); }
.forked-from { font: .72rem var(--mono); }
.app-bar .visibility-pill { border-radius: 0; }

/* Every chip in the bar: square, hairline, mono. */
.app-bar .menu-button,
.app-bar .button-ghost,
.app-bar .visitor-only,
.app-bar .app-signout .button {
  border-radius: 0;
}
.app-bar .app-signout .button,
.app-bar .visitor-only {
  font: 500 .68rem/1 var(--mono);
  letter-spacing: .07em;
  text-transform: uppercase;
}
.app-bar .clone-menu .menu-button,
.app-bar .more-menu .menu-button { background: transparent; }
.menu-button {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--ink-2);
  font: 500 .72rem/1 var(--mono);
  letter-spacing: .07em;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.menu-button:hover, .menu[open] > .menu-button {
  border-color: var(--ink-2);
  color: var(--ink);
  box-shadow: none;
}
/* The channel chip: the branch glyph and the channel's real name. */
.channel-menu .menu-button {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: var(--ink-2);
  text-transform: none;
  letter-spacing: .05em;
}
.channel-menu .menu-button svg { width: 11px; height: 11px; flex: none; }
.menu-panel { border-radius: 0; border-color: var(--line); }
.menu-panel a { border-radius: 0; }
.menu-title { letter-spacing: .18em; }

/* Icon controls: quiet until hovered. */
.app-bar .icon-button { border-radius: 0; color: var(--ink-2); }
.app-bar .icon-button:hover { background: var(--panel-2); color: var(--ink); }
.app-bar :focus-visible { outline: 1.5px solid var(--focus); outline-offset: 2px; }
.app-bar .theme-toggle { position: relative; }
.app-bar .notifications-link { position: relative; }

/* Real awaiting-review count on the Reviews tab: a square accent pill. */
.count-pill {
  border-radius: 0;
  border: 1px solid var(--accent);
  background: transparent;
  color: var(--accent);
}

/* The theme picker and its menu stay square too. */
.theme-menu { border-radius: 0; }
.theme-option { border-radius: 0; }

/* The tabs under the bar: mono, tracked, the current one underlined in the
   accent. Their 42px row is Wake's second hairline, not another card. */
.repo-tabs { gap: 1.3rem; min-height: 42px; background: var(--bg); }
.repo-tabs > a, .repo-tabs .app-within {
  font-size: .72rem;
  letter-spacing: .12em;
  padding: .8rem 0 .62rem;
}
.repo-tabs > a[aria-current="page"]::after { box-shadow: none; }
.tab-count { border-radius: 0; }

/* ---- Shared Wake pieces ----------------------------------------------------
   .wake-mono is the metadata voice; .wake-ghostword is the huge outlined
   background word (its content is real: the repository's name); .wake-rise
   is the staggered entrance; .wake-tape is the recent-changes strip. */
.wake-mono { font-family: var(--mono); font-size: .72rem; letter-spacing: .09em; }

.wake-ghostword {
  position: absolute;
  z-index: 0;
  white-space: nowrap;
  font: 800 16cqw/1 var(--sans);
  letter-spacing: -.045em;
  color: transparent;
  -webkit-text-stroke: 1.5px color-mix(in srgb, var(--ink) 9%, transparent);
  transform: scaleX(.92);
  user-select: none;
  pointer-events: none;
}

.wake-rise > * { animation: wake-rise .55s var(--wake-enter) both; }
.wake-rise > *:nth-child(2) { animation-delay: .06s; }
.wake-rise > *:nth-child(3) { animation-delay: .12s; }
.wake-rise > *:nth-child(4) { animation-delay: .18s; }
.wake-rise > *:nth-child(5) { animation-delay: .24s; }
@keyframes wake-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ---- The sign-in gate (a private repository, signed out) -------------------
   Wake's auth composition: a left-aligned column, a hairline chip of real
   context, a big tight headline, one square orange action. */
.sign-in-gate {
  min-height: calc(100vh - var(--bar-h));
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 2rem clamp(1.25rem, 9vw, 8rem);
  background:
    radial-gradient(90% 60% at 85% 0%, color-mix(in srgb, var(--accent) 4.5%, transparent), transparent 60%),
    var(--bg);
}
.gate-card {
  width: min(34rem, 100%);
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
  text-align: left;
}
.gate-card .eyebrow {
  display: flex;
  align-items: center;
  gap: .65rem;
  margin: 0 0 1.1rem;
  color: var(--ink-3);
  font: 500 .72rem var(--mono);
  letter-spacing: .09em;
  text-transform: uppercase;
}
.gate-card .eyebrow::before { content: ""; width: 26px; height: 1px; background: var(--accent); }
.gate-card h1 {
  margin: 0 0 1rem;
  font: 800 clamp(2.6rem, 7vw, 4.4rem)/.98 var(--sans);
  letter-spacing: -.05em;
  text-transform: none;
}
.gate-card .gate-name { color: var(--accent); font-size: .82em; }
.gate-card .gate-copy { margin: 0 0 1.8rem; max-width: 30rem; color: var(--ink-2); }
.gate-card .gate-button {
  display: inline-flex;
  min-height: 3.5rem;
  padding: 0 1.6rem;
  border-radius: 0;
  font: 600 .8rem var(--mono);
  letter-spacing: .08em;
  box-shadow: none;
}
.gate-card .gate-foot { margin: 1.4rem 0 0; }
.gate-card .gate-foot a { color: var(--ink-3); }

/* A phone keeps the bar to one row, as before, only tighter. */
@media (max-width: 760px) {
  .app-bar { gap: .3rem; padding: 0 .7rem; }
  .app-bar .app-actions { gap: 0; }
  .repo-name { font-size: .95rem; }
  .app-bar .repo-name { min-width: 2rem; max-width: 5.8rem; }
  .app-bar .app-signout .button,
  .app-bar .visitor-only { padding-inline: .35rem; font-size: .62rem; }
  .gate-card h1 { font-size: clamp(2.2rem, 11vw, 3rem); }
}

@media (prefers-reduced-motion: reduce) {
  .wake-rise > * { animation: none; }
}

/* ---- Repository: crumbs / tree + source / real-change tape ---------------
   The file view owns the viewport below the shared chrome. The tree is a
   quiet 220px rail, source stays in its UsaGui island, and the tape links
   only to changes the node actually returned. */
.repo-file-page { height: 100dvh; overflow: hidden; display: flex; flex-direction: column; }
.repo-file-page > .app-bar, .repo-file-page > .repo-tabs, .repo-file-page > .repo-notice { flex: none; }
.repo-file-page main.repo-main {
  flex: 1; min-height: 0; width: 100%; max-width: none; padding: 0;
  display: grid; grid-template-rows: 42px minmax(0, 1fr) auto; gap: 0;
}
.repo-file-page .path-bar {
  min-width: 0; display: flex; align-items: center; gap: .65rem;
  min-height: 42px; padding: 0 clamp(1rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--line); background: var(--bg); overflow: hidden;
}
.repo-file-page .path-bar .crumbs {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 400 .72rem/1 var(--mono); letter-spacing: .055em;
}
.wake-files-toggle {
  display: none; flex: none; align-items: center; justify-content: center; gap: .4rem;
  min-width: 44px; min-height: 40px; padding: 0 .55rem !important;
  border: 0 !important; border-right: 1px solid var(--line) !important; border-radius: 0 !important;
  background: transparent !important; color: var(--ink-2) !important;
  font: 500 .68rem/1 var(--mono) !important; letter-spacing: .08em; text-transform: uppercase;
}
.wake-files-toggle svg { width: 16px; height: 16px; }
.repo-file-page .file-layout {
  position: relative; container-type: inline-size; min-height: 0; overflow: hidden;
  display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 0; align-items: stretch;
}
.repo-file-page .repo-tree {
  position: relative; z-index: 2; top: auto; max-height: none; min-height: 0; overflow: hidden;
  padding: 1rem 0; gap: .65rem; border: 0; border-right: 1px solid var(--line);
  border-radius: 0; background: color-mix(in srgb, var(--bg) 82%, transparent);
}
.repo-file-page .repo-tree .filter-input {
  width: calc(100% - 2rem); margin: 0 1rem; padding: .45rem .55rem;
  border: 0; border-bottom: 1px solid var(--line-strong); border-radius: 0;
  background: transparent; font: .72rem var(--mono);
}
.repo-file-page .tree { padding: 0 .65rem; font: .72rem/2.05 var(--mono); color: var(--ink-3); }
.repo-file-page .tree ul { padding-left: .65rem; margin-left: .35rem; }
.repo-file-page .tree summary,
.repo-file-page .tree-file { min-height: 32px; padding-block: 0; border-radius: 0; }
.repo-file-page .tree summary { color: var(--ink-3); }
.repo-file-page .tree-file { position: relative; color: var(--ink-2) !important; }
.repo-file-page .tree-file[aria-current="page"] {
  color: var(--ink) !important;
  background: linear-gradient(90deg, var(--accent-soft), transparent 75%);
  box-shadow: inset 2px 0 0 var(--accent);
}
.repo-file-page .tree-file:hover, .repo-file-page .tree summary:hover { background: var(--panel-2); }
.repo-file-page .tree-size { font-size: .62rem; }
.repo-ghost {
  top: 0; right: -1cqw; z-index: 0; max-width: 100%; overflow: hidden;
  font-size: 19cqw; text-transform: uppercase;
}
.repo-file-page .file-pane { position: relative; z-index: 1; min-height: 0; overflow: auto; gap: 0; grid-template-rows: minmax(0, 1fr); }
.repo-file-page .file.card {
  height: 100%; min-height: 0; padding: 0; border: 0; border-radius: 0; box-shadow: none;
  display: flex; flex-direction: column; background: color-mix(in srgb, var(--code-bg) 86%, transparent);
  animation: none;
}
.repo-file-page .file-bar {
  position: relative; top: auto; z-index: 3; flex: none; min-height: 42px;
  padding: .4rem 1rem; background: color-mix(in srgb, var(--code-bg) 92%, transparent);
}
.repo-file-page .file-meta, .repo-file-page .file-actions { font: .68rem var(--mono); }
.repo-file-page .file-actions .chip { border-radius: 0; background: transparent; }
.repo-file-page .file-credit { flex: none; background: var(--code-bg); }
/* The source view keeps a bounded box and scrolls inside it (as on main): the
   UsaGui island takes the <pre>'s box, so an unbounded <pre> would make a
   canvas as tall as the whole file. */
.repo-file-page usagui-island.code-island { flex: 1 1 0; min-height: 20rem; grid-template-rows: minmax(0, 1fr); }
.repo-file-page usagui-island.code-island > [data-usagui-fallback] { height: 100%; }
.repo-file-page .code {
  height: 100%; min-height: 0; max-height: none; overflow: auto; padding: 1.25rem 0 2.5rem;
  background: transparent; font-size: .8rem; line-height: 1.95;
}
.repo-file-page .code .ln { width: 4.15em; }
.repo-file-page .line.selected {
  background: color-mix(in srgb, var(--ink) 5%, transparent);
  box-shadow: inset 2px 0 0 var(--accent);
}
.repo-file-page .edit-panel { margin: 1rem; border-radius: 0; }

.wake-tape {
  position: relative; z-index: 4; height: 78px; flex: none; overflow: hidden;
  border-top: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 94%, transparent);
}
.wake-tape > svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.wake-tape > svg path { fill: none; stroke: var(--line-strong); stroke-width: 1.2; }
.wake-ticks { position: relative; height: 100%; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(8rem, 1fr); }
.wake-tick {
  position: relative; min-width: 0; padding: .55rem .7rem .45rem 1rem;
  border-left: 1px solid var(--line); color: var(--ink-2) !important;
  display: grid; grid-template-rows: auto auto auto; gap: .08rem;
  font: .62rem/1.35 var(--mono); text-decoration: none !important;
}
.wake-tick:hover { background: var(--panel-2); }
.wake-tick.hot { border-left: 2px solid var(--accent); }
.wake-tick-who { color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wake-tick.hot .wake-tick-who { color: var(--accent); }
.wake-tick-title { color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wake-tick-meta { display: flex; gap: .55rem; color: var(--ink-3); white-space: nowrap; }
.wake-tick-meta code { font: inherit; }
.wake-runner {
  position: absolute; z-index: 2; left: 0; top: 41px; width: 6px; height: 6px;
  background: var(--accent); animation: wake-run 9s linear infinite;
}
@keyframes wake-run {
  from { transform: translateX(-8px); opacity: 0; }
  6%, 94% { opacity: 1; }
  to { transform: translateX(100vw); opacity: 0; }
}

@media (max-width: 760px) {
  .wake-files-toggle { display: inline-flex; margin-left: -1rem; }
  .repo-file-page .path-bar { padding-left: 1rem; padding-right: 1rem; }
  .repo-file-page .file-layout { grid-template-columns: minmax(0, 1fr); }
  .repo-file-page .repo-tree { display: none; }
  .repo-file-page.tree-open .repo-tree {
    position: fixed; z-index: 28; top: calc(var(--bar-h) + 84px); bottom: 0; left: 0;
    display: flex; width: min(84vw, 20rem); border-right: 1px solid var(--line-strong);
    background: var(--panel); box-shadow: var(--shadow-2);
  }
  .repo-file-page .code { font-size: .68rem; }
  .repo-file-page .code .ln { width: 3.4em; padding-right: .8em; }
  .repo-ghost { font-size: 26cqw; -webkit-text-stroke-width: 1px; }
  .repo-file-page .file-bar { align-items: flex-start; }
  .repo-file-page .file-actions { justify-content: flex-end; }
  .wake-tick-title { display: none; }
  .wake-tick { grid-template-rows: auto auto; align-content: center; }
  .wake-tick:nth-child(even) .wake-tick-who { color: var(--ink-3); }
}
@media (prefers-reduced-motion: reduce) {
  .wake-runner { animation: none; display: none; }
}

/* ---- Review hub: a real staged-change stream, then the full workspace -----
   The first screen is Wake's REVIEW composition. Every row comes from the
   draft graph; Inspect drives the existing StagingPanel. The original graph,
   diff, split editor, decisions and publish cards remain immediately below. */
body.review-hub { height: auto; min-height: 100dvh; overflow: visible; }
.wake-review-intro {
  position: relative; container-type: inline-size; isolation: isolate;
  display: grid; grid-template-rows: auto auto;
  border-bottom: 1px solid var(--line); background: var(--bg); overflow: hidden;
}
.wake-review-intro:empty { display: none; }
.wake-review-ghost { top: 0; right: -1cqw; font-size: 17cqw; }
.wake-revhead {
  position: relative; z-index: 1; display: flex; align-items: baseline; gap: 1.1rem;
  padding: 1rem clamp(1.25rem, 4vw, 2.5rem) .9rem;
}
.wake-review-count { font: 800 clamp(2.75rem, 6.5cqw, 4.5rem)/1 var(--sans); letter-spacing: -.05em; }
.wake-review-count strong { color: var(--accent); font-weight: 800; }
.wake-review-label { color: var(--ink-3); text-transform: uppercase; white-space: nowrap; }
.wake-revhead progress {
  flex: 1; align-self: center; height: 1px; border-radius: 0; background: var(--line);
}
.wake-revhead progress::-webkit-progress-bar { background: var(--line); border-radius: 0; }
.wake-revhead progress::-webkit-progress-value { height: 3px; margin-top: -1px; border-radius: 0; background: var(--accent); }
.wake-revhead progress::-moz-progress-bar { height: 3px; border-radius: 0; background: var(--accent); }
.wake-review-workspace { color: var(--ink-2) !important; text-decoration: none !important; white-space: nowrap; }
.wake-review-workspace:hover { color: var(--accent) !important; }
.wake-change-stream {
  position: relative; z-index: 1; min-height: 0;
  display: flex; flex-direction: column; border-top: 1px solid var(--line);
  padding-bottom: calc(1rem + env(safe-area-inset-bottom));
}
.wake-change-row {
  position: relative; flex: 0 0 auto; min-height: 84px;
  display: grid; grid-template-columns: 5.5rem minmax(0, 1fr) auto; align-items: center; gap: 1rem;
  padding: .7rem clamp(1.25rem, 4vw, 2.5rem);
  border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 90%, transparent);
  animation: wake-row-in .5s var(--wake-enter) both;
}
.wake-change-row:nth-child(2) { animation-delay: .06s; }
.wake-change-row:nth-child(3) { animation-delay: .12s; }
.wake-change-row:nth-child(4) { animation-delay: .18s; }
.wake-change-row::before { content: ""; position: absolute; left: 0; inset-block: 0; width: 2px; background: transparent; }
.wake-change-row:hover::before, .wake-change-row:focus-within::before { background: var(--accent); }
@keyframes wake-row-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.wake-change-delta { display: grid; justify-items: end; font: 800 1.55rem/1.05 var(--sans); letter-spacing: -.04em; }
.wake-change-delta strong { color: var(--link); font-weight: 800; }
.wake-change-delta span { color: var(--ink-3); font-size: .8em; }
.wake-change-who { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.wake-agent {
  flex: none; width: auto; min-width: 30px; height: 30px; padding-inline: .45rem;
  display: grid; place-items: center; box-sizing: border-box;
  border: 1px solid var(--line-strong); color: var(--ink-2);
  font: 600 .56rem/1 var(--mono); text-transform: uppercase;
}
.wake-agent[data-kind="ai"] { color: var(--au-ai); border-color: color-mix(in srgb, var(--au-ai) 55%, var(--line)); }
.wake-agent[data-kind="human"] { color: var(--au-human); border-color: color-mix(in srgb, var(--au-human) 55%, var(--line)); }
.wake-change-copy { min-width: 0; }
.wake-change-copy h2 {
  margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink); font: 600 .92rem/1.45 var(--sans); letter-spacing: -.01em;
}
.wake-change-copy p { margin: .1rem 0 0; color: var(--ink-3); font: .68rem/1.4 var(--mono); letter-spacing: .04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wake-inspect {
  width: 48px; height: 48px; padding: 0 !important; border: 1px solid var(--line-strong) !important;
  border-radius: 0 !important; background: transparent !important; color: var(--ink-2) !important;
  font: 1.1rem/1 var(--mono) !important;
}
.wake-inspect:hover { color: var(--accent) !important; border-color: var(--accent) !important; }

/* The complete existing workspace, restyled as Wake rather than removed. */
.review-hub .hub {
  flex: none; height: calc(100dvh - var(--bar-h) - 42px); min-height: 38rem;
  scroll-margin-top: var(--bar-h); background: var(--bg);
}
.review-hub .hub-nav { background: var(--bg); padding: 1rem; }
.review-hub .pipeline-link, .review-hub .file-link { border-radius: 0; }
.review-hub .pipeline.is-active > .pipeline-link { box-shadow: inset 2px 0 var(--accent); background: linear-gradient(90deg, var(--accent-soft), transparent 80%); }
.review-hub .hub-filebar { background: var(--bg); padding: .8rem 1.25rem .65rem; }
.review-hub .filebar-title .eyebrow { font-family: var(--mono); }
.review-hub .hub-side { padding: 0; gap: 0; }
.review-hub .hub-card {
  margin: 0; padding: 1rem 1.1rem; border: 0; border-bottom: 1px solid var(--line);
  border-radius: 0; box-shadow: none; background: var(--bg);
}
.review-hub .publish-card { background: linear-gradient(180deg, color-mix(in srgb, var(--accent) 7%, var(--bg)), var(--bg) 7rem); }
.review-hub .hub-card .card-header h2 { font: 600 .72rem/1.2 var(--mono); letter-spacing: .12em; text-transform: uppercase; }
.review-hub .hub-card .button, .review-hub .hub-card .badge, .review-hub .hub-card .chip,
.review-hub .filebar-tools .chip, .review-hub .segmented, .review-hub .segmented button,
.review-hub .find input { border-radius: 0; }
.review-hub .dag-scroll { border-radius: 0; }
.review-hub .graph-card { scroll-margin-top: var(--bar-h); }
.review-hub .selection-bar { border-radius: 0; }

@media (max-width: 1240px) {
  .review-hub .hub { height: auto; min-height: 0; }
  .review-hub .hub-main { height: calc(100dvh - var(--bar-h)); }
}
@media (max-width: 760px) {
  .wake-review-intro { min-height: 0; }
  .wake-review-ghost { font-size: 26cqw; -webkit-text-stroke-width: 1px; }
  .wake-revhead { flex-wrap: wrap; gap: .5rem .85rem; padding-top: .8rem; }
  .wake-review-count { font-size: 2.75rem; }
  .wake-review-label { font-size: .62rem; }
  .wake-revhead progress { order: 3; flex-basis: 100%; }
  .wake-review-workspace { margin-left: auto; font-size: .62rem; }
  .wake-change-row { grid-template-columns: 3.6rem minmax(0, 1fr) auto; gap: .65rem; min-height: 82px; padding-block: .75rem; }
  .wake-change-delta { font-size: 1.25rem; }
  .wake-change-who { gap: .55rem; }
  .wake-change-copy h2 { font-size: .85rem; }
  .wake-change-copy p { font-size: .6rem; }
  .wake-inspect { width: 44px; height: 44px; }
  .review-hub .hub-main { height: 78vh; }
}
@media (prefers-reduced-motion: reduce) {
  .wake-change-row { animation: none; }
}
