<% content_for :title, t("team_pages.show.title", team: @team.name, club: @club.name) %> <% content_for :meta_description, team_page_meta_description(@team, @club) %> <% content_for :canonical_url, seo_absolute_url(public_team_page_path(@team.slug)) %> <% content_for :head do %> <% end %>

<%= @club.name %>

<%= @team.name %>

<%= @team.sport_label %> <% if @live_sessions.any? %> · <%= t("team_pages.show.live_now_label") %> <% end %>

<% if @team.description.present? %>
<%= simple_format @team.description %>
<% end %>
<% if @live_sessions.any? %> <%= link_to t("team_pages.show.watch_live_link"), public_live_path(@live_sessions.first), class: "btn btn-primary" %> <% end %> <%= link_to t("team_pages.show.all_live_link"), public_live_index_path(club_id: @club.id), class: "btn btn-secondary" %> <% if @recordings.any? %> <%= link_to t("team_pages.show.replay_archive_link"), public_replay_index_path(team_id: @team.id), class: "btn btn-secondary" %> <% end %>
<% logo = @team.effective_logo_url.presence || @club.effective_logo_url %> <% if @team.team_photo_url.present? %> <%= image_tag @team.team_photo_url, alt: @team.name, class: "roster-hero__photo" %> <% elsif logo.present? %> <%= image_tag logo, alt: @team.name, class: "roster-hero__photo roster-hero__photo--logo" %> <% else %> <% end %>
<% if @live_sessions.any? %>

<%= t("team_pages.show.section_live_now") %>

<% @live_sessions.each do |session| %> <% match = session.match %> <% on_air = @online_paths.include?(session.mediamtx_path_name) %>
<%= live_match_card_heading(match, link_team: false) %>

<% if match.location.present? %><%= match.location %> · <% end %> Match Live TV

<% if session.score_state %>

<%= live_score_sets_label(session.score_state, match) %> <% if live_score_partials_label(session.score_state).present? %> <%= t("score.partials_prefix", value: live_score_partials_label(session.score_state)) %> <% end %> <%= session.score_state.home_points %> - <%= session.score_state.away_points %>

<% end %>
<% if on_air %> <%= t("live.index.badge_on_air") %> <% elsif session.paused? %> <%= t("live.index.badge_paused") %> <% else %> <%= t("live.index.badge_live") %> <% end %>
<%= link_to t("live.index.watch_link"), public_live_path(session), class: "btn-watch" %>
<% end %>
<% end %> <% if @upcoming_matches.any? %>

"><%= t("team_pages.show.section_upcoming") %>

<%= t("team_pages.show.upcoming_hint") %>

<% @upcoming_matches.each do |match| %>

<%= @team.name %> vs <%= match.opponent_name %>

<% if match.location.present? %><%= match.location %> · <% end %> <%= match.category.presence || @team.sport_label %>

<%= live_scheduled_relative(match.scheduled_at) %>

<%= t("live.index.badge_scheduled") %>
<% end %>
<% end %> <% if @recordings.any? %>

<%= t("team_pages.show.section_replays") %>

<% @recordings.each do |rec| %> <% match = rec.stream_session.match %> <%= link_to public_replay_path(rec.stream_session_id), class: "replay-card" do %>
<% if rec.thumbnail_url %> <% else %> <% end %> <%= rec.duration_label %>
<%= rec.title_or_default %>

<%= l_local(rec.recorded_at_or_fallback) %>

<% end %> <% end %>

<%= link_to t("team_pages.show.replays_more_link", team: @team.name), public_replay_index_path(team_id: @team.id) %>

<% end %> <% if @roster_by_category %>

<%= t("team_pages.show.section_roster") %>

<% TeamRosterMember::DISPLAY_ORDER.each do |category| %> <% members = @roster_by_category[category] %> <% next if members.blank? %>

<%= TeamRosterMember.category_label(category) %>

<%= members.size %>
<% members.each do |person| %> <%= render "shared/roster_person_card", person: person, team: @team, editable: false, compact: true %> <% end %>
<% end %>
<% end %> <% if @live_sessions.empty? && @upcoming_matches.empty? && @recordings.empty? %>

<%= t("team_pages.show.empty_title") %>

<%= t("team_pages.show.empty_body") %>

<%= link_to t("team_pages.show.empty_link"), public_live_index_path, class: "btn btn-secondary" %>
<% end %>