:root {
  --bg: #e9f5ec;
  --surface: #ffffff;
  --surface-2: #eef8f1;
  --border: #bfdcc9;
  --border-strong: #6ea885;
  --text: #16261e;
  --muted: #57705f;
  --accent: #d9622b;
  --accent-ink: #fff9f4;
  --accent-soft: #f7ddca;
  --focus: #128a48;
  --shadow: 0 8px 24px -12px rgba(15, 40, 26, 0.25);

  --font-display: "Barlow Semi Condensed", "Arial Narrow", sans-serif;
  --font-body: "IBM Plex Sans", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "Courier New", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f2419;
    --surface: #163324;
    --surface-2: #1b3e2c;
    --border: #2d5940;
    --border-strong: #437759;
    --text: #e9f6ee;
    --muted: #9bc2ab;
    --accent: #f2934d;
    --accent-ink: #1b2a38;
    --accent-soft: #4a3520;
    --focus: #4ade80;
    --shadow: 0 8px 28px -10px rgba(0, 0, 0, 0.55);
  }
}

* { box-sizing: border-box; }

html, body {
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--text);
  font-family: var(--font-body);
  line-height: 1.55;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 32px 32px;
  background-attachment: fixed;
  background-position: -1px -1px;
}

@media (prefers-color-scheme: dark) {
  body { background-image:
      linear-gradient(rgba(255,255,255,0.05) 1px, transparent 1px),
      linear-gradient(90deg, rgba(255,255,255,0.05) 1px, transparent 1px);
  }
}

a { color: var(--focus); }

h1, h2 {
  font-family: var(--font-display);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  text-wrap: balance;
  margin: 0;
}

/* ---------- header ---------- */

header.site {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  background: var(--surface);
  border-bottom: 2px solid var(--border-strong);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--text);
  order: 1;
  flex-shrink: 0;
}

.brand-logo {
  display: block;
  height: 2.5rem;
  width: auto;
}

.brand-tagline {
  display: none;
  padding-left: 0.85rem;
  border-left: 1.5px solid var(--border-strong);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  white-space: nowrap;
}

@media (min-width: 640px) {
  .brand-tagline { display: inline-block; }
}

/* ---------- language dropdown ---------- */

.lang-select {
  position: relative;
  order: 2;
  flex-shrink: 0;
  margin-left: auto;
}

@media (min-width: 640px) {
  .lang-select { order: 3; margin-left: 0; }
}

.lang-select-trigger {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--surface-2);
  color: var(--text);
  border: 1.5px solid var(--border-strong);
  border-radius: 6px;
  padding: 0.4rem 0.6rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  cursor: pointer;
}

.lang-select-trigger:hover { border-color: var(--accent); }
.lang-select-trigger:focus-visible,
.lang-select-list [data-lang-option]:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.lang-select-trigger .code { font-weight: 600; letter-spacing: 0.04em; }
.lang-select-trigger .chev { color: var(--muted); }

.flag svg {
  display: block;
  width: 1.35em;
  height: 0.9em;
  border-radius: 2px;
  box-shadow: 0 0 0 1px var(--border-strong);
}

.lang-select-list {
  position: absolute;
  right: 0;
  top: calc(100% + 0.4rem);
  min-width: 10rem;
  margin: 0;
  padding: 0.35rem;
  list-style: none;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: var(--shadow);
  z-index: 10;
}

.lang-select-list[hidden] { display: none; }

.lang-select-list li {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.6rem;
  border-radius: 5px;
  cursor: pointer;
  font-size: 0.9rem;
}

.lang-select-list li:hover,
.lang-select-list li:focus-visible {
  background: var(--accent-soft);
}

.lang-select-list li[aria-selected="true"] {
  font-weight: 600;
  color: var(--accent);
}

.lang-select-list .flag { font-size: 1.05rem; }

/* ---------- layout ---------- */

main {
  max-width: 760px;
  margin: 0 auto;
  padding: 2.25rem 1.25rem 3.5rem;
}

.page-home h1 { font-size: 1.9rem; }

.lede {
  color: var(--muted);
  max-width: 46ch;
  margin: 0.6rem 0 1.75rem;
}

/* ---------- navbar search ---------- */

.nav-search {
  position: relative;
  order: 3;
  flex: 1 1 220px;
  min-width: 0;
}

@media (min-width: 640px) {
  .nav-search { order: 2; flex: 0 1 280px; margin-left: auto; }
}

.nav-search-field {
  position: relative;
}

.nav-search-field .search-icon {
  position: absolute;
  left: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.nav-search-field input {
  width: 100%;
  padding: 0.5rem 0.75rem 0.5rem 2.1rem;
  font-size: 0.92rem;
  font-family: var(--font-body);
  border-radius: 6px;
  border: 1.5px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
}

.nav-search-field input:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

.nav-search-panel {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.4rem);
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 0.4rem;
  z-index: 20;
  max-height: 60vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.nav-search-panel[hidden] { display: none; }

.result-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.7rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  color: var(--text);
  font-size: 0.9rem;
}

.result-item:hover,
.result-item:focus-visible { border-color: var(--accent); }

.result-item .code {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 4px;
  padding: 0.2rem 0.4rem;
  letter-spacing: 0.03em;
  flex-shrink: 0;
}

.nav-search-panel .empty-state {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 0.5rem 0.4rem;
}

/* ---------- shared "technical frame" ---------- */

.frame {
  position: relative;
  background: var(--surface);
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  padding: 1.25rem;
}

.frame::before,
.frame::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
  border: 1.5px solid var(--border-strong);
  top: -1.5px;
}

.frame::before { left: -1.5px; border-right: none; border-bottom: none; }
.frame::after { right: -1.5px; border-left: none; border-bottom: none; }

.section-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin: 2rem 0 0.6rem;
}

/* ---------- product page ---------- */

.back-link {
  display: inline-block;
  font-size: 0.85rem;
  margin-bottom: 1.25rem;
  text-decoration: none;
}

.product-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.85rem 1.1rem;
}

.part-number {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 5px;
  padding: 0.45rem 0.6rem;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.product-head-text h1 { font-size: 1.4rem; margin-bottom: 0.4rem; }
.product-head-text p { margin: 0; color: var(--muted); }

.video-wrap {
  position: relative;
  padding: 0;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}

.video-wrap iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.table-scroll {
  overflow-x: auto;
}

table.specs {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

table.specs tr:nth-child(even) .spec-label,
table.specs tr:nth-child(even) .spec-value {
  background: var(--surface-2);
}

table.specs td {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px dashed var(--border);
}

.spec-label {
  color: var(--muted);
  width: 50%;
  font-size: 0.9rem;
}

.spec-value {
  font-family: var(--font-mono);
  font-weight: 500;
}

/* ---------- 404 ---------- */

.not-found {
  text-align: center;
  padding: 2.5rem 1.5rem;
}

.not-found h1 { font-size: 1.3rem; margin-bottom: 0.6rem; }
.not-found p { color: var(--muted); }

/* ---------- footer ---------- */

footer.site {
  text-align: center;
  padding: 2rem 1rem 2.5rem;
}

.footnote {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  letter-spacing: 0.03em;
}

/* ---------- language-scoped visibility ---------- */

[data-lang-block] { display: none; }
[data-lang-block].active { display: block; }
span[data-lang-block].active { display: inline; }

@media (prefers-reduced-motion: no-preference) {
  .result-item, .lang-select-trigger { transition: border-color 0.15s ease; }
}
