/* ============================================================
   SUNDA Intelligent Control — single-page corporate site
   Sections: tokens · base · buttons · topbar · header · hero
             stats · cards · apps · process · certs
             about · contact · footer · responsive
   ============================================================ */

/* ---------- tokens ---------- */
:root {
  --ink:        #0A1F1F;
  --ink-2:      #122E2E;
  --ink-3:      #1A3D3D;

  /* brand: sampled from logo.png — teal #18A8A8 → green #48C090 */
  --accent:     #0C8484;
  --accent-dk:  #0A6E6E;
  --accent-lt:  #E2F4F4;
  --accent-vivid: #18A8A8;
  --cyan:       #18A8A8;
  --green:      #2BA574;
  --amber:      #F59E0B;

  --bg:         #FFFFFF;
  --bg-muted:   #F5F9F9;
  --border:     #E3EDED;
  --border-dk:  #CFDCDC;

  --text:       #15292C;
  --text-muted: #5B7373;
  --text-soft:  #849999;

  --shadow-sm:  0 1px 2px rgba(10, 31, 31, .06);
  --shadow:     0 4px 16px rgba(10, 31, 31, .07);
  --shadow-lg:  0 16px 48px rgba(10, 31, 31, .12);

  --r-sm: 8px;
  --r:    14px;
  --r-lg: 22px;

  --wrap: 1200px;
  --gutter: clamp(20px, 5vw, 40px);

  /* Heights of the two chrome bars. The mobile drawer is a fixed child of .header,
     and .header has a backdrop-filter — which makes it the containing block for fixed
     descendants. So the drawer's offset is measured from the header, not the viewport,
     and these values have to match the real heights. */
  --header-h: 72px;
  --topbar-h: 44px;

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
          'Helvetica Neue', Arial, 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

/* ---------- reset / base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 90px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg { max-width: 100%; display: block; }

h1, h2, h3, h4 { margin: 0; line-height: 1.18; letter-spacing: -.02em; font-weight: 700; }
h1 { font-size: clamp(2.1rem, 5vw, 3.6rem); letter-spacing: -.035em; }
h2 { font-size: clamp(1.65rem, 3.4vw, 2.5rem); letter-spacing: -.03em; }
h3 { font-size: 1.09rem; }
p  { margin: 0 0 1em; }
a  { color: inherit; text-decoration: none; }
ul, ol { margin: 0; padding: 0; list-style: none; }

/* max() against the safe-area insets keeps content clear of the notch and the rounded
   corners in landscape. Requires viewport-fit=cover in the <meta viewport>, which both
   pages set; without it the env() values are 0 and this degrades to --gutter. */
.wrap {
  width: 100%; max-width: var(--wrap); margin-inline: auto;
  padding-inline: max(var(--gutter), env(safe-area-inset-left))
                  max(var(--gutter), env(safe-area-inset-right));
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 0 0 var(--r-sm) 0;
}
.skip-link:focus { left: 0; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.hl { color: var(--accent); }

/* ---------- eyebrow ---------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: .78rem; font-weight: 600; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent); margin: 0 0 16px;
}
.eyebrow__dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 4px var(--accent-lt);
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 12px 22px; border: 1px solid transparent; border-radius: 999px;
  font-family: inherit; font-size: .94rem; font-weight: 600; letter-spacing: -.01em;
  cursor: pointer; white-space: nowrap; transition: .18s ease;
}
.btn svg { width: 17px; height: 17px; fill: currentColor; flex: none; }
.btn--lg { padding: 15px 28px; font-size: 1rem; }
.btn--block { width: 100%; }

.btn--primary { background: var(--accent); color: #fff; box-shadow: 0 6px 18px rgba(12, 132, 132, .28); }
.btn--primary:hover { background: var(--accent-dk); transform: translateY(-1px); box-shadow: 0 10px 26px rgba(12, 132, 132, .34); }

.btn--ghost { background: transparent; color: var(--ink); border-color: var(--border-dk); }
.btn--ghost:hover { border-color: var(--ink); background: rgba(10, 31, 31, .04); }

/* ---------- topbar ---------- */
.topbar {
  background: var(--ink); color: #BFD6D6; font-size: .83rem;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.topbar__inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 42px; }
.topbar__contact { display: flex; gap: 24px; flex-wrap: wrap; }
/* 44px tap target: these are the tel: and mailto: links, the first conversion path on
   a phone, and their inline box was only ~21px tall. The parent's min-height does not
   reach them. */
.topbar__contact a { display: inline-flex; align-items: center; gap: 7px; min-height: 44px; transition: color .15s; }
.topbar__contact a:hover { color: #fff; }
.topbar__contact svg { width: 14px; height: 14px; fill: var(--cyan); }
.topbar__badge { display: inline-flex; align-items: center; gap: 7px; color: #85A8A8; white-space: nowrap; }
.topbar__badge svg { width: 15px; height: 15px; fill: var(--green); }

/* Groups the badge and the language switch so .topbar__inner keeps its two-child
   space-between layout. At 820px and below the badge is hidden and only the switch
   remains, which is deliberate — it has to stay reachable on a phone. */
.topbar__meta { display: flex; align-items: center; gap: 16px; }
.lang {
  display: inline-flex; align-items: center; min-height: 30px; padding: 3px 11px;
  border: 1px solid rgba(255, 255, 255, .22); border-radius: 999px;
  white-space: nowrap; transition: color .15s, border-color .15s;
}
.lang:hover { color: #fff; border-color: rgba(255, 255, 255, .45); }

/* ---------- header ---------- */
.header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255, 255, 255, .88);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
  transition: box-shadow .2s;
}
.header.is-stuck { box-shadow: var(--shadow); }
.header__inner { display: flex; align-items: center; justify-content: space-between; gap: 24px; min-height: var(--header-h); }

.logo { display: inline-flex; align-items: center; gap: 11px; }
.logo__img { height: 40px; width: auto; }
.logo--footer .logo__img { height: 46px; }

.nav { display: flex; align-items: center; gap: 32px; }
.nav ul { display: flex; gap: 28px; }
/* Desktop-only nav link styling.
   Scoped to : 821px rather than written as a base rule with a mobile override.
   The previous version used `.nav a:not(.nav__cta)`, and `:not()` contributes its
   argument's specificity — so it scored (0,2,1) and silently beat the drawer's
   `.nav ul a` (0,1,2), collapsing mobile tap targets from 56px to 33px.
   Isolating by breakpoint means the two rule sets never compete at all.
   The CTA needs no exclusion here: it is a direct child of .nav, not inside the ul.
   Do NOT reintroduce `:not()` in this file. */
@media (min-width: 821px) {
  .nav ul a { font-size: .93rem; font-weight: 500; color: var(--text); position: relative; padding: 4px 0; }
  .nav ul a::after {
    content: ''; position: absolute; left: 0; bottom: 0; height: 2px; width: 0;
    background: var(--accent); transition: width .2s ease;
  }
  .nav ul a:hover::after { width: 100%; }
  .nav ul a:hover { color: var(--accent); }
  .nav ul a.is-current { color: var(--accent); }
}

.burger { display: none; width: 42px; height: 42px; background: none; border: 1px solid var(--border-dk); border-radius: 10px; cursor: pointer; padding: 11px 10px; }
.burger span { display: block; height: 2px; background: var(--ink); border-radius: 2px; transition: .22s ease; }
.burger span + span { margin-top: 5px; }
.burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; background: var(--bg); padding: clamp(64px, 9vw, 116px) 0 clamp(72px, 10vw, 128px); }
.hero__bg { position: absolute; inset: 0; pointer-events: none; }

/* hero photograph — production cells in their assembly jig.
   Source is 1920x520; the hero is ~600px tall, so it is upscaled ~1.15x and
   will look soft on high-DPI. Swap in a taller source (e.g. 1920x900) if you have one.

   The mask below is what keeps the copy readable: the photo is faded to fully
   transparent across the left (where the headline and lede sit) and comes up to
   full strength on the right, behind the glass spec card. A mask is used rather
   than a white overlay so the fade follows the page background automatically.
   Without it, dark ink on this busy mid-tone photo is unreadable. */
.hero__photo {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: 62% 50%;
  mask-image: linear-gradient(94deg,
    transparent 0%, transparent 38%,
    rgba(0, 0, 0, .18) 50%, rgba(0, 0, 0, .48) 62%,
    rgba(0, 0, 0, .82) 76%, #000 90%);
  -webkit-mask-image: linear-gradient(94deg,
    transparent 0%, transparent 38%,
    rgba(0, 0, 0, .18) 50%, rgba(0, 0, 0, .48) 62%,
    rgba(0, 0, 0, .82) 76%, #000 90%);
}
.hero__grid { position: absolute; inset: 0; width: 100%; height: 100%; color: #E6F1F1; opacity: .85;
  mask-image: radial-gradient(120% 90% at 75% 15%, #000 20%, transparent 72%);
  -webkit-mask-image: radial-gradient(120% 90% at 75% 15%, #000 20%, transparent 72%); }
.hero__glow {
  position: absolute; top: -22%; right: -12%; width: 760px; height: 760px; border-radius: 50%;
  background: radial-gradient(circle, rgba(12, 132, 132, .16) 0%, rgba(24, 168, 168, .09) 42%, transparent 70%);
  filter: blur(12px);
}
.hero__inner { position: relative; display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(40px, 6vw, 80px); align-items: center; }
.hero__copy { max-width: 620px; }
.lede { font-size: clamp(1.02rem, 1.6vw, 1.16rem); color: var(--text-muted); line-height: 1.7; margin: 22px 0 0; }

.hero__actions { display: flex; gap: 14px; flex-wrap: wrap; margin: 34px 0 0; }

.hero__chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 38px; }
.hero__chips li {
  font-size: .78rem; font-weight: 600; letter-spacing: .03em;
  color: var(--text-muted); background: var(--bg-muted);
  border: 1px solid var(--border); border-radius: 999px; padding: 6px 13px;
}

/* hero visual */
.hero__visual { position: relative; display: flex; align-items: center; justify-content: center; min-height: 380px; }
/* drawn CSS cells — switched off because the hero background is now a real
   photograph of the same subject and the two double up.
   Change `none` back to `flex` to bring them back. */
.cell-stack { display: none; position: absolute; gap: 16px; transform: rotate(-10deg); opacity: .5; }
.cell {
  width: 62px; height: 260px; border-radius: 34px;
  background: linear-gradient(170deg, #DCE6F5, #EEF3FA);
  border: 1px solid var(--border-dk);
  display: flex; align-items: flex-end; justify-content: center; padding-bottom: 14px;
  box-shadow: inset 0 -30px 40px -30px rgba(10, 31, 31, .25);
}
.cell span { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); opacity: .35; }
.cell:nth-child(2) { height: 300px; }
.cell:nth-child(2) span { background: var(--cyan); }
.cell:nth-child(3) span { background: var(--green); }

.hero__card {
  position: relative; z-index: 2; width: min(320px, 100%);
  background: rgba(255, 255, 255, .82);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 8px; box-shadow: var(--shadow-lg);
}
.hero__card-row {
  display: flex; align-items: center; gap: 11px;
  padding: 13px 15px; font-size: .87rem; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.hero__card-row:last-child { border-bottom: 0; }
.hero__card-row strong { margin-left: auto; color: var(--ink); font-weight: 700; font-variant-numeric: tabular-nums; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot--green { background: var(--green); }
.dot--blue  { background: var(--accent); }
.dot--amber { background: var(--amber); }

/* ---------- stats ---------- */
.stats { background: var(--ink); color: #fff; }
.stats__grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.stat { padding: 34px 24px; text-align: center; border-right: 1px solid rgba(255, 255, 255, .09); }
.stat:last-child { border-right: 0; }
.stat strong { display: block; font-size: clamp(1.02rem, 1.75vw, 1.32rem); font-weight: 700; letter-spacing: -.02em; color: #fff; margin-bottom: 4px; }
.stat span { font-size: .82rem; color: #85A8A8; letter-spacing: .02em; }

/* ---------- generic section ---------- */
.section { padding: clamp(64px, 8vw, 108px) 0; }
.section--muted { background: var(--bg-muted); }
.section--dark { background: var(--ink); color: #fff; }
.section__head { max-width: 680px; margin-bottom: clamp(36px, 5vw, 56px); }
.section__head--light h2 { color: #fff; }
.section__head--light .eyebrow { color: var(--cyan); }
.section__head--light .eyebrow__dot { background: var(--cyan); box-shadow: 0 0 0 4px rgba(24, 168, 168, .16); }
.section__head--light .section__sub { color: #97B5B5; }
.section__sub { color: var(--text-muted); font-size: 1.02rem; margin: 16px 0 0; }

/* ---------- product cards ---------- */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.cards--4 { grid-template-columns: repeat(4, 1fr); gap: 20px; }
.card {
  background: #fff; border: 1px solid var(--border); border-radius: var(--r);
  padding: 30px 26px; transition: .22s ease;
}
.cards--4 .card { padding: 20px 20px 24px; }
.card:hover { border-color: var(--accent); box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.card__media {
  aspect-ratio: 1 / 1; border-radius: 10px; margin-bottom: 22px;
  background: linear-gradient(150deg, #E7F5F5 0%, #F5FAFA 100%);
  border: 1px solid var(--border);
  display: grid; place-items: center; overflow: hidden;
}
.card__media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card__body h3 { margin-bottom: 10px; color: var(--ink); }
.card__body p { font-size: .93rem; color: var(--text-muted); line-height: 1.65; }
.cards--4 .card__body h3 { font-size: 1rem; }
.cards--4 .card__body p { font-size: .88rem; }
.card h3 { margin-bottom: 10px; color: var(--ink); }
.card p { font-size: .93rem; color: var(--text-muted); line-height: 1.65; }
.card__specs { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--border); }
.card__specs li {
  font-size: .77rem; font-weight: 600; color: var(--accent);
  background: var(--accent-lt); border-radius: 6px; padding: 4px 9px;
}

/* ---------- applications ---------- */
.apps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.app { background: #fff; padding: 26px 22px; transition: .2s; }
.app:hover { background: var(--ink); }
.app:hover h3 { color: #fff; }
.app:hover .app__n { color: var(--cyan); }
.app__n { display: block; font-size: .72rem; font-weight: 700; color: var(--text-soft); letter-spacing: .08em; margin-bottom: 10px; transition: .2s; }
.app h3 { font-size: .95rem; font-weight: 600; color: var(--ink); transition: .2s; }

/* ---------- process ---------- */
.process { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; counter-reset: step; }
.step { background: rgba(255, 255, 255, .04); border: 1px solid rgba(255, 255, 255, .1); border-radius: var(--r); padding: 26px 24px; }
.step__n { display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .08em; color: var(--cyan); margin-bottom: 12px; }
.step h3 { color: #fff; font-size: 1.02rem; margin-bottom: 9px; }
.step p { font-size: .9rem; color: #97B5B5; margin: 0; line-height: 1.62; }

/* ---------- certifications ---------- */
.certs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.certs li {
  border: 1px solid var(--border); border-radius: var(--r-sm); padding: 20px 18px;
  background: #fff; transition: .2s;
}
.certs li:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.certs strong { display: block; font-size: .98rem; color: var(--ink); margin-bottom: 3px; letter-spacing: -.01em; }
.certs span { font-size: .8rem; color: var(--text-soft); }

/* document-style cert cards: tag + reference + issuer */
.certs--docs { grid-template-columns: repeat(3, 1fr); }
.certs--docs li { display: flex; flex-direction: column; padding: 22px 20px; }
.certs__tag {
  align-self: flex-start;
  font-size: .67rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-lt); border-radius: 5px;
  padding: 3px 8px; margin-bottom: 11px;
}
.certs--docs strong { font-size: 1.02rem; margin-bottom: 8px; }
.certs--docs .certs__meta { display: block; font-size: .81rem; color: var(--text-soft); line-height: 1.55; }
.certs--docs .certs__meta:last-child { color: var(--text-muted); font-weight: 500; margin-top: 3px; }

/* ---------- about ---------- */
.about { display: grid; grid-template-columns: 1.15fr .85fr; gap: clamp(36px, 5vw, 72px); align-items: start; }
.about__copy p { color: var(--text-muted); line-height: 1.75; }
.about__copy .btn { margin-top: 12px; }
.about__panel { background: #fff; border: 1px solid var(--border); border-radius: var(--r); padding: 30px 28px; box-shadow: var(--shadow); }
.about__panel h3 { color: var(--ink); margin-bottom: 18px; font-size: 1rem; }
.ticks li { position: relative; padding-left: 28px; font-size: .93rem; color: var(--text-muted); margin-bottom: 12px; }
.ticks li:last-child { margin-bottom: 0; }
.ticks li::before {
  content: ''; position: absolute; left: 0; top: .42em;
  width: 15px; height: 9px; border-left: 2px solid var(--green); border-bottom: 2px solid var(--green);
  transform: rotate(-45deg);
}

/* ---------- contact ---------- */
.contact { display: grid; grid-template-columns: 1fr 1.1fr; gap: clamp(36px, 5vw, 72px); align-items: start; }
.contact__list { margin-top: 34px; }
.contact__list li { display: flex; gap: 18px; padding: 15px 0; border-bottom: 1px solid var(--border); }
.contact__list li:first-child { border-top: 1px solid var(--border); }
.contact__k { flex: none; width: 78px; font-size: .82rem; font-weight: 600; color: var(--text-soft); letter-spacing: .04em; text-transform: uppercase; padding-top: 2px; }
.contact__list a:hover { color: var(--accent); }

.form { background: #fff; border: 1px solid var(--border); border-radius: var(--r); padding: clamp(24px, 3vw, 34px); box-shadow: var(--shadow); }
.form__row { margin-bottom: 18px; }
.form__row--2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.form label { display: block; font-size: .85rem; font-weight: 600; color: var(--ink); margin-bottom: 7px; }
.form label span { color: var(--accent); }
.form input, .form select, .form textarea {
  /* 1rem, not .94rem: iOS Safari force-zooms the viewport when a focused form control
     is under 16px, and does not zoom back out on blur. .btn stays at .94rem — buttons
     do not receive focus-zoom. */
  width: 100%; padding: 11px 14px; font-family: inherit; font-size: 1rem; color: var(--text);
  background: var(--bg-muted); border: 1px solid var(--border); border-radius: var(--r-sm);
  transition: .16s;
}
.form textarea { resize: vertical; min-height: 110px; }
.form input:focus, .form select:focus, .form textarea:focus {
  outline: none; border-color: var(--accent); background: #fff;
  box-shadow: 0 0 0 3px rgba(12, 132, 132, .12);
}
.form input:user-invalid, .form textarea:user-invalid { border-color: #DC2626; }
.form__note { margin: 14px 0 0; font-size: .86rem; text-align: center; color: var(--text-muted); min-height: 1.2em; }
.form__note.is-ok { color: var(--green); font-weight: 600; }
.form__note.is-err { color: #DC2626; font-weight: 600; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- footer ---------- */
.footer { background: var(--ink); color: #97B5B5; padding: clamp(52px, 6vw, 76px) 0 0; font-size: .9rem; }
.footer__inner { display: grid; grid-template-columns: 1.3fr 2fr; gap: clamp(36px, 5vw, 72px); padding-bottom: 48px; }
.footer__brand p { color: #7D9E9E; max-width: 320px; margin-top: 18px; font-size: .88rem; line-height: 1.7; }
.footer__nav { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.footer__nav h4 { color: #fff; font-size: .86rem; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 16px; }
.footer__nav li { margin-bottom: 11px; }
.footer__nav a { color: #97B5B5; font-size: .89rem; }
.footer__nav a:hover { color: #fff; }
.footer__bottom {
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  border-top: 1px solid rgba(255, 255, 255, .09); padding-top: 24px;
  padding-bottom: max(30px, env(safe-area-inset-bottom));
  font-size: .82rem; color: #6B8F8F;
}
.footer__bottom p { margin: 0; }

/* ---------- reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s ease, transform .6s ease; }
.reveal.is-in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ============================================================
   responsive
   ============================================================ */
@media (max-width: 1024px) {
  .cards, .process { grid-template-columns: repeat(2, 1fr); }
  /* .apps holds exactly 10 items. Only 1 / 2 / 5 / 10 columns divide evenly — 3 columns
     left two empty cells that showed the container's #E3EDED through, as grey holes
     across the whole 641-1024px range. Adding an 11th item breaks this again. */
  .apps { grid-template-columns: repeat(2, 1fr); }
  .certs { grid-template-columns: repeat(2, 1fr); }
  .hero__inner { grid-template-columns: 1fr; }
  /* .cell-stack is display:none and the spec card is only ~190px tall, so the 300px
     floor left ~324px of empty space in the middle of the page. */
  .hero__visual { min-height: 0; margin-top: 24px; }

  /* Single column: stop the photo filling the hero's full height. Stacked, the hero is
     ~1000px tall, and `cover` on a source that is only 520px tall scaled it 1.92x and
     cropped it to a ~10% vertical slice — on a 2x screen that is 3.85x, a smear.
     As a band along the bottom edge the geometry works out to roughly 1:1, and it
     stays clear of the copy without needing a scrim. */
  .hero__photo {
    top: auto; bottom: 0; height: 260px;
    object-position: 58% 50%;
    /* softens the band's top edge into the white above it */
    mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, .55) 34%, #000 72%);
    -webkit-mask-image: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, .55) 34%, #000 72%);
  }
  .about, .contact { grid-template-columns: 1fr; }
  .footer__inner { grid-template-columns: 1fr; }
}

/* 820.98, not 820: browser zoom reports fractional widths, and a 820 < w < 821 viewport
   would match neither this block nor the min-width: 821px one, losing all nav styling. */
@media (max-width: 820.98px) {
  .burger { display: block; }
  .nav {
    position: fixed; inset: var(--header-h) 0 auto; flex-direction: column; align-items: stretch; gap: 0;
    background: #fff; border-bottom: 1px solid var(--border);
    padding: 16px max(var(--gutter), env(safe-area-inset-left)) 26px; box-shadow: var(--shadow-lg);
    transform: translateY(-12px); opacity: 0; visibility: hidden; pointer-events: none;
    transition: .22s ease; overflow-y: auto; overscroll-behavior: contain;
    /* subtract both bars: at scroll 0 the topbar sits above the header, so measuring
       against the viewport alone left the last item (the CTA) unreachable. */
    max-height: calc(100vh - var(--header-h) - var(--topbar-h));   /* fallback for iOS < 15.4 */
    max-height: calc(100dvh - var(--header-h) - var(--topbar-h));
  }
  .nav.is-open { transform: none; opacity: 1; visibility: visible; pointer-events: auto; }

  /* Scrim behind the open drawer. A pseudo-element rather than a real node, so the
     English and Chinese pages do not each need another div. z-index 90 sits under
     .header (100), keeping the burger clickable; pointer-events:none lets a tap fall
     through to the document listener in script.js that closes the drawer. */
  body::after {
    content: ''; position: fixed; inset: 0; z-index: 90;
    background: rgba(10, 31, 31, .42);
    opacity: 0; pointer-events: none; transition: opacity .22s ease;
  }
  html.nav-open body::after { opacity: 1; }
  html.nav-open, html.nav-open body { overflow: hidden; }
  .nav ul { flex-direction: column; gap: 0; }
  .nav ul li { border-bottom: 1px solid var(--border); }
  /* 56px tap target. font-weight must be repeated here: the desktop rule that used to
     supply it now lives inside `min-width: 821px` and no longer reaches this breakpoint. */
  .nav ul a { display: block; padding: 15px 2px; font-size: 1rem; font-weight: 500; }
  .nav__cta { margin-top: 20px; align-self: flex-start; }
  .topbar__badge { display: none; }
  .stats__grid { grid-template-columns: repeat(2, 1fr); }
  .stat:nth-child(2) { border-right: 0; }
  .stat:nth-child(1), .stat:nth-child(2) { border-bottom: 1px solid rgba(255, 255, 255, .09); }
}

@media (max-width: 640px) {
  .cards, .process, .apps, .certs { grid-template-columns: 1fr; }
  /* keep product cards 2-up so square photos don't become full-width */
  .cards--4 { grid-template-columns: repeat(2, 1fr); }
  .cards--4 .card { padding: 14px 14px 18px; }
  /* Clamp rather than hide: display:none was removing every product description on
     phones, including from the accessibility tree, halving what this section says. */
  .cards--4 .card__body p {
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  }
  .stat { padding: 22px 12px; }
  .apps { gap: 1px; }
  .form__row--2 { grid-template-columns: 1fr; }
  /* 3 groups of links, so a 2-column grid orphaned the third on its own row */
  .footer__nav { grid-template-columns: 1fr; }
  .footer__nav li { margin-bottom: 0; }
  .footer__nav a { display: block; padding: 9px 0; }
  /* the address has no break opportunity and pushed the grid wider than the viewport
     (horizontal scroll) below ~340px */
  .footer__nav a[href^="mailto"] { overflow-wrap: anywhere; }
  /* the language switch added a second child to .topbar__inner; at narrow widths the
     two no longer fit side by side, and the default nowrap would overflow the viewport
     and create horizontal scroll. Let it wrap to a second centred row instead. */
  .topbar__inner { justify-content: center; flex-wrap: wrap; row-gap: 0; }
  /* tightened so both links still fit on one line at 320px now that each carries a
     44px tap target — verify on a real 320px device */
  .topbar__contact { gap: 12px; font-size: .74rem; }
  .hero__chips { margin-top: 28px; }
  .contact__list li { flex-direction: column; gap: 3px; }
  .contact__k { width: auto; }
  .logo__img { height: 34px; }
  /* the footer logo rule is `.logo--footer .logo__img` (0,2,0) and outranked the line
     above, so the footer mark stayed at 46px on phones. Repeat it at this breakpoint. */
  .logo--footer .logo__img { height: 34px; }
}
