
:root {
  --fb-canvas: #FFFFFF;
  --fb-surface: #FFFFFF;
  --fb-hairline: #CCCCCC;

  --activity_cardio: #008ffb;
  --activity_strength: #00e396;
  --activity_mixed: #feb019;
  --activity_group: #ff4560;
  --event: #775dd0;
  --meal: #00e600;
  --club: #cccccc;
	
  --activity_cardio-tint: #edf5fa;
  --activity_strength-tint: #f2fffb;
  --activity_mixed-tint: #faf6ed;
  --activity_group-tint: #fff5f6;
  --event-tint: #f6f2ff;
  --meal-tint: #f2fcf2;
  --club-tint: #f5f5f5;

  --fb-font-body: 'Helvetica', 'Arial', sans-serif;

}

* { box-sizing: border-box; }

body {
  margin: 0;

}

/* --- Page shell ---------------------------------------------------- */

.fb-feed-page {
  max-width: 1000px;
  margin: 0 auto;
  padding: 90px 20px;
}

/* --- Welcome / announcement box ------------------------------------
   Sits as the first child inside .fb-feed-page, so it inherits that
   container's max-width and side padding and its edges line up exactly with
   the tile grid below. The bottom margin matches the grid's gap. */

.fb-welcome {
  border: 1px solid var(--fb-hairline);
  background: var(--fb-surface);
  padding: 20px 40px 20px 30px;
  margin-bottom: 10px;
  font-family: var(--fb-font-body);
  font-size: 13px;
  line-height: 1.5;
  color: rgb(125, 125, 125);
}

.fb-welcome__title {
  margin: 0 0 6px;
  font-size: 18px;
  font-weight: bold;
  color: rgb(125, 125, 125);
}

.fb-welcome__text {
  margin: 0 0 8px;
 font-style: italic;
}

.fb-welcome__text:last-child {
  margin-bottom: 0;
}

/* --- Tile grid ------------------------------------------------------ */

.fb-feed-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: auto;	
  grid-auto-flow: dense;
  gap: 10px;
}

.fb-tile {
  position: relative;
  background: var(--fb-surface);
  border: 1px solid var(--fb-hairline);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border-left: 0;
}

.fb-tile__media {
  aspect-ratio: 1 / 1;
  background-size: cover;
  background-position: center;
  position: relative;
  display: flex;
  align-items: flex-end;
}

/* Only dim on hover when the square actually holds a photo/video. The empty
   squares (club quote, activity metrics, media-less meals) render content or
   a flat tint that shouldn't fade — they get a pointer cursor instead, via
   the [role="button"] rule below, where they're clickable. */
.fb-tile__media:not(.fb-tile__media--empty):hover { opacity: 0.7; transition: 0.3s; }

.fb-tile__media[role="button"] { cursor: pointer; }

.fb-tile__media--empty {
  display: flex;
  align-items: center;
  justify-content: center;
}

.fb-tile__quote {
  padding: 14px;
  max-height: 100%;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.4;
  font-family: 'Helvetica', 'Arial', sans-serif;
  color: rgb(125, 125, 125);
  text-align: center;
}

.fb-tile__metrics {
  width: fit-content;   /* hug the widest row… */
  max-width: 100%;      /* …but never overflow the tile */
  max-height: 100%;
  margin: 0 auto;       /* centre the single column horizontally */
  padding-left: 0;
  display: grid;
  grid-template-columns: auto;   /* one column, sized to content */
  gap: 6px 0;                    /* vertical rhythm; no column gap */
  align-content: center;
  overflow: hidden;
  font-family: 'Helvetica', 'Arial', sans-serif;
}

