/**
 * Machining & Metalworking Lab - Craftsman Paper Theme
 * Palette: #faf8f2 paper, #253d32 ink, #b56842 terracotta
 * Typography: Georgia serif headings, System sans body, Tabular monospace numbers
 * 100% Original Vector SVGs - Zero Emojis
 */

:root {
  --paper: #faf8f2;
  --paper-card: #fdfcf9;
  --paper-soft: #ede8dc;
  --paper-warm: #f4efe4;
  --ink: #253d32;
  --ink-muted: #536259;
  --ink-light: #7b8880;
  --line: #d8dcce;
  --line-dark: #b8bdac;
  --terracotta: #b56842;
  --terracotta-dark: #964e2b;
  --terracotta-light: #f7ede8;
  --terracotta-glow: rgba(181, 104, 66, 0.15);

  --serif: Georgia, Cambria, 'Times New Roman', serif;
  --sans: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow-sm: 0 1px 3px rgba(37, 61, 50, 0.06);
  --shadow-md: 0 4px 12px rgba(37, 61, 50, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 25px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

.wrap {
  width: min(100% - 32px, 1160px);
  margin-inline: auto;
}

.skip {
  position: absolute;
  top: -9999px;
  left: 12px;
  background: var(--terracotta);
  color: #fff;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  z-index: 1000;
  text-decoration: none;
  font-weight: 600;
}
.skip:focus {
  top: 12px;
}

/* Hub Return Bar */
.kc-hub-bar {
  background: var(--paper);
  color: var(--ink);
  padding: 8px 24px;
  font-size: 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--sans);
}
.kc-hub-bar a {
  color: var(--terracotta);
  text-decoration: none;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.kc-hub-bar a:hover {
  text-decoration: underline;
}
.kc-hub-bar span {
  color: var(--ink-muted);
  font-weight: 500;
}

/* Header */
.header {
  padding-block: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.2px;
}
.brand span small {
  display: block;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--terracotta);
  margin-top: 1px;
}

#navigation {
  display: flex;
  align-items: center;
  gap: 24px;
}
#navigation a {
  text-decoration: none;
  color: var(--ink-muted);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.15s ease;
}
#navigation a:hover,
#navigation a[aria-current="page"] {
  color: var(--terracotta);
  font-weight: 600;
}

.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--ink);
  color: #fff;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.15s ease;
}
.nav-cta:hover {
  background: var(--terracotta);
}

/* Hero Section */
.hero {
  padding-block: 48px 36px;
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 40px;
  align-items: center;
}
@media (max-width: 860px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 28px;
  }
}

.eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--terracotta);
  text-transform: uppercase;
  margin-bottom: 8px;
}

h1, h2, h3, h4 {
  font-family: var(--serif);
  color: var(--ink);
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 12px 0;
}
h1 { font-size: clamp(28px, 4vw, 38px); letter-spacing: -0.5px; }
h2 { font-size: clamp(22px, 3vw, 28px); }
h3 { font-size: 18px; }

.lead {
  font-size: 16.5px;
  color: var(--ink-muted);
  line-height: 1.6;
  margin-bottom: 24px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-family: var(--sans);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
}
.btn-primary {
  background: var(--ink);
  color: #fff;
}
.btn-primary:hover {
  background: var(--terracotta);
}
.btn-secondary {
  background: var(--paper-soft);
  color: var(--ink);
  border-color: var(--line);
}
.btn-secondary:hover {
  background: var(--line);
}
.btn-outline {
  background: transparent;
  color: var(--ink-muted);
  border-color: var(--line);
}
.btn-outline:hover {
  border-color: var(--ink);
  color: var(--ink);
}

/* Hero Telemetry Card */
.hero-card {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}
.tag {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--terracotta);
}
.mono-badge {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--paper-soft);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
}
.metric-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
.metric .label {
  display: block;
  font-size: 12px;
  color: var(--ink-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.metric .val {
  font-size: 26px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
}
.metric .sub {
  display: block;
  font-size: 11.5px;
  color: var(--ink-muted);
  margin-top: 2px;
}
.card-footer {
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.pill-label {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-muted);
}
.pill-val {
  font-size: 12px;
  font-weight: 700;
  background: var(--terracotta-light);
  color: var(--terracotta-dark);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
}

/* Ruler Ticks Divider */
.ruler-ticks {
  height: 8px;
  margin-block: 28px;
  background: repeating-linear-gradient(
    90deg,
    var(--line) 0,
    var(--line) 1px,
    transparent 1px,
    transparent 12px
  );
  border-bottom: 1px solid var(--line);
}

/* Curated Materials Bar */
.presets-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 14px 18px;
  background: var(--paper-warm);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
}
.presets-title {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--ink);
}
.preset-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.preset-pill {
  display: inline-flex;
  flex-direction: column;
  padding: 4px 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  text-decoration: none;
  color: var(--ink);
  font-size: 12px;
  transition: all 0.15s ease;
}
.preset-pill small {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--ink-light);
}
.preset-pill:hover {
  border-color: var(--terracotta);
  background: var(--terracotta-light);
}

