/* The Wi-Fi setup page. */

/* ==== Theme ==========================================================
   Everything that makes the page look like one particular space is in
   this block: colours, fonts, sizes, corners, shadows. The values are
   the built-in default. To restyle the page,
   change them here; the rules below the block only use them. */

@font-face {
  font-family: "Rajdhani";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("rajdhani-semibold.94bbd25a18ca6659.ttf") format("truetype");
}

@font-face {
  font-family: "Saira";
  font-style: normal;
  font-weight: 100 900;
  font-stretch: 50% 125%;
  font-display: swap;
  src: url("saira.9d050fc5a01c85f7.ttf") format("truetype");
}

:root {
  color-scheme: light dark;

  --color-bg: #f5f5f5;
  --color-surface: #ffffff;
  --color-surface-2: #f5f5f5;
  --color-field: #ffffff;
  --color-text: #222222;
  --color-heading: #111111;
  --color-text-muted: #505050;
  /* The brand red is for decoration and for large text only: white on it,
     or it on the page at body size, is under 4.5:1. */
  --color-brand: #e13838;
  --color-primary: #d32f2f;
  --color-primary-hover: #c62828;
  --color-on-primary: #ffffff;
  --color-accent-text: #c62828;
  --color-link: #c62828;
  --color-border: #8a8a8a;
  --color-divider: #ececec;
  --color-focus: #111111;
  --color-error: #c62828;
  --color-error-bg: #fdf0ef;
  --color-disabled-bg: #dcdcdc;
  --color-disabled-text: #505050;
  --color-hero-tint: #6d3bdb2e;
  --color-footer-bg: #000000;
  --color-footer-text: #ffffff;

  --font-heading: "Rajdhani", "Avenir Next Condensed", "Roboto Condensed", "Arial Narrow", system-ui, sans-serif;
  --font-body: "Saira", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --text-title: 2.25rem;
  --text-title-wide: 3.375rem;
  --text-h2: 1.5rem;
  --text-eyebrow: 1.25rem;
  --text-summary: 1.125rem;
  --text-body: 1rem;
  --text-button: 1rem;
  --text-label: 0.875rem;
  --text-chip: 0.9375rem;
  --text-small: 0.8125rem;

  --weight-regular: 400;
  --weight-medium: 500;
  --weight-semibold: 600;

  --leading-title: 1.15;
  --leading-heading: 1.2;
  --leading-body: 1.6;
  --leading-tight: 1.5;

  --tracking-button: 0.8px;
  --tracking-label: 0.8px;
  --tracking-wordmark: 1px;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 15px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 40px;

  --shadow-card: 0 0 1px rgba(0, 0, 0, 0.04), 0 0 2px rgba(0, 0, 0, 0.04), 0 0 3px rgba(0, 0, 0, 0.02),
    0 0 5px rgba(0, 0, 0, 0.03);
  --shadow-open: 0 0 0 2px var(--color-brand), 0 6px 16px rgba(0, 0, 0, 0.06);

  --content-max: 560px;
  --page-gutter: 20px;
  --tap-min: 44px;
}

/* The light theme had no dark counterpart; this one is built on the colours of its
   announcement banner. */
@media (prefers-color-scheme: dark) {
  :root {
    --color-bg: #141418;
    --color-surface: #1f1f26;
    --color-surface-2: #141418;
    --color-field: #141418;
    --color-text: #f2f2f2;
    --color-heading: #ffffff;
    --color-text-muted: #b9b6c4;
    --color-accent-text: #ff6b63;
    --color-link: #ff6b63;
    --color-border: #858294;
    --color-divider: #33323c;
    --color-focus: #b794f6;
    --color-error: #ff8a80;
    --color-error-bg: #2a1516;
    --color-disabled-bg: #33323c;
    --color-disabled-text: #a5a2b0;
    --color-hero-tint: #231a2e;
    --shadow-card: 0 0 0 1px rgba(255, 255, 255, 0.06);
    --shadow-open: 0 0 0 2px var(--color-brand), 0 6px 16px rgba(0, 0, 0, 0.5);
  }
}

/* ==== End of theme =================================================== */

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

/* The script and the markup show and hide with the hidden attribute. */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  display: grid;
  grid-template-rows: auto 1fr auto;
  grid-template-columns: minmax(0, 1fr);
  min-height: 100vh;
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font: var(--weight-regular) var(--text-body) / var(--leading-body) var(--font-body);
}

p,
ol,
dl,
pre,
h1,
h2,
h3 {
  margin: 0;
}