.fb-tile__metric {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.fb-tile__metric i {
  font-size: 26px;
  color: rgb(125, 125, 125);
  flex-shrink: 0;
  width: 26px;
  text-align: center;
}

.fb-tile__metric-text {
  min-width: 0;
}

.fb-tile__metric-label {
  font-size: 12px;
  color: rgb(125, 125, 125);
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fb-tile__metric-value {
  font-size: 16px;
  font-weight: bold;
  color: rgb(125, 125, 125);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fb-tile__metric--inactive i,
.fb-tile__metric--inactive .fb-tile__metric-label,
.fb-tile__metric--inactive .fb-tile__metric-value {
  color: rgb(204, 204, 204);
}

.fb-tile__caption {
  padding: 7px 7px 7px 12px;
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: flex-start;
}

.fb-tile__avatar {
  width: 36px;
  height: 36px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--fb-hairline);
}

.fb-tile__caption-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.fb-tile__topline {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.fb-tile__author {
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.fb-tile__age {
  font-size: 11px;
  flex-shrink: 0;
}

/* Type line under the author (e.g. "Skyrunning / Mountain Running (Event)" or
   "Meal (Snack)"). Not a link. Coloured with the same --fb-accent that drives
   the left stripe, so the two always match by type/sub-type. */
.fb-tile__typeline {
  font-size: 11px;
  font-weight: 600;
  color: var(--fb-accent);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

/* Caption links (avatar, username, title) inherit their look from the
   classes above; just strip the default anchor underline/colour and add a
   hover underline on the text links. */
.fb-tile__avatar-link {
  flex-shrink: 0;
  line-height: 0;
}

.fb-tile__author:link,
.fb-tile__author:visited,
.fb-tile__author:active {
  font-family: 'Helvetica', 'Arial', sans-serif;
  font-size: 11px; 
  color: rgb(100, 100, 100);
  padding-bottom: 5px;
}

.fb-tile__title:link,
.fb-tile__title:visited,
.fb-tile__title:active {
  font-family: 'Helvetica', 'Arial', sans-serif;
  font-size: 14px; 
  color: rgb(100, 100, 100);
  font-weight: bold;
  padding-bottom: 5px;
}

.fb-tile__author:hover,
.fb-tile__title:hover {
  color: rgb(0, 230, 0);
}

.fb-tile__title {
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.fb-tile__title--club {
  font-family: 'Helvetica', 'Arial', sans-serif;
  font-size: 14px;
  font-weight: normal;
  color: rgb(100, 100, 100);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
	padding-bottom: 5px;
}

.fb-tile__club-link:link,
.fb-tile__club-link:visited,
.fb-tile__club-link:active {
  color: rgb(100, 100, 100);
  font-weight: bold;
  text-decoration: none;
  padding-bottom: 5px;
}

.fb-tile__club-link:hover {
  color: rgb(0, 230, 0);
}

.fb-tile__meta {
  font-family: var(--fb-font-body);
  font-size: 11px;
  display: flex;
  gap: 10px;
  margin-top: 2px;
}

.fb-tile::before {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 5px;
  background: var(--fb-accent, var(--fb-hairline));
  z-index: 2;
  pointer-events: none;
}

.fb-tile--meal      { --fb-accent: var(--meal); }
.fb-tile--activity  { --fb-accent: var(--activity_cardio); }
.fb-tile--club_post { --fb-accent: var(--club); }
.fb-tile--discovery { --fb-accent: var(--club); }

.fb-tile[data-activity-type="Cardio"]   { --fb-accent: var(--activity_cardio); }
.fb-tile[data-activity-type="Strength"] { --fb-accent: var(--activity_strength); }
.fb-tile[data-activity-type="Mixed"]    { --fb-accent: var(--activity_mixed); }
.fb-tile[data-activity-type="Group"]    { --fb-accent: var(--activity_group); }
.fb-tile[data-activity-type="Event"]    { --fb-accent: var(--event); }

/* type-specific tints for the caption area on tiles with no media */
.fb-tile--meal .fb-tile__media--empty { background: var(--meal-tint); }
.fb-tile[data-activity-type="Cardio"] .fb-tile__media--empty   { background: var(--activity_cardio-tint); }
.fb-tile[data-activity-type="Strength"] .fb-tile__media--empty { background: var(--activity_strength-tint); }
.fb-tile[data-activity-type="Mixed"] .fb-tile__media--empty    { background: var(--activity_mixed-tint); }
.fb-tile[data-activity-type="Group"] .fb-tile__media--empty    { background: var(--activity_group-tint); }
.fb-tile[data-activity-type="Event"] .fb-tile__media--empty    { background: var(--event-tint); }
.fb-tile--club_post .fb-tile__media--empty { background: var(--club-tint); }
.fb-tile--discovery .fb-tile__media--empty { background: var(--club-tint); }


.fb-tile--discovery .fb-tile__badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(20,38,33,0.75);
  color: #fff;
  font-size: 10px;
  font-family: var(--fb-font-body);
  padding: 2px 7px;
  border-radius: 20px;
  letter-spacing: 0.02em;
}

/* --- Loading skeleton, styled as a pulse readout ------------------- */

.fb-feed-grid--skeleton { margin-top: 10px; }

.fb-skeleton-tile {
  background: linear-gradient(90deg, var(--fb-hairline) 25%, #EFECE2 37%, var(--fb-hairline) 63%);
  background-size: 200% 100%;
  animation: fb-shimmer 1.4s ease-in-out infinite;
  height: 150px;
}

/* .fb-skeleton-tile--big { grid-column: span 2; grid-row: span 2; } */

@keyframes fb-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* --- Sentinel / end / error states ---------------------------------- */

.fb-feed-sentinel { height: 1px; }

.fb-feed-end,
.fb-feed-error {
  text-align: center;
  font-size: 13px;
  margin-top: 24px;
}

.fb-feed-error button {
  background: none;
  border: 1px solid var(--fb-hairline);
  border-radius: 6px;
  padding: 5px;
  font-size: 13px;
  color: rgb(125, 125, 125);
  cursor: pointer;
  margin-left: 6px;
}

/* --- Lightbox --------------------------------------------------------- */

.fb-lightbox[hidden] {
  display: none;
}

.fb-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 50px;
  overflow: auto;
  z-index: 100;
}

.fb-lightbox__body {
  max-width: 90vw;
  max-height: 85vh;
}

.fb-lightbox__body img,
.fb-lightbox__body video {
  max-width: 90vw;
  max-height: 85vh;
}

.fb-lightbox__close {
  position: fixed;
  top: 20px;
  right: 28px;
  background: none;
  border: none;
  color: #fff;
  font-size: 32px;
  cursor: pointer;
  line-height: 1;
}

/* --- Responsive ------------------------------------------------------- */

@media (max-width: 600px) {
  .fb-feed-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: 120px; }
}
