/* ============================================================
   NO TOCAR
   ============================================================ */
:root {
  /* MODE DIA */
  --chrome-bg: #ffffff;
  --chrome-text: #000000;
  --chrome-border: rgba(0, 0, 0, 0.2);
  --chrome-border-hover: rgba(0, 0, 0, 0.4);
  --page-bg: #e8e8e8;
  --page-text: #000000;
  --menu-panel-bg: rgba(255, 255, 255, 0.75);

  /* marca */
  --side-gap: 68px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* taula i calendari */
  --table-bg: #f6f6f6;
  --table-head-bg: #e4e4e4;
  --table-ink: #2c2340;
  --table-ink-muted: rgba(44, 35, 64, 0.45);
  --table-row-border: rgba(0, 0, 0, 0.07);
}

/* MODE NIT */
[data-theme="dark"] {
  --chrome-bg: #000000;
  --chrome-text: #ffffff;
  --chrome-border: rgba(255, 255, 255, 0.25);
  --chrome-border-hover: rgba(255, 255, 255, 0.5);
  --page-bg: #272727;
  --page-text: #ffffff;
  --menu-panel-bg: rgba(0, 0, 0, 0.75);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--page-bg);
  color: var(--page-text);
}

/* bloqueig scroll mobil menu obert */
body.menu-obert {
  overflow: hidden;
}

img {
  max-width: 100%;
}

.container {
  padding-left: var(--side-gap);
  padding-right: 24px;
}

/* HEADER */
.site-header {
  background: var(--chrome-bg);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  height: 88px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 3.15px;
  text-decoration: none;
}

.logo-icon {
  display: block;
  height: 70px;
  width: auto;
  object-fit: contain;
}

.logo-text {
  display: flex;
  align-items: flex-start;
  line-height: 1;
}

.logo-title {
  font-size: 21.72px;
  font-weight: 700;
  color: var(--chrome-text);
  white-space: nowrap;
}

/* gue */
.logo-tail {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1;
}

.logo-sub {
  margin-top: -1.05px;
  font-size: 11.38px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--chrome-text);
  white-space: nowrap;
}

.header-accent {
  display: none;
  height: 6px;
  background: var(--chrome-text);
}

/* links de navegacio desktop */
.header-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-left: auto;
}

.nav-link {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--chrome-text);
  text-decoration: none;
  white-space: nowrap;
}

/* ============================================================
   MENU HAMBURGUESA
   ============================================================ */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
}

.menu-toggle-bar {
  display: block;
  width: 22px;
  height: 2px;
  border-radius: 1px;
  background: var(--chrome-text);
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.menu-toggle.is-active .menu-toggle-bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle.is-active .menu-toggle-bar:nth-child(2) {
  opacity: 0;
}

.menu-toggle.is-active .menu-toggle-bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.menu-overlay {
  display: none;
}

.menu-panel {
  display: none;
}

/* CLASSIFICACIO */
.main {
  padding-top: 23px;
  padding-bottom: 37px;
}

.standings-section {
  display: flex;
  justify-content: flex-start;
  padding-left: var(--side-gap);
  padding-right: 24px;
}

/* Pàgines de contingut (article.article-card): el marge dret es
   iguala a l'esquerre perquè el bloc quede centrat amb marges
   equilibrats, sense afectar la resta de pàgines que comparteixen
   .standings-section (inici, calendari). */
@media (min-width: 641px) {
  .standings-section:has(.article-card) {
    padding-right: var(--side-gap);
  }
}

.standings-table {
  width: 100%;
  max-width: 230px;
  background: var(--table-bg);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3);
}

.standings-head,
.standings-row {
  display: flex;
  align-items: center;
  padding: 0 16px;
}

.standings-head {
  height: 41px;
  background: var(--table-head-bg);
  font-size: 13px;
  font-weight: 600;
  color: var(--table-ink-muted);
}

.standings-head .col-deck,
.standings-head .col-pts {
  color: inherit;
  font-weight: inherit;
}

.standings-row {
  height: 57px;
  border-bottom: 1px solid var(--table-row-border);
}

.standings-row:last-child {
  border-bottom: none;
}

.col-pos {
  width: 40px;
  flex-shrink: 0;
  font-size: 15px;
  color: var(--table-ink-muted);
}

.col-deck {
  flex: 1;
  font-size: 15px;
  font-weight: 600;
  color: var(--table-ink);
}

.col-pts {
  flex-shrink: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--table-ink);
  text-align: right;
}

/* PAGINA INICI */
.home-layout {
  display: grid;
  grid-template-columns: 230px minmax(220px, 320px);
  justify-content: start;
  align-items: stretch;
  gap: 48px;
  width: 100%;
}

