/*
 * Working Agents: the interface's visual language.
 *
 * A dark indigo-navy rail carries the navigation; the work sits on white
 * cards over a pale blue-grey ground. One colour acts: an indigo, used for the
 * primary button, the current place in the rail and the focus ring. Everything
 * else that is coloured is a state: green done, blue at work, violet waiting,
 * red failed, grey stopped, each as a strong ink on a pale wash of itself.
 * Cards and controls are rounded; type is Plus Jakarta Sans, with IBM Plex
 * Mono kept for code and verbatim content.
 *
 * Files are loaded alphabetically by Propshaft; the layer order below is what
 * decides precedence, and is repeated at the top of each stylesheet.
 */
@layer tokens, base, layout, components, pages;

@layer tokens {
  @font-face {
    font-family: "Plus Jakarta Sans";
    src: url("/assets/plus-jakarta-sans-latin-d2ff26bc.woff2") format("woff2");
    font-weight: 200 800;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
  }

  @font-face {
    font-family: "Plus Jakarta Sans";
    src: url("/assets/plus-jakarta-sans-latin-ext-ff4456f1.woff2") format("woff2");
    font-weight: 200 800;
    font-style: normal;
    font-display: swap;
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
  }

  @font-face {
    font-family: "Plus Jakarta Sans";
    src: url("/assets/plus-jakarta-sans-latin-italic-25321de8.woff2") format("woff2");
    font-weight: 200 800;
    font-style: italic;
    font-display: swap;
  }

  @font-face {
    font-family: "IBM Plex Mono";
    src: url("/assets/ibm-plex-mono-400-d803141a.woff2") format("woff2");
    font-weight: 400;
    font-display: swap;
  }

  @font-face {
    font-family: "IBM Plex Mono";
    src: url("/assets/ibm-plex-mono-500-3f7bbac1.woff2") format("woff2");
    font-weight: 500;
    font-display: swap;
  }

  :root {
    /* Ground, what is set into it, and what sits on it */
    --panel: #f3f5fa;
    --panel-deep: #e7ebf3;
    --surface: #ffffff;
    --well: #f6f7fb;
    --rule: #dde2ec;
    --rule-soft: #ebeef5;
    --rule-strong: #c9d0de;

    /* Ink */
    --ink: #111a33;
    --ink-soft: #566079;
    --ink-faint: #69728b;

    /* The rail, with its own lighter inks */
    --rail: #131a31;
    --rail-raise: #1f2845;
    --rail-rule: #2a3454;
    --rail-ink: #e4e8f5;
    --rail-ink-soft: #8c95b4;

    /* The one colour that acts, and its lighter form for use on the rail */
    --signal: #3b45d4;
    --signal-deep: #2e37b5;
    --signal-bright: #8d99ff;
    --signal-wash: #e8eaff;

    /* States: an ink and a wash for each */
    --lamp-queued: #0369a1;
    --lamp-running: #1d4ed8;
    --lamp-waiting: #6d28d9;
    --lamp-completed: #15803d;
    --lamp-failed: #c81e1e;
    --lamp-cancelled: #566079;

    --wash-queued: #e0f2fe;
    --wash-running: #dbe8fe;
    --wash-waiting: #ede9fe;
    --wash-completed: #dcfce7;
    --wash-failed: #fee4e2;
    --wash-cancelled: #eceff5;

    /* A caution that is not a state: a limit nearly reached, a tool not set up */
    --warn: #b45309;
    --wash-warn: #fef3c7;

    --shadow: 0 1px 2px rgb(17 26 51 / 0.04), 0 1px 3px rgb(17 26 51 / 0.05);
    --shadow-raised: 0 4px 6px -2px rgb(17 26 51 / 0.06), 0 12px 24px -6px rgb(17 26 51 / 0.14);

    --font-body: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-data: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

    --step--2: 0.75rem;
    --step--1: 0.8125rem;
    --step-0: 0.875rem;
    --step-1: 1.0625rem;
    --step-2: 1.375rem;
    --step-3: 1.625rem;

    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;

    /* Cards, and the controls inside them */
    --radius: 12px;
    --radius-control: 8px;
    --rail-width: 14.5rem;

    /* State icons, used as masks so that they take the colour of their badge */
    --icon-check-circle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill-rule='evenodd' d='M12 2a10 10 0 1 0 0 20 10 10 0 0 0 0-20zm5 7.6-5.8 6.1a1 1 0 0 1-1.4 0L7 12.9a1 1 0 0 1 1.4-1.4l2 2 5.1-5.3A1 1 0 0 1 17 9.6z'/%3E%3C/svg%3E");
    --icon-cross-circle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m9 9 6 6M15 9l-6 6'/%3E%3C/svg%3E");
    --icon-pause-circle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M10 9v6M14 9v6'/%3E%3C/svg%3E");
    --icon-spinner: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='M12 3v3.5'/%3E%3Cpath opacity='.85' d='m18.4 5.6-2.5 2.5'/%3E%3Cpath opacity='.7' d='M21 12h-3.5'/%3E%3Cpath opacity='.55' d='m18.4 18.4-2.5-2.5'/%3E%3Cpath opacity='.45' d='M12 21v-3.5'/%3E%3Cpath opacity='.35' d='m5.6 18.4 2.5-2.5'/%3E%3Cpath opacity='.25' d='M3 12h3.5'/%3E%3Cpath opacity='.15' d='m5.6 5.6 2.5 2.5'/%3E%3C/svg%3E");
    --icon-clock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7.5V12l3 2'/%3E%3C/svg%3E");
    --icon-stop-circle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M8.5 12h7'/%3E%3C/svg%3E");
    --icon-circle: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2'%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3C/svg%3E");
  }
}

