/* /home (HomeController): the greeting, then the page's sections (PageSectionComponent, 42-page-section.css) in two columns where there is room, each holding entry cards (EntryComponent,
   43-entry-list.css): HomeSectionComponent's lists, "Needs you" (one card for each office) and the briefing's suggestions. A card is the title as a link, its state as a badge and when it is due or
   starts at the end of the line, then whom it is about and the office on one quiet line. Overdue is said in words and set heavier, and the card has the bar of a card that needs a person; its
   color is the bad tone's foreground, which is never the only sign. So what is here is only what those do not draw: the two columns, "Show more", an office's group under "Your offices' queues", and
   the word that says a card is overdue.

   Tokens only and logical properties only, both enforced (test/styles/tokens_test.rb, test/styles/components_test.rb), so it reads on the light shell
   and the console, in light and in dark, and mirrors in a right-to-left language. Nothing pinned to an edge, no height in vh, and everything that holds
   words may shrink and wrap, so a language 40% longer never widens the page (WCAG 1.4.10). */

/* The page's two columns. Each is a flow (`.page-flow`, 41-page-structure.css), so a section is `--section-gap` from the next in both; the columns start at the same line. */
.home-page {
  display: grid;
  gap: var(--section-gap);
  align-items: start;
  min-inline-size: 0;
}

/* What a phone app said about turning on Face ID or a fingerprint (a callout under the greeting): one section's distance from the page it sits above, as the sections are from each other. */
.home-page-note {
  margin-block-end: var(--section-gap);
}

/* Where there is room, what needs the person beside the rest. The page's own width decides (a container query), not the window's: the rail takes part of it. A page with nothing beside it (a
   person with nothing waiting, who is told so once) is one column the page's width, not three fifths of it. */
.console-main:has(.home-page),
.console-main:has(.home-board),
.light-main:has(.home-board),
.preview-main:has(.home-board) {
  container-type: inline-size;
}

@container (min-inline-size: 960px) {
  .home-page:has(.home-page__rest) {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  }
}

/* The console home's board (show.html.erb): the glance strip, then two columns where the page has room: "Needs you" (the briefing when it has something, the office notices and the
   list) and the person's cases in the main one, about two thirds; the offices, the week and where to report at the side. One column on a phone, in that order. The page's own width decides (a
   container query), not the window's: the rail takes part of it. */
.home-board {
  display: grid;
  gap: var(--space-5);
  min-inline-size: 0;
}

/* One column first, in the order a phone reads it and the keyboard goes: "Needs you", the offices, the week, where to report, then the person's cases. Where there is room the side
   column runs beside both "Needs you" and the cases. */
.home-board__columns,
.home-board__main,
.home-board__side {
  display: grid;
  gap: var(--space-5);
  align-content: start;
  min-inline-size: 0;
}

@container (min-inline-size: 760px) {
  .home-board__columns {
    grid-template-columns: minmax(0, 2fr) minmax(17rem, 1fr);
    grid-template-rows: auto 1fr;
    column-gap: var(--space-6);
  }

  .home-board__main {
    grid-area: 1 / 1;
  }

  .home-board__side {
    grid-area: 1 / 2 / span 2;
  }

  .home-board__more {
    grid-area: 2 / 1;
    min-inline-size: 0;
  }
}

