/* MAIN */
body:has(#main) {
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "nav"
    "main"
    "footer";
}

#go-top {
  z-index: 2;
  font-size: 2rem;
  opacity: 0.7;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: fit-content;
  height: fit-content;
  margin: auto 2rem -4rem auto;
  padding: .5rem;
  color: var(--primary-foreground);
  background-color: var(--primary);
  border-radius: .25rem;
  transform: rotate(-90deg) scale(1) translateX(0);
  transition: opacity 200ms ease-in, transform 350ms ease;

  &.active {
    transform: rotate(-90deg) scale(1) translateX(5rem);
  }

  &:hover {
    opacity: .8;
    cursor: pointer;
  }

  &:active {
    transform: rotate(-90deg) scale(.9) translateX(5rem);
    background-color: color-mix(in hsl, var(--foreground) 90%, transparent);
    opacity: 1;
  }
}

/* NAV ELEMENT */
nav {
  grid-template-columns: 1fr 2fr 1fr;
  grid-template-areas: "logo links .";
  gap: 4rem;
  padding: 0.75rem 2.5rem;
}


.nav-menu-btn {
  display: none;
  height: 3.25rem;
  fill: var(--nav-foreground);
  transition: fill 300ms ease-in-out;

  &:active {
    fill: color-mix(in hsl, var(--nav-foreground) 80%, var(--nav) 20%);
  }
}

#navbar-logo {
  grid-area: logo;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 1rem;

  & img {
    height: 3.25rem;
  }
}

#navbar-links {
  grid-area: links;
  display: flex;
  justify-content: center;
  gap: 1.5rem;

  & li {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}

#main {
  grid-area: main;
}

body:has(#alt) {
  height: 100%;
  display: grid;
  background-color: var(--background);

  main#alt {
    display: grid;
    height: 100%;

    &>article {
      margin: auto;
      padding: 2rem 1rem;
    }
  }
}

#footer {
  color: var(--nav-foreground);
  background-color: var(--nav);
  grid-area: footer;

  &>article {
    display: grid;
    grid-template-rows: auto auto;
    grid-template-columns: auto auto auto;
    grid-template-areas:
      "addr time logo"
      "tel mail logo"
    ;
    row-gap: 1rem;

    & ul {
      display: grid;

      & li {
        margin-bottom: .25rem;
      }
    }

    & .footer-title {
      font-size: 1.65rem;
      font-family: Didot, serif;
    }

    & .tel {
      grid-area: tel;
    }

    & .addr {
      grid-area: addr;
    }

    & .mail {
      grid-area: mail;
    }

    & .time {
      grid-area: time;
    }

    & .logo {
      grid-area: logo;
      font-family: 'Cinzel';
      text-align: center;
      font-size: 2rem;
      line-height: 2rem;
      margin-block: auto;

      & img {
        display: block;
        width: 200px;
        margin-inline: auto;
        margin-bottom: 0.75rem;
      }
    }
  }
}

.list-mark::before {
  content: '\2022';
  color: var(--accent);
  font-weight: bolder;
  margin-right: .5rem;
}

.card-btn {
  padding: .5rem;
  background-color: var(--secondary);
  color: var(--secondary-foreground);
  border-radius: 8px;
  width: 200px;
  text-align: center;

  &:hover {
    background-color: color-mix(in hsl, var(--secondary) 90%, var(--secondary-foreground) 10%);
  }

  & .title {
    font-family: Didot, serif;
    font-size: 1.75rem;
    line-height: 1.75rem;
    margin-bottom: 0.75rem;
  }

  & ul {
    display: grid;
    line-height: 1.25rem;
  }

  & svg {
    display: block;
    max-width: 75px;
    fill: var(--secondary-foreground);
    margin: auto;
  }
}

.stcc {
  font-family: 'Cinzel', Georgia, serif;
  color: var(--nav-foreground);
  text-align: center;
  font-size: 1.75rem;
  line-height: 1.5rem;
}

.homepage {
  display: grid;
  width: 100%;
  justify-items: center;
  gap: 3rem;
  padding-block: 4rem;
  padding-inline: 1rem;
  background-color: var(--background);

  &:nth-child(even) {
    background-color: color-mix(in hsl, var(--background) 98%, var(--foreground) 2%);
  }

  &>* {
    max-width: 78rem;
    width: 100%;
  }
}

