/* Base styling and variables */

/* CSS Custom Properties for colours and spacing */
:root {
  --primary: #0073c4;
  /* deep blue used for headings and accents */
  --primary-light: #00aaff;
  /* lighter blue used for highlights */
  --secondary: #f5f7fa;
  /* very light grey used for section backgrounds */
  --dark: #1a1a1a;
  /* rich black for text and overlay */
  --muted: #666;
  /* muted grey for secondary text */
  --danger: #e63946;
  /* red for error/problem icons */
  --success: #2ca58d;
  /* green for advantages */
  --max-width: 1200px;
  /* max container width */
  --space-unit: 1rem;
  /* base unit for margins and paddings */
}

/* Global resets */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Roboto', 'Noto Sans SC', 'Noto Sans JP', sans-serif;
  line-height: 1.6;
  color: var(--dark);
  background-color: white;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s ease-in-out;
}

a:hover {
  color: var(--primary-light);
}

/* 基础样式 */
body {
  font-family: 'Noto Sans SC', 'Roboto', sans-serif;
  margin: 0;
  padding: 0;
}

/* 语言切换按钮样式 */
.lang-switch {
  display: flex;
  gap: 8px;
}

.lang-switch button {
  background: transparent;      
  border: 1px solid #ccc;        
  border-radius: 4px;            
  padding: 4px 10px;
  font-size: 14px;
  color: #333;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
}

.lang-switch button:hover {
  background: #009FE8;           
  color: #fff;                   
  border-color: #009FE8;
}

.lang-switch button.active {
  background: #009FE8;           
  color: #fff;
  border-color: #009FE8;
}

/* 导航栏样式 */
.nav-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: var(--max-width);
  margin: 0 auto;
}

/* make nav-wrapper a positioned container so absolute/mobile menu is positioned correctly */
.nav-wrapper {
  position: relative;
}

.nav-menu {
  display: flex;
  gap: calc(var(--space-unit) * 1.25); /* slightly tighter on desktop */
}

/* Desktop: align nav items to the right of the header so they're not cramped against the logo */
@media (min-width: 769px) {
  .nav-menu {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: calc(var(--space-unit) * 1.25);
  }

  /* keep header-controls (hamburger + lang) immediately after nav, not pushing items left */
  .header-controls {
    margin-left: 12px;
  }

  /* ensure the logo doesn't shrink on large screens */
  .nav-wrapper .logo {
    flex: 0 0 auto;
  }

  /* nudge the nav further right for a less empty right side: add right padding to the header area
     and constrain the nav-menu so items are closer to the edge but still inside the layout */
  .nav-wrapper {
    padding-right: 1.5rem; /* small gutter on right */
  }

  .nav-menu {
    max-width: 520px; /* prevents nav from centering too much on very wide screens */
    justify-content: flex-end;
  }
}

.nav-menu a {
  font-weight: 500;
  color: var(--dark);
}

.nav-menu a:hover {
  color: var(--primary)
}
/* 下拉菜单样式 */
.dropdown {
  position: relative;
}

.dropdown-menu {
  position: absolute !important;
  top: calc(100% + 8px);
  right: 0;
  left: auto;
  display: none;
  min-width: 220px;
  max-width: 320px;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, .06);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, .12);
  padding: 8px 0;
  z-index: 10000;
  white-space: nowrap;
}

/* On small screens, dropdown menu becomes full width inside the mobile nav */
@media (max-width: 768px) {
  .dropdown-menu {
    position: static !important;
    display: none;
    width: 100%;
    box-shadow: none;
    border: none;
    background: transparent;
    padding: 0;
    white-space: normal;
  }
  .dropdown.active .dropdown-menu {
    display: block !important;
  }
}

.dropdown-toggle {
  background: none;
  border: none;
  color: #333;
  font: inherit;
  cursor: pointer;
  padding: 0;
  margin: 0 10px;
  display: inline;
  font-weight: normal;
}

.dropdown-toggle:hover {
  color: #0066cc;
}


.dropdown.active .dropdown-menu {
  display: block !important;
}

