/* share.html, go.html, and the route pages. Base colors come from style.css. */

:root {
  --chip-line: #767c87;
  --chip-on-bg: #dbe8f6;
  --chip-on-line: #0044cc;
  --picker-bg: #f6f7f9;
}

@media (prefers-color-scheme: dark) {
  :root {
    --chip-line: #7d8592;
    --chip-on-bg: #1d3550;
    --chip-on-line: #66b2ff;
    --picker-bg: #181c22;
  }
}

/* The display rules below would otherwise override the hidden attribute. */
[hidden] {
  display: none !important;
}

label[for] {
  display: block;
  font-weight: 600;
  margin-top: 1rem;
}

input[type="search"],
input[type="url"] {
  box-sizing: border-box;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--chip-line);
  border-radius: 0.5rem;
}

input::placeholder {
  color: var(--chip-line);
  opacity: 1;
}

/* The route picker: a panel of chips, as in the app. */
.picker-panel {
  margin: 1.25rem 0 0.75rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 1rem;
  background: var(--picker-bg);
}

@media (min-width: 40rem) {
  .picker-panel { padding: 1rem 1.25rem; }
}

/* Floated, so it sits in the panel beside Clear all instead of on the border. */
.picker-panel legend {
  float: left;
  padding: 0;
  font-weight: 700;
  font-size: 1.0625rem;
  line-height: 2.75rem;
}

.picker-panel .text-button {
  float: right;
}

.picker-panel .filter-label {
  clear: both;
  padding-top: 0.25rem;
  margin-top: 0;
}

.route-options {
  clear: both;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
  max-height: 20rem;
  overflow-y: auto;
  /* Room for the focus ring inside the scroll area. */
  padding: 4px;
  margin-left: -4px;
  margin-right: -4px;
}

.route-option {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  box-sizing: border-box;
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0 0.9rem;
  border: 1px solid var(--chip-line);
  border-radius: 0.5rem;
  background: var(--bg);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
}

/* The checkbox stays for screen readers and keyboards; the chip is what shows. */
.route-option input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: inherit;
}

.route-option:hover {
  border-color: var(--text);
}

.route-option:has(input:checked) {
  background: var(--chip-on-bg);
  border-color: var(--chip-on-line);
  font-weight: 700;
}

.route-option:has(input:checked)::before {
  content: "✓";
  font-weight: 700;
}

.route-option:has(input:focus-visible) {
  outline: 3px solid var(--link);
  outline-offset: 2px;
}

.route-option:has(input:disabled) {
  opacity: 0.45;
  cursor: default;
}

.route-option:has(input:disabled):hover {
  border-color: var(--chip-line);
}

button,
a.button {
  display: inline-block;
  box-sizing: border-box;
  min-height: 2.75rem;
  padding: 0.5rem 1rem;
  font: inherit;
  font-weight: 600;
  line-height: 1.6;
  color: var(--bg);
  background: var(--link);
  border: 2px solid var(--link);
  border-radius: 0.5rem;
  text-decoration: none;
  cursor: pointer;
}

/* Quiet buttons: Clear all, and the open-in-app link on a route page. */
button.text-button,
a.outline-button {
  color: var(--link);
  background: transparent;
  border-color: transparent;
}

a.outline-button {
  border-color: var(--link);
}

button.text-button:hover:not(:disabled) {
  text-decoration: underline;
}

button:disabled {
  opacity: 0.45;
  cursor: default;
}

button:focus-visible,
a.button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--link);
  outline-offset: 2px;
}

.link-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1rem;
}

.hint {
  font-size: 0.9375rem;
}

.store-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}

.nowrap {
  white-space: nowrap;
}

@media (forced-colors: active) {
  .route-option:has(input:checked) {
    border: 3px solid Highlight;
  }
  .route-option:has(input:focus-visible) {
    outline-color: Highlight;
  }
}

/* QR code: black on white in every theme, so phone cameras read it. */
.qr-card {
  width: min(100%, 16rem);
  margin-top: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  overflow: hidden;
  background: #ffffff;
  forced-color-adjust: none;
}

.qr-card svg {
  display: block;
  width: 100%;
  height: auto;
}

/* The printed sign (share.html), shown only when printing with routes chosen. */
.print-sign {
  display: none;
}

@media print {
  @page {
    size: letter;
    margin: 0.75in;
  }

  body.has-sign {
    background: #ffffff;
  }

  body.has-sign > :not(.print-sign) {
    display: none !important;
  }

  body.has-sign > .print-sign {
    display: block;
    color: #000000;
    text-align: center;
  }

  .print-sign .print-title {
    margin: 0 0 0.3in;
    font-size: 28pt;
    line-height: 1.2;
  }

  .print-sign .print-qr {
    width: 3in;
    height: 3in;
    margin: 0 auto 0.25in;
    print-color-adjust: exact;
  }

  .print-sign .print-qr svg {
    display: block;
    width: 100%;
    height: 100%;
  }

  .print-sign .print-scan {
    margin: 0 0 0.15in;
    font-size: 16pt;
  }

  .print-sign .print-link {
    margin: 0 0 0.3in;
    font-size: 16pt;
    font-weight: 700;
    overflow-wrap: anywhere;
  }

  .print-sign .print-about {
    max-width: 5.5in;
    margin: 0 auto;
    font-size: 12pt;
  }
}
