@layer base, layout, components, utilities, pages;

@layer pages {

  /* ==============================================================
     Page Default Layout - Used by single pages and archives
     ============================================================== */

  .page-default {
    position: relative;
    display: block;
    margin-bottom: clamp(48px, 5vw, 96px);
  }

  .page-default__hero {
    position: relative;
    overflow: hidden;
    padding: clamp(48px, 8vw, 120px) 0;
    background: linear-gradient(135deg, rgba(248, 250, 252, 0.95) 0%, #ffffff 70%);
    color: #2b2010;
  }

  .page-default__hero--image {
    color: #ffffff;
  }

  .page-default__hero-media {
    position: absolute;
    inset: 0;
    z-index: 0;
    overflow: hidden;
  }

  .page-default__hero-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
  }

  .page-default__hero-inner {
    position: relative;
    z-index: 1;
    display: grid;
    gap: clamp(16px, 2.6vw, 28px);
    margin: 0 auto;
    padding: 0 clamp(24px, 6vw, 80px);
  }

  .page-default__meta {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(43, 32, 16, 0.65);
  }

  .page-default__meta-label {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(138, 106, 37, 0.12);
    border: 1px solid rgba(138, 106, 37, 0.2);
    font-weight: 700;
    color: #b38f2d;
  }

  .page-default__meta time {
    font-weight: 600;
    letter-spacing: 0.08em;
  }

  .page-default__title {
    margin: 0;
    font-size: clamp(2.1rem, 4vw, 3.4rem);
    line-height: 1.12;
    font-weight: 700;
    color: inherit;
  }

  .page-default__lead {
    margin: 0;
    font-size: clamp(1.05rem, 2.3vw, 1.35rem);
    line-height: 1.7;
    color: rgba(43, 32, 16, 0.8);
    max-width: 68ch;
  }

  .page-default__hero--image .page-default__meta {
    color: rgba(255, 255, 255, 0.76);
  }

  .page-default__hero--image .page-default__meta-label {
    background: rgba(255, 255, 255, 0.24);
    border-color: rgba(255, 255, 255, 0.38);
    color: #ffffff;
  }

  .page-default__hero--image .page-default__lead {
    color: rgba(255, 255, 255, 0.85);
  }

  .page-default__body {
    position: relative;
    display: grid;
    gap: clamp(32px, 6vw, 72px);
    margin: clamp(36px, 6vw, 80px) 0 clamp(40px, 6vw, 96px);
    width: 100%;
  }

  .page-default__content {
    position: relative;
    width: 100%;
    padding: clamp(40px, 6vw, 96px) clamp(32px, 8vw, 120px);
    border-radius: 0;
    background: rgba(255, 255, 255, 0.96);
    border: 0;
    box-shadow: none;
  }

  .page-default__content .toc {
    margin-bottom: clamp(24px, 4vw, 40px);
    border-radius: 18px;
    border: 1px solid rgba(203, 213, 225, 0.6);
    box-shadow: 0 14px 30px rgba(43, 32, 16, 0.08);
    background: linear-gradient(135deg, rgba(238, 242, 255, 0.95), #ffffff 68%);
  }

  .page-default__content .toc__list {
    gap: 12px;
  }

  .page-default__content .toc__item {
    font-weight: 600;
    color: #3a2a14;
  }

  .page-default__supplements > .section {
    margin: 0;
  }

  .page-default__supplements > .section + .section {
    margin-top: clamp(24px, 4vw, 40px);
  }

  @media (max-width: 900px) {
    .page-default__body {
      margin: clamp(32px, 8vw, 64px) auto clamp(36px, 7vw, 90px);
    }
  }

  @media (max-width: 640px) {
    .page-default__body {
      margin: clamp(28px, 10vw, 52px) auto clamp(32px, 9vw, 80px);
      gap: 28px;
    }

    .page-default__content {
      padding: 24px;
    }
  }

  /* ==============================================================
     Facility Featured Grid
     ============================================================== */

  .facility-featured {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: clamp(28px, 5vw, 40px);
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .facility-featured .card-list__item {
    display: flex;
    flex-direction: column;
  }

  .facility-featured__media {
    position: relative;
    overflow: hidden;
    background: #f6f0e3;
    border-radius: 0;
    width: 100%;
    aspect-ratio: 4 / 3;
  }

  .facility-featured__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
  }

  .facility-featured__body {
    margin-top: clamp(16px, 3vw, 24px);
  }

  .facility-featured__title {
    margin: 0;
    font-size: clamp(1.05rem, 2vw, 1.4rem);
    font-weight: 600;
    color: #2b2010;
  }

  .facility-featured__excerpt {
    margin: clamp(8px, 2vw, 12px) 0 0;
    color: rgba(90, 74, 42, 0.76);
    font-size: 0.94rem;
    line-height: 1.6;
  }

  .facility-featured__media:hover img,
  .facility-featured__media:focus-within img {
    transform: scale(1.05);
  }

  @media (max-width: 1024px) {
    .facility-featured {
      grid-template-columns: repeat(2, minmax(0, 1fr));
    }
  }

  @media (max-width: 680px) {
    .facility-featured {
      grid-template-columns: 1fr;
    }
  }

  /* ==============================================================
     Site Main Container
     ============================================================== */

  .site-main > .container {
    max-width: 1280px;
  }

  .site-main > .container > .section {
    position: relative;
    z-index: 0;
  }

  .site-main > .container > .section:not(.front-section)::after {
    content: '';
    position: absolute;
    inset: 0;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
    background: inherit;
    background-color: inherit;
    background-image: inherit;
    background-size: inherit;
    background-repeat: inherit;
    background-position: inherit;
    background-attachment: inherit;
    background-origin: inherit;
    background-clip: inherit;
    z-index: -1;
    pointer-events: none;
  }

  .site-main > .container > .section:not(.front-section) > * {
    position: relative;
    z-index: 1;
  }

  /* ==============================================================
     Section Latest News
     ============================================================== */

  .section--latest-news {
    margin-top: clamp(32px, 5vw, 72px);
    padding-top: clamp(20px, 5vw, 40px);
  }

  .section--latest-news .post-list {
    border-top: 0;
  }

  .section--latest-news .post-list__item {
    border-bottom: 0;
  }

  .section--latest-news .section__more {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 1.2rem;
    border-radius: 999px;
    font-size: 0.9rem;
    font-weight: 600;
    color: rgba(138, 106, 37, 0.85);
    background: rgba(216, 183, 104, 0.12);
    transition: background 0.2s ease, transform 0.2s ease;
  }

  .section--latest-news .section__more::after {
    content: '\203A';
    font-size: 1rem;
  }

  .section--latest-news .section__more:hover,
  .section--latest-news .section__more:focus-visible {
    background: rgba(216, 183, 104, 0.2);
    color: #7f6520;
    transform: translateX(2px);
  }

}
