:root {
  --paper: #faf8f2;
  --paper-card: #fdfbf7;
  --paper-soft: #f4eee1;
  --paper-tint: #ece3d2;
  --ink: #253d32;
  --ink-muted: #56655c;
  --ink-light: #7c8b82;
  --line: #dcd3c4;
  --line-dark: #b8ad9a;
  --terracotta: #b56842;
  --terracotta-dark: #964e2b;
  --terracotta-light: #f7ede8;
  --brass: #c59b27;
  --brass-dark: #8c6b12;
  --leather-grain: #e8dccb;
  --leather-edge: #7d4427;
  --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;
}

* {
  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.7;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, p {
  margin-top: 0;
}

h1, h2 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.18;
}

h1 {
  font-size: clamp(36px, 4.5vw, 64px);
}

h2 {
  font-size: clamp(26px, 3vw, 40px);
}

h3 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 400;
}

em {
  font-style: italic;
  color: var(--terracotta);
}

a {
  color: inherit;
  text-decoration: none;
}

button, input, select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

[hidden] {
  display: none !important;
}

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid var(--terracotta);
  outline-offset: 3px;
}

::selection {
  background: var(--terracotta-light);
  color: var(--terracotta-dark);
}

/* Layout Shell */
.wrap {
  width: min(1140px, calc(100% - 48px));
  margin-inline: auto;
}

.skip {
  position: absolute;
  top: -100px;
  left: 16px;
  background: var(--terracotta);
  color: #fff;
  padding: 8px 16px;
  border-radius: 4px;
  z-index: 100;
}
.skip:focus {
  top: 16px;
}

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

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--serif);
  font-size: 20px;
  font-weight: bold;
  letter-spacing: -0.02em;
}

.brand svg {
  flex-shrink: 0;
}

.brand span {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand small {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.16em;
  color: var(--terracotta);
  text-transform: uppercase;
  margin-top: 3px;
  font-weight: 600;
}

nav#navigation {
  display: flex;
  align-items: center;
  gap: 28px;
  font-size: 14px;
}

nav#navigation a {
  color: var(--ink-muted);
  transition: color 0.15s ease;
  padding-block: 6px;
}

nav#navigation a:hover,
nav#navigation a[aria-current="true"] {
  color: var(--ink);
  font-weight: 600;
}

.nav-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.nav-cta:hover {
  background: var(--terracotta);
  transform: translateY(-1px);
}

/* Features Ribbon */
.features {
  background: var(--paper-soft);
  border-bottom: 1px solid var(--line);
  padding-block: 10px;
  font-size: 12.5px;
  color: var(--ink-muted);
}

.features > .wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.features span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.features strong {
  font-family: var(--mono);
  color: var(--ink);
  font-weight: 600;
}

/* Hero Section */
.hero {
  padding-block: 64px 44px;
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 56px;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--terracotta);
  font-weight: 600;
  margin-bottom: 16px;
}

.eyebrow::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 2px;
  background: var(--terracotta);
}

.hero p.lead {
  font-size: 18px;
  color: var(--ink-muted);
  line-height: 1.6;
  margin-bottom: 32px;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 4px;
  font-weight: 500;
  font-size: 14px;
  transition: all 0.2s ease;
  border: 1px solid var(--ink);
}

.btn-primary:hover {
  background: var(--terracotta);
  border-color: var(--terracotta);
  transform: translateY(-1px);
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: transparent;
  color: var(--ink);
  border-radius: 4px;
  font-weight: 500;
  font-size: 14px;
  border: 1px solid var(--line-dark);
  transition: all 0.2s ease;
}

.btn-outline:hover {
  background: var(--paper-soft);
  border-color: var(--ink);
}

.hero-art {
  background: var(--paper-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(37, 61, 50, 0.05);
  position: relative;
}

/* Tool Grid Cards */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding-block: 48px 24px;
}

.section-header h2 {
  margin-bottom: 6px;
}

.section-header p {
  color: var(--ink-muted);
  font-size: 15px;
  margin-bottom: 0;
}

.tool-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin-bottom: 64px;
}

.tool-card {
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  transition: all 0.25s ease;
  position: relative;
}

.tool-card:hover {
  border-color: var(--line-dark);
  box-shadow: 0 8px 24px rgba(37, 61, 50, 0.08);
  transform: translateY(-2px);
}

.tool-number {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  color: var(--terracotta);
  font-weight: 600;
  margin-bottom: 12px;
}

