/* cmtoinches.uk v2 — Self-contained Layout, Dropdown Converter, Boxed Desktop Spacing & Responsive Tables */
*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  max-width: 100vw;
  background-color: #f1f5f9;
  color: #1e293b;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
}

img, svg {
  max-width: 100%;
  height: auto;
}

a {
  color: #1d4ed8;
}

/* Header */
.cm-header {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  background: #ffffff;
  border-bottom: 1px solid #e2e8f0;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05);
}

.cm-header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 10px 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cm-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.cm-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: #0f172a;
  font-weight: 900;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.cm-brand-tld {
  color: #2563eb;
}

.cm-nav {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
}

.cm-nav a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 11px;
  border-radius: 10px;
  font-size: 14.8px;
  font-weight: 600;
  color: #334155;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.cm-nav a:hover {
  background: #f1f5f9;
  color: #1d4ed8;
}

.cm-nav a[aria-current="page"] {
  background: #2563eb;
  color: #ffffff;
  box-shadow: 0 3px 10px rgba(37, 99, 235, 0.22);
}

.cm-menu-btn {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  border-radius: 10px;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  color: #0f172a;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 1023px) {
  .cm-nav {
    display: none;
  }
  .cm-menu-btn {
    display: inline-flex;
  }
  .cm-header-inner {
    padding: 10px 16px;
  }
}

/* Main Desktop Boxed Container (Matches stone2kg.co.uk generous left & right outer space) */
.cm-main {
  width: 100%;
  max-width: 860px;
  margin: 28px auto 48px;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@media (max-width: 767px) {
  .cm-main {
    margin: 14px auto 32px;
    padding: 0 12px;
    gap: 18px;
  }
}

/* Surface Cards */
.cm-card {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04);
  padding: 28px 34px;
}

@media (max-width: 639px) {
  .cm-card {
    padding: 18px 15px;
    border-radius: 14px;
  }
}

.cm-card > * + * {
  margin-top: 16px;
}

.cm-card h1 {
  margin: 0;
  font-size: clamp(1.45rem, 2.8vw, 1.95rem);
  line-height: 1.25;
  font-weight: 900;
  color: #0f172a;
  letter-spacing: -0.02em;
}

.cm-card h2 {
  margin: 26px 0 8px;
  font-size: clamp(1.2rem, 2.2vw, 1.48rem);
  line-height: 1.3;
  font-weight: 800;
  color: #0f172a;
}

.cm-card h3 {
  margin: 20px 0 6px;
  font-size: 1.12rem;
  font-weight: 800;
  color: #0f172a;
}

.cm-card p, .cm-card li {
  font-size: 16px;
  line-height: 1.72;
  color: #334155;
}

.cm-card ul, .cm-card ol {
  margin: 10px 0 16px;
  padding-left: 24px;
}

.cm-card ul {
  list-style: disc;
}

.cm-card ol {
  list-style: decimal;
}

.cm-card li {
  margin-bottom: 7px;
}

.cm-eyebrow {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #1d4ed8;
}

.cm-page-header {
  padding-bottom: 16px;
  border-bottom: 1px solid #e2e8f0;
}

.cm-page-header p:last-child {
  margin-top: 8px;
  margin-bottom: 0;
}

/* Breadcrumbs */
.cm-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 11px 16px;
  font-size: 14.8px;
  font-weight: 600;
  color: #475569;
}

.cm-breadcrumb a {
  color: #1d4ed8;
  text-decoration: none;
  font-weight: 700;
}

.cm-breadcrumb a:hover {
  text-decoration: underline;
}

/* Home Converter Box */
.cm-conv-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 20px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.07);
  overflow: hidden;
}

.cm-conv-banner {
  background: #0f172a;
  color: #ffffff;
  padding: 20px 28px;
}

.cm-conv-banner h1 {
  margin: 0;
  font-size: clamp(1.38rem, 2.7vw, 1.85rem);
  font-weight: 900;
  line-height: 1.25;
  color: #ffffff;
}

.cm-conv-banner p {
  margin: 6px 0 0;
  font-size: 15px;
  color: #cbd5e1;
}

.cm-conv-body {
  padding: 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

@media (max-width: 639px) {
  .cm-conv-banner {
    padding: 16px 16px;
  }
  .cm-conv-body {
    padding: 16px;
    gap: 14px;
  }
}

/* Primary Conversion Tool Dropdown Row */
.cm-tool-bar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: end;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 14px 16px;
}

@media (max-width: 600px) {
  .cm-tool-bar {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

.cm-select-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cm-select-group label {
  font-size: 14px;
  font-weight: 800;
  color: #1e293b;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.cm-tool-select {
  width: 100%;
  min-height: 44px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1.5px solid #2563eb;
  background: #ffffff;
  color: #0f172a;
  font-size: 15.5px;
  font-weight: 700;
  cursor: pointer;
}

.cm-tool-select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.18);
}

/* Converter Input / Output Grid */
.cm-conv-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 14px;
  align-items: end;
}

