/*
  Global Stylesheet
  ------------------
  Colours, typography, layout. Includes responsive breakpoints for nav, grids,
  accordion, chat, and mobile refinements.
*/

/* Colour palette */
:root {
  --primary-color: #1e3a8a;
  --secondary-color: #2563eb;
  --light-color: #f9fafb;
  --dark-text: #1f2937;
  --muted-text: #6b7280;
  --card-bg: #ffffff;
  --card-shadow: rgba(0, 0, 0, 0.05);
  --border-radius: 0.5rem;
  --transition-speed: 0.3s;
}

/* Base typography */
body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  color: var(--dark-text);
  line-height: 1.6;
  background-color: #ffffff;

  /* Safe area insets for iOS notch devices */
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

h1, h2, h3, h4 {
  margin-top: 0;
  color: var(--primary-color);
}
h1 { font-size: 2.5rem; line-height: 1.2; }
h2 { font-size: 2rem; margin-bottom: 1rem; }
h3 { font-size: 1.4rem; margin-bottom: 0.5rem; }
h4 { font-size: 1.1rem; margin-bottom: 0.5rem; }
p { margin-bottom: 1rem; }



/* Containers */
.container {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
}

.section {
  padding: 4rem 0;
}
.bg-light {
  background-color: var(--light-color);
}

.section-title {
  font-size: 2rem;
  margin-bottom: 1.5rem;
  text-align: center;
}

/* Navigation */
.site-header {
  position: sticky;
  top: 0;
  width: 100%;
  z-index: 1000;
  background-color: #ffffff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.05);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
}
.logo {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-color);
}
.logo .highlight {
  color: var(--secondary-color);
}
.nav-links {
  list-style: none;
  display: flex;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
}
.nav-links li a {
  color: var(--dark-text);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--transition-speed);
}
.nav-links li a:hover {
  color: var(--secondary-color);
}

/* Mobile navigation */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.5rem;
  color: var(--primary-color);
}

@media (max-width: 768px) {
  .nav-links {
    position: fixed;
    top: 60px;
    right: 0;
    background: #ffffff;
    flex-direction: column;
    width: 220px;
    padding: 1rem;
    box-shadow: -2px 2px 8px rgba(0, 0, 0, 0.1);
    transform: translateX(100%);
    transition: transform var(--transition-speed);
  }
  .nav-links.open {
    transform: translateX(0);
  }
  .nav-toggle {
    display: block;
  }
}

/* Hero */
.hero {
  position: relative;
  height: 70vh;
  min-height: 400px;
  background-image: url('assets/hero_bg.png');
  background-size: cover;
  background-position: center;
  color: #ffffff;
}
.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0,0,0,0.5) 0%, rgba(0,0,0,0.7) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}
.hero-content {
  text-align: center;
  max-width: 700px;
}
.hero-content h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  color: #ffffff;
}
.hero-content p {
  font-size: 1.2rem;
  margin-bottom: 2rem;
  color: #e5e7eb;
}

/* Buttons */
.btn-primary {
  display: inline-block;
  padding: 0.75rem 1.5rem;
  background: var(--secondary-color);
  color: #ffffff;
  border-radius: var(--border-radius);
  font-weight: 600;
  text-decoration: none;
  transition: background var(--transition-speed), transform var(--transition-speed);
}
.btn-primary:hover {
  background: #1d4ed8;
  transform: translateY(-2px);
}

/* Cards */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 2rem;
  margin-top: 2rem;
}
.card {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 6px var(--card-shadow);
  transition: transform var(--transition-speed), box-shadow var(--transition-speed);
}
.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 4px 12px var(--card-shadow);
}
.card-icon {
  font-size: 2rem;
  color: var(--secondary-color);
  margin-bottom: 0.5rem;
}

/* Two column layout */
.two-column {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  align-items: center;
}
.two-column > div {
  flex: 1 1 300px;
}
.image-wrapper {
  text-align: center;
}
.flag-img {
  max-width: 100%;
  height: auto;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 6px var(--card-shadow);
}

