/**
 * @file
 * Find Information for My Region section.
 */

.sml-region__box {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  grid-template-rows: minmax(0, auto);
  border: 3px solid var(--sml-black);
  border-radius: 20px;
  border-bottom-left-radius: 10px;
  overflow: hidden;
  background: var(--sml-white);
}

/* Region tab list. */
.sml-region__nav {
  display: flex;
  flex-direction: column;
  grid-column: 1;
  grid-row: 1;
  align-self: stretch;
  background: var(--sml-gray);
  border-right: 3px solid var(--sml-black);
}

.sml-region__nav ul {
  display: block;
  flex: 0 0 auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sml-region__nav li {
  display: block;
  flex: none;
}

/* Figma tab row height: 88px (node 1368:778 rail; active chip 1368:780 is 97px at top). */
.sml-region__tab {
  position: relative;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  width: 100%;
  height: 88px;
  min-height: 88px;
  max-height: 88px;
  padding: 0 clamp(1.5rem, 3vw, 2rem);
  font-family: var(--sml-font-code-pro);
  font-weight: 400;
  font-size: 1.375rem;
  color: var(--sml-black);
  text-decoration: none;
  background: var(--sml-gray);
  border-bottom: 3px solid var(--sml-black);
}

/* Active/hover tab covers the nav rail so it blends into the panel. The
 * cover sits in the padding box only, so the bottom border strip stays open
 * and the vertical rail meets the horizontal separator. */
.sml-region__tab.is-active,
.sml-region__tab:hover,
.sml-region__tab:focus {
  font-family: var(--sml-font-code-pro-bold);
  font-weight: 700;
  color: var(--sml-black);
  background: var(--sml-white);
  text-decoration: none;
  outline: none;
}

.sml-region__tab.is-active::after,
.sml-region__tab:hover::after,
.sml-region__tab:focus::after {
  content: "";
  position: absolute;
  top: 0;
  right: -3px;
  bottom: 0;
  width: 3px;
  background: var(--sml-white);
}

.sml-region__tab:focus-visible {
  outline: none;
  box-shadow: inset 4px 0 0 var(--sml-black);
}

/* Detail panel.
 * Row height is driven by the left tab stack. Panels fill that height and
 * scroll if their content is taller, so the box stays no taller than the tabs.
 * Inactive panels stay in the same grid cell (visibility only). */
.sml-region__panel {
  grid-column: 2;
  grid-row: 1;
  box-sizing: border-box;
  height: 0;
  min-height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  padding: clamp(1.5rem, 3vw, 2.5rem);
  background: var(--sml-white);
}

.sml-region__panel[hidden] {
  display: block !important;
  visibility: hidden;
  pointer-events: none;
  z-index: 0;
}

.sml-region__panel:not([hidden]) {
  position: relative;
  z-index: 1;
}

.sml-region__division-title {
  margin: 0;
  font-family: var(--sml-font-code-pro-bold);
  font-weight: 700;
  font-size: 1.75rem;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--sml-black);
}

.sml-region__division-body {
  margin: 1rem 0 1.5rem;
  font-family: var(--sml-font-jost);
  font-size: 1.125rem;
  line-height: 35px;
}

.sml-region__events-title {
  margin: 0.75rem 0 1rem;
  font-family: var(--sml-font-code-pro-bold);
  font-weight: 700;
  font-size: 1.375rem;
  line-height: 42px;
}

.sml-region__panel > .sml-region__events-title:first-child {
  margin: 0 0 1rem;
  font-size: 1.75rem;
  line-height: 1.1;
  padding-bottom: 1rem;
  border-bottom: 2px solid var(--sml-black);
}

.sml-region__subtitle {
  margin: 0 0 1.5rem;
  font-family: var(--sml-font-lexend);
  font-weight: 400;
  font-size: 1.125rem;
  line-height: 1.5;
}

.sml-region__events {
  margin: 0;
  padding: 0;
  list-style: none;
}

.sml-region__event {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1rem 0;
  border-bottom: 2px solid var(--sml-black);
}

.sml-region__dates {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 1rem;
}

.sml-region__date-separator {
  width: 17px;
  height: 0;
  border-top: 3px solid var(--sml-black);
}

.sml-region__grant {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.25rem;
}

.sml-region__status {
  margin: 0;
  font-family: var(--sml-font-code-pro-bold);
  font-weight: 700;
  font-size: 0.875rem;
  line-height: 1.2;
  text-transform: uppercase;
}

.sml-region__status--open {
  color: var(--sml-purple);
}

.sml-region__status--closed {
  color: var(--sml-black);
}

/* Purple date badge (extends the shared .card-date-badge). */
.sml-region__date {
  flex: 0 0 57px;
  width: 57px;
  height: 106px;
  border: 3px solid var(--sml-black);
  border-radius: 4px;
}

.sml-region__date .month {
  font-family: var(--sml-font-jost);
  font-weight: 600;
  font-size: 1rem;
}

.sml-region__date .day {
  font-family: var(--sml-font-code-pro-bold);
  font-weight: 700;
  font-size: 2rem;
}

.sml-region__date .year {
  font-family: var(--sml-font-lexend);
  font-weight: 600;
  font-size: 1rem;
}

