/* ==========================================================================
   HSCODE.UK — Global stylesheet
   British, restrained, professional. System fonts for speed and reliability.
   ========================================================================== */

:root {
  --navy: #0b1f33;
  --navy-2: #12304d;
  --navy-3: #1a4066;
  --ink: #1c2b3a;
  --muted: #5a6b7b;
  --faint: #8b9aa9;
  --line: #e2e8ee;
  --line-soft: #eef2f6;
  --bg: #ffffff;
  --bg-soft: #f5f7fa;
  --red: #c8102e;
  --red-dark: #a30e27;
  --green: #00703c;
  --green-soft: #eaf5f0;
  --amber: #8a5a00;
  --amber-soft: #fbf3e2;
  --blue-soft: #e9f2fb;
  --serif: Georgia, "Times New Roman", "Times", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgba(11, 31, 51, 0.06), 0 10px 28px rgba(11, 31, 51, 0.08);
  --shadow-sm: 0 1px 2px rgba(11, 31, 51, 0.07);
  --maxw: 1180px;
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
}

img, svg { max-width: 100%; height: auto; vertical-align: middle; }
a { color: var(--navy-3); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--red); }

h1, h2, h3, h4 {
  font-family: var(--serif);
  color: var(--navy);
  line-height: 1.22;
  margin: 0 0 0.55em;
  font-weight: 700;
  letter-spacing: -0.01em;
}
h1 { font-size: clamp(1.9rem, 4vw, 2.7rem); }
h2 { font-size: clamp(1.35rem, 2.6vw, 1.75rem); }
h3 { font-size: 1.18rem; }
h4 { font-size: 1.02rem; }
p { margin: 0 0 1em; }
ul, ol { margin: 0 0 1em; padding-left: 1.35em; }
li { margin-bottom: 0.3em; }
small { font-size: 0.86em; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ==========================================================================
   Header / navigation
   ========================================================================== */

.site-header {
  background: var(--navy);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 60;
  box-shadow: 0 1px 0 rgba(255,255,255,.06), 0 4px 18px rgba(6,20,35,.25);
}
.header-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 62px;
}
.brand {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 1.35rem;
  color: #fff;
  text-decoration: none;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  white-space: nowrap;
}
.brand .dot { color: var(--red); }
.brand .uk { color: #9db4cc; font-size: 0.72em; letter-spacing: 0.08em; }
.brand:hover { color: #fff; }

.main-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 4px;
}
.main-nav a {
  color: #c9d6e3;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  display: inline-block;
}
.main-nav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.main-nav a[aria-current="page"] { color: #fff; background: rgba(255,255,255,.12); }

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid rgba(255,255,255,.25);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  font-size: 0.95rem;
  cursor: pointer;
}
.nav-toggle:hover { background: rgba(255,255,255,.08); }

/* ==========================================================================
   Footer
   ========================================================================== */

.site-footer { background: var(--navy); color: #b9c8d8; margin-top: 60px; }
.footer-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 44px 20px 20px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1.2fr;
  gap: 32px;
}
.footer-inner h4 { color: #fff; font-size: 0.95rem; margin-bottom: 0.8em; }
.footer-inner a { color: #b9c8d8; text-decoration: none; display: block; padding: 5px 0; font-size: 0.9rem; }
.footer-inner a:hover { color: #fff; }
.footer-brand { font-family: var(--serif); font-size: 1.25rem; color: #fff; }
.footer-tag { font-size: 0.88rem; line-height: 1.6; margin-top: 8px; max-width: 300px; }
.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.12);
  padding: 16px 20px;
  font-size: 0.85rem;
  color: #8498ad;
}
.footer-bottom .container { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* ==========================================================================
   Hero & page intro
   ========================================================================== */

.hero {
  background: linear-gradient(180deg, #0e2439 0%, var(--navy) 100%);
  color: #fff;
  padding: 64px 0 72px;
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 26px 26px;
  opacity: .5;
  pointer-events: none;
}
.hero .container { position: relative; z-index: 1; }
.hero h1 { color: #fff; margin-bottom: 0.3em; }
.hero .lead { color: #c3d2e1; font-size: 1.08rem; max-width: 720px; margin-bottom: 1.6em; }
.hero .lead a { color: #fff; }

.page-intro { background: var(--bg-soft); border-bottom: 1px solid var(--line-soft); padding: 34px 0; }
.page-intro h1 { margin-bottom: 0.25em; }
.page-intro .lead { color: var(--muted); max-width: 820px; margin: 0; }

.breadcrumbs { font-size: 0.82rem; color: var(--faint); margin: 0 0 10px; }
.breadcrumbs a { color: var(--faint); text-decoration: none; }
.breadcrumbs a:hover { color: var(--navy-3); }

/* ==========================================================================
   Search box
   ========================================================================== */

.search-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px 26px 22px;
}
.search-row { display: flex; gap: 10px; flex-wrap: wrap; }
.search-input {
  flex: 1 1 260px;
  min-width: 0;
  max-width: 100%;
  font-size: 1.06rem;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--sans);
  color: var(--ink);
  background: #fff;
}
.search-row select { max-width: 100%; }
.search-input:focus { outline: 3px solid rgba(200,16,46,.18); border-color: var(--red); }
.btn {
  font-family: var(--sans);
  font-size: 1rem;
  font-weight: 600;
  padding: 13px 22px;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--red);
  color: #fff;
  transition: background .15s ease;
  text-decoration: none;
  display: inline-block;
}
.btn:hover { background: var(--red-dark); color: #fff; }
.btn-ghost { background: var(--bg-soft); color: var(--navy); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--line-soft); color: var(--navy); border-color: #cfd8e0; }
.btn-sm { padding: 9px 15px; font-size: 0.9rem; }
.search-hint { font-size: 0.88rem; color: var(--faint); margin-top: 10px; }
.search-hint kbd {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 6px;
  font-size: 0.8em;
}

/* ==========================================================================
   Cards & grids
   ========================================================================== */

.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 26px;
  transition: box-shadow .15s ease, transform .15s ease;
  display: flex;
  flex-direction: column;
}
.card a.card-link { text-decoration: none; color: inherit; }
.card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.card h3 { margin-bottom: 0.4em; }
.card h3 a { color: var(--navy); text-decoration: none; }
.card h3 a:hover { color: var(--red); }
.card p { color: var(--muted); font-size: 0.95rem; margin-bottom: 0.8em; flex: 1; }
.card .card-foot { font-size: 0.86rem; color: var(--navy-3); font-weight: 600; }
.card .icon {
  width: 46px; height: 46px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
  background: var(--blue-soft);
  color: var(--navy-3);
}
.card .icon svg { width: 24px; height: 24px; }

/* ==========================================================================
   Sections
   ========================================================================== */

.section { padding: 48px 0 8px; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.section-title h2 { margin: 0; }
.section-title .more { font-size: 0.9rem; font-weight: 600; }
.band { background: var(--bg-soft); border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); }

/* ==========================================================================
   Tables
   ========================================================================== */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
table.data-table { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 0.92rem; }
table.data-table th, table.data-table td { padding: 11px 14px; text-align: left; vertical-align: top; }
table.data-table thead th {
  background: var(--navy);
  color: #fff;
  font-weight: 600;
  font-size: 0.84rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
table.data-table tbody tr { border-top: 1px solid var(--line-soft); }
table.data-table tbody tr:nth-child(even) { background: #fbfcfd; }
table.data-table tbody tr:hover { background: var(--blue-soft); }
table.data-table td.mono, .mono { font-family: "SF Mono", "Cascadia Mono", Consolas, Menlo, monospace; font-size: 0.92em; }

/* ==========================================================================
   Results & detail
   ========================================================================== */

.result-list { list-style: none; margin: 0; padding: 0; }
.result-item {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 14px;
  background: #fff;
  cursor: pointer;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.result-item:hover { border-color: var(--navy-3); box-shadow: var(--shadow-sm); }
.result-item .ri-code { font-family: "SF Mono", "Cascadia Mono", Consolas, Menlo, monospace; font-weight: 700; color: var(--navy); min-width: 118px; }
.result-item .ri-title { color: var(--ink); font-size: 0.95rem; flex: 1; }
.result-item .ri-title small { display: block; color: var(--faint); font-size: 0.8rem; }

.badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge.heading { background: var(--blue-soft); color: var(--navy-3); }
.badge.subheading { background: #eaeef4; color: #41546a; }
.badge.commodity { background: var(--green-soft); color: var(--green); }
.badge.duty { background: var(--amber-soft); color: var(--amber); }
.badge.free { background: var(--green-soft); color: var(--green); }
.badge.limit { background: #fdecee; color: var(--red); }
.badge.info { background: var(--blue-soft); color: var(--navy-3); }

/* Detail panel */
.detail-panel { border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow); margin-top: 22px; overflow: hidden; }
.detail-head { background: var(--bg-soft); border-bottom: 1px solid var(--line-soft); padding: 20px 24px; }
.detail-head h3 { margin: 0 0 4px; }
.detail-head .dh-code { font-family: "SF Mono", "Cascadia Mono", Consolas, Menlo, monospace; color: var(--faint); font-size: 0.86rem; }
.detail-body { padding: 20px 24px 24px; }

.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.metric { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; background: #fff; }
.metric .m-label { font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--faint); font-weight: 700; margin-bottom: 6px; }
.metric .m-value { font-size: 1.3rem; font-weight: 700; color: var(--navy); font-family: var(--serif); }
.metric .m-value.green { color: var(--green); }
.metric .m-value.amber { color: var(--amber); }
.metric .m-sub { font-size: 0.8rem; color: var(--muted); }

.measures-group { margin-bottom: 18px; }
.measures-group h4 { margin-bottom: 6px; font-size: 1rem; }
.measures-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.measures-list li { padding: 11px 16px; border-bottom: 1px solid var(--line-soft); font-size: 0.92rem; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.measures-list li:last-child { border-bottom: none; }
.measures-list li .ml-type { font-weight: 600; color: var(--ink); }
.measures-list li .ml-val { color: var(--navy); font-weight: 700; white-space: nowrap; }
.measures-list li .ml-note { color: var(--muted); font-size: 0.84rem; width: 100%; }

/* ==========================================================================
   Alerts & info boxes
   ========================================================================== */

.alert { border-radius: var(--radius-sm); padding: 14px 18px; font-size: 0.92rem; margin: 16px 0; border: 1px solid; }
.alert.info { background: var(--blue-soft); border-color: #cfe1f2; color: #24415f; }
.alert.warn { background: var(--amber-soft); border-color: #eeddb4; color: #6b4a06; }
.alert.ok { background: var(--green-soft); border-color: #bfe3d2; color: #04562c; }
.alert.err { background: #fdecee; border-color: #f3c0c7; color: #8f0f26; }
.alert strong { font-weight: 700; }

/* ==========================================================================
   Ad slots
   ========================================================================== */

.ad-slot {
  max-width: var(--maxw);
  margin: 26px auto;
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  background: var(--bg-soft);
  color: var(--faint);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  overflow: hidden;
}
.ad-slot .adsbygoogle { min-height: inherit; }
.ad-slot.ad-label::before { content: attr(data-label); }

/* ==========================================================================
   Forms
   ========================================================================== */

.form-field { margin-bottom: 16px; }
.form-field label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 6px; color: var(--navy); }
.form-field input, .form-field textarea, .form-field select {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-family: var(--sans);
  font-size: 0.95rem;
  color: var(--ink);
}
.form-field input:focus, .form-field textarea:focus { outline: 3px solid rgba(200,16,46,.15); border-color: var(--red); }

/* ==========================================================================
   FAQ & misc
   ========================================================================== */

.faq-item { border-bottom: 1px solid var(--line-soft); padding: 4px 0 14px; margin-bottom: 4px; }
.faq-item h3 { font-size: 1.05rem; }
.faq-item p { color: var(--muted); }

.chip { display: inline-block; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 999px; padding: 6px 14px; font-size: 0.86rem; margin: 4px 4px 0 0; cursor: pointer; transition: all .12s ease; }
.chip:hover { border-color: var(--navy-3); color: var(--navy-3); }
.chip.active { background: var(--navy); color: #fff; border-color: var(--navy); }

.two-col { display: grid; grid-template-columns: 1.05fr 1fr; gap: 28px; align-items: start; }
.sticky { position: sticky; top: 84px; }

.prose { max-width: 860px; }
.prose h2 { margin-top: 1.6em; }
.prose li { margin-bottom: 0.5em; }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li { counter-increment: step; position: relative; padding: 0 0 22px 46px; }
.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 2px;
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--navy); color: #fff;
  font-weight: 700; font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
}
.steps li:not(:last-child)::after {
  content: ""; position: absolute; left: 15px; top: 34px; bottom: 4px;
  width: 1px; background: var(--line);
}

.status-line { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--muted); margin: 8px 0 0; }
.dot-live { width: 8px; height: 8px; border-radius: 50%; background: var(--green); display: inline-block; }
.dot-soft { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; }

/* Recent searches block (bottom of every page) */
.recent-searches {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 8px 20px 4px;
}
.recent-searches:not([data-has]) { display: none; }
.recent-searches .section-title { margin-bottom: 6px; }
.rc-note { color: var(--muted); font-size: 0.88rem; margin: 0 0 10px; }
.rc-list { padding-bottom: 8px; }
.rc-site { color: var(--faint); font-size: 0.78em; font-weight: 600; }
.chip.rc-clear { border-style: dashed; color: var(--muted); }

.loader { display: none; align-items: center; gap: 10px; color: var(--muted); font-size: 0.9rem; padding: 14px 0; }
.loader.show { display: flex; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line); border-top-color: var(--navy-3); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

#toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(20px);
  background: var(--navy); color: #fff; padding: 12px 20px; border-radius: 8px;
  font-size: 0.9rem; box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  transition: all .25s ease; z-index: 90; max-width: 90vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute; left: -999px; top: 0; background: var(--red); color: #fff;
  padding: 10px 16px; z-index: 100; border-radius: 0 0 6px 0; text-decoration: none;
}
.skip-link:focus { left: 0; color: #fff; }

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .footer-inner { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 820px) {
  .nav-toggle { display: block; }
  .main-nav {
    position: absolute; top: 62px; left: 0; right: 0;
    background: var(--navy-2);
    display: none;
    border-top: 1px solid rgba(255,255,255,.1);
    box-shadow: 0 18px 28px rgba(6,20,35,.3);
  }
  .main-nav.open { display: block; }
  .main-nav ul { flex-direction: column; align-items: stretch; padding: 8px 20px 16px; }
  .main-nav a { display: block; padding: 12px 8px; border-bottom: 1px solid rgba(255,255,255,.08); border-radius: 0; }
  .two-col { grid-template-columns: 1fr; }
  .sticky { position: static; }
  .hero { padding: 46px 0 54px; }
}

@media (max-width: 600px) {
  .grid-3, .grid-2, .grid-4 { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: 1fr; }
  .footer-inner { grid-template-columns: 1fr; gap: 24px; }
  .footer-inner a { padding: 7px 0; }
  .search-row { flex-direction: column; }
  .search-row select, .search-row input { width: 100%; }
  .search-row .btn { width: 100%; }
  .result-item { flex-wrap: wrap; }
  .result-item .ri-code { min-width: 0; }
  table.data-table th, table.data-table td { padding: 9px 10px; }
  .detail-body { padding: 16px; }
  .detail-head { padding: 16px; }
}

@media (max-width: 480px) {
  .brand { font-size: 1.12rem; }
  .brand .uk { display: none; }
  .hero { padding: 38px 0 46px; }
  h1 { font-size: 1.6rem; }
}