.tool-card h3 {
  font-size: 21px;
  margin-bottom: 12px;
}

.tool-card p {
  color: var(--ink-muted);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 24px;
  flex-grow: 1;
}

.tool-formula {
  background: var(--paper-soft);
  border-left: 3px solid var(--terracotta);
  padding: 8px 12px;
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--ink);
  margin-bottom: 24px;
  border-radius: 0 4px 4px 0;
}

.tool-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink);
  transition: gap 0.2s;
}

.tool-card:hover .tool-link {
  color: var(--terracotta);
  gap: 10px;
}

/* Preset Strip & Chips */
.preset-strip {
  background: var(--paper-soft);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px 18px;
  margin-bottom: 28px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.preset-strip-title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.preset-strip-title::after {
  content: "→";
  color: var(--terracotta);
}

.preset-chip {
  background: var(--paper-card);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.preset-chip:hover {
  background: #fff;
  border-color: var(--terracotta);
  color: var(--terracotta-dark);
}

.preset-chip.active {
  background: var(--terracotta);
  color: #fff;
  border-color: var(--terracotta);
}

/* Calculator Workbench Layout */
.calculator {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(37, 61, 50, 0.04);
  margin-bottom: 56px;
}

.form-side {
  padding: 36px 32px;
}

.result-side {
  background: var(--paper-soft);
  border-left: 1px solid var(--line);
  padding: 36px 32px;
  display: flex;
  flex-direction: column;
}

/* Form Inputs & Controls */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.form-grid.three {
  grid-template-columns: repeat(3, 1fr);
}

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

.form-group.full {
  grid-column: 1 / -1;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  display: flex;
  justify-content: space-between;
}

.form-group label small {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: normal;
  color: var(--ink-muted);
}

.input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 4px;
  overflow: hidden;
  transition: border-color 0.2s ease;
}

.input-wrap:focus-within {
  border-color: var(--terracotta);
  box-shadow: 0 0 0 2px var(--terracotta-light);
}

.input-wrap input,
.input-wrap select {
  flex-grow: 1;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: transparent;
  font-family: var(--mono);
  font-size: 14px;
  outline: none;
}

.input-unit {
  padding-right: 12px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-muted);
  user-select: none;
}

.form-hint {
  font-size: 12px;
  color: var(--ink-muted);
  margin-top: 2px;
}

/* Results Display */
.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}

.result-header h3 {
  margin: 0;
  font-size: 18px;
}

.result-tag {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--terracotta);
  font-weight: 600;
}

.stat-callout {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 20px;
  margin-bottom: 20px;
  text-align: center;
}

.stat-value {
  font-family: var(--mono);
  font-size: clamp(32px, 3.5vw, 44px);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 13px;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}

.spec-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  margin-bottom: 24px;
}

.spec-table tr {
  border-bottom: 1px solid var(--line);
}

.spec-table th,
.spec-table td {
  padding: 10px 4px;
  text-align: left;
}

.spec-table th {
  font-weight: 500;
  color: var(--ink-muted);
  width: 48%;
}

.spec-table td {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--ink);
  text-align: right;
}

/* SVG Seam Diagram & Precision Ruler Ticks */
.diagram-container {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 20px;
}

.diagram-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 12px;
}

.seam-svg {
  width: 100%;
  height: auto;
  border-radius: 4px;
  overflow: visible;
}

/* Leather Cross-Section Thickness Bar */
.gauge-visualizer {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 20px;
}

.leather-slab {
  height: 52px;
  background: linear-gradient(180deg, #cf8d5e 0%, #b86e3f 30%, #e0c8b0 32%, #ccad8d 100%);
  border-radius: 4px;
  border: 1px solid var(--leather-edge);
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: var(--mono);
  font-weight: bold;
  text-shadow: 0 1px 2px rgba(0,0,0,0.4);
}

.slab-layers {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--ink-muted);
  margin-top: 6px;
}

/* Punching Steps List */
.step-list {
  list-style: none;
  padding: 0;
  margin: 0 0 20px 0;
  font-size: 13px;
}

.step-list li {
  position: relative;
  padding-left: 24px;
  margin-bottom: 8px;
  color: var(--ink);
}

.step-list li::before {
  content: "•";
  position: absolute;
  left: 8px;
  color: var(--terracotta);
  font-weight: bold;
}

