/* Shell: the window grid, top bar, page head, rail frame and footer.
 *
 * The shell fills the window; a page scrolls in .main under the bar. Below
 * 860px it gives way to normal page scroll with the bar pinned on top.
 */

html:has(body > .app), body:has(> .app) { height: 100%; }
body:has(> .app) { overflow: hidden; }

/* One shrinkable column: an implicit `auto` column would grow to a wide
 * table's min-content width and push the whole shell past the viewport. */
.app {
  display: grid; grid-template-rows: var(--top-h) minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);
  height: 100vh; height: 100dvh; width: 100%;
  overflow: hidden; overflow: clip; /* nothing inside may enlarge the document */
  background: var(--paper); color: var(--ink);
  font: var(--fs-md)/var(--lh) var(--sans);
}

/* ============================================================== top bar ===
 * Logo, NFL | CFB, the tabs as plain text, search, team, account. The bar's
 * content lines up with the page's capped column, except over a board, which
 * runs the full width. */

.top {
  position: relative; z-index: 20;
  display: flex; align-items: center; gap: var(--sp-5); min-width: 0; min-height: var(--top-h);
  padding: 0 max(var(--gutter), calc((100% - var(--wrap)) / 2 + var(--gutter)));
  background: var(--bar); color: var(--bar-ink);
}
.app:has(.main.is-board) .top { padding: 0 var(--gutter); }
.top .brand { display: flex; flex: none; align-items: center; border-radius: var(--r-sm); }
.top .brand img { height: 20px; width: auto; }
.top .brand .shield-fb { font-weight: 700; font-style: italic; color: var(--bar-ink); }

.modeswitch { display: inline-flex; flex: none; padding: 2px; border-radius: var(--r); background: var(--bar-fill); }
.modeswitch a {
  display: inline-flex; align-items: center; height: 26px; padding: 0 var(--sp-3);
  border-radius: var(--r-sm); color: var(--bar-sub); font-size: var(--fs-xs); font-weight: 600;
}
.modeswitch a:hover { color: var(--bar-ink); }
.modeswitch a[aria-current="page"] { background: var(--bar-ink); color: var(--ink); }
/* A short bar control keeps its drawn size and gains a 44px touch target. */
.modeswitch a, .top .top-tools > .btn { position: relative; }
.modeswitch a::before { content: ""; position: absolute; inset: -9px 0; }
.top .top-tools > .btn::before { content: ""; position: absolute; inset: -15px 0; }

/* the tabs keep their width; search gives way first */
.tabs {
  display: flex; flex: none; align-items: stretch; gap: var(--sp-6);
  height: var(--top-h); min-width: 0; overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
.tabs a { position: relative; display: flex; flex: none; align-items: center; color: var(--bar-sub); font-size: var(--fs-sm); }
.tabs a:hover { color: var(--bar-ink); }
.tabs a.on, .tabs a[aria-current="page"] { color: var(--bar-ink); font-weight: 600; }
/* the one use of red beside the logo: the marker under the current tab */
.tabs a.on::after, .tabs a[aria-current="page"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--red);
}
/* The row scrolls sideways and overflow-x: auto clips the y axis too, so an
   outset ring is cut off; draw it inside the link (same for .sub-tabs). */
.tabs a:focus-visible { outline-offset: -3px; }

/* Search, team and account: plain bar items. The first of them takes the
 * slack, so the group sits at the right whatever it starts with. */
.top-tools { display: contents; }
.top-tools > :first-child { margin-left: auto; }
/* "Sign in" is a plain bar link, whatever button classes it carries */
.top .top-tools > .btn {
  flex: none; min-height: 0; padding: 0; white-space: nowrap;
  background: transparent; color: var(--bar-ink); font-size: var(--fs-sm); font-weight: 400;
}
.top .top-tools > .btn:hover { background: transparent; text-decoration: underline; text-underline-offset: 3px; }

