/* ============================================================
   Multi-language layer: sticky header (ibj.cn style) + language
   dialog (aws.amazon.com style) + per-language font stacks.
   Loaded after common.css / style.css on every page.
   ============================================================ */

/* ---------- sticky header ---------- */
body.has-sbnav { padding-top: 64px; }

.sbnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: #232f3e;
  box-shadow: 0 2px 12px rgba(10, 20, 40, 0.25);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
.sbnav-inner {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: calc(var(--content-width, 1200px) + 32px);
  height: 64px;
  margin: 0 auto;
  padding: 0 16px;
}
.sbnav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 0 0 auto;
  color: #fff;
  text-decoration: none;
}
.sbnav-brand:hover { color: #fff; }
.sbnav-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 4px;
  background: #ec7211;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.15);
}
.sbnav-name { display: flex; flex-direction: column; line-height: 1.25; }
.sbnav-name strong { font-size: 16px; font-weight: 600; color: #fff; }
.sbnav-name em {
  font-style: normal;
  font-size: 11.5px;
  color: rgba(255, 255, 255, 0.58);
  white-space: nowrap;
}

.sbnav-links {
  display: flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  gap: 2px;
  margin-left: 6px;
}
.sbnav-link,
.sbnav-group > summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 12px;
  border-radius: 3px;
  color: #e9ebed;
  font-size: 14.5px;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.sbnav-link { text-decoration: none; }
.sbnav-group > summary::-webkit-details-marker { display: none; }
.sbnav-link:hover,
.sbnav-group > summary:hover,
.sbnav-group[open] > summary {
  background: rgba(255, 255, 255, 0.07);
  color: #ec7211;
}
.sbnav-link.is-active,
.sbnav-group.is-active > summary,
.sbnav-sub.is-active {
  color: #ec7211;
  font-weight: 600;
}
.sbnav-badge {
  padding: 1px 5px;
  border-radius: 2px;
  background: rgba(255, 153, 0, 0.18);
  color: #ffb84d;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.sbnav-caret { flex: 0 0 auto; opacity: 0.7; transition: transform 0.15s ease; }
.sbnav-group[open] > summary .sbnav-caret { transform: rotate(180deg); }

.sbnav-group { position: relative; }
.sbnav-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  padding: 6px 0;
  background: #fff;
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(10, 20, 40, 0.25);
  z-index: 120;
}
.sbnav-sub {
  display: block;
  padding: 9px 16px;
  color: #16191f;
  font-size: 14px;
  text-decoration: none;
  white-space: nowrap;
}
.sbnav-sub:hover { background: #f2f3f5; color: #c45500; }

/* ---------- language trigger (AWS style: globe + language + caret) ---------- */
.sbnav-lang {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  margin-left: auto;
  padding: 7px 10px;
  border: 0;
  border-radius: 3px;
  background: transparent;
  color: #e9ebed;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
}
.sbnav-lang:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.sbnav-ico { flex: 0 0 auto; fill: currentColor; }
.sbnav-langname { max-width: 130px; overflow: hidden; text-overflow: ellipsis; }

.sbnav-burger {
  display: none;
  flex: 0 0 auto;
  padding: 8px;
  border: 0;
  background: none;
  cursor: pointer;
}
.sbnav-burger span {
  display: block;
  width: 20px;
  height: 2px;
  margin: 4px 0;
  background: #fff;
}

/* ---------- language dialog (AWS style modal) ---------- */
.sblang { position: fixed; inset: 0; z-index: 300; }
.sblang[hidden] { display: none; }
.sblang-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 35, 0.62);
}
/* dim page scroll while the dialog is open */
html.sblang-open, html.sblang-open body { overflow: hidden; }

