/* ==========================================================================
   UNIFINITY – shared site styles
   Loaded once in base.html. Page templates only add what is unique to them.
   ========================================================================== */

/* ---------- Design tokens ---------- */
:root {
  --brand-bg: #f7584d;        /* coral page background */
  --brand-ink: #000000;       /* text, dark surfaces */
  --brand-accent: #4decf7;    /* hover / highlight */
  --surface-dark: #000000;    /* cards, panels */
  --on-dark: #f7584d;         /* text on dark surfaces */

  --page-max: 1200px;         /* content never gets wider than this */
  --nav-h: 88px;              /* height of the fixed navbar */
  --radius: 14px;
  --radius-sm: 8px;
  --gap: clamp(1rem, 2.5vw, 1.75rem);

  --font-main: "Helvetica Neue", Helvetica, Arial, sans-serif;

  /* Bootstrap hooks */
  --bs-body-bg: var(--brand-bg);
  --bs-body-color: var(--brand-ink);
  --bs-body-font-family: var(--font-main);
  --bs-link-color-rgb: 0, 0, 0;
  --bs-link-hover-color-rgb: 0, 0, 0;
}

/* Per-page colour themes: set on <body> via {% block body_class %} */
.theme-ths-i {
  --brand-bg: #84b09d;
  --brand-ink: #282727;
  --on-dark: #84b09d;         /* text/icons on dark surfaces = page colour, like the other themes */
  --bs-body-bg: #84b09d;
  --bs-body-color: #282727;
}

html { scroll-padding-top: calc(var(--nav-h) + 12px); } /* anchors land below the navbar */

body {
  font-family: var(--font-main);
  background-color: var(--brand-bg);
  color: var(--brand-ink);
  -webkit-font-smoothing: antialiased;
}

h1 { font-size: clamp(1.7rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.4rem, 3vw, 2rem); }
img { max-width: 100%; height: auto; }

.hidden { display: none !important; }   /* used by the feedback filters */

/* ---------- Layout ---------- */
.site-main {
  padding-top: calc(var(--nav-h) + 1rem);
  padding-bottom: 3rem;
}
.page {
  width: 100%;
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}
.page-narrow { max-width: 760px; }
.page-tight  { max-width: 420px; }
.page-header { text-align: center; margin: 1rem 0 2rem; }
.page-header p { margin: .25rem 0 0; }
.section { margin-block: clamp(2.5rem, 6vw, 4.5rem); }

/* ---------- Navbar ---------- */
.site-nav {
  background-color: var(--brand-bg);
  min-height: var(--nav-h);
}
.site-nav .nav-inner {
  max-width: var(--page-max);
  margin-inline: auto;
  padding-inline: clamp(1rem, 4vw, 2rem);
}
.site-nav .brand-logo { height: 62px; width: auto; }
.site-nav .navbar-nav { gap: .5rem; }
.site-nav .btn { white-space: nowrap; }
.site-nav .navbar-toggler { border-color: var(--brand-ink); }
.site-nav .navbar-toggler:focus { box-shadow: none; }

.nav-socials {
  display: flex;
  align-items: center;
  gap: 1rem;
}
.social-icon {
  font-size: 1.9rem;
  color: var(--brand-ink);
  transition: color .15s ease;
}
.social-icon:hover,
.social-icon:focus-visible { color: var(--brand-accent); }

/* Mobile menu: full-width stacked buttons, scrollable if long */
@media (max-width: 991.98px) {
  .site-nav .navbar-collapse {
    max-height: calc(100vh - var(--nav-h));
    overflow-y: auto;
    padding: .5rem 0 1rem;
  }
  .site-nav .navbar-nav .btn,
  .site-nav .navbar-nav .dropdown-toggle { width: 100%; text-align: center; }
  .site-nav .navbar-nav .dropdown-menu { position: static; float: none; }
  .nav-socials { margin-top: 1rem; flex-wrap: wrap; justify-content: center; }
}

/* ---------- Links ---------- */
.ulink {                     /* inline highlighted link (was #link) */
  color: var(--on-dark);
  background-color: var(--surface-dark);
  text-decoration: none;
  padding: 0 .2em;
  border-radius: 3px;
}
.ulink:hover,
.ulink:focus-visible { color: var(--brand-accent); }

/* ---------- Dark panels & cards ---------- */
.panel-dark {
  background: var(--surface-dark);
  color: var(--on-dark);
  border-radius: var(--radius);
  padding: clamp(1rem, 3vw, 1.75rem);
}
.panel-dark a { color: var(--on-dark); }
.rounded-soft { border-radius: 25px / 15px; }

