/* HTS Catalog — Design Tokens */
:root {
  --text: #1A1A18;
  --text-mid: #5A564E;
  --text-muted: #9C9488;
  --text-ghost: #B5AFA6;
  --bg: #FAFAF8;
  --surface: #F0EDE8;
  --border: #D5D0C8;
  --border-light: #E5E0D8;
  --accent: #C2502E;
  --accent-hover: #A8421F;
  --white: #FFFFFF;
  --sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --serif: 'Instrument Serif', Georgia, serif;
  --radius: 8px;
}

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

body {
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
}

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

/* Nav */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 120px;
  max-width: 1440px;
  margin: 0 auto;
}
.nav-logo { font-weight: 600; font-size: 18px; letter-spacing: -0.02em; }
.nav-links { display: flex; gap: 36px; }
.nav-links a { font-size: 14px; color: var(--text-muted); transition: color 0.15s; }
.nav-links a:hover { color: var(--text); }
.nav-links a.active { color: var(--text); }

/* Layout */
.container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 120px;
}

/* Page Header */
.page-header {
  padding: 48px 0 24px;
}
.page-header h1 {
  font-family: var(--serif);
  font-size: 44px;
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.page-header .subtitle {
  font-size: 17px;
  color: var(--text-mid);
  font-weight: 300;
  margin-top: 12px;
  line-height: 1.6;
  max-width: 640px;
}

/* Breadcrumbs */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  padding-top: 32px;
  flex-wrap: wrap;
}
.breadcrumbs a { transition: color 0.15s; }
.breadcrumbs a:hover { color: var(--text); }
.breadcrumbs .sep { color: var(--border); user-select: none; }

/* Section Groups (root page) */
#search {
  margin: 8px 0 32px;
}
.section-group {
  margin-bottom: 48px;
}
.section-group h2 {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.section-group .section-range {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
}
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.chapter-card {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 14px 16px;
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.chapter-card:hover {
  border-color: var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}
.chapter-card .ch-num {
  font-weight: 600;
  font-size: 13px;
  color: var(--text-muted);
  flex-shrink: 0;
  min-width: 28px;
}
.chapter-card .ch-desc {
  font-size: 14px;
  color: var(--text-mid);
  line-height: 1.45;
}

/* Data Tables */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.data-table th {
  text-align: left;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 10px 12px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: rgba(0,0,0,0.015); }
.data-table .code-col {
  font-weight: 500;
  white-space: nowrap;
  color: var(--accent);
}
.data-table .code-col a { color: var(--accent); }
.data-table .code-col a:hover { text-decoration: underline; }
.data-table .desc-col { color: var(--text-mid); line-height: 1.45; }
.data-table .rate-col {
  white-space: nowrap;
  color: var(--text-mid);
  font-size: 13px;
}
.data-table .superior-row td {
  font-weight: 500;
  color: var(--text);
  padding-top: 20px;
  border-bottom: none;
  font-size: 13px;
}

/* Rate Detail Card */
.rate-card {
  background: var(--white);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
}
.rate-card h3 {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 16px;
}
.rate-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.rate-item .rate-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.rate-item .rate-value {
  font-size: 16px;
  font-weight: 500;
}
.rate-item .rate-value.free { color: #3d8c5c; }

/* CR Rates Card */
.cr-card {
  background: var(--white);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  position: relative;
}
.cr-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent);
  border-radius: var(--radius) var(--radius) 0 0;
}
.cr-card h3 {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.cr-card .cr-flag { font-size: 16px; }
.cr-card .cr-product {
  font-size: 13px;
  color: var(--text-mid);
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}

/* Stat Suffixes */
.suffix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-top: 16px;
}
.suffix-table th {
  text-align: left;
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.suffix-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-mid);
}
.suffix-table tr:last-child td { border-bottom: none; }
.suffix-table .code-col { font-weight: 500; color: var(--text); }

/* Footnotes */
.footnotes {
  margin-top: 16px;
  padding: 16px;
  background: var(--surface);
  border-radius: var(--radius);
  font-size: 13px;
  color: var(--text-mid);
  line-height: 1.6;
}
.footnotes strong { color: var(--text); font-weight: 500; }

/* Prev/Next Nav */
.pager {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 16px;
  padding: 32px 0;
  margin-top: 32px;
  border-top: 1px solid var(--border-light);
}
.pager a {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 16px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  transition: border-color 0.15s;
  max-width: 45%;
}
.pager a:hover { border-color: var(--border); }
.pager .pager-label {
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}
.pager .pager-title {
  font-size: 14px;
  color: var(--text);
  font-weight: 500;
}
.pager .next { text-align: right; margin-left: auto; }

/* CTA Banner */
.cta-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 24px 28px;
  background: var(--surface);
  border-radius: var(--radius);
  margin: 32px 0;
}
.cta-banner .cta-text {
  font-size: 15px;
  color: var(--text-mid);
}
.cta-banner .cta-text strong {
  color: var(--text);
  font-weight: 500;
}
.cta-links {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
}
.cta-link {
  display: inline-flex;
  align-items: center;
  padding: 10px 20px;
  font-size: 13px;
  font-weight: 500;
  border-radius: 6px;
  transition: all 0.15s;
  white-space: nowrap;
}
.cta-link--primary {
  background: var(--text);
  color: var(--bg);
}
.cta-link--primary:hover { background: #333; }
.cta-link--secondary {
  background: var(--white);
  color: var(--text);
  border: 1px solid var(--border);
}
.cta-link--secondary:hover { border-color: var(--text-muted); }

/* Footer */
.footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0;
  margin-top: 48px;
  border-top: 1px solid var(--border-light);
}
.footer span { font-size: 13px; color: var(--text-ghost); }
.footer a { font-size: 13px; color: var(--text-ghost); }
.footer a:hover { color: var(--text-mid); }

/* Search */
.search-input {
  width: 100%;
  font-family: var(--sans);
  font-weight: 400;
  font-size: 16px;
  height: 52px;
  padding: 0 16px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-input::placeholder { opacity: 0.35; }
.search-input:focus {
  border-color: var(--text-muted);
  box-shadow: 0 0 0 3px rgba(26, 26, 24, 0.06);
}
.search-results {
  display: flex;
  flex-direction: column;
}
.search-result {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.1s;
}
.search-result:hover { background: var(--surface); }
.search-code {
  font-weight: 500;
  color: var(--accent);
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 90px;
  font-size: 14px;
}
.search-desc {
  color: var(--text-mid);
  font-size: 14px;
  line-height: 1.45;
}
.search-empty {
  padding: 16px;
  font-size: 14px;
  color: var(--text-muted);
}

/* Responsive */
@media (max-width: 1024px) {
  .container { padding: 0 48px; }
  .nav { padding: 28px 48px; }
}
@media (max-width: 768px) {
  .container { padding: 0 24px; }
  .nav { padding: 28px 24px; }
  .page-header h1 { font-size: 32px; }
  .chapter-grid { grid-template-columns: 1fr; }
  .data-table { font-size: 13px; }
  .data-table th, .data-table td { padding: 8px; }
  .rate-grid { grid-template-columns: 1fr 1fr; }
  .cta-banner { flex-direction: column; text-align: center; }
  .cta-links { flex-direction: column; width: 100%; }
  .cta-link { justify-content: center; }
  .pager { flex-direction: column; }
  .pager a { max-width: 100%; }
  .pager .next { text-align: left; margin-left: 0; }
}