.sblang-panel {
  position: relative;
  width: calc(100% - 32px);
  max-width: 720px;
  max-height: calc(100vh - 120px);
  margin: 8vh auto 0;
  padding: 24px 28px 20px;
  overflow: auto;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 16px 48px rgba(10, 20, 40, 0.35);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
.sblang-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid #eaeded;
}
.sblang-head h2 {
  margin: 0;
  padding: 0;
  border: 0;
  color: #16191f;
  font-size: 20px;
  font-weight: 500;
  line-height: 1.4;
}
.sblang-x {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  margin: -4px -6px 0 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: #545b64;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
}
.sblang-x:hover { background: #f2f3f5; color: #16191f; }

.sblang-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px 20px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}
.sblang-list li { margin: 0; }
.sblang-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 4px;
  color: #16191f;
  font-size: 14.5px;
  text-decoration: none;
}
.sblang-list a:hover { background: #f2f3f5; }
.sblang-list a[aria-current="true"] {
  background: #fff4e5;
  color: #c45500;
  font-weight: 600;
}
.sblang-check { color: #ec7211; font-weight: 700; opacity: 0; }
.sblang-list a[aria-current="true"] .sblang-check { opacity: 1; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .sbnav-links .sbnav-link,
  .sbnav-links .sbnav-group > summary { padding: 8px 9px; font-size: 14px; }
  .sbnav-name em { display: none; }
}
@media (max-width: 900px) {
  .sbnav-burger { display: block; margin-left: 4px; }
  .sbnav-lang { margin-left: auto; }
  .sbnav-links {
    position: absolute;
    top: 64px;
    left: 0;
    right: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    margin: 0;
    padding: 6px 12px 12px;
    background: #232f3e;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 20px rgba(10, 20, 40, 0.3);
    max-height: calc(100vh - 64px);
    overflow: auto;
  }
  .sbnav-links.is-open { display: flex; }
  .sbnav-links .sbnav-link,
  .sbnav-links .sbnav-group > summary {
    padding: 12px 8px;
    font-size: 15px;
    border-radius: 0;
  }
  .sbnav-group { position: static; }
  .sbnav-menu {
    position: static;
    min-width: 0;
    padding: 0 0 6px 16px;
    background: transparent;
    box-shadow: none;
  }
  .sbnav-sub { color: #d5dbdb; padding: 9px 10px; font-size: 14px; }
  .sbnav-sub:hover { background: rgba(255, 255, 255, 0.07); color: #ec7211; }
}
@media (max-width: 640px) {
  .sbnav-inner { gap: 8px; padding: 0 12px; }
  .sbnav-langname { display: none; }
  .sblang-panel {
    width: 100%;
    max-width: none;
    max-height: 100vh;
    height: 100%;
    margin: 0;
    border-radius: 0;
    padding: 18px 16px;
  }
  .sblang-list { grid-template-columns: 1fr; }
}
@media print {
  .sbnav, .sblang, .sbnav-links { display: none !important; }
  body.has-sbnav { padding-top: 0; }
}

/* ---------- one content grid for every layout ----------
   aws.amazon.com (pc): content container 1200px centred, section backgrounds
   full-bleed, header/footer content aligned to the same 1200 grid.
   - body padding 20 (core) / 16 (tools) keeps the outer gutter
   - 100wen/contact use 1240 + 20px padding = 1200 of real content
   ---------------------------------------------------------- */
:root { --content-width: 1320px; }

body.has-sbnav .wrap { max-width: var(--content-width); }
.container { max-width: var(--content-width); }
.site-footer .container {
  max-width: calc(var(--content-width) + 40px);
  padding: 0 20px;
}


/* anchors should not hide under the fixed header */
[id] { scroll-margin-top: 76px; }

/* ---------- CJK / latin font stacks per language ---------- */
html[lang="ja"] body {
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic",
    "Noto Sans JP", "Meiryo", -apple-system, BlinkMacSystemFont, sans-serif;
}
html[lang="ko"] body {
  font-family: "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR",
    -apple-system, BlinkMacSystemFont, sans-serif;
}
html[lang="zh-TW"] body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang TC",
    "Microsoft JhengHei", "Noto Sans TC", sans-serif;
}
html[lang="th"] body {
  font-family: "Leelawadee UI", "Noto Sans Thai", "Thonburi",
    -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 1.85;
}
html[lang="th"] h1,
html[lang="th"] h2,
html[lang="th"] h3,
html[lang="th"] p,
html[lang="th"] li,
html[lang="th"] td,
html[lang="th"] th { line-height: 1.8; }
html[lang="vi"] body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans",
    "PingFang SC", sans-serif;
}

/* German / French / Spanish run longer: keep long labels wrapping instead of
   overflowing nav items and cards. */
html[lang="de"] .card,
html[lang="fr"] .card,
html[lang="es"] .card,
html[lang="vi"] .card,
html[lang="th"] .card { min-width: 280px; }

/* ---------- knowledge base language notice ---------- */
.i18n-lang-note {
  margin: 0;
  padding: 12px 16px;
  border-top: 1px solid #f0d9b5;
  background: #fff8ee;
  color: #545b64;
  font-size: 13px;
  line-height: 1.6;
  text-align: center;
}
html[lang="th"] .i18n-lang-note { line-height: 1.8; }

/* Legacy in-page header (contact page inherits the 100wen template) would
   duplicate the sticky header — hide it where the new header is present. */
body.has-sbnav .site-header { display: none; }

/* ---------- footer palette (ibj.cn: deep navy #0f2233) ---------- */
.footer,
.site-footer,
.tool-footer {
  background: #0f2233;
  color: #b9c7d3;
  border-top: 0;
  font-size: 13.5px;
  line-height: 1.7;
  padding: 34px 24px 22px;
  text-align: center;
}
.tool-footer { margin-top: 40px; padding: 28px 0 22px; }
.site-footer { padding: 34px 0 22px; }

.footer .footer-links,
.site-footer .footer-links,
.tool-footer .footer-links {
  max-width: var(--content-width, 1200px);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 20px;
  margin: 0 auto 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.footer .footer-links a,
.site-footer .footer-links a,
.tool-footer .footer-links a {
  color: #b9c7d3;
  font-size: 13.5px;
  margin: 0;
  text-decoration: none;
  display: inline-block;
}
.footer .footer-links a:hover,
.site-footer .footer-links a:hover,
.tool-footer .footer-links a:hover {
  color: #fff;
  text-decoration: none;
}

/* visit counters + copyright: secondary tone */
.footer > div:not(.footer-links),
.site-footer .container > div:not(.footer-links),
.site-footer > div:not(.container):not(.footer-links),
.tool-footer > div:not(.footer-links) {
  color: #93a6b6;
  font-size: 12.5px;
  line-height: 1.9;
}
.footer-copy { margin-top: 4px; }

/* 100wen mobile drawer: keep the sticky header visible above it */
@media (max-width: 991px) {
  body.has-sbnav .book-sidebar { top: 64px; }
}

/* ---------- full-bleed footer (background spans the viewport) ---------- */
body.has-sbnav { --page-gutter: 20px; }
body.has-sbnav:has(.tool-footer) { --page-gutter: 16px; }
@media (max-width: 640px) {
  body.has-sbnav { --page-gutter: 10px; }
}
.footer,
.i18n-lang-note {
  margin-left: calc(-1 * var(--page-gutter, 20px));
  margin-right: calc(-1 * var(--page-gutter, 20px));
  padding-left: 0;
  padding-right: 0;
}
.tool-footer {
  margin-left: calc(-1 * var(--page-gutter, 16px));
  margin-right: calc(-1 * var(--page-gutter, 16px));
}

/* narrow screens: keep footer link rows off the viewport edge */
@media (max-width: 1359px) {
  .footer .footer-links,
  .tool-footer .footer-links {
    padding-left: 16px;
    padding-right: 16px;
  }
}
