/* OurBrewbot website - shared styles.
   Colours match the device's own admin UI (OurBrewbot/WebAdmin.cpp). */

:root {
  --bg: #1a1a2e;
  --panel: #16213e;
  --panel-2: #0f3460;
  --border: #243b6b;
  --text: #e6e8f0;
  --muted: #a3abc2;
  --accent: #e94560;
  --accent-hover: #c73650;
  --cyan: #53d8fb;
  --warn-bg: #4a2a00;
  --warn-border: #b36b00;
  --radius: 10px;
  --max-width: 1040px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
}

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

a:hover {
  color: #fff;
}

code,
pre {
  font-family: var(--mono);
  font-size: 0.9em;
}

code {
  background: var(--panel-2);
  padding: 0.1em 0.35em;
  border-radius: 4px;
}

pre {
  background: #0c1426;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  overflow-x: auto;
}

pre code {
  background: none;
  padding: 0;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0 0 0.5em;
}

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

h3 {
  font-size: 1.2rem;
}

/* ---------- Layout ---------- */

.wrap {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 16px;
}

section {
  padding: 56px 0;
}

section + section {
  border-top: 1px solid var(--border);
}

.lead {
  font-size: 1.15rem;
  color: var(--muted);
  max-width: 44em;
}

/* ---------- Header / nav ---------- */

.site-header {
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.15rem;
}

.brand img {
  width: 28px;
  height: 28px;
}

.site-nav {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 6px;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: #fff;
  background: var(--panel-2);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  border: 2px solid transparent;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
  color: #fff;
}

.btn-secondary {
  border-color: var(--cyan);
  color: var(--cyan);
}

.btn-secondary:hover {
  background: var(--panel-2);
  color: #fff;
}

.btn-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 28px;
}

/* ---------- Hero ---------- */

.hero {
  padding: 72px 0 64px;
}

.hero .wrap {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 48px;
  align-items: center;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3rem);
}

.hero h1 span {
  color: var(--accent);
}

/* A mock of the admin UI's fermenter card, drawn in HTML */
.mock-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.mock-card .mock-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.mock-card .mock-title strong {
  font-size: 1.05rem;
}

.mock-temp {
  font-size: 2.6rem;
  font-weight: 700;
  color: var(--cyan);
  line-height: 1;
}

.mock-sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin: 4px 0 16px;
}

.mock-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mock-grid div {
  background: var(--bg);
  border-radius: 8px;
  padding: 8px 10px;
}

.mock-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
}

.mock-grid b {
  font-size: 1rem;
}

.badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.badge-cool {
  background: var(--panel-2);
  color: var(--cyan);
}

/* ---------- Feature grid ---------- */

.features {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-top: 32px;
}

.feature {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.feature h3 {
  color: #fff;
}

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

/* ---------- Content blocks ---------- */

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin: 24px 0;
}

.notice {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius);
  padding: 14px 18px;
  margin: 20px 0;
}

.notice strong {
  color: #ffc46b;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.steps {
  padding-left: 1.3em;
}

.steps li {
  margin-bottom: 10px;
}

.check-list {
  list-style: none;
  padding: 0;
}

.check-list li {
  padding-left: 1.6em;
  position: relative;
  margin-bottom: 6px;
}

.check-list li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: var(--cyan);
  font-weight: 700;
}

.cross-list li::before {
  content: "\2715";
  color: var(--accent);
}

/* ---------- Tables ---------- */

.table-scroll {
  overflow-x: auto;
  margin: 16px 0;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
}

th,
td {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
  background: var(--panel);
}

.method {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: 700;
}

.method-get {
  color: var(--cyan);
}

.method-post {
  color: var(--accent);
}

/* ---------- Installer ---------- */

.installer {
  text-align: center;
  padding: 32px 24px;
}

.installer .version {
  color: var(--muted);
  margin: 12px 0 0;
}

/* The ESP Web Tools button is styled through its CSS custom properties */
esp-web-install-button {
  --esp-tools-button-color: var(--accent);
  --esp-tools-button-text-color: #fff;
  --esp-tools-button-border-radius: 8px;
}

.install-button {
  font: inherit;
  font-size: 1.1rem;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 14px 28px;
  cursor: pointer;
}

.install-button:hover {
  background: var(--accent-hover);
}

.unsupported {
  color: #ffc46b;
}

/* ---------- Docs page ---------- */

.docs-layout {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 40px;
  /* Top and bottom only - .wrap supplies the side gutters */
  padding-top: 40px;
  padding-bottom: 40px;
}

.docs-toc {
  position: sticky;
  top: 80px;
  align-self: start;
  font-size: 0.95rem;
}

.docs-toc ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.docs-toc a {
  display: block;
  color: var(--muted);
  text-decoration: none;
  padding: 4px 0;
}

.docs-toc a:hover {
  color: #fff;
}

.docs-content section {
  padding: 32px 0;
  scroll-margin-top: 70px;
}

.docs-content section:first-child {
  padding-top: 0;
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--panel);
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
  padding: 28px 0;
}

.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* ---------- Stats page (private, /stats/) ---------- */

.stats {
  padding-top: 40px;
  padding-bottom: 40px;
}

.stats section {
  padding: 24px 0;
  border-top: none;
}

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.stat-tile {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}

.stat-tile span,
.stat-tile small {
  display: block;
  color: var(--muted);
}

.stat-tile b {
  display: block;
  font-size: 2.2rem;
  color: var(--cyan);
  line-height: 1.2;
}

.crash {
  margin: 12px 0;
  padding: 12px 16px;
}

.crash summary {
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.9rem;
}

.small-button {
  font-size: 0.9rem;
  padding: 8px 16px;
}

/* ---------- Small screens ---------- */

@media (max-width: 800px) {
  .hero .wrap,
  .two-col,
  .docs-layout {
    grid-template-columns: 1fr;
  }

  .hero {
    padding: 48px 0;
  }

  .docs-toc {
    position: static;
  }

  .docs-toc ul {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 16px;
  }

  section {
    padding: 40px 0;
  }
}