.dropdown-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.dropdown-menu li {
  display: block;
  margin: 0;
}

.dropdown-menu a {
  display: block;
  padding: 10px 20px;
  color: #333;
  text-decoration: none;
  transition: background .2s ease, color .2s ease;
}

.dropdown-menu a:hover {
  background: #f5f5f5;
  color: #0066cc;
}


/* Utility classes */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space-unit);
}

.section {
  padding: calc(var(--space-unit) * 4) 0;
}

.section-heading {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: calc(var(--space-unit) * 2);
  text-align: center;
  color: var(--primary);
}

/* Header and Navigation */
header {
  width: 100%;
  padding: calc(var(--space-unit) * 1.5) var(--space-unit);
  background: white;
  border-bottom: 1px solid #e5e8eb;
  position: sticky;
  top: 0;
  z-index: 1000;
}

/* Mobile navigation toggle (simple, no JS required beyond adding a class) */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.25rem;
  cursor: pointer;
}

/* Header controls container: holds the lang toggle and hamburger on the right */
.header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Style for the single language toggle when placed in header-controls */
#langToggle {
  background: transparent;
  border: none;
  color: var(--dark);
  font-size: 1rem;
  font-weight: 500;
  padding: 0 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#langToggle:hover {
  color: var(--primary);
}

#langToggle:focus {
  outline: 3px solid rgba(0,159,232,0.18);
  outline-offset: 2px;
  border-radius: 4px;
}

.logo-img {
  height: 48px;
  width: auto;
}

/* 一体化外层卡片 + 背景图 */
.comparison-card {
  position: relative;
  border-radius: 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .08);
  padding: 2rem 2.25rem;
  overflow: hidden;
  background: #fff;
  /* 先给白底，防止图片没加载时发灰 */
}

/* 背景图 */
.comparison-card.with-bg {
  background: #fff url("assets/对比.png") center top / cover no-repeat;
}

/* 左半区域做一点白色遮罩，保证文字可读 */
.comparison-card.with-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
      rgba(255, 255, 255, 0.92) 0 52%,
      rgba(255, 255, 255, 0.65) 52% 100%);
  pointer-events: none;
  z-index: 0;
}

/* 内容网格：左列 | 竖线占位 | 右列 */
.comparison-grid {
  position: relative;
  z-index: 1;
  /* 盖在遮罩之上 */
  display: grid;
  grid-template-columns: 1fr 24px 1fr;
  column-gap: 2.5rem;
  align-items: start;
}

/* 竖向分隔线 */
.divider {
  width: 1px;
  background: linear-gradient(to bottom, #e5e7eb00, #e5e7eb, #e5e7eb00);
  justify-self: center;
  height: 100%;
}

/* 圆形 VS 徽章，居中覆盖在分隔线上 */
.vs-badge {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 84px;
  height: 84px;
  border-radius: 999px;
  border: 4px solid #e5e7eb;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1.5rem;
  color: #374151;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .08);
  pointer-events: none;
}

/* 文案样式 */
.comparison-title {
  margin: 0 0 1rem;
  font-size: 1.35rem;
  font-weight: 700;
}

.comparison-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.comparison-list li {
  margin: .65rem 0;
  line-height: 1.6;
}

.icon-cross {
  color: #e63946;
  margin-right: .6rem;
}

.icon-check {
  color: #16a34a;
  margin-right: .6rem;
}

.comparison-grid {
  /* spacing and positioning for the comparison area; keep grid as primary layout
     (avoid overriding the grid with flex so mobile grid breakpoints work) */
  gap: 80px;
  position: relative;
}

/* 左边列 */
.col-left {
  flex: 0 0 400px;
  text-align: left;
  margin-right: 40px;
  /* 离中间多一点 */
}

/* 右边列 */
.col-right {
  flex: 0 0 300px;
  text-align: left;
  margin-left: 40px;
  /* 和左边对称 */
}

/* 中间分隔线 */
.divider {
  width: 2px;
  background: #eee;
}

/* VS 徽章保持在正中 */
.vs-badge {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: #009FE8;
  color: #fff;
  font-weight: bold;
  padding: 10px 20px;
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.15);
}

