/* Visual idea: the paperwork of a customs entry. Cool form paper, ink-blue
   stamp color, and one bold element: the tariff code set like a form field. */
/* Palette: navy for trust, orange only where the visitor should act.
   White text on bright orange fails contrast, so orange buttons use navy text. */
:root {
  --paper: #F4F7FB;
  --surface: #FFFFFF;
  --ink: #0B2545;
  --muted: #4A5B73;
  --rule: #D5DEEB;
  --stamp: #1B4DB1;
  --navy: #0B2545;
  --seal: #C2410C;
  --accent: #FF8A1F;
  --accent-hover: #FF7A00;
  --accent-text: #C2410C;
  --accent-soft: #FFE9D2;
  --on-accent: #0B2545;
  --ok: #15803D;
  --mark: #FF8A1F;
  --display: "Archivo", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --text: "Source Serif 4", Georgia, "Times New Roman", serif;
  --measure: 40rem;
  --r: 8px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0A1628; --surface: #112240; --ink: #E8EEF7; --muted: #A9B8D0;
    --rule: #26406A; --stamp: #8DB4FF; --navy: #071223; --seal: #FFB067;
    --accent: #FF9A3C; --accent-hover: #FFAE5E; --accent-text: #FFB067; --accent-soft: #3A2A18;
    --on-accent: #0B2545; --ok: #4ADE80; --mark: #FF9A3C;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 1.0625rem/1.65 var(--text);
}
a { color: var(--stamp); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--display); line-height: 1.15; margin: 0 0 0.6em; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 5vw, 3.25rem); font-weight: 800; font-stretch: 75%; }
h2 { font-size: 1.35rem; font-weight: 700; font-stretch: 87%; }
p { margin: 0 0 1em; }

main, .site-foot { max-width: 72rem; margin: 0 auto; padding: 0 1.25rem; }
.site-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.9rem max(1.25rem, calc((100% - 72rem) / 2 + 1.25rem));
  background: var(--navy); border-bottom: 3px solid var(--accent);
}
.brand { font: 800 1.2rem var(--display); font-stretch: 75%; color: #fff; text-decoration: none; letter-spacing: 0.01em; }
.lang { font: 600 0.9rem var(--display); color: #fff; text-decoration: none; border: 1px solid rgba(255,255,255,0.45); border-radius: 999px; padding: 0.2rem 0.85rem; }
.lang:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
main { padding-top: 2rem; padding-bottom: 3rem; }
.site-foot { border-top: 1px solid var(--rule); padding-top: 1.5rem; padding-bottom: 2.5rem; color: var(--muted); font-size: 0.9rem; }
.site-foot p { max-width: var(--measure); }

/* Home */
.hero { max-width: 48rem; padding: 2rem 0 2.5rem; }
.lead { font-size: 1.2rem; color: var(--muted); max-width: var(--measure); }
.search label { display: block; font: 600 0.95rem var(--display); margin-bottom: 0.4rem; }
.search input {
  width: 100%; font: 700 clamp(1.3rem, 3.5vw, 1.75rem) var(--display); font-stretch: 80%;
  padding: 0.7rem 0.9rem; color: var(--ink); background: var(--surface);
  border: 2px solid var(--ink); border-radius: 10px; font-variant-numeric: tabular-nums;
}
.search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent); }
.results { list-style: none; margin: 0.5rem 0 0; padding: 0; background: var(--surface); border-radius: 10px; border: 1px solid var(--rule); }
.results:empty { display: none; }
.results li { border-bottom: 1px solid var(--rule); }
.results li:last-child { border-bottom: 0; }
.results a { display: block; padding: 0.6rem 0.9rem; color: var(--ink); text-decoration: none; }
.results a:hover, .results a:focus-visible { background: var(--accent-soft); }
.results .empty { padding: 0.6rem 0.9rem; color: var(--muted); }
.code { font: 700 1em var(--display); font-stretch: 80%; color: var(--stamp); font-variant-numeric: tabular-nums; }

.chapters { margin: 1rem 0 3rem; }
.chapter-list { list-style: none; padding: 0; margin: 0; border-top: 1px solid var(--rule); }
.chapter-list a {
  display: grid; grid-template-columns: 3.5rem 1fr auto; gap: 1rem; align-items: baseline;
  padding: 0.75rem 0; border-bottom: 1px solid var(--rule); color: var(--ink); text-decoration: none;
}
.chapter-list a:hover { background: var(--accent-soft); }
.chapter-list a:hover .ch-name { text-decoration: underline; }
.ch-num { font: 800 1.5rem var(--display); font-stretch: 70%; color: var(--accent-text); }
.ch-count { color: var(--muted); font-size: 0.9rem; }
.prose { max-width: var(--measure); }