.event-container {
  display: grid;
  grid-template-columns: 5fr 4fr;
  grid-template-areas: "img-evt evt-group";
  gap: 2rem;
}

.seasonal-display {
  display: grid;
  grid-template-rows: min-content;
  background-position: center 70%;
  background-repeat: no-repeat;
  border-radius: 3rem;
  background-size: cover;
  grid-area: img-evt;
  width: 100%;
  padding: .5rem;

  & h3 {
    color: white;
    padding-inline: 1rem;
    margin-inline: auto;
    font-size: 1.75rem;
    border-radius: 3rem;
    background-color: rgba(40, 40, 40, 0.4);
  }
}

.event-group {
  grid-area: evt-group;
  padding-block: 1.5rem;

  & .evt span {
    display: block;
    width: 300px;
    text-wrap: balance;
  }
}

.evt-date {
  grid-area: evt;
  position: relative;
  font-family: Didot, serif;
  z-index: 1;
  font-size: 1.25rem;
  color: var(--card-foreground);
  padding-block: .125rem;
  font-weight: 600;
  padding-left: 1rem;

  &::after {
    content: '';
    z-index: -1;
    width: 280px;
    top: 0;
    left: 0;
    position: absolute;
    border: 1px solid var(--border);
    border-left: 4px solid var(--accent);
    height: 100%;
    transform: skew(25deg);
    background: var(--card);
  }

  &.active {

    &::after {
      border-color: var(--accent);
    }

    &+.evt-title::before {
      content: '\2726';
      font-weight: bolder;
    }
  }
}

.section-title {
  padding-block: 1rem;
}

.evt-title {
  padding: .25rem .5rem;
  font-weight: 500;
  color: var(--foreground);

  &::before {
    content: '\2022';
    font-weight: bolder;
    margin-right: 0.5rem;
    color: var(--accent);
  }

  &+span {
    position: relative;
    padding-left: 2rem;
  }

  &+span::before {
    content: '\21AA';
    position: absolute;
    left: .5rem;
  }
}

.evt-month {
  display: grid;

  &>h2 {
    font-family: Didot, serif;
    font-size: 2rem;
    border-bottom: 4px solid var(--accent);
    margin-bottom: .5rem;
    background-color: var(--background);
    line-height: 2.125rem;
  }

  & p {
    font-family: Didot, serif;
    font-size: 1.125rem;
    font-weight: 600;
  }

  & .evt-month-body {
    padding: .25rem .75rem;

    & ul:not(:last-child) {
      margin-bottom: .75rem;
    }
  }
}

.list-panel {
  grid-template-columns: auto 620px;
  max-width: 64rem;
  margin-inline: auto;
  margin-block: 3rem;
  gap: 6rem;

  & .sticky {
    top: 2rem;
    padding: 1.5rem;
    border-radius: .25rem;
    background-color: color-mix(in hsl, var(--card) 50%, transparent 50%);
  }
}

.announcement {
  display: none;
  padding: 2rem 1.25rem;
  opacity: 0;
  transition: opacity 350ms 150ms ease-in;

  &.open {
    display: block;
    opacity: 1;

    @starting-style {
      opacity: 0;
    }
  }


  &::after {
    content: 'Saint Charles College';
    font-family: 'Cinzel';
    font-size: 1.75rem;
    display: block;
    width: 100%;
  }

  &>*:last-child::after {
    content: 'Saludos cordiales,';
    border-top: 1px solid var(--border);
    display: block;
    margin-top: 1.5rem;
    padding-top: .5rem;
  }

  & .separator {
    border-bottom: 1px solid var(--border);
  }

  & .ann-subttl {
    margin-bottom: 1.5rem;
    font-weight: 600;
  }

  & .ann-list-title {
    font-size: 1.25rem;
    font-weight: 500;
  }

  & .ann-link-list {
    margin-bottom: 1.5rem;
    margin-left: .5rem;
    display: grid;

    & a {
      color: var(--primary);

      &::before {
        content: '\2022';
        font-weight: bolder;
        margin-right: .5rem;
        color: var(--accent);
      }
    }
  }

  & .ann-img {
    display: block;
    width: 100%;
    aspect-ratio: 1.78;
    object-fit: cover;
    object-position: center;
    border-radius: .5rem;

    &+p {
      margin-bottom: 1rem;
      text-align: center;
      font-style: italic;
      font-weight: 300;
    }
  }

  & .ann-txt {
    display: grid;
    color: var(--card-foreground);
    gap: 1rem;

    &:not(:last-child) {
      margin-bottom: 1.5rem;
    }

  }

  & .ann-cmp {
    margin-bottom: 1.5rem;
  }

  & .ann-list {
    display: grid;
    margin-left: 1rem;
    margin-bottom: 1.5rem;

    & b::before {
      content: '\2022';
      margin-right: .5rem;
      color: var(--accent);
    }

    & b::after {
      content: ':';
    }
  }
}

