:root {
  --shell-height: 72px;
  --shell-width: 1200px;
  --shell-side: 24px;
  --shell-paper: rgba(252, 251, 248, 0.97);
  --shell-line: rgba(23, 62, 71, 0.14);
  --shell-ink: #173e47;
  --shell-muted: #607276;
  --shell-footer: #0c242c;
  --shell-footer-text: #dce7e4;
}

/* One stable header geometry for the legacy and rebuilt page systems. */
nav.nav[role="navigation"],
.site-header {
  position: sticky;
  top: 0;
  z-index: 1000;
  height: var(--shell-height);
  min-height: var(--shell-height);
  box-sizing: border-box;
  background: var(--shell-paper);
  border-bottom: 1px solid var(--shell-line);
  box-shadow: 0 1px 0 rgba(255,255,255,0.75), 0 8px 24px rgba(12,36,44,0.04);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

nav.nav[role="navigation"] > .container-wide,
.site-header > .container.nav {
  width: calc(100% - (var(--shell-side) * 2));
  max-width: var(--shell-width);
  height: var(--shell-height);
  min-height: var(--shell-height);
  margin: 0 auto;
  padding: 0;
  box-sizing: border-box;
}

nav.nav[role="navigation"] .nav-inner,
.site-header > .container.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

nav.nav[role="navigation"] .nav-inner {
  height: var(--shell-height);
  min-height: var(--shell-height);
}

.nav-logo,
.site-header .logo {
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  gap: 11px;
  min-width: 214px;
  color: var(--shell-ink);
  text-decoration: none;
}

.nav-logo::before,
.site-header .logo::before {
  content: "";
  display: block;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  background: url("uci-logo-mark.png") center / contain no-repeat;
}

/* The original raster contains a white square. Keep its accessible alt text in
   the document, but render the transparent web mark in the shared shell. */
.nav-logo img,
.site-header .logo img {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}

.site-header .logo::after {
  content: "宇創儀器應用站";
  display: block;
  color: var(--shell-ink);
  font-family: "Noto Sans TC", sans-serif;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.nav-logo-text,
.site-header .brand-text {
  display: block;
  color: var(--shell-ink);
  font-family: "Noto Sans TC", sans-serif;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

nav.nav[role="navigation"] .nav-links,
.site-header .nav-links {
  align-items: center;
  margin: 0;
}

nav.nav[role="navigation"] .nav-cta,
.site-header .nav-cta {
  white-space: nowrap;
  box-shadow: none;
}

/* One footer tone and vertical rhythm; page-specific content can remain. */
.footer,
.site-footer {
  min-height: 258px;
  box-sizing: border-box;
  padding: 36px 0 !important;
  background: var(--shell-footer) !important;
  color: var(--shell-footer-text);
  border-top: 1px solid rgba(255,255,255,0.08);
}

.footer > .container-wide,
.site-footer > .container {
  width: calc(100% - (var(--shell-side) * 2));
  max-width: var(--shell-width);
  min-height: 186px;
  margin: 0 auto;
  padding: 0;
  box-sizing: border-box;
}

.footer > .container-wide {
  display: flex;
  align-items: center;
}

.footer .footer-bottom {
  width: 100%;
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
}

.footer .footer-info,
.footer .footer-links {
  line-height: 1.75;
}

.footer .footer-links {
  justify-content: flex-end;
}

.footer a,
.site-footer a {
  color: rgba(232, 242, 239, 0.78) !important;
  text-underline-offset: 3px;
}

.footer a:hover,
.site-footer a:hover {
  color: #ffffff !important;
}

.site-footer .footer-grid {
  min-height: 116px;
  align-items: start;
  gap: 48px;
}

.site-footer .footer-grid strong {
  color: #ffffff;
  font-size: 15px;
}

.site-footer .footer-grid p {
  margin: 8px 0 0;
  color: rgba(220, 231, 228, 0.74);
}

.site-footer .legal {
  margin-top: 20px;
  padding-top: 16px;
  border-top-color: rgba(255,255,255,0.12);
  color: rgba(220, 231, 228, 0.56);
}

@media (max-width: 900px) {
  :root { --shell-height: 64px; --shell-side: 16px; }

  .nav-logo,
  .site-header .logo {
    min-width: 0;
    gap: 8px;
  }

  .nav-logo::before,
  .site-header .logo::before {
    width: 36px;
    height: 36px;
    flex-basis: 36px;
  }

  .nav-logo-text,
  .site-header .brand-text,
  .site-header .logo::after {
    font-size: 13px;
  }

  .footer,
  .site-footer {
    min-height: 0;
    padding: 32px 0 !important;
  }

  .footer > .container-wide,
  .site-footer > .container {
    min-height: 0;
  }

  .footer .footer-bottom {
    min-height: 0;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 20px;
  }

  .footer .footer-info,
  .footer .footer-links {
    justify-content: center;
  }

  .site-footer .footer-grid {
    gap: 28px;
  }
}

@media (max-width: 420px) {
  .nav-logo-text,
  .site-header .brand-text,
  .site-header .logo::after {
    max-width: 112px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Canonical header rendered by site-shell.js. The original static navigation
   remains in each document as a crawlable/no-JS fallback. */
.uci-site-header {
  position: sticky;
  top: 0;
  z-index: 1200;
  height: 72px;
  box-sizing: border-box;
  background: var(--shell-paper);
  border-bottom: 1px solid var(--shell-line);
  box-shadow: 0 1px 0 rgba(255,255,255,.75), 0 8px 24px rgba(12,36,44,.04);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.uci-header-inner {
  width: calc(100% - 48px);
  max-width: 1200px;
  height: 72px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  box-sizing: border-box;
}
.uci-brand {
  min-width: 252px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #173e47;
  text-decoration: none;
}
.uci-brand img { width: 42px; height: 42px; flex: 0 0 42px; object-fit: contain; }
.uci-brand-copy { display: flex; flex-direction: column; gap: 2px; }
.uci-brand-copy strong {
  color: #173e47;
  font: 700 15px/1.15 "Noto Sans TC", sans-serif;
  letter-spacing: .02em;
  white-space: nowrap;
}
.uci-brand-copy small {
  color: #42696d;
  font: 650 11px/1.15 "Noto Sans TC", sans-serif;
  letter-spacing: .035em;
  white-space: nowrap;
}
.uci-nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.uci-nav-links > li { position: relative; }
.uci-nav-links > li > a {
  min-height: 42px;
  padding: 0 11px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: #53686d;
  font: 600 14px/1 "Noto Sans TC", sans-serif;
  text-decoration: none;
  white-space: nowrap;
  border-radius: 9px;
}
.uci-nav-links > li > a:hover,
.uci-nav-links > li > a.is-active { color: #176f6b; background: rgba(23,111,107,.07); }
.uci-nav-links > li > a span { font-size: 14px; transition: transform .18s ease; }
.uci-has-dropdown:hover > a span { transform: rotate(180deg); }
.uci-dropdown {
  position: absolute;
  top: calc(100% - 2px);
  left: 0;
  min-width: 260px;
  margin: 0;
  padding: 8px;
  list-style: none;
  background: #fffdf9;
  border: 1px solid rgba(23,62,71,.13);
  border-radius: 14px;
  box-shadow: 0 20px 50px rgba(12,36,44,.14);
  opacity: 0;
  visibility: hidden;
  transform: translateY(6px);
  transition: opacity .18s ease, transform .18s ease, visibility .18s;
}
.uci-dropdown-wide { min-width: 300px; }
.uci-has-dropdown:hover > .uci-dropdown,
.uci-has-dropdown:focus-within > .uci-dropdown {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.uci-dropdown a {
  display: block;
  padding: 9px 12px;
  color: #53686d;
  font: 500 13px/1.35 "Noto Sans TC", sans-serif;
  text-decoration: none;
  border-radius: 8px;
  white-space: nowrap;
}
.uci-dropdown a:hover { color: #176f6b; background: rgba(23,111,107,.07); }
.uci-dropdown-label {
  margin: 7px 10px 3px;
  color: #1a817c;
  font: 700 10px/1.2 "Noto Sans TC", sans-serif;
  letter-spacing: .08em;
}
.uci-nav-actions { display: flex; align-items: center; gap: 10px; }
.uci-nav-cta,
.uci-mobile-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 19px;
  color: #fff !important;
  background: #174e78;
  border-radius: 999px;
  font: 700 14px/1 "Noto Sans TC", sans-serif;
  text-decoration: none;
  white-space: nowrap;
}
.uci-nav-cta:hover,
.uci-mobile-cta:hover { background: #123f63; color: #fff !important; }
.uci-menu-toggle {
  width: 40px;
  height: 40px;
  padding: 0;
  display: none;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 4px;
  border: 1px solid rgba(23,62,71,.18);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
}
.uci-menu-toggle span { width: 18px; height: 2px; background: #173e47; border-radius: 2px; }
.uci-mobile-menu { display: none; }

@media (max-width: 980px) {
  .uci-site-header { height: 64px; }
  .uci-header-inner { width: calc(100% - 32px); height: 64px; gap: 10px; }
  .uci-brand { min-width: 0; gap: 8px; }
  .uci-brand img { width: 36px; height: 36px; flex-basis: 36px; }
  .uci-brand-copy strong { font-size: 13px; }
  .uci-brand-copy small { font-size: 9px; }
  .uci-nav-links { display: none; }
  .uci-nav-cta { padding: 10px 15px; font-size: 13px; }
  .uci-menu-toggle { display: flex; }
  .uci-mobile-menu {
    position: fixed;
    top: 64px;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1199;
    padding: 18px 20px 32px;
    overflow-y: auto;
    background: #f8faf8;
    border-top: 1px solid rgba(23,62,71,.1);
  }
  .uci-mobile-menu:not([hidden]) { display: block; }
  .uci-mobile-menu > a:not(.uci-mobile-cta),
  .uci-mobile-menu summary {
    display: flex;
    align-items: center;
    min-height: 50px;
    color: #173e47;
    font: 700 15px/1.3 "Noto Sans TC", sans-serif;
    text-decoration: none;
    border-bottom: 1px solid rgba(23,62,71,.1);
    cursor: pointer;
  }
  .uci-mobile-menu summary { justify-content: space-between; list-style: none; }
  .uci-mobile-menu summary::after { content: "+"; color: #176f6b; font-size: 20px; }
  .uci-mobile-menu details[open] summary::after { content: "−"; }
  .uci-mobile-menu details > a {
    display: block;
    padding: 10px 14px;
    color: #5a6d71;
    font: 500 13px/1.35 "Noto Sans TC", sans-serif;
    text-decoration: none;
  }
  .uci-mobile-menu .uci-mobile-cta { margin-top: 20px; min-height: 48px; }
  html.uci-menu-open { overflow: hidden; }
}

@media (max-width: 420px) {
  .uci-header-inner { gap: 8px; }
  .uci-brand-copy small { max-width: 112px; overflow: hidden; text-overflow: ellipsis; }
  .uci-nav-cta { padding: 10px 13px; font-size: 12px; }
}
