/* ==========================================================================
   iRM Global Initiatives Group — Website Preview
   Design tokens live in :root. Change colours, spacing, and type here first.
   Palette matches IRM-Website-Guide/DESIGN.md (provisional until approved).
   ========================================================================== */

:root {
  /* Surfaces — layering system: base -> elevated -> floating */
  --bg-base: #090e0c;
  --bg-elevated: #141e18;
  --bg-floating: #1b2920;
  --border-subtle: #212a22;
  --border-strong: #344238;

  /* Text */
  --text-primary: #f2f2ed;
  --text-secondary: #a1aca4;
  --text-tertiary: #6f796f;

  /* Brand accent — custom muted security-green, used sparingly */
  --accent: #56b88b;
  --accent-bright: #8ad7af;
  --accent-dim: #28493a;
  --accent-glow: rgba(86, 184, 139, 0.22);

  /* Metallic neutral for fine strokes / icons */
  --metal: #9aa39c;

  /* Typography */
  --font-display: Georgia, 'Times New Roman', ui-serif, serif;
  --font-body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;

  /* Spacing scale */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;
  --space-9: 6.5rem;

  /* Shadows — layered, colour-tinted, low opacity */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.45);
  --shadow-md: 0 10px 28px -10px rgba(0, 0, 0, 0.6), 0 2px 10px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 24px 60px -20px rgba(0, 0, 0, 0.65), 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-accent: 0 0 0 1px rgba(86, 184, 139, 0.14), 0 16px 44px -16px rgba(86, 184, 139, 0.3);

  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
  --header-h: 97px;
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-body);
  line-height: 1.5;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
button { font: inherit; }
h1, h2, h3, p { margin: 0; }

a {
  color: var(--accent-bright);
  text-decoration: none;
}

:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 3px;
  border-radius: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ==========================================================================
   Site-wide decorative background layer (every page)
   ========================================================================== */
.bg-layer {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.bg-grid {
  position: absolute;
  inset: -1px;
  background-image:
    linear-gradient(to right, rgba(154, 163, 156, 0.05) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(154, 163, 156, 0.05) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 40%, transparent 85%);
}

.bg-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(10px);
  opacity: 0.5;
  will-change: transform;
}
.bg-glow--one {
  top: -10%;
  right: -10%;
  width: 46vw;
  height: 46vw;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  animation: drift-one 26s var(--ease-spring) infinite alternate;
}
.bg-glow--two {
  bottom: -16%;
  left: -12%;
  width: 40vw;
  height: 40vw;
  background: radial-gradient(circle, rgba(154, 163, 156, 0.1) 0%, transparent 70%);
  animation: drift-two 32s var(--ease-spring) infinite alternate;
}

@keyframes drift-one {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(-3%, 4%, 0) scale(1.08); }
}
@keyframes drift-two {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(4%, -3%, 0) scale(1.06); }
}

.bg-network {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.bg-globe {
  color: var(--metal);
  fill: none;
}
.bg-globe circle,
.bg-globe ellipse {
  stroke: currentColor;
  stroke-width: 1;
  opacity: 0.13;
}
.network-lines line {
  stroke: var(--metal);
  stroke-width: 1;
  opacity: 0.18;
}
.network-nodes circle {
  fill: var(--accent-bright);
  opacity: 0.35;
  animation: node-pulse 5s ease-in-out infinite;
}
.network-nodes circle:nth-child(2n) { animation-delay: 1.1s; }
.network-nodes circle:nth-child(3n) { animation-delay: 2.3s; }

@keyframes node-pulse {
  0%, 100% { opacity: 0.2; }
  50% { opacity: 0.6; }
}

/* ==========================================================================
   Layout shell
   ========================================================================== */
header, main, footer { position: relative; z-index: 1; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(9, 14, 12, 0.76);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-subtle);
  transition: background-color 0.35s ease, box-shadow 0.35s ease;
}
.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  min-height: var(--header-h);
  padding: 20px var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
}

