/* =========================================================
   BASE / RESET
   ========================================================= */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 17px; /* WCAG: Above 16px minimum */
  line-height: 1.75; /* WCAG: Above 1.5 minimum ✓ */
  -webkit-font-smoothing: antialiased;
}

/* =========================================================
   HERO
   ========================================================= */
.hero {
  background: linear-gradient(160deg, #fffdf5 0%, #f5f3ee 60%, #eee9df 100%);
  border-bottom: 1px solid var(--border);
  padding: 64px 24px 56px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Decorative letter - using design token for color */
.hero::before {
  content: var(--hero-letter, "");
  position: absolute;
  right: -40px;
  top: -20px;
  font-family: "Playfair Display", serif;
  font-size: 320px;
  font-weight: 900;
  color: var(
    --hero-letter-color
  ); /* WCAG: Decorative element, subtle opacity */
  pointer-events: none;
  user-select: none;
  line-height: 1;
}

.hero h1 {
  font-family: "Playfair Display", serif;
  font-size: clamp(28px, 5vw, 42px); /* WCAG: Large text, 3:1 minimum ✓ */
  font-weight: 900;
  color: var(--text); /* WCAG: 16.7:1 contrast — AAA ✓ */
  line-height: 1.15;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.hero-sub {
  color: var(--text-muted); /* WCAG: 7.35:1 contrast — AAA ✓ */
  font-style: italic;
  font-size: 16px; /* WCAG: Minimum size met ✓ */

  max-width: 500px;
  margin: 0 auto;
  margin-bottom: 40px;
}

.hero-sub var {
  font-style: normal;
  font-family: "DM Mono", monospace;
  color: var(--accent); /* WCAG: 5.85:1 contrast — AA ✓ */
  background: var(--accent-bg);
  padding: 2px 8px;
  border-radius: 4px;
}

/* =========================================================
   CALCULATOR
   ========================================================= */
.calculator {
  max-width: 660px;
  margin: 0 auto 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 32px 28px 24px;
  box-shadow: var(--shadow-normal);
}

.calc-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.calc-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.calc-label {
  font-family: "DM Mono", monospace;
  font-size: 12px; /* WCAG: Small UI text, ensure parent context is clear */
  color: var(--text-muted); /* WCAG: 7.35:1 contrast — AAA ✓ */
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.calc-input {
  width: 100%;
  background: var(--formula-bg);
  border: 2px solid var(--border);
  border-radius: 10px;
  color: var(--text); /* WCAG: 16.7:1 contrast — AAA ✓ */
  font-family: "DM Mono", monospace;
  font-size: 28px; /* WCAG: Large text ✓ */
  font-weight: 500;
  padding: 14px 18px;
  outline: none;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  -moz-appearance: textfield;
}

.calc-input::placeholder {
  color: var(--text-muted); /* WCAG: 7.35:1 contrast — AAA ✓ */
  opacity: 0.5;
}

.calc-input::-webkit-outer-spin-button,
.calc-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
}

/* WCAG: Focus state with 3:1 contrast against background ✓ */
.calc-input:focus {
  border-color: var(--accent); /* WCAG: Visible border change */
  box-shadow: 0 0 0 4px var(--focus-accent); /* WCAG: Clear focus indicator */
}

/* Output field variants - all use WCAG-compliant colors */
.calc-input.output-k,
.calc-input.output-c,
.calc-input.output-f,
.calc-input.output-m,
.calc-input.output-cm,
.calc-input.output-ft {
  color: var(--accent-1);
  border: 2px solid var(--accent-light);
  background: var(--accent-light);
}

.calc-formula {
  margin-top: 1.25rem;
  padding: 0.65rem 0.9rem;
  background: var(--neutral-100);
  border-radius: var(--radius-sm);
  font-size: 1rem;
  color: var(--neutral-950);
  border-left: 3px solid var(--brand-300);
}
.calc-formula var {
  color: var(--neutral-950);
  font-weight: 500;
}

/* Swap button - interactive element with clear states */
.swap-btn {
  width: 44px; /* WCAG: Touch target 44×44px minimum ✓ */
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted); /* WCAG: 7.35:1 contrast — AAA ✓ */
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}

/* WCAG: Clear hover state with color change */
.swap-btn:hover {
  border-color: var(--accent); /* WCAG: 5.85:1 contrast — AA ✓ */
  color: var(--accent);
  transform: rotate(180deg);
  background: var(--accent-bg);
  box-shadow: var(--shadow-hover);
}

/* WCAG: Focus state for keyboard navigation */
.swap-btn:focus {
  outline: none;
  box-shadow: var(--focus-ring);
}

/* WCAG: Success state with accessible color */

/* =========================================================
   LAYOUT + TYPOGRAPHY
   ========================================================= */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

.section {
  padding: 64px 24px;
  border-top: 1px solid var(--border-soft);
}

.section:last-child {
  border-bottom: 1px solid var(--border-soft);
}

.section h2 {
  font-family: "Playfair Display", serif;
  font-size: clamp(24px, 3.5vw, 32px); /* WCAG: Large text ✓ */
  font-weight: 700;
  color: var(--text); /* WCAG: 16.7:1 contrast — AAA ✓ */
  margin-bottom: 28px;
  line-height: 1.2;
}

.section h3 {
  font-family: "Playfair Display", serif;
  font-size: 24px; /* WCAG: Large text ✓ */
  color: var(--text); /* WCAG: 16.7:1 contrast — AAA ✓ */
  margin: 38px 0 12px;
  line-height: 1.3;
}

.section p {
  color: var(--text); /* WCAG: 16.7:1 contrast — AAA ✓ */
  margin-bottom: 16px;
  line-height: 1.75; /* WCAG: Above 1.5 minimum ✓ */
}

.section p:last-child {
  margin-bottom: 0;
}

/* =========================================================
   TABLES
   ========================================================= */
.table-wrap {
  overflow-x: auto;
  margin: 24px 0;
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-family: "DM Mono", monospace;
  font-size: 14px;
}

thead th {
  background: var(--neutral-950);
  color: var(--white);
  text-align: left;
  padding: 12px 16px;
  border-bottom: 2px solid var(--border);
  letter-spacing: 0.05em;
  font-size: 12px;
  text-transform: uppercase;
}

tbody tr {
  border-bottom: 1px solid var(--border-soft);
  transition: background 0.15s;
}

/* WCAG: Hover state with visible change */
tbody tr:hover {
  background: var(--surface-2);
}

tbody td {
  padding: 10px 16px;
  color: var(--text); /* WCAG: 16.7:1 contrast — AAA ✓ */
}

/* WCAG: Highlighted row with clear visual distinction */
tbody tr.highlight td {
  background: var(--highlight-bg);
  border-left: 3px solid var(--accent); /* WCAG: Visible border */
  color: var(--accent-800); /* WCAG: 7.5:1 contrast on light bg — AAA ✓ */
}

/* =========================================================
   FORMULA BLOCK
   ========================================================= */
.formula-block {
  background: var(--formula-bg);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent); /* WCAG: Clear visual indicator */
  border-radius: 10px;
  padding: 28px 32px;
  margin: 24px 0;
  font-family: "DM Mono", monospace;
  box-shadow: var(--shadow-sm);
}

.formula-main {
  font-size: clamp(24px, 4vw, 38px); /* WCAG: Large text ✓ */
  font-weight: 500;
  color: var(--accent); /* WCAG: 5.85:1 contrast — AA ✓ */
  display: block;
  margin-bottom: 8px;
  line-height: 1.3;
}

.formula-alt {
  font-size: 15px;
  color: var(--text-muted); /* WCAG: 7.35:1 contrast — AAA ✓ */
  line-height: 1.5;
}

/* =========================================================
   EXAMPLES
   ========================================================= */
.examples-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.example-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px;
  box-shadow: var(--shadow-sm);
}

