/* Shared modern design system: header/nav, dark-light theme, search bar,
   cards grid, hero banner. Used by index.html (Home) and the
   indexmaker-mod generated pages (kisp/kop/kcsp/kexc.html) so the whole
   site shares one consistent look. */
* { box-sizing: border-box; }

:root {
  --bg: #f2f4f8;
  --fg: #1c2430;
  --muted: #6b7684;
  --card-bg: #ffffff;
  --border: #e2e6ec;
  --accent: #2563eb;
  --accent-fg: #ffffff;
  --header-bg: #ffffff;
  --header-border: #e5e9f0;
  --input-bg: #ffffff;
  --shadow: 0 1px 3px rgba(20,25,35,.08);
  --shadow-hover: 0 8px 20px rgba(20,25,35,.14);
}
:root[data-theme="dark"] {
  --bg: #0e141d;
  --fg: #e7ecf3;
  --muted: #93a0b2;
  --card-bg: #161e2a;
  --border: #29323f;
  --accent: #5b8def;
  --accent-fg: #0e141d;
  --header-bg: #121927;
  --header-border: #232d3d;
  --input-bg: #1b2431;
  --shadow: 0 1px 3px rgba(0,0,0,.4);
  --shadow-hover: 0 8px 24px rgba(0,0,0,.5);
}

html, body { background: var(--bg); color: var(--fg); }
body { margin: 0; transition: background .2s ease, color .2s ease; font-family: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
a { color: var(--accent); }
img { max-width: 100%; }

.iix-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--header-bg);
  border-bottom: 1px solid var(--header-border);
  box-shadow: var(--shadow);
}
.iix-header-top {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 20px;
  min-height: 50px;
}
.iix-brand { display: flex; align-items: center; gap: 8px; text-decoration: none; flex: 0 0 auto; }
.iix-brand img { height: 30px; width: auto; }
:root[data-theme="dark"] .iix-brand img { filter: brightness(0) invert(1); }
.iix-brand-title { font-size: .95rem; font-weight: 700; color: var(--fg); letter-spacing: .02em; white-space: nowrap; }
.iix-ip { margin-left: auto; font-size: .76rem; color: var(--muted); white-space: nowrap; }
.iix-ip a { color: inherit; }
.theme-toggle, .nav-toggle {
  border: 1px solid var(--border); background: var(--card-bg); color: var(--fg);
  width: 32px; height: 32px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex: 0 0 auto;
}
.theme-toggle { border-radius: 50%; font-size: .95rem; }
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: inline; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }

.nav-toggle { display: none; flex-direction: column; justify-content: center; gap: 4px; border-radius: 8px; }
.nav-toggle span { display: block; width: 16px; height: 2px; background: var(--fg); }

.iix-nav { border-top: 1px solid var(--header-border); }
.iix-nav-list { list-style: none; display: flex; gap: 2px; margin: 0; padding: 0 14px; }
.iix-nav-list > li { position: relative; }
.iix-nav-list > li > a {
  display: block; padding: 9px 13px; font-size: .8rem; font-weight: 600;
  letter-spacing: .03em; color: var(--muted); text-decoration: none; white-space: nowrap;
  border-bottom: 2px solid transparent;
}
.iix-nav-list > li > a:hover { color: var(--accent); }
.iix-nav-dropdown:hover > a { color: var(--accent); border-bottom-color: var(--accent); }
.iix-dropdown-menu {
  list-style: none; margin: 0; padding: 6px; position: absolute; left: 0; top: 100%;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow-hover); min-width: 220px; display: none; z-index: 60;
}
.iix-nav-dropdown:hover .iix-dropdown-menu { display: block; }
.iix-dropdown-menu li a {
  display: block; padding: 8px 10px; border-radius: 6px; font-size: .8rem;
  color: var(--fg); text-decoration: none; white-space: nowrap;
}
.iix-dropdown-menu li a:hover { background: var(--bg); color: var(--accent); }

