/*
 * pdf2web — styled after the FHNW Styleguide Web V5
 * (https://web.fhnw.ch/fhnw-styleguide-v5/): black primary, yellow secondary,
 * off-white surface, Inter.
 *
 * Inter is self-hosted from web/assets/fonts and embedded in the binary, so the
 * app matches the styleguide's typeface without making a request to a font CDN.
 * SIL Open Font License 1.1 — the licence text ships alongside the files in
 * web/assets/fonts/LICENSE.txt, as the licence requires.
 *
 * One variable file per subset covers weights 400-700, which is every weight
 * this stylesheet asks for. Only latin and latin-ext are shipped: the interface
 * is German, and latin-ext keeps user-supplied document titles legible beyond
 * latin-1. Text outside those ranges falls back down the stack in --font.
 */

@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/fonts/inter-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/fonts/inter-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --black: #000000;
  --yellow: #fde703;
  --yellow-dark: #ead20a; /* styleguide hover / hairline shade */
  --danger: #df305b;
  --success: #198754;
  --light: #f1f1ee;
  --info: #dee2e6;
  --white: #ffffff;

  --ink: var(--black);
  --ink-muted: #5a5a55;
  --surface: var(--light);
  --card: var(--white);
  --line: #d6d6d0;

  --space: 1rem;
  --radius: 2px;
  --shadow: 0 1px 2px rgb(0 0 0 / 6%), 0 8px 24px rgb(0 0 0 / 6%);

  --font: Inter, "Helvetica Neue", "Segoe UI", Arial, system-ui, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.2;
}

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

a:hover {
  text-decoration-color: var(--yellow);
}

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

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--yellow);
  font-weight: 600;
}

.skip-link:focus {
  left: 0;
}

/* ------------------------------------------------------------ tools header */
/*
 * FHNW Styleguide V5 "Tools-Header". Values below are taken from the official
 * fhnw.css: a yellow bar with a darker yellow hairline, 60px minimum height,
 * asymmetric padding, and the wordmark at 40px.
 */

.navbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  min-height: 60px;
  padding: 0 1rem 0 1.5rem;
  background-color: var(--yellow);
  border-bottom: 1px solid var(--yellow-dark);
}

@media (max-width: 991.98px) {
  .navbar {
    padding: 0.5rem 1rem;
  }
}

.navbar-brand {
  display: flex;
  align-items: center;
  min-width: 0;
  font-size: 1.125rem;
  font-weight: 400;
  color: var(--black);
  text-decoration: none;
  white-space: nowrap;
}

.navbar-brand img {
  height: 40px;
  width: auto;
  margin-right: 2rem;
}

@media (max-width: 575.98px) {
  .navbar-brand img {
    margin-right: 1rem;
  }
}

.navbar-title {
  font-size: 1.125rem;
  font-weight: 400;
  color: var(--black);
  overflow: hidden;
  text-overflow: ellipsis;
}

.navbar-collapse {
  display: flex;
  justify-content: flex-end;
  min-width: 0;
}

.navbar-nav {
  display: flex;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-item {
  position: relative;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 18rem;
  padding: 0.5rem 0.75rem;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--black);
  cursor: pointer;
}

.nav-link:hover {
  background-color: var(--yellow-dark);
}

.nav-link__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 575.98px) {
  .nav-link__label {
    display: none;
  }
}

.rounded-circle {
  border-radius: 50%;
}

/* The styleguide's caret, drawn rather than pulled from an icon font. */
.dropdown-toggle::after {
  content: "";
  flex: none;
  width: 0;
  height: 0;
  margin-left: 0.15rem;
  border-top: 0.3em solid currentColor;
  border-right: 0.3em solid transparent;
  border-left: 0.3em solid transparent;
}

/* ---------------------------------------------------------------- dropdown */

.dropdown-menu {
  position: absolute;
  top: 100%;
  z-index: 1000;
  min-width: 14rem;
  margin: 0;
  padding: 0;
  list-style: none;
  background-color: var(--white);
  border: 0;
  box-shadow: 0 15px 15px rgb(0 0 0 / 30%);
}

.dropdown-menu[hidden] {
  display: none;
}

