*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --rail-black: #2C2F2A;
  --sage: #6B7F5E;
  --sage-light: #A3B18A;
  --copper: #B8860B;
  --ivory: #FAF8F4;
  --parchment: #F2EFE9;
  --stone: #E0DDD6;
  --slate: #6B6F66;
  --charcoal: #3D4038;
  --font-display: 'Cormorant Garamond', Georgia, serif;
  --font-body: 'Outfit', 'Helvetica Neue', sans-serif;
  --font-mono: 'DM Mono', monospace;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  color: var(--rail-black);
  background-color: var(--ivory);
  -webkit-font-smoothing: antialiased;
}

/* ── NAV ── */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--rail-black);
  padding: 0 40px;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: box-shadow 0.3s ease;
}
.nav.scrolled { box-shadow: 0 2px 24px rgba(0,0,0,0.2); }
.nav-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.nav-logo svg { flex-shrink: 0; }
.nav-wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.02em;
  color: var(--ivory);
}
.nav-wordmark span { color: var(--sage-light); }
.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
}
.nav-link {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--sage-light);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 6px;
  transition: all 0.2s ease;
  letter-spacing: 0.02em;
}
.nav-link:hover { color: var(--ivory); background: rgba(163,177,138,0.1); }
.nav-link--primary {
  background: var(--sage);
  color: var(--ivory);
}
.nav-link--primary:hover { background: var(--sage-light); color: var(--rail-black); }

/* ── HERO ── */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 120px 40px 80px;
  position: relative;
  overflow: hidden;
}
.hero-network {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.hero::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(107,127,94,0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 50%, rgba(184,134,11,0.04) 0%, transparent 60%);
  pointer-events: none;
}
.hero-inner {
  max-width: 900px;
  text-align: center;
  position: relative;
  z-index: 1;
}
.hero-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sage);
  border: 1px solid var(--stone);
  padding: 6px 16px;
  border-radius: 100px;
  margin-bottom: 32px;
}
.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(36px, 5.5vw, 64px);
  font-weight: 700;
  line-height: 1.08;
  margin-bottom: 24px;
  color: var(--rail-black);
}
.hero h1 em {
  font-style: normal;
  color: var(--sage);
}
.hero-sub {
  font-size: 18px;
  font-weight: 400;
  line-height: 1.7;
  color: var(--charcoal);
  max-width: 620px;
  margin: 0 auto 48px;
}
.hero-ctas {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  padding: 14px 32px;
  border-radius: 8px;
  text-decoration: none;
  transition: all 0.2s ease;
  border: none;
  cursor: pointer;
}
.btn--sage {
  background: var(--sage);
  color: var(--ivory);
}
.btn--sage:hover { background: #5A6E4F; transform: translateY(-1px); box-shadow: 0 4px 16px rgba(107,127,94,0.3); }
.btn--outline {
  background: transparent;
  color: var(--rail-black);
  border: 1.5px solid var(--stone);
}
.btn--outline:hover { border-color: var(--sage); color: var(--sage); transform: translateY(-1px); }
.btn--outline-light {
  background: transparent;
  color: var(--ivory);
  border: 1.5px solid rgba(250,248,244,0.2);
}
.btn--outline-light:hover { border-color: var(--sage); background: var(--sage); }
.btn svg { width: 16px; height: 16px; }

/* ── SECTION SHARED ── */
section { padding: 100px 40px; }
.section-inner { max-width: 1080px; margin: 0 auto; }
.section-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--sage);
  display: block;
  margin-bottom: 12px;
}
.section-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 3.5vw, 42px);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 16px;
}
.section-desc {
  font-size: 16px;
  line-height: 1.7;
  color: var(--charcoal);
  max-width: 600px;
  margin-bottom: 48px;
}

/* ── PILLARS ── */
.pillars { background: var(--parchment); }
.pillar-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.pillar-card {
  background: var(--ivory);
  border-radius: 10px;
  padding: 36px 28px;
  border-left: 3px solid var(--sage);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.pillar-card:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(0,0,0,0.06); }
.pillar-icon {
  width: 44px;
  height: 44px;
  background: var(--parchment);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}
.pillar-icon svg { width: 22px; height: 22px; color: var(--sage); }
.pillar-card h3 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 10px;
}
.pillar-card p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--slate);
}

