/* Xingyu Zhitong — Modern Engineering System Stylesheet */
:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-subtle: #f1f5f9;
  --surface-hover: #e2e8f0;
  --border: #e2e8f0;
  --border-focus: #0284c7;
  --text: #0f172a;
  --text-muted: #64748b;
  --brand: #0284c7;
  --brand-hover: #0369a1;
  --brand-light: #e0f2fe;
  --accent: #0ea5e9;
  --success: #059669;
  --success-bg: #ecfdf5;
  --success-border: #a7f3d0;
  --info: #0284c7;
  --info-bg: #f0f9ff;
  --info-border: #bae6fd;
  --warning: #d97706;
  --warning-bg: #fffbeb;
  --warning-border: #fde68a;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.07), 0 4px 6px -4px rgba(0, 0, 0, 0.05);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #090d16;
    --surface: #0f172a;
    --surface-subtle: #1e293b;
    --surface-hover: #334155;
    --border: #1e293b;
    --border-focus: #38bdf8;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --brand: #38bdf8;
    --brand-hover: #7dd3fc;
    --brand-light: #082f49;
    --accent: #0284c7;
    --success: #10b981;
    --success-bg: #064e3b;
    --success-border: #047857;
    --info: #38bdf8;
    --info-bg: #082f49;
    --info-border: #0369a1;
    --warning: #fbbf24;
    --warning-bg: #451a03;
    --warning-border: #78350f;
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.4);
  }
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--font-sans);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

a {
  color: var(--brand);
  text-decoration: underline;
  text-decoration-thickness: 1.5px;
  text-underline-offset: 2.5px;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--brand-hover);
}

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-container {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.015em;
}

.site-logo svg {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.site-nav a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: all 0.15s ease;
}

.site-nav a:hover,
.site-nav a.active {
  color: var(--text);
  background: var(--surface-subtle);
}

.site-nav a.active {
  font-weight: 600;
  color: var(--brand);
}

/* Main Layout */
.site-main {
  flex: 1;
  padding: 2.25rem 1.25rem 3.5rem;
}

.content-container {
  max-width: 760px;
  margin: 0 auto;
  width: 100%;
}

.layout-wide {
  max-width: 1120px;
  margin: 0 auto;
  width: 100%;
}

/* Typography & Headings */
h1 {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.25;
  letter-spacing: -0.025em;
  margin-bottom: 0.75rem;
  color: var(--text);
}

h2 {
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: -0.02em;
  margin: 2rem 0 0.85rem;
  color: var(--text);
}

h3 {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.4;
  margin: 1.5rem 0 0.6rem;
  color: var(--text);
}

p {
  margin-bottom: 1rem;
  color: var(--text);
}

.page-subtitle {
  font-size: 1.1rem;
  line-height: 1.55;
  color: var(--text-muted);
  margin-bottom: 1.75rem;
}

.page-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

/* Hero Section */
.hero-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem 1.75rem;
  margin-bottom: 2.5rem;
  box-shadow: var(--shadow-sm);
}

.hero-box h1 {
  font-size: 2.2rem;
  margin-bottom: 0.85rem;
}

.hero-lead {
  font-size: 1.15rem;
  line-height: 1.6;
  color: var(--text-muted);
  max-width: 820px;
  margin-bottom: 1.5rem;
}

.hero-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Category Sections & Grids */
.category-section {
  margin-bottom: 2.75rem;
}

.category-header {
  border-bottom: 2px solid var(--border);
  padding-bottom: 0.6rem;
  margin-bottom: 1.25rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.category-title {
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
  display: flex;
  flex-direction: column;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
}

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

.card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.5rem;
  line-height: 1.35;
}

.card-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 1rem;
  flex: 1;
}

.card-footer {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

/* Calculator Panel */
.calc-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow);
}

.calc-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.form-group label {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
}

.form-group .field-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.calc-input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.calc-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15);
  background: var(--surface);
}

/* Results Display Box */
.results-box {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.35rem;
  margin-top: 1rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.88rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
}

.status-badge.status-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.status-badge.status-info {
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid var(--info-border);
}

.status-badge.status-warning {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid var(--warning-border);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.metric-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.metric-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

.metric-val {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  font-family: var(--font-mono);
}

.results-detail {
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text);
  margin-bottom: 0.85rem;
}

.results-formula {
  background: var(--surface);
  border-left: 3px solid var(--brand);
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-family: var(--font-mono);
  font-size: 0.84rem;
  color: var(--text);
  overflow-x: auto;
  margin-bottom: 0.85rem;
}

.results-assumptions {
  font-size: 0.84rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  line-height: 1.5;
}

/* Informational Callouts */
.callout {
  border-radius: var(--radius);
  padding: 1.15rem 1.35rem;
  margin: 1.5rem 0;
  font-size: 0.92rem;
  line-height: 1.6;
  border: 1px solid var(--border);
  background: var(--surface);
}

.callout-info {
  border-left: 4px solid var(--brand);
  background: var(--info-bg);
  border-color: var(--info-border);
}

.callout-warning {
  border-left: 4px solid var(--warning);
  background: var(--warning-bg);
  border-color: var(--warning-border);
}

/* Lists and Tables */
ul, ol {
  padding-left: 1.4rem;
  margin-bottom: 1.25rem;
}

li {
  margin-bottom: 0.4rem;
}

.table-wrapper {
  overflow-x: auto;
  margin: 1.25rem 0 1.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  text-align: left;
}

th {
  background: var(--surface-subtle);
  padding: 0.75rem 1rem;
  font-weight: 600;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}

td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}

tr:last-child td {
  border-bottom: none;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--surface-subtle);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

pre {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.86rem;
  margin: 1rem 0 1.5rem;
}

/* FAQ Accordion / Blocks */
.faq-block {
  margin-top: 2rem;
}

.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  background: var(--surface);
  overflow: hidden;
}

.faq-question {
  padding: 1rem 1.25rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.faq-question::-webkit-details-marker {
  display: none;
}

.faq-answer {
  padding: 0 1.25rem 1.25rem;
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.6;
}

/* Related Guides Section */
.related-guides-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin: 2rem 0;
}

.related-guides-box h3 {
  margin-top: 0;
  margin-bottom: 0.85rem;
}

.related-guides-list {
  list-style: none;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.related-guides-list li {
  margin-bottom: 0;
}

.related-guides-list a {
  font-weight: 500;
  font-size: 0.95rem;
}

/* Breadcrumb Navigation */
.breadcrumb-nav {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}

.breadcrumb-nav a {
  text-decoration: none;
  color: var(--text-muted);
}

.breadcrumb-nav a:hover {
  color: var(--brand);
}

.breadcrumb-sep {
  color: var(--text-muted);
  opacity: 0.6;
}

/* Footer */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 3rem 1.25rem 2.5rem;
  margin-top: auto;
}

.footer-container {
  max-width: 1120px;
  margin: 0 auto;
}

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.footer-nav a {
  text-decoration: none;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.footer-nav a:hover {
  color: var(--brand);
}

.footer-disclaimer {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--text-muted);
}

/* Responsive adjustments */
@media (max-width: 640px) {
  h1 { font-size: 1.65rem; }
  h2 { font-size: 1.25rem; }
  .calc-panel { padding: 1.25rem 1rem; }
  .hero-box { padding: 1.75rem 1.25rem; }
  .calc-form { grid-template-columns: 1fr; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .metric-val { font-size: 1.15rem; }
}

@media (max-width: 700px) {
  table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  pre { white-space: pre-wrap; word-break: break-word; }
}