.annmnt {
  display: grid;
  max-width: 300px;
  grid-template-rows: auto auto 1fr;
  gap: 1rem;
  padding: 2rem 1rem;
  transition: border-color 150ms ease-out;

  &:has(img:hover, img:active, .link:hover, .link:active) {
    border-color: color-mix(in hsl, var(--primary) 70%, transparent);
  }

  & .card-title {
    margin-block: .25rem;
  }

  .annmnt-date {
    font-weight: 550;
    opacity: .5;
  }

  .annmnt-subt {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1rem;
    border-top: 1px solid var(--border);
    padding-top: .125rem;

  }


  & img {
    width: 100%;
    border-radius: .5rem;
    aspect-ratio: 1.4;
    object-position: center;
    object-fit: cover;
  }

}


svg.inline-card {
  vertical-align: text-bottom;
  fill: var(--card-foreground);
  margin-right: .5rem;
  opacity: .8;
}

.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-flow: row;
  justify-items: center;
  gap: 1rem;
  max-width: 70rem;
  margin: 3rem auto;
  padding-inline: 1rem;


  & .doc {
    display: grid;
    padding: 1.5rem 1rem;
    width: 100%;
    overflow: hidden;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "img title"
      "img body";
    column-gap: 0.75rem;
    row-gap: .5rem;
    text-wrap: balance;

    &:hover {
      border-color: var(--accent);
    }

    & img {
      width: 75px;
      grid-area: img;
      margin: auto;
    }

    & .title {
      grid-area: title;
      font-size: 1.5rem;
      font-weight: 600;
      font-family: Didot, serif;
      color: var(--card-foreground);
    }

    & .body {
      grid-area: body;
      color: color-mix(in hsl, var(--card-foreground) 80%, transparent)
    }
  }

}

a.telnum,
a.mailto,
a.google-maps {
  color: var(--nav-foreground);
  font-weight: 450;
  display: block;
  width: fit-content;
  line-height: 1rem;

  &:hover {
    color: color-mix(in hsl, var(--nav-foreground) 90%, transparent 10%);
  }
}

.inline-svg {
  fill: var(--nav-foreground);
}

.pop {
  border: none;
  background-color: transparent;
  cursor: pointer;

  &::after {
    content: '\003F';
    font-weight: bolder;
    color: var(--primary);
    background-color: var(--nav-foreground);
    padding: .25rem;
    border-radius: 50%;
  }

}

.swipe-container {
  display: grid;
  gap: 2rem;
}

.swipe-body {
  display: flex;
  gap: 1rem;
  justify-content: space-evenly;

  &>.swipe-item {
    display: grid;
  }
}

.swipe-indicator {
  display: none;
  margin-inline: auto;
  margin-top: -1rem;
}

.indicator {
  fill: var(--border);
  margin-inline: .25rem;
  transition: fill 250ms ease-out;

  &.active {
    fill: var(--accent);
    transition: fill 0ms ease;
  }
}

.gallery-container {
  display: grid;
  max-width: 68rem;
  margin-inline: auto;
  margin-block: 3rem;
  gap: 2rem;
}

