/* =====================================================================
   Layout — shell, header, footer, sections, grid
   ===================================================================== */

.site-frame { display: flex; flex-direction: column; min-height: 100vh; }

.container {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}
.container--narrow { max-width: var(--max-narrow); }
.container--mid { max-width: var(--max-mid); }

/* --- Skip link --- */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -60px;
  z-index: 200;
  background: var(--ink);
  color: #fff;
  padding: .7rem 1.1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  text-decoration: none;
  transition: top var(--dur-fast) var(--ease);
}
.skip-link:focus { top: 1rem; color: #fff; }

/* --- Header --- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid transparent;
  color: var(--ink);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.site-header.is-scrolled {
  border-bottom-color: var(--line);
  box-shadow: 0 8px 28px rgba(17, 24, 39, .06);
  background: rgba(255, 255, 255, .95);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  text-decoration: none;
  line-height: 1.05;
}
.brand__logo { width: 52px; height: auto; flex: none; }
.brand__text { display: flex; flex-direction: column; gap: 3px; }
.brand__name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.14rem;
  letter-spacing: .005em;
  text-transform: uppercase;
  color: var(--mineral);
  line-height: 1;
}
.brand__name span { color: var(--copper); }
.brand__tag {
  font-size: .55rem;
  font-weight: 600;
  letter-spacing: .19em;
  text-transform: uppercase;
  color: var(--muted);
  line-height: 1;
}

/* --- Primary nav (grouped dropdowns, gold sliding underline) --- */
.primary-nav { display: flex; align-items: center; }
.primary-nav .nav-list {
  display: flex;
  align-items: center;
  gap: clamp(.55rem, 1.3vw, 1.4rem);
}
.primary-nav .nav-list > li { position: relative; }

/* Top-level links + dropdown parents share the underline treatment */
.primary-nav > .nav-list > li > a,
.primary-nav .nav-parent {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: 13px 0;
  color: var(--ink);
  font-size: .95rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  background: none;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease);
}
.primary-nav > .nav-list > li > a::after,
.primary-nav .nav-parent::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 6px;
  height: 2px;
  background: var(--copper);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-fast) var(--ease);
}
.primary-nav > .nav-list > li > a:hover,
.primary-nav > .nav-list > li > a:focus-visible,
.primary-nav .nav-parent:hover,
.primary-nav .nav-parent:focus-visible,
.has-dropdown:hover .nav-parent { color: var(--mineral); }
.primary-nav > .nav-list > li > a:hover::after,
.primary-nav > .nav-list > li > a:focus-visible::after,
.primary-nav .nav-parent:hover::after,
.primary-nav .nav-parent:focus-visible::after,
.has-dropdown:hover .nav-parent::after,
.nav-parent[aria-expanded="true"]::after { transform: scaleX(1); }
.primary-nav > .nav-list > li > a[aria-current="page"] { color: var(--mineral); }
.primary-nav > .nav-list > li > a[aria-current="page"]::after { transform: scaleX(1); }
.is-active-group > .nav-parent { color: var(--mineral); }
.is-active-group > .nav-parent::after { transform: scaleX(1); }

.nav-caret { width: 14px; height: 14px; transition: transform var(--dur-fast) var(--ease); }
.has-dropdown:hover .nav-caret,
.nav-parent[aria-expanded="true"] .nav-caret { transform: rotate(180deg); }

/* Dropdown panel (mega-menu style) */
.dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  min-width: 260px;
  max-width: min(340px, 90vw);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: .5rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity var(--dur-fast) var(--ease), transform var(--dur-fast) var(--ease), visibility var(--dur-fast);
  z-index: 60;
}
/* Right-align the later dropdowns so they never overflow the viewport */
.primary-nav .nav-list > li:nth-last-child(-n+3) .dropdown { left: auto; right: 0; }
.has-dropdown:hover .dropdown,
.has-dropdown:focus-within .dropdown,
.dropdown.is-open { opacity: 1; visibility: visible; transform: translateY(0); }
.dropdown a {
  display: grid;
  gap: 1px;
  padding: .55rem .7rem;
  border-radius: 10px;
  text-decoration: none;
}
.dropdown a strong { color: var(--ink); font-size: .92rem; font-weight: 700; }
.dropdown a span { color: var(--muted-2); font-size: .76rem; font-weight: 500; }
.dropdown a:hover, .dropdown a:focus-visible { background: var(--mineral-tint); }
.dropdown a:hover strong, .dropdown a:focus-visible strong,
.dropdown a:hover span, .dropdown a:focus-visible span { color: var(--mineral); }
.dropdown a[aria-current="page"] { background: var(--mineral-tint); }
.dropdown a[aria-current="page"] strong { color: var(--mineral); }

.header-actions { display: flex; align-items: center; gap: .6rem; }

/* --- Menu toggle (mobile) --- */
.menu-toggle {
  display: none;
  align-items: center;
  gap: .5rem;
  padding: .5rem .8rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  color: var(--mineral);
  background: var(--surface);
  font-size: .85rem;
  font-weight: 700;
}
.menu-toggle:hover { background: var(--paper-2); }
.menu-toggle__bars { position: relative; width: 18px; height: 12px; }
.menu-toggle__bars span {
  position: absolute; left: 0; right: 0; height: 2px; background: currentColor; border-radius: 2px;
  transition: transform var(--dur-fast) var(--ease), opacity var(--dur-fast) var(--ease);
}
.menu-toggle__bars span:nth-child(1) { top: 0; }
.menu-toggle__bars span:nth-child(2) { top: 5px; }
.menu-toggle__bars span:nth-child(3) { top: 10px; }

