/**
 * Tabs & accordions (plg_system_contenttabs)
 *
 * Colours and fonts are custom properties, so a template can change them:
 *   .lc-acc, .lc-tabs { --lc-accent: #165153; }
 *
 * @copyright  (C) 2026 License Consult GmbH
 * @license    GNU General Public License version 2 or later
 */

.lc-acc,
.lc-tabs {
  --lc-accent: #165153;          /* selected tab, hover, focus ring */
  --lc-accent-contrast: #fff;    /* text on the accent colour */
  --lc-gold: #b88c58;            /* icon, badge */
  --lc-ink: #222;                /* titles */
  --lc-muted: #6b6b6b;           /* second line of a tab */
  --lc-line: #e5e0d8;            /* dividers */
  --lc-line-strong: #d6cec2;     /* tab borders */
  --lc-soft: #faf7f2;            /* hover background */
  --lc-heading-font: Butler, Georgia, "Times New Roman", serif;
  --lc-scroll-offset: 120px;     /* height of the fixed header, for #anchor jumps */
}

/* ===========================================================================
 * Accordion: native <details>/<summary>
 * ======================================================================== */

.lc-acc {
  margin: 2rem 0;
  border-top: 1px solid var(--lc-line);
}

.lc-acc__item {
  border-bottom: 1px solid var(--lc-line);
  scroll-margin-top: var(--lc-scroll-offset);
}

.lc-acc__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.25rem 0.25rem;
  cursor: pointer;
  list-style: none;              /* hides the default triangle (Firefox) */
}

/* Hides the default triangle (Chrome, Safari) */
.lc-acc__head::-webkit-details-marker {
  display: none;
}

.lc-acc__head:focus-visible {
  outline: 2px solid var(--lc-accent);
  outline-offset: 2px;
}

/* The title is a real heading (h3 by default) – reset the template's
   large heading size so it fits a list of items */
.lc-acc .lc-acc__title {
  margin: 0;
  font-family: var(--lc-heading-font);
  font-size: clamp(1.2rem, 1.05rem + 0.6vw, 1.55rem);
  font-weight: 400;
  line-height: 1.3;
  color: var(--lc-ink);
  transition: color 0.2s ease;
}

/* Bold set in the title by the editor would look too heavy in the serif font */
.lc-acc__title strong {
  font-weight: inherit;
}

.lc-acc__head:hover .lc-acc__title,
.lc-acc__item[open]:not(.is-closing) > .lc-acc__head .lc-acc__title {
  color: var(--lc-accent);
}

/* Round button with a chevron, drawn with two borders of a rotated square */
.lc-acc__icon {
  flex: 0 0 auto;
  position: relative;
  width: 2.25rem;
  height: 2.25rem;
  border: 1px solid var(--lc-gold);
  border-radius: 50%;
  transition: background-color 0.2s ease, transform 0.25s ease;
}

.lc-acc__icon::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0.5rem;
  height: 0.5rem;
  border-right: 2px solid var(--lc-gold);
  border-bottom: 2px solid var(--lc-gold);
  /* -70%: optically centres the chevron, whose tip points down */
  transform: translate(-50%, -70%) rotate(45deg);
}

.lc-acc__head:hover .lc-acc__icon {
  background-color: var(--lc-soft);
}

/* Open: filled circle, chevron points up. "is-closing" is set by the script
   while the closing animation runs: the header looks closed at once */
.lc-acc__item[open]:not(.is-closing) > .lc-acc__head .lc-acc__icon {
  background-color: var(--lc-gold);
  transform: rotate(180deg);
}

.lc-acc__item[open]:not(.is-closing) > .lc-acc__head .lc-acc__icon::before {
  border-color: #fff;
}

/* The body has no padding: the script animates its height between 0 and
   the content height when an item opens or closes (contenttabs.js). The
   spacing is on the inner wrapper instead. */
.lc-acc__inner {
  padding: 0 0.25rem 1.75rem;
}

.lc-acc__inner > :last-child {
  margin-bottom: 0;
}

/* ===========================================================================
 * Tabs
 * ======================================================================== */

.lc-tabs {
  margin: 1.5rem 0 2rem;
}

/* All buttons in one row with the same width (--lc-tab-count is set by the plugin) */
.lc-tabs__list {
  display: grid;
  grid-template-columns: repeat(var(--lc-tab-count, 3), minmax(0, 1fr));
  gap: 0.5rem;
}

.lc-tabs__tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  margin: 0;
  padding: 0.85rem 1rem;
  border: 1px solid var(--lc-line-strong);
  border-radius: 0;
  background: #fff;
  color: var(--lc-ink);
  font: inherit;
  text-align: center;
  cursor: pointer;
  transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.lc-tabs__tab:hover {
  border-color: var(--lc-gold);
  background: var(--lc-soft);
}

.lc-tabs__tab:focus-visible {
  outline: 2px solid var(--lc-accent);
  outline-offset: 2px;
}

.lc-tabs__label {
  font-family: var(--lc-heading-font);
  font-size: 1.05rem;
  line-height: 1.3;
}

.lc-tabs__meta {
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--lc-muted);
}