.example-card .label {
  font-family: "DM Mono", monospace;
  font-size: 11px;
  color: var(--text-muted); /* WCAG: 7.35:1 contrast — AAA ✓ */
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.example-card .calc {
  font-family: "DM Mono", monospace;
  font-size: 15px;
  color: var(--accent); /* WCAG: 5.85:1 contrast — AA ✓ */
  margin-bottom: 6px;
  line-height: 1.5;
}

.example-card .note {
  font-size: 13px;
  color: var(--text-muted); /* WCAG: 7.35:1 contrast — AAA ✓ */
  font-style: italic;
  line-height: 1.5;
}

/* =========================================================
   STEPS + NOTE
   ========================================================= */
.steps {
  margin: 24px 0;
  counter-reset: step;
}

.step {
  display: flex;
  gap: 20px;
  margin-bottom: 24px;
  align-items: flex-start;
  counter-increment: step;
}

/* WCAG: High contrast step number with clear visibility */
.step-num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--accent); /* WCAG: Background color */
  color: var(--neutral-0); /* WCAG: White text on accent: 5.7:1 — AA ✓ */
  font-family: "DM Mono", monospace;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: var(--shadow-accent); /* WCAG: Visible shadow using token */
}

.step-body {
  flex: 1;
  padding-top: 6px;
}

