/* ============================================================================
   Oxfordshire Cross Country League - Brand Personalisation
   Colour scheme: #1F3A5F (navy primary), #6B4F3A (brown accent), #F7F5F2 (off-white bg)
   Fonts: Barlow Condensed (headings) + DM Sans (body/UI)
   ========================================================================== */

/* ============================================================================
   1. BRAND TOKENS — Custom properties for consistent theming
   ========================================================================== */

:root {
  /* Brand colours */
  --brand-primary: #1f3a5f;
  --brand-primary-rgb: 31, 58, 95;
  --brand-accent: #6b4f3a;
  --brand-accent-rgb: 107, 79, 58;
  --brand-bg: #f7f5f2;
  --brand-text: #1a1a2e;

  /* Override Bootstrap 5 CSS custom properties */
  --bs-primary: var(--brand-primary);
  --bs-primary-rgb: var(--brand-primary-rgb);
  --bs-body-bg: var(--brand-bg);
  --bs-body-font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --bs-body-color: var(--brand-text);
  --bs-heading-color: var(--brand-primary);
  --bs-link-color: var(--brand-primary);
  --bs-link-color-rgb: var(--brand-primary-rgb);       /* Bootstrap 5 renders links via rgba(--bs-link-color-rgb) not --bs-link-color */
  --bs-link-hover-color: var(--brand-accent);
  --bs-link-hover-color-rgb: var(--brand-accent-rgb);
  --bs-border-color: color-mix(in srgb, var(--brand-primary) 10%, #fff);
}

/* ============================================================================
   2. FONTS — Self-hosted via @font-face
   ========================================================================== */

/* DM Sans — Variable Font (supports weights 100-900) */
@font-face {
  font-family: 'DM Sans';
  src: url('/static/fonts/dm-sans.ttf') format('truetype');
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* ============================================================================
   3. TYPOGRAPHY — Headings and text styling
   ========================================================================== */

h1, h2, h3, h4, h5, h6 {
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  letter-spacing: 0.25px;
  text-transform: none;
}

body {
  background-color: var(--brand-bg);
  color: var(--brand-text);
  font-family: 'DM Sans', sans-serif;
}

/* ============================================================================
   4. NAVBAR — Brand styling with accent stripe
   ========================================================================== */

.navbar {
  border-bottom: 3px solid var(--brand-accent);
}

.bg-brand {
  background-color: var(--brand-primary) !important;
}

.navbar-brand {
  font-family: 'DM Sans', sans-serif;
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 0.5px;
  text-transform: none;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* Mobile: reduce font size and letter-spacing for better fit */
@media (max-width: 767.98px) {
  .navbar-brand {
    font-size: 1rem;
    letter-spacing: 0.5px;
  }
}

/* ============================================================================
   5. SIDEBAR — Navigation styling with accent highlights
   ========================================================================== */

.sidebar {
  min-height: calc(100vh - 3.5rem);
  background-color: #fff;
  border-right: 1px solid var(--bs-border-color);
}

.sidebar .nav-link {
  color: var(--brand-primary);
  padding: 0.5rem 0.75rem;
  border-radius: 0.375rem;
  transition: all 150ms ease-in-out;
}

.sidebar .nav-link:hover,
.sidebar .nav-link:focus {
  background-color: rgba(var(--brand-primary-rgb), 0.08);
  color: var(--brand-primary);
  text-decoration: none;
}

.sidebar .nav-link.active {
  background-color: var(--brand-accent);
  color: #fff;
  font-weight: 500;
}

/* ============================================================================
   6. POST CONTENT — Article and preview styling
   ========================================================================== */

.post-content img,
.post-preview img {
  max-width: 100%;
  height: auto;
  border-radius: 0.25rem;
}

.post-content h1,
.post-content h2,
.post-content h3 {
  margin-top: 1.25rem;
  color: var(--brand-primary);
}

.post-content blockquote {
  border-left: 4px solid var(--brand-accent);
  padding-left: 1rem;
  color: var(--brand-text);
  opacity: 0.85;
}

/* ============================================================================
   7. FIXTURE IMAGES — Course map display and modal
   ========================================================================== */

.fixture-image {
  cursor: pointer;
  transition: transform 150ms ease-in-out, box-shadow 150ms ease-in-out;
  max-height: 300px;
  max-width: 350px;
  object-fit: cover;
}

.fixture-image:hover,
.fixture-image:focus {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(var(--brand-primary-rgb), 0.2);
}

/* Mobile: reduce image size */
@media (max-width: 576px) {
  .fixture-image {
    max-height: 250px;
    max-width: 280px;
  }
}

/* Modal overlay and dialog */
dialog.fixture-image-modal {
  border: none;
  padding: 0;
  background-color: transparent;
}

/* Only apply fullscreen styles when the dialog is actually open (via showModal()) */
dialog.fixture-image-modal:modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  animation: fadeIn 150ms ease-in-out;
}

dialog.fixture-image-modal:modal::backdrop {
  background-color: rgba(0, 0, 0, 0.75);
  animation: fadeIn 150ms ease-in-out;
}

dialog.fixture-image-modal:modal img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: 0.5rem;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.fixture-image-modal-close {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 2001;
}

@media (max-width: 576px) {
  dialog.fixture-image-modal:modal img {
    max-width: 95vw;
    max-height: 80vh;
  }

  .fixture-image-modal-close {
    top: 1rem;
    right: 1rem;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ============================================================================
   8. QUILL EDITOR — Rich text editing
   ========================================================================== */

#editor {
  background: #fff;
  border-bottom-left-radius: 0.375rem;
  border-bottom-right-radius: 0.375rem;
  height: calc(100vh - 260px);
  min-height: 300px;
}

/* ============================================================================
   8. FOOTER — Subtle branding
   ========================================================================== */

footer {
  border-top-color: var(--bs-border-color);
}