@layer base {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  body {
    margin: 0;
    background: var(--panel);
    color: var(--ink);
    font-family: var(--font-body);
    font-size: var(--step-0);
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
  }

  h1,
  h2,
  h3,
  p,
  ul,
  ol,
  dl,
  dd,
  figure,
  pre {
    margin: 0;
  }

  ul,
  ol {
    padding: 0;
    list-style: none;
  }

  h1 {
    font-size: var(--step-3);
    font-weight: 750;
    letter-spacing: -0.025em;
    line-height: 1.15;
  }

  h2 {
    font-size: var(--step-1);
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.3;
  }

  h3 {
    font-size: var(--step-0);
    font-weight: 700;
  }

  a {
    color: inherit;
    text-decoration-color: var(--rule-strong);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
  }

  a:hover {
    text-decoration-color: var(--signal);
    text-decoration-thickness: 2px;
  }

  :focus-visible {
    outline: 2px solid var(--signal);
    outline-offset: 2px;
  }

  code,
  kbd,
  samp,
  pre {
    font-family: var(--font-data);
    font-size: 0.92em;
  }

  hr {
    border: 0;
    border-top: 1px solid var(--rule);
    margin: var(--space-5) 0;
  }

  /* A frame is a piece of the page, and takes its width like one. */
  turbo-frame {
    display: block;
  }

  /* The hidden attribute wins over any display a class gives. */
  [hidden] {
    display: none !important;
  }

  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }
}