@media (max-width: 700px) {
  .cm-conv-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

.cm-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.cm-field-label {
  font-size: 14.5px;
  font-weight: 700;
  color: #334155;
}

.cm-input-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  border: 2px solid #cbd5e1;
  border-radius: 12px;
  padding: 8px 12px;
  min-height: 58px;
}

.cm-input-box:focus-within {
  border-color: #2563eb;
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.cm-input-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  font-weight: 900;
  color: #0f172a;
  font-variant-numeric: tabular-nums;
}

.cm-output-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: #eff6ff;
  border: 2px solid #bfdbfe;
  border-radius: 12px;
  padding: 8px 12px;
  min-height: 58px;
}

.cm-output-val {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  font-weight: 900;
  color: #1d4ed8;
  font-variant-numeric: tabular-nums;
}

.cm-swap-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  padding-bottom: 6px;
}

.cm-swap-btn {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  border: 2px solid #ffffff;
  background: #2563eb;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
  transition: transform 0.15s ease, background 0.15s ease;
}

.cm-swap-btn:hover {
  background: #1d4ed8;
  transform: scale(1.06);
}

.unit-select {
  appearance: auto;
  min-height: 40px;
  padding: 6px 10px;
  border-radius: 9px;
  border: 1.5px solid #cbd5e1;
  background: #ffffff;
  color: #0f172a;
  font-size: 14.8px;
  font-weight: 800;
  cursor: pointer;
  flex-shrink: 0;
}

.unit-select-out {
  border-color: #93c5fd;
  background: #ffffff;
  color: #1d4ed8;
}

.ft-extra-wrap {
  display: none;
  margin-top: 6px;
}

.ft-extra-wrap.show {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ft-extra-wrap input {
  width: 100%;
  border: 1.5px solid #cbd5e1;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 16px;
  font-weight: 700;
  background: #f8fafc;
  color: #0f172a;
}

.cm-conv-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.cm-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.cm-btn-primary {
  min-height: 42px;
  padding: 9px 18px;
  border-radius: 10px;
  border: 0;
  background: #2563eb;
  color: #ffffff;
  font-size: 14.8px;
  font-weight: 800;
  cursor: pointer;
}

.cm-btn-primary:hover {
  background: #1d4ed8;
}

.cm-btn-secondary {
  min-height: 42px;
  padding: 9px 18px;
  border-radius: 10px;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  color: #1e293b;
  font-size: 14.8px;
  font-weight: 700;
  cursor: pointer;
}

.cm-btn-secondary:hover {
  background: #e2e8f0;
}

.cm-info-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
}

@media (max-width: 680px) {
  .cm-info-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }
}

.cm-info-label {
  margin: 0;
  font-size: 13.8px;
  font-weight: 700;
  color: #475569;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.cm-info-val {
  margin: 4px 0 0;
  font-size: 15.5px;
  font-weight: 800;
  color: #0f172a;
}

.cm-info-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14.2px;
  font-weight: 700;
}

/* Formula Box */
.cm-formula-box {
  background: #0f172a;
  color: #f1f5f9;
  border-radius: 14px;
  padding: 18px 22px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14.8px;
  line-height: 1.75;
}

.cm-formula-title {
  margin: 0 0 6px !important;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 13.8px !important;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #93c5fd !important;
}

.cm-formula-box p {
  margin: 0;
  color: #f8fafc;
  font-size: 14.8px;
}

/* Inner Page Backlink CTA */
.home-tool-cta {
  background: linear-gradient(135deg, #eff6ff 0%, #f8fafc 100%);
  border: 1.5px solid #93c5fd;
  border-radius: 16px;
  padding: 18px 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.home-tool-cta p {
  margin: 0;
  flex: 1 1 260px;
  color: #1e293b;
  font-size: 15.5px;
  line-height: 1.6;
}

.home-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 12px;
  background: #2563eb;
  color: #ffffff !important;
  font-size: 15px;
  font-weight: 800;
  text-decoration: none !important;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.22);
}

.home-tool-btn:hover {
  background: #1d4ed8;
}

/* Mobile & Desktop Table Shortcut Pills */
.mob-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 10px 0 14px;
}

