/* =========================================================
   Layout - header, footer, containers, grids
   ========================================================= */

.container {
  width: min(100% - 1.5rem, var(--container));
  margin-inline: auto;
}

.container--narrow {
  width: min(100% - 1.5rem, var(--container-narrow));
}

@media (min-width: 480px) {
  .container,
  .container--narrow {
    width: min(100% - 2rem, var(--container));
  }

  .container--narrow {
    width: min(100% - 2rem, var(--container-narrow));
  }
}

.section {
  padding-block: var(--section-pad-y);
  position: relative;
}

.section--alt {
  background: var(--bg-section-alt);
}

.section--primary {
  background: var(--bg-primary);
  color: var(--color-ivory);
}

.section--primary h2,
.section--primary h3,
.section--primary .section-eyebrow {
  color: var(--color-ivory);
}

.section--primary p,
.section--primary .muted {
  color: rgba(250, 247, 242, 0.88);
}

.section-header {
  max-width: 40rem;
  margin-bottom: var(--space-7);
}

.section-header--center {
  text-align: center;
  margin-inline: auto;
}

.section-eyebrow {
  display: inline-block;
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-accent-alt);
  margin-bottom: var(--space-3);
}

.section-title {
  font-size: var(--fs-2xl);
  margin-bottom: var(--space-4);
}

.section-lead {
  font-size: var(--fs-md);
  color: var(--color-text-muted);
  margin: 0;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 400;
  background: rgba(250, 247, 242, 0.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--color-border);
  min-height: var(--header-h);
  overflow: visible;
  padding-left: env(safe-area-inset-left, 0);
  padding-right: env(safe-area-inset-right, 0);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: var(--header-h);
  position: relative;
  z-index: 2;
}

@media (min-width: 480px) {
  .header-inner {
    gap: var(--space-4);
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  color: var(--color-primary-deep);
  min-width: 0;
}

.brand__logo {
  width: 2.4rem;
  height: 2.4rem;
  object-fit: contain;
  flex-shrink: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

@media (min-width: 480px) {
  .brand__logo {
    width: 2.75rem;
    height: 2.75rem;
  }
}

.brand__text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand__name {
  font-family: var(--font-display);
  font-size: clamp(0.88rem, 0.75rem + 1.2vw, 1.05rem);
  font-weight: 600;
  line-height: 1.15;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

html[lang="si"] .brand__name {
  font-family: var(--font-sinhala);
  font-size: clamp(0.8rem, 0.7rem + 1vw, 0.95rem);
}

.brand__sub {
  font-size: clamp(0.62rem, 0.55rem + 0.5vw, 0.7rem);
  color: var(--color-text-light);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 360px) {
  .brand__sub {
    display: none;
  }
}

.nav-desktop {
  display: none;
  align-items: center;
  gap: 0.2rem;
  position: relative;
  z-index: 5;
}

.nav-desktop > a,
.nav-item__trigger {
  text-decoration: none;
  color: var(--color-text-muted);
  font-size: var(--fs-sm);
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  background: transparent;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  min-height: 2.5rem;
}

.nav-item__trigger::after {
  content: "";
  width: 0.35rem;
  height: 0.35rem;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translateY(-1px);
  opacity: 0.7;
  transition: transform 0.2s ease;
}

.nav-item.is-open .nav-item__trigger::after {
  transform: rotate(225deg) translateY(-1px);
}

.nav-desktop > a:hover,
.nav-desktop > a[aria-current="page"],
.nav-item__trigger:hover,
.nav-item.is-open .nav-item__trigger,
.nav-item.is-current .nav-item__trigger {
  color: var(--color-primary);
  background: rgba(30, 58, 95, 0.05);
}

.nav-item {
  position: relative;
}

.nav-sub {
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 12.5rem;
  padding: 0.55rem 0.4rem 0.4rem;
  margin: 0;
  list-style: none;
  background: var(--color-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lift);
  display: grid;
  gap: 0.15rem;
  z-index: 60;
}

/* Invisible hover bridge so the menu does not close between trigger and panel */
.nav-sub::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -0.75rem;
  height: 0.75rem;
}

.nav-sub[hidden] {
  display: none;
}

.nav-sub a {
  display: block;
  text-decoration: none;
  color: var(--color-text);
  font-size: var(--fs-sm);
  font-weight: 500;
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.nav-sub a:hover,
.nav-sub a:focus-visible {
  background: rgba(30, 58, 95, 0.06);
  color: var(--color-primary);
}

.nav-sub a[aria-current="page"] {
  background: rgba(30, 58, 95, 0.08);
  color: var(--color-primary);
  font-weight: 600;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  border: 1px solid var(--color-border-strong);
  border-radius: 999px;
  padding: 0.12rem;
  background: var(--color-white);
}

.lang-switch button {
  font-size: var(--fs-xs);
  font-weight: 600;
  min-height: 2.5rem;
  min-width: 2.5rem;
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  color: var(--color-text-muted);
}

.lang-switch button[aria-pressed="true"] {
  background: var(--color-primary);
  color: var(--color-white);
}

.menu-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 2.75rem;
  height: 2.75rem;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0.55rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-white);
  cursor: pointer;
  position: relative;
  z-index: 3;
  -webkit-tap-highlight-color: transparent;
}

.menu-toggle:hover,
.menu-toggle:focus-visible {
  border-color: var(--color-primary);
}

.menu-toggle__bar {
  display: block;
  width: 1.15rem;
  height: 2px;
  background: var(--color-primary);
  border-radius: 1px;
  transition: transform 0.28s ease, opacity 0.2s ease;
  transform-origin: center;
}

.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(2) {
  opacity: 0;
  transform: scaleX(0.4);
}

.menu-toggle[aria-expanded="true"] .menu-toggle__bar:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

.nav-backdrop {
  position: fixed;
  inset: 0;
  z-index: 350;
  background: rgba(30, 58, 95, 0.48);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.32s ease, visibility 0.32s ease;
  border: 0;
  padding: 0;
  cursor: pointer;
}

.nav-backdrop.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.nav-mobile-wrap {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  z-index: 1;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-0.4rem);
  transition:
    max-height 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.28s ease,
    transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0.32s ease;
}