.step-body strong {
  color: var(--text); /* WCAG: 16.7:1 contrast — AAA ✓ */
  display: block;
  margin-bottom: 4px;
}

.step-code {
  font-family: "DM Mono", monospace;
  font-size: 14px;
  color: var(--accent2); /* WCAG: 4.7:1 contrast — AA ✓ */
  margin-top: 4px;
  line-height: 1.5;
}

/* WCAG: Info/note box with accessible colors */
.note-box {
  background: var(--accent2-bg);
  border: 1px solid var(--border-info-subtle); /* WCAG: Visible border using token */
  border-radius: 8px;
  padding: 16px 20px;
  font-size: 14px;
  color: var(--accent2); /* WCAG: 4.7:1 contrast — AA ✓ */
  margin-top: 20px;
  line-height: 1.5;
}

/* =========================================================
   CHART GRID
   ========================================================= */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  margin: 24px 0;
}

.chart-pair {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  font-family: "DM Mono", monospace;
  font-size: 16px;
  display: flex;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
}

/* Default muted state for all units */
.chart-pair .k,
.chart-pair .f,
.chart-pair .c,
.chart-pair .unit {
  color: var(--text-muted); /* WCAG: 7.35:1 contrast — AAA ✓ */
}

/* Highlighted unit state */
.chart-pair .hot {
  color: var(--accent); /* WCAG: 5.85:1 contrast — AA ✓ */
  font-weight: 500;
}

/* Page-specific highlighting using page classes */
.page-k2f .chart-pair .f {
  color: var(--accent);
  font-weight: 500;
}

.page-f2k .chart-pair .k {
  color: var(--accent);
  font-weight: 500;
}

.page-c2k .chart-pair .k {
  color: var(--accent);
  font-weight: 500;
}

.page-k2c .chart-pair .c {
  color: var(--accent);
  font-weight: 500;
}

/* =========================================================
   ES SECTION + RELATED
   ========================================================= */
.es-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 28px 32px;
  margin: 24px 0;
  box-shadow: var(--shadow-sm);
}

.es-flag {
  font-size: 24px;
  margin-right: 10px;
}

.related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-top: 24px;
}

/* WCAG: Interactive card with clear states */
.related-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
  text-decoration: none;
  color: var(--text); /* WCAG: 16.7:1 contrast — AAA ✓ */
  transition: all 0.2s;
  display: block;
  box-shadow: var(--shadow-sm);
  min-height: 44px; /* WCAG: Touch target height */
}

/* WCAG: Clear hover state */
.related-card:hover {
  border-color: var(--accent); /* WCAG: Visible state change */
  color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-hover);
}

