/* Shtypi: page chrome. Plain and monochrome, set in Compagnon. */

/*
 * Compagnon by Chloé Lozano, Juliette Duhé, Léa Pradine, Sébastien Riollier
 * and Valentin Papon, published by Velvetyne (found via uncut.wtf).
 * SIL Open Font License 1.1, see assets/fonts/Compagnon-LICENSE.txt.
 */
@font-face {
  font-family: "Compagnon";
  src: url("assets/fonts/Compagnon-Roman.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

/* Medium is the family's heaviest upright cut, so it also serves bold text. */
@font-face {
  font-family: "Compagnon";
  src: url("assets/fonts/Compagnon-Medium.woff2") format("woff2");
  font-weight: 500 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --ink: #111;
  --muted: #666;
  --line: #ddd;
  --white: #fff;
  --text-body: #333;
  --stage: #f3f3f1;
  --error: #b3261e;
  --font-ui: "Compagnon", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --transition: 180ms ease;
  color-scheme: light;
}

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

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  font: 16px/1.55 var(--font-ui);
  color: var(--ink);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}

body.view-reader {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

body.view-reader main {
  display: grid;
  min-height: 0;
}

::selection {
  color: var(--white);
  background: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* ---------- Top bar ---------- */

.topbar {
  position: relative;
  z-index: 5;
  background: var(--white);
}

.topbar-inner {
  display: flex;
  align-items: center;
  gap: 24px;
  max-width: 1180px;
  min-height: 72px;
  margin: 0 auto;
  padding: 0 24px;
}

.view-reader .topbar {
  border-bottom: 1px solid var(--line);
}

.view-reader .topbar-inner {
  max-width: none;
  min-height: 64px;
}

.logo {
  flex: none;
  font: 500 24px/1 var(--font-ui);
  color: var(--ink);
  text-decoration: none;
}

.doc {
  display: flex;
  flex: 1;
  align-items: baseline;
  gap: 14px;
  min-width: 0;
}

.doc-title {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  font-size: 15px;
}

.doc-status {
  flex: none;
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.actions {
  display: flex;
  flex: none;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 38px;
  padding: 0 14px;
  font: 400 15px/1 var(--font-ui);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
  background: var(--white);
  border: 1px solid var(--ink);
  border-radius: 0;
  cursor: pointer;
  transition: color var(--transition), background-color var(--transition);
}

.btn:hover,
.btn:focus-visible {
  color: var(--white);
  background: var(--ink);
}

.btn-primary {
  color: var(--white);
  background: var(--ink);
}

.btn-primary:hover,
.btn-primary:focus-visible {
  color: var(--ink);
  background: var(--white);
}

.btn:disabled {
  opacity: 0.3;
  cursor: default;
}

.btn:disabled:hover {
  color: var(--ink);
  background: var(--white);
}

.btn-primary:disabled:hover {
  color: var(--white);
  background: var(--ink);
}

.btn.is-busy {
  cursor: progress;
}

.icon-btn {
  width: 38px;
  padding: 0;
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

.icon-shrink,
.is-fullscreen .icon-expand {
  display: none;
}

.is-fullscreen .icon-shrink {
  display: block;
}

.label-short {
  display: none;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 6px;
  font-size: 15px;
  cursor: pointer;
  user-select: none;
}

.check input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--ink);
  cursor: pointer;
}

.text-link {
  color: var(--ink);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}

.text-link:hover,
.text-link:focus-visible {
  text-decoration-thickness: 2px;
}

@keyframes rise {
  from {
    opacity: 0;
    translate: 0 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

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

@media (max-width: 760px) {
  .topbar-inner {
    gap: 10px;
    min-height: 60px;
    padding: 0 16px;
  }

  .logo {
    font-size: 21px;
  }

  .view-reader .doc,
  .check-label,
  #openBtn,
  #fullscreenBtn {
    display: none;
  }

  .label-long {
    display: none;
  }

  .label-short {
    display: inline;
  }

  .actions {
    gap: 6px;
  }

  .btn {
    padding: 0 10px;
    font-size: 14px;
  }

  .icon-btn {
    padding: 0;
  }
}