a {
  color: var(--color-link);
  text-decoration: underline;
  text-underline-offset: 3px;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.column {
  width: 100%;
  max-width: calc(var(--content-max) + 2 * var(--page-gutter));
  margin-right: auto;
  margin-left: auto;
  padding-right: var(--page-gutter);
  padding-left: var(--page-gutter);
}

/* ---- Header and title ---- */

.top {
  background: linear-gradient(0deg, var(--color-hero-tint) 10%, var(--color-bg) 45%, var(--color-bg) 100%);
}

.site-header {
  display: flex;
  align-items: center;
  padding: var(--space-5) 0;
}

/* The logo carries its own background. No plate, no rounding, no filter. */
.site-logo {
  display: block;
  flex: none;
  width: 40px;
  height: 40px;
  margin-right: var(--space-3);
}

.wordmark {
  overflow: hidden;
  color: var(--color-heading);
  font: var(--weight-medium) 1.125rem/40px var(--font-body);
  letter-spacing: var(--tracking-wordmark);
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.hero {
  padding: var(--space-8) 0;
  text-align: center;
}

.chip {
  display: inline-block;
  margin-bottom: var(--space-4);
  padding: 3px 10px 2px;
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font: var(--weight-semibold) var(--text-chip) / var(--leading-tight) var(--font-heading);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

h1 {
  margin-bottom: 14px;
  color: var(--color-heading);
  font: var(--weight-semibold) var(--text-title) / var(--leading-title) var(--font-heading);
  overflow-wrap: anywhere;
}

/* Large text only: the brand red is 3.99:1 on the page. */
h1 .accent {
  color: var(--color-brand);
}

.nowrap {
  white-space: nowrap;
}

.intro {
  font-size: var(--text-summary);
}

/* ---- Blocks ---- */

main {
  padding-top: var(--space-6);
  padding-bottom: var(--space-8);
}

main > * + * {
  margin-top: var(--space-8);
}

.eyebrow {
  margin-bottom: var(--space-2);
  color: var(--color-accent-text);
  font: var(--weight-semibold) var(--text-eyebrow) / var(--leading-heading) var(--font-heading);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

h2 {
  margin-bottom: var(--space-5);
  color: var(--color-heading);
  font: var(--weight-semibold) var(--text-h2) / var(--leading-heading) var(--font-heading);
}

.card {
  padding: 22px var(--space-5) 25px;
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.card > p {
  margin-bottom: var(--space-3);
}

.fine {
  color: var(--color-text-muted);
  font-size: var(--text-small);
  line-height: var(--leading-tight);
}

.help {
  text-align: center;
}

/* ---- The form ---- */

form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: var(--space-5);
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: var(--text-label);
}

label small {
  color: var(--color-text-muted);
  font-size: var(--text-small);
}

/* 16px, or an iPhone zooms in when the field is tapped. */
input {
  width: 100%;
  min-height: var(--tap-min);
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-field);
  color: var(--color-text);
  font: var(--weight-regular) 16px var(--font-body);
}

/* The chooser: which device the card is for. */
select {
  width: 100%;
  min-height: var(--tap-min);
  margin: 0;
  padding: 10px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-field);
  color: var(--color-text);
  font: var(--weight-regular) 16px var(--font-body);
}

.chooser {
  margin-bottom: var(--space-3);
}

input::placeholder {
  color: var(--color-text-muted);
  opacity: 1;
}

input.pin {
  font-family: var(--font-mono);
  letter-spacing: 0.15em;
}

.button {
  display: block;
  width: 100%;
  min-height: var(--tap-min);
  margin: 0;
  padding: 12px 20px;
  border: 0;
  border-radius: var(--radius-md);
  cursor: pointer;
  font: var(--weight-semibold) var(--text-button) / 1.25 var(--font-heading);
  letter-spacing: var(--tracking-button);
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
}

.button-primary {
  background: var(--color-primary);
  color: var(--color-on-primary);
}

.button-primary:hover,
.button-primary:active {
  background: var(--color-primary-hover);
}

.button-secondary {
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-heading);
}

.button-secondary:hover,
.button-secondary:active {
  background: var(--color-surface-2);
}

.button:disabled {
  background: var(--color-disabled-bg);
  color: var(--color-disabled-text);
  cursor: default;
}

.button .hint {
  display: inline-block;
  margin-left: var(--space-2);
  color: var(--color-text-muted);
  font: var(--weight-regular) var(--text-small) var(--font-body);
  letter-spacing: 0;
  text-transform: none;
}

/* On the main button the file name is the button's own colour. */
.button-primary .hint {
  color: inherit;
}

.status {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: var(--text-label);
  line-height: var(--leading-tight);
}

.status-error {
  background: var(--color-error-bg);
  color: var(--color-error);
}

.status-note {
  background: var(--color-surface-2);
  color: var(--color-text);
}

.callout {
  padding: 18px var(--space-5);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  font-size: var(--text-label);
  line-height: var(--leading-tight);
}

.callout strong {
  display: block;
  margin-bottom: var(--space-1);
  color: var(--color-heading);
  font-weight: var(--weight-semibold);
}

/* ---- Steps by device ---- */

.device {
  overflow: hidden;
  margin-bottom: 10px;
  border-radius: var(--radius-md);
  background: var(--color-surface);
  box-shadow: var(--shadow-card);
}

.device[open] {
  box-shadow: var(--shadow-open);
}

/* The chosen device's steps, moved into the card at the top: part of the
   card, with the card's heading for a title. */
#mine .device {
  overflow: visible;
  margin: var(--space-5) 0 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

#mine .device > summary {
  display: none;
}