/* WCAG: Focus state for keyboard navigation */
.related-card:focus {
  outline: none;
  box-shadow: var(--focus-ring);
}

.related-card .rtitle {
  font-weight: 600;
  color: inherit;
  margin-bottom: 4px;
  line-height: 1.4;
}

.related-card .rarrow {
  color: var(--accent); /* WCAG: 5.85:1 contrast — AA ✓ */
  font-family: "DM Mono", monospace;
  font-size: 14px;
}

/* =========================================================
   ANIMATION
   ========================================================= */
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* WCAG: Respects prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  html {
    scroll-behavior: auto;
  }
}

/* Animations applied only when motion is allowed */
@media (prefers-reduced-motion: no-preference) {
  .hero h1 {
    animation: fadeUp 0.6s ease both;
  }

  .hero-sub {
    animation: fadeUp 0.6s 0.1s ease both;
  }

  .calculator {
    animation: fadeUp 0.6s 0.2s ease both;
  }
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (max-width: 600px) {
  .calc-row {
    flex-direction: column;
  }

  .swap-btn {
    transform: rotate(90deg);
    width: 44px; /* WCAG: Maintain touch target size */
    height: 44px;
  }

  .swap-btn:hover {
    transform: rotate(270deg);
  }

  /* WCAG: Ensure readable font sizes on mobile */
  body {
    font-size: 16px; /* WCAG: Maintain minimum size */
  }

  .calc-input {
    font-size: 24px; /* WCAG: Still large enough for input */
  }
}

/* =========================================================
   ACCESSIBILITY ENHANCEMENTS
   ========================================================= */

/* WCAG: Ensure all interactive elements have visible focus */

/* WCAG: Ensure links are distinguishable */
a {
  color: var(--link); /* WCAG: 5.8:1 contrast — AA ✓ */
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
  transition: color 0.2s;
}

a:hover {
  color: var(--link-hover); /* WCAG: Clear state change */
  text-decoration-thickness: 2px;
}

/* WCAG: Skip link for keyboard navigation */
.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--accent);
  color: var(--neutral-0);
  padding: 8px 16px;
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
  outline: none;
  box-shadow: var(--focus-ring);
}
/* =========================================================
   NEW: ERROR + RESULT + CHIPS + CLEAR (Premium + WCAG)
   ========================================================= */

/* Error message under input */
.error-msg {
  margin-top: 6px;
  min-height: 18px; /* prevents layout jump */
  font-family: "DM Mono", monospace;
  font-size: 12px;
  line-height: 1.4;
  color: var(--danger-700);
}

/* Optional: if you add .is-invalid to the input when error exists */
.calc-input.is-invalid {
  border-color: var(--danger-700);
  box-shadow: 0 0 0 4px rgba(190, 18, 60, 0.14); /* danger focus glow */
}

/* Result sentence (live region) */
.result-sentence {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary);
  min-height: 2.25rem;
  margin: 24px 0;
}

/* Hide when empty (JS sets empty textContent) */
.chips-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.1rem;
}
.chip {
  height: 34px;
  padding: 0 1rem;
  border-radius: 999px;
  border: 1.5px solid var(--brand-200);
  background: var(--brand-50);
  color: var(--primary);
  font-size: 0.83rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background var(--transition),
    border-color var(--transition);
  font-family: "DM Sans", sans-serif;
}
.chip:hover {
  background: var(--brand-100);
  border-color: var(--brand-300);
}
/* Actions row: Copy + Clear */
.calc-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.1rem;
}
.copy-btn,
.clear-btn {
  height: 38px;
  padding: 0 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1.5px solid transparent;
  font-family: "DM Sans", sans-serif;
  transition:
    background var(--transition),
    border-color var(--transition),
    color var(--transition);
}
.copy-btn {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.copy-btn:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}
.clear-btn {
  background: var(--surface);
  color: var(--muted);
  border-color: var(--border);
}
.clear-btn:hover {
  background: var(--neutral-100);
  color: var(--ink);
}

