:root {
  --c2-blue: #014d98;
  --c2-blue-hover: #1a4f95;
  --c2-ice: #f5f9ff;
  --c2-black: #000000;
  --c2-text: #54595f;
  --c2-border: #e2e8f0;
  --c2-white: #ffffff;
  --success: #15803d;
  --danger: #b91c1c;
  --radius: 6px;
}

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

body {
  margin: 0;
  font-family: "Raleway", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--c2-white);
  color: var(--c2-text);
  font-size: 15px;
  line-height: 1.65;
}

h1,
h2,
h3,
h4 {
  font-family: "Raleway", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--c2-black);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.container {
  width: min(1200px, 100% - 2rem);
  margin-inline: auto;
}

/* Tier 1: Royal Blue Top Bar (#014D98) */
.top-bar {
  background: var(--c2-blue);
  color: var(--c2-white);
  font-size: 0.84rem;
  font-weight: 500;
  padding: 0.7rem 0;
}

.top-bar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.top-bar-location {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.top-bar-contact {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem;
}

.top-bar a {
  color: var(--c2-white);
  text-decoration: none;
  font-weight: 600;
}

.top-bar a:hover {
  text-decoration: underline;
}

/* Tier 2: Black Brand & Address Bar (#000000) */
.brand-bar {
  background: var(--c2-black);
  color: var(--c2-white);
  padding: 0.95rem 0;
}

.brand-bar-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.brand-logo {
  display: block;
  height: 58px;
  width: auto;
  object-fit: contain;
}

.address-box {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.address-pin {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--c2-blue);
  color: var(--c2-white);
  flex-shrink: 0;
}

.address-box strong {
  display: block;
  color: var(--c2-white);
  font-size: 0.92rem;
  line-height: 1.2;
}

.address-box span {
  font-size: 0.84rem;
  color: rgba(255, 255, 255, 0.86);
}

/* Tier 3: Sticky White Navigation Bar (#FFFFFF) */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--c2-white);
  border-bottom: 1px solid var(--c2-border);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 56px;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.main-nav a {
  color: var(--c2-black);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  white-space: nowrap;
  padding: 0.35rem 0;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.main-nav a:hover,
.main-nav a.nav-active {
  color: var(--c2-blue);
  border-bottom-color: var(--c2-black);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-left: auto;
}

@media (max-width: 960px) {
  .main-nav {
    display: none;
  }
}

/* Buttons (sentence-case, solid #014D98 matching c2millwrightmachining.ca) */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border-radius: 4px;
  padding: 0.62rem 1.25rem;
  font-family: "Raleway", sans-serif;
  font-size: 0.88rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.btn-nav {
  padding: 0.48rem 1rem;
  font-size: 0.86rem;
}

.btn-primary {
  background: var(--c2-blue);
  color: var(--c2-white);
}

.btn-primary:hover {
  background: var(--c2-blue-hover);
}

.btn-secondary {
  background: var(--c2-white);
  color: var(--c2-black);
  border-color: var(--c2-border);
}

.btn-secondary:hover {
  border-color: var(--c2-blue);
  color: var(--c2-blue);
}

.btn-outline-blue {
  background: var(--c2-white);
  color: var(--c2-blue);
  border-color: var(--c2-blue);
}

.btn-outline-blue:hover {
  background: var(--c2-ice);
}

/* 50/50 Split Hero (matching c2millwrightmachining.ca) */
.hero {
  background: var(--c2-ice);
  border-bottom: 1px solid var(--c2-border);
}

.hero-split {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  min-height: 490px;
}

.hero-left {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 2.75rem 2.5rem 2.75rem 1.5rem;
}

.hero-left-inner {
  width: min(560px, 100%);
}

.hero-left h1 {
  margin: 0 0 0.6rem;
  font-size: clamp(1.9rem, 3.1vw, 2.75rem);
  font-weight: 700;
  line-height: 1.18;
  color: var(--c2-black);
}

.hero-sub {
  margin: 0 0 0.65rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--c2-black);
}

.hero-lead {
  margin: 0 0 1.1rem;
  color: var(--c2-text);
}

.hero-checklist {
  list-style: none;
  margin: 0 0 1.5rem;
  padding: 0;
}

.hero-checklist li {
  position: relative;
  padding: 0.45rem 0 0.45rem 1.6rem;
  border-bottom: 1px dashed rgba(1, 77, 152, 0.25);
  color: var(--c2-black);
  font-weight: 500;
  font-size: 0.92rem;
}

.hero-checklist li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--c2-blue);
  font-weight: 800;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hero-right {
  position: relative;
  overflow: hidden;
  min-height: 320px;
}

