/* styles/sections/persona-app.css
 * Brief app windows transcribed from the Personas frames: User Intelligence (xKEqx at 1440, the
 * 1500 window in the 1236 Window Crop aTIBL at 1920, lVBuw at 390) and the persona list in
 * The Call (tXLjF, UkJQ5). Spline Sans as the app draws it, --app-* product-shot colors.
 * The table (D and W) and the cards (M) are separate layouts, as the frames draw them, not a
 * reflow: User Intelligence switches at 900 (frame-variants.css); the persona list switches by
 * its own width (container ui-list, 640), so a narrow window between 900 and about 1200 shows
 * the cards. The Suggestion layout: intro 380 beside the window, which runs off the page's
 * right edge under the frame's fade (wFKH3: 130 wide, clear to white at 85%), and is cropped
 * inside the container at 1920 (aTIBL, fade KbYpq 160 wide). Where the row is narrower than
 * 1240 (container suggestion, a 1400 viewport) the window beside the intro would put the
 * Suggested badge and the Priority column under the fade, so the intro stacks above it and the
 * window starts at the container's left edge, scaled to 0.85 under a 900 row: title, the
 * Finance Analyst row, its badge and Priority stay clear of the fade from 900 up. */
@layer sections {
  /* ---------- Suggestion layout ---------- */
  .workflow-walkthrough--personas {
    overflow-x: clip;
  }

  .suggestion {
    display: flex;
    flex-direction: column;
    gap: var(--space-40);
  }

  .suggestion__intro {
    display: flex;
    flex-direction: column;
    gap: 28px;
    padding-top: var(--space-24);
  }

  .suggestion__heading {
    font-size: var(--t-h2-size);
    line-height: round(nearest, 1.05em, 1px);
    letter-spacing: var(--t-h2-ls);
  }

  .suggestion__body {
    margin: 0;
    font-size: 17px;
    line-height: 26px;
    color: var(--ink-2);
  }

  .suggestion__note {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 20px;
    color: var(--ink-55);
  }

  /* The fade sits at the viewport's right edge, 40 above and below the window: no top, so it
     keeps its static place under the window and the margin lifts it */
  .walkthrough-section--suggestion {
    --win-zoom: 1;
    container: suggestion / inline-size;
  }

  .suggestion__fade {
    position: absolute;
    right: calc((100% - 100vw) / 2);
    width: 130px;
    height: calc(570px * var(--win-zoom) + 80px);
    margin-top: calc(-570px * var(--win-zoom) - 40px);
    background: linear-gradient(90deg, transparent 0%, var(--white) 85%);
    pointer-events: none;
  }

  /* ---------- Window and type ---------- */
  .ui-window {
    font-family: var(--font-body);
    line-height: 1.2;
    color: var(--app-ink);
  }

  .ui-window p,
  .ui-window dl,
  .ui-window dd {
    margin: 0;
  }

  .shot-icon {
    flex: none;
  }

  .ui-window--app {
    display: flex;
    width: 1240px;
    height: 570px;
  }

  .ui-sidebar {
    display: flex;
    flex: none;
    flex-direction: column;
    gap: var(--space-4);
    width: 232px;
    padding: var(--space-24) var(--space-14);
    box-shadow: inset -1px 0 0 var(--app-sidebar-edge);
    background: var(--app-sidebar);
  }

  /* The frame's 10 spacer plus the gap after it */
  .ui-sidebar .ui-sidebar__home {
    margin-bottom: var(--space-14);
    font-size: 16px;
    font-weight: 600;
    color: var(--app-ink-strong);
  }

  .ui-sidebar ul {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .ui-nav {
    display: flex;
    align-items: center;
    height: 33px;
    gap: 9px;
    padding: var(--space-8) var(--space-10);
    border-radius: 6px;
    font-size: 14px;
    white-space: nowrap;
    color: var(--app-ink-2);
  }

  .ui-nav--current {
    border-radius: 0;
    background: var(--white);
    box-shadow: inset 4px 0 0 var(--app-brand);
    font-weight: 700;
    color: var(--app-ink-strong);
  }

  .ui-main {
    display: flex;
    flex: 1;
    flex-direction: column;
    gap: var(--space-16);
    min-width: 0;
    padding: 18px var(--space-16) var(--space-20);
  }

  .ui-title {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
  }

  /* Qualified: .workflow-walkthrough p { text-wrap: wrap } would rewrap it */
  .ui-window .ui-h1 {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 900;
    line-height: normal;
    letter-spacing: -0.8px;
    white-space: nowrap;
  }

  .ui-count {
    font-size: 14px;
    color: var(--app-ink-2);
  }

  .ui-tabs {
    display: flex;
    justify-content: space-between;
    padding: var(--space-4);
    border-radius: var(--radius-pill);
    background: var(--app-tabs);
  }

  .ui-tab {
    padding: var(--space-6) var(--space-12);
    line-height: 14px;
    border-radius: var(--radius-pill);
    font-size: 12px;
    letter-spacing: 0.36px;
    white-space: nowrap;
    color: var(--app-ink-2);
  }

  .ui-tab--current {
    background: var(--white);
    box-shadow: var(--app-tab-shadow);
    font-weight: 700;
    color: var(--app-ink);
  }

  .ui-toolbar {
    display: flex;
    align-items: center;
    gap: var(--space-8);
  }

  .ui-new {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: 7px;
    padding: var(--space-8) var(--space-12);
    border-radius: 6px;
    background: var(--app-brand);
    line-height: 16px;
    font-size: 13px;
    letter-spacing: 0.3px;
    white-space: nowrap;
    color: var(--white);
  }

  .ui-search {
    display: flex;
    flex: 1;
    align-items: center;
    gap: var(--space-8);
    min-width: 0;
    padding: var(--space-8) var(--space-12);
    border-radius: 6px;
    outline: 1px solid var(--app-field-edge);
    outline-offset: -1px;
    font-size: 13px;
    white-space: nowrap;
    color: var(--shot-text-2);
  }

  .ui-appbar {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    height: 40px;
    padding-inline: var(--space-14);
    box-shadow: inset 0 -1px 0 var(--app-bar-edge);
    background: var(--app-bar);
    font-size: 13px;
    font-weight: 600;
    color: var(--app-ink-strong);
  }

  /* ---------- Table (D, W) ----------
     An ARIA table laid out as a CSS table: fixed layout, the Persona column takes what the
     fixed columns leave (120, 110, 120, 90, 110). Rows sit on the frames' whole-pixel pitch,
     61 and the header 33; rules are inset shadows on the cells, inside the box as Pencil draws
     them. */
  .ui-table {
    display: table;
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 13px;
    white-space: nowrap;
  }

  .ui-thead { display: table-header-group; }
  .ui-tbody { display: table-row-group; }

  .ui-row {
    display: table-row;
    height: 61px;
  }

  .ui-row--head {
    height: 33px;
  }

  .ui-cell {
    display: table-cell;
    width: 120px;
    padding: 0 var(--space-16);
    box-shadow: inset 0 -1px 0 var(--app-row-rule);
    font-weight: 400;
    text-align: left;
    vertical-align: middle;
  }

  .ui-row--head .ui-cell {
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.39px;
  }

  .ui-row--head .ui-cell:nth-child(3),
  .ui-row--head .ui-cell:nth-child(6) { width: 110px; }
  .ui-row--head .ui-cell:nth-child(5) { width: 90px; }

  .ui-table .ui-cell--persona {
    width: auto;
    padding-left: var(--space-24);
  }

  .ui-name,
  .ui-desc {
    display: block;
    overflow: hidden;
    text-overflow: clip;
  }

  .ui-name {
    font-size: 15px;
  }

  .ui-desc {
    margin-top: 3px;
    font-size: 13px;
    color: var(--app-ink-2);
  }

  .ui-row--suggested .ui-cell {
    background: var(--app-row-suggested);
    box-shadow: inset 0 -1px 0 var(--app-brand);
  }

  .ui-row--suggested .ui-cell--persona {
    box-shadow: inset 3px 0 0 var(--app-brand), inset 0 -1px 0 var(--app-brand);
  }

  .ui-row--suggested .ui-name,
  .ui-card--suggested .ui-name {
    font-weight: 600;
    color: var(--app-brand);
  }

  .ui-row--accepted .ui-cell,
  .ui-card--accepted {
    background: var(--app-row-accepted);
  }

  .ui-pill {
    display: inline-block;
    flex: none;
    padding: 2px var(--space-8);
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
  }

  .ui-pill--high {
    background: var(--app-high-bg);
    color: var(--app-high);
  }

  .ui-pill--suggested {
    background: var(--app-brand);
    color: var(--white);
  }

  .ui-pill--medium {
    background: var(--app-medium-bg);
    color: var(--white);
  }

  .ui-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-4);
    padding: 2px 6px;
    border-radius: 5px;
    outline: 1px solid var(--app-field-edge);
    outline-offset: -1px;
    font-size: 12px;
    white-space: nowrap;
    color: var(--app-ink-2);
  }

  /* ---------- Cards (M) ---------- */
  .ui-cards {
    display: flex;
    flex-direction: column;
  }

  .ui-cards__list {
    margin: 0;
    padding: 0;
    list-style: none;
  }

  .ui-cards__head {
    display: flex;
    height: 30px;
    justify-content: space-between;
    padding: var(--space-8) var(--space-12);
    box-shadow: inset 0 -1px 0 var(--app-row-rule);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.3px;
  }

  .ui-card {
    display: flex;
    flex-direction: column;
    gap: var(--space-8);
    padding: var(--space-12) var(--space-12) var(--space-14);
    box-shadow: inset 0 -1px 0 var(--app-row-rule);
  }

  .ui-card--suggested {
    padding-left: 9px;
    border-left: 3px solid var(--app-brand);
    background: var(--app-row-suggested);
    box-shadow: inset 0 -1px 0 var(--app-brand);
  }

  .ui-card__top {
    display: flex;
    height: 18px;
    gap: var(--space-10);
  }

  .ui-card__top .ui-name {
    flex: 1;
  }

  .ui-card .ui-desc {
    line-height: 18px;
  }

  /* One stat grid for every card in a list: equal columns, as many as the list has stats */
  .ui-card__meta {
    display: grid;
    grid-auto-columns: minmax(0, 1fr);
    grid-auto-flow: column;
    gap: 6px var(--space-8);
    padding-top: 6px;
  }

  .ui-card__meta > div {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 3px;
  }

  .ui-card__meta dt {
    white-space: nowrap;
    font-size: 11px;
    line-height: 13px;
    letter-spacing: 0.2px;
    color: var(--shot-text-2);
  }

  .ui-card__meta dd {
    display: flex;
    font-size: 13px;
    line-height: 16px;
  }

  .ui-card .ui-chip {
    gap: 2px;
    padding: 1px var(--space-4);
    font-size: 11px;
    line-height: 1.2;
  }

  .ui-search__hint {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Under the M frame's 342 window (320 viewports) the app tightens as it would: tab padding
     4 (ellipsis as a last resort), every card's four stats on a two by two grid, the search
     hint ellipsized */
  .ui-window--m {
    container: ui-m / inline-size;
  }

  @container ui-m (width < 340px) {
    .ui-tab {
      min-width: 0;
      overflow: hidden;
      padding-inline: var(--space-4);
      text-overflow: ellipsis;
    }

    .ui-card__meta {
      grid-template-columns: repeat(2, minmax(0, 1fr));
      grid-auto-flow: row;
    }
  }

  /* ---------- The Call's persona list ---------- */
  .ui-window--call {
    container: ui-list / inline-size;
  }

  .ui-window--call .ui-main {
    gap: 0;
    padding: var(--space-12) var(--space-16) var(--space-20);
  }

  @container ui-list (width >= 640px) {
    .ui-window--call .ui-main {
      padding-inline: 28px;
    }

    .ui-window--call .ui-cards {
      display: none;
    }
  }

  @container ui-list (width < 640px) {
    .ui-window--call .ui-table {
      display: none;
    }
  }

  @media (min-width: 900px) {
    .suggestion {
      position: relative;
      gap: var(--space-64);
    }

    .suggestion__intro {
      max-width: 680px;
    }

    .suggestion__heading {
      font-size: var(--t-h1-size);
      letter-spacing: var(--t-h1-ls);
    }

    .suggestion__body {
      font-size: 19px;
      line-height: 29px;
    }

    .suggestion__shot {
      flex: none;
    }

    .ui-main {
      gap: 22px;
      padding: var(--space-32) var(--space-40) 44px;
    }

    .ui-window .ui-h1 {
      font-size: 31px;
      letter-spacing: -1.2px;
    }

    .ui-tab {
      flex: 1;
      padding: 7px var(--space-12);
      line-height: 16px;
      font-size: 13px;
      text-align: center;
    }

    .ui-toolbar {
      justify-content: space-between;
    }

    .ui-new {
      padding: 9px var(--space-16);
      font-size: 12px;
      line-height: 14px;
    }

    .ui-search {
      flex: none;
      width: 220px;
    }
  }

  @container suggestion (width >= 1240px) {
    .suggestion {
      flex-direction: row;
      align-items: flex-start;
    }

    .suggestion__intro {
      flex: none;
      width: 380px;
    }
  }

  @container suggestion (740px <= width < 900px) {
    .suggestion {
      --win-zoom: 0.85;
    }

    .ui-window--app {
      zoom: 0.85;
    }
  }

  @media (min-width: 1680px) {
    .suggestion__shot {
      position: relative;
      flex: 1;
      min-width: 0;
      height: 610px;
      overflow: clip;
    }

    /* The 570 window sits 20 into the 610 crop, clear of its shadow at the top and bottom */
    .ui-window--app {
      width: 1500px;
      margin-top: var(--space-20);
    }

    .suggestion__fade {
      top: 0;
      right: 0;
      width: 160px;
      height: 100%;
      margin-top: 0;
    }
  }

  /* Rules are inset shadows, drawn inside the box as Pencil draws strokes; forced colors
     drops shadows, so they come back as borders there */
  @media (forced-colors: active) {
    .ui-cell,
    .ui-cards__head,
    .ui-card,
    .ui-appbar {
      border-bottom: 1px solid CanvasText;
    }

    .ui-sidebar {
      border-right: 1px solid CanvasText;
    }
  }
}
