/* Public and staff pages around the viewer (home, login, share links). The viewer's
   style.css sits behind the access check, so the few shared tokens are repeated here.
   Sections: tokens · base · wordmark · buttons · fields · card + login · notice · home · top bar ·
   links page · dialogs · toast · user preferences. */

/* ========== tokens ========== */
:root {
  --bg: #111415;
  --bg-2: #181c1d;
  --bg-3: #1f2425;
  --fg-rgb: 236, 232, 225;
  --fg: rgb(var(--fg-rgb));
  --muted: #b5b7b2;                     /* 9:1 on --bg */
  --faint: rgba(var(--fg-rgb), .12);
  --line: rgba(var(--fg-rgb), .18);
  --hover: rgba(var(--fg-rgb), .08);
  --warm-rgb: 214, 178, 120;
  --warm: rgb(var(--warm-rgb));
  --danger-rgb: 232, 146, 128;
  --danger: rgb(var(--danger-rgb));
  --font: "Inter", "Helvetica Neue", Helvetica, "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  --radius: 10px;
  --target: 2.75rem;                    /* minimum size of anything tappable */
  --ease: cubic-bezier(.2, .7, .2, 1);
}

/* ========== base ========== */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

/* The UI is sized in rem, so it grows with the screen. Same rule in ../style.css, which explains it. */
html { font-size: clamp(100%, 64% + min(.4vw, .75vh), 150%); }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(120% 90% at 50% 40%, #171b1c 0%, var(--bg) 70%) fixed;
  color: var(--fg);
  font: 400 1rem/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
body.centered { display: grid; place-items: center; min-height: 100dvh; padding: 1.5rem; }
h1, h2, p, ul { margin: 0; }
ul { padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--warm); outline-offset: 2px; }
main:focus { outline: none; } /* focus lands here after the skip link, without a ring around the page */

