/* PPP web interface.
 *
 * Styling follows the swisstopo.admin.ch look: white ground, Swiss red accent,
 * a system font stack. Nothing is loaded from a CDN -- the only external
 * resources are the logos on www.swisstopo.admin.ch.
 */

:root {
  --red: #dc0018;
  --ink: #1a1a1a;
  --muted: #5c6670;
  --line: #d8dbde;
  --bg-soft: #f5f6f7;
  --green: #1a7f37;
  --amber: #a15c00;
  --max: 62rem;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: #fff;
  -webkit-text-size-adjust: 100%;
}

/* ---------- header / footer ---------- */

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

/* Shown only outside production -- see the config fetch in i18n.js. Deliberately
   a thin full-width strip: unmissable, but it must not push the page down. */
.envbar {
  padding: 0.4rem 1.25rem;
  background: var(--red);
  color: #fff;
  font-size: 0.85rem;
  line-height: 1.35;
  text-align: center;
}

.envbar strong {
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.envbar strong::after {
  content: " · ";
  font-weight: 400;
}

.site-header__inner,
.site-footer__inner,
main {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}

.logo__flag {
  height: 2.1rem;
  width: auto;
}

.logo__text {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.logo__sub {
  display: block;
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--muted);
}

.langs {
  display: flex;
  gap: 0.25rem;
  font-size: 0.85rem;
}

.langs a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.15rem 0.4rem;
  border-radius: 2px;
  text-transform: uppercase;
}

.langs a:hover {
  color: var(--ink);
  background: var(--bg-soft);
}

.langs a[aria-current="true"] {
  color: #fff;
  background: var(--red);
}

main {
  padding-top: 2.5rem;
  padding-bottom: 4rem;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
}

.site-footer__inner {
  padding-top: 1.25rem;
  padding-bottom: 2rem;
}

/* ---------- typography ---------- */

h1 {
  font-size: 2rem;
  line-height: 1.2;
  margin: 0 0 0.75rem;
}

h2 {
  font-size: 1.25rem;
  margin: 2.5rem 0 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--line);
}

.lead {
  font-size: 1.1rem;
  color: var(--muted);
  margin-bottom: 2rem;
}

a {
  color: #0059a3;
}

code,
.mono {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.9em;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-block;
  font: inherit;
  font-weight: 700;
  color: #fff;
  background: var(--red);
  border: 1px solid var(--red);
  border-radius: 2px;
  padding: 0.7rem 1.4rem;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover:not(:disabled) {
  background: #b30014;
  border-color: #b30014;
}

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

.btn--secondary {
  color: var(--ink);
  background: #fff;
  border-color: var(--line);
}

.btn--secondary:hover:not(:disabled) {
  background: var(--bg-soft);
  border-color: var(--muted);
}

.btn--small {
  padding: 0.3rem 0.7rem;
  font-size: 0.85rem;
  font-weight: 400;
}

/* ---------- panels, notices ---------- */

.panel {
  border: 1px solid var(--line);
  border-left: 6px solid var(--red);
  background: var(--bg-soft);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0;
}

.panel h3 {
  margin: 0 0 0.5rem;
  font-size: 1rem;
}

.notice {
  padding: 0.8rem 1rem;
  border: 1px solid var(--line);
  border-left: 6px solid var(--muted);
  margin: 1rem 0;
}

.notice--error {
  border-left-color: var(--red);
  color: #7a0010;
}

.notice--ok {
  border-left-color: var(--green);
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.5rem;
  border-radius: 2px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  color: var(--muted);
  vertical-align: middle;
}

.badge--share {
  background: #fff4d6;
  border-color: #e6c65c;
  color: var(--amber);
}

/* Links panel: label and value side by side, so the panel stays compact. */
.links {
  display: grid;
  grid-template-columns: minmax(9rem, 18rem) 1fr;
  gap: 0.6rem 1rem;
  align-items: start;
}

.links__label {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.links__value {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.links__value .linkbox {
  flex: 1 1 auto;
  min-width: 0;
}

.links__value .copy {
  flex: 0 0 auto;
}

/* A URL the user has to keep: shown whole, wrapping, and selected as a unit --
 * one click, or Ctrl-A while focused, grabs the whole link and nothing else. */
.linkbox {
  display: block;
  width: 100%;
  user-select: all;
  -webkit-user-select: all;
  cursor: text;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.85rem;
  padding: 0.6rem 0.7rem;
  border: 1px solid var(--line);
  background: #fff;
  word-break: break-all;
  margin: 0;
}

.linkbox:focus {
  outline: 2px solid var(--red);
  outline-offset: 1px;
}

/* ---------- help ---------- */

.help-btn {
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.35rem;
  width: 1.4rem;
  height: 1.4rem;
  padding: 0;
  margin-left: 0.5rem;
  vertical-align: middle;
  color: #fff;
  background: var(--muted);
  border: none;
  border-radius: 50%;
  cursor: pointer;
}

.help-btn:hover,
.help-btn:focus {
  background: var(--red);
}

.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;
}

dialog.help {
  width: min(56rem, calc(100vw - 2rem));
  max-height: calc(100vh - 4rem);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--ink);
  background: #fff;
}

dialog.help::backdrop {
  background: rgba(26, 26, 26, 0.55);
}

.help__bar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 1.25rem;
  background: #fff;
  border-bottom: 3px solid var(--red);
}

