/* -------- RESET -------- */

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

html, body,
h1, h2, h3, h4, h5, h6,
p, ul, ol, dl, dd,
blockquote, figure,
pre, table, th, td,
form, fieldset, legend {
  margin: 0;
  padding: 0;
}

img, video {
  display: block;
  max-width: 100%;
  height: auto;
}

ul[class], ol[class] {
  list-style: none;
  padding-left: 0;
}

fieldset[class] {
  border: none;
  padding: 0;
}

address[class] {
  font-style: normal;
}

table {
  border-collapse: collapse;
  border-color: currentColor;
}

input, textarea, select, button {
  font: inherit;
}

html {
  height: 100%;
  scroll-behavior: smooth;
}

a[class] {
  display: inline-flex;
}

button, label {
  cursor: pointer;
}

/* -------- VARIABLES -------- */

:root {
  --color-dark: hsl(0, 0%, 5%);
  --color-white: hsl(0, 0%, 100%);
  --color-dark-grey: hsl(0, 0%, 40%);
  --color-light-grey: hsl(0, 0%, 70%);
  --color-super-light-grey: hsl(0, 0%, 90%);
  --color-reddish: rgb(187, 17, 51);
  --color-reddish-transparent: rgba(220, 20, 60, 0.56);
}

/* -------- BASE -------- */

body {
  font-family: "PT Serif", serif;
  background-color: var(--color-white);
  color: var(--color-dark);
}

h1, h2 {
  font-weight: 700;
  font-size: clamp(18px, 8vw, 70px);
  user-select: none;
}

p {
  font-family: "Roboto", sans-serif;
  font-size: clamp(14px, .8vw, 22px);
  font-weight: 400;
}

a {
  font-family: "Roboto", sans-serif;
  text-decoration: none;
  color: var(--color-dark);
  cursor: pointer;
  font-size: clamp(14px, .8vw, 22px);
  font-weight: 700;
}

button {
  font-family: "Roboto", sans-serif;
  font-size: clamp(14px, .8vw, 22px);
  padding: 5px 8px;
  color: var(--color-white);
  background-color: var(--color-dark);
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.25s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.controls button {
  color: var(--color-white);
  height: 36px;
  width: 36px;
}

#up-btn {
  margin-left: 8px;
}
/* -------- LAYOUT -------- */

.block {
  max-width: 1880px;
  margin-inline: auto;
}

.info {
  position: relative;
  height: 100svh;
  display: flex;
  flex-direction: column;
  text-align: center;
  justify-content: center;
  gap: 30px;
  padding: 20px;
  background: url('../img/back.svg') center no-repeat;
  margin-bottom: 40px;
}

.om62 {
  color: crimson;
}

.see_pdf {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.mail {
  position: absolute;
  bottom: 20px; /* расстояние от низа */
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
}

.contact {
  background-color: hsl(0, 0%, 75%);
  padding: 6px 10px;
  border-radius: 10px;
}

/* -------- PDF VIEWER -------- */

.pdf {
  height: 100svh;
  padding: 20px 0;
  display: flex;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-bottom: 20px;
  gap: 4px;
}

#pdf-container {
  height: calc(100% - 60px);
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

#pdf-canvas {
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Loading and error states */
.pdf-loading,
.error {
  text-align: center;
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  margin-block: auto;
}

.pdf-loading p {
  color: var(--color-dark-grey);
}

/* Spinner animation */
.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid var(--color-super-light-grey);
  border-top: 4px solid var(--color-reddish);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.error {
  color: var(--color-reddish);
}

.error p {
  margin-bottom: 10px;
}

/* -------- BUTTONS -------- */

.controls button {
  background: var(--color-reddish-transparent);
}

.controls button:hover {
  background: var(--color-reddish);
}

.controls button:disabled {
  background: var(--color-dark-grey);
  cursor: not-allowed;
  opacity: 0.6;
}

/* -------- INPUT -------- */

input[type="number"] {
  border: 1px solid var(--color-dark);
  border-radius: 5px;
  max-width: 80px;
  height: 36px;
  margin-left: 1vw;
  background-color: transparent;
  transition: border-color 0.25s ease;
  padding-left: 4px;
}

input[type="number"]:focus {
  outline: none;
  border-color: var(--color-reddish);
}

/* Remove spinner on number input */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  appearance: none;
  margin: 0;
}

input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* -------- PAGE INFO -------- */

.page-info {
  text-align: center;
  white-space: nowrap;
}

/* -------- MOBILE -------- */

@media (max-width: 600px) {
  .info {
    padding: 40px 15px;
  }

  .pdf {
    padding: 15px 4px;
    min-height: auto;
    padding-bottom: 20px;
  }

  #pdf-container {
    height: calc(100svh - 60px);
  }

  #pdf-canvas {
    max-height: calc(100vh - 100px);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    border-radius: 4px;
  }

  .controls {
    gap: 8px;
    padding: 0 5px;
    margin-bottom: 15px;
  }

  input[type="number"] {
    margin-left: 8px;
  }

  #up-btn {
    margin-left: 8px;
  }

}

/* -------- DARK MODE -------- */

@media (prefers-color-scheme: dark) {
  body {
    background-color: var(--color-dark);
    color: var(--color-white);
  }

  .info {
    background: url('../img/back-light.svg') center no-repeat;
  }

  .contact {
    background-color: hsl(0, 0%, 25%);
  }

  a {
    color: var(--color-white);
  }

  button {
    color: var(--color-dark);
    background-color: var(--color-white);
  }

  .page-info {
    color: var(--color-white);
  }

  input[type="number"] {
    border: 1px solid var(--color-white);
    color: var(--color-white);
  }

  input[type="number"]:focus {
    border-color: var(--color-reddish);
  }

  .error {
    color: rgb(255, 99, 132);
  }

  .pdf-loading p {
    color: var(--color-light-grey);
  }

  .spinner {
    border-color: var(--color-dark-grey);
    border-top-color: var(--color-reddish);
  }

  #pdf-canvas {
    box-shadow: 0 4px 6px rgba(255, 255, 255, 0.1);
  }


  @media (max-width: 600px) {
    #pdf-canvas {
      box-shadow: 0 2px 4px rgba(255, 255, 255, 0.1);
    }
  }
}

/* -------- REDUCED MOTION -------- */

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