@layer layout {
  .console {
    display: grid;
    grid-template-columns: var(--rail-width) minmax(0, 1fr);
    min-height: 100vh;
  }

  .rail {
    position: sticky;
    top: 0;
    align-self: start;
    display: flex;
    flex-direction: column;
    gap: var(--space-5);
    height: 100vh;
    padding: var(--space-5) var(--space-4) var(--space-4);
    overflow-y: auto;
    background: var(--rail);
    color: var(--rail-ink);
  }

  .rail :focus-visible {
    outline-color: var(--signal-bright);
  }

  /*
   * The wordmark: two words run together, the second in the accent, behind a
   * mark of two leaning strokes.
   */
  .brand {
    --brand-accent: var(--signal);
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    color: var(--ink);
    font-size: 1.1875rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
    text-decoration: none;
  }

  .rail .brand {
    --brand-accent: var(--signal-bright);
    padding: var(--space-1) var(--space-2) var(--space-2);
    color: #fff;
  }

  .brand__mark {
    flex: none;
    width: 1.75rem;
    height: 1.75rem;
  }

  .brand__accent {
    color: var(--brand-accent);
  }

  .rail__group {
    display: grid;
    gap: 2px;
  }

  .rail__group > .legend {
    padding: 0 var(--space-3) var(--space-2);
  }

  .rail__link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0.55rem var(--space-3);
    border-radius: var(--radius-control);
    font-weight: 500;
    text-decoration: none;
  }

  .rail__link .icon {
    flex: none;
    width: 1.2rem;
    height: 1.2rem;
  }

  .rail__link:hover {
    background: var(--rail-raise);
    color: #fff;
  }

  .rail__link[aria-current="page"] {
    background: var(--signal);
    color: #fff;
    font-weight: 650;
  }

  .rail__count {
    margin-left: auto;
    min-width: 1.5em;
    padding: 0 0.45em;
    border-radius: 999px;
    background: #fff;
    color: var(--lamp-waiting);
    font-size: var(--step--2);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: center;
  }

  .rail__foot {
    margin-top: auto;
    display: grid;
    gap: var(--space-3);
    padding-top: var(--space-4);
    border-top: 1px solid var(--rail-rule);
    font-size: var(--step--1);
  }

  .rail__user {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-width: 0;
    padding: 0 var(--space-1);
  }

  .rail__avatar {
    flex: none;
    display: grid;
    place-items: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    background: #c9d3ff;
    color: var(--rail);
    font-size: var(--step--1);
    font-weight: 750;
    letter-spacing: 0.02em;
  }

  .rail__email {
    min-width: 0;
    overflow-wrap: break-word;
    line-height: 1.35;
  }

  .desk {
    min-width: 0;
    padding: var(--space-5) clamp(var(--space-4), 2.5vw, var(--space-6)) var(--space-7);
  }

  .desk > * + * {
    margin-top: var(--space-5);
  }

  .desk--narrow {
    max-width: 54rem;
  }

  /* A page made to end at the foot of the window, such as a run's: less
     empty margin beneath it. */
  .desk--fitted {
    padding-bottom: var(--space-5);
  }

  /* Signed-out pages: the name, and one card under it, in the middle of the ground. */
  .gate {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: var(--space-5);
  }

  .gate__column {
    width: min(100%, 26rem);
    display: grid;
    gap: var(--space-5);
  }

  .gate__column > .brand {
    font-size: 1.5rem;
  }

  .gate__plate {
    display: grid;
    gap: var(--space-5);
    padding: var(--space-6) var(--space-5);
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: var(--radius);
    box-shadow: var(--shadow-raised);
  }

  .page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3) var(--space-4);
  }

  .page-head__icon {
    flex: none;
    align-self: start;
    display: grid;
    place-items: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 50%;
    background: var(--panel-deep);
  }

  .page-head__icon .icon {
    width: 1.35rem;
    height: 1.35rem;
  }

  .page-head__title {
    flex: 1 1 18rem;
    display: grid;
    gap: var(--space-1);
    min-width: 0;
  }

  .page-head__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
  }

  .split {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 19rem;
    gap: var(--space-5);
    align-items: start;
  }

  .split__aside {
    position: sticky;
    top: var(--space-5);
    display: grid;
    gap: var(--space-4);
  }

  .stack {
    display: grid;
    gap: var(--space-4);
  }

  .stack--loose {
    gap: var(--space-6);
  }

  .cluster {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2) var(--space-3);
  }

  @media (max-width: 60rem) {
    .console {
      grid-template-columns: minmax(0, 1fr);
    }

    .rail {
      position: static;
      flex-direction: row;
      flex-wrap: wrap;
      align-items: center;
      gap: var(--space-2) var(--space-4);
      height: auto;
      padding: var(--space-3) var(--space-4);
    }

    .rail .brand {
      padding: 0;
    }

    .rail__group {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: var(--space-1);
    }

    .rail__group .legend {
      display: none;
    }

    .rail__link {
      gap: var(--space-2);
      padding: 0.35rem var(--space-2);
    }

    .rail__link .icon {
      width: 1rem;
      height: 1rem;
    }

    .rail__foot {
      margin: 0 0 0 auto;
      display: flex;
      align-items: center;
      padding: 0;
      border: 0;
    }

    .rail__user {
      display: none;
    }

    .split {
      grid-template-columns: minmax(0, 1fr);
    }

    .split__aside {
      position: static;
      order: -1;
    }
  }
}