/* Make sure images and svg scale on small screens */
img,
picture,
svg {
  max-width: 100%;
  height: auto;
  display: block;
}

/* Ensure workflow image doesn't overflow */
.workflow-img img {
  max-width: 100%;
  height: auto;
}

.highlight {
  color: #e63946;
  /* 红色 */
  font-weight: 700;
  /* 加粗 */
}

/* 左列：在右边加内边距 */
.col-left {
  padding-right: 1.5rem;
  /* 你可以调整这个值 */
  text-align: left;
}

/* 右列：在左边加内边距 */
.col-right {
  padding-left: 1.5rem;
  /* 保持与左边一致 */
  text-align: left;
}

/* 响应式：窄屏改纵向一块 */
@media (max-width: 900px) {
  .comparison-grid {
    grid-template-columns: 1fr;
    row-gap: 1.25rem;
  }

  /* Ensure stacked columns align consistently on small screens */
  .comparison-grid {
    gap: 1rem;
    padding: 0 1rem;
  }

  .col-left,
  .col-right {
    padding-left: 0;
    padding-right: 0;
    margin: 0;
    flex: none;
  }

  .comparison-title {
    text-align: left;
    margin-bottom: 0.5rem;
  }

  .comparison-list {
    margin-left: 0;
    padding-left: 0;
  }

  .divider {
    display: none;
  }

  .vs-badge {
    position: static;
    transform: none;
    margin: .5rem auto;
  }
}

/* 响应式：在手机上自动变成单列 */
@media (max-width: 600px) {
  .gallery {
    grid-template-columns: 1fr;
  }
  .divider {
    display: none;
  }

  .vs-badge {
    position: static;
    transform: none;
    margin: .25rem auto;
  }
}

.icon-cross {
  color: #e63946;
  /* 红色 */
  margin-right: 0.5rem;
}

.icon-check {
  color: #2a9d8f;
  /* 绿色 */
  margin-right: 0.5rem;
}

.comparison-vs {
  font-size: 2rem;
  font-weight: bold;
  color: #444;
  align-self: center;
}


.logo {
  display: flex;
  align-items: center;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--dark);
}

/* Explicit ordering so we can reposition the language toggle between nav and hamburger per breakpoint */
.nav-wrapper > .logo { order: 1; }
/* By default the nav-menu can sit in the middle; header-controls (hamburger + lang) should stick to the right */
.nav-menu { order: 2; }
.header-controls { order: 3; margin-left: auto; }

/* Place lang toggle visually just before the nav links on larger screens using inline placement */
#langToggle { order: 2; margin-left: 12px; }

.logo i {
  font-size: 1.5rem;
  margin-right: 0.5rem;
  color: var(--primary);
}

/* Hero section */
.hero {
  background: #000;
}

.hero-inner {
  max-width: var(--max-width);
  /* 和导航对齐 */
  margin: 0 auto;
  height: 65vh;
  min-height: 360px;

  background-image: url('assets/hero.png');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;

  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  text-align: center;
  position: relative;
}

/* 遮罩 */
.hero-inner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 0;
}


.hero-content {
  position: relative;
  z-index: 1;
  width: 100%;
  padding: 0 5%;
}


.hero-title {
  font-size: 2.5rem;
  line-height: 1.1;
  margin-bottom: var(--space-unit);
  font-weight: 700;
}

.hero-subtitle {
  font-size: 1.25rem;
  font-weight: 500;
  margin-bottom: calc(var(--space-unit) * 2);
  opacity: 0.9;
}

/* 子页面字段格式 */
.clean-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.title-banner {
  background: #009FE8;
  color: #fff;
  text-align: center;
  padding: 12px 16px;
  margin: 0 auto;
  border-radius: 8px;
  font-weight: 800;
  display: block;
  width: 100%;
  max-width: var(--max-width, 1200px);
  /* 和导航同宽 */
  box-sizing: border-box;
  /* 让 padding 计入宽度 */
}

.centered-block {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 16px;
  background: transparent;
  text-align: left;
}

