/* =============================================================
   World License Plates — redesign design system
   Dark premium gallery. References: elxit.com (blue, dark) +
   barbershop (near-black, bright accent). Content-first: the
   colourful plate images are the heroes; the shell stays calm.
   ============================================================= */

:root {
  /* Surfaces */
  --bg:        #0b0b0c;   /* page background (near-black) */
  --surface:   #141416;   /* raised surfaces / cards */
  --elevated:  #1c1c1f;   /* tiles / higher surfaces */
  --line:      #2a2a2e;   /* hairline borders */
  --line-soft: #1f1f23;

  /* Text */
  --text:      #f5f5f5;
  --muted:     #a2a2ab;
  --faint:     #6f6f78;

  /* Brand accent — azure (nod to elxit "STUDIO" blue) */
  --accent:      #2e9bff;
  --accent-2:    #4ca0ee;
  --accent-deep: #0a63c9;
  --accent-ink:  #05213f;

  /* Warm secondary (nod to the barbershop) for subtle highlights */
  --warm: #ff9d3d;

  /* Radii & shadow */
  --r-sm: 8px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --shadow:   0 10px 30px rgba(0,0,0,.45);
  --shadow-lg:0 24px 60px rgba(0,0,0,.55);

  --header-h: 68px;
  --maxw: 1240px;

  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --font-head: 'Sora', 'Inter', system-ui, sans-serif;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 16px); -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
  overflow-x: hidden;
}
img { max-width: 100%; display: block; }
a { color: var(--accent-2); text-decoration: none; transition: color .18s ease; }
a:hover { color: var(--accent); }
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 700; line-height: 1.15; letter-spacing: -.01em; }
::selection { background: var(--accent); color: #051225; }

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

/* subtle atmospheric glow behind hero/content */
body::before {
  content: "";
  position: fixed; inset: 0;
  background:
    radial-gradient(60% 45% at 15% 0%, rgba(46,155,255,.10), transparent 60%),
    radial-gradient(50% 40% at 100% 0%, rgba(255,157,61,.06), transparent 55%);
  pointer-events: none; z-index: 0;
}
main, .site-header, .site-footer { position: relative; z-index: 1; }

/* =============================================================
   Header
   ============================================================= */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  display: flex; align-items: center;
  background: rgba(11,11,12,.72);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--line-soft);
}
.site-header .container { display: flex; align-items: center; gap: 18px; }
.brand { display: flex; align-items: center; gap: 11px; font-family: var(--font-head); font-weight: 800; font-size: 1.02rem; color: var(--text); letter-spacing: -.02em; white-space: nowrap; }
.brand:hover { color: var(--text); }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px; flex: none;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: #fff; font-size: 1rem; box-shadow: 0 4px 14px rgba(46,155,255,.4);
}
.brand-mark svg { width: 20px; height: 20px; }
.brand small { display: block; font-size: .62rem; font-weight: 600; letter-spacing: .16em; color: var(--faint); text-transform: uppercase; }

.header-nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.header-nav a {
  color: var(--muted); font-weight: 600; font-size: .9rem;
  padding: 8px 12px; border-radius: 9px; transition: color .18s, background .18s;
}
.header-nav a:hover, .header-nav a.active { color: var(--text); background: var(--elevated); }

/* header search */
.search-wrap { position: relative; margin-left: auto; }
.header-nav + .search-wrap { margin-left: 6px; }
.search-input {
  width: 210px; height: 40px;
  background: var(--elevated);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--text);
  padding: 0 16px 0 40px;
  font: inherit; font-size: .9rem;
  transition: width .25s ease, border-color .18s, box-shadow .18s;
}
.search-input::placeholder { color: var(--faint); }
.search-input:focus { outline: none; width: 260px; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(46,155,255,.18); }
.search-wrap svg.search-icn { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--faint); pointer-events: none; }

/* live search dropdown */
.search-results {
  position: absolute; top: calc(100% + 8px); right: 0;
  width: min(420px, 86vw); max-height: 60vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  padding: 6px; display: none; z-index: 60;
}
.search-results.open { display: block; }
.search-results a {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px; border-radius: 9px; color: var(--text); font-size: .92rem;
}
.search-results a:hover, .search-results a.hl { background: var(--elevated); }
.search-results img { width: 30px; height: 20px; object-fit: cover; border-radius: 3px; flex: none; background: var(--elevated); }
.search-results .sr-region { margin-left: auto; font-size: .72rem; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; }
.search-results .sr-empty { padding: 16px; color: var(--faint); text-align: center; font-size: .9rem; }
.search-results i { color: var(--muted); font-style: italic; }