.brand {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  border-radius: 999px;
  transition: transform 0.25s var(--ease-spring), opacity 0.2s ease;
}
.brand:hover { transform: translateY(-1px); }

/* Header logo: img/irm-logo-white.png is a dedicated white-on-transparent
   variant (verified: genuine alpha transparency, white lettering, red leaf
   preserved), so it sits directly on the dark header with no container,
   background, or pill of any kind. */
.brand-logo {
  height: 26px;
  width: auto;
}

/* ---------- Sticky header: one consistent size, just a subtle weight shift on scroll ---------- */
.site-header.is-scrolled {
  background: rgba(9, 14, 12, 0.92);
  box-shadow: var(--shadow-md);
}

/* ---------- Primary nav (desktop) ---------- */
.site-nav {
  display: none;
  align-items: center;
  gap: var(--space-6);
  margin-right: auto;
  margin-left: var(--space-7);
}
.nav-link {
  position: relative;
  color: var(--text-secondary);
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  padding: 6px 0;
  transition: color 0.2s ease;
}
.nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  right: 100%;
  bottom: 0;
  height: 1px;
  background: var(--accent-bright);
  transition: right 0.25s var(--ease-spring);
}
.nav-link:hover { color: var(--text-primary); }
.nav-link:hover::after { right: 0; }
.nav-link[aria-current="page"] {
  color: var(--text-primary);
}
.nav-link[aria-current="page"]::after { right: 0; }

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

/* ---------- Mobile nav toggle ---------- */
.nav-toggle {
  display: inline-flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 5px;
  width: 38px;
  height: 38px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}
.nav-toggle-bar {
  width: 16px;
  height: 1.5px;
  background: var(--text-primary);
  border-radius: 1px;
  transition: transform 0.3s var(--ease-spring), opacity 0.2s ease;
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:first-child {
  transform: translateY(3.25px) rotate(45deg);
}
.nav-toggle[aria-expanded="true"] .nav-toggle-bar:last-child {
  transform: translateY(-3.25px) rotate(-45deg);
}

.mobile-nav {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: rgba(10, 15, 13, 0.97);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
  padding: var(--space-4) var(--space-5) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.28s var(--ease-spring), transform 0.28s var(--ease-spring);
}
.mobile-nav[hidden] { display: none; }
.mobile-nav.is-open { opacity: 1; transform: translateY(0); }
.mobile-nav-link {
  padding: 12px 4px;
  color: var(--text-secondary);
  font-size: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}
.mobile-nav-link:last-child { border-bottom: none; }
.mobile-nav-link:hover,
.mobile-nav-link[aria-current="page"] { color: var(--text-primary); }

/* ---------- Buttons ---------- */
.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 11px 22px;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 0.3s var(--ease-spring), box-shadow 0.3s var(--ease-spring), background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.btn:active { transform: translateY(1px) scale(0.98); }
.btn-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}
.btn-sm { padding: 9px 16px; font-size: 0.85rem; }

.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-primary);
}
.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent-bright);
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(180deg, var(--accent) 0%, #3a9270 100%);
  color: #06120c;
  box-shadow: var(--shadow-accent);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 48px -16px rgba(86, 184, 139, 0.4), var(--shadow-md);
}

/* ==========================================================================
   Home hero — immersive
   ========================================================================== */
.hero--home {
  position: relative;
  min-height: calc(100vh - var(--header-h));
  min-height: calc(100dvh - var(--header-h));
  display: flex;
  align-items: center;
  overflow: hidden;
  padding: var(--space-8) 0;
}

.hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.hero-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 78% center;
}
.hero-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(100deg, var(--bg-base) 0%, rgba(9, 14, 12, 0.88) 24%, rgba(9, 14, 12, 0.46) 50%, rgba(9, 14, 12, 0.12) 72%),
    linear-gradient(to bottom, var(--bg-base) 0%, transparent 14%, transparent 82%, var(--bg-base) 100%);
}

.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 var(--space-5);
  width: 100%;
}
.hero-content { max-width: 640px; text-align: left; }