/* Small pill (roles, tags, status) */
.pill {
  display: inline-block;
  border: 1px solid var(--on-dark);
  color: var(--on-dark);
  border-radius: 999px;
  padding: .1rem .65rem;
  font-size: .8rem;
  line-height: 1.5;
  margin: 0 .3rem .3rem 0;
}
.pill-solid { background: var(--on-dark); color: var(--surface-dark); }

.btn-coral-outline {
  border: 1px solid var(--on-dark);
  color: #fff;
  border-radius: var(--radius-sm);
}
.btn-coral-outline:hover,
.btn-coral-outline:focus-visible { background: var(--on-dark); color: var(--surface-dark); }

/* ---------- Card grid (artists, board members) ---------- */
.card-grid {
  display: flex;              /* flex (not grid) so a half-full last row is centered too */
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--gap);
}
.card-grid > * { flex: 0 1 260px; min-width: 0; }
/* Phones: two compact cards per row (artists grid) */
@media (max-width: 575.98px) {
  .card-grid-compact { gap: .75rem; }
  .card-grid-compact > * { flex-basis: calc(50% - .375rem); }
  .card-grid-compact .u-card { padding: 1rem .6rem; }
  .card-grid-compact .avatar { width: 96px; height: 96px; }
  .card-grid-compact h3 { font-size: 1rem; }
  .card-grid-compact .pill { font-size: .7rem; padding: .05rem .5rem; }
}

.u-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: .4rem;
  width: 100%;
  padding: 1.5rem 1.25rem 1.25rem;
  background: var(--surface-dark);
  color: var(--on-dark);
  border: 0;
  border-radius: var(--radius);
  transition: transform .2s ease, box-shadow .2s ease;
}
.u-card h3 { font-size: 1.2rem; margin: .5rem 0 0; color: var(--on-dark); }
.u-card .muted { opacity: .65; font-size: .85rem; }
.u-card .label { text-decoration: underline; font-size: .85rem; opacity: .85; }

.avatar {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  object-fit: cover;
  transition: transform .25s ease;
}
.avatar-lg { width: 180px; height: 180px; }

/* Clickable cards lift slightly */
.u-card-clickable { cursor: pointer; }
.u-card-clickable:hover,
.u-card-clickable:focus-visible {
  transform: translateY(-4px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .25);
  outline: none;
}
.u-card-clickable:hover .avatar,
.u-card-clickable:focus-visible .avatar { transform: scale(1.04); }
.u-card-clickable:focus-visible { box-shadow: 0 0 0 3px var(--brand-accent); }

/* ---------- Fade-in on scroll (site.js adds .is-visible) ---------- */
.reveal { opacity: 0; transform: translateY(12px); transition: opacity .5s ease, transform .5s ease; }
.reveal.is-visible { opacity: 1; transform: none; }

@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  .u-card, .avatar { transition: none; }
}

/* ---------- Modals in brand colours ---------- */
.modal-brand .modal-content {
  background: var(--surface-dark);
  color: var(--on-dark);
  border-radius: var(--radius);
  border: 0;
}
.modal-brand .modal-header,
.modal-brand .modal-footer { border-color: rgba(247, 88, 77, .3); }
.modal-brand .btn-close { filter: invert(1); }

/* ---------- Forms on dark panels ---------- */
.form-dark .form-label,
.form-dark .form-check-label,
.form-dark .form-text { color: var(--on-dark); }
.form-dark .form-control,
.form-dark .form-select {
  background-color: var(--surface-dark);
  color: var(--on-dark);
  border: 1px solid var(--on-dark);
}
.form-dark .form-control::placeholder { color: rgba(247, 88, 77, .55); }
.form-dark .form-control:focus,
.form-dark .form-select:focus {
  background-color: var(--surface-dark);
  color: var(--on-dark);
  border-color: var(--on-dark);
  box-shadow: 0 0 0 .2rem rgba(247, 88, 77, .35);
}
.form-dark .form-select option { background-color: var(--surface-dark); color: var(--on-dark); }
.form-dark .form-check-input { background-color: var(--surface-dark); border-color: var(--on-dark); }
.form-dark .form-check-input:checked { background-color: var(--on-dark); border-color: var(--on-dark); }
.form-dark .form-control[type="file"]::file-selector-button {
  background-color: var(--on-dark);
  color: var(--surface-dark);
  border: none;
  margin-right: 12px;
}
.btn-coral {
  background-color: var(--on-dark);
  color: var(--surface-dark);
  border: 1px solid var(--on-dark);
}
.btn-coral:hover,
.btn-coral:focus-visible { background-color: var(--surface-dark); color: var(--on-dark); }