/* la taula marca el height */
.home-infographic {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: 100%;
  max-width: 320px;
  min-height: 0;
}

.home-infographic-img {
  display: block;
  flex: 1 1 0;
  min-height: 0;
  width: auto;
  max-width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 14px; /* radi */
}

.home-infographic-caption {
  flex: 0 0 auto;
  margin-top: 10px;
  font-family: inherit;
  font-weight: 700;
  font-style: italic;
  font-size: 15px;
  letter-spacing: 0.3px;
  color: var(--page-text);
}

/* breakpoint intermedi */
@media (max-width: 880px) {
  .home-layout {
    grid-template-columns: 1fr;
    align-items: start;
    justify-items: center;
    gap: 32px;
  }

  .home-infographic {
    align-items: flex-start;
    max-width: 280px;
  }

  .home-infographic-img {
    flex: 0 0 auto;
    width: 100%;
    height: auto;
  }
}

/* ABOUT */
.article-card {
  max-width: 640px;
  margin-inline: auto;
  padding: 40px 44px;
}

.article-title {
  margin: 0 0 18px;
  font-size: 24px;
  font-weight: 700;
  color: var(--table-ink);
}

.article-lead {
  margin: 0 0 20px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.55;
  color: var(--table-ink);
}

.article-text {
  margin: 0 0 16px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--table-ink);
}

.article-text:last-child {
  margin-bottom: 0;
}

.article-subtitle {
  margin: 28px 0 12px;
  font-size: 18px;
  font-weight: 700;
  color: var(--table-ink);
}

.article-list {
  margin: 0 0 16px;
  padding-left: 20px;
  font-size: 15px;
  line-height: 1.6;
  color: var(--table-ink);
}

.article-list li {
  margin-bottom: 6px;
}

.article-list li:last-child {
  margin-bottom: 0;
}

.article-download-link,
.article-download-link:visited {
  display: inline-block;
  margin: 0 0 24px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--table-ink);
  text-decoration: underline;
}

.pdf-viewer {
  display: block;
  width: 100%;
  height: 80vh;
  min-height: 480px;
  border: 1px solid var(--table-row-border);
  border-radius: 10px;
  background: var(--table-bg);
}

.document-card {
  max-width: 1600px;
}

/* article algoritme */
.algo-diagram {
  margin: 24px 0 8px;
  padding: 24px;
  border: 1px solid var(--table-row-border);
  border-radius: 10px;
  background: var(--table-bg);
}

.algo-diagram--rotation {
  margin-top: 8px;
}

.algo-step-label {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--table-ink-muted);
  text-align: center;
}

.algo-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 0 0 14px;
}

.algo-player {
  display: inline-block;
  min-width: 44px;
  padding: 6px 10px;
  border: 1px solid var(--table-ink-muted);
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  color: var(--table-ink);
}

.algo-player--fixed {
  border-width: 2px;
  border-color: var(--table-ink);
}

.algo-player--rest {
  color: var(--table-ink-muted);
  border-style: dashed;
}

.algo-arrow {
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  color: var(--table-ink-muted);
}

.algo-table-wrap {
  width: 100%;
}

.algo-table {
  width: 100%;
  border-collapse: collapse;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

.algo-table th,
.algo-table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--table-row-border);
  text-align: left;
  color: var(--table-ink);
  font-weight: 600;
}

.algo-table tr:last-child th,
.algo-table tr:last-child td {
  border-bottom: none;
}

.algo-table th {
  color: var(--table-ink-muted);
  font-weight: 700;
}

.article-caption {
  margin: 8px 0 24px;
  font-size: 12.5px;
  font-style: italic;
  color: var(--table-ink-muted);
  text-align: center;
}

.algo-code {
  display: block;
  margin: 14px 0;
  padding: 14px 16px;
  border-radius: 8px;
  background: var(--table-head-bg);
  color: var(--table-ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-x: auto;
}

.algo-inline-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  background: var(--table-head-bg);
  padding: 1px 5px;
  border-radius: 4px;
}

/* CALENDARI */
.calendar-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  align-items: start;
  gap: 16px;
  width: 100%;
}

.jornada-title {
  font-size: 13px;
  font-weight: 600;
}

.match-player {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 15px;
  font-weight: 600;
  color: var(--table-ink);
}

.match-player--right {
  text-align: right;
}

.match-vs {
  flex-shrink: 0;
  padding: 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--table-ink-muted);
}

/* camp de text */
.match-score {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 1px solid var(--table-ink-muted);
  border-radius: 6px;
  background: var(--table-bg);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  color: var(--table-ink);
  text-align: center;
}

.match-score:focus {
  outline: 2px solid var(--table-ink);
  outline-offset: 1px;
}