/* Tool Grid */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}
.tool-card {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 24px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--line-dark);
}
.tool-badge {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--terracotta);
  margin-bottom: 8px;
}
.tool-card p {
  color: var(--ink-muted);
  font-size: 14px;
  flex-grow: 1;
  margin: 0 0 16px 0;
}
.tool-scope {
  font-size: 12px;
  color: var(--ink-light);
  margin-bottom: 12px;
}
.tool-formula {
  background: var(--paper-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 11px;
  color: var(--ink);
  margin-bottom: 16px;
  overflow-x: auto;
}
.tool-link {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--terracotta);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.tool-link:hover {
  text-decoration: underline;
}

/* Guides Grid */
.guides-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
}
.guide-card {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.guide-tag {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--terracotta);
  text-transform: uppercase;
  margin-bottom: 8px;
  display: inline-block;
}
.guide-card p {
  font-size: 13.5px;
  color: var(--ink-muted);
  margin-bottom: 14px;
}
.guide-link {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.guide-link:hover {
  color: var(--terracotta);
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  gap: 8px;
  font-size: 12.5px;
  color: var(--ink-light);
  margin-bottom: 16px;
}
.breadcrumb a {
  color: var(--ink-muted);
  text-decoration: none;
}
.breadcrumb a:hover {
  color: var(--terracotta);
}

/* Workbench Grid & Tool Layout */
.tool-header {
  margin-bottom: 32px;
}
.workbench-grid {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 28px;
  align-items: start;
}
@media (max-width: 900px) {
  .workbench-grid {
    grid-template-columns: 1fr;
  }
}

.workbench-card {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card-title-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 20px;
}
.card-title-bar h3 {
  margin: 0;
  font-size: 18px;
}

/* Unit Toggle */
.unit-toggle {
  display: flex;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.unit-btn {
  background: var(--paper-soft);
  border: none;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}
.unit-btn.active {
  background: var(--ink);
  color: #fff;
}

/* Forms */
.calc-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 480px) {
  .form-row {
    grid-template-columns: 1fr;
  }
}
.form-input, .form-select {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 14px;
  color: var(--ink);
  font-family: inherit;
  transition: border-color 0.15s ease;
}
.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--terracotta);
  box-shadow: 0 0 0 2px var(--terracotta-glow);
}
.field-hint {
  font-size: 11.5px;
  color: var(--ink-light);
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
}

/* Range Slider */
.form-range {
  width: 100%;
  accent-color: var(--terracotta);
}
.slider-legend {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--ink-light);
  margin-top: 4px;
}

/* Results Hero */
.results-hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  background: var(--paper-warm);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 20px;
  margin-bottom: 20px;
}
.result-big .label {
  display: block;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.8px;
  color: var(--ink-light);
  margin-bottom: 4px;
}
.result-big .big-val {
  font-size: 32px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1;
}
.result-big .big-unit {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--terracotta);
  margin-top: 4px;
}

/* RCT Alert Box */
.rct-alert-box {
  background: var(--terracotta-light);
  border-left: 3px solid var(--terracotta);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 12px 16px;
  margin-bottom: 20px;
}
.rct-title {
  font-size: 13px;
  color: var(--terracotta-dark);
  margin-bottom: 2px;
}
.rct-alert-box p {
  margin: 0;
  font-size: 12px;
  color: var(--ink-muted);
}

/* Specs Grid */
.specs-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 20px;
}
@media (max-width: 480px) {
  .specs-grid {
    grid-template-columns: 1fr;
  }
}
.spec-item {
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}
.spec-label {
  display: block;
  font-size: 11.5px;
  color: var(--ink-light);
  margin-bottom: 2px;
}
.spec-val {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
}

/* Status Pill */
.status-pill {
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
}
.status-ready {
  background: #e2ede5;
  color: #2e593e;
}

/* Table Container */
.table-container {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.specs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  text-align: left;
}
.specs-table th {
  background: var(--paper-warm);
  padding: 8px 12px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.specs-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink-muted);
}
.specs-table tr:last-child td {
  border-bottom: none;
}

/* Advisory Card */
.advisory-card {
  background: var(--paper-warm);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
}
.advisory-card h4 {
  margin: 0 0 6px 0;
  font-size: 14px;
  color: var(--terracotta);
}
.advisory-card p {
  margin: 0;
  font-size: 12.5px;
  color: var(--ink-muted);
}

/* Article & Guide Styling */
.article-container {
  max-width: 820px;
}
.article-header {
  margin-bottom: 32px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 24px;
}
.guide-section {
  margin-bottom: 36px;
}
.formula-box {
  background: var(--paper-warm);
  border-left: 3px solid var(--terracotta);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 12px 18px;
  font-size: 14px;
  margin-block: 16px;
  overflow-x: auto;
}

/* Footer */
.footer {
  margin-top: 64px;
  border-top: 1px solid var(--line);
  padding-block: 48px 32px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
}
@media (max-width: 860px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 500px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}
.footer-brand strong {
  font-family: var(--serif);
  font-size: 16px;
  color: var(--ink);
}
.footer-brand p {
  font-size: 13px;
  color: var(--ink-muted);
  margin: 6px 0 12px 0;
}
.footer-brand .copyright {
  font-size: 11.5px;
  color: var(--ink-light);
}
.footer h4 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
  color: var(--ink);
}
.footer ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.footer ul a {
  text-decoration: none;
  color: var(--ink-muted);
  font-size: 13px;
}
.footer ul a:hover {
  color: var(--terracotta);
}