/* The side column's headings are a step quieter than "Needs you". */
.home-side__title,
.home-board__side .page-section__title {
  margin: 0;
  color: var(--fg1);
  font-family: var(--font-display);
  font-size: var(--text-md);
  font-weight: 600;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

/* The office notices open "Needs you", inside its card. */
.home-attention > .home-notices {
  padding: 0 var(--space-4) var(--space-3);
}

/* "Show more" under a long list: a native disclosure, its summary a target at least 24 CSS px tall. */
.home-section__more {
  display: grid;
  gap: var(--space-2);
  min-inline-size: 0;
}

.home-section__more > summary {
  min-block-size: 24px;
  padding-block: var(--space-1);
  color: var(--accent-text);
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}

@media (pointer: coarse) {
  .home-section__more > summary {
    min-block-size: var(--target-min);
  }
}

/* "Your offices' queues" is a group for each office: its name over its cards. */
.home-section__group {
  display: grid;
  gap: var(--space-2);
  min-inline-size: 0;
}

.home-section__group-title {
  margin: 0;
  overflow-wrap: anywhere;
}

.home-item__more {
  margin: 0;
  color: var(--fg2);
  font-size: var(--text-sm);
}

.home-item[data-overdue="true"] .home-item__when {
  color: var(--bad);
  font-weight: 700;
}

/* The rail's links that belong to no area (Home, config/navigation.yml): above the first area, set off from it. */
.rail-pinned {
  display: grid;
  margin-block-end: var(--density-gap);
  padding-block-end: var(--density-gap);
  border-block-end: 1px solid var(--rule);
}

/* The student week fills the available measure. Narrow screens read the same days as an agenda. */
.student-home {
  display: grid;
  gap: clamp(var(--space-5), 2.4vw, var(--space-6));
  min-inline-size: 0;
  padding-block-start: var(--space-5);
  container-type: inline-size;
}

.student-home__welcome {
  display: grid;
  min-inline-size: 0;
  border-radius: var(--radius-lg);
  background: var(--accent-soft);
  color: var(--fg1);
}

.student-home__intro {
  display: grid;
  align-content: center;
  justify-items: start;
  gap: var(--space-3);
  min-inline-size: 0;
  padding: clamp(var(--space-5), 3vw, var(--space-6));
  overflow-wrap: anywhere;
}

.student-home__date,
.student-home__caption,
.student-home__action-source,
.home-week__range {
  margin: 0;
  color: var(--accent-text);
  font-size: var(--text-sm);
  font-weight: 700;
}

.student-home__intro h1 {
  max-inline-size: 21ch;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(var(--text-2xl), 3.8vw, var(--text-4xl));
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.06;
  text-wrap: balance;
}

.student-home__scene {
  display: block;
  inline-size: 100%;
  block-size: clamp(5.5rem, 24vw, 10rem);
  object-fit: cover;
  object-position: center 56%;
  border-end-start-radius: inherit;
  border-end-end-radius: inherit;
}

.student-home__next {
  display: grid;
  justify-items: start;
  gap: var(--space-1);
}

.student-home__lead-link {
  display: inline-flex;
  align-items: center;
  min-block-size: var(--target-min);
  color: var(--accent-text);
  font-size: var(--text-md);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.student-home__clear,
.student-home__next time {
  margin: 0;
  color: var(--fg2);
  line-height: 1.5;
}

.student-home__clear {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.student-home__clear svg {
  flex: none;
  color: var(--tone-good-fg);
}

.student-home__heading,
.student-home .home-side__title,
.home-destinations__head h2 {
  margin: 0;
  color: var(--fg1);
  font-family: var(--font-display);
  font-size: clamp(var(--text-xl), 2.3vw, var(--text-2xl));
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.student-home__actions,
.home-destinations,
.student-home .home-week {
  display: grid;
  gap: var(--space-4);
  min-inline-size: 0;
}

.student-home__action-list,
.home-destinations__list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.student-home__action-list > li,
.home-destinations__list > li {
  min-inline-size: 0;
}

.student-home__action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-content: start;
  gap: var(--space-2) var(--space-3);
  block-size: 100%;
  min-block-size: var(--target-min);
  padding: var(--space-4) var(--space-5);
  border: 1px solid var(--rule);
  border-block-start: 3px solid var(--accent-line);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  color: var(--fg1);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.student-home__action-source {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  grid-column: 1;
}

.student-home__action strong {
  grid-column: 1;
  font-size: var(--text-md);
  line-height: 1.4;
}

.student-home__action-detail,
.home-destination__detail,
.home-week__quiet,
.home-week__quiet-week {
  grid-column: 1;
  color: var(--fg2);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.student-home__arrow {
  align-self: center;
  grid-column: 2;
  grid-row: 1 / span 2;
  color: var(--accent-text);
}

.student-home__arrow:dir(rtl),
.home-destination__arrow:dir(rtl) {
  transform: scaleX(-1);
}

.student-home .home-week__head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2) var(--space-4);
}

.student-home .home-week__days {
  border: 1px solid var(--rule-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
}

.student-home .home-week__day {
  grid-template-columns: minmax(3.75rem, max-content) minmax(0, 1fr);
  align-items: baseline;
  padding: var(--space-3);
}

.student-home .home-week__day:first-child {
  border-start-start-radius: var(--radius-lg);
  border-start-end-radius: var(--radius-lg);
}

.student-home .home-week__day:last-child {
  border-block-end: 0;
}

.student-home .home-week__when {
  align-items: center;
  gap: var(--space-2);
}

.student-home .home-week__date {
  font-size: var(--text-xl);
}

.student-home .home-week__body {
  gap: var(--space-2);
}

.student-home .home-week__event {
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-1);
  min-block-size: var(--target-min);
  padding: var(--space-2);
  border-inline-start: 2px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--accent-soft);
}

.student-home .home-week__meta {
  grid-column: 1;
  color: var(--fg2);
  font-size: var(--text-sm);
}

.home-week__quiet-week {
  margin: 0;
}

.student-home__destinations {
  display: grid;
  align-items: start;
  gap: var(--space-6);
  min-inline-size: 0;
}

.student-home__destinations:empty {
  display: none;
}

.student-home .home-report {
  padding: var(--space-4);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--surface-sunken);
}

.home-destinations__list {
  gap: 0 var(--space-5);
}

.home-destination {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-inline-size: 0;
  min-block-size: var(--target-min);
  block-size: 100%;
  padding-block: var(--space-3);
  border-block-start: 1px solid var(--rule-strong);
  color: var(--fg1);
  text-decoration: none;
}

.home-destination__icon {
  display: inline-grid;
  flex: none;
  place-items: center;
  inline-size: 2.5rem;
  block-size: 2.5rem;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: var(--accent-text);
}

.home-destination__body {
  display: grid;
  flex: 1;
  gap: var(--space-1);
  min-inline-size: 0;
  overflow-wrap: anywhere;
}

.home-destination__title {
  font-weight: 700;
}

.home-destination__arrow {
  display: inline-flex;
  color: var(--accent-text);
}

.home-destination:hover .home-destination__title,
.student-home__action:hover strong {
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.home-destination:focus-visible,
.student-home__action:focus-visible,
.student-home__lead-link:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 3px;
}

.student-home .entry__title a {
  display: inline-flex;
  align-items: center;
  min-block-size: var(--target-min);
}

@container (min-width: 38rem) {
  .student-home__next {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0 var(--space-3);
  }

  .student-home__caption {
    flex-basis: 100%;
  }

  .student-home__welcome:has(.student-home__scene) {
    grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  }

  .student-home__scene {
    min-block-size: 0;
    block-size: 100%;
    max-block-size: none;
    contain: size;
    border-end-start-radius: 0;
    border-start-end-radius: inherit;
  }
}

@container (min-width: 60rem) {
  .student-home .home-week__days {
    grid-template-columns: repeat(7, minmax(0, 1fr));
  }

  .student-home .home-week__day {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-3);
    padding: var(--space-3);
    border-inline-start: 0;
    border-block-end: 0;
    border-block-start: 3px solid transparent;
  }

  .student-home .home-week__day + .home-week__day {
    border-inline-start: 1px solid var(--rule);
  }

  .student-home .home-week__day[data-today="true"] {
    border-block-start-color: var(--accent);
    border-start-end-radius: 0;
    border-end-start-radius: var(--radius-lg);
  }

  .student-home .home-week__when {
    flex-direction: column;
    align-items: start;
  }

  .student-home .home-week__date {
    font-size: var(--text-2xl);
  }

  .student-home__destinations:has(.home-destinations):has(.home-report) {
    grid-template-columns: minmax(0, 2fr) minmax(16rem, 1fr);
  }
}

.student-home__event-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 19rem), 1fr));
  gap: var(--space-3) var(--space-5);
  margin: 0;
  padding: 0;
  list-style: none;
}

.student-home__discovery {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  block-size: 100%;
  min-block-size: var(--target-min);
  padding-block: var(--space-2);
  color: var(--fg1);
  text-decoration: none;
  overflow-wrap: anywhere;
}

.student-home__event-date {
  display: grid;
  align-content: center;
  justify-items: center;
  min-inline-size: 3.5rem;
  padding: var(--space-2);
  border-radius: var(--radius-md);
  background: var(--tone-info-bg);
  color: var(--tone-info-fg);
  font-size: var(--text-sm);
  font-weight: 700;
}

.student-home__event-date strong {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 500;
  line-height: 1.05;
}

.student-home__event-copy {
  display: grid;
  gap: var(--space-1);
}

.student-home__event-copy bdi {
  font-size: var(--text-md);
  font-weight: 700;
}

.student-home__event-copy span {
  color: var(--fg2);
  font-size: var(--text-sm);
}

.student-home__discovery:hover bdi {
  color: var(--accent-text);
  text-decoration: underline;
  text-underline-offset: 0.18em;
}