/* ── PORTALS (original) ── */
.portals-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.portal-card {
  background: var(--rail-black);
  border-radius: 12px;
  padding: 48px 40px;
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.portal-card:hover { transform: translateY(-3px); box-shadow: 0 12px 40px rgba(0,0,0,0.15); }
.portal-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sage-light);
  margin-bottom: 16px;
}
.portal-card h3 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--ivory);
  margin-bottom: 12px;
}
.portal-card p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--sage-light);
  margin-bottom: 32px;
  flex: 1;
}
.portal-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--ivory);
  text-decoration: none;
  padding: 12px 24px;
  border: 1.5px solid rgba(250,248,244,0.2);
  border-radius: 8px;
  transition: all 0.2s ease;
  align-self: flex-start;
}
.portal-link:hover {
  background: var(--sage);
  border-color: var(--sage);
}
.portal-link svg { width: 16px; height: 16px; }

/* ── PRODUCTS GRID ── */
.products { background: var(--ivory); }
.products-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
.product-card {
  background: var(--ivory);
  border-radius: 10px;
  padding: 40px 32px;
  border-left: 3px solid var(--sage);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
}
.product-card:hover { transform: translateY(-2px); box-shadow: 0 8px 32px rgba(0,0,0,0.06); }
.product-card--featured {
  grid-column: 1 / -1;
  background: var(--rail-black);
  border-left-color: var(--sage-light);
}
.product-card--featured h3 { color: var(--ivory); }
.product-card--featured .product-tagline { color: var(--sage-light); }
.product-card--featured p { color: var(--sage-light); }
.product-card--parchment {
  background: var(--parchment);
}
.product-tagline {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--sage);
  margin-bottom: 12px;
}
.product-card h3 {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  margin-bottom: 12px;
}
.product-card p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--slate);
  margin-bottom: 24px;
  flex: 1;
}
.product-card .btn {
  align-self: flex-start;
  font-size: 13px;
  padding: 10px 24px;
}

/* ── WHY CORERAIL ── */
.why-corerail {
  background: var(--parchment);
}
.why-corerail .section-title {
  margin-bottom: 32px;
}
.why-corerail-lead {
  font-family: var(--font-display);
  font-size: clamp(18px, 2.2vw, 22px);
  font-weight: 600;
  line-height: 1.5;
  color: var(--rail-black);
  margin-bottom: 32px;
  max-width: 720px;
}
.why-corerail-body p {
  font-size: 16px;
  line-height: 1.8;
  color: var(--charcoal);
  max-width: 720px;
  margin-bottom: 20px;
}
.why-corerail-body p:last-child {
  margin-bottom: 0;
  font-weight: 500;
  color: var(--rail-black);
}

/* ── DEMO SECTION ── */
.demo { background: var(--ivory); }
.demo-card {
  background: var(--rail-black);
  border-radius: 12px;
  padding: 48px 40px;
  display: flex;
  align-items: center;
  gap: 48px;
}
.demo-content { flex: 1; }
.demo-content h3 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  color: var(--ivory);
  margin-bottom: 12px;
}
.demo-content p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--sage-light);
  margin-bottom: 24px;
  max-width: 480px;
}
.demo-visual {
  width: 200px;
  height: 160px;
  background: var(--charcoal);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.demo-visual svg { width: 48px; height: 48px; color: var(--sage-light); }

/* ── POSITIONING ── */
.positioning {
  background: var(--rail-black);
  text-align: center;
}
.positioning .section-label { color: var(--sage-light); }
.positioning blockquote {
  font-family: var(--font-display);
  font-size: clamp(22px, 2.8vw, 32px);
  font-weight: 500;
  line-height: 1.5;
  color: var(--ivory);
  max-width: 800px;
  margin: 0 auto;
}

/* ── CTA SECTION ── */
.cta-section {
  background: var(--parchment);
  text-align: center;
}
.cta-section .section-title {
  margin-bottom: 12px;
}
.cta-section p {
  font-size: 16px;
  line-height: 1.7;
  color: var(--charcoal);
  max-width: 540px;
  margin: 0 auto 32px;
}

/* ── FOOTER ── */
.footer {
  background: var(--rail-black);
  border-top: 1px solid rgba(250,248,244,0.08);
  padding: 40px;
}
.footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.footer-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.footer-wordmark {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--ivory);
}
.footer-wordmark span { color: var(--sage-light); }
.footer-copy {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--slate);
}
.footer-links {
  display: flex;
  gap: 24px;
}
.footer-links a {
  font-size: 13px;
  color: var(--sage-light);
  text-decoration: none;
  transition: color 0.2s ease;
}
.footer-links a:hover { color: var(--ivory); }

