/* ==========================================================================
   TeamTrek V5 — Footer link columns
   --------------------------------------------------------------------------
   Loaded only by index-v5.html. css/sections.css and css/responsive.css are
   shared with v1, v3 and v4, and they size .footer__cols for three groups:
   two columns to 600px, three above it. This page carries four.

   Nothing else in the footer changes — the brand block, the status chip, the
   social row, the ghosted wordmark and the bottom bar are all untouched, and
   js/footer-v3.js still turns these same groups into accordions below
   1024px, reading them straight out of the markup.
   ========================================================================== */

/* Four groups, so four columns once there is room for them. Below 1024px the
   accordion takes over and these never apply.

   Every rule here names .footer as well as the part it sets. The shared
   sheets size the same two containers for three groups -- responsive.css
   asks for three columns from 600px and a .95fr/1.35fr top -- and whichever
   file loads last used to win, which made the footer's layout depend on the
   order of two <link> tags. One extra class decides it instead: the sheet
   that knows there are four groups outranks the one that assumes three. */
@media (min-width: 1024px) {
  .footer .footer__cols { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.75rem; }

  /* The link block needs more of the row than it did with three groups, so
     the brand column gives some back. Shared value was .95fr / 1.35fr. */
  .footer .footer__top { grid-template-columns: minmax(0, .8fr) minmax(0, 1.7fr); gap: 3.5rem; }

  /* The lists start at the same line as the brand blurb and run to their own
     length: four groups of 4, 3, 6 and 5 links are uneven by nature, and
     padding them out would mean inventing entries. A straight top edge and a
     ragged bottom is what a footer is. */
  .footer .footer__cols > div { align-content: start; }

  /* 15px links in a 200px column wrap "Project & Task Tracking" and
     "Templates & Tools" onto a second line, which breaks the row rhythm
     against the neighbouring columns. 14px holds all twenty on one line. */
  .footer .footer__links a { font-size: .875rem; }
  .footer .footer__links { gap: .625rem; }
}

/* Between 600px and 1023px the shared sheet asks for three columns and the
   accordion has not taken over yet on the widest of those — two columns of
   four groups reads better than three plus an orphan. */
@media (min-width: 600px) and (max-width: 1023px) {
  /* :not(--acc) matters: js/footer-v3.js rebuilds these groups as accordion
     rows below 1024px and marks the container .footer__cols--acc, which
     css/product-v3.css lays out as a single column. This sheet loads after
     that one at equal specificity, so without the guard it would win and
     split the accordion into two columns. */
  .footer .footer__cols:not(.footer__cols--acc) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ==========================================================================
   Footer link groups — collapsible below 1024px
   --------------------------------------------------------------------------
   Three lists of four or five links stacked on a phone is a long scroll for
   a footer. Below 1024px js/footer-v3.js rebuilds each group as a row that
   opens: group name, chevron, links underneath, one open at a time.

   >= 1024px nothing here applies, so laptop and desktop keep the three
   columns exactly as they were.

   The collapse is the same 0fr -> 1fr grid row the FAQ uses, so the panel
   animates to its own content height without anything measuring it.
   ========================================================================== */

@media (max-width: 1023px) {
  /* One group per row. Above 600px the base sheet puts these in three
     columns, which an accordion cannot use. */
  .footer .footer__cols--acc { grid-template-columns: minmax(0, 1fr); gap: 0; }

  .footer .footer__group { border-top: 1px solid rgba(255, 255, 255, .1); }
  .footer .footer__group:last-child { border-bottom: 1px solid rgba(255, 255, 255, .1); }

  .footer .footer__coltoggle {
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem;
    width: 100%;
    /* A footer row is a big tap target on purpose: it is the last thing on
       the page and usually reached one-handed. */
    min-height: 56px;
    padding-block: .5rem;
    text-align: left;
  }
  /* The group name steps up from the desktop micro-label: at this size it is
     a row heading you tap, not a caption above a visible list. */
  .footer .footer__cols--acc .footer__coltitle {
    font-size: 1rem; font-weight: var(--weight-bold);
    text-transform: none; letter-spacing: -.01em; color: #fff;
  }

  .footer .footer__colchev {
    display: grid; place-items: center; flex: none;
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .16);
    color: var(--neutral-300);
    transition: transform var(--dur-ui) var(--ease-brand),
                background-color var(--dur-micro) var(--ease-ui),
                border-color var(--dur-micro) var(--ease-ui),
                color var(--dur-micro) var(--ease-ui);
  }
  .footer .footer__coltoggle[aria-expanded="true"] .footer__colchev {
    transform: rotate(180deg);
    background: var(--primary-600); border-color: var(--primary-600); color: #fff;
  }

  .footer .footer__colpanel {
    display: grid; grid-template-rows: 0fr;
    transition: grid-template-rows var(--dur-ui) var(--ease-brand);
  }
  .footer .footer__colpanel > div { min-height: 0; overflow: hidden; }
  .footer .footer__colpanel.is-open { grid-template-rows: 1fr; }
  /* Padding on the list rather than the panel: a closed panel with padding
     still occupies those pixels, so the rows would never fully collapse. */
  .footer .footer__cols--acc .footer__links {
    margin-top: 0;
    padding-bottom: 1.25rem;
    gap: 0;
  }
  .footer .footer__cols--acc .footer__links a {
    display: block;
    padding-block: .625rem;
    font-size: 1rem;
  }
}

/* Under 1024px the wordmark follows the accordion instead of a block of
   links, so it needs the space the list's own margin used to provide. */
@media (max-width: 1023px) {
  .footer .footer__cols--acc + .footer__wordmark,
  .footer .footer__top:has(.footer__cols--acc) + .footer__wordmark { margin-top: 2.5rem; }
}


/* The social row's buttons are 34px. Enough for a pointer, not for a thumb,
   and they sit at the foot of a page a phone is likely to be reading. The
   icon inside keeps its size; only the target grows. */
@media (hover: none) {
  .footer .footer__social a { width: 44px; height: 44px; }
}
