/* The homepage (/) as one centred card.
   Mirrors /imager/ and /rare-beta/: the header, one card and the footer sit
   together in the middle of the viewport, and the card takes the imager
   card's height for this account (--home-centered-card-h, set inline by
   index.php from habbend_imager_card_height_px()) as a minimum:
   the tiles are the public homepage's size, so the card grows to fit two
   rows of them. Left pane: a strip of category tabs on the card's top edge,
   with an "All N" link to the open category at its end, over a 3×2 grid of
   that category's catalogue tiles. Right pane: heading, the discovery strip
   and the Updates stream. Below 820px everything stacks. */

/* The switcher: one tab per category. Only the open category is the filled
   head button; the rest are quiet text on the tray with a dot in their
   category's colour, so the strip stays calmer than the tiles under it. */
.home-beta-cats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0 0 0.75rem;
}

.home-beta-cat {
  box-sizing: border-box;
  position: relative;
  flex: 1 1 auto;
  justify-content: center;
  height: 1.7rem;
  min-height: 1.7rem;
  min-width: 0;
  gap: 0.35rem;
  padding: 0 0.5rem;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

/* Tone inks: the head button's fill, used for the dot, the tab's bar and
   the panel's foot link. */
.home-beta-tone--warn { --home-beta-ink: #b8780a; }
.home-beta-tone--success { --home-beta-ink: #1f9d6a; }
.home-beta-tone--danger { --home-beta-ink: #c94444; }
.home-beta-tone--info { --home-beta-ink: var(--accent); }
.home-beta-tone--purple { --home-beta-ink: #7c3aed; }
.home-beta-tone--teal { --home-beta-ink: #0f766e; }
.home-beta-tone--cyan { --home-beta-ink: #0891b2; }
.home-beta-tone--orange { --home-beta-ink: #c2410c; }
.home-beta-tone--neutral { --home-beta-ink: var(--muted); }

html:not([data-theme="light"]):not([data-theme="paper"]) .home-beta-tone--warn { --home-beta-ink: #f6c45a; }
html:not([data-theme="light"]):not([data-theme="paper"]) .home-beta-tone--success { --home-beta-ink: #34d399; }
html:not([data-theme="light"]):not([data-theme="paper"]) .home-beta-tone--danger { --home-beta-ink: #f87171; }
html:not([data-theme="light"]):not([data-theme="paper"]) .home-beta-tone--info { --home-beta-ink: #6aa6ff; }
html:not([data-theme="light"]):not([data-theme="paper"]) .home-beta-tone--purple { --home-beta-ink: #c084fc; }
html:not([data-theme="light"]):not([data-theme="paper"]) .home-beta-tone--teal { --home-beta-ink: #2dd4bf; }
html:not([data-theme="light"]):not([data-theme="paper"]) .home-beta-tone--cyan { --home-beta-ink: #22d3ee; }
html:not([data-theme="light"]):not([data-theme="paper"]) .home-beta-tone--orange { --home-beta-ink: #fb923c; }

.home-beta-cats .home-beta-cat:not([aria-selected="true"]) {
  background-color: transparent;
  background-image: none;
  border-color: transparent;
  color: var(--muted);
  text-shadow: none;
  box-shadow: none;
}

.home-beta-cats .home-beta-cat:not([aria-selected="true"]):hover,
.home-beta-cats .home-beta-cat:not([aria-selected="true"]):focus-visible {
  background-color: var(--control-bg);
  color: var(--fg);
}

.home-beta-cat-dot {
  flex: 0 0 auto;
  width: 9px;
  height: 9px;
  background: var(--home-beta-ink, var(--muted));
}

.home-beta-cat[aria-selected="true"] .home-beta-cat-dot {
  display: none;
}

/* The open tab's bar sits on the strip's bottom edge. */
.home-beta-cat[aria-selected="true"]::after {
  content: "";
  position: absolute;
  left: 0.3rem;
  right: 0.3rem;
  bottom: calc(-0.45rem - 1px);
  height: 2px;
  background: var(--home-beta-ink, var(--accent));
}

.home-beta-cat:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.home-beta-cat-name {
  overflow: hidden;
  font-family: var(--font-pixel);
  font-weight: 400;
  font-size: 0.72rem;
  line-height: 1.2;
  white-space: nowrap;
  text-overflow: ellipsis;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
}

.home-beta-cat[aria-selected="true"] .home-beta-cat-name {
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.55);
}

/* "All N ▸" at the strip's end: the open category's page, no row of its own. */
.home-beta-cats-all {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  height: 1.7rem;
  margin-left: auto;
  padding: 0 0.4rem;
  border-radius: 6px;
  font-size: 0.72rem;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
}

.home-beta-cats-all:hover,
.home-beta-cats-all:focus-visible {
  background-color: var(--control-bg);
  color: var(--fg);
}

.home-beta-panel[hidden] {
  display: none;
}

/* Rare tile footer (title + price) in the beta grid: more air above the
   title and below the price than the catalogue defaults, and larger
   currency icons, so the name/value block reads as its own section. */
.rare-grid.home-beta-grid .rare-tile {
  gap: 0.5rem;
}

.rare-grid.home-beta-grid .rare-tile > :not(.rare-thumb) {
  margin-left: 0.8rem;
  margin-right: 0.8rem;
}

.rare-grid.home-beta-grid .rare-tile h3 {
  padding: 0.4rem 0 0;
  font-size: 0.9rem;
  line-height: 1.35;
}

.rare-grid.home-beta-grid .rare-tile .rare-meta {
  padding: 0.5rem 0 0.85rem;
  gap: 0.45rem;
}

.rare-grid.home-beta-grid .rare-tile .rare-tile-value {
  gap: 0.45rem;
}

.rare-grid.home-beta-grid .rare-tile .price {
  gap: 0.35rem;
  min-height: 1.8rem;
  padding: 0.25rem 0.55rem 0.25rem 0.45rem;
  font-size: 0.78rem;
}

.rare-grid.home-beta-grid .rare-tile .price .currency-icon,
.rare-grid.home-beta-grid .rare-tile-stacks .currency-icon {
  width: 18px;
  height: 18px;
}

.rare-grid.home-beta-grid .rare-tile-stacks {
  gap: 0.35rem;
}

.rare-grid.home-beta-grid .rare-tile-stacks li {
  gap: 0.35rem;
  min-height: 1.8rem;
  padding: 0.25rem 0.55rem 0.25rem 0.4rem;
}

.rare-grid.home-beta-grid .rare-tile-stacks .stack-count {
  font-size: 0.78rem;
}

/* Unvalued tiles keep the same footer height as priced ones. */
.rare-grid.home-beta-grid .rare-tile .rare-meta > .muted {
  display: inline-flex;
  align-items: center;
  min-height: 1.8rem;
  font-size: 0.78rem;
}

/* Latest Origins news atop the discover pane (mirrors /news/ cards):
   featured Habbo image, then thumb rows for the next posts. */
.home-beta-news {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0 0 1rem;
}

.home-beta-news-feature {
  display: block;
  color: inherit;
  text-decoration: none;
}

/* Featured story as a hero: Habbo art full-bleed, title and date over a
   dark scrim at the bottom of the image. */
.home-beta-news-media {
  position: relative;
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--content-box-border);
  border-radius: 8px;
  background: #17191d;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.08);
}

.home-beta-news-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.home-beta-news-media-fallback {
  display: block;
  width: 100%;
  height: 100%;
}

.home-beta-news-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(8, 10, 13, 0) 35%, rgba(8, 10, 13, 0.6) 65%, rgba(8, 10, 13, 0.92) 100%);
  pointer-events: none;
}


.home-beta-news-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  padding: 0.65rem 0.75rem 0.7rem;
}

.home-beta-news-feature:hover .home-beta-news-media,
.home-beta-news-feature:focus-visible .home-beta-news-media {
  border-color: var(--fg);
}

/* Poster: the latest story's art across the pane's top, its title in
   uppercase Volter with the hard shadow, a NEW tag, the date and the All
   news link as chips. */
.home-beta-news-feature-title {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.home-beta-news-feature-title {
  font-family: var(--font-pixel);
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.15;
  text-transform: uppercase;
  color: #fff;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.7);
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
  -webkit-line-clamp: 2;
}

.home-beta-news-feature-meta {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.3rem;
}

.home-beta-news-tag {
  display: inline-flex;
  align-items: center;
  height: 1.1rem;
  padding: 0 0.4rem;
  border-radius: 3px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(0, 0, 0, 0.45);
  font-family: var(--font-pixel);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.9);
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
}

.home-beta-news-tag--all {
  margin-left: auto;
}

.home-beta-news-tag--new {
  background: #d94848;
  border-color: #ff8a8a;
  color: #fff;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
}

.home-beta-news-empty {
  margin: 0;
}

.home-beta-col + .home-beta-col {
  margin-top: 1.25rem;
}

/* The Updates stream was styled for the dark toolbar; here it sits on the
   page and card background. */
.home-centered-page .home-update-stream-head h2 {
  color: var(--fg);
  text-shadow: none;
}

.home-centered-page .home-update-copy {
  color: var(--muted);
}

.home-centered-page .home-update-copy strong {
  color: var(--fg);
}

/* The card itself, only once there is room for two panes. */
@media (min-width: 820px) {
  body.home-centered-page {
    display: flex;
    flex-direction: column;
  }

  .home-centered-page .home-centered-wrap {
    /* Fallback: .imager-card for a signed-out visitor. */
    --home-centered-card-h: 579px;
    flex: 0 0 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    width: min(980px, calc(100% - 2rem));
    margin: 0 auto;
    padding: var(--habbend-page-top, 1.5rem) 0 2rem;
  }

  .home-centered-page .home-centered-wrap > .site-header,
  .home-centered-page .home-centered-wrap > .site-footer {
    width: 100%;
    max-width: none;
  }

  /* Identical footer to /imager/ and /rare-beta/: the nav and footer sit
     in the same place at the same size on all three centered pages. */
  .home-centered-page .home-centered-wrap > .site-header {
    flex: 0 0 auto;
  }

  .home-centered-page .home-centered-wrap > .site-footer {
    flex: 0 0 auto;
    margin-top: 0;
    padding-bottom: 1.25rem;
  }

  .home-centered-page .home-centered-main {
    display: flex;
    flex-direction: column;
    flex: 0 0 var(--home-centered-card-h);
    min-height: 0;
  }

  .home-centered-page .home-beta-card {
    flex: 1 1 auto;
    display: grid;
    /* The browse pane takes what three category-page tiles need. */
    grid-template-columns: minmax(0, 1.24fr) minmax(0, 0.76fr);
    grid-template-rows: minmax(0, 1fr);
    min-height: 0;
    overflow: hidden;
    background: var(--content-box-bg);
    border: 1px solid var(--content-box-border);
    border-radius: var(--content-box-radius);
    box-shadow: var(--content-box-shadow);
  }

  .home-centered-page .home-beta-col {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    padding: 0.9rem 1rem 0.9rem;
    overflow: hidden;
  }

  .home-centered-page .home-beta-col + .home-beta-col {
    margin-top: 0;
  }

  .home-centered-page .home-beta-col--browse {
    border-right: 1px solid var(--content-box-border);
  }

  /* The strip sits on the pane's top edge, one row, tabs sharing the width. */
  /* The browse pane's inset equals the grid gap, so the space above,
     between, below and beside the tiles is one value. */
  .home-centered-page .home-beta-col--browse {
    padding: 0.9rem 0.6rem 0.6rem;
  }

  .home-centered-page .home-beta-cats {
    flex: 0 0 auto;
    flex-wrap: nowrap;
    gap: 0.15rem;
    margin: -0.9rem -0.6rem 0.6rem;
    padding: 0.45rem 0.6rem;
    background: var(--field-bg);
    border-bottom: 1px solid var(--content-box-border);
  }

  .home-centered-page .home-beta-cat {
    gap: 0.28rem;
    padding: 0 0.3rem;
  }

  .home-centered-page .home-beta-cat-name {
    font-size: 0.68rem;
  }

  .home-centered-page .home-beta-cat-dot {
    width: 8px;
    height: 8px;
  }

  .home-centered-page .home-beta-cats-all {
    padding: 0 0.3rem;
    font-size: 0.7rem;
  }

  .home-centered-page .home-beta-panel {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .home-centered-page .home-beta-panel[hidden] {
    display: none;
  }

  /* Six catalogue tiles as 3×2 (two rows) at the public homepage's size (its grid is
     150px-minimum columns with a 0.9rem gap, five across the 960px wrap, so
     the same tile here is three across the browse pane). The thumbs stay
     square and the card takes the height two rows need. */
  .home-centered-page .home-beta-grid {
    flex: 0 0 auto;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.7rem;
  }

  /* Online pulse atop the discover pane, over the news poster. */
  .home-centered-page .home-beta-pulse {
    flex: 0 0 auto;
    margin: 0 0 0.7rem;
  }

  /* News under the pulse: framed poster, short featured image so the
     pane fits. */
  .home-centered-page .home-beta-news {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    gap: 0;
    min-height: 0;
    margin: 0 0 0.7rem;
    padding: 0;
  }

  /* The poster takes whatever height the strip and Updates leave, never
     less than its minimum, so the pane is full on every card height. */
  .home-centered-page .home-beta-news-feature {
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .home-centered-page .home-beta-news-media {
    flex: 1 1 auto;
    aspect-ratio: auto;
    height: auto;
    min-height: 10.5rem;
  }

  .home-centered-page .home-beta-news-overlay {
    padding: 0.65rem 0.75rem 0.7rem;
  }

  /* Discovery strip: two columns of four, flat inside the card. */
  .home-centered-page .home-discovery {
    --hd-cols: 2;
    --hd-rows: 3;
    --hd-row-h: 2.25rem;
    --hd-gap: 0.1rem;
    flex: 0 0 auto;
    gap: 0.2rem;
    margin: 0;
    padding: 0.2rem 0 0.4rem;
    border: 0;
    background: transparent;
  }

  .home-centered-page .home-discovery-item:nth-child(n + 7) {
    display: none;
  }

  .home-centered-page .home-discovery-card {
    padding: 0.15rem 0.3rem;
  }

  /* Updates: pinned to the bottom of the pane, three rows at most. */
  .home-centered-page .home-update-stream {
    flex: 0 0 auto;
    margin-top: auto;
    padding-top: 0.6rem;
    border-top: 1px solid var(--panel-border);
    overflow: hidden;
  }

  .home-centered-page .home-update-stream-head {
    margin-bottom: 0.3rem;
  }

  .home-centered-page .home-update-stream-head h2 {
    font-size: 0.8rem;
    color: var(--fg);
    text-shadow: none;
  }

  .home-centered-page .home-update-stream-list {
    gap: 0.15rem;
  }

  .home-centered-page .home-update-stream-list > li:nth-child(n + 4) {
    display: none;
  }

  .home-centered-page .home-update-item {
    padding: 0.1rem 0;
  }

  .home-centered-page .home-update-copy {
    font-size: 0.78rem;
  }

  .home-centered-page .home-update-empty {
    font-size: 0.76rem;
  }
}

/* Short viewports: shrink the news image and the tile grid so both panes
   still fit the shrunken card instead of clipping. */
@media (min-width: 820px) {

  .home-centered-page .home-beta-grid {
    width: 100%;
    gap: 0.6rem;
  }
}

/* The two tile rows share the pane height at every viewport (art area
   flexes, title/price footer keeps its size): the card is the account's
   fixed height, so otherwise a tall screen leaves a band under row two. */
@media (min-width: 820px) {
  .home-centered-page .home-beta-grid {
    flex: 1 1 auto;
    min-height: 0;
    grid-template-rows: repeat(2, minmax(0, 1fr));
  }

  .home-centered-page .home-beta-grid .rare-tile {
    min-height: 0;
  }

  /* Every tile's footer is the valued tile's height (price pill plus the
     note stacks), so the art area lines up across the row whether or not
     the rare has a valuation yet. */
  .home-centered-page .home-beta-grid .rare-meta {
    min-height: 5.05rem;
  }

  .home-centered-page .home-beta-grid .rare-thumb {
    aspect-ratio: auto;
    flex: 1 1 auto;
    min-height: 0;
  }

  .rare-grid.home-beta-grid .rare-tile h3 {
    padding-top: 0.25rem;
  }

  .rare-grid.home-beta-grid .rare-tile .rare-meta {
    padding: 0.35rem 0 0.6rem;
  }
}

/* Online pulse: the live count as the headline, a bar per hotel scaled to
   the busiest, today's peak and the link to /online/. One link. */
.home-beta-pulse {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-areas:
    "count bars"
    "foot foot";
  align-items: center;
  gap: 0.25rem 0.75rem;
  margin: 0 0 0.45rem;
  padding: 0.5rem 0.7rem 0.45rem;
  border-radius: 6px;
  border: 1px solid var(--content-box-border);
  background: var(--inset-bg);
  color: inherit;
  text-decoration: none;
}

.home-beta-pulse:hover,
.home-beta-pulse:focus-visible {
  border-color: var(--success);
}

.home-beta-pulse-count {
  grid-area: count;
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.home-beta-pulse-n {
  font-size: 1.9rem;
  color: var(--success);
}

.home-beta-pulse-l {
  margin-top: 0.15rem;
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.home-beta-pulse-bars {
  grid-area: bars;
  display: grid;
  gap: 0.2rem;
}

.home-beta-pulse-bar {
  display: grid;
  grid-template-columns: 1.3rem minmax(0, 1fr) 2.2rem;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.66rem;
  color: var(--muted);
}

.home-beta-pulse-bar span:last-child {
  text-align: right;
  color: var(--fg);
}

.home-beta-pulse-bar i {
  display: block;
  height: 7px;
  border-radius: 2px;
  background: var(--control-border);
  overflow: hidden;
}

.home-beta-pulse-bar i::after {
  content: "";
  display: block;
  width: var(--w, 0%);
  height: 100%;
  background: var(--success);
}

.home-beta-pulse-foot {
  grid-area: foot;
  font-size: 0.66rem;
  color: var(--muted);
}