/* Accordion */
.accordion-item {
  border-bottom: 1px solid #e5e7eb;
}
.accordion-header {
  width: 100%;
  background: none;
  border: none;
  padding: 1rem 0;
  text-align: left;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
}
.accordion-header i {
  margin-left: 1rem;
  transition: transform var(--transition-speed);
}
.accordion-header.active i {
  transform: rotate(-180deg);
}
.accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--transition-speed) ease;
  padding-right: 1rem;
}
.accordion-content p {
  margin: 0 0 1rem;
}

/* Demo chat */
.demo-interface {
  margin-top: 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.chat-window {
  background: #f3f4f6;
  border-radius: var(--border-radius);
  padding: 1rem;
  height: 300px;
  overflow-y: auto;
  box-shadow: 0 2px 6px var(--card-shadow);
}
.message {
  margin-bottom: 0.75rem;
  max-width: 75%;
  padding: 0.5rem 0.75rem;
  border-radius: var(--border-radius);
  clear: both;
  word-wrap: break-word;
}
.message.agent {
  background: #dbeafe;
  color: var(--primary-color);
  float: left;
}
.message.user {
  background: #dcfce7;
  color: #166534;
  float: right;
}
.chat-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.chat-controls button {
  flex: 1 1 180px;
  padding: 0.5rem;
  background: var(--secondary-color);
  color: #ffffff;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  font-size: 0.9rem;
  transition: background var(--transition-speed);
}
.chat-controls button:hover {
  background: #1d4ed8;
}

/* Profile card */
.profile-card {
  background: var(--card-bg);
  padding: 2rem;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 6px var(--card-shadow);
}
.profile-columns {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-top: 1rem;
}
.profile-columns > div {
  flex: 1 1 200px;
}
.profile-columns ul {
  list-style: disc inside;
  margin: 0;
  padding-left: 0.5rem;
}

/* Grants table */
.grants-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.5rem;
}
.grants-table th,
.grants-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
}
.grants-table th {
  background: var(--primary-color);
  color: #ffffff;
  font-weight: 600;
}
.grants-table tr:nth-child(even) td {
  background: #f9fafb;
}

/* Contact form */
.contact-form {
  margin-top: 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
}
.contact-form .form-group {
  display: flex;
  flex-direction: column;
}
.contact-form label {
  margin-bottom: 0.3rem;
  font-weight: 600;
}
.contact-form input,
.contact-form textarea {
  padding: 0.6rem;
  border: 1px solid #e5e7eb;
  border-radius: var(--border-radius);
  font-family: inherit;
  font-size: 1rem;
}
.contact-form button {
  grid-column: 1 / -1;
  margin-top: 1rem;
}

/* Footer */
.footer {
  background: #f9fafb;
  padding: 2rem 0;
}
.citations {
  list-style: decimal inside;
  font-size: 0.9rem;
  line-height: 1.4;
}
.citations li {
  margin-bottom: 0.5rem;
}
.citations a {
  color: var(--secondary-color);
  text-decoration: underline;
}
.smallprint {
  font-size: 0.8rem;
  color: var(--muted-text);
  margin-top: 0.5rem;
}