.mob-shortcut-btn {
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 10px;
  border: 1.5px solid #cbd5e1;
  background: #f8fafc;
  color: #1e293b;
  font-size: 14.5px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.mob-shortcut-btn:hover {
  border-color: #2563eb;
  color: #1d4ed8;
}

.mob-shortcut-btn.active {
  background: #0f172a;
  border-color: #0f172a;
  color: #ffffff;
}

/* Zero-Horizontal-Scroll Responsive Tables (Centered Inside Desktop Cards with Breathing Room) */
.cm-table-card {
  width: 100%;
  max-width: 100%;
  margin: 14px 0 22px;
  overflow-x: hidden !important;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  background: #ffffff;
}

table.cm-table {
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}

table.cm-table caption {
  text-align: left;
  padding: 13px 18px;
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
  background: #f8fafc;
  border-bottom: 1px solid #cbd5e1;
}

table.cm-table th,
table.cm-table td {
  padding: 11px 16px;
  font-size: 15.2px;
  line-height: 1.45;
  text-align: left;
  border-bottom: 1px solid #e2e8f0;
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: normal;
  vertical-align: middle;
}

table.cm-table thead th {
  background: #f1f5f9;
  color: #0f172a;
  font-weight: 800;
}

table.cm-table tbody tr:nth-child(even) {
  background: #f8fafc;
}

table.cm-table tbody tr:last-child th,
table.cm-table tbody tr:last-child td {
  border-bottom: 0;
}

table.cm-table tbody th {
  font-weight: 700;
  color: #0f172a;
}

table.cm-table td strong {
  color: #1d4ed8;
}

@media (max-width: 639px) {
  table.cm-table caption {
    padding: 11px 12px;
    font-size: 15px;
  }
  table.cm-table th,
  table.cm-table td {
    padding: 9px 8px;
    font-size: 14.2px;
  }
}

/* Mobile Column Switcher for 4-column Specialised Tables */
.col-switch-bar {
  display: none;
}

@media (max-width: 767px) {
  .col-switch-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 10px 12px;
    background: #eff6ff;
    border-bottom: 1px solid #dbeafe;
  }
  .col-switch-wrap[data-active-col="1"] [data-col="2"],
  .col-switch-wrap[data-active-col="1"] [data-col="3"],
  .col-switch-wrap[data-active-col="2"] [data-col="1"],
  .col-switch-wrap[data-active-col="2"] [data-col="3"],
  .col-switch-wrap[data-active-col="3"] [data-col="1"],
  .col-switch-wrap[data-active-col="3"] [data-col="2"] {
    display: none;
  }
}

/* Link Card Grids & Figures */
.cm-link-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}

@media (max-width: 639px) {
  .cm-link-grid {
    grid-template-columns: 1fr;
  }
}

.cm-link-card {
  display: block;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cm-link-card:hover {
  border-color: #2563eb;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.1);
}

.cm-link-card strong {
  display: block;
  color: #1d4ed8;
  font-size: 16px;
  margin-bottom: 3px;
}

.cm-link-card span {
  display: block;
  color: #475569;
  font-size: 14.5px;
  line-height: 1.5;
}

.cm-figure-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 639px) {
  .cm-figure-grid {
    grid-template-columns: 1fr;
  }
}

.cm-figure {
  margin: 0;
  border: 1px solid #e2e8f0;
  border-radius: 14px;
  background: #f8fafc;
  padding: 12px;
}

.cm-figure img {
  width: 100%;
  height: auto;
  border-radius: 10px;
  display: block;
}

.cm-figure figcaption {
  margin-top: 8px;
  font-size: 14.5px;
  color: #475569;
  line-height: 1.5;
}

/* FAQs */
.cm-faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cm-faq-item {
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 14px 18px;
  background: #f8fafc;
}

.cm-faq-item summary {
  font-size: 16px;
  font-weight: 800;
  color: #0f172a;
  cursor: pointer;
}

.cm-faq-item p {
  margin: 10px 0 0;
  font-size: 15.5px;
  color: #334155;
  line-height: 1.65;
}

/* Contact & 404 Helpers */
.cm-contact-box {
  padding: 20px 22px;
  border-radius: 14px;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cm-center {
  text-align: center;
}

/* Sample-Matched Clean Footer */
.cm-footer {
  background: #0f172a;
  color: #cbd5e1;
  border-top: 2px solid #1e293b;
  margin-top: 24px;
}

.cm-footer-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 36px 24px 24px;
}

.cm-footer-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.cm-footer-left {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cm-footer-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #ffffff;
  font-weight: 900;
  font-size: 1.12rem;
  text-decoration: none;
}

.cm-footer-mail {
  font-size: 15px;
  color: #cbd5e1;
}

.cm-footer-mail a {
  color: #ffffff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-decoration: underline;
}

.cm-footer-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 28px;
}

.cm-footer-nav a {
  color: #f1f5f9;
  font-size: 15.5px;
  font-weight: 700;
  text-decoration: none;
}

.cm-footer-nav a:hover {
  color: #facc15;
  text-decoration: underline;
}

.cm-social-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cm-social-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #1e293b;
  border: 1px solid #334155;
  color: #f1f5f9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.cm-social-btn:hover {
  background: #2563eb;
  border-color: #2563eb;
  color: #ffffff;
}

.cm-footer-bottom {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid #1e293b;
  font-size: 14.5px;
  color: #94a3b8;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
}

/* Mobile Navigation Drawer */
.vc-drw {
  width: 100%;
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  border-radius: 14px;
  padding: 14px;
  margin-top: 6px;
}

.vc-drw.hidden {
  display: none;
}

.vc-drw-title {
  font-size: 13.8px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #475569;
  margin-bottom: 10px;
}

.vc-drw-g {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

@media (min-width: 560px) {
  .vc-drw-g {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.vc-drw-a {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 8px 13px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  background: #ffffff;
  color: #1e293b;
  border: 1px solid #cbd5e1;
  text-decoration: none;
}

.vc-drw-a.act {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}
