/*
 * The household site (my.fluent.pet, FP-3445). The design tokens of the FluentPet app
 * (CleverPet/fluentpet_app), as CSS custom properties. Each token's source in that repo:
 *
 *   --color-primary         #006271  src/theme/Colors.ts: PRIMARY_DARK / DARK_BLUE; src/theme/Color.ts: GREEN_400
 *                                    (the new-design primary button, src/shared/components/new-design-components/nextButton.tsx)
 *   --color-primary-deep    #02434D  src/theme/Color.ts: GREEN_500
 *   --color-primary-light   #6AD1E3  src/theme/Colors.ts: PRIMARY
 *   --color-primary-tint    #E2F3FB  src/theme/Color.ts: GREEN_100 (Colors.ts: BLUE_V2)
 *   --color-sky             #BDEEFD  src/theme/Color.ts: GREEN_200 / BUTTON_BLUE
 *   --color-teal            #79DAE4  src/theme/Color.ts: GREEN_300
 *   --color-mint            #B7F2EE  src/theme/Color.ts: BUTTON_GREEN
 *   --color-text            #222B45  src/theme/Color.ts: BLACK_800 (BasicText default, src/components/common/Typography.tsx)
 *   --color-text-strong     #2E3A59  src/theme/Color.ts: BLACK_700 (Colors.ts: BLACK_LIGHT)
 *   --color-text-muted      #707070  src/theme/Colors.ts: GREY_DARK (placeholder colour, src/components/common/Form/TextInput.tsx)
 *   --color-bg              #F7F9FC  src/theme/Color.ts: BLACK_200 (Colors.ts: GHOST_WHITE)
 *   --color-surface         #FFFFFF  src/theme/Color.ts: BLACK_000
 *   --color-surface-muted   #EDF1F7  src/theme/Color.ts: BLACK_300 (Colors.ts: SECONDARY_LIGHTER)
 *   --color-border          #E4E9F2  src/theme/Color.ts: BLACK_400 (Colors.ts: GREY_4)
 *   --color-border-strong   #C5CEE0  src/theme/Color.ts: BLACK_500
 *   --color-secondary       #9A96B2  src/theme/Colors.ts: SECONDARY
 *   --color-violet-tint     #D6DCF6  src/theme/Color.ts: BLUE_200 / BUTTON_VIOLET
 *   --color-violet          #1E2F7B  src/theme/Color.ts: BLUE_500
 *   --color-sunset          #FBECDA  src/theme/Color.ts: YELLOW_100 (Colors.ts: SUNSET)
 *   --color-sunset-strong   #FCBC71  src/theme/Color.ts: YELLOW_300
 *   --color-plum            #581746  src/theme/Color.ts: PURPLE_500
 *   --color-pink-tint       #FFE5E5  src/theme/Color.ts: PINK_100
 *   --color-error           #97132B  src/theme/Color.ts: RED_400
 *   --color-error-deep      #740D1F  src/theme/Color.ts: RED_500
 *   --color-error-light     #EC657D  src/theme/Color.ts: RED_300
 *   --color-success         #30AE78  src/theme/Color.ts: SYSTEM_GREEN (Colors.ts: GREEN)
 *
 *   --font-body       "Arizona Sans Regular"  src/components/common/Typography.tsx: FontArizona.REGULAR
 *   --font-heading    "Arizona Text Bold"     src/components/common/Typography.tsx: FontArizona.BOLD_TEXT
 *                     (the app's headings use FontArizona.BOLD, ABCArizonaSans-Bold; Arizona Text Bold
 *                     is the bold face fluent.pet already serves as a web font, see @font-face below)
 *   --text-h1         30px / 42px  src/components/common/Typography.tsx: headline1
 *   --text-h1-phone   26px / 36px  src/components/common/Typography.tsx: headline2
 *   --text-h2         23px / 34px  src/components/common/Typography.tsx: navigationTitle
 *   --text-lead       18px / 27px  src/components/common/Typography.tsx: body
 *   --text-body       16px / 24px  src/components/common/Typography.tsx: bodySmall (src/theme/Text.ts: TextSize.body)
 *   --text-caption    14px / 17px  src/theme/Text.ts: TextSize.caption1
 *   --text-small      12px / 16px  src/components/common/Typography.tsx: captionSmall
 *
 *   --space-1   4px   src/theme/Spacing.ts: px4
 *   --space-2   8px   src/theme/Spacing.ts: px8
 *   --space-3  12px   src/theme/Size.ts: SizeV2.S (Spacing.ts: px12 is 8, a typo there)
 *   --space-4  16px   src/theme/Spacing.ts: px16
 *   --space-5  20px   src/theme/Spacing.ts: px20
 *   --space-6  24px   src/theme/Spacing.ts: px24
 *   --space-8  32px   src/theme/Spacing.ts: px32
 *   --space-10 40px   src/theme/Size.ts: Size.X3_L
 *
 *   --radius-sm      4px   src/theme/Size.ts: Size.BORDER_RADIUS (inputs, src/components/common/Form/TextInput.tsx)
 *   --radius-lg     16px   src/shared/components/new-design-components/nextButton.tsx: borderRadius
 *   --control-height 48px  src/theme/Size.ts: Size.BUTTON_HEIGHT / Size.TEXT_INPUT_HEIGHT
 *   --border-outline 2px   src/components/common/Button.tsx: borderWidth of an outline button
 *
 * The app has one shadow (src/theme/Shadows.ts: modalShadow, for modals); the site has no modals,
 * so it has no shadow token.
 *
 * Desktop additions: what a desktop browser needs that the app's tokens do not cover. Listed in the
 * :root block below under "Desktop additions".
 */