.hero-right img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@media (max-width: 900px) {
  .hero-split {
    grid-template-columns: 1fr;
  }
  .hero-left {
    justify-content: flex-start;
    padding: 2rem 1rem;
  }
  .hero-right {
    min-height: 260px;
  }
}

/* Catalog Section */
.catalog-section {
  background: var(--c2-white);
  padding: 2.75rem 0 4rem;
}

.section-heading {
  text-align: center;
  margin-bottom: 1.75rem;
}

.section-heading h2 {
  margin: 0 0 0.3rem;
  font-size: 1.85rem;
  font-weight: 700;
  color: var(--c2-black);
}

.section-heading p {
  margin: 0;
  color: var(--c2-text);
}

.catalog-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
  background: var(--c2-ice);
  border: 1px solid var(--c2-border);
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
}

.search-form {
  flex: 1;
  min-width: 240px;
}

.search-form input {
  width: 100%;
  background: var(--c2-white);
  border: 1px solid var(--c2-border);
  border-radius: 4px;
  color: var(--c2-black);
  padding: 0.55rem 0.85rem;
  font-family: inherit;
  font-size: 0.92rem;
}

.search-form input:focus {
  outline: 2px solid var(--c2-blue);
  outline-offset: 1px;
}

.sort-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.88rem;
  color: var(--c2-text);
}

.sort-wrap select {
  background: var(--c2-white);
  color: var(--c2-black);
  border: 1px solid var(--c2-border);
  border-radius: 4px;
  padding: 0.45rem 0.7rem;
  font-family: inherit;
  font-size: 0.86rem;
}

.controls-bar {
  margin-bottom: 1.5rem;
}

.category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.pill {
  background: var(--c2-white);
  color: var(--c2-black);
  border: 1px solid var(--c2-border);
  border-radius: 4px;
  padding: 0.44rem 0.95rem;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.pill:hover {
  border-color: var(--c2-blue);
  color: var(--c2-blue);
}

.pill.active {
  background: var(--c2-blue);
  color: var(--c2-white);
  border-color: var(--c2-blue);
}

/* Product Grid */
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(265px, 1fr));
  gap: 1.25rem;
}

.product-card {
  background: var(--c2-white);
  border: 1px solid var(--c2-border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
  transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card:hover {
  border-color: var(--c2-blue);
  box-shadow: 0 10px 24px rgba(1, 77, 152, 0.1);
  transform: translateY(-2px);
}

.product-thumb {
  background: var(--c2-ice);
  border-bottom: 1px solid var(--c2-border);
  height: 175px;
  display: grid;
  place-items: center;
  padding: 0.85rem;
  position: relative;
}

.product-thumb img.product-photo {
  max-width: 100%;
  max-height: 145px;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

.stock-badge {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--success);
  background: #ecfdf3;
  border: 1px solid #bbf7d0;
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
}

.product-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 0.45rem;
}

.product-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  color: var(--c2-text);
}

.sku-tag {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--c2-blue);
  font-weight: 700;
  font-size: 0.76rem;
}

.product-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--c2-black);
}

.product-spec {
  margin: 0;
  font-size: 0.84rem;
  color: var(--c2-text);
}

.product-footer {
  margin-top: auto;
  padding-top: 0.75rem;
  border-top: 1px solid var(--c2-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.price {
  font-size: 1.12rem;
  font-weight: 800;
  color: var(--c2-black);
}

.price small {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--c2-text);
}

.card-actions {
  display: flex;
  gap: 0.4rem;
}

.btn-sm {
  padding: 0.42rem 0.75rem;
  font-size: 0.8rem;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3rem 1rem;
  background: var(--c2-ice);
  border: 1px dashed var(--c2-border);
  border-radius: var(--radius);
  color: var(--c2-text);
}

/* Native Modal Dialogs */
dialog {
  border: 1px solid var(--c2-border);
  border-radius: 8px;
  background: var(--c2-white);
  color: var(--c2-text);
  padding: 0;
  width: min(620px, calc(100% - 1.5rem));
  max-height: calc(100dvh - 2rem);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(2px);
  overflow: hidden;
  overscroll-behavior: contain;
}

.dialog-shell {
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 2rem);
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--c2-border);
  background: var(--c2-white);
}

.dialog-header h1 {
  margin: 0.15rem 0 0;
  font-size: 1.15rem;
}

