/**
 * Bootstrap Replacement CSS
 * Replaces Bootstrap 5 (~230KB) with only the classes actually used (~4KB)
 * Used by: container, display utilities, table-responsive, modal, accordion,
 *          alerts, form controls, btn-close
 */

/* ==========================================================================
   Self-hosted Google Fonts — Roboto via CDN (eliminates 230ms external chain)
   NOTE: R2 bucket must have CORS header: Access-Control-Allow-Origin: *
   ========================================================================== */
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 300;
  font-display: optional;
  src: url('https://cdn.kmstechnologies.co.in/fonts/roboto-300.woff2') format('woff2');
}
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 400;
  font-display: optional;
  src: url('https://cdn.kmstechnologies.co.in/fonts/roboto-400.woff2') format('woff2');
}
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 500;
  font-display: optional;
  src: url('https://cdn.kmstechnologies.co.in/fonts/roboto-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Roboto';
  font-style: normal;
  font-weight: 700;
  font-display: optional;
  src: url('https://cdn.kmstechnologies.co.in/fonts/roboto-700.woff2') format('woff2');
}

/* ==========================================================================
   Layout Performance — CSS Containment
   Tells browser to skip rendering off-screen sections until they scroll into
   view, reducing initial layout cost (forced reflow).
   ========================================================================== */
section,
footer,
.footer-pro,
.accordion {
  content-visibility: auto;
  contain-intrinsic-size: auto 500px;
}
/* ==========================================================================
   Container
   ========================================================================== */
.container {
  width: 100%;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 15px;
  padding-right: 15px;
}

/* ==========================================================================
   Display Utilities
   ========================================================================== */
.d-none    { display: none !important; }
.d-flex    { display: flex !important; }
.d-block   { display: block !important; }

@media (min-width: 768px) {
  .d-md-none  { display: none !important; }
  .d-md-flex  { display: flex !important; }
  .d-md-block { display: block !important; }
}

/* ==========================================================================
   Table Responsive
   ========================================================================== */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.table-responsive table {
  width: 100%;
  border-collapse: collapse;
}

/* ==========================================================================
   Modal
   ========================================================================== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1055;
  width: 100%;
  height: 100%;
  overflow: hidden;
  outline: 0;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1050;
  background: rgba(0, 0, 0, 0.5);
  opacity: 0;
  transition: opacity 0.15s linear;
}
.modal-backdrop.show { opacity: 1; }

.modal.fade .modal-dialog {
  transform: translateY(-30px);
  transition: transform 0.3s ease-out;
}
.modal.show .modal-dialog {
  transform: translateY(0);
}

.modal-dialog {
  position: relative;
  width: auto;
  margin: 0.5rem;
  max-width: 500px;
  pointer-events: none;
}
@media (min-width: 576px) {
  .modal-dialog {
    max-width: 500px;
    margin: 1.75rem auto;
  }
}

.modal-dialog-centered {
  display: flex;
  align-items: center;
  min-height: calc(100% - 1rem);
}
@media (min-width: 576px) {
  .modal-dialog-centered {
    min-height: calc(100% - 3.5rem);
  }
}

.modal-content {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  pointer-events: auto;
  background-color: #fff;
  border-radius: 0.5rem;
  outline: 0;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem;
  border-bottom: 1px solid #dee2e6;
  flex-shrink: 0;
}

.modal-body { padding: 1rem; }
.modal-title { margin: 0; font-size: 1.25rem; font-weight: 500; }

.btn-close {
  box-sizing: content-box;
  width: 1em; height: 1em;
  padding: 0.25em;
  background: transparent url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath d='M.293.293a1 1 0 0 1 1.414 0L8 6.586 14.293.293a1 1 0 1 1 1.414 1.414L9.414 8l6.293 6.293a1 1 0 0 1-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 0 1-1.414-1.414L6.586 8 .293 1.707a1 1 0 0 1 0-1.414z'/%3e%3c/svg%3e") center/1em auto no-repeat;
  border: 0;
  opacity: 0.5;
  cursor: pointer;
}
.btn-close:hover { opacity: 1; }
.btn-close-white { filter: invert(1) grayscale(100%) brightness(200%); }

body.modal-open { overflow: hidden !important; }

/* ==========================================================================
   Accordion
   ========================================================================== */
.accordion { border-radius: 0.5rem; overflow: hidden; }

.accordion-item {
  border-bottom: 1px solid #dee2e6;
}
.accordion-item:last-child { border-bottom: 0; }

.accordion-header { margin: 0; }

.accordion-button {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  padding: 1rem 1.25rem;
  font-size: 1rem;
  text-align: left;
  background: transparent;
  border: 0;
  cursor: pointer;
}
.accordion-button::after {
  content: '';
  flex-shrink: 0;
  width: 1.25rem; height: 1.25rem;
  margin-left: auto;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23212529' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-size: 1.25rem;
  transition: transform 0.2s ease-in-out;
}
.accordion-button:not(.collapsed)::after {
  transform: rotate(-180deg);
}

.accordion-collapse {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.35s ease;
}

.accordion-body { padding: 1rem 1.25rem; }

/* ==========================================================================
   Alerts (used by enquiry-form.js)
   ========================================================================== */
.alert {
  padding: 0.75rem 1.25rem;
  margin-bottom: 1rem;
  border: 1px solid transparent;
  border-radius: 0.375rem;
}
.alert-success { color: #0f5132; background: #d1e7dd; border-color: #badbcc; }
.alert-danger  { color: #842029; background: #f8d7da; border-color: #f5c2c7; }

/* ==========================================================================
   Form Controls
   ========================================================================== */
.form-control {
  display: block;
  width: 100%;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  color: #212529;
  background-color: #fff;
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  appearance: none;
}
.form-control:focus {
  border-color: #86b7fe;
  outline: 0;
  box-shadow: 0 0 0 0.25rem rgba(13, 110, 253, 0.25);
}
.form-control::placeholder { color: #6c757d; opacity: 1; }

.form-group { margin-bottom: 1rem; }

/* ==========================================================================
   Responsive Modal
   ========================================================================== */
@media (max-width: 575.98px) {
  .modal-dialog {
    margin: 0.5rem;
  }
  .modal-dialog-centered {
    min-height: calc(100% - 1rem);
  }
}