/* The same web font files the public dashboard and the web interface load. font-weight on each
   face stops Safari from synthesizing bold over a face that already is bold. */
@font-face {
  font-family: "Arizona Sans Regular";
  src: url("https://cdn.shopify.com/s/files/1/0397/2903/7469/files/ABCArizonaSans-Regular.woff2?v=1640364095") format("woff2"),
    url("https://cdn.shopify.com/s/files/1/0397/2903/7469/files/ABCArizonaSans-Regular.woff?v=1640364095") format("woff");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Arizona Text Bold";
  src: url("https://cdn.shopify.com/s/files/1/0397/2903/7469/files/ABCArizonaText-Bold.woff2?v=1640364082") format("woff2"),
    url("https://cdn.shopify.com/s/files/1/0397/2903/7469/files/ABCArizonaText-Bold.woff?v=1640364083") format("woff");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Colour (FluentPet app) */
  --color-primary: #006271;
  --color-primary-deep: #02434d;
  --color-primary-light: #6ad1e3;
  --color-primary-tint: #e2f3fb;
  --color-sky: #bdeefd;
  --color-teal: #79dae4;
  --color-mint: #b7f2ee;
  --color-text: #222b45;
  --color-text-strong: #2e3a59;
  --color-text-muted: #707070;
  --color-bg: #f7f9fc;
  --color-surface: #ffffff;
  --color-surface-muted: #edf1f7;
  --color-border: #e4e9f2;
  --color-border-strong: #c5cee0;
  --color-secondary: #9a96b2;
  --color-violet-tint: #d6dcf6;
  --color-violet: #1e2f7b;
  --color-sunset: #fbecda;
  --color-sunset-strong: #fcbc71;
  --color-plum: #581746;
  --color-pink-tint: #ffe5e5;
  --color-error: #97132b;
  --color-error-deep: #740d1f;
  --color-error-light: #ec657d;
  --color-success: #30ae78;

  /* Typography (FluentPet app) */
  --font-fallback: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-body: "Arizona Sans Regular", var(--font-fallback);
  --font-heading: "Arizona Text Bold", var(--font-fallback);
  --text-h1: 30px;
  --leading-h1: 42px;
  --text-h1-phone: 26px;
  --leading-h1-phone: 36px;
  --text-h2: 23px;
  --leading-h2: 34px;
  --text-lead: 18px;
  --leading-lead: 27px;
  --text-body: 16px;
  --leading-body: 24px;
  --text-caption: 14px;
  --leading-caption: 17px;
  --text-small: 12px;
  --leading-small: 16px;

  /* Spacing (FluentPet app) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;

  /* Shape (FluentPet app) */
  --radius-sm: 4px;
  --radius-lg: 16px;
  --control-height: 48px;
  --border-outline: 2px;

  /* Desktop additions (not in the app's tokens) */
  --page-max-width: 1080px;      /* content column width on a wide screen */
  --form-max-width: 640px;       /* width of a form and its inputs */
  --breakpoint-phone: 640px;     /* documentation only: the @media queries below use this value */
  --radius-pill: 999px;          /* status pills and badges */
  --control-height-sm: 36px;     /* the compact button in the header */
  --focus-ring-width: 3px;      /* keyboard focus outline */
  --focus-ring-offset: 2px;
  --table-cell-padding: var(--space-3) var(--space-4); /* table cells */
  --header-height: 64px;         /* the site header */
}

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

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

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-body);
  line-height: var(--leading-body);
  font-synthesis: none;
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
  font-weight: 700;
  color: var(--color-text);
  margin: 0 0 var(--space-4);
}

h1 {
  font-size: var(--text-h1);
  line-height: var(--leading-h1);
}

