*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--btn);
  font-family: Montserrat, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- landing ---------- */
.home {
  --inset: 32px;   /* frame line distance from the window edge */
  --dot: 9px;
  --pitch: 22px;
  --corner: 41px;
  min-height: 100vh;
  min-height: 100dvh;
  background-attachment: fixed;
}

/* Dotted frame with leaf corners, drawn in the button colour so it follows the theme */
.frame {
  position: fixed;
  inset: var(--inset);
  border: 1.5px solid var(--btn);
  pointer-events: none;
  z-index: 0;
}
.frame::before,
.frame::after {
  content: "";
  position: absolute;
  --d: radial-gradient(circle, var(--btn) calc(var(--dot) / 2 - .5px), transparent calc(var(--dot) / 2));
}
.frame::before { /* top and bottom rows */
  inset: 3px calc(var(--corner) + 4px);
  background: var(--d) top / var(--pitch) var(--dot) space no-repeat,
              var(--d) bottom / var(--pitch) var(--dot) space no-repeat;
}
.frame::after { /* left and right columns */
  inset: calc(var(--corner) + 4px) 3px;
  background: var(--d) left / var(--dot) var(--pitch) no-repeat space,
              var(--d) right / var(--dot) var(--pitch) no-repeat space;
}
.corner {
  position: absolute;
  width: var(--corner);
  height: calc(var(--corner) * 44 / 41);
  background: var(--btn);
  -webkit-mask: url(corner.png) center / contain no-repeat;
          mask: url(corner.png) center / contain no-repeat;
}
.corner.tl { top: 1px; left: 1px; }
.corner.tr { top: 1px; right: 1px; transform: scaleX(-1); }
.corner.bl { bottom: 1px; left: 1px; transform: scaleY(-1); }
.corner.br { bottom: 1px; right: 1px; transform: scale(-1); }

.landing {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(var(--inset) + 12px) calc(var(--inset) + 24px);
  display: flex;
  flex-direction: column;
  align-items: center;
}
.logo {
  margin: 7.2vh 0 0;
  width: min(40.5vw, 780px);
  display: flex;
  justify-content: center;
}
.logo img { display: block; width: 100%; height: auto; }
.logo-text {
  font: 700 clamp(26px, 4vw, 64px)/1.05 "Archivo", sans-serif;
  text-align: center;
  color: var(--btn);
}

.links {
  width: min(26.8vw, 515px);
  margin-top: 13.4vh;
  display: flex;
  flex-direction: column;
  gap: clamp(16px, 1.5vw, 29px);
}
.menu-link {
  display: flex;
  align-items: center;
  justify-content: center;
  height: clamp(46px, 2.62vw, 50px);
  padding: 0 14px;
  border-radius: clamp(16px, 1.05vw, 20px);
  background: var(--btn);
  color: var(--btn-text);
  text-align: center;
  text-decoration: none;
  text-transform: uppercase;
  font: 800 clamp(15px, 1.62vw, 31px)/1 "Archivo", sans-serif;
  font-stretch: 125%;
  letter-spacing: .01em;
  white-space: nowrap;
  transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
  animation: rise .6s cubic-bezier(.2, .7, .2, 1) both;
  animation-delay: calc(.25s + var(--i, 0) * .08s);
}
.menu-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(0, 0, 0, .3);
  filter: brightness(1.06);
}
.menu-link:active { transform: translateY(0) scale(.985); }
.menu-link:focus-visible { outline: 2px solid var(--btn); outline-offset: 4px; }
.logo { animation: rise .7s cubic-bezier(.2, .7, .2, 1) both; }
.empty { text-align: center; opacity: .7; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .menu-link, .logo { animation: none; }
}

@media (max-width: 1100px) {
  .logo { width: min(62vw, 560px); }
  .links { width: min(60vw, 460px); }
  .menu-link { font-size: clamp(13px, 2.3vw, 22px); }
}
@media (max-width: 640px) {
  .home { --inset: 12px; --dot: 6px; --pitch: 15px; --corner: 26px; }
  .landing { padding: 0 34px 40px; }
  .logo { width: 100%; margin-top: 15vh; }
  .links { width: 100%; margin-top: 11vh; gap: 14px; }
  .menu-link { height: 48px; font-size: clamp(12px, 4.1vw, 17px); }
}

/* ---------- PDF viewer ---------- */
.viewer { background: var(--viewer-bg); }
.bar {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--btn);
  color: var(--btn-text);
}
.bar h1 {
  flex: 1;
  margin: 0;
  font: 800 13px "Archivo", Montserrat, sans-serif;
  font-stretch: 125%;
  text-transform: uppercase;
  letter-spacing: .04em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-btn {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  color: inherit;
}
.bar-btn:hover { background: rgba(0, 0, 0, .08); }
.pages { max-width: 900px; margin: 0 auto; }
.page { width: 100%; background: rgba(0, 0, 0, .04); }
.page + .page { margin-top: 2px; }
.page canvas { display: block; width: 100%; height: 100%; }
.loading { padding: 48px 16px; text-align: center; color: var(--btn); }
.loading a { color: inherit; }