/* ---------- Brand kicker: small company identity label, reused on every page ---------- */
.brand-kicker {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
}
.brand-kicker-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: 0.95;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 0.5; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}

.hero-title {
  margin-top: var(--space-4);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.3rem, 4.8vw, 4rem);
  letter-spacing: -0.02em;
  line-height: 1.08;
  color: var(--text-primary);
}

.hero-subtitle {
  margin-top: var(--space-4);
  font-size: clamp(1.02rem, 1.4vw, 1.18rem);
  line-height: 1.65;
  color: var(--text-secondary);
  max-width: 480px;
}

.hero-cta {
  margin-top: var(--space-7);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

/* ==========================================================================
   Secondary-page intro band (Vision / Solutions / Client Access)
   ========================================================================== */
.page-hero {
  position: relative;
  padding: calc(var(--space-9) + 1rem) var(--space-5) var(--space-8);
  overflow: hidden;
}
.page-hero-texture {
  position: absolute;
  inset: 0;
  z-index: 0;
  background-image: linear-gradient(180deg, rgba(9, 14, 12, 0.93) 0%, rgba(9, 14, 12, 0.96) 60%, var(--bg-base) 100%), var(--texture-url);
  background-size: cover;
  background-position: center;
  opacity: 0.6;
}
.page-hero-inner {
  position: relative;
  z-index: 1;
  max-width: 1280px;
  margin: 0 auto;
}

.page-title {
  margin-top: var(--space-5);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 4vw, 3.2rem);
  letter-spacing: -0.02em;
  line-height: 1.12;
  max-width: 820px;
  color: var(--text-primary);
}

.page-intro-text {
  margin-top: var(--space-4);
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--text-secondary);
  max-width: 640px;
}

.page-brand-mark {
  width: 64px;
  height: 64px;
  opacity: 0.95;
}

/* ==========================================================================
   Vision page — asymmetrical content rhythm
   ========================================================================== */
.vision-sections {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-5) var(--space-9);
  display: flex;
  flex-direction: column;
  gap: var(--space-8);
}
.vision-block {
  max-width: 560px;
  padding: var(--space-6);
  border-left: 1px solid var(--border-strong);
}
.vision-block:nth-child(even) {
  margin-left: auto;
  text-align: right;
  border-left: none;
  border-right: 1px solid var(--border-strong);
}
.vision-eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent-bright);
}
.vision-heading {
  margin-top: var(--space-2);
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 2.4vw, 1.9rem);
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
.vision-text {
  margin-top: var(--space-3);
  font-size: 1rem;
  line-height: 1.75;
  color: var(--text-secondary);
}

/* ==========================================================================
   Solutions page — conceptual service cards
   ========================================================================== */
.solutions-grid {
  max-width: 1280px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-5) var(--space-9);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-5);
}
.solution-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: var(--space-6);
  transition: opacity 0.6s var(--ease-spring), transform 0.35s var(--ease-spring), border-color 0.35s ease, box-shadow 0.35s var(--ease-spring);
}
.solution-card:hover {
  transform: translateY(-6px) scale(1.015);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}
.solution-icon {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-dim);
  color: var(--accent-bright);
}
.solution-icon svg { width: 22px; height: 22px; }
.solution-title {
  margin-top: var(--space-4);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}
.solution-text {
  margin-top: var(--space-2);
  font-size: 0.94rem;
  line-height: 1.65;
  color: var(--text-secondary);
}
.solution-note {
  margin-top: var(--space-4);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

/* ==========================================================================
   Client Access page — premium nonfunctional portal preview
   ========================================================================== */
.portal-section {
  display: flex;
  justify-content: center;
  padding: 0 var(--space-5) var(--space-9);
}
.portal-panel {
  position: relative;
  width: 100%;
  max-width: 460px;
  background: linear-gradient(180deg, var(--bg-floating) 0%, var(--bg-elevated) 100%);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  padding: var(--space-7) var(--space-6) var(--space-6);
  text-align: center;
  box-shadow: var(--shadow-lg), var(--shadow-accent);
  overflow: hidden;
}
.portal-panel::before {
  content: '';
  position: absolute;
  top: 0;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-bright), transparent);
  opacity: 0.6;
}
.portal-corner {
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid var(--accent);
  opacity: 0.4;
  pointer-events: none;
}
.portal-corner--tl { top: 9px; left: 9px; border-right: none; border-bottom: none; border-radius: 4px 0 0 0; }
.portal-corner--tr { top: 9px; right: 9px; border-left: none; border-bottom: none; border-radius: 0 4px 0 0; }
.portal-corner--bl { bottom: 9px; left: 9px; border-right: none; border-top: none; border-radius: 0 0 0 4px; }
.portal-corner--br { bottom: 9px; right: 9px; border-left: none; border-top: none; border-radius: 0 0 4px 0; }

