/* ══════════════════════════════════════════════════
   Applied R&D — Shared Styles
   ══════════════════════════════════════════════════ */

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body { font-family: 'Inter', -apple-system, sans-serif; color: #1a1a2e; line-height: 1.65; font-size: 16px; -webkit-font-smoothing: antialiased; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }

/* ── Colors ── */
:root {
  --primary: #0F4C75;
  --primary-dark: #0B3D61;
  --accent: #00B4D8;
  --accent-glow: rgba(0, 180, 216, 0.3);
  --dark: #1a1a2e;
  --gray: #6b7280;
  --light: #f8fafc;
  --white: #ffffff;
}

/* ── Nav ── */
.nav { position: fixed; top: 0; left: 0; right: 0; z-index: 100; padding: 16px 0; transition: all 0.3s; background: #fff; box-shadow: 0 1px 8px rgba(0,0,0,0.08); }
.nav.scrolled { background: #fff; backdrop-filter: blur(12px); padding: 10px 0; box-shadow: 0 2px 20px rgba(0,0,0,0.1); }
.nav-inner { max-width: 1100px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; justify-content: space-between; }
.nav-logo { font-weight: 800; font-size: 18px; color: var(--dark); letter-spacing: -0.3px; }
.nav-logo span { color: var(--accent); }
.nav-links { display: flex; gap: 32px; align-items: center; }
.nav-links a { color: var(--dark); font-size: 14px; font-weight: 500; transition: color 0.2s; }
.nav-links a:hover { color: var(--primary); }
.nav-links a.active { color: var(--accent); }
.nav-cta { background: var(--accent); color: #fff !important; padding: 8px 20px; border-radius: 8px; font-weight: 600; }
.nav-cta:hover { background: #00a0c0; }
.nav-toggle { display: none; background: none; border: none; color: var(--dark); font-size: 24px; cursor: pointer; }

/* ── Hero (shared) ── */
.hero { background: linear-gradient(135deg, #0F4C75 0%, #1a1a2e 60%, #16213e 100%); min-height: 100vh; display: flex; align-items: center; position: relative; overflow: hidden; }
.hero.hero-short { min-height: 60vh; }
.hero::before { content: ''; position: absolute; top: -50%; right: -20%; width: 800px; height: 800px; background: radial-gradient(circle, rgba(0,180,216,0.08) 0%, transparent 70%); pointer-events: none; }
.hero-inner { max-width: 1100px; margin: 0 auto; padding: 120px 24px 80px; position: relative; z-index: 1; width: 100%; }
.hero-badge { display: inline-block; background: rgba(0,180,216,0.15); border: 1px solid rgba(0,180,216,0.3); color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; padding: 6px 16px; border-radius: 50px; margin-bottom: 24px; }
.hero h1 { font-size: clamp(36px, 6vw, 64px); font-weight: 900; color: #fff; line-height: 1.08; letter-spacing: -1.5px; margin-bottom: 20px; max-width: 700px; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero p { font-size: clamp(16px, 2vw, 20px); color: rgba(255,255,255,0.75); max-width: 600px; margin-bottom: 36px; line-height: 1.6; font-weight: 400; }
.hero-btns { display: flex; gap: 14px; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 48px; margin-top: 56px; padding-top: 32px; border-top: 1px solid rgba(255,255,255,0.1); }
.hero-stat-num { font-size: 32px; font-weight: 900; color: var(--accent); }
.hero-stat-label { font-size: 13px; color: rgba(255,255,255,0.55); margin-top: 2px; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 14px 28px; border-radius: 10px; font-size: 15px; font-weight: 700; transition: all 0.2s; cursor: pointer; border: none; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 4px 20px var(--accent-glow); }
.btn-primary:hover { background: #00a0c0; transform: translateY(-1px); }
.btn-outline { background: transparent; color: #fff; border: 2px solid rgba(255,255,255,0.3); }
.btn-outline:hover { border-color: rgba(255,255,255,0.6); }
.btn-dark-outline { background: transparent; color: var(--primary); border: 2px solid var(--primary); }
.btn-dark-outline:hover { background: var(--primary); color: #fff; }

/* ── Section common ── */
.section { padding: 80px 24px; }
.section-inner { max-width: 1100px; margin: 0 auto; }
.section-label { font-size: 12px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--accent); margin-bottom: 8px; }
.section-title { font-size: clamp(28px, 4vw, 40px); font-weight: 800; color: var(--dark); letter-spacing: -0.5px; margin-bottom: 12px; }
.section-sub { font-size: 17px; color: var(--gray); max-width: 600px; margin-bottom: 48px; }
.bg-light { background: var(--light); }

/* ── Pillar Cards (Landing page) ── */
.pillars-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px; }
.pillar-card { background: var(--white); border: 1px solid #e5e7eb; border-radius: 20px; padding: 40px 32px; transition: all 0.3s; text-align: center; position: relative; overflow: hidden; }
.pillar-card:hover { border-color: var(--accent); box-shadow: 0 12px 40px rgba(0,180,216,0.12); transform: translateY(-6px); }
.pillar-icon { width: 64px; height: 64px; background: linear-gradient(135deg, var(--primary), var(--accent)); border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 28px; margin: 0 auto 20px; }
.pillar-card h3 { font-size: 22px; font-weight: 800; color: var(--dark); margin-bottom: 12px; }
.pillar-card p { font-size: 15px; color: var(--gray); line-height: 1.65; margin-bottom: 24px; }
.pillar-link { font-size: 14px; font-weight: 700; color: var(--accent); display: inline-flex; align-items: center; gap: 6px; transition: gap 0.2s; }
.pillar-link:hover { gap: 10px; }

/* ── Services grid (sub-pages) ── */
.services-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.service-card { background: var(--white); border: 1px solid #e5e7eb; border-radius: 16px; padding: 32px 24px; transition: all 0.25s; }
.service-card:hover { border-color: var(--accent); box-shadow: 0 8px 32px rgba(0,180,216,0.1); transform: translateY(-4px); }
.service-icon { width: 48px; height: 48px; background: linear-gradient(135deg, var(--primary), var(--accent)); border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 16px; }
.service-card h3 { font-size: 18px; font-weight: 800; color: var(--dark); margin-bottom: 8px; }
.service-card p { font-size: 14px; color: var(--gray); line-height: 1.6; }

/* ── Case Study Cards ── */
.case-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px; }
.case-card { background: var(--white); border: 1px solid #e5e7eb; border-radius: 16px; padding: 32px; transition: all 0.25s; }
.case-card:hover { box-shadow: 0 8px 32px rgba(0,0,0,0.08); transform: translateY(-3px); }
.case-card .tag { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; padding: 4px 10px; border-radius: 50px; margin-bottom: 12px; }
.tag-health { background: rgba(0,180,216,0.1); color: var(--accent); }
.tag-research { background: rgba(15,76,117,0.1); color: var(--primary); }
.tag-ai { background: rgba(139, 92, 246, 0.1); color: #7c3aed; }
.tag-sred { background: rgba(16, 185, 129, 0.1); color: #059669; }
.tag-mfg { background: rgba(245, 158, 11, 0.1); color: #d97706; }
.case-card h3 { font-size: 20px; font-weight: 800; color: var(--dark); margin-bottom: 10px; }
.case-card p { font-size: 14px; color: var(--gray); line-height: 1.65; margin-bottom: 12px; }
.case-card .result { font-size: 13px; font-weight: 600; color: var(--primary); }
.case-card a.case-link { font-size: 13px; font-weight: 700; color: var(--accent); }

/* ── App Table ── */
.app-table { width: 100%; border-collapse: separate; border-spacing: 0; border-radius: 12px; overflow: hidden; border: 1px solid #e5e7eb; margin-bottom: 32px; }
.app-table thead { background: var(--primary); }
.app-table th { color: #fff; font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; padding: 14px 20px; text-align: left; }
.app-table td { padding: 14px 20px; font-size: 14px; color: var(--gray); border-bottom: 1px solid #f0f0f0; }
.app-table tbody tr:last-child td { border-bottom: none; }
.app-table tbody tr:hover { background: rgba(0,180,216,0.03); }
.app-table td:first-child { font-weight: 600; color: var(--dark); }

/* ── Process Steps ── */
.process-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; margin-top: 48px; }
.process-step { text-align: center; }
.step-num { width: 48px; height: 48px; background: var(--accent); color: #fff; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 20px; font-weight: 900; margin: 0 auto 16px; }
.process-step h3 { font-size: 18px; font-weight: 800; color: var(--dark); margin-bottom: 8px; }
.process-step p { font-size: 14px; color: var(--gray); line-height: 1.6; }

/* ── Partner block ── */
.partner-block { display: flex; gap: 40px; align-items: center; background: var(--white); border: 1px solid #e5e7eb; border-radius: 16px; padding: 40px; margin-top: 48px; }
.partner-logo { min-width: 240px; text-align: center; }
.partner-logo .logo-text { font-size: 32px; font-weight: 900; color: var(--primary); }
.partner-logo .logo-sub { font-size: 11px; color: var(--gray); text-transform: uppercase; letter-spacing: 1px; margin-top: 4px; }
.partner-info h3 { font-size: 20px; font-weight: 800; color: var(--dark); margin-bottom: 8px; }
.partner-info p { font-size: 15px; color: var(--gray); line-height: 1.65; }
.partner-info a { color: var(--accent); font-weight: 600; }

/* ── Founder Section ── */
.founder-layout { display: grid; grid-template-columns: 280px 1fr; gap: 48px; align-items: center; }
.founder-photo { width: 280px; height: 280px; border-radius: 20px; object-fit: cover; border: 4px solid rgba(0,180,216,0.2); }
.founder-info h3 { font-size: 24px; font-weight: 800; color: var(--dark); margin-bottom: 4px; }
.founder-role { font-size: 14px; color: var(--accent); font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 16px; }
.founder-info p { font-size: 15px; color: var(--gray); line-height: 1.7; margin-bottom: 12px; }
.founder-credentials { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 20px; }
.founder-cred { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--gray); background: var(--light); padding: 6px 14px; border-radius: 50px; font-weight: 500; }

/* ── Feature list ── */
.feature-list { list-style: none; }
.feature-list li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; font-size: 15px; color: var(--gray); line-height: 1.6; }
.feature-list li::before { content: '\2713'; color: var(--accent); font-weight: 900; font-size: 16px; min-width: 20px; }

/* ── Tech stack badges ── */
.tech-stack { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.tech-badge { font-size: 13px; font-weight: 600; color: var(--primary); background: rgba(15,76,117,0.08); padding: 6px 14px; border-radius: 8px; }

/* ── Two-col layout ── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; align-items: start; }

/* ── CTA ── */
.cta { background: linear-gradient(135deg, #0F4C75 0%, #1a1a2e 100%); padding: 80px 24px; text-align: center; }
.cta h2 { font-size: clamp(28px, 4vw, 40px); font-weight: 800; color: #fff; margin-bottom: 12px; }
.cta p { font-size: 17px; color: rgba(255,255,255,0.7); max-width: 500px; margin: 0 auto 32px; }

/* ── Footer ── */
.footer { background: #0d0d1a; padding: 40px 24px; text-align: center; }
.footer p { font-size: 13px; color: rgba(255,255,255,0.4); }
.footer a { color: var(--accent); }
.footer-links { display: flex; justify-content: center; gap: 24px; margin-bottom: 16px; }
.footer-links a { font-size: 13px; color: rgba(255,255,255,0.5); }
.footer-links a:hover { color: var(--accent); }

/* ── Breadcrumb ── */
.breadcrumb { font-size: 13px; color: rgba(255,255,255,0.5); margin-bottom: 16px; }
.breadcrumb a { color: rgba(255,255,255,0.5); }
.breadcrumb a:hover { color: var(--accent); }

/* ── Chat widget mobile fix — move close button above input ── */
@media (max-width: 480px) {
  .ard-embed-bubble.ard--close {
    bottom: 120px !important;
    right: 12px !important;
    height: 44px !important;
    width: 44px !important;
    padding: 0 10px !important;
    border-radius: 50% !important;
  }
}

/* ── Mobile back button ── */
.mobile-back {
  display: none;
}
@media (max-width: 768px) {
  .mobile-back {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255,255,255,0.15);
    border: 1.5px solid rgba(255,255,255,0.35);
    color: #fff;
    font-family: 'Inter', sans-serif;
    font-size: 15px;
    font-weight: 600;
    padding: 8px 18px;
    border-radius: 8px;
    margin-bottom: 16px;
    text-decoration: none;
    backdrop-filter: blur(4px);
  }
}

/* ── Hero Flow (SR&ED) ── */
.hero-flow { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.hero-flow-box { background: rgba(255,255,255,0.15); backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,0.25); border-radius: 12px; padding: 16px 28px; text-align: center; }
.hero-flow-box-accent { background: rgba(0,180,216,0.2); border-color: rgba(0,180,216,0.4); }
.hero-flow-icon { font-size: 28px; margin-bottom: 4px; }
.hero-flow-img { height: 48px; margin: 0 auto 4px; }
.hero-flow-label { font-size: 18px; font-weight: 700; color: #fff; }
.hero-flow-arrow { font-size: 32px; color: rgba(255,255,255,0.6); }

/* ══════════════════════════════════════════════════
   Responsive
   ══════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-links.open { display: flex; flex-direction: column; position: absolute; top: 100%; left: 0; right: 0; background: #fff; padding: 24px; gap: 20px; box-shadow: 0 8px 20px rgba(0,0,0,0.1); }
  .nav-links.open a { font-size: 18px !important; }
  .nav-toggle { display: block; }
  .pillars-grid { grid-template-columns: 1fr; }
  .services-grid { grid-template-columns: 1fr; }
  .case-grid { grid-template-columns: 1fr; }
  .process-steps { grid-template-columns: 1fr; gap: 32px; }
  .two-col { grid-template-columns: 1fr; gap: 32px; }
  .founder-layout { grid-template-columns: 1fr; text-align: center; }
  .founder-photo { margin: 0 auto; width: 200px; height: 200px; }
  .founder-credentials { justify-content: center; }
  .hero-stats { flex-direction: column; gap: 20px; }
  .hero-btns { flex-direction: column; }
  .btn { justify-content: center; }
  .partner-block { flex-direction: column; text-align: center; gap: 24px; }
  .hero-flow { gap: 12px; flex-wrap: nowrap; }
  .hero-flow-box { background: none; border: none; padding: 0; backdrop-filter: none; }
  .hero-flow-box-accent { background: none; border: none; padding: 0; }
  .hero-flow-label { display: none; }
  .hero-flow-icon { font-size: 40px; margin-bottom: 0; }
  .hero-flow-img { height: 48px; margin-bottom: 0; }
  .hero-flow-arrow { font-size: 24px; }
  /* ── App table → cards on mobile ── */
  .app-table { border: none !important; }
  .app-table thead { display: none !important; }
  .app-table tbody tr {
    display: block !important;
    background: var(--white);
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px !important;
    margin-bottom: 12px;
  }
  .app-table tbody tr:hover { background: var(--white); }
  .app-table td {
    display: block !important;
    border: none !important;
    padding: 2px 0 !important;
    font-size: 14px !important;
  }
  .app-table td:first-child {
    font-size: 17px !important;
    font-weight: 800 !important;
    color: var(--dark) !important;
    margin-bottom: 4px !important;
  }
  .app-table td:nth-child(2) {
    color: var(--gray) !important;
    line-height: 1.5 !important;
    margin-bottom: 6px !important;
  }
  .app-table td:nth-child(3) {
    font-size: 13px !important;
    font-weight: 600 !important;
    color: var(--accent) !important;
    margin-bottom: 4px !important;
  }
  .app-table td:nth-child(4) {
    font-size: 12px !important;
    color: var(--gray) !important;
  }

  /* ── Mobile font size bump ── */
  body { font-size: 17px; }
  .hero h1 { font-size: clamp(28px, 8vw, 44px); }
  .hero p, .hero-subtitle { font-size: 17px !important; }
  .section-title { font-size: clamp(24px, 6vw, 32px); }
  .section-sub { font-size: 16px; }
  .work-card-body h3 { font-size: 19px; }
  .work-card-body p { font-size: 16px; }
  .work-card-body .card-detail { font-size: 14px; }
  .founder-info p { font-size: 16px; }
  .founder-info h3 { font-size: 22px; }
  .service-card h3 { font-size: 17px; }
  .service-card p { font-size: 15px; }
  .case-card h3 { font-size: 19px; }
  .case-card p { font-size: 15px; }
  .pillar-card h3 { font-size: 20px; }
  .pillar-card p { font-size: 16px; }
  .footer p, .footer-links a { font-size: 14px; }

  /* ── Collapsible work cards ── */
  .section { padding: 36px 16px !important; }
  .work-cards { gap: 10px !important; padding: 0 12px !important; }
  .work-card {
    display: grid !important;
    grid-template-columns: 56px 1fr !important;
    align-items: center !important;
    gap: 0 14px !important;
    padding: 10px 16px !important;
    cursor: pointer;
    text-align: left !important;
    border-radius: 10px !important;
  }
  .work-card:not(.expanded) { padding: 8px 16px !important; }
  /* Hide icon when collapsed, show when expanded */
  .work-card:not(.expanded) .work-card-icon { display: none !important; }
  .work-card:not(.expanded) { grid-template-columns: 1fr !important; }
  .work-card.expanded .work-card-icon[style*="gap"] { display: flex !important; justify-content: center; width: 100%; grid-column: 1 / -1; margin-bottom: 8px; }
  .work-card-body {
    grid-column: 2 !important;
    grid-row: 1 !important;
  }
  .work-card-body h3 { margin-bottom: 0 !important; font-size: 16px !important; }
  .work-card-body h3::after { content: ' \25BC'; font-size: 18px; color: var(--accent); margin-left: 8px; transition: transform 0.3s ease; display: inline-block; vertical-align: middle; }
  .work-card.expanded .work-card-body h3::after { transform: rotate(180deg); }
  .work-card:not(.expanded) .work-card-body p,
  .work-card:not(.expanded) .work-card-body .card-detail {
    display: none !important;
  }
  /* Expanded: body spans full width below */
  .work-card.expanded .work-card-body {
    grid-column: 1 / -1 !important;
    grid-row: 2 !important;
    padding-top: 10px;
  }
  .work-card.expanded .work-card-body h3 { margin-bottom: 8px !important; }
  .work-card.expanded .work-card-body p,
  .work-card.expanded .work-card-body .card-detail {
    max-height: 500px; opacity: 1; margin-bottom: 6px !important;
  }
  .work-card.expanded .work-card-body .card-detail {
    display: inline-block !important;
    border: 2px solid var(--accent) !important;
    border-radius: 8px !important;
    padding: 8px 18px !important;
    margin-top: 8px !important;
    font-size: 13px !important;
    font-weight: 700 !important;
    color: var(--accent) !important;
    text-align: center !important;
  }
}