@media (max-width: 820px) {
  .nav-toggle { display: flex; }
  .iix-ip { font-size: .7rem; }
  .iix-nav { display: none; }
  .iix-nav.open { display: block; }
  .iix-nav-list { flex-direction: column; padding: 6px; }
  .iix-nav-list > li > a { padding: 11px 10px; border-bottom: 1px solid var(--header-border); }
  .iix-nav-dropdown:hover .iix-dropdown-menu { display: none; }
  .iix-dropdown-menu {
    position: static; display: none; box-shadow: none; border: none;
    background: transparent; padding-left: 14px; min-width: 0;
  }
  .iix-nav-dropdown.open .iix-dropdown-menu { display: block; }
  .iix-nav-dropdown.open > a { color: var(--accent); }
}
@media (max-width: 480px) {
  .iix-header-top { flex-wrap: nowrap; }
  .iix-brand img:last-of-type { display: none; }
  .iix-brand-title { font-size: .8rem; max-width: 130px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .iix-ip { display: none; }
}

h1:empty { display: none; margin: 0; }
.content1 { padding: 16px 18px 40px; }

.search-wrap { position: relative; max-width: 480px; margin: 4px 0 18px; }
.search-wrap .search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: .9rem; pointer-events: none;
}
#myInput {
  width: 100%; font-size: .95rem; padding: 11px 16px 11px 38px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--input-bg); color: var(--fg);
}
#myInput:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,235,.15); }

.section-header {
  font-size: 1rem; font-weight: 700; margin: 22px 0 10px; color: var(--fg);
  grid-column: 1 / -1;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
@media (max-width: 820px) {
  .cards-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
}
.card {
  min-width: 0;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px; box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: var(--accent); }
.card DIV:first-child B {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  overflow-wrap: break-word; word-break: break-word;
  font-size: .82rem; font-weight: 600; line-height: 1.3; min-height: 2.1em; color: var(--fg);
}
.card img { width: 100%; border-radius: 8px; display: block; border: 1px solid var(--border); margin-top: 8px; }
.card SMALL { color: var(--muted); font-size: .68rem; }

.iix-page-footer {
  border-top: 1px solid var(--border); margin-top: 24px;
  padding: 16px 18px; text-align: center; color: var(--muted); font-size: .78rem;
}
.iix-page-footer p { margin: 0; }

/* Home page: keep the theme in sync with the rest of the site without
   touching the existing navy branded footer bar. */
.content-card { background-color: var(--card-bg); color: var(--fg); }

/* --- Home page hero banner: uses images/bgtop-body.png as a backdrop
   behind the traffic headline stats. --- */
.iix-hero {
  position: relative;
  background-image: linear-gradient(180deg, rgba(10,16,26,.55), rgba(10,16,26,.72)), url('../images/bgtop-body.png');
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  border-radius: 14px;
  padding: 34px 20px;
  margin: 18px 0 24px;
  display: flex; flex-wrap: wrap; gap: 14px;
  justify-content: center;
}
.iix-hero-stat {
  min-width: 220px;
  text-align: center;
  padding: 10px 24px;
}
.iix-hero-stat h1 {
  margin: 0; font-size: 1.9rem; font-weight: 800; color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.iix-hero-stat a { color: #fff; text-decoration: none; }
.iix-hero-stat a:hover { text-decoration: underline; }
.iix-hero-stat span {
  display: block; margin-top: 6px; font-size: .8rem; font-weight: 600;
  letter-spacing: .04em; text-transform: uppercase; color: rgba(255,255,255,.85);
}
.iix-hero-divider {
  width: 1px; align-self: stretch; background: rgba(255,255,255,.25);
}
@media (max-width: 600px) {
  .iix-hero { padding: 24px 14px; }
  .iix-hero-divider { display: none; }
  .iix-hero-stat h1 { font-size: 1.5rem; }
}

/* Home page: embedded total/*.html panels. The CGI-graph crop windows
   (index.cgi/index3.cgi) are a fixed-pixel image-crop hack that can't be
   made truly fluid, so they get a responsive, scrollable frame instead of
   forcing the whole page wider than the viewport. The plain HTML panels
   (mth/bgp_state/net_map) are same-origin, so their iframe height is set
   to match their real content height via JS instead of being clipped. */
.cgi-wrap {
  width: 100%;
  max-width: 1050px;
  height: 470px;
  overflow: auto;
  margin: 0 auto 20px;
  border: 1px solid var(--border);
  border-radius: 10px;
}
.cgi-wrap-tall { height: 800px; }

.responsive-frame {
  display: block;
  width: 100%;
  border: none;
  margin-bottom: 20px;
  min-height: 200px;
  transition: height 0.25s ease;
}