.gallery-preview {
  display: grid;
  padding: 2rem;
  gap: 2rem;
  grid-template-columns: 2fr 3fr;
  grid-template-areas: "description cover";
  transition: border-color 150ms ease-out;

  &:has(img:hover, img:active, .link:hover, .link:active) {
    border-color: color-mix(in hsl, var(--primary) 70%, transparent);
  }

  & .description {
    grid-area: description;
    display: grid;
    gap: 1rem;

    h3 {
      text-decoration: underline;
      text-decoration-color: var(--accent);
      text-decoration-thickness: 4px;
    }

    p {
      color: var(--card-foreground);
    }
  }

  & .img-cover {
    grid-area: cover;
    border-radius: .5rem;
    width: 100%;
    height: 350px;
    object-fit: cover;

    &:hover {
      cursor: pointer;
    }
  }
}

.modal-container {
  position: fixed;
  display: none;
  width: 100%;
  height: 100dvh;
  top: 0;
  left: 0;
  z-index: 5;
  background-color: var(--background);

  &:has(.open) {
    display: grid;
  }

  & .gallery-modal {
    display: none;
    position: relative;
    place-content: center;
    /* grid-template-columns: auto 1fr auto; */
    /* grid-template-areas: */
    /* "aside-left main-gallery aside-right"; */
    transition: opacity 350ms ease-in;
    opacity: 0;

    &.open {
      display: grid;
      opacity: 1;

      @starting-style {
        opacity: 0;
      }
    }

    &:has(picture.active:first-child) .left span,
    &:has(picture.active:last-child) .right span {
      pointer-events: none;
      opacity: .15;
    }

    & aside {
      position: absolute;
      display: grid;
      z-index: 5;
      place-items: center;
      padding-inline: 1rem;
      align-self: center;

      &.left {
        justify-self: start;
      }

      &.right {
        justify-self: end;
      }

      & span {
        padding-inline: 1rem;
        border-radius: .25rem;
        font-size: 3.5rem;
        user-select: none;
        cursor: pointer;
        background-color: color-mix(in hsl, var(--background) 20%, transparent);

        &:hover {
          color: color-mix(in hsl, var(--card-foreground) 75%, transparent);
        }

        &:active {
          color: color-mix(in hsl, var(--card-foreground) 25%, transparent);
        }
      }
    }
  }
}

.main-gallery {
  display: grid;
  grid-area: main-gallery;
  width: 100%;
  gap: 1rem;
  overflow-x: hidden;
  grid-auto-flow: column;
  grid-auto-columns: 100%;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;

  &>.entry {
    display: grid;
    background-color: red;
    scroll-snap-align: center;
    scroll-snap-stop: always;
    margin: auto;


    & .entry-info {
      position: absolute;
      display: none;
      left: 0;
      right: 0;
      bottom: 0;
      top: 0;
      margin: auto auto 1rem;
      width: fit-content;
      height: fit-content;
      padding: .5rem;
      opacity: 0;
      gap: .5rem;
      border-radius: .5rem;
      background-color: color-mix(in hsl, var(--card) 70%, transparent);

      & svg {
        fill: var(--card-foreground);
        width: 2rem;

        &:hover {
          fill: color-mix(in hsl, var(--card-foreground) 75%, transparent);
          cursor: pointer;
        }

        &:active {
          fill: color-mix(in hsl, var(--card-foreground) 25%, transparent);
        }
      }
    }

    &.active {

      & source,
      & img {
        opacity: 1;
      }

      & .entry-info {
        display: flex;
        opacity: 1;
        transition: opacity 350ms 100ms ease-out;

        @starting-style {
          opacity: 0;
        }
      }
    }

    &:has(.entry-caption-toggle:hover, .entry-caption-toggle:active).active .entry-caption {
      display: grid;
    }

    & .entry-caption {
      position: absolute;
      left: 0;
      right: 0;
      bottom: 0;
      top: 0;
      margin: auto;
      border: none;
      width: fit-content;
      height: fit-content;
      font-size: 14px;
      padding: 1rem;
      max-width: 85%;
      display: none;
      background-color: color-mix(in hsl, var(--card) 85%, transparent);
      border-radius: .5rem;
    }

    & source,
    & img {
      max-height: 100dvh;
      max-width: 100%;
      margin: auto;
      opacity: 0.25;
      transition: opacity 500ms ease-in;
    }
  }
}