/* Responsive: stack actions on small screens */
@media (max-width: 520px) {
  .calc-row {
    flex-direction: column;
    align-items: stretch;
    gap: 0px;
  }

  .swap-btn {
    margin: 0px auto;
  }

  .calc-actions {
    flex-direction: column;
  }

  .clear-btn {
    width: 100%;
    min-width: 0;
  }
}
.example-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 20px 24px;
  margin-bottom: 16px;
}
.example-card h3 {
  margin-top: 0;
  margin-bottom: 8px;
}
.math-line {
  font-family: "DM Serif Display", serif;
  font-size: 1.1rem;
  color: var(--accent-1);
  background: var(--accent-light);
  display: inline-block;
  padding: 4px 12px;
  border-radius: 6px;
  margin-top: 6px;
}
/* Remaps:
   --navy   -> --primary
   --teal   -> --accent-mid
   --teal-l -> --accent-light
   --teal-d -> --accent-1
   --slate  -> --muted-2
   --shadow-l -> --shadow-hover
*/

.examples-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.example-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition:
    box-shadow var(--transition),
    transform var(--transition);
  cursor: pointer;
}

.example-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.example-card-head {
  background: var(--primary);
  padding: 1rem 1.2rem;
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

.example-card-head .cm {
  font-family: var(--display);
  font-size: 2rem;
  font-weight: 800;
  color: var(--white);
  line-height: 1;
}

.example-card-head .cm-unit {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--accent-mid);
}

.example-card-body {
  padding: 1rem 1.2rem;
}

.example-ft-in {
  font-family: var(--display);
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
}

.example-ft-in span {
  color: var(--accent-mid);
}

.example-decimal {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.example-context {
  font-size: 0.78rem;
  color: var(--muted-2);
  margin-top: 0.6rem;
  line-height: 1.4;
  padding-top: 0.6rem;
  border-top: 1px solid var(--border);
}

.example-calc {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 0.4rem;
  padding: 0.4rem 0.6rem;
  background: var(--bg);
  border-radius: 6px;
  border: 1px solid var(--border);
}

/* ---- EXAMPLE DETAIL SECTIONS ---- */
.example-detail {
  margin: 2.5rem 0;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-left: 4px solid var(--accent-mid);
}

.example-detail h3 {
  margin-top: 0;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--primary);
}

.example-detail .answer {
  display: inline-flex;
  align-items: baseline;
  gap: 0.5rem;
  background: var(--accent-light);
  border: 1px solid var(--border-accent-subtle);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  margin: 0.7rem 0;
}

.example-detail .answer .big {
  font-family: var(--display);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent-1);
  line-height: 1;
}

.example-detail .answer .small {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--muted-2);
}

.example-detail table {
  margin: 0.8rem 0;
}

.example-detail .step-calc {
  font-family: var(--mono);
  font-size: 1rem;
  color: var(--muted-2);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.9rem;
  margin-top: 0.5rem;
  line-height: 2;
}

.example-detail .step-calc .hi {
  color: var(--accent-1);
  font-weight: 500;
}

/* extra style  */
/* extra style  */
/* extra style  */
/* extra style  */
/* extra style  */

/* ─── SECTION LABEL ─── */
.section-label {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
  margin-bottom: 0.5rem;
  background: var(--accent-50);
  padding: 0.2rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--accent-200);
}

/* ─── DIVIDER ─── */

section {
  padding: 5rem 0;
}
.rule-divider {
  border: none;
  border-top: 1px solid var(--border-soft);
  margin: 0;
}

/* ─── REFERENCE TABLES ─── */
.reference-section {
  background: var(--bg);
}
.reference-section h2 {
  font-size: 1.75rem;
  margin-bottom: 0.75rem;
}
.reference-section > .container > p {
  color: var(--muted);
  margin-bottom: 2rem;
  font-size: 0.95rem;
}

.tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
}