/* burger (mobile) */
.burger { display: none; margin-left: 8px; width: 42px; height: 42px; border: 1px solid var(--line); background: var(--elevated); border-radius: 10px; color: var(--text); align-items: center; justify-content: center; cursor: pointer; }
.burger svg { width: 20px; height: 20px; }

/* =============================================================
   Hero (home)
   ============================================================= */
.hero { padding: 68px 0 40px; text-align: center; }
.hero .eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: .74rem; font-weight: 700; letter-spacing: .18em; text-transform: uppercase;
  color: var(--accent-2); background: rgba(46,155,255,.09);
  border: 1px solid rgba(46,155,255,.22); padding: 6px 14px; border-radius: 999px; margin-bottom: 22px;
}
.hero h1 { font-size: clamp(2.1rem, 6vw, 4rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.04; }
.hero h1 .grad { background: linear-gradient(120deg, var(--accent-2), var(--accent)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero p.lead { max-width: 640px; margin: 20px auto 0; color: var(--muted); font-size: clamp(1rem, 2.4vw, 1.18rem); }
.hero-search { max-width: 560px; margin: 30px auto 0; position: relative; }
.hero-search .search-input { width: 100%; height: 56px; font-size: 1.02rem; border-radius: 16px; padding-left: 50px; }
.hero-search .search-input:focus { width: 100%; }
.hero-search svg.search-icn { left: 18px; width: 20px; height: 20px; }
.hero-search .search-results { left: 0; right: 0; width: 100%; }
.hero-stats { display: flex; gap: 34px; justify-content: center; flex-wrap: wrap; margin-top: 40px; }
.hero-stats .stat b { font-family: var(--font-head); font-size: 1.7rem; display: block; color: var(--text); }
.hero-stats .stat span { font-size: .82rem; color: var(--faint); text-transform: uppercase; letter-spacing: .08em; }

/* marquee strip of plate thumbnails under hero */
.plate-strip { margin-top: 46px; -webkit-mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); overflow: hidden; }
.plate-strip__track { display: flex; gap: 16px; width: max-content; animation: strip 80s linear infinite; }
.plate-strip:hover .plate-strip__track { animation-play-state: paused; }
.plate-strip img { height: 46px; width: auto; border-radius: 5px; opacity: .85; }
@keyframes strip { to { transform: translateX(calc(-50% - 8px)); } }

/* =============================================================
   Section headings (generic)
   ============================================================= */
.section { padding: 46px 0; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.section-head h2 { font-size: clamp(1.5rem, 3.5vw, 2.1rem); }
.section-head p { color: var(--muted); margin-top: 6px; }
.section-head .kicker { color: var(--accent-2); font-weight: 700; font-size: .78rem; letter-spacing: .16em; text-transform: uppercase; }

/* =============================================================
   Region / territory card grids
   ============================================================= */
.region-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.region-card {
  position: relative; display: flex; flex-direction: column; gap: 12px;
  padding: 22px; border-radius: var(--r-lg);
  background: linear-gradient(160deg, var(--surface), var(--elevated));
  border: 1px solid var(--line); color: var(--text);
  overflow: hidden; transition: transform .22s ease, border-color .22s, box-shadow .22s;
}
.region-card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: var(--shadow); color: var(--text); }
.region-card .rc-icn { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: rgba(46,155,255,.12); color: var(--accent-2); font-size: 1.5rem; }
.region-card h3 { font-size: 1.15rem; }
.region-card p { color: var(--muted); font-size: .88rem; }
.region-card .rc-count { margin-top: auto; font-size: .8rem; color: var(--faint); font-weight: 600; }
.region-card::after { content: "→"; position: absolute; top: 20px; right: 20px; color: var(--faint); transition: transform .22s, color .22s; }
.region-card:hover::after { transform: translate(3px,-3px); color: var(--accent); }

/* territory card grid (flag + name) */
.terr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.terr-card {
  display: flex; align-items: center; gap: 13px;
  padding: 12px 14px; border-radius: var(--r-md);
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
  transition: transform .16s ease, border-color .16s, background .16s;
}
.terr-card:hover { transform: translateY(-2px); border-color: var(--accent); background: var(--elevated); color: var(--text); }
.terr-card img { width: 42px; height: 28px; object-fit: cover; border-radius: 4px; flex: none; background: var(--elevated); box-shadow: 0 1px 4px rgba(0,0,0,.4); }
.terr-card .tc-name { font-weight: 600; font-size: .94rem; line-height: 1.25; }
.terr-card .tc-name i { color: var(--muted); font-weight: 500; }
.terr-card.hist { opacity: .82; }

/* letter buckets on browse page */
.az-nav { position: sticky; top: var(--header-h); z-index: 30; display: flex; flex-wrap: wrap; gap: 4px; padding: 12px 0; background: rgba(11,11,12,.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line-soft); }
.az-nav a { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; font-weight: 700; font-size: .82rem; color: var(--muted); background: var(--elevated); }
.az-nav a:hover { background: var(--accent); color: #05213f; }
.az-bucket { padding-top: 30px; }
.az-bucket h2 { font-size: 1.6rem; color: var(--accent-2); margin-bottom: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }

/* =============================================================
   Detail page
   ============================================================= */
.detail-hero {
  padding: 30px 0 26px; margin-bottom: 8px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(70% 120% at 0% 0%, rgba(46,155,255,.08), transparent 60%);
}
.breadcrumb { font-size: .84rem; color: var(--faint); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 18px; }
.breadcrumb a { color: var(--muted); font-weight: 600; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: var(--faint); }
.detail-title { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.detail-flags { display: flex; align-items: center; gap: 10px; }
.detail-flags img { height: 46px; width: auto; border-radius: 6px; box-shadow: 0 3px 12px rgba(0,0,0,.5); border: 1px solid var(--line); }
.detail-flags img.pport { height: 60px; }
.detail-title h1 { font-size: clamp(1.9rem, 5vw, 3rem); font-weight: 800; letter-spacing: -.02em; }

/* section pills nav (from TOC) */
.toc-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.toc-pills a {
  font-size: .84rem; font-weight: 600; color: var(--muted);
  padding: 7px 14px; border-radius: 999px; background: var(--elevated); border: 1px solid var(--line);
  transition: all .16s ease;
}
.toc-pills a:hover { color: #05213f; background: var(--accent); border-color: var(--accent); }

/* content sections */
.detail-body { padding: 20px 0 60px; display: grid; gap: 26px; }
.plate-section { scroll-margin-top: calc(var(--header-h) + 20px); }
.plate-section > h2, .plate-section > h3 {
  font-size: 1.5rem; margin-bottom: 4px;
  display: inline-flex; align-items: center; gap: 12px;
}
.plate-section > h2::before {
  content: ""; width: 6px; height: 22px; border-radius: 3px;
  background: linear-gradient(var(--accent-2), var(--accent-deep)); display: inline-block;
}
.plate-card {
  margin-top: 16px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 18px; box-shadow: var(--shadow);
}
.plate-card + .plate-card { margin-top: 16px; }
.plate-card .plate-img { cursor: zoom-in; border-radius: var(--r-sm); overflow: hidden; background: #fff0; }
.plate-card .plate-img img { width: 100%; height: auto; border-radius: var(--r-sm); transition: transform .3s ease; }
.plate-card .plate-img:hover img { transform: scale(1.012); }
.plate-notes { margin-top: 14px; color: var(--muted); font-size: .95rem; }
.plate-notes b { color: var(--text); }
.plate-notes a { color: var(--accent-2); }

/* country/state information panel */
.info-panel { display: grid; grid-template-columns: 300px 1fr; gap: 24px; align-items: start; }
.info-panel .info-map { border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); background: var(--elevated); padding: 14px; }
.info-panel .info-map img { width: 100%; border-radius: 6px; }
.info-table { width: 100%; border-collapse: collapse; }
.info-table td { padding: 11px 4px; vertical-align: top; border-bottom: 1px solid var(--line-soft); }
.info-table tr:last-child td { border-bottom: none; }
.info-table td:first-child { width: 34%; color: var(--faint); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; padding-right: 16px; }
.info-table td:last-child { color: var(--text); }

/* credits */
.credits-block { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 18px 22px; }
.credits-block .col-head { color: var(--faint); font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 8px; }
.credits-list { columns: 2; column-gap: 34px; font-size: .9rem; color: var(--muted); }
.credits-list span { display: block; break-inside: avoid; padding: 2px 0; }
@media (max-width: 560px) { .credits-list { columns: 1; } }

/* =============================================================
   Lightbox
   ============================================================= */
.lightbox { position: fixed; inset: 0; z-index: 200; background: rgba(4,4,6,.94); display: none; align-items: center; justify-content: center; padding: 30px; cursor: zoom-out; }
.lightbox.open { display: flex; }
.lightbox img { max-width: 96vw; max-height: 92vh; width: auto; border-radius: 8px; box-shadow: var(--shadow-lg); background: #fff; }
.lightbox .lb-close { position: fixed; top: 18px; right: 22px; width: 44px; height: 44px; border-radius: 50%; background: var(--elevated); border: 1px solid var(--line); color: var(--text); font-size: 1.4rem; cursor: pointer; display: grid; place-items: center; }

/* back to top */
.to-top { position: fixed; bottom: 24px; right: 24px; z-index: 40; width: 48px; height: 48px; border-radius: 50%; background: var(--accent); color: #05213f; border: none; cursor: pointer; display: grid; place-items: center; box-shadow: 0 8px 24px rgba(46,155,255,.4); opacity: 0; transform: translateY(14px); transition: opacity .25s, transform .25s; }
.to-top.show { opacity: 1; transform: translateY(0); }
.to-top svg { width: 22px; height: 22px; }

/* =============================================================
   Footer
   ============================================================= */
.site-footer { border-top: 1px solid var(--line); margin-top: 40px; padding: 44px 0 34px; background: #0a0a0b; }
.footer-grid { display: flex; justify-content: space-between; gap: 30px; flex-wrap: wrap; }
.site-footer .brand { margin-bottom: 12px; }
.site-footer p { color: var(--muted); font-size: .9rem; max-width: 380px; }
.footer-links { display: flex; gap: 40px; flex-wrap: wrap; }
.footer-links h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); margin-bottom: 12px; }
.footer-links a { display: block; color: var(--muted); font-size: .92rem; padding: 3px 0; }
.footer-links a:hover { color: var(--accent); }
.footer-bottom { margin-top: 34px; padding-top: 20px; border-top: 1px solid var(--line-soft); color: var(--faint); font-size: .82rem; display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* =============================================================
   Mobile nav drawer + responsive
   ============================================================= */
.mobile-drawer { position: fixed; inset: 0; z-index: 100; display: none; }
.mobile-drawer.open { display: block; }
.mobile-drawer .backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.6); backdrop-filter: blur(2px); }
.mobile-drawer .panel { position: absolute; top: 0; right: 0; height: 100%; width: min(320px, 84vw); background: var(--surface); border-left: 1px solid var(--line); padding: 20px; overflow-y: auto; }
.mobile-drawer .panel a { display: block; color: var(--text); font-weight: 600; padding: 13px 10px; border-radius: 10px; }
.mobile-drawer .panel a:hover { background: var(--elevated); }
.mobile-drawer .panel .md-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.mobile-drawer .panel .md-close { background: var(--elevated); border: 1px solid var(--line); color: var(--text); width: 40px; height: 40px; border-radius: 10px; font-size: 1.3rem; cursor: pointer; }

@media (max-width: 860px) {
  .header-nav { display: none; }
  .burger { display: inline-flex; }
  .search-wrap.header-search-desktop { display: none; }
  .info-panel { grid-template-columns: 1fr; }
  .info-panel .info-map { max-width: 340px; }
}
@media (min-width: 861px) { .burger { display: none; } }

@media (max-width: 640px) {
  .hero { padding: 44px 0 26px; }
  .section { padding: 34px 0; }
  .detail-flags img { height: 38px; }
  .region-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .region-card { padding: 16px; }
  .terr-grid { grid-template-columns: 1fr; }
}
@media (max-width: 420px) { .region-grid { grid-template-columns: 1fr; } }