.help__bar h2 {
  margin: 0;
  padding: 0;
  border: none;
  font-size: 1.15rem;
}

.help__close {
  font: inherit;
  font-size: 1.6rem;
  line-height: 1;
  padding: 0 0.3rem;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
}

.help__close:hover {
  color: var(--red);
}

.help__body {
  padding: 0.5rem 1.25rem 1.5rem;
  overflow-y: auto;
  max-height: calc(100vh - 8rem);
}

.help__body h3 {
  font-size: 1.05rem;
  margin: 1.6rem 0 0.5rem;
  padding-bottom: 0.3rem;
  border-bottom: 1px solid var(--line);
}

.help__body h4 {
  font-size: 0.95rem;
  margin: 1.2rem 0 0.4rem;
  color: var(--muted);
}

.help__body ul {
  padding-left: 1.2rem;
}

.help__body li {
  margin-bottom: 0.45rem;
}

.help__body code {
  background: var(--bg-soft);
  padding: 0.05rem 0.25rem;
  border-radius: 2px;
}

/* The name diagram is aligned with box-drawing characters: it must not wrap,
   and on a narrow screen it scrolls rather than breaking apart. */
.help__diagram {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.78rem;
  line-height: 1.35;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  padding: 0.9rem;
  overflow-x: auto;
  white-space: pre;
}

/* ---------- tables ---------- */

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

th,
td {
  text-align: left;
  padding: 0.55rem 0.6rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

td.num {
  text-align: right;
  white-space: nowrap;
}

td.actions {
  text-align: right;
  white-space: nowrap;
}

.empty {
  color: var(--muted);
  font-style: italic;
  padding: 1rem 0;
}

/* ---------- upload ---------- */

.dropzone {
  display: block;
  margin: 0 0 1rem;
  border: 2px dashed var(--line);
  border-radius: 3px;
  padding: 2rem 1rem;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  background: #fff;
}

.dropzone:hover,
.dropzone.is-over {
  border-color: var(--red);
  background: var(--bg-soft);
  color: var(--ink);
}

.dropzone input[type="file"] {
  display: none;
}

.upload__label {
  margin: 0.25rem 0 1rem;
  font-size: 0.9rem;
  color: var(--muted);
}

.upload__label .mono {
  color: var(--ink);
}

/* ---------- progress ---------- */

.bar {
  height: 0.75rem;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 2px;
  overflow: hidden;
  margin: 0.6rem 0;
}

.bar__fill {
  height: 100%;
  width: 0;
  background: var(--red);
  transition: width 0.4s ease;
}

.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.25rem 1.25rem;
  font-size: 0.95rem;
}

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

.kv dd {
  margin: 0;
}

pre.result {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  padding: 1rem;
  overflow-x: auto;
  font-size: 0.82rem;
  line-height: 1.45;
  max-height: 32rem;
}

[hidden] {
  display: none !important;
}

/* ---------- small screens ---------- */

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

  h1 {
    font-size: 1.5rem;
  }

  .site-header__inner {
    justify-content: flex-start;
  }

  /* The file tables lose their least useful column rather than scrolling. */
  th.optional,
  td.optional {
    display: none;
  }

  .btn {
    width: 100%;
    text-align: center;
  }

  .btn--small {
    width: auto;
  }

  .links {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  dialog.help {
    width: 100vw;
    max-width: 100vw;
    max-height: 100vh;
    margin: 0;
    border: none;
  }

  .help__body {
    max-height: calc(100vh - 4rem);
  }

  .help__close {
    width: auto;
  }

  .links__label {
    margin-top: 0.6rem;
  }
}