.ref-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.ref-table-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.85rem 1.1rem;
  background: var(--neutral-50);
  border-bottom: 1px solid var(--border-soft);
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--ink);
}
.ref-table-head span {
  font-family: "DM Mono", monospace;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--muted-2);
  background: var(--brand-50);
  padding: 0.15rem 0.6rem;
  border-radius: 999px;
  border: 1px solid var(--brand-200);
}

.ref-table table {
  width: 100%;
  border-collapse: collapse;
}
.ref-table thead th {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted-2);
  padding: 0.55rem 1.1rem;
  text-align: left;
  background: var(--neutral-50);
  border-bottom: 1px solid var(--border-soft);
}
.ref-table tbody tr {
  border-bottom: 1px solid var(--border-soft);
  transition: background var(--transition);
}
.ref-table tbody tr:last-child {
  border-bottom: none;
}
.ref-table tbody tr:hover {
  background: var(--brand-50);
}
.ref-table tbody td {
  padding: 0.55rem 1.1rem;
  font-size: 0.875rem;
  color: var(--muted);
}
.ref-table tbody td:first-child {
  color: var(--ink);
  font-weight: 500;
}
.ref-table tbody td:last-child {
  font-family: "DM Mono", monospace;
  color: var(--primary);
  font-weight: 600;
}

/* ─── HEIGHT CONTEXT ─── */
.context-section {
  background: var(--surface);
}
.context-section h2 {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
}
.context-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}
.context-card {
  padding: 1.5rem;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  background: var(--neutral-50);
  transition:
    box-shadow var(--transition),
    border-color var(--transition);
}
.context-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--brand-200);
}
.context-card h3 {
  font-size: 1rem;
  color: var(--primary);
  margin-bottom: 0.6rem;
}
.context-card p {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.65;
}

/* ─── EXTENDED CONTENT ─── */
.extended-section {
  background: var(--bg);
}
.extended-section .inner {
  max-width: 860px;
  margin: 0 auto;
}
.extended-section h2 {
  font-size: 1.75rem;
  margin-bottom: 1.5rem;
}
.extended-section h3 {
  font-size: 1.08rem;
  margin: 2.25rem 0 0.6rem;
}
.extended-section p {
  color: var(--muted);
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  line-height: 1.7;
}
.extended-section strong {
  color: var(--ink);
}

/* ─── RESPONSIVE ─── */
@media (max-width: 640px) {
  section {
    padding: 3.5rem 0;
  }
}
/* ─── POPULAR ─── */
.popular-section {
  background: var(--surface);
  padding: 3.5rem 0;
  border-bottom: 1px solid var(--border-soft);
}
.popular-section h2 {
  font-size: 1.6rem;
  margin-bottom: 1.5rem;
}
.pop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 0.65rem;
}
.pop-card {
  background: var(--neutral-50);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-md);
  padding: 0.9rem 0.75rem;
  text-align: center;
  cursor: pointer;
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    background var(--transition);
}
.pop-card:hover {
  background: var(--brand-50);
  border-color: var(--brand-200);
  box-shadow: var(--shadow-sm);
}
.pop-card .from {
  font-family: "DM Mono", monospace;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink);
}
.pop-card .to {
  font-family: "DM Mono", monospace;
  font-size: 1rem;
  font-weight: 700;
  color: var(--primary);
  margin-top: 0.2rem;
}
.pop-card .unit {
  font-size: 0.65rem;
  color: var(--neutral-900);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 0.15rem;
}

/* new style  */
/* new style  */
/* new style  */
/* new style  */
/* incehes to centimeter  */

/* ── Use-case cards ── */
.use-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
  margin: 1.25rem 0 0.5rem;
}
.use-card {
  background: var(--accent2-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.1rem 1.25rem;
}
.use-card .icon {
  font-size: 1.5rem;
  margin-bottom: 0.4rem;
  display: block;
}
.use-card strong {
  display: block;
  font-weight: 600;
  margin-bottom: 0.25rem;
  color: var(--ink);
  font-size: 0.95rem;
}
.use-card p {
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0;
  line-height: 1.55;
}