.nav-mobile-wrap.is-open {
  max-height: min(78vh, 32rem);
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.nav-mobile {
  margin: 0;
  background: var(--color-ivory);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 18px 40px rgba(20, 40, 64, 0.12);
  padding: 0.35rem 0 0.85rem;
}

.nav-mobile__list {
  list-style: none;
  margin: 0;
  padding: 0.25rem 1rem 0.5rem;
  display: grid;
  gap: 0.15rem;
}

.nav-mobile__list a {
  display: flex;
  align-items: center;
  min-height: 2.85rem;
  padding: 0.7rem 0.9rem;
  text-decoration: none;
  color: var(--color-text);
  font-weight: 500;
  font-size: var(--fs-base);
  border-radius: var(--radius-md);
  transition: background 0.2s ease, color 0.2s ease;
}

.nav-mobile__list a:hover,
.nav-mobile__list a:focus-visible {
  background: rgba(30, 58, 95, 0.06);
  color: var(--color-primary);
}

.nav-mobile__list a[aria-current="page"] {
  background: rgba(30, 58, 95, 0.08);
  color: var(--color-primary);
  font-weight: 600;
}

.nav-mobile__divider {
  height: 1px;
  margin: 0.55rem 0.9rem;
  background: var(--color-border);
  list-style: none;
  pointer-events: none;
}

.nav-mobile__label {
  list-style: none;
  margin: 0.15rem 0.9rem 0.35rem;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent-alt);
  pointer-events: none;
}

@media (min-width: 960px) {
  .nav-desktop {
    display: flex;
  }

  .menu-toggle {
    display: none;
  }

  .nav-mobile-wrap,
  .nav-backdrop {
    display: none !important;
  }

  .brand__sub {
    max-width: 14rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .nav-mobile-wrap,
  .nav-backdrop,
  .menu-toggle__bar {
    transition: none;
  }
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--color-primary-deep);
  color: rgba(250, 247, 242, 0.88);
  padding-top: var(--space-8);
  padding-bottom: var(--space-6);
}

.footer-grid {
  display: grid;
  gap: var(--space-7);
  margin-bottom: var(--space-7);
}

@media (min-width: 640px) {
  .footer-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 960px) {
  .footer-grid {
    grid-template-columns: 1.4fr 1fr 1fr 1.1fr;
  }
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.footer-brand img {
  width: 3.75rem;
  height: 3.75rem;
  object-fit: contain;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.footer-brand h2 {
  color: var(--color-ivory);
  font-size: var(--fs-lg);
  margin: 0;
}

.footer-brand p {
  margin: 0;
  font-size: var(--fs-sm);
  line-height: var(--lh-relaxed);
  max-width: 22rem;
}

.footer-col h3 {
  color: var(--color-gold-soft);
  font-family: var(--font-body);
  font-size: var(--fs-xs);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: var(--space-4);
}

.footer-col ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.footer-col li {
  margin-bottom: var(--space-2);
}

.footer-col a {
  color: rgba(250, 247, 242, 0.85);
  text-decoration: none;
  font-size: var(--fs-sm);
}

.footer-col a:hover {
  color: var(--color-gold-soft);
}

.footer-contact-item {
  font-size: var(--fs-sm);
  margin-bottom: var(--space-3);
}

.footer-contact-item strong {
  display: block;
  color: var(--color-gold-soft);
  font-weight: 600;
  font-size: var(--fs-xs);
  margin-bottom: 0.15rem;
}

.footer-cta {
  margin-top: var(--space-4);
}

.footer-social {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-4);
}

.footer-social a,
.footer-social span {
  font-size: var(--fs-sm);
  color: rgba(250, 247, 242, 0.7);
  text-decoration: none;
  border: 1px solid rgba(250, 247, 242, 0.2);
  padding: 0.55rem 0.85rem;
  min-height: 2.5rem;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm);
}

.footer-bottom {
  border-top: 1px solid rgba(250, 247, 242, 0.15);
  padding-top: var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  font-size: var(--fs-xs);
}

@media (min-width: 768px) {
  .footer-bottom {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
}

.footer-bottom a {
  color: var(--color-gold-soft);
  text-decoration: none;
}

.azryno-credit {
  margin-top: var(--space-4);
  text-align: center;
  font-size: var(--fs-sm);
  color: rgba(249, 247, 242, 0.75);
}

.azryno-credit a {
  color: var(--color-gold-soft);
  font-weight: 600;
  text-decoration: none;
}

.azryno-credit a:hover {
  text-decoration: underline;
}

/* Grids */
.grid-2,
.grid-3,
.grid-4 {
  display: grid;
  gap: var(--space-5);
}

@media (min-width: 640px) {
  .grid-2 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 768px) {
  .grid-3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 900px) {
  .grid-4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

.muted {
  color: var(--color-text-muted);
}

.placeholder-note {
  font-size: var(--fs-sm);
  color: var(--color-text-light);
  font-style: italic;
  border: 1px dashed var(--color-border-strong);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: rgba(30, 58, 95, 0.03);
}