.pager {
  position: absolute;
  text-align: center;
  left: 0;
  right: 0;
  bottom: 0;
  top: 0;
  margin: 1rem auto auto;
  width: fit-content;
  height: fit-content;
  font-weight: 500;
  min-width: 5.5rem;
  background-color: color-mix(in hsl, var(--card) 70%, transparent);
  color: var(--card-foreground);
  padding: .25rem .75rem;
  border-radius: 1rem;
  z-index: 6;
}

svg.close {
  position: absolute;
  justify-self: end;
  width: 3rem;
  z-index: 5;
  top: 1rem;
  right: 1rem;
  fill: var(--card-foreground);
  cursor: pointer;
  border-radius: .25rem;

  &:hover {
    fill: color-mix(in hsl, var(--card-foreground) 75%, transparent);
  }

  &:active {
    fill: color-mix(in hsl, var(--card-foreground) 25%, transparent);
  }
}

html:has(.gallery-modal.open) {
  overflow: hidden;
}

/* =========================================================== */

@media only screen and (max-width: 950px) {
  .stcc {
    display: none;
  }

  .homepage {
    padding-inline: 1rem;
  }


  #footer>article {
    grid-template-columns: 1fr;
    grid-template-rows: repeat(5, auto);
    grid-template-areas: "addr" "time" "tel" "mail" "logo";
    gap: 2rem;
  }

  .info-grid {
    grid-template-columns: 1fr;
    padding-inline: 1rem;

    & .doc {
      max-width: 240px;
      grid-template-columns: auto;
      grid-template-rows: auto auto auto;
      grid-template-areas:
        "img"
        "title"
        "body";
      column-gap: 1rem;

      & p {
        text-align: center;
      }
    }
  }

  .evt-month {
    grid-template-rows: min-content 0fr;
    transition: grid-template-rows 500ms ease-in-out;

    & h2 {
      display: flex;
      border-color: var(--border);

      &::before {
        content: '\276F';
        font-size: 1.5rem;
        color: var(--accent);
        margin-inline: .5rem 1rem;
        transform: rotate(90deg);
        transition: transform 300ms ease;
      }
    }

    & .evt-month-body {
      overflow: hidden;
    }

    &.active {
      grid-template-rows: min-content 1fr;

      & h2 {
        border-color: var(--accent);
      }

      & h2::before {
        transform: rotate(-90deg);
      }
    }
  }

  .event-container {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    grid-template-areas: "img-evt" "evt-group";
  }

  .event-group {
    padding: 0;
    width: 280px;
  }

  .seasonal-display {
    aspect-ratio: 2.5;
    background-attachment: fixed;
    border-radius: .5rem;

    &>h3 {
      padding-inline: .5rem;
      font-size: 1.375rem;
    }
  }

  #go-top {
    font-size: 1.5rem;
    padding: .25rem .5rem;
    margin-right: 1rem;
  }

  .list-panel {
    grid-template-columns: 1fr;
  }

  .swipe-body {
    display: grid;
    justify-content: normal;
    width: max-content;
    gap: 0;
    width: 100%;
    overflow-x: scroll;
    grid-template-columns: 100%;
    grid-auto-flow: column;
    grid-auto-columns: 100%;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .swipe-item {
    margin-inline: auto;
    scroll-snap-align: center;
    scroll-snap-stop: always;
  }

  .swipe-indicator {
    display: block;
    margin-inline: auto;
  }

  .gallery-preview {
    grid-template-columns: 1fr;
    grid-template-areas: "cover" "description";
    padding: 1rem;
    margin-inline: .75rem;
  }

  .modal-container {
    & .gallery-modal {

      & aside {
        display: none;
      }
    }


    & .pager {
      top: .5rem;
    }
  }

  .main-gallery {
    gap: 1rem;
    overflow-x: scroll;
    scrollbar-width: none;

  }

  svg.close {
    width: 2rem;
    top: .5rem;
    right: .5rem;
  }

  svg.close+.header {
    margin-top: 1rem;
  }

}