.rest-row {
  justify-content: center;
  gap: 6px;
}

.rest-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--table-ink-muted);
}

.rest-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--table-ink);
}

/* FOOTER */
.site-footer {
  background: var(--chrome-bg);
}

.footer-columns {
  padding-top: 40px;
  padding-bottom: 31px;
}

.footer-heading {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: var(--chrome-text);
}

.footer-underline {
  display: block;
  width: 22px;
  height: 3px;
  margin: 8px 0 17px;
  background: var(--chrome-text);
}

.sponsors-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 32px;
  min-height: 64px;
}

.sponsor-img {
  display: block;
  height: 74px;
  width: auto;
  max-width: 161px;
  object-fit: contain;
}

.footer-bottom {
  background: var(--page-bg);
}

/* colors footer */
:root {
  --footer-legal-link: #0b5025;
}

[data-theme="dark"] {
  --footer-legal-link: #1cc45a;
}

.footer-bottom .container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 28px;
  padding-bottom: 28px;
}

.footer-bottom p {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: var(--page-text);
}

.footer-legal-link,
.footer-legal-link:visited {
  color: var(--footer-legal-link);
  text-decoration: underline;
}

.footer-social,
.footer-social:visited {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  color: var(--footer-legal-link);
  text-decoration: none;
}

.footer-social-icon {
  width: 20px;
  height: 20px;
}

/*  INTERRUPTOR MODE DIA / MODE NIT */
.theme-toggle {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 50;
  padding: 7px 14px;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  line-height: 1;
  color: var(--chrome-text);
  background: var(--chrome-bg);
  border: 1px solid var(--chrome-border);
  border-radius: 999px;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.15s;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  opacity: 1;
  border-color: var(--chrome-border-hover);
}

.theme-toggle:focus-visible {
  outline: 2px solid var(--chrome-text);
  outline-offset: 2px;
}

/* RESPONSIVE — MÒVIL*/
@media (max-width: 640px) {
  .container {
    padding-left: 24px;
    padding-right: 24px;
  }

  .header-inner {
    height: auto;
    position: relative;
    justify-content: center;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  .logo-text {
    display: none;
  }

  .logo-icon {
    height: 63.96px;
    width: auto;
  }

  /* passa al menu burguer */
  .header-nav {
    display: none;
  }

  .menu-toggle {
    display: flex;
    position: absolute;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    /* per damunt del overlay */
    z-index: 210;
  }

  /* overlay translucid */
  .menu-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: var(--menu-panel-bg);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 190;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, visibility 0.25s ease;
  }

  .menu-overlay.is-open {
    opacity: 1;
    visibility: visible;
  }

  /* menu desplegable */
  .menu-panel {
    display: flex;
    flex-direction: column;
    gap: 28px;
    position: fixed;
    inset: 0;
    padding: 96px 32px 32px;
    background: transparent;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  .menu-panel.is-open {
    transform: translateX(0);
  }

  .menu-panel-link {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
    color: var(--chrome-text);
    text-decoration: none;
  }

  .header-accent {
    display: block;
  }

  .main {
    padding-top: 26px;
  }

  .standings-section {
    justify-content: center;
    padding-left: 24px;
    padding-right: 24px;
  }

  .home-layout {
    gap: 24px;
  }

  .home-infographic {
    max-width: 240px;
  }

  .home-infographic-caption {
    font-size: 14px;
  }

  /* grid */
  .calendar-list {
    justify-items: center;
  }

  .article-card {
    padding: 28px 24px;
  }

  .document-card {
    padding: 20px 14px;
  }

  .article-title {
    font-size: 20px;
  }

  .article-subtitle {
    font-size: 16.5px;
  }

  .pdf-viewer {
    height: 70vh;
    min-height: 420px;
  }

  .algo-diagram {
    padding: 16px;
  }

  .algo-player {
    min-width: 36px;
    padding: 4px 6px;
    font-size: 12px;
  }

  .algo-row {
    gap: 6px;
  }

  .algo-table-wrap {
    overflow-x: auto;
  }

  .algo-table {
    font-size: 11.5px;
  }

  .algo-code {
    font-size: 11.5px;
    padding: 10px 12px;
  }

  .standings-head {
    height: 32px;
  }

  .footer-heading {
    font-size: 18px;
  }

  .footer-underline {
    margin: 6px 0 10px;
  }

  .sponsors-row {
    gap: 18px;
    min-height: 40px;
  }

  .sponsor-img {
    height: 46px;
    max-width: 104px;
  }

  .footer-bottom .container {
    gap: 14px;
    padding-top: 22px;
    padding-bottom: 22px;
  }

  .theme-toggle {
    right: 14px;
    bottom: 14px;
    padding: 6px 12px;
  }
}