.dropdown-menu-end {
  right: 0;
}

.dropdown-item {
  display: block;
  width: 100%;
  padding: 0.6rem 1rem;
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 400;
  color: var(--black);
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}

.dropdown-item:hover {
  background-color: var(--yellow);
}

.dropdown-item-text {
  display: block;
  padding: 0.6rem 1rem;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.dropdown-divider {
  margin: 0;
  border: 0;
  border-top: 1px solid var(--line);
}

/* ------------------------------------------------------------------ layout */

.shell {
  flex: 1;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
}

/* The upload zone occupies one third, the document list the remaining two. */
.split {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 900px) {
  .split {
    grid-template-columns: 1fr;
  }
}

.pane__heading {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-muted);
  margin-bottom: 0.75rem;
}

.pane--drop {
  position: sticky;
  top: 1.5rem;
}

@media (max-width: 900px) {
  .pane--drop {
    position: static;
  }
}

/* --------------------------------------------------------------- drop zone */

.dropzone {
  display: block;
  min-height: 22rem;
  background: var(--card);
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  transition: border-color 120ms ease, background-color 120ms ease;
}

.dropzone.is-dragging {
  border-color: var(--black);
  background: var(--yellow);
}

.dropzone.is-busy {
  opacity: 0.65;
  pointer-events: none;
}

.dropzone__inner {
  height: 100%;
  min-height: 22rem;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.4rem;
}

.dropzone__icon {
  width: 48px;
  height: 48px;
  margin-bottom: 0.5rem;
  color: var(--ink);
}

.dropzone__lead {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}

.dropzone__or {
  margin: 0.1rem 0 0.6rem;
  color: var(--ink-muted);
  font-size: 0.9rem;
}

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

.dropzone__busy {
  margin: 0;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--line);
  font-size: 0.9rem;
  font-weight: 600;
}

/* --------------------------------------------------------------- documents */

.doc-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.doc {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--black);
  border-radius: var(--radius);
  padding: 1rem 1.15rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: flex-start;
}

.doc:hover {
  border-left-color: var(--yellow);
}

.doc__main {
  min-width: 0;
  flex: 1 1 18rem;
}

.doc__title {
  font-size: 1.05rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc__meta {
  margin: 0.2rem 0 0.4rem;
  font-size: 0.82rem;
  color: var(--ink-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.doc__url {
  font-family: var(--mono);
  font-size: 0.85rem;
  word-break: break-all;
}

.doc__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.shortcode-form {
  display: flex;
  gap: 0.4rem;
}

.empty {
  margin: 0;
  padding: 2.5rem 1.5rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--ink-muted);
  max-width: 46ch;
}

/* ----------------------------------------------------------------- controls */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--black);
  border-radius: var(--radius);
  background: var(--white);
  color: var(--black);
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}

.btn:hover {
  background: var(--yellow);
}

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

.btn--primary:hover {
  background: var(--yellow);
  color: var(--black);
}

.btn--secondary {
  background: var(--yellow);
  border-color: var(--black);
}

.btn--secondary:hover {
  background: var(--black);
  color: var(--white);
}

.btn--ghost {
  background: transparent;
  border-color: currentColor;
  color: inherit;
}

.btn--ghost:hover {
  background: var(--yellow);
  color: var(--black);
  border-color: var(--yellow);
}

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

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

.btn--sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.82rem;
}

.btn--lg {
  padding: 0.8rem 1.6rem;
  font-size: 1rem;
}

.input {
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--white);
  font: inherit;
  font-size: 0.85rem;
  color: var(--ink);
}

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

.input--code {
  font-family: var(--mono);
  width: 11rem;
}

/* ------------------------------------------------------------------ flashes */

.flash-area:empty {
  display: none;
}

.flash {
  margin: 0 0 1rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  border-left: 4px solid;
  font-size: 0.92rem;
  background: var(--card);
}

.flash--error {
  border-color: var(--danger);
}

.flash--ok {
  border-color: var(--success);
}

/* -------------------------------------------------------------------- modal */