#mine .device-body {
  padding: 0;
}

.device summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--tap-min);
  padding: 18px 22px;
  color: var(--color-heading);
  cursor: pointer;
  font: var(--weight-semibold) var(--text-summary) / var(--leading-heading) var(--font-heading);
  list-style: none;
}

.device summary::-webkit-details-marker {
  display: none;
}

/* A graphic, so the brand red will do: it needs 3:1 and has 4.3:1. */
.device summary::after {
  margin-left: var(--space-3);
  color: var(--color-brand);
  content: "+";
  font-size: 22px;
  font-weight: var(--weight-regular);
  line-height: 1;
}

.device[open] summary::after {
  transform: rotate(45deg);
}

.device summary:focus-visible {
  outline-offset: -4px;
}

.device-body {
  padding: 0 22px var(--space-5);
}

.device-body > * + *,
.device-body > div > * + * {
  margin-top: var(--space-4);
}

.steps {
  padding: 0;
  counter-reset: step;
  list-style: none;
}

.steps li {
  position: relative;
  padding: var(--space-4) 0 var(--space-4) 40px;
  border-bottom: 1px solid var(--color-divider);
  counter-increment: step;
}

.steps li:last-child {
  border-bottom: 0;
}

.steps li::before {
  position: absolute;
  top: var(--space-4);
  left: 0;
  color: var(--color-accent-text);
  content: counter(step, decimal-leading-zero);
  font: var(--weight-semibold) var(--text-summary) / 1.45 var(--font-heading);
}

.steps .button,
.steps .command,
.steps .status {
  margin-top: var(--space-3);
}

/* One way of several to set a device up. */
.device-body h3 {
  color: var(--color-heading);
  font: var(--weight-semibold) var(--text-eyebrow) / var(--leading-heading) var(--font-heading);
}

.device-body h3:not(:first-child) {
  margin-top: var(--space-6);
}

/* A command to copy letter for letter. It wraps on the page and is still
   one line when copied. */
.command {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--color-surface-2);
  color: var(--color-heading);
  font: var(--weight-regular) var(--text-label) / 1.5 var(--font-mono);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.command:focus-visible {
  outline: 2px solid var(--color-focus);
  outline-offset: 2px;
}

.command + .button {
  margin-top: var(--space-3);
}

.value {
  color: var(--color-heading);
  font-weight: var(--weight-semibold);
  overflow-wrap: anywhere;
}

.settings {
  padding: var(--space-1) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
}

.settings > div {
  padding: 14px 0;
  border-bottom: 1px solid var(--color-divider);
}

.settings > div:last-child {
  border-bottom: 0;
}

.settings dt {
  color: var(--color-text-muted);
  font: var(--weight-semibold) var(--text-small) / var(--leading-tight) var(--font-heading);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

/* Network and server names are copied letter for letter. */
.settings dd {
  margin: 0;
  color: var(--color-heading);
  font: var(--weight-regular) 1rem/1.4 var(--font-mono);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

/* What to do, where there is no value to copy. */
.settings dd.say {
  font-family: var(--font-body);
}

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

.site-footer {
  padding: var(--space-5);
  background: var(--color-footer-bg);
  color: var(--color-footer-text);
  font: var(--weight-semibold) var(--text-label) / var(--leading-tight) var(--font-heading);
  letter-spacing: var(--tracking-label);
  text-align: center;
  text-transform: uppercase;
  overflow-wrap: anywhere;
}

@media (min-width: 480px) {
  .settings > div {
    display: grid;
    grid-template-columns: 9rem 1fr;
    gap: var(--space-3);
    align-items: baseline;
  }
}

@media (min-width: 961px) {
  h1 {
    font-size: var(--text-title-wide);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .button {
    transition: background 0.2s;
  }

  .device summary::after {
    transition: transform 0.2s;
  }
}