h2 {
  font-size: var(--text-h2);
  line-height: var(--leading-h2);
  margin-top: var(--space-8);
}

p {
  margin: 0 0 var(--space-4);
}

a {
  color: var(--color-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--color-primary-deep);
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: var(--text-caption);
}

/* Keyboard focus is an outline, so forced-colors mode keeps it (a box-shadow is dropped there). */
:focus-visible {
  outline: var(--focus-ring-width) solid var(--color-primary);
  outline-offset: var(--focus-ring-offset);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.muted {
  color: var(--color-text-muted);
}

.lead {
  font-size: var(--text-lead);
  line-height: var(--leading-lead);
}

.text-break {
  overflow-wrap: anywhere;
}

/* Header and navigation */

.site-header {
  background: var(--color-primary);
  color: var(--color-surface);
}

.site-header__inner {
  max-width: var(--page-max-width);
  min-height: var(--header-height);
  margin: 0 auto;
  padding: var(--space-3) var(--space-6);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-6);
}

.site-logo {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm);
}

.site-logo img {
  display: block;
  width: 130px;
  height: 34px;
}

.site-nav {
  flex: 1 1 auto;
}

.site-nav ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-6);
}

/* Header links: the nav items and Sign out share one treatment, plain text in the body size and
   weight. The current page has a white underline, hover a lighter teal one. Sign out keeps its
   btn class from the layout, so its button styles are reset here. */
.site-nav a,
.site-user .btn-on-dark {
  display: inline-block;
  min-height: 0;
  padding: var(--space-2) 0;
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: none;
  color: var(--color-surface);
  font-family: var(--font-body);
  font-size: var(--text-body);
  font-weight: 400;
  line-height: var(--leading-body);
  text-decoration: none;
}

.site-nav a:hover,
.site-user .btn-on-dark:hover {
  background: none;
  color: var(--color-surface);
  border-bottom-color: var(--color-teal);
}

.site-nav a[aria-current="page"] {
  border-bottom-color: var(--color-surface);
}

/* On the header's --color-primary a primary outline would not show: white contrasts about 7:1
   with #006271. Every focusable element in the header, the current page's link included. */
.site-header :focus-visible {
  outline-color: var(--color-surface);
}

.site-user {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  font-size: var(--text-caption);
  line-height: var(--leading-caption);
}

.site-user__email {
  color: var(--color-sky);
  overflow-wrap: anywhere;
}

/* Page */

.page {
  max-width: var(--page-max-width);
  margin: 0 auto;
  padding: var(--space-8) var(--space-6) var(--space-10);
}

.back-link {
  margin-bottom: var(--space-2);
  font-size: var(--text-caption);
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  margin-bottom: var(--space-6);
}

.card > :last-child {
  margin-bottom: 0;
}

.card--narrow {
  max-width: var(--form-max-width);
}

.sign-in {
  max-width: var(--form-max-width);
  margin: var(--space-10) auto 0;
  text-align: center;
}

.sign-in .actions {
  justify-content: center;
}

/* Buttons. A button_to form sits inline in an .actions row. */

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin: 0 0 var(--space-6);
}

.actions form {
  margin: 0;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: var(--control-height);
  padding: 0 var(--space-6);
  border: var(--border-outline) solid transparent;
  border-radius: var(--radius-lg);
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-body);
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  background: transparent;
  color: var(--color-primary);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.6;
}

.btn-primary {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-surface);
}

.btn-primary:hover {
  background: var(--color-primary-deep);
  border-color: var(--color-primary-deep);
  color: var(--color-surface);
}

.btn-secondary {
  background: var(--color-surface);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.btn-secondary:hover {
  background: var(--color-primary-tint);
  color: var(--color-primary-deep);
}

.btn-danger {
  background: var(--color-surface);
  border-color: var(--color-error);
  color: var(--color-error);
}

.btn-danger:hover {
  background: var(--color-pink-tint);
  color: var(--color-error-deep);
}

.btn-link {
  padding: 0 var(--space-3);
  text-decoration: underline;
}

.btn-on-dark {
  min-height: var(--control-height-sm);
  padding: 0 var(--space-4);
  border-color: var(--color-surface);
  color: var(--color-surface);
  font-size: var(--text-caption);
}

.btn-on-dark:hover {
  background: var(--color-surface);
  color: var(--color-primary);
}

/* Forms */

.field {
  margin-bottom: var(--space-6);
  max-width: var(--form-max-width);
}

.field label,
.field legend {
  display: block;
  margin-bottom: var(--space-2);
  font-family: var(--font-heading);
  font-weight: 700;
}

fieldset.field {
  border: 0;
  padding: 0;
  min-width: 0;
}

.input {
  display: block;
  width: 100%;
  min-height: var(--control-height);
  padding: 0 var(--space-4);
  border: 1px solid var(--color-text-muted);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--text-body);
}

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