.sml-region__event-title {
  display: flex;
  flex-direction: column;
  font-family: var(--sml-font-jost);
  font-weight: 700;
  font-size: 1.125rem;
  line-height: 20px;
  color: var(--sml-black);
  text-decoration: none;
}

.sml-region__event-title:hover,
.sml-region__event-title:focus {
  text-decoration: none;
  color: var(--sml-purple);
}

.sml-region__grant-title {
  font-size: 1.375rem;
  line-height: 1.27;
  text-decoration: underline;
}

.sml-region__grant-title:hover,
.sml-region__grant-title:focus {
  text-decoration: underline;
}

.sml-region__grant-title.is-closed .sml-region__event-name {
  text-decoration: line-through;
}

.sml-region__footer {
  margin-top: 1.5rem;
  text-align: right;
}

.sml-region__footer .sml-arrow-link {
  text-decoration: underline;
}

/* Mobile picker is JS-only; stacked tabs remain the no-JS fallback. */
.sml-region__picker {
  display: none;
}

@media (max-width: 767px) {
  .sml-region__box {
    grid-template-columns: 1fr;
  }

  .sml-region__nav {
    grid-column: 1;
    grid-row: 1;
    border-right: 0;
  }

  .sml-region__panel {
    grid-column: 1;
    grid-row: 2;
    height: auto;
    min-height: 0;
    overflow: visible;
  }

  .sml-region__tab.is-active::after,
  .sml-region__tab:hover::after,
  .sml-region__tab:focus::after {
    content: none;
  }

  html.js .sml-region__picker {
    display: block;
    margin: 0 0 1.25rem;
  }

  html.js .sml-region__select {
    display: block;
    box-sizing: border-box;
    width: 100%;
    max-width: none;
    height: 60px;
    padding: 12px 52px 12px 14px;
    font-family: var(--sml-font-jost);
    font-weight: 400;
    font-size: 1rem;
    line-height: 35px;
    color: var(--sml-black);
    background-color: var(--sml-white);
    background-image: url("../../images/icons/arrow-drop-down.svg");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 29.5px 29.5px;
    border: 3px solid var(--sml-black);
    border-radius: 5px;
    appearance: none;
  }

  html.js .sml-region__select:focus {
    border: 3px solid var(--sml-black);
    outline: 2px solid var(--sml-black);
    outline-offset: 2px;
  }

  html.js .sml-region__box {
    display: flex;
    flex-direction: column;
    overflow: visible;
    background: transparent;
    border: 0;
    border-radius: 0;
  }

  html.js .sml-region__nav {
    z-index: 1;
    align-self: stretch;
    margin: 0 10px -3px;
    background: transparent;
    border: 0;
  }

  html.js .sml-region__nav li:not(:has(.is-active)) {
    display: none;
  }

  html.js .sml-region__tab,
  html.js .sml-region__tab.is-active,
  html.js .sml-region__tab:hover,
  html.js .sml-region__tab:focus {
    height: auto;
    min-height: 0;
    max-height: none;
    padding: 0.85rem 0.875rem 1rem;
    font-family: var(--sml-font-code-pro-bold);
    font-weight: 700;
    font-size: 1.5rem;
    line-height: 1.2;
    color: var(--sml-black);
    background: var(--sml-white);
    border: 3px solid var(--sml-black);
    border-bottom-color: var(--sml-white);
    border-radius: 10px 10px 0 0;
    pointer-events: none;
  }

  html.js .sml-region__panel {
    z-index: 0;
    padding: 1.75rem 1.125rem 1.5rem;
    overflow: visible;
    border: 3px solid var(--sml-black);
    border-radius: 10px;
  }

  html.js .sml-region__panel[hidden] {
    display: none !important;
  }

  .sml-region__division-title,
  .sml-region__panel > .sml-region__events-title:first-child {
    font-size: 1.5rem;
    line-height: 1.2;
    padding-bottom: 0.75rem;
  }

  .sml-region__division-title {
    border-bottom: 0;
  }

  .sml-region__division-body {
    margin: 0.75rem 0 1rem;
    font-size: 1rem;
    line-height: 1.5;
  }

  .sml-region__events-title {
    font-size: 1.125rem;
    line-height: 1.5;
  }

  .sml-region__division-title + .sml-region__events-title,
  .sml-region__division-body + .sml-region__events-title {
    margin-top: 0;
    padding-top: 0.75rem;
    border-top: 2px solid var(--sml-black);
  }

  .sml-region__event {
    border-bottom-color: var(--sml-black);
  }

  .sml-region__event-title {
    font-size: 1rem;
    line-height: 1.5;
  }
}

@media (min-width: 1500px) {
  .sml-region__box {
    grid-template-columns: 303px minmax(0, 1fr);
    max-width: 1387px;
  }

  .sml-region__tab {
    padding: 0 2rem;
  }

  .sml-region__panel {
    padding: 2.625rem 3.375rem 2.5rem 4rem;
  }

  .sml-region__division-body {
    max-width: 988px;
  }

  .sml-region__events {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: 2.125rem;
  }

  .sml-region__event {
    min-height: 129px;
    align-items: flex-start;
  }

  .sml-region__footer {
    margin-top: 2rem;
  }
}