.sr-only, .skip:not(:focus) {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
.skip {
  position: fixed; z-index: 100; top: .5rem; left: .5rem;
  padding: .625rem .875rem; border-radius: var(--radius);
  background: var(--fg); color: var(--bg); text-decoration: none; font-weight: 500;
}

.icon { width: 1.25rem; height: 1.25rem; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

/* ========== wordmark + quiet link ========== */
.wordmark {
  color: var(--fg);
  text-decoration: none;
  font-size: 1.375rem;
  font-weight: 500;
  letter-spacing: .6em;
  margin-right: -.6em;
  white-space: nowrap;
}
.quiet-link {
  display: inline-flex;
  align-items: center;
  min-height: var(--target);
  padding: 0 .5rem;
  color: var(--muted);
  font-size: .9375rem;
  text-decoration: none;
  border-radius: 6px;
  transition: color .2s;
}
.quiet-link:hover { color: var(--fg); }

/* ========== buttons ========== */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: var(--target);
  padding: 0 1rem;
  border: 1px solid transparent;
  border-radius: 999px;
  background: none;
  color: var(--fg);
  font: inherit;
  font-size: 1rem;
  font-weight: 400;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color .2s, border-color .2s, color .2s, opacity .2s;
}
.btn--ghost { color: var(--muted); }
.btn--ghost:hover { background: var(--hover); color: var(--fg); }
.btn--primary { background: var(--fg); color: var(--bg); font-weight: 500; }
.btn--primary:hover { background: #fff; }
.btn--danger { background: rgba(var(--danger-rgb), .16); border-color: rgba(var(--danger-rgb), .5); color: var(--danger); font-weight: 500; }
.btn--danger:hover { background: rgba(var(--danger-rgb), .26); }
.btn--danger-ghost { color: var(--muted); }
.btn--danger-ghost:hover { background: rgba(var(--danger-rgb), .12); color: var(--danger); }
.btn--block { width: 100%; }
.btn:disabled { opacity: .55; cursor: default; }
/* spinner while a request is running; the label stays so the button keeps its size */
.btn.is-busy > span { opacity: .45; }
.btn.is-busy::after {
  content: "";
  width: .875rem; height: .875rem;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.icon-btn {
  display: inline-grid;
  place-items: center;
  width: var(--target);
  height: var(--target);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: background-color .2s, color .2s;
}
.icon-btn:hover { background: var(--hover); color: var(--fg); }

/* ========== fields ========== */
.field { display: grid; gap: .5rem; }
.field + .field { margin-top: 1rem; }
.field label { color: var(--muted); font-size: .9375rem; }
.field input {
  width: 100%;
  height: 3rem;
  padding: 0 .875rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-2);
  color: var(--fg);
  font: inherit;
  font-size: 1rem; /* below 16px iOS zooms the page on focus */
  transition: border-color .2s;
}
.field input:hover { border-color: rgba(var(--fg-rgb), .3); }
.field input:focus-visible { border-color: var(--warm); outline: 2px solid rgba(var(--warm-rgb), .45); outline-offset: 0; }
.field input[aria-invalid="true"] { border-color: var(--danger); }
.field input[readonly] { color: var(--muted); }
.field__row { position: relative; }
.field__row input { padding-right: 3.25rem; }
.field__row .icon-btn { position: absolute; top: 50%; right: 2px; translate: 0 -50%; }
.field__hint { color: var(--muted); font-size: .9375rem; }

.message { font-size: .9375rem; }
.message--error { display: flex; gap: .5rem; margin-top: 1rem; padding: .625rem .75rem; border-radius: var(--radius); background: rgba(var(--danger-rgb), .1); color: var(--danger); }

/* ========== card + login ========== */
.login { display: grid; justify-items: center; gap: 1.75rem; width: min(28rem, 100%); }
.card {
  display: grid;
  width: 100%;
  padding: 2rem 1.75rem 1.75rem;
  border: 1px solid var(--faint);
  border-radius: 16px;
  background: rgba(var(--fg-rgb), .03);
  box-shadow: 0 30px 80px -40px rgba(0, 0, 0, .8);
}
.card__badge { display: grid; place-items: center; width: 3rem; height: 3rem; margin-bottom: 1.125rem; border-radius: 50%; background: var(--hover); color: var(--warm); }
.card__badge .icon { width: 1.5rem; height: 1.5rem; }
.card__title { font-size: 1.5rem; font-weight: 400; line-height: 1.25; }
.card__lead { margin: .375rem 0 1.5rem; color: var(--muted); font-size: 1rem; }
.card .btn--block { margin-top: 1.25rem; }

/* ========== notice (unavailable link: unavailable.html) ========== */
.notice { display: grid; justify-items: center; gap: 1.5rem; text-align: center; }
.notice p { color: var(--muted); font-size: 1.125rem; }

/* ========== home (the public page at /) ==========
   Follows dechemstudio.com: its logo, serif and square outlined button, with its photography.
   Assets are self-hosted in home/ because the CSP allows same-origin images and fonts only.
   Browsers fetch the fonts only for pages that use them, so the other pages don't pay for them. */
@font-face { font-family: "STIX Two Text"; font-weight: 400; font-display: swap; src: url("home/stix-two-text-regular.woff2") format("woff2"); }
@font-face { font-family: "STIX Two Text"; font-weight: 500; font-display: swap; src: url("home/stix-two-text-medium.woff2") format("woff2"); }

.home {
  display: grid;
  grid-template-columns: minmax(24rem, 36%) minmax(0, 1fr); /* minmax(0): the photos' natural size can't widen the page */
  min-height: 100dvh;
  background: var(--bg);
  font-family: "STIX Two Text", Georgia, "Times New Roman", serif;
}
.home__panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 3rem;
  padding: clamp(1.5rem, 3.5vw, 4rem);
}
.home__logo { display: block; width: 9rem; height: auto; }
.home__title { font-size: 2.25rem; font-weight: 500; line-height: 1.15; text-transform: uppercase; }
.home__lead { margin-top: .625rem; color: var(--muted); font-size: 1.1875rem; }
.home__cta {
  display: inline-flex;
  align-items: center;
  min-height: 3rem;
  margin-top: 2rem;
  padding: 0 1.25rem;
  border: 1px solid var(--fg);
  color: var(--fg);
  font-size: 1.125rem;
  letter-spacing: .03em;
  text-decoration: none;
  transition: background-color .2s, color .2s;
}
.home__cta:hover { background: var(--fg); color: var(--bg); }
.home__art {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  grid-template-rows: repeat(2, minmax(0, 1fr));
  gap: 2px;
  height: 100dvh;
}
.home__art img { display: block; width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: cover; }
.home__art img:first-child { grid-row: span 2; }

@media (max-width: 900px), (max-aspect-ratio: 1/1) {
  .home { grid-template-columns: minmax(0, 1fr); grid-template-rows: 1fr auto; }
  .home__panel { gap: 2.5rem; }
  .home__title { font-size: 1.875rem; }
  .home__art { height: auto; aspect-ratio: 3 / 2; }
}

/* ========== top bar ========== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.25rem;
  padding: .5rem 1rem .5rem 1.5rem;
}
.topbar .wordmark { font-size: 1.125rem; letter-spacing: .42em; margin-right: -.42em; }
.topbar__nav { display: flex; gap: .25rem; align-items: center; }

/* ========== links page ========== */
.page { max-width: 56rem; margin: 0 auto; padding: 1.5rem 1.5rem 4.5rem; }
.page__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.75rem; }
.page__title { font-size: 2rem; font-weight: 300; line-height: 1.2; }
.page__lead { margin-top: .25rem; color: var(--muted); font-size: 1rem; }
.page .message--error { margin: 0 0 1.25rem; }