/* Tariff page */
.crumbs { font: 500 0.9rem var(--display); color: var(--muted); margin-bottom: 1.5rem; }
.crumbs a { color: var(--muted); }
.sample-banner {
  border: 2px dashed var(--seal); color: var(--seal); padding: 0.75rem 1rem;
  font: 700 0.95rem var(--display); border-radius: var(--r);
}
.tariff { display: grid; gap: 2.5rem; max-width: 52rem; }
.tariff-head h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); font-stretch: 87%; }
.meta { color: var(--muted); font-size: 0.95rem; }
.official { font-size: 0.95rem; border-left: 3px solid var(--rule); padding-left: 0.75rem; }
.official span:first-child { font: 600 0.85rem var(--display); color: var(--muted); display: block; }

.code-plate {
  display: inline-flex; align-items: stretch; margin: 0 0 1rem;
  border: 1px solid var(--rule); background: var(--surface); border-radius: 10px; overflow: hidden;
}
.plate-digits {
  font: 800 clamp(2.6rem, 11vw, 5rem)/1 var(--display); font-stretch: 62%;
  padding: 0.35rem 0.9rem 0.45rem; font-variant-numeric: tabular-nums; letter-spacing: 0.02em;
}
.plate-digits i { font-style: normal; color: var(--accent-text); }
.plate-nico {
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  background: var(--navy); color: var(--accent); padding: 0 0.9rem;
  font: 800 clamp(1.4rem, 5vw, 2.4rem)/1 var(--display); font-stretch: 62%;
}
.plate-nico small { font: 600 0.75rem var(--display); color: #fff; opacity: 0.8; margin-bottom: 0.2rem; }

.rates, .outputs, .mini { margin: 0; display: grid; }
.rates > div, .outputs > div, .mini > div {
  display: grid; grid-template-columns: minmax(10rem, 18rem) 1fr; gap: 1rem;
  padding: 0.6rem 0; border-bottom: 1px solid var(--rule);
}
dt { color: var(--muted); }
dd { margin: 0; }
dd ul { margin: 0; padding-left: 1.1rem; }
.rate { font: 800 1.6rem/1 var(--display); font-stretch: 75%; background: var(--accent-soft); color: var(--ink); border-radius: 8px; padding: 0.2rem 0.65rem; }

.calc { background: var(--surface); border: 1px solid var(--rule); border-top: 5px solid var(--accent); padding: 1.25rem; border-radius: 12px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: 0.9rem 1rem; margin-bottom: 1rem; }
.fields label { display: grid; gap: 0.3rem; font: 600 0.9rem var(--display); }
.fields .wide { grid-column: 1 / -1; }
.fields [hidden] { display: none; }
input, select {
  font: 500 1rem var(--text); padding: 0.5rem 0.6rem; color: var(--ink); background: var(--paper);
  border: 1px solid var(--rule); border-radius: var(--r); min-width: 0;
}
input[type="number"] { font-variant-numeric: tabular-nums; }
.outputs dd { font: 700 1.05rem var(--display); font-variant-numeric: tabular-nums; text-align: right; }
.outputs .out-taxes dd, .outputs .out-landed dd { font-size: 1.35rem; }
.outputs .out-landed { border-bottom: 2px solid var(--accent); }
.outputs .out-landed dd { color: var(--accent-text); }
.outputs [hidden] { display: none; }
.hint { color: var(--accent-text); font-size: 0.95rem; }
.note, .small { color: var(--muted); font-size: 0.85rem; margin-top: 0.8rem; }
.mini dd { text-align: right; font-variant-numeric: tabular-nums; font-family: var(--display); font-weight: 600; }

.quote { border-left: 4px solid var(--accent); padding: 0.25rem 0 0.25rem 1.25rem; }
.button {
  display: inline-block; font: 700 1rem var(--display); padding: 0.7rem 1.1rem;
  background: var(--accent); color: var(--on-accent); border-radius: 10px; text-decoration: none;
}
.button:hover { background: var(--accent-hover); }
.partners ul, .related ul { list-style: none; padding: 0; margin: 0; }
.partners li, .related li { padding: 0.5rem 0; border-bottom: 1px solid var(--rule); }
.partners li span { display: block; color: var(--muted); font-size: 0.9rem; }
.faq details { border-bottom: 1px solid var(--rule); padding: 0.75rem 0; }
.faq summary { cursor: pointer; font: 600 1.05rem var(--display); }
.faq details p { margin: 0.6rem 0 0; max-width: var(--measure); }
.ad { min-height: 100px; }

/* Chapter table */
.page-title { font-size: clamp(1.6rem, 4vw, 2.4rem); font-stretch: 80%; }
.table-wrap { overflow-x: auto; }
.codes { width: 100%; border-collapse: collapse; }
.codes th { text-align: left; font: 600 0.9rem var(--display); color: var(--muted); border-bottom: 2px solid var(--accent); padding: 0.5rem 0.75rem 0.5rem 0; }
.codes td { border-bottom: 1px solid var(--rule); padding: 0.6rem 0.75rem 0.6rem 0; vertical-align: top; }
.codes .code { white-space: nowrap; }
.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }

@media (max-width: 34rem) {
  .rates > div, .outputs > div, .mini > div { grid-template-columns: 1fr auto; gap: 0.5rem; }
  .rates > div { grid-template-columns: 1fr; gap: 0.15rem; }
  .chapter-list a { grid-template-columns: 2.75rem 1fr; }
  .ch-count { grid-column: 2; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
@media print { .search, .ad, .partners, .quote, .site-head .lang { display: none; } }

/* Permits and regulations */
.regs .legal { background: var(--surface); border: 1px solid var(--rule); border-left: 4px solid var(--seal); padding: 0.75rem 1rem; font-size: 0.92rem; border-radius: var(--r); }
.regs .legal strong { font-family: var(--display); }
.regs .warn { border-left: 4px solid var(--accent); background: var(--accent-soft); padding: 0.55rem 0.9rem; font-size: 0.95rem; }
.reg-list { list-style: none; padding: 0; margin: 0 0 1rem; }
.reg-list li { padding: 0.7rem 0; border-bottom: 1px solid var(--rule); }
.reg-list strong { display: block; font: 700 1.02rem var(--display); }
.reg-list span { color: var(--muted); font-size: 0.95rem; }
.programs span { font: 600 0.9rem var(--display); color: var(--muted); }

/* Interactive extras */
.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 0.9rem 0 0.4rem; }
.chips > span, .share > span { font: 600 0.9rem var(--display); color: var(--muted); margin-right: 0.15rem; }
.chip {
  font: 600 0.9rem var(--display); color: var(--ink); background: var(--surface); text-decoration: none; cursor: pointer;
  border: 1px solid var(--rule); border-radius: 999px; padding: 0.3rem 0.9rem;
}
.chip:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.trust { color: var(--muted); font-size: 0.88rem; margin: 0.6rem 0 0; }
.trust::before { content: ""; display: inline-block; width: 0.55rem; height: 0.55rem; border-radius: 50%; background: var(--ok); margin-right: 0.45rem; }
.share { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; margin: 1rem 0 0; }
.bar { display: flex; height: 0.9rem; border-radius: 999px; overflow: hidden; background: var(--rule); margin: 1rem 0 0.4rem; }
.bar-goods { flex: 1; background: var(--stamp); }
.bar-tax { flex: none; width: var(--tax-share, 0%); background: var(--accent); transition: width 0.35s ease; }
.bar-legend { display: flex; gap: 1.2rem; font-size: 0.85rem; color: var(--muted); margin: 0; }
.dot { display: inline-block; width: 0.7rem; height: 0.7rem; border-radius: 50%; margin-right: 0.35rem; }
.dot.goods { background: var(--stamp); }
.dot.tax { background: var(--accent); }
@media (prefers-reduced-motion: reduce) { .bar-tax { transition: none; } }
@media print { .chips, .share { display: none; } }

/* Guides */
.guides { margin: 0 0 3rem; }
.guide-list { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: 0.9rem; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); }
.guide-list a {
  display: grid; gap: 0.35rem; height: 100%; padding: 1rem 1.1rem; text-decoration: none; color: var(--ink);
  background: var(--surface); border: 1px solid var(--rule); border-top: 4px solid var(--accent); border-radius: 12px;
}
.guide-list a:hover { background: var(--accent-soft); }
.guide-list strong { font: 700 1.05rem/1.25 var(--display); }
.guide-list span { color: var(--muted); font-size: 0.92rem; line-height: 1.45; }
.guide { max-width: 44rem; }
.guide h2 { margin-top: 2rem; }
.guide li { margin-bottom: 0.45rem; }
.guide .related, .guide .faq { margin-top: 2.5rem; }