.icon-close {
  background: var(--c2-ice);
  border: 1px solid var(--c2-border);
  color: var(--c2-black);
  border-radius: 4px;
  width: 32px;
  height: 32px;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.icon-close:hover {
  border-color: var(--c2-blue);
}

.spec-body {
  padding: 1.15rem 1.25rem;
  overflow-y: auto;
  display: grid;
  gap: 0.9rem;
}

.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
}

.spec-table th,
.spec-table td {
  text-align: left;
  padding: 0.5rem 0.6rem;
  border-bottom: 1px solid var(--c2-border);
}

.spec-table th {
  color: var(--c2-text);
  font-weight: 600;
  width: 42%;
}

.spec-table td {
  color: var(--c2-black);
}

.dialog-footer {
  padding: 0.9rem 1.25rem;
  border-top: 1px solid var(--c2-border);
  background: var(--c2-ice);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.quote-link {
  font-size: 0.82rem;
  color: var(--c2-blue);
  font-weight: 600;
  text-decoration: none;
}

.quote-link:hover {
  text-decoration: underline;
}

.dialog-actions {
  display: flex;
  gap: 0.5rem;
  margin-left: auto;
}

/* Cart Content */
.cart-content {
  padding: 1.1rem 1.25rem 1.25rem;
  overflow-y: auto;
  display: grid;
  gap: 1rem;
}

.cart-items {
  display: grid;
  gap: 0.65rem;
}

.cart-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 0.75rem;
  background: var(--c2-ice);
  border: 1px solid var(--c2-border);
  border-radius: 6px;
  padding: 0.65rem 0.8rem;
}

.cart-row-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--c2-black);
}

.cart-row-sub {
  font-size: 0.76rem;
  color: var(--c2-text);
}

.qty-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.qty-btn {
  background: var(--c2-white);
  color: var(--c2-black);
  border: 1px solid var(--c2-border);
  border-radius: 4px;
  width: 26px;
  height: 26px;
  cursor: pointer;
  font-weight: 700;
}

.remove-btn {
  background: transparent;
  border: none;
  color: var(--c2-text);
  cursor: pointer;
  font-size: 0.78rem;
}

.remove-btn:hover {
  color: var(--danger);
}

.checkout-box {
  background: var(--c2-ice);
  border: 1px solid var(--c2-border);
  border-radius: 6px;
  padding: 0.95rem;
  display: grid;
  gap: 0.75rem;
  font-size: 0.86rem;
}

.field-group {
  display: grid;
  gap: 0.35rem;
}

.field-group label {
  font-weight: 600;
  font-size: 0.82rem;
  color: var(--c2-black);
}

.field-group select,
.field-group input {
  background: var(--c2-white);
  color: var(--c2-black);
  border: 1px solid var(--c2-border);
  border-radius: 4px;
  padding: 0.48rem 0.65rem;
  font-family: inherit;
  font-size: 0.85rem;
}

.totals-grid {
  display: grid;
  gap: 0.35rem;
  border-top: 1px solid var(--c2-border);
  padding-top: 0.65rem;
}

.totals-row {
  display: flex;
  justify-content: space-between;
  color: var(--c2-text);
}

.totals-row.grand {
  color: var(--c2-black);
  font-size: 1rem;
  font-weight: 800;
  padding-top: 0.35rem;
  border-top: 1px solid var(--c2-border);
}

.freight-note {
  font-size: 0.78rem;
  color: #1e3a8a;
  background: #dbeafe;
  border: 1px solid #93c5fd;
  border-radius: 4px;
  padding: 0.5rem 0.65rem;
}

.order-confirmed {
  text-align: center;
  padding: 1.5rem 0.5rem;
  display: grid;
  gap: 0.6rem;
}

.order-confirmed h2 {
  margin: 0;
  color: var(--success);
}

/* 2-Tier Footer (#000000 upper + #014D98 bottom copyright bar) */
.footer-upper {
  background: var(--c2-black);
  color: rgba(255, 255, 255, 0.82);
  padding: 3rem 0;
  font-size: 0.88rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 2.25rem;
}

@media (max-width: 780px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

.site-footer h3 {
  color: var(--c2-white);
  font-size: 0.96rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin: 0 0 0.75rem;
}

.site-footer p {
  margin: 0.3rem 0;
}

.footer-links {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.4rem;
}

.site-footer a {
  color: rgba(255, 255, 255, 0.86);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--c2-white);
  text-decoration: underline;
}

.footer-note {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.78rem;
  margin-top: 0.85rem;
}

.footer-bottom {
  background: var(--c2-blue);
  color: var(--c2-white);
  text-align: center;
  padding: 0.85rem 0;
  font-size: 0.84rem;
}