.modal {
  width: min(46rem, calc(100vw - 2rem));
  padding: 1.75rem;
  border: none;
  border-top: 4px solid var(--yellow);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgb(0 0 0 / 55%);
}

.modal__close-form {
  float: right;
  margin: -0.5rem -0.5rem 0 0;
}

.modal__close {
  border: none;
  background: none;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  color: var(--ink-muted);
}

.modal__close:hover {
  color: var(--ink);
}

.modal__title {
  font-size: 1.3rem;
}

.modal__lead {
  margin: 0.3rem 0 1rem;
  color: var(--ink-muted);
  font-size: 0.9rem;
  word-break: break-all;
}

.modal__code {
  width: 100%;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--light);
  font-family: var(--mono);
  font-size: 0.82rem;
  resize: vertical;
}

.modal__actions {
  margin-top: 1rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

/* --------------------------------------------------------- login / errors */

.hero {
  display: grid;
  grid-template-columns: 3fr 2fr;
  gap: 3rem;
  align-items: center;
  padding: 3rem 0;
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 2rem;
    padding: 1.5rem 0;
  }
}

.hero__title {
  font-size: clamp(1.9rem, 4vw, 2.9rem);
  max-width: 18ch;
}

.hero__lead {
  margin: 1rem 0 1.75rem;
  font-size: 1.05rem;
  max-width: 52ch;
  color: var(--ink-muted);
}

.hero__code {
  font-family: var(--mono);
  font-size: 0.95em;
  background: var(--yellow);
  padding: 0.1em 0.35em;
  color: var(--black);
}

.hero__note {
  margin: 1rem 0 0;
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.steps {
  list-style: none;
  margin: 0;
  padding: 1.5rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.steps__item {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  font-size: 0.95rem;
}

.steps__n {
  flex: none;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  background: var(--yellow);
  font-weight: 700;
  border-radius: 50%;
}

.errorpage {
  padding: 4rem 0;
  max-width: 46ch;
}

.errorpage__status {
  margin: 0 0 0.5rem;
  font-family: var(--mono);
  font-size: 0.85rem;
  color: var(--ink-muted);
}

.errorpage__title {
  font-size: 1.6rem;
  margin-bottom: 1.75rem;
}

/* ------------------------------------------------------------ tools footer */
/*
 * FHNW Styleguide V5 "Tools-Footer": black bar, a 2px #4c4c4c hairline above
 * the link row, and links at 70% opacity that come up to full on hover.
 */

#footer {
  background-color: var(--black);
  margin-top: 5rem;
  padding-bottom: 1rem;
  color: var(--white);
}

#footer .container {
  position: relative;
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding-right: 1.5rem;
  padding-left: 1.5rem;
}

.tools__footer::before {
  display: flex;
  content: "";
  width: 100%;
  border-top: 2px solid #4c4c4c;
}

.tools__footer p {
  margin: 0 0 0.5rem;
}

.tools__footer a {
  color: var(--white);
  font-size: 0.875rem;
  font-weight: 600;
  opacity: 0.7;
  text-decoration: none;
  transition: opacity 0.5s ease-in;
}

.tools__footer a:hover,
.tools__footer a:focus-visible {
  opacity: 1;
}

/* --------------------------------- styleguide (Bootstrap) layout utilities */

.d-flex {
  display: flex;
}

.d-inline-block {
  display: inline-block;
}

.justify-content-center {
  justify-content: center;
}

.justify-content-end {
  justify-content: flex-end;
}

.pt-4 {
  padding-top: 1.5rem;
}

.mx-1 {
  margin-right: 0.25rem;
  margin-left: 0.25rem;
}

@media (min-width: 768px) {
  .mx-md-2 {
    margin-right: 0.5rem;
    margin-left: 0.5rem;
  }
}

/* --------------------------------------------------- public viewer page */

body.viewer {
  margin: 0;
  height: 100vh;
  background: var(--info);
}

.viewer__frame {
  display: block;
  width: 100%;
  height: 100vh;
  border: 0;
}

.viewer__fallback {
  padding: 3rem 1.5rem;
  text-align: center;
}

.viewer__fallback-title {
  font-size: 1.3rem;
  margin-bottom: 1rem;
}