.content-wrapper {
  width: 100%;
  max-width: var(--max-width);
  margin: 30px auto;
  /* 居中，左边缘与导航一致 */
  padding: 0 var(--container-x);
  box-sizing: border-box;
  font-family: "Noto Sans SC", "Microsoft YaHei", sans-serif;
}

.info-section {
  margin-bottom: 25px;
}

.info-section h3 {
  font-size: 1.2rem;
  color: #009FE8;
  border-left: 4px solid #009FE8;
  padding-left: 8px;
  margin-bottom: 10px;
}

.info-section ul {
  list-style: none;
  padding-left: 0;
}

.info-section li {
  margin: 5px 0;
  padding-left: 18px;
  position: relative;
}

.info-section li::before {
  content: "◆";
  color: #009FE8;
  position: absolute;
  left: 0;
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 30px;
}

.card {
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.card h3 {
  margin-bottom: 15px;
  font-size: 1.2rem;
  color: #333;
  border-bottom: 1px solid #eee;
  padding-bottom: 8px;
}

.card ol {
  padding-left: 20px;
  margin: 0;
}

.card li {
  margin: 8px 0;
}

/* ===== 独立容器样式 ===== */
.case-card {
  --card-bg: #fff;
  --card-border: #e6e8eb;
  --head-bg: #f5f7fa;
  --row-alt: #fafbfc;
  --text: #1f2328;
  --muted: #6b7280;

  max-width: 1100px;
  /* 限制容器宽度 */
  margin: 24px auto;
  /* 居中 */
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .06);
  overflow: hidden;
}

.case-card__header {
  font-weight: 700;
  font-size: 18px;
  padding: 12px 16px;
  background: #eef6ff;
  color: #0b63b0;
  border-bottom: 1px solid var(--card-border);
}

/* 横向滚动容器（小屏友好） */
.case-card__scroller {
  width: 100%;
  overflow-x: auto;
}

/* Enable smooth scrolling on mobile for horizontal tables */
.case-card__scroller {
  -webkit-overflow-scrolling: touch;
}

/* ===== 表格样式 ===== */
.case-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  color: var(--text);
  min-width: 760px;

}

.case-table thead th {
  position: sticky;
  top: 0;
  background: var(--head-bg);
  text-align: center;
  font-weight: 700;
  padding: 10px 12px;
  border-bottom: 1px solid var(--card-border);
  white-space: nowrap;
}

.case-table tbody th {
  background: var(--head-bg);
  text-align: left;
  font-weight: 700;
  padding: 10px 12px;
  border-bottom: 1px solid var(--card-border);
  white-space: nowrap;
}

.case-table td {
  text-align: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--card-border);
  white-space: nowrap;
}

/* 除去第一列标题 */
.case-table tbody tr:nth-child(even) td {
  background: var(--row-alt);
}

/* 圆角只作用在最外圈 */
.case-table thead th:first-child {
  border-top-left-radius: 8px;
}

.case-table thead th:last-child {
  border-top-right-radius: 8px;
}

.case-table tbody tr:last-child th {
  border-bottom-left-radius: 8px;
}

.case-table tbody tr:last-child td:last-child {
  border-bottom-right-radius: 8px;
}

/* 备注 */
.case-card__note {
  margin: 10px 16px 16px;
  font-size: 12px;
  color: var(--muted);
}

/* 绘制四宫格示意图 */
.gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  /* 两列 */
  gap: 16px;
  /* 间距 */
  max-width: 800px;
  /* 限制整体宽度 */
  margin: 20px ;
  padding: 10px;
  box-sizing: border-box;
}

/* Make card grids single column on small screens */
@media (max-width: 900px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
  .workflow-img img {
    max-width: 100%;
    width: 100%;
  }
}