.input:focus {
  border-color: var(--color-primary);
}

.input--mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.hint {
  display: block;
  margin-top: var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--text-caption);
  line-height: var(--leading-caption);
}

.checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: var(--space-2) var(--space-4);
}

.check {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.check label {
  margin: 0;
  font-family: var(--font-body);
  font-weight: 400;
}

.check input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin: 0;
  accent-color: var(--color-primary);
}

.form-errors {
  margin: 0;
  padding-left: var(--space-6);
}

/* Alerts */

.alert {
  margin-bottom: var(--space-6);
  padding: var(--space-4) var(--space-5);
  border: 1px solid;
  border-left-width: 4px;
  border-radius: var(--radius-sm);
}

.alert-success {
  background: var(--color-primary-tint);
  border-color: var(--color-teal);
  border-left-color: var(--color-primary);
  color: var(--color-primary-deep);
}

.alert-warning {
  background: var(--color-sunset);
  border-color: var(--color-sunset-strong);
  color: var(--color-text);
}

.alert-danger {
  background: var(--color-pink-tint);
  border-color: var(--color-error-light);
  border-left-color: var(--color-error);
  color: var(--color-error-deep);
}

/* The signing secret, shown once */

.secret-box {
  padding: var(--space-5);
  border: var(--border-outline) dashed var(--color-primary);
  border-radius: var(--radius-lg);
  background: var(--color-primary-tint);
  margin-bottom: var(--space-6);
}

.secret-box .field {
  margin-bottom: 0;
  max-width: none;
}

/* Details list */

.details {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: var(--space-3) var(--space-6);
  margin: 0;
}

.details dt {
  color: var(--color-text-muted);
}

.details dd {
  margin: 0;
}

/* Tables. A wide table scrolls inside .table-wrap on a narrow screen. */

.table-wrap {
  overflow-x: auto;
  margin-bottom: var(--space-6);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-caption);
  line-height: var(--leading-body);
}

.table th,
.table td {
  padding: var(--table-cell-padding);
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--color-border);
}

.table thead th {
  background: var(--color-surface-muted);
  color: var(--color-text-strong);
  font-family: var(--font-heading);
  font-weight: 700;
  white-space: nowrap;
}

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

.nowrap {
  white-space: nowrap;
}

/* Badges and status pills */

.badge {
  display: inline-block;
  padding: 2px var(--space-3);
  border-radius: var(--radius-pill);
  font-size: var(--text-small);
  line-height: var(--leading-small);
  font-family: var(--font-heading);
  font-weight: 700;
  white-space: nowrap;
  vertical-align: middle;
  background: var(--color-surface-muted);
  color: var(--color-text-strong);
}

.badge-admin {
  background: var(--color-violet-tint);
  color: var(--color-violet);
  margin-left: var(--space-2);
}

.badge-enabled,
.badge-delivery-succeeded {
  background: var(--color-mint);
  color: var(--color-primary-deep);
}

.badge-disabled,
.badge-delivery-skipped {
  background: var(--color-surface-muted);
  color: var(--color-text-strong);
}

.badge-failing,
.badge-delivery-failed {
  background: var(--color-pink-tint);
  color: var(--color-error-deep);
}

.badge-delivery-pending {
  background: var(--color-sunset);
  color: var(--color-plum);
}

.latest-delivery {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
}

/* Phone width */

@media (max-width: 640px) {
  .site-header__inner {
    padding: var(--space-3) var(--space-4);
  }

  .site-nav {
    order: 3;
    flex-basis: 100%;
  }

  .site-nav ul {
    column-gap: var(--space-4);
  }

  .site-user {
    margin-left: auto;
  }

  .site-user__email {
    display: none;
  }

  .page {
    padding: var(--space-6) var(--space-4) var(--space-8);
  }

  h1 {
    font-size: var(--text-h1-phone);
    line-height: var(--leading-h1-phone);
  }

  .card {
    padding: var(--space-4);
  }

  .details {
    grid-template-columns: 1fr;
    gap: var(--space-1);
  }

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

  .actions .btn,
  .actions form {
    flex: 1 1 auto;
  }

  .actions form .btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .btn,
  .site-nav a {
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  }
}

/* A pending delivery that no longer updates (my_deliveries.js): the page says so next to its status. */
[data-delivery-stale][data-delivery-pending] [data-delivery-field="status"]::after {
  content: " (not updating)";
  color: inherit;
  font-weight: normal;
}