.portal-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-dim);
  color: var(--accent-bright);
  box-shadow: 0 0 0 1px var(--border-strong), 0 0 24px -4px var(--accent-glow);
}
.portal-icon svg { width: 26px; height: 26px; }

.portal-eyebrow {
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-bright);
  margin-bottom: 0.4rem;
}
.portal-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--text-primary);
}
.portal-text {
  margin-top: var(--space-3);
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--text-secondary);
}
.portal-return {
  margin-top: var(--space-6);
}

/* ==========================================================================
   Footer
   ========================================================================== */
.site-footer {
  border-top: 1px solid var(--border-subtle);
  padding: var(--space-7) var(--space-5);
}
.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
  text-align: center;
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-5);
  margin-bottom: var(--space-5);
}
.footer-nav a {
  color: var(--text-secondary);
  font-size: 0.85rem;
}
.footer-nav a:hover { color: var(--text-primary); }
.footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--text-primary);
}
.footer-brand-icon {
  width: 18px;
  height: 18px;
  opacity: 0.9;
}
.footer-tagline {
  margin-top: var(--space-2);
  font-size: 0.85rem;
  color: var(--accent-bright);
  letter-spacing: 0.04em;
}
.footer-note {
  margin-top: var(--space-4);
  font-size: 0.82rem;
  color: var(--text-tertiary);
}
.footer-copy {
  margin-top: var(--space-3);
  font-size: 0.75rem;
  color: var(--text-tertiary);
  opacity: 0.8;
}

/* ==========================================================================
   Scroll reveal (progressive enhancement)
   ========================================================================== */
[data-reveal] { opacity: 1; transform: none; }

/* Wrapped in :where() so this carries zero specificity: a component's own
   rules (e.g. .solution-card:hover) always win outright, with no fragile
   ordering/specificity fight, once the entrance reveal has finished. */
:where(.reveal-armed [data-reveal]) {
  transition: opacity 0.6s var(--ease-spring), transform 0.6s var(--ease-spring);
}
:where(.reveal-armed [data-reveal]:not(.is-visible)) {
  opacity: 0;
  transform: translateY(14px);
}
:where(.reveal-armed [data-reveal-delay="1"]) { transition-delay: 0.08s; }
:where(.reveal-armed [data-reveal-delay="2"]) { transition-delay: 0.16s; }
:where(.reveal-armed [data-reveal-delay="3"]) { transition-delay: 0.24s; }

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (min-width: 640px) {
  .brand-logo { height: 30px; }
}

@media (min-width: 860px) {
  .site-nav { display: flex; }
  .nav-toggle { display: none; }
  .mobile-nav { display: none; }
  .brand-logo { height: 34px; }
}

@media (max-width: 859.98px) {
  .header-inner { position: relative; }
}

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

@media (max-width: 639.98px) {
  .vision-block {
    max-width: none;
    margin-left: 0 !important;
    text-align: left !important;
    border-left: 1px solid var(--border-strong) !important;
    border-right: none !important;
  }
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .bg-glow,
  .network-nodes circle {
    animation: none !important;
  }
  .btn,
  .brand,
  .site-header,
  .mobile-nav,
  .nav-toggle-bar,
  .solution-card,
  [data-reveal] {
    transition: none !important;
  }
}