.srch {
  display: flex; align-items: center; gap: var(--sp-2);
  flex: 0 1 280px; min-width: 120px; height: 32px; padding: 0 10px;
  background: var(--bar-fill); color: var(--bar-sub);
  border: 1px solid transparent; border-radius: var(--r); font-size: var(--fs-xs);
  transition: border-color 160ms var(--ease), box-shadow 160ms var(--ease);
}
.srch svg { flex: none; }
.srch input {
  flex: 1; width: 100%; min-width: 0; height: 100%; padding: 0;
  background: transparent; border: 0; color: var(--bar-ink); font-size: var(--fs-xs);
}
.srch-field { position: relative; flex: 1; min-width: 0; height: 100%; display: flex; align-items: center; }
.srch-hint {
  position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  color: var(--bar-sub); pointer-events: none;
}
.srch:focus-within .srch-hint, .srch:has(input:valid) .srch-hint { visibility: hidden; }
.srch input:focus { outline: none; }
.srch:focus-within { border-color: var(--focus); box-shadow: 0 0 0 3px var(--focus); }
/* the key hint: its border is quiet, its text keeps the bar's 4.5:1 */
.kbd { flex: none; margin-left: auto; padding: 0 6px; border: 1px solid color-mix(in srgb, currentColor 60%, transparent); border-radius: var(--r-sm); font-size: var(--fs-2xs); line-height: 16px; }
/* phones: search is a link to the search page */
.srch-go { display: none; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px; margin-left: auto; color: var(--bar-ink); }
/* The search link and the menu button nearly fill a phone's bar, so an outset
   ring would run off its top edge; draw it inside. */
.srch-go:focus-visible, .tabmenu > summary:focus-visible { outline-offset: -4px; }

.home {
  display: flex; flex: none; align-items: center; gap: var(--sp-2); white-space: nowrap;
  font-size: var(--fs-sm); color: var(--bar-ink); border-radius: var(--r);
}
.home img, .home .tm-fb { flex: none; width: 22px; height: 22px; }
.home small { display: block; color: var(--bar-sub); font-size: var(--fs-2xs); line-height: 1.1; }

.me {
  display: flex; align-items: center; justify-content: center; flex: none;
  width: 32px; height: 32px; border-radius: 50%; border: 0;
  background: var(--bar-fill); color: var(--bar-ink); font-weight: 600; font-size: var(--fs-xs);
}
summary.me { list-style: none; cursor: pointer; }
summary.me::-webkit-details-marker, .tabmenu summary::-webkit-details-marker { display: none; }

/* User menu: a native disclosure anchored under the avatar. */
.usermenu { position: relative; flex: none; }
.usermenu[open] > summary.me { background: var(--bar-ink); color: var(--ink); }
.usermenu-panel {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 40;
  min-width: 220px; padding: var(--sp-3) 0 var(--sp-2);
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: var(--r-md); box-shadow: var(--shadow-menu);
}
.usermenu-panel .who-name { padding: 0 var(--sp-4); font-weight: 600; }
.usermenu-panel .who-role { padding: 0 var(--sp-4) var(--sp-2); color: var(--sub); font-size: var(--fs-xs); line-height: 1.3; }
.usermenu-links { display: flex; flex-direction: column; border-top: 1px solid var(--line-2); padding: var(--sp-1) 0; }
.usermenu-links a { padding: 10px var(--sp-4); }
.usermenu-links a:hover { background: var(--fill); }
.usermenu-panel form { padding: var(--sp-2) var(--sp-4) 0; border-top: 1px solid var(--line-2); }

/* Demo team picker: the home chip as a disclosure listing the 32 clubs. */
/* The padding is the hover fill's room; the margin takes it back, so the
 * words sit on the bar's own spacing and search keeps the width its hint needs. */
.teampick > summary.home { list-style: none; cursor: pointer; padding: 6px var(--sp-2); margin: 0 calc(-1 * var(--sp-2)); }
.teampick > summary.home::-webkit-details-marker { display: none; }
.teampick > summary.home:hover, .teampick[open] > summary.home { background: var(--bar-fill); }
.pick-cta-short { display: none; }
.pick-caret { font-size: var(--fs-2xs); color: var(--bar-sub); }
.teampick-panel {
  display: flex; flex-direction: column; padding: var(--sp-1) 0;
  min-width: 260px; max-height: 70vh; overflow-y: auto;
}
.teampick-panel a { padding: 10px var(--sp-4); white-space: nowrap; }
.teampick-panel a:hover { background: var(--fill); }
.teampick-panel a[aria-current] { font-weight: 600; }

.bell { position: relative; display: inline-flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 32px; color: var(--bar-ink); border-radius: 50%; }
.bell:hover { background: var(--bar-fill); }
.bell-n { position: absolute; top: -2px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--r); background: var(--bar-ink); color: var(--ink); font: 600 var(--fs-2xs)/16px var(--sans); text-align: center; }