/* --- Mobile menu panel --- */
.mobile-menu {
  position: fixed;
  inset: var(--header-h) 0 0 0;
  z-index: 99;
  background: var(--surface);
  color: var(--ink);
  padding: var(--space-4) var(--gutter) var(--space-6);
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform var(--dur) var(--ease);
  display: flex;
  flex-direction: column;
  gap: .2rem;
  box-shadow: var(--shadow-lg);
}
.mobile-menu.is-open { transform: translateX(0); }
.mobile-menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .95rem .4rem;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 600;
  text-decoration: none;
}
.mobile-menu a:hover { color: var(--mineral); }
.mobile-menu a[aria-current="page"] { color: var(--mineral); }
.mobile-menu a[aria-current="page"]::after { content: "•"; color: var(--copper); }
.mobile-menu .m-link { font-weight: 700; }
.mobile-menu .m-group { display: flex; flex-direction: column; }
.mobile-menu .m-group__title {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--copper-deep);
  padding: 1rem .4rem .3rem;
}
.mobile-menu .m-sub { padding-left: 1rem; font-size: 1rem; }
.mobile-menu .button { margin-top: var(--space-4); justify-content: center; }
body.menu-open { overflow: hidden; }

/* --- Main --- */
main { flex: 1 0 auto; }
main:focus { outline: none; }

.loading {
  display: grid;
  place-items: center;
  min-height: 50vh;
  color: var(--muted);
  font-size: var(--fs-lead);
}
.loading::before {
  content: "";
  width: 30px; height: 30px;
  margin-bottom: 1rem;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--mineral);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Sections --- */
.section { padding-block: var(--space-7); }
.section--tight { padding-block: var(--space-6); }
.section--flush-top { padding-top: 0; }
.section--alt { background: var(--paper-2); }
.section--surface { background: var(--surface); }
.section--dark {
  background: linear-gradient(160deg, var(--ink-2), var(--ink-3));
  color: #dfe6e6;
}
.section--dark h1, .section--dark h2, .section--dark h3, .section--dark h4 { color: #fff; }
.section--dark .eyebrow { color: var(--copper-soft); }
.section--mineral {
  background: linear-gradient(155deg, var(--mineral-deep), var(--ink-2));
  color: #e4eef1;
}
.section--mineral h2, .section--mineral h3 { color: #fff; }
.section--mineral .eyebrow { color: var(--copper-soft); }

/* --- Section header --- */
.section-header { max-width: 62ch; margin-bottom: var(--space-5); }
.section-header--center { margin-inline: auto; text-align: center; }
.section-header > h2::after {
  content: "";
  display: block;
  width: 46px; height: 3px;
  margin-top: .75rem;
  border-radius: 2px;
  background: var(--copper);
}
.section-header--center > h2::after { margin-inline: auto; }
.section-header p.lead { margin-top: var(--space-2); color: var(--muted); font-size: var(--fs-lead); }
.section--dark .section-header p.lead,
.section--mineral .section-header p.lead { color: #c4d0d1; }

.eyebrow {
  display: inline-block;
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: var(--tracking-eyebrow);
  text-transform: uppercase;
  color: var(--copper-deep);
  margin-bottom: var(--space-2);
}

/* --- Grid --- */
.grid { display: grid; gap: var(--space-4); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-auto { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-auto-sm { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }

.split {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: var(--space-6);
  align-items: start;
}
.split--even { grid-template-columns: 1fr 1fr; }
.split--reverse > :first-child { order: 2; }

/* --- Footer --- */
.site-footer {
  background:
    radial-gradient(circle at 80% 20%, rgba(212, 175, 55, .14), transparent 30%),
    linear-gradient(135deg, var(--ink-3), var(--mineral));
  color: rgba(255, 255, 255, .82);
  padding-block: var(--space-6) var(--space-4);
  margin-top: auto;
}
.site-footer a { color: rgba(255, 255, 255, .78); text-decoration: none; }
/* Footer links: gold sliding underline on hover (matches header) */
.footer-col a, .footer-bottom a {
  position: relative;
  display: inline-block;
  transition: color var(--dur-fast) var(--ease);
}
.footer-col a::after, .footer-bottom a::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -2px;
  height: 1.5px;
  background: var(--copper);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-fast) var(--ease);
}
.site-footer a:hover { color: #fff; }
.footer-col a:hover::after, .footer-bottom a:hover::after { transform: scaleX(1); }
.site-footer .brand__name { color: #fff; }
.site-footer .brand__name span { color: var(--copper-soft); }
.site-footer .brand__tag { color: rgba(255, 255, 255, .68); }
.footer-grid {
  display: grid;
  grid-template-columns: 1.7fr repeat(4, 1fr);
  gap: var(--space-5);
  padding-bottom: var(--space-5);
  border-bottom: 1px solid rgba(255,255,255,.1);
}
.footer-brand .brand { margin-bottom: var(--space-3); }
.footer-brand p { color: rgba(255, 255, 255, .74); font-size: var(--fs-sm); max-width: 34ch; }
.footer-col h3 {
  color: #fff;
  font-size: .82rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  margin-bottom: var(--space-3);
}
.footer-col ul { display: flex; flex-direction: column; gap: .55rem; }
.footer-col li { font-size: var(--fs-sm); }
.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
  justify-content: space-between;
  align-items: center;
  padding-top: var(--space-4);
  font-size: var(--fs-xs);
  color: rgba(255, 255, 255, .62);
}
.footer-bottom .footer-legal { max-width: 70ch; line-height: 1.6; }
.footer-verify {
  font-size: var(--fs-xs);
  color: rgba(255, 255, 255, .6);
  padding-top: var(--space-3);
  font-style: italic;
}
