:root {
  color-scheme: light;
  --background: #f6f8f7;
  --surface: #ffffff;
  --text: #1b2522;
  --muted: #53635d;
  --border: #d8e0dc;
  --accent: #005f73;
  --accent-strong: #003f4d;
  --focus: #b0005a;
  --shadow: 0 16px 36px rgba(24, 41, 37, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 100%;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.65;
}

a {
  color: var(--accent);
  font-weight: 700;
  text-underline-offset: 0.18em;
}

a:hover {
  color: var(--accent-strong);
}

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

.container {
  width: min(100% - 2rem, 900px);
  margin: 0 auto;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0;
}

.site-name {
  color: var(--text);
  font-size: 1.2rem;
  font-weight: 800;
  text-decoration: none;
}

.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  align-items: center;
  justify-content: flex-end;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: inline-block;
  padding: 0.25rem 0;
}

.site-nav a[aria-current="page"] {
  color: var(--text);
  text-decoration-thickness: 0.16em;
}

.hero,
.page-intro {
  padding: 4.5rem 0 3.5rem;
}

.eyebrow {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  line-height: 1.2;
}

h1 {
  max-width: 12ch;
  margin: 0 0 1rem;
  font-size: clamp(2.5rem, 8vw, 4.25rem);
}

h2 {
  margin: 0 0 1.25rem;
  font-size: 1.8rem;
}

h3 {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
}

p {
  max-width: 68ch;
}

.intro {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 1.25rem;
  line-height: 1.55;
}

.language-switcher {
  margin-top: 1.5rem;
}

.language-switcher ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.language-switcher a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.55rem 0.85rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.35rem;
  text-decoration-thickness: 0.08em;
}

.language-switcher a[aria-current="page"] {
  color: var(--text);
  border-color: var(--accent);
  text-decoration-thickness: 0.16em;
}

.projects {
  padding: 0 0 4.5rem;
}

.content-section {
  padding: 0 0 4.5rem;
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.project-card {
  min-height: 12rem;
  padding: 1.35rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  box-shadow: var(--shadow);
}

.project-card p {
  margin-bottom: 0;
}

.feature-grid,
.example-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.feature-card {
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  box-shadow: var(--shadow);
}

.feature-card p {
  margin-bottom: 0;
}

.table-wrap {
  margin: 1.5rem 0;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
}

.support-table {
  width: 100%;
  min-width: 46rem;
  border-collapse: collapse;
}

.support-table th,
.support-table td {
  padding: 0.85rem 1rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}

.support-table th {
  color: var(--accent-strong);
  background: #edf4f2;
  font-size: 0.95rem;
}

.support-table tr:last-child td {
  border-bottom: 0;
}

.keypad-layout {
  display: grid;
  grid-template-columns: repeat(4, 3.25rem);
  gap: 0.45rem;
  width: max-content;
  margin: 1.5rem 0;
}

.keypad-layout span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  color: var(--accent-strong);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.35rem;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(24, 41, 37, 0.06);
}

.steps {
  padding-left: 1.35rem;
}

.steps li + li {
  margin-top: 0.35rem;
}

.back-link {
  display: inline-block;
  margin-top: 1rem;
}

.notice,
.tool-panel {
  margin: 1.5rem 0;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
}

.notice {
  border-left: 0.35rem solid var(--accent);
}

.notice p,
.tool-panel p {
  margin-top: 0;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin: 1rem 0;
}

.button,
esp-web-install-button::part(button) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0.65rem 1rem;
  color: #ffffff;
  background: var(--accent);
  border: 2px solid var(--accent);
  border-radius: 0.35rem;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.button:hover,
esp-web-install-button::part(button):hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.status-text {
  margin: 1rem 0;
  font-weight: 700;
}

.button-secondary {
  color: var(--accent);
  background: var(--surface);
}

.button-secondary:hover {
  color: #ffffff;
  background: var(--accent-strong);
}

.button-small,
esp-web-install-button .button-small {
  min-height: 2.35rem;
  padding: 0.45rem 0.75rem;
  font-size: 0.95rem;
}

.manual-update {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.protected-download {
  margin-top: 1rem;
  padding: 1rem;
  background: #f7fbfa;
  border: 1px solid var(--border);
  border-left: 0.35rem solid var(--focus);
  border-radius: 0.5rem;
}

.protected-download h4 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  line-height: 1.25;
}

.protected-download p {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.98rem;
}

.manual-update p {
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.98rem;
}

.serial-output {
  min-height: 14rem;
  max-height: 28rem;
  overflow: auto;
  padding: 1rem;
  color: #f7fff9;
  background: #17211d;
  border-radius: 0.35rem;
  white-space: pre-wrap;
}

.serial-output:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}

.diagnostic-report {
  min-height: 10rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.site-footer .container {
  padding: 1.25rem 0;
}

.site-footer p {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 680px) {
  body {
    font-size: 1rem;
  }

  .site-header .container {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-nav ul {
    justify-content: flex-start;
  }

  .hero,
  .page-intro {
    padding: 3rem 0 2.5rem;
  }

  .intro {
    font-size: 1.12rem;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .feature-grid,
  .example-grid {
    grid-template-columns: 1fr;
  }

  .keypad-layout {
    grid-template-columns: repeat(4, minmax(2.75rem, 1fr));
    width: min(100%, 15rem);
  }
}