/* Reveal animations */
.reveal {
  opacity: 0;
  transform: translateY(30px);
  transition: opacity var(--transition-speed) ease-out,
              transform var(--transition-speed) ease-out;
}
.reveal-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Skip link helper */
.visually-hidden-focusable {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.visually-hidden-focusable:focus {
  position: static;
  width: auto;
  height: auto;
  padding: .5rem;
  background: #ffffff;
  color: #000000;
  z-index: 10000;
}

/* Mobile refinements */
@media (max-width: 480px) {
  h1 { font-size: 2rem; }
  .section { padding: 3rem 0; }
  .cards-grid { gap: 1.25rem; }
  .chat-controls button { flex: 1 1 100%; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
}


/* --- Mobile overflow fixes --- */

/* 1) Never allow page to be wider than the viewport */
html, body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

/* 2) Box-sizing so padding/borders don’t push widths over 100% */
*, *::before, *::after {
  box-sizing: border-box;
}

/* 3) Media that sometimes overflows (images, iframes, videos) */
img, svg, video, canvas, iframe {
  max-width: 100%;
  height: auto;
  display: block;
}

/* 4) Calendly/Bookings embeds can force a min-width */
.calendly-inline-widget,
#booking iframe {
  width: 100% !important;
  min-width: 0 !important;
}

/* 5) Off-canvas nav shouldn’t increase page width when hidden */
@media (max-width: 768px) {
  .nav-links {
    left: auto;          /* ensure it's anchored to the right only */
    right: 0;
    max-width: 100vw;    /* never exceed viewport width */
    overflow-x: hidden;  /* no horizontal scroll from the panel itself */
  }
}

/* 6) Tables: prevent page-wide overflow; allow table to scroll instead */
.grants-table {
  table-layout: fixed;   /* cells wrap instead of expanding table */
  word-wrap: break-word;
  width: 100%;
  display: block;        /* enable horizontal scrolling on the table only */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.grants-table th, .grants-table td {
  word-break: break-word;
}

/* 7) Extra small screens: tighten spacing to avoid accidental overflow */
@media (max-width: 380px) {
  .section { padding: 2.5rem 0; }
  .nav-links { width: 200px; } /* a bit narrower on very small phones */
}

/* Keep the page from widening */
html, body { overflow-x: hidden; }

/* Scrollable table for small screens */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.grants-table {
  border-collapse: collapse;
  min-width: 600px; /* prevent columns from collapsing */
}

.grants-table th,
.grants-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #e5e7eb;
  white-space: normal;
  word-break: normal;
}

.grants-table th {
  background: var(--primary-color);
  color: #fff;
  font-weight: 600;
  white-space: nowrap;
}


/* --- Text wrap + sizing fixes (phones & tablets) --- */

/* Let long words/phrases wrap naturally (no weird letter-per-line breaks) */
h1, h2, h3, h4, p, .section-title {
  word-break: normal;
  overflow-wrap: anywhere;   /* allows breaks when needed without clipping */
  hyphens: auto;
}

/* Scale big headings responsively so they never overflow the viewport */
.hero-content h1 {
  /* From ~26px on tiny phones up to your original ~40px on desktop */
  font-size: clamp(1.6rem, 6vw + 0.2rem, 2.5rem);
  line-height: 1.2;     /* tighter but safe for multiple lines */
  margin-bottom: 1rem;
}

/* Body copy a touch smaller on narrow screens */
@media (max-width: 480px) {
  .hero-content p {
    font-size: 1rem;
    line-height: 1.5;
  }
}

/* Prevent any parent from clipping text horizontally */
.container, .hero-content, .section, header, footer {
  overflow: visible;
}

/* Safety: never allow horizontal overflow from text */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

/* Header/logo tune so it doesn’t push layout */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: nowrap;
  min-width: 0; /* allows children to shrink instead of pushing page wider */
}
.logo {
  white-space: nowrap;
}
@media (max-width: 480px) {
  .logo { font-size: 1.1rem; }
}

/* --- Blog & Products shared styles --- */
.card h3 {
  margin-top: 0;
  color: var(--primary-color);
}

.card a.btn-primary {
  margin-top: 1rem;
  display: inline-block;
}

.nav-links li a.active {
  color: var(--secondary-color);
  font-weight: 700;
  border-bottom: 2px solid var(--secondary-color);
}
/* --- Voice Agent Section --- */
.voice-agent-box {
  display: flex;
  align-items: center;
  gap: 1rem;
  background: var(--card-bg);
  padding: 1.5rem;
  border-radius: var(--border-radius);
  box-shadow: 0 2px 6px var(--card-shadow);
  margin-top: 2rem;
}

.phone-icon {
  font-size: 3rem;
  color: var(--secondary-color);
}

.voice-agent-text h3 {
  margin: 0;
  font-size: 1.4rem;
  color: var(--primary-color);
}

.voice-agent-text a {
  color: var(--secondary-color);
  text-decoration: none;
  font-weight: 600;
}

.voice-agent-text a:hover {
  text-decoration: underline;
}

.coming-soon {
  margin-top: 2rem;
  background: #f3f4f6;
  padding: 1rem 1.5rem;
  border-radius: var(--border-radius);
}

.coming-soon h4 {
  margin-top: 0;
  color: var(--primary-color);
}
.coming-soon ul {
  list-style: disc inside;
  margin: 0.5rem 0 0 0;
  padding: 0;
}