/* Selected tab: filled with the accent colour and a small arrow to the panel */
.lc-tabs__tab[aria-selected="true"] {
  border-color: var(--lc-accent);
  background: var(--lc-accent);
  color: var(--lc-accent-contrast);
  cursor: default;
}

.lc-tabs__tab[aria-selected="true"] .lc-tabs__meta {
  color: inherit;
  opacity: 0.85;
}

.lc-tabs__tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  bottom: -0.45rem;
  left: 50%;
  width: 0.8rem;
  height: 0.8rem;
  background: var(--lc-accent);
  transform: translateX(-50%) rotate(45deg);
}

/* "Current" badge on the tab of today's season (added by the script) */
.lc-tabs__badge {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.3em 0.55em;
  border-radius: 2px;
  background: var(--lc-gold);
  color: #fff;
  font-family: "Libre Franklin", system-ui, sans-serif;
  font-size: 0.65rem;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  vertical-align: 0.2em;
}

.lc-tabs__tab[aria-selected="true"] .lc-tabs__badge {
  background: #fff;
  color: var(--lc-accent);
}

.lc-tabs__panel {
  padding-top: 1.5rem;
  scroll-margin-top: var(--lc-scroll-offset);
}

.lc-tabs__panel:focus-visible {
  outline: 2px solid var(--lc-accent);
  outline-offset: 4px;
}

.lc-tabs__panel > :last-child {
  margin-bottom: 0;
}

/* Price tables and similar (in tabs and directly in accordion sections):
   thin row lines, light hover */
.lc-tabs__panel table,
.lc-acc__body table {
  width: 100%;
  border-collapse: collapse;
}

.lc-tabs__panel td,
.lc-tabs__panel th,
.lc-acc__body td,
.lc-acc__body th {
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--lc-line);
  vertical-align: middle;
}

.lc-tabs__panel tr:last-child > td,
.lc-acc__body tr:last-child > td {
  border-bottom: 0;
}

.lc-tabs__panel tbody tr:not(:first-child):hover {
  background: var(--lc-soft);
}

/* Lists directly in an accordion section or a tab (e.g. "Notes", offers):
   rows with lines in between, like the tables, instead of bullet points */
.lc-acc__inner > ul,
.lc-tabs__panel > ul {
  margin: 0 0 1rem;
  padding: 0;
  list-style: none;
}

.lc-acc__inner > ul > li,
.lc-tabs__panel > ul > li {
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid var(--lc-line);
}

.lc-acc__inner > ul > li:last-child,
.lc-tabs__panel > ul > li:last-child {
  border-bottom: 0;
}

/* ---------------------------------------------------------------------------
 * Phones: tabs as a list of choices, one below the other, with a radio dot
 * ------------------------------------------------------------------------ */
@media (max-width: 639.98px) {
  .lc-tabs__list {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }

  .lc-tabs__tab {
    align-items: flex-start;
    padding: 0.7rem 1rem 0.7rem 2.75rem;
    text-align: left;
  }

  /* Radio dot: empty circle, filled when selected */
  .lc-tabs__tab::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 1rem;
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--lc-line-strong);
    border-radius: 50%;
    transform: translateY(-50%);
  }

  .lc-tabs__tab[aria-selected="true"]::before {
    border-color: var(--lc-accent-contrast);
    background: radial-gradient(circle, var(--lc-accent-contrast) 0 40%, transparent 45%);
  }

  /* No arrow in the list layout */
  .lc-tabs__tab[aria-selected="true"]::after {
    content: none;
  }

  .lc-tabs__panel {
    padding-top: 1rem;
  }

  .lc-tabs__panel table {
    font-size: 0.875rem;
  }

  /* The editor gives every column a fixed share (e.g. 33 %); on a phone the
     browser should size the columns by their content instead, so prices
     like "180,- CHF / 200,- CHF" fit on one line */
  .lc-tabs__panel col {
    width: auto !important;
  }

  .lc-tabs__panel td:last-child {
    white-space: nowrap;
  }

  .lc-tabs__panel td,
  .lc-tabs__panel th,
  .lc-acc__body td,
  .lc-acc__body th,
  .lc-acc__inner > ul > li,
  .lc-tabs__panel > ul > li {
    padding: 0.5rem 0.3rem;
  }

  .lc-acc__head {
    padding: 1rem 0;
  }

  .lc-acc__inner {
    padding: 0 0 1.5rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .lc-acc__icon,
  .lc-acc__title,
  .lc-tabs__tab {
    transition: none;
  }
}

/* ---------------------------------------------------------------------------
 * Print: everything open, each tab panel with its title as heading
 * ------------------------------------------------------------------------ */
@media print {
  .lc-acc__icon,
  .lc-tabs__list {
    display: none;
  }

  .lc-acc__item::details-content {
    height: auto;
    content-visibility: visible;
  }

  .lc-tabs__panel[hidden] {
    display: block !important;
    content-visibility: visible !important;
  }

  .lc-tabs__panel::before {
    content: attr(data-label);
    display: block;
    margin: 1rem 0 0.5rem;
    font-weight: 600;
  }
}