.link-list { display: grid; gap: .75rem; }
.link {
  display: grid;
  gap: .625rem;
  padding: 1.125rem 1.25rem .75rem;
  border: 1px solid var(--faint);
  border-radius: 14px;
  background: rgba(var(--fg-rgb), .03);
}
.link--active { border-color: rgba(var(--warm-rgb), .28); }
.link__head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.link__client { font-size: 1.25rem; font-weight: 400; overflow-wrap: anywhere; }
.link--expired .link__client, .link--cancelled .link__client { color: var(--muted); }
.link__facts { display: flex; flex-wrap: wrap; gap: .125rem 1.125rem; color: var(--muted); font-size: .9375rem; }
.link__actions { display: flex; flex-wrap: wrap; gap: .25rem; margin: .25rem -.625rem 0; padding-top: .5rem; border-top: 1px solid var(--faint); }
.link__actions .btn { padding: 0 .75rem; }
.link__actions .btn:last-child { margin-left: auto; }

/* the state is always an icon and a word, never colour alone */
.chip {
  display: inline-flex;
  align-items: center;
  gap: .375rem;
  flex: none;
  padding: .3125rem .75rem .3125rem .5625rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: .875rem;
  line-height: 1.2;
}
.chip .icon { width: 1rem; height: 1rem; }
.chip--active { border-color: rgba(var(--warm-rgb), .5); background: rgba(var(--warm-rgb), .1); color: var(--warm); }

.empty { display: grid; justify-items: center; gap: .5rem; padding: 3.5rem 1.5rem; border: 1px dashed var(--line); border-radius: 14px; text-align: center; }
.empty__icon { display: grid; place-items: center; width: 3.5rem; height: 3.5rem; margin-bottom: .5rem; border-radius: 50%; background: var(--hover); color: var(--warm); }
.empty__icon .icon { width: 1.5rem; height: 1.5rem; }
.empty__title { font-size: 1.25rem; font-weight: 400; }
.empty__text { max-width: 38ch; color: var(--muted); font-size: 1rem; }

/* ========== dialogs (native <dialog>: focus trap and Esc come from the browser) ========== */
.dialog {
  width: min(30rem, calc(100vw - 2rem));
  padding: 1.625rem 1.5rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--bg-2);
  color: var(--fg);
  box-shadow: 0 40px 100px -30px rgba(0, 0, 0, .9);
}
.dialog::backdrop { background: rgba(6, 8, 8, .72); }
.dialog[open] { animation: pop .22s var(--ease); }
.dialog__title { margin-bottom: .5rem; font-size: 1.375rem; font-weight: 400; }
.dialog__text { color: var(--muted); font-size: 1rem; }
.dialog__actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: .5rem; margin-top: 1.375rem; }
.dialog form .field__hint { margin-top: 2px; }

/* ========== toast ========== */
.toast {
  position: fixed;
  z-index: 60;
  left: 50%;
  bottom: calc(1.5rem + env(safe-area-inset-bottom, 0px));
  translate: -50% 8px;
  max-width: calc(100vw - 2rem);
  padding: .6875rem 1.25rem;
  border-radius: 999px;
  background: rgba(var(--fg-rgb), .95);
  color: var(--bg);
  font-size: .9375rem;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transition: opacity .25s, translate .3s var(--ease);
}
.toast.is-visible { opacity: 1; translate: -50% 0; }

/* ========== responsive ========== */
@media (max-width: 560px) {
  .topbar { padding: .5rem .75rem .5rem 1rem; }
  .page { padding: 1rem 1rem 4rem; }
  .page__head { flex-direction: column; align-items: stretch; }
  .page__title { font-size: 1.625rem; }
  .link { padding: 1rem 1rem .625rem; }
  .link__head { align-items: flex-start; }
  .card { padding: 1.625rem 1.25rem 1.375rem; }
}

@keyframes spin { to { rotate: 360deg; } }
@keyframes pop { from { opacity: 0; translate: 0 8px; scale: .98; } }

/* ========== user preferences ========== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
@media (prefers-contrast: more) {
  :root { --muted: #cfccc5; --line: rgba(var(--fg-rgb), .5); --faint: rgba(var(--fg-rgb), .35); }
}
@media (forced-colors: active) {
  .btn--primary, .chip, .link, .card, .dialog, .toast { border: 1px solid CanvasText; }
  .btn.is-busy::after { border-color: CanvasText; border-right-color: transparent; }
}