.gallery-item img {
  width: 100%;
  height: auto;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  object-fit: cover;
}

  /* 无障碍：隐藏标题但保留可读性 */
  .visually-hidden {
    position: absolute !important;
    height: 1px;
    width: 1px;
    overflow: hidden;
    clip: rect(1px, 1px, 1px, 1px);
    white-space: nowrap;
  }


  /* Call-to-action button */
  .cta-button {
    display: inline-block;
    padding: 0.75rem 2rem;
    border-radius: 4px;
    background: var(--primary);
    color: white;
    font-size: 1rem;
    font-weight: 600;
    transition: background 0.2s ease-in-out;
  }

  .cta-button:hover {
    background: var(--primary-light);
  }

  /* Problems section */
  .problems {
    background: var(--secondary);
  }

  .problems .content {
    display: flex;
    flex-direction: column;
    gap: calc(var(--space-unit) * 2);
  }

  .problem-list {
    list-style: none;
  }

  .problem-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: var(--space-unit);
    font-size: 1rem;
  }

  .problem-item i {
    color: var(--danger);
    margin-right: 0.75rem;
    font-size: 1.25rem;
    flex-shrink: 0;
  }

  .problem-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--space-unit);
    color: var(--dark);
  }

  /* Scenarios section */
  .scenarios {
    background: white;
  }

  .scenario-list {
    list-style: none;
  }

  .scenario-item {
    display: flex;
    align-items: flex-start;
    margin-bottom: var(--space-unit);
    font-size: 1rem;
  }

  .scenario-item i {
    color: var(--primary);
    margin-right: 0.75rem;
    font-size: 1.25rem;
    flex-shrink: 0;
  }

  .scenario-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: var(--space-unit);
    color: var(--dark);
  }

  /* Features section */
  .features {
    background: var(--secondary);
  }

  .feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: calc(var(--space-unit) * 2);
  }

  .feature-card {
    background: white;
    border-radius: 8px;
    padding: calc(var(--space-unit) * 2);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
  }

  .feature-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.1);
  }

  .feature-card i {
    font-size: 2rem;
    margin-bottom: var(--space-unit);
    color: var(--primary);
  }

  .feature-card h3 {
    font-size: 1.25rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
    color: var(--dark);
  }

  .feature-card p {
    font-size: 0.95rem;
    color: var(--muted);
    flex-grow: 1;
  }

  .feature-card a {
    margin-top: var(--space-unit);
    display: inline-block;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--primary);
  }

  .feature-card a:hover {
    color: var(--primary-light);
  }

  /* CTA Section */
  .cta {
    background: var(--primary);
    color: white;
    text-align: center;
    padding: calc(var(--space-unit) * 4) var(--space-unit);
  }

  .cta h2 {
    font-size: 2rem;
    margin-bottom: var(--space-unit);
    font-weight: 700;
  }

  .cta p {
    font-size: 1.1rem;
    margin-bottom: calc(var(--space-unit) * 2);
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
    opacity: 0.9;
  }

  .cta .cta-button {
    background: white;
    color: var(--primary);
    font-weight: 600;
  }

  .cta .cta-button:hover {
    background: var(--secondary);
  }

  /* Footer */
  footer {
    background: #0f254f;
    color: #fff;
    padding: calc(var(--space-unit) * 2);
    font-size: 0.85rem;
  }

  footer .container {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  footer .footnotes {
    max-width: var(--max-width);
    margin-top: var(--space-unit);
  }

  footer a {
    color: #8ab5e1;
  }

  /* Responsive typography & layout adjustments */
  @media (max-width: 768px) {
    .hero-title {
      font-size: 2.25rem;
    }

    .hero-subtitle {
      font-size: 1rem;
    }

    /* collapse nav on small screens and show a toggle button */
    .nav-menu {
      display: none;
      /* collapsed by default on small screens; will be toggled via .nav-open on .nav-wrapper */
    }

    .nav-toggle {
      display: inline-block;
    }

    /* When nav is open (add .nav-open to .nav-wrapper), show nav menu as vertical list */
    .nav-wrapper.nav-open .nav-menu {
      display: flex;
      flex-direction: column;
      position: absolute;
      right: 16px;
      top: 64px;
      background: white;
      border: 1px solid #e5e8eb;
      border-radius: 8px;
      padding: 8px;
      box-shadow: 0 8px 24px rgba(0,0,0,.08);
      z-index: 2000;
      width: calc(100% - 32px);
      max-width: 320px;
      gap: 0; /* remove extra gap between flex children; items have their own padding */
    }

    /* make spacing inside the mobile nav match the dropdown menu spacing (10px 20px) */
    .nav-wrapper.nav-open .nav-menu a,
    .nav-wrapper.nav-open .nav-menu .dropdown-toggle,
    .nav-wrapper.nav-open .nav-menu .lang-switch {
      margin: 0;
      padding: 10px 20px;
    }

    /* Make items inside the mobile nav full-width and left-aligned */
    .nav-wrapper.nav-open .nav-menu {
      align-items: stretch;
    }

    .nav-wrapper.nav-open .nav-menu a,
    .nav-wrapper.nav-open .nav-menu .dropdown-toggle,
    .nav-wrapper.nav-open .nav-menu .lang-switch {
      /* consistent padding to match dropdown menu items */
      padding: 10px 20px;
      margin: 0;
      width: 100%;
      box-sizing: border-box;
      text-align: left;
      background: transparent;
    }

    /* Ensure header-placed lang toggle matches nav links on wider screens
       use a selector that targets the button regardless of whether it's inside nav */
    .header-controls > #langToggle,
    #mainNav > #langToggle {
      display: inline-block;
      background: transparent;
      border: none;
      padding: 0 8px;
      margin: 0;
      color: var(--dark);
      font-size: 1rem;
      font-weight: 500;
      cursor: pointer;
      text-align: left;
    }

    .header-controls > #langToggle:hover,
    #mainNav > #langToggle:hover {
      color: var(--primary);
    }

    /* accessibility: visible focus ring */
    .header-controls > #langToggle:focus,
    #mainNav > #langToggle:focus {
      outline: 3px solid rgba(0,159,232,0.18);
      outline-offset: 2px;
      border-radius: 4px;
    }

    /* Keep the mobile pill/icon behavior via media query (overrides below) */

    /* hide the old multi-button lang-switch inside the nav on small screens (we'll remove it from HTML too) */
    .nav-wrapper .lang-switch {
      display: none;
    }

    .nav-wrapper.nav-open .nav-menu .lang-switch {
      display: flex;
      gap: 8px;
      justify-content: flex-start;
      padding: 8px 14px;
    }

    header {
      padding: calc(var(--space-unit) * 1);
    }

  /* On small screens ensure header-controls (hamburger + lang) remain at the far right and nav stays collapsed */
  .header-controls { order: 3; margin-left: auto; }
  #langToggle { order: 3; margin-left: 8px; }
  .nav-menu { order: 4; }

    /* Defensive: keep logo pinned to the left and prevent it from shrinking on very small screens */
    .nav-wrapper {
      justify-content: space-between;
      align-items: center;
    }

    .nav-wrapper .logo {
      flex: 0 0 auto;
      min-width: 0;
    }

    .problem-title,
    .scenario-title {
      font-size: 1.25rem;
    }

    .feature-card h3 {
      font-size: 1.1rem;
    }

    /* Reduce hero vertical height on small devices */
    .hero-inner {
      height: auto;
      min-height: 280px;
      padding: 40px 16px;
      align-items: center;
    }

    .hero-title {
      font-size: 1.75rem;
    }

    /* small helper: indent certain sections on mobile to avoid content touching the edge */
    .mobile-indent {
      padding-left: 1rem; /* approx two spaces worth visually */
    }
  }

@media (max-width: 420px) {
  .nav-wrapper.nav-open .nav-menu {
    right: 8px;
    left: 8px;
    width: auto;
  }
  .col-left, .col-right {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    margin: 0;
    flex: 1 1 auto;
  }
  .vs-badge {
    width: 64px;
    height: 64px;
    font-size: 1rem;
  }

    /* compact icon-only lang toggle on very small screens */
    #mainNav > #langToggle,
    #langToggle {
      padding: 6px;
      width: 36px;
      height: 36px;
      border-radius: 50%;
      font-size: 12px;
      gap: 0;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      background: #fff;
      border: 1px solid rgba(0,0,0,0.08);
    }

    #langToggle::before { margin-right: 0; }
}