/* 1. Universal reset */
*, ::after, ::before, ::backdrop, ::file-selector-button {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 0 solid;
}

/* 2. html element */
html {
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  tab-size: 4;
  font-family: ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
  -webkit-tap-highlight-color: transparent;
}

/* 3. Headings reset */
h1, h2, h3, h4, h5, h6 {
  font-size: inherit;
  font-weight: inherit;
}

/* 4. Anchor reset */
a {
  color: inherit;
  text-decoration: inherit;
}

/* 5. Media elements */
img, svg, video, canvas, audio, iframe, embed, object {
  display: block;
}
img, video {
  max-width: 100%;
  height: auto;
}

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

.title {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 3rem;

  h2 {
    font-size: 2.25rem;
    font-weight: 700;
    color: #0f5238;
    margin-bottom: 0.5rem;
  }

  .underline {
    height: 0.25rem;
    width: 5rem;
    background-color: #a43946;
  }
}

.title-end {
  display: flex;
  flex: 1;
  justify-content: flex-end;
}

.continue-link {
  color: #0f5238;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 0.25rem;

  &:hover {
    text-decoration: underline;
  }
}

:root {
  --box-border-color: rgb(130 150 140 / 0.45);
  --box-border-hover-color: rgb(130 150 140 / 0.95);
}

body {
  font-family: 'Open Sans', sans-serif;
  background-color: #fbf9f4; /* bg-surface */
  color: #1b1c19;            /* text-on-surface */
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  margin: 0;
  overflow-x: clip;          /* hidden navbar dropdown panels can overhang the viewport */
}

/* ###### MAIN CONTENT ###### */

main {
  min-height: 80vh; /* just for testing empty sites with footer in right next to menu */
}

.content {
  max-width: 80rem;        /* max-w-7xl */
  margin-inline: auto;     /* mx-auto */
  padding-inline: 1.5rem;  /* px-6 */
  padding-block-start: 6rem; /* py-24 */

  & > section {
    margin-bottom: 6rem;
  }
  & > section:last-child { /* last section is follow by a green footer, not by an h2 (which has a bit of padding above it) */
    margin-bottom: 7rem;
  }
}

