/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  line-height: 1.6;
  color: #333;
  background: #f9f9f6;
  padding: 0;
}

/* Container */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header */
header {
  background: #2c3e50;
  color: #fff;
  padding: 2rem 0;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
header h1 {
  font-size: 2.2rem;
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 0.25rem;
}
.subtitle {
  font-size: 1.1rem;
  opacity: 0.85;
  font-weight: 300;
}

/* Sections */
section {
  margin: 2.5rem 0;
  background: #fff;
  padding: 1.75rem 2rem;
  border-radius: 8px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  border: 1px solid #e0e0d5;
}
section h2 {
  font-size: 1.5rem;
  color: #2c3e50;
  margin-bottom: 1rem;
  border-bottom: 2px solid #e67e22;
  padding-bottom: 0.4rem;
  display: inline-block;
}
.intro p, .code-reference p {
  margin-bottom: 0.8rem;
}

/* Controls */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1.5rem;
  background: #f4f4ed;
  padding: 1rem;
  border-radius: 6px;
}
.controls label {
  font-weight: 600;
  font-size: 0.9rem;
  color: #2c3e50;
}
.controls select {
  padding: 0.4rem 0.6rem;
  border: 1px solid #ccc;
  border-radius: 4px;
  font-size: 0.9rem;
  background: #fff;
  min-width: 100px;
}

/* Chart Output */
.chart-output {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: flex-start;
}
.screw-count {
  background: #e67e22;
  color: #fff;
  border-radius: 12px;
  padding: 1.5rem;
  text-align: center;
  min-width: 140px;
  box-shadow: 0 4px 12px rgba(230,126,34,0.3);
}
.screw-count .number {
  font-size: 3rem;
  font-weight: 800;
  display: block;
  line-height: 1;
}
.screw-count .label {
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  opacity: 0.9;
}
.spacing-details {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-size: 1rem;
}
.spacing-details .detail {
  background: #f4f4ed;
  padding: 0.5rem 0.8rem;
  border-radius: 4px;
  border-left: 4px solid #e67e22;
}
.pattern-diagram {
  flex-basis: 100%;
  margin-top: 1rem;
  background: #fafaf5;
  border: 1px solid #e0e0d5;
  border-radius: 6px;
  padding: 1rem;
  min-height: 200px;
  display: flex;
  justify-content: center;
  align-items: center;
}
.pattern-diagram svg {
  max-width: 100%;
  height: auto;
}
.note {
  font-size: 0.85rem;
  color: #666;
  margin-top: 1rem;
  font-style: italic;
}

/* Tips List */
.tips ul {
  list-style: none;
  padding-left: 0;
}
.tips li {
  margin-bottom: 0.7rem;
  padding-left: 1.5rem;
  position: relative;
}
.tips li::before {
  content: "🔩";
  position: absolute;
  left: 0;
  top: 0;
  font-size: 0.9rem;
}

/* Footer */
footer {
  background: #2c3e50;
  color: #ccc;
  text-align: center;
  padding: 1.5rem 0;
  margin-top: 2.5rem;
  font-size: 0.9rem;
}
footer a {
  color: #e67e22;
  text-decoration: none;
  margin: 0 0.3rem;
}
footer a:hover {
  text-decoration: underline;
}

/* Responsive */
@media (max-width: 700px) {
  header h1 { font-size: 1.7rem; }
  section { padding: 1.2rem; }
  .controls { flex-direction: column; align-items: flex-start; }
  .chart-output { flex-direction: column; }
  .screw-count { width: 100%; }
}
@media (max-width: 400px) {
  .container { padding: 0 0.8rem; }
  section { padding: 1rem; }
}

/* Print */
@media print {
  header, footer, .controls { display: none; }
  body { background: #fff; color: #000; }
  section { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
}



/* Factory-injected deployment helpers. The AI owns the site design above this block. */
.ad-unit {
  width: min(100%, 720px);
  min-height: 120px;
  margin: 24px auto;
  display: block;
}

.legal-page {
  width: min(900px, calc(100% - 32px));
  margin: 40px auto;
}

.site-utility-links {
  width: min(900px, calc(100% - 32px));
  margin: 32px auto;
  padding-top: 16px;
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  border-top: 1px solid rgba(127, 127, 127, 0.25);
  font-size: 0.9rem;
}

.site-utility-links a {
  color: inherit;
  opacity: 0.75;
}