/* Notice Banners */
.notice-box {
  padding: 12px 14px;
  border-radius: 4px;
  font-size: 12.5px;
  line-height: 1.5;
  margin-bottom: 16px;
}

.notice-box.safe {
  background: #edf5ef;
  color: #235232;
  border-left: 3px solid #3d8650;
}

.notice-box.caution {
  background: #fdf5e8;
  color: #8c5d18;
  border-left: 3px solid #d4952c;
}

/* Workbench Guide Articles */
.article-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 48px;
  padding-block: 48px 64px;
}

.article-sidebar {
  position: sticky;
  top: 32px;
  align-self: start;
}

.article-sidebar h4 {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin-bottom: 16px;
}

.article-sidebar ul {
  list-style: none;
  padding: 0;
  margin: 0;
  border-left: 1px solid var(--line);
}

.article-sidebar li a {
  display: block;
  padding: 6px 0 6px 16px;
  font-size: 13px;
  color: var(--ink-muted);
  border-left: 2px solid transparent;
  margin-left: -1px;
  transition: all 0.15s;
}

.article-sidebar li a:hover {
  color: var(--terracotta);
  border-color: var(--terracotta);
}

.article-content {
  max-width: 680px;
}

.article-content h1 {
  font-size: clamp(32px, 4vw, 48px);
  margin-bottom: 16px;
}

.article-lead {
  font-size: 18px;
  line-height: 1.6;
  color: var(--ink-muted);
  margin-bottom: 36px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.article-content h2 {
  font-size: 26px;
  margin-top: 40px;
  margin-bottom: 14px;
}

.article-content p {
  margin-bottom: 18px;
}

.article-content code {
  font-family: var(--mono);
  font-size: 13px;
  background: var(--paper-soft);
  padding: 2px 6px;
  border-radius: 3px;
}

/* Footer */
.footer {
  border-top: 1px solid var(--line);
  background: var(--paper-soft);
  padding-block: 48px 24px;
  margin-top: 64px;
}

.footer-top {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 40px;
  margin-bottom: 40px;
}

.footer-top strong {
  display: block;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 16px;
}

.footer-top a {
  display: block;
  font-size: 13px;
  color: var(--ink-muted);
  margin-bottom: 10px;
  transition: color 0.15s;
}

.footer-top a:hover {
  color: var(--terracotta);
}

.footer-bottom {
  border-top: 1px solid var(--line);
  padding-block: 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--ink-muted);
}

/* Responsive */
@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 36px;
    padding-block: 40px 32px;
  }
  .tool-grid {
    grid-template-columns: 1fr;
  }
  .calculator {
    grid-template-columns: 1fr;
  }
  .result-side {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
  .article-layout {
    grid-template-columns: 1fr;
  }
  .article-sidebar {
    display: none;
  }
  .footer-top {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 600px) {
  .wrap {
    width: calc(100% - 32px);
  }
  .header {
    flex-wrap: wrap;
    gap: 16px;
  }
  .header nav#navigation {
    order: 3;
    width: 100%;
    justify-content: space-between;
    gap: 12px;
    font-size: 12px;
  }
  .features > .wrap {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  .form-grid, .form-grid.three {
    grid-template-columns: 1fr;
  }
  .footer-top {
    grid-template-columns: 1fr;
  }
  .preset-strip {
    padding: 10px 12px;
  }
  .preset-chip {
    font-size: 11.5px;
    padding: 5px 10px;
    white-space: normal;
  }
}

/* Workshop Print Styles (Spec Sheet Mode) */
@media print {
  body {
    background: #fff !important;
    color: #000 !important;
    font-size: 12px;
  }
  .header, .footer, .skip, .actions, .nav-cta, .features, .hero-actions, .btn-primary, .btn-outline, .preset-strip, nav#navigation {
    display: none !important;
  }
  .wrap {
    width: 100% !important;
  }
  .calculator {
    border: 1px solid #000 !important;
    box-shadow: none !important;
    grid-template-columns: 1fr !important;
  }
  .result-side {
    background: #fdfdfd !important;
    border-left: 0 !important;
    border-top: 1px solid #000 !important;
    padding: 20px !important;
  }
  .form-side {
    padding: 20px !important;
  }
  .stat-callout {
    border: 1px solid #000 !important;
    background: #f5f5f5 !important;
  }
  .stat-value {
    color: #000 !important;
  }
  .diagram-container {
    border: 1px solid #000 !important;
  }
}