.box-container {
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  justify-items: center;

  &.box-4 {
    @media (min-width: 768px) {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    @media (min-width: 1024px) {
      grid-template-columns: repeat(4, minmax(0, 1fr));
    }
    gap: 1.5rem;
  }

  &.box-3 {
    @media (min-width: 768px) {
      grid-template-columns: repeat(3, minmax(0, 1fr));
    }
    gap: 2rem;
  }

  &.box-2 {
    @media (min-width: 768px) {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    gap: 2rem;
  }

  &.box-1 {
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 2rem;
  }
}

.box {
  padding: 2rem;
  background-color: #ffffff;
  border: 1px solid var(--box-border-color);
  border-radius: 0.75rem;
  transition: all 300ms;
  cursor: pointer;
  width: 100%;
  max-width: 390px;

  &:is(a) {
    display: block;
    text-decoration: none;
    color: inherit;
  }

  &:hover {
    background-color: rgb(255 255 255 / 0.3);
    border-color: var(--box-border-hover-color);
  }

  & .date {
    font-size: 1rem;
    line-height: 1rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: #a43946;
    text-transform: uppercase;
    display: block;
  }

  & h3 {
    font-size: 1.5rem;
    line-height: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    transition-property: color, background-color, border-color, text-decoration-color, fill, stroke;
    transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
    transition-duration: 150ms;
  }

  &:hover h3 {
    color: #0f5238;
  }

  & > p {
    font-size: 1rem;
    line-height: 1.25rem;
    color: #404943;
  }

  &.center > * {
    display: flex;
    justify-content: center;
    text-align: center;
  }
}

/* Pályázat boxes: optional image, linked boxes are <a> elements */
.palyazat-box {
  display: block;
  text-decoration: none;
  color: inherit;

  & .palyazat-image {
    display: block;
    max-width: 100%;
    max-height: 160px;
    margin: 0 auto 1rem;
    border: 1px solid var(--box-border-color);
  }
}

/* Főoldal: card descriptions match the long-text size */
.home .box > p {
  font-size: 1.0625rem;
  line-height: 1.8;
}

.gray-section {
  background-color: rgb(224 235 226);
  border-radius: 0.75rem;
  padding: 3rem;
}

.yellow-section {
  background-color: rgb(237 222 186); /* orig: rgb(230 211 163); lighter: rgb(243 233 209); now we use the avg of these 2 */
  border-radius: 0.75rem;
  padding: 3rem;
  & p {
    color: #333333 !important;
  }
  & h2, & h3, & a {
    color: #2f4f2f;
  }
  .box:hover {
    background-color: rgb(255 255 255 / 0.7);
    border-color: var(--box-border-hover-color);
  }
  .title {
    @media (max-width: 550px) {
      flex-direction: column;
      .title-end {
        margin-top: 1rem;
      }
    }
  }
}


/* ###### EVENT CALENDAR ###### */

.event-calendar-layout {
  display: flex;
  flex-direction: column;
  gap: 3rem;

  @media (width >= 768px) {
    flex-direction: row;
  }

  .event-calendar-header {
    @media (width >= 768px) {
      width: 33.333%;
    }

    .event-calendar-heading {
      font-size: 2.25rem;
      line-height: 1.25;
      font-weight: 700;
      color: #0f5238;
      margin-bottom: 1.5rem;
    }

    .event-calendar-intro {
      color: #404943;
      margin-bottom: 2rem;
    }
  }

  .event-list {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;

    @media (width >= 768px) {
      width: 66.667%;
    }

    .event-card {
      background-color: #ffffff;
      padding: 1.5rem;
      border-radius: 0.25rem;
      display: flex;
      gap: 1.5rem;
      cursor: pointer;
      align-items: center;
      border: 1px solid var(--box-border-color);
      transition: all 0.3s ease;

      @media (max-width: 550px) {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;

        .event-date-badge {
          display: flex;
          align-items: baseline;
          gap: 0.5rem;
        }
      }

      &:hover {
        background-color: rgb(255 255 255 / 0.7);
        border-color: var(--box-border-hover-color);

        .event-date-badge {
          background-color: rgb(164 57 70 / 0.15);
          border-color: rgb(164 57 70 / 0.4);
        }
      }

      .event-date-badge {
        flex-shrink: 0;
        text-align: center;
        background-color: rgb(164 57 70 / 0.1);
        padding: 0.5rem 1rem;
        border-radius: 0.25rem;
        border: 1px solid rgb(164 57 70 / 0.2);
        transition: background-color 0.3s ease, border-color 0.3s ease;

        .event-date-day {
          display: block;
          font-size: 1.5rem;
          font-weight: 700;
          color: #a43946;
        }

        .event-date-month {
          display: block;
          font-size: 0.75rem;
          text-transform: uppercase;
          font-weight: 700;
          color: rgb(164 57 70 / 0.8);
        }
      }

      .event-title {
        font-weight: 700;
        font-size: 1.125rem;
        color: #0f5238;
      }

      .event-meta {
        font-size: 1.0625rem;
        line-height: 1.8;
        color: oklch(55.3% 0.013 58.071);
      }
    }
  }
}

/* ###### MAYOR GREETING SECTION ###### */

.mayor-layout {
  display: flex;
  gap: 3rem;
  align-items: flex-start;

  @media (max-width: 768px) {
    flex-direction: column;
  }

  .mayor-text {
    flex: 0 0 50%;
    color: #404943;
    font-size: 1.0625rem;
    line-height: 1.8;

    p, div {
      margin-bottom: 1rem;
      color: #404943;
    }
  }

  .mayor-image-wrap {
    flex: 1;

    img {
      width: 100%;
      border: 1px solid var(--box-border-color);
      border-radius: 0.75rem;
    }
  }

  .mayor-signature {
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 2px solid var(--box-border-color);
    text-align: right;

    .mayor-name {
      font-size: 1.25rem;
      font-weight: 700;
      font-style: italic;
      color: #0f5238;
      letter-spacing: 0.02em;
    }

    .mayor-title {
      font-size: 0.8rem;
      font-style: italic;
      color: #a43946;
      text-transform: uppercase;
      letter-spacing: 0.12em;
      margin-bottom: 0;
    }
  }
}

/* ###### SUBPAGE HERO TITLES ON MOBILE ###### */

/* Below 950px the navbar already shows the page name (.mobile-pali-link), so the hero title
   is hidden visually; it stays in the document as the page's h1 for screen readers and SEO. */
@media (max-width: 950px) {
  .story-hero-text,
  .fg-hero-text,
  .hiv-hero-text {
    clip-path: inset(50%);
    width: 1px;
    height: 1px;
    overflow: hidden;
    white-space: nowrap;
  }
}