/* Narrow screens: the tabs, the team and the account fold into this
 * disclosure, drawn as a black sheet under the bar. */
.tabmenu { display: none; flex: none; }
.tabmenu > summary { display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; list-style: none; cursor: pointer; color: var(--bar-ink); }
.tabmenu-label {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.tabmenu-panel {
  position: absolute; left: 0; right: 0; top: 100%; z-index: 40;
  display: flex; flex-direction: column; max-height: calc(100dvh - var(--top-h)); overflow-y: auto;
  padding: var(--sp-1) var(--gutter) var(--sp-5); background: var(--bar);
}
.tabmenu-more { display: flex; flex-direction: column; }
.tabmenu-more form { margin: 0; }
.tabmenu-panel a, .tabmenu-more button {
  display: flex; align-items: center; width: 100%; min-height: 48px; padding: 0;
  background: transparent; border: 0; border-bottom: 1px solid var(--bar-line);
  color: var(--bar-ink); font: 400 var(--fs-lg)/1.2 var(--sans); text-align: left;
}
.tabmenu-panel a[aria-current="page"] { padding-left: var(--sp-3); font-weight: 600; box-shadow: inset 3px 0 0 var(--red); }
/* a line that names the viewer or the home team: text, not a link */
.tabmenu-who { display: flex; align-items: center; min-height: 44px; border-bottom: 1px solid var(--bar-line); color: var(--bar-sub); font-size: var(--fs-sm); }
/* the team picker inside the menu: a second disclosure listing the clubs */
.tabmenu-teams > summary {
  display: flex; align-items: center; justify-content: space-between; min-height: 48px;
  border-bottom: 1px solid var(--bar-line); color: var(--bar-ink); font-size: var(--fs-lg);
  list-style: none; cursor: pointer;
}
.tabmenu-teams > summary::-webkit-details-marker { display: none; }
.tabmenu-teams > summary::after { content: ""; width: 7px; height: 7px; margin-right: var(--sp-1); border-right: 1.5px solid; border-bottom: 1.5px solid; transform: rotate(45deg); opacity: .7; }
.tabmenu-teams[open] > summary::after { transform: rotate(-135deg); }
.tabmenu-teams a { min-height: 44px; padding-left: var(--sp-4); font-size: var(--fs-md); color: var(--bar-sub); }
.tabmenu-teams a[aria-current="true"] { color: var(--bar-ink); font-weight: 600; }

/* Laptops: tighten the bar before any tab can be clipped; the team chip keeps
 * its logo and gives up the club name (kept for screen readers). */
@media (max-width: 1359.98px) {
  .top { gap: var(--sp-4); }
  .tabs { gap: var(--sp-4); }
  .home > div {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  .pick-cta-long { display: none; }
  .pick-cta-short { display: inline; }
}
/* Below that the bar is one row: logo, switch, search link, menu. Where the
 * bar has no menu (the front door), the account stays in the bar. */
@media (max-width: 1139.98px) {
  .top { gap: var(--sp-3); padding-right: var(--sp-2); }
  .tabs { display: none; }
  .tabmenu { display: block; }
  .srch-go { display: inline-flex; }
  .top:has(.tabmenu) .top-tools { display: none; }
  .top:not(:has(.tabmenu)) { padding-right: var(--gutter); }
}

/* ============================================================= body row ===
 * Grows to the remaining height. Board pages fit it exactly and scroll
 * inside .scroll; plain pages scroll here. Every inner scroller is
 * positioned, so it is the containing block for its absolute descendants
 * (.sr-only captions, .ci marks): they cannot escape it and grow the
 * document behind the overflow-hidden body. */
.main { position: relative; min-width: 0; min-height: 0; overflow: auto; display: flex; flex-direction: column; scroll-padding-block: var(--sp-3); }
.main:focus { outline: none; }
.main.is-board { overflow: hidden; }

/* A plain page's blocks share one capped column; a board runs full width.
 * The cap is a width, not padding, so a rule under a block ends with it. */
.main > .ph, .main > .data-stamp, .main > .provisional-note, .main > .feedback-sent,
.main > .page, .main > .credits, .main > .fnd-say {
  flex: none; width: calc(100% - 2 * var(--gutter)); max-width: calc(var(--wrap) - 2 * var(--gutter));
  margin-left: auto; margin-right: auto;
}
.main.is-board > .ph, .main.is-board > .data-stamp, .main.is-board > .provisional-note,
.main.is-board > .feedback-sent, .main.is-board > .credits, .main.is-board > .fnd-say { max-width: none; }
.main > .page { flex: 1 0 auto; padding: var(--sp-6) 0 var(--sp-12); }
/* a profile draws its own header to the column's edges */
.page:has(> .pview) { padding-top: 0; }

/* ========================================================== page header === */

.ph { padding: var(--sp-10) 0 0; }
.ph h1 { margin: 0; font-size: var(--fs-3xl); font-weight: 600; line-height: 1.08; letter-spacing: var(--tight); }
.ph:not(:has(.sub-tabs)) { padding-bottom: var(--sp-2); }
.ph.ph-tabs { padding-top: var(--sp-4); }
.crumbs { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; color: var(--sub); font-size: var(--fs-sm); }
.crumbs img { width: 18px; height: 18px; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; }
.crumb-back { color: var(--ink); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.ph-row { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.ph-act { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.ph-sub { margin: var(--sp-1) 0 0; color: var(--sub); font-size: var(--fs-md); }

.sub-tabs { display: flex; gap: var(--sp-6); margin-top: var(--sp-4); overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.sub-tabs::-webkit-scrollbar { display: none; }
.ph-tabs .sub-tabs { margin-top: 0; }
.sub-tabs a { position: relative; flex: none; padding: var(--sp-3) 0 13px; color: var(--sub); }
.sub-tabs a:hover { color: var(--ink); }
.sub-tabs a.on, .sub-tabs a[aria-current="page"] { color: var(--ink); font-weight: 600; }
.sub-tabs a.on::after, .sub-tabs a[aria-current="page"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--red);
}
.sub-tabs a:focus-visible { outline-offset: -3px; }

/* Phones: the sub-tabs scroll sideways with no scrollbar, so the edges fade
   to say "more this way". The mask fades the right edge by default; where
   scroll-driven animations exist it tracks the scroll position, fading the
   left edge once scrolled and dropping the right fade at the end. */
@property --fade-l { syntax: "<length>"; inherits: false; initial-value: 0px; }
@property --fade-r { syntax: "<length>"; inherits: false; initial-value: 28px; }
@keyframes sub-tabs-fade {
  from { --fade-l: 0px; --fade-r: 28px; }
  12% { --fade-l: 28px; }
  88% { --fade-r: 28px; }
  to { --fade-l: 28px; --fade-r: 0px; }
}
@media (max-width: 860px) {
  .sub-tabs {
    scroll-padding-inline: 32px;
    -webkit-mask-image: linear-gradient(to right, transparent 0, black var(--fade-l), black calc(100% - var(--fade-r)), transparent 100%);
    mask-image: linear-gradient(to right, transparent 0, black var(--fade-l), black calc(100% - var(--fade-r)), transparent 100%);
  }
  @supports (animation-timeline: scroll()) {
    .sub-tabs { animation: sub-tabs-fade linear both; animation-timeline: scroll(self inline); }
  }
}

/* Data stamp: "Data through Week N · updated <ET>" and the Season drop-down,
 * one quiet row under the head, right-aligned; it wraps on narrow screens. */
.data-stamp {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end;
  gap: var(--sp-1) var(--sp-3); padding-top: var(--sp-3);
  font-size: var(--fs-2xs); color: var(--sub);
}
.data-stamp-text { font-variant-numeric: tabular-nums; }
.main > .provisional-note { padding: 0; background: none; border: 0; color: var(--sub); font-size: var(--fs-2xs); text-align: right; }
.main > .feedback-sent { margin-top: var(--sp-3); }

/* ================================================================ board ===
 * A filter rail beside a table that scrolls inside the window. */

.board { flex: 1; min-height: 0; display: grid; grid-template-columns: var(--rail-w) minmax(0, 1fr); gap: var(--sp-8); padding: var(--sp-4) var(--gutter); }
/* A scroller clips at its edge: the left padding is the room a focus ring
 * needs, and the margin gives the same space back. */
.rail { position: relative; overflow: auto; margin-left: calc(-1 * var(--sp-1)); padding-left: var(--sp-1); padding-right: var(--sp-6); border-right: 1px solid var(--line); }
.rail > .flt:last-child { border-bottom: 0; }
.content { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.content > .note { margin: var(--sp-2) 0 0; flex: none; }
.content > .callout { flex: none; }
.results { display: flex; flex-direction: column; flex: 1; min-height: 0; }

/* =============================================================== footer === */

.credits { padding: var(--sp-4) 0 var(--sp-6); border-top: 1px solid var(--line); color: var(--sub); font-size: var(--fs-2xs); }
/* a link or the byline wraps whole, never between its words */
.credits a { text-decoration: underline; text-underline-offset: 2px; white-space: nowrap; }
.credits .credits-by { display: inline-block; }
.credits .credits-by, .credits .credits-updates, .credits .credits-feedback { margin-left: var(--sp-2); }

/* Feedback: one dialog in the shell. Script opens it as a modal; without
 * script the #feedback-dialog link targets it and :target shows it. */
.feedback-dialog {
  width: min(480px, calc(100vw - 32px)); padding: var(--sp-6);
  background: var(--paper); color: var(--ink);
  border: 1px solid var(--line-2); border-radius: var(--r-md); box-shadow: var(--shadow-menu);
}
.feedback-dialog::backdrop { background: var(--scrim); }
.feedback-dialog:target:not([open]) {
  display: block; position: fixed; inset: 0; z-index: 60; height: fit-content; margin: auto;
}
.feedback-title { font: 600 var(--fs-xl)/1.2 var(--sans); letter-spacing: var(--snug); }
.feedback-actions { display: flex; justify-content: flex-end; gap: var(--sp-2); }

.hint {
  position: fixed; right: var(--sp-4); bottom: var(--sp-4); z-index: 50;
  padding: var(--sp-2) var(--sp-3); border-radius: var(--r);
  background: var(--toast); color: var(--paper); font-size: var(--fs-sm);
}

/* Sign-in: one card on a quiet fill. */
.app.app-signin { display: grid; grid-template-rows: none; place-items: center; overflow: auto; padding: var(--sp-6) var(--sp-4); background: var(--fill); }
.signin-card { width: 100%; max-width: 380px; padding: var(--sp-8); background: var(--paper); border-radius: var(--r-md); }
.signin-brand { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-5); }
.signin-brand img { height: 28px; width: auto; }
.signin-brand .shield-fb { display: none; }
.signin-brand .wm { padding-left: var(--sp-3); border-left: 1px solid var(--line); font: 600 var(--fs-md)/1.15 var(--sans); }
.signin-brand .wm small { display: block; color: var(--sub); font: 400 var(--fs-2xs)/1.2 var(--sans); }
.signin-title { font: 600 var(--fs-2xl)/1.1 var(--sans); letter-spacing: var(--tight); }

/* =========================================================== responsive ===
 * Below tablet width the window-filling layout gives way to normal page
 * scroll: the bar stays on top, the rail stacks above the table. */
@media (max-width: 860px) {
  :root { --gutter: var(--sp-4); --top-h: 48px; }
  body:has(> .app) { overflow: auto; height: auto; }
  /* a jump link or a focused control stops under the pinned bar, not behind it */
  html:has(body > .app) { height: auto; scroll-padding-top: calc(var(--top-h) + var(--sp-2)); }
  /* The body row takes any slack, so a short page never stretches the top bar. */
  .app { height: auto; min-height: 100dvh; grid-template-rows: auto 1fr; overflow: visible; }
  .top { position: sticky; top: 0; }
  .main, .main.is-board { overflow: visible; }
  .ph { padding-top: var(--sp-6); }
  .ph h1 { font-size: var(--fs-2xl); }
  .board { grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); }
  .rail { margin-left: 0; padding-left: 0; padding-right: 0; border-right: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  /* the stacked rail's rule stands in for the first panel's own */
  .content > .panel:first-child, .content > .results > .panel:first-child,
  .content > .stack > .depth-grid > .panel:first-child { border-top: 0; }
  .scroll { max-height: 75vh; }
  /* the footer's byline takes its own line, so no line starts indented */
  .credits .credits-by { display: block; margin: var(--sp-1) 0 0; }
  .credits .credits-updates, .credits .credits-feedback { margin-left: 0; margin-right: var(--sp-2); }
  .data-stamp { justify-content: flex-start; }
  .main > .provisional-note { text-align: left; }
  .main > .page { padding-top: var(--sp-4); padding-bottom: var(--sp-8); }
}