/* ── PRODUCT PAGE HERO ── */
.page-hero {
  padding: 140px 40px 80px;
  position: relative;
  overflow: hidden;
}
.page-hero::after {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background:
    radial-gradient(ellipse at 20% 50%, rgba(107,127,94,0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 50%, rgba(184,134,11,0.04) 0%, transparent 60%);
  pointer-events: none;
}
.page-hero-inner {
  max-width: 720px;
  position: relative;
  z-index: 1;
}
.page-hero .hero-badge {
  margin-bottom: 24px;
}
.page-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(32px, 4.5vw, 52px);
  font-weight: 700;
  line-height: 1.1;
  margin-bottom: 20px;
  color: var(--rail-black);
}
.page-hero h1 em {
  font-style: normal;
  color: var(--sage);
}
.page-hero p {
  font-size: 18px;
  line-height: 1.7;
  color: var(--charcoal);
  max-width: 600px;
}

/* ── PROBLEM/SOLUTION ── */
.problem-solution { background: var(--parchment); }
.ps-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
}
.ps-block h3 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 16px;
}
.ps-block p {
  font-size: 15px;
  line-height: 1.8;
  color: var(--charcoal);
}

/* ── FEATURES LIST ── */
.features { background: var(--ivory); }
.features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.feature-card {
  background: var(--parchment);
  border-radius: 10px;
  padding: 32px 24px;
  border-left: 3px solid var(--sage);
}
.feature-card h3,
.feature-card h4 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}
.feature-card p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--slate);
}

/* ── ROLES SECTION ── */
.roles-section { background: var(--ivory); }
.roles-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}
.role-card {
  background: var(--parchment);
  border-radius: 10px;
  padding: 32px 24px;
  border-left: 3px solid var(--sage);
}
.role-card h3 {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 12px;
}
.role-card p {
  font-size: 14px;
  line-height: 1.7;
  color: var(--slate);
}

/* ── TECH STRIP ── */
.tech-strip {
  background: var(--rail-black);
  padding: 48px 40px;
  text-align: center;
}
.tech-strip .section-label { color: var(--sage-light); margin-bottom: 20px; }
.tech-tags {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}
.tech-tag {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--sage-light);
  padding: 6px 16px;
  border: 1px solid rgba(163,177,138,0.2);
  border-radius: 100px;
}

/* ── CASE STUDY ── */
.case-study-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 24px;
  margin-top: 48px;
}
.stat-card {
  text-align: center;
  background: var(--ivory);
  border-radius: 10px;
  padding: 32px 20px;
}
.stat-number {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 700;
  color: var(--sage);
  display: block;
  margin-bottom: 4px;
}
.stat-label {
  font-size: 13px;
  color: var(--slate);
}

/* ── BACK LINK ── */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--sage);
  text-decoration: none;
  margin-bottom: 24px;
  transition: color 0.2s ease;
}
.back-link:hover { color: var(--rail-black); }
.back-link svg { width: 14px; height: 14px; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .nav { padding: 0 20px; }
  .nav-wordmark { font-size: 18px; }
  .nav-links { gap: 4px; }
  .nav-link { padding: 6px 12px; font-size: 12px; }

  section { padding: 64px 20px; }
  .hero { padding: 100px 20px 60px; }
  .page-hero { padding: 100px 20px 60px; }

  .pillar-grid { grid-template-columns: 1fr; }
  .portals-grid { grid-template-columns: 1fr; }
  .products-grid { grid-template-columns: 1fr; }
  .ps-grid { grid-template-columns: 1fr; }
  .features-grid { grid-template-columns: 1fr; }
  .roles-grid { grid-template-columns: 1fr; }
  .case-study-stats { grid-template-columns: 1fr 1fr; }

  .product-card--featured { grid-column: auto; }

  .hero-ctas { flex-direction: column; align-items: center; }
  .btn { width: 100%; max-width: 300px; justify-content: center; }

  .demo-card { flex-direction: column; text-align: center; }
  .demo-visual { width: 100%; max-width: 200px; }

  .footer-inner { flex-direction: column; gap: 20px; text-align: center; }
  .footer-links { flex-wrap: wrap; justify-content: center; }
}

@media (max-width: 480px) {
  .nav-links .nav-link:not(.nav-link--primary) { display: none; }
  .case-study-stats { grid-template-columns: 1fr; }
}