/* ---------- Filter chips (artists page) ---------- */
.filter-bar label { display: block; text-align: center; }
.filter-bar { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; justify-content: center; margin-bottom: 2rem; }
.chip-group { display: flex; flex-wrap: wrap; gap: .4rem; justify-content: center; }
.chip {
  border: 1px solid var(--brand-ink);
  border-radius: 999px;
  padding: .25rem .8rem;
  font-size: .9rem;
  color: var(--brand-ink);
  background: transparent;
}
.btn-check:checked + .chip { background: var(--brand-ink); color: var(--brand-bg); }
.btn-check:focus-visible + .chip { box-shadow: 0 0 0 3px var(--brand-accent); }

/* ---------- Home feed ---------- */
.feed { display: flex; flex-direction: column; gap: .25rem; }
.feed-item {
  display: grid;
  grid-template-columns: 4.75rem 72px 1fr;
  align-items: center;
  gap: 1rem;
  padding: .75rem;
  color: var(--brand-ink);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background-color .15s ease, color .15s ease;
}
.feed-item:hover,
.feed-item:focus-visible { background: var(--surface-dark); color: var(--on-dark); }
.feed-item img { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; }
.feed-date { font-size: .9rem; font-weight: 600; margin: 0; }
.past-date { opacity: .5; }
.today-date { color: var(--brand-accent); }
@media (max-width: 420px) {
  .feed-item { grid-template-columns: 3.75rem 56px 1fr; gap: .6rem; }
  .feed-item img { width: 56px; height: 56px; }
}

/* ---------- Release pages (THS music) ---------- */
.release { margin-block: clamp(2rem, 6vw, 4rem); text-align: center; }
.release-sub { font-size: 1.15rem; }
.cover-img { display: block; width: 100%; max-width: 500px; height: auto; margin-inline: auto; }
.platform-box {
  background: var(--surface-dark);
  border-radius: var(--radius);
  padding: 1rem;
}
.platform-box__title { color: var(--on-dark); text-decoration: underline; }
.platform-icon { font-size: 40px; color: var(--on-dark); }
.platform-box a { display: inline-block; transition: transform .15s ease; }
.platform-box a:hover { transform: scale(1.08); }

/* Supporter logos: greyscale until hovered */
.supporter-logo {
  filter: grayscale(100%);
  transition: filter .2s ease;
  max-width: 130px;
  height: auto;
}
.supporter-logo:hover { filter: none; }

/* ---------- Feedback pages ---------- */
.audio-item {
  background: rgba(0, 0, 0, .06);
  border-radius: var(--radius);
}
.filter-select { max-width: 280px; margin-inline: auto; }

/* ---------- Simple message pages ---------- */
.message-page { text-align: center; padding-block: clamp(2rem, 8vw, 5rem); }
.message-page .btn { min-width: 220px; }

/* ---------- Tiles (studio) ---------- */
.tile-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}
.tile-grid > * { flex: 1 1 220px; max-width: 320px; }
.tile {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 96px;
  padding: 1rem;
  border: 1px solid var(--brand-ink);
  border-radius: var(--radius);
  color: var(--brand-ink);
  text-decoration: none;
  font-size: 1.1rem;
  transition: background-color .15s ease, color .15s ease, transform .15s ease;
}
.tile:hover,
.tile:focus-visible { background: var(--surface-dark); color: var(--on-dark); transform: translateY(-2px); }

/* THS II page theme (yellow / purple) */
.theme-ths-ii {
  --brand-bg: #d2ff19;
  --brand-accent: #614097;
  --on-dark: #d2ff19;
  --bs-body-bg: #d2ff19;
}
.text-on-dark { color: var(--on-dark); }

/* Legacy feed markup (news.html) */
.link-popout { display: block; color: var(--brand-ink); border-radius: var(--radius-sm); transition: background-color .15s ease, color .15s ease; }
.link-popout:hover { background-color: var(--surface-dark); color: var(--on-dark); }
.site-main > .release:first-child,
.site-main > .page:first-child > .release:first-child { margin-top: 0; }

/* Navbar dropdown in brand colours */
.site-nav .dropdown-menu { background: var(--surface-dark); border: 0; border-radius: var(--radius-sm); }
.site-nav .dropdown-item { color: var(--on-dark); text-align: center; }
.site-nav .dropdown-item:hover,
.site-nav .dropdown-item:focus { background: var(--on-dark); color: var(--surface-dark); }
