/* Study funnel on top of brut.css: the order wizard, the paper page and their dialogs.
   Class names are the ones study-new.js and study-paper.js already toggle. */

.st-main {
  padding-block: clamp(24px, 4vw, 48px) var(--section);
}

.brut .study-visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* ---------- buttons ---------- */

.study-button {
  --btn-bg: var(--paper);
  --btn-fg: var(--ink);
  --btn-line: var(--line-strong);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 24px;
  border: 1px solid var(--btn-line);
  border-radius: 12px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: 600 15px/1.15 var(--font-display);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.brut .study-button,
.brut .study-button:hover {
  color: var(--btn-fg);
}

.study-button:hover {
  border-color: var(--ink);
}

.study-button:active {
  box-shadow: inset 0 1px 2px rgba(29, 28, 26, 0.12);
}

/* The one ink button of a step. */
.study-button-primary {
  --btn-bg: var(--ink);
  --btn-fg: var(--paper);
  --btn-line: var(--ink);
}

/* Touch keeps :hover after a tap, so the tint is for real pointers only. */
@media (hover: hover) {
  .study-button-primary:hover {
    --btn-bg: #34322e;
  }
}

.study-button-primary:active {
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
}

.study-button:is(:disabled, [aria-busy="true"]),
.study-button:is(:disabled, [aria-busy="true"]):hover {
  border-color: var(--btn-line);
  box-shadow: none;
  cursor: not-allowed;
  opacity: 0.5;
}

.study-button-primary:is(:disabled, [aria-busy="true"]) {
  --btn-bg: var(--ink);
}

.study-button[aria-busy="true"] {
  cursor: progress;
}

.study-link-button,
.study-back,
.study-custom-subject-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: 600 15px/1.3 var(--font-body);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
  cursor: pointer;
  transition: color var(--dur) var(--ease), text-decoration-color var(--dur) var(--ease);
}

.study-link-button:hover,
.study-back:hover,
.study-custom-subject-toggle:hover {
  color: var(--cobalt);
  text-decoration-color: currentColor;
}

.study-link-button:active,
.study-back:active,
.study-custom-subject-toggle:active {
  color: var(--cobalt-deep);
}

.study-back {
  margin-bottom: 8px;
  text-decoration: none;
}

/* ---------- fields ---------- */

.st-form label > span,
.study-title-dialog label > span,
.study-materials-label,
.study-field-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 15px;
}

.st-form label > span em,
.study-title-dialog label > span em,
.study-materials-label em {
  margin-left: 6px;
  color: var(--text-3);
  font-style: normal;
  font-weight: 500;
}

.st-form textarea,
.st-form input[type="text"],
.st-form input[type="search"],
.st-form input[type="number"],
.st-form select,
.study-title-dialog input,
.study-title-dialog select {
  --field-r: 12px;
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--field-r);
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.45 var(--font-body);
  transition: border-color var(--dur) var(--ease);
}

.st-form textarea {
  min-height: 120px;
  resize: vertical;
}

.st-form :is(textarea, input, select):hover,
.study-title-dialog :is(input, select):hover {
  border-color: var(--text-3);
}

/* brut.css rounds every focus ring to 6px; fields keep their own radius. */
.st-form :is(textarea, input, select):focus-visible,
.study-title-dialog :is(input, select):focus-visible {
  border-color: var(--ink);
  border-radius: var(--field-r, 12px);
  outline: 2px solid var(--cobalt);
  outline-offset: 2px;
  box-shadow: none;
}

.st-form :is(textarea, input, select):disabled,
.study-title-dialog :is(input, select):disabled {
  border-color: var(--line);
  background: var(--paper-2);
  color: var(--text-3);
  cursor: not-allowed;
}

.st-form [aria-invalid="true"],
.st-form [aria-invalid="true"]:hover,
.st-form [aria-invalid="true"]:focus-visible {
  border-color: var(--red);
}

.st-form ::placeholder,
.study-title-dialog ::placeholder {
  color: #77746d;
}

.study-field-hint {
  display: block;
  margin-top: 8px;
  color: var(--text-3);
  font-size: 14px;
  line-height: 1.45;
}

/* A message right under the field it is about. */
.study-field-error {
  margin: 8px 0 0;
  color: var(--red);
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.4;
}

.study-form-error,
.study-checkout-error {
  margin: 0;
  color: var(--red);
  font-weight: 500;
  font-size: 15px;
  line-height: 1.4;
}

.study-form-error:empty,
.study-checkout-error:empty {
  display: none;
}

.study-form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

/* ---------- wizard ---------- */

.study-page-intro {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
}

.study-page-intro h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(32px, 4.4vw, 56px);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.02em;
}

.study-page-intro p {
  margin: 0;
  max-width: 56ch;
  color: var(--text-2);
  font-size: var(--t-lead);
}

.study-page-intro.is-compact h1 {
  font-size: clamp(22px, 2.4vw, 28px);
}

.study-page-intro.is-compact p {
  display: none;
}

.study-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 36px;
}

.study-progress span {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px 6px 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--paper);
  font-weight: 600;
  font-size: 14px;
}

.study-progress span b {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  font: 600 13px/1 var(--font-display);
}

.study-progress em {
  font-style: normal;
}

.study-progress span.is-active {
  background: var(--ink);
  color: var(--paper);
}

.study-progress span.is-active b {
  border-color: var(--paper);
  background: var(--lemon);
  color: var(--ink);
}

.study-progress span.is-done b {
  background: var(--mint);
}

.study-progress i {
  flex: 0 1 48px;
  border-top: 1px dashed var(--line-strong);
}

.study-wizard-step {
  display: none;
}

.study-wizard-step.is-active {
  display: block;
  animation: st-in 260ms var(--ease) both;
}

@keyframes st-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.study-wizard-heading {
  margin-bottom: 24px;
}

.study-wizard-heading h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(24px, 2.8vw, 36px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.015em;
}

.study-wizard-heading h2:focus {
  outline: none;
}

.study-wizard-heading p {
  margin: 10px 0 0;
  max-width: 60ch;
  color: var(--text-2);
}

/* Work types: one row per format, coloured like the rest of the site. */
.study-work-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 880px;
}

.study-work-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  width: 100%;
  padding: 20px 24px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-l);
  background: var(--paper);
  box-shadow: var(--shadow-s);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.study-work-row:hover {
  border-color: var(--ink);
}

.study-work-row:active {
  background: var(--paper-3);
}

.study-work-icon {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #b8b3a6;
}

.study-work-row[data-work-type="coursework_draft"] .study-work-icon { background: #6f8ae6; }
.study-work-row[data-work-type="exam_answers"] .study-work-icon { background: #e98fb5; }
.study-work-row[data-work-type="abstract"] .study-work-icon { background: #e7c443; }
.study-work-row[data-work-type="report"] .study-work-icon { background: #5cc08f; }

.study-work-text strong {
  display: block;
  font: 600 clamp(18px, 1.8vw, 22px)/1.2 var(--font-display);
}

.study-work-text small {
  display: block;
  margin-top: 6px;
  color: var(--text-2);
  font-size: 15px;
}

.study-work-price {
  font: 650 clamp(22px, 2.2vw, 30px)/1 var(--font-display);
  letter-spacing: -0.02em;
  white-space: nowrap;
}

/* Subject */
.study-search-field {
  display: block;
  max-width: 560px;
  margin-bottom: 22px;
}

.study-subject-picker {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  align-items: start;
  gap: 24px;
  margin-bottom: 22px;
}

.study-subject-categories {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.study-subject-categories button {
  min-height: 44px;
  padding: 10px 14px;
  border: var(--stroke-thin) solid transparent;
  border-radius: 12px;
  background: none;
  color: var(--ink);
  font: 600 15px/1.3 var(--font-body);
  text-align: left;
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.study-subject-categories button:hover {
  border-color: var(--line-strong);
  background: var(--paper);
}

.study-subject-categories button:active {
  background: var(--paper-3);
}

.study-subject-categories button.is-active {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
}

.study-subject-list {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 10px;
}

.study-subject-list button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--paper);
  color: var(--ink);
  font: 500 15px/1.2 var(--font-body);
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.study-subject-list button:hover {
  border-color: var(--ink);
}

.study-subject-list button:active {
  background: var(--paper-3);
}

/* Topic & requirements */
.study-topic-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  align-items: start;
  gap: 36px;
}

.study-topic-form {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.study-topic-form > label,
.study-field,
.study-questions-field,
.study-requirements-field {
  display: block;
}

.study-page-control {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) 52px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  overflow: hidden;
  background: var(--paper);
  transition: border-color var(--dur) var(--ease);
}

.study-page-control:has([aria-invalid="true"]) {
  border-color: var(--red);
}

.study-page-control button {
  border: 0;
  background: var(--paper-2);
  color: var(--ink);
  font: 600 22px/1 var(--font-display);
  cursor: pointer;
  transition: background-color var(--dur) var(--ease);
}

.study-page-control button:hover {
  background: var(--paper-3);
}

.study-page-control button:active {
  background: var(--line);
}

/* The control clips its children, so rings sit inside the edge. */
.brut .study-page-control button:focus-visible {
  border-radius: 0;
  outline-offset: -2px;
}

.brut .st-form .study-page-control input {
  --field-r: 0;
  min-height: 48px;
  border: 0;
  border-inline: 1px solid var(--line-strong);
  border-radius: 0;
  text-align: center;
  font: 600 18px/1 var(--font-display);
  -moz-appearance: textfield;
}

.study-page-control input::-webkit-inner-spin-button,
.study-page-control input::-webkit-outer-spin-button {
  -webkit-appearance: none;
}

.brut .st-form .study-page-control input:focus-visible {
  border-color: var(--line-strong);
  outline-offset: -2px;
}

.study-file-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
}

.study-file-row .study-field-hint {
  flex: 1 1 240px;
  margin: 0;
}

.study-file-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 16px;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--paper-2);
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.study-file-button:hover {
  border-color: var(--ink);
}

.study-file-button:active {
  background: var(--paper-3);
}

.study-file-row:has(input:focus-visible) .study-file-button {
  outline: 2px solid var(--cobalt);
  outline-offset: 2px;
}

.study-file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.study-file-list:empty {
  display: none;
}

.study-file-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 0 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--paper);
  font-weight: 500;
  font-size: 14.5px;
}

.study-file-list span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.study-file-list button {
  flex: none;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 0 11px 11px 0;
  background: none;
  color: var(--text-2);
  font: 500 14px/1 var(--font-body);
  cursor: pointer;
  transition: background-color var(--dur) var(--ease), color var(--dur) var(--ease);
}

.study-file-list button:hover {
  background: var(--paper-3);
  color: var(--ink);
}

.study-file-list button:active {
  background: var(--line);
}

.study-recognized {
  margin: 0;
  padding: 12px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--mint);
  font-weight: 500;
  font-size: 15px;
}

/* Formatting panel (wizard) */
.study-format-panel {
  border: 1px solid var(--line-strong);
  border-radius: var(--r-l);
  background: var(--paper);
}

.study-format-panel > summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--r-l);
  list-style: none;
  cursor: pointer;
}

.study-format-panel > summary::-webkit-details-marker {
  display: none;
}

.study-format-panel-text b {
  display: block;
  font-size: 16px;
  font-weight: 600;
}

.study-format-panel-text small {
  display: block;
  margin-top: 2px;
  color: var(--text-2);
  font-size: 14px;
}

.study-format-panel-action {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  font-weight: 500;
  font-size: 14px;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.study-format-panel > summary:hover .study-format-panel-action {
  border-color: var(--ink);
}

.study-format-panel > summary:active .study-format-panel-action,
.study-format-panel[open] .study-format-panel-action {
  background: var(--paper-3);
}

.study-format-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 0 18px 20px;
}

.study-format-body > .study-field-hint {
  margin: 0;
}

.study-format-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.study-format-grid label > span,
.study-format-margins legend {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
  font-size: 14px;
}

.study-format-grid :is(input:not([type="checkbox"]), select) {
  min-height: 46px !important;
  padding: 8px 12px !important;
  font-size: 15px !important;
}

.study-format-grid label.is-recognized > span::after {
  content: "из методички";
  margin-left: 8px;
  padding: 1px 8px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--mint);
  font-size: 11.5px;
  font-weight: 600;
}

.study-format-margins {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  grid-column: 1 / -1;
  margin: 0;
  padding: 0;
  border: 0;
}

.study-format-margins legend {
  padding: 0;
}

.study-format-margins label > span {
  font-weight: 500;
  color: var(--text-3);
}

.study-format-switches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 24px;
  grid-column: 1 / -1;
}

.study-check,
.brut .study-title-dialog .study-check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  font-weight: 500;
  font-size: 15px;
  cursor: pointer;
}

.brut .study-check > span {
  margin: 0;
  font-weight: 500;
}

.study-check input {
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--ink);
}

.study-submit-button {
  padding: 0 28px;
  font-size: 16px;
}

/* Order summary */
.study-order-summary {
  position: sticky;
  top: 24px;
  padding: 24px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-l);
  background: var(--lemon-soft);
  box-shadow: var(--shadow);
}

.study-order-summary h3 {
  margin: 0 0 14px;
  font: 600 20px/1.2 var(--font-display);
}

.study-order-summary dl {
  margin: 0;
}

.study-order-summary dl > div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-block: 8px;
  border-bottom: 1px dashed var(--line-strong);
  font-size: 14.5px;
}

.study-order-summary dt {
  color: var(--text-2);
}

.study-order-summary dd {
  margin: 0;
  font-weight: 600;
  text-align: right;
}

.study-order-price {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 14px;
  font-weight: 600;
}

.study-order-price > span:first-child {
  padding-top: 8px;
  white-space: nowrap;
}

.study-order-price-value {
  text-align: right;
}

.study-order-price b {
  font: 650 34px/1 var(--font-display);
  letter-spacing: -0.02em;
}

.study-order-price small,
.study-actionbar-info small {
  color: var(--text-3);
  font-size: 14px;
  font-weight: 500;
}

.study-order-price em {
  display: block;
  margin-top: 4px;
  color: var(--text-2);
  font-size: 14px;
  font-style: normal;
  font-weight: 500;
}

/* Tick lists use the site's .b-tick mark. */
.study-order-summary ul,
.study-check-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.study-order-summary ul {
  margin-top: 14px;
  font-size: 14px;
  font-weight: 500;
}

.study-order-summary li,
.study-check-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  line-height: 1.4;
}

.study-order-summary .b-tick,
.study-check-list .b-tick {
  width: 20px;
  height: 20px;
}

.study-order-summary .b-tick svg,
.study-check-list .b-tick svg {
  width: 12px;
  height: 12px;
}

/* Loader */
.study-loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 560px;
  margin: 40px auto;
  padding: 40px 28px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-l);
  background: var(--paper);
  box-shadow: var(--shadow-l);
  text-align: center;
}

.study-loader-mark {
  width: 64px;
  height: 64px;
  border: 6px solid var(--paper-3);
  border-top-color: var(--cobalt);
  border-right-color: var(--pink);
  border-radius: 50%;
  animation: st-spin 900ms linear infinite;
}

@keyframes st-spin {
  to { transform: rotate(360deg); }
}

.study-loader h2 {
  margin: 22px 0 6px;
  font: 600 24px/1.2 var(--font-display);
}

.study-loader p {
  margin: 0;
  color: var(--text-2);
}

.study-loader-track {
  width: 100%;
  height: 16px;
  margin: 22px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--paper-2);
  overflow: hidden;
}

.study-loader-track span {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--lemon);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 400ms var(--ease);
}

.study-loader small {
  color: var(--text-3);
  font-size: 14px;
}

/* Outline variants */
.study-outline-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr));
  align-items: start;
  gap: 24px;
}

.study-outline-card {
  padding: 20px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-l);
  background: var(--paper);
  box-shadow: var(--shadow-s);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
}

/* The chosen plan stays a white sheet: an ink edge and a small tick say it all. */
.study-outline-card.is-selected {
  border-color: var(--ink);
  box-shadow: var(--shadow);
}

.study-outline-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.study-outline-card-head > span {
  margin-right: auto;
  font: 600 18px/1.2 var(--font-display);
}

.study-outline-select,
.study-outline-edit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--paper);
  color: var(--ink);
  font: 600 14px/1 var(--font-display);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.study-outline-select:hover,
.study-outline-edit:hover {
  border-color: var(--ink);
}

.study-outline-select:active,
.study-outline-edit:active {
  background: var(--paper-3);
}

.study-outline-select[aria-pressed="true"] {
  padding-inline: 4px 6px;
  border-color: transparent;
  background: none;
  cursor: default;
}

.study-outline-edit {
  padding-inline: 14px;
  border-color: transparent;
  background: none;
  color: var(--text-2);
  font-weight: 500;
}

.study-outline-card.is-editing .study-outline-edit {
  background: var(--paper-3);
  color: var(--ink);
}

/* The tick is drawn like a pen stroke the moment a plan is picked. */
.study-outline-card.is-just-selected .study-outline-select .b-tick path {
  stroke-dasharray: 16;
  stroke-dashoffset: 16;
  animation: st-tick 280ms var(--ease) 60ms forwards;
}

@keyframes st-tick {
  to { stroke-dashoffset: 0; }
}

.study-outline-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 4px;
}

.study-outline-row > span {
  display: none;
}

.study-outline-row.is-child {
  margin-left: 18px;
  padding-left: 10px;
  border-left: 1px solid var(--line-strong);
}

.study-outline-row textarea {
  min-height: 36px;
  padding: 7px 10px;
  overflow: hidden;
  resize: none;
  border: var(--stroke-thin) solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--ink);
  font: 400 15px/1.45 var(--font-body);
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.study-outline-row:not(.is-child) textarea {
  font-weight: 600;
}

.study-outline-row textarea:hover {
  border-color: var(--line);
}

.study-outline-row textarea:focus {
  outline: none;
  border-color: var(--ink);
  background: var(--paper);
}

.brut .study-outline-row textarea:focus-visible {
  border-radius: 10px;
  outline: 2px solid var(--cobalt);
  outline-offset: 1px;
}

.study-outline-row textarea[aria-invalid="true"] {
  border-color: var(--red);
}

.study-outline-row > .study-field-error {
  grid-column: 1 / -1;
  margin: 2px 10px 6px;
}

/* Remove buttons: touch screens show them after «Править»,
   a mouse sees them on the row it points at, the keyboard on focus. */
.study-outline-remove {
  display: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--text-3);
  font: 400 22px/1 var(--font-body);
  cursor: pointer;
  transition: opacity var(--dur) var(--ease), background-color var(--dur) var(--ease), color var(--dur) var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.study-outline-card.is-editing .study-outline-remove {
  display: grid;
}

.study-outline-remove:hover {
  background: color-mix(in srgb, var(--red) 10%, var(--paper));
  color: var(--red);
}

.study-outline-remove:active {
  background: color-mix(in srgb, var(--red) 18%, var(--paper));
}

@media (hover: hover) and (pointer: fine) {
  .study-outline-edit {
    display: none;
  }

  .study-outline-remove {
    display: grid;
    width: 32px;
    height: 32px;
    margin-top: 3px;
    font-size: 20px;
    opacity: 0;
  }

  .study-outline-row:is(:hover, :focus-within) .study-outline-remove {
    opacity: 1;
  }
}

.study-outline-add {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 10px;
  padding: 0 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 10px;
  background: none;
  color: var(--ink);
  font: 500 14px/1 var(--font-body);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.study-outline-add:hover {
  border-color: var(--ink);
}

.study-outline-add:active {
  background: var(--paper-3);
}

/* ---------- action bar: price and the step's one ink action ---------- */

.study-actionbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 20px;
}

.study-actionbar > .study-form-error,
.study-actionbar > .study-checkout-error {
  flex: 1 1 100%;
}

/* Phones only: on wide screens the side panel already shows the price. */
.study-actionbar-info {
  display: none;
  margin: 0;
}

.study-outline-actions {
  justify-content: flex-end;
  margin-top: 28px;
}

.study-paper-actionbar {
  display: none;
}

/* ---------- paper page ---------- */

.study-paper-page-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 32px;
  margin-bottom: 28px;
}

.study-paper-page-heading h1 {
  margin: 0;
  max-width: 28ch;
  font: 600 clamp(26px, 3.2vw, 42px)/1.08 var(--font-display);
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.study-paper-page-heading p {
  margin: 10px 0 0;
  color: var(--text-2);
  font-weight: 600;
}

.study-paper-page-status {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--paper);
  font-weight: 600;
  font-size: 14px;
}

.study-status-dot {
  width: 10px;
  height: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--mint);
}

.study-paper-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  align-items: start;
  gap: 40px;
}

.study-paper-topline {
  margin-bottom: 14px;
}

.study-paper-topline a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-weight: 600;
  font-size: 15px;
}

.study-paper-sheet {
  position: relative;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--paper);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.study-paper-title-page {
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 0 0 32px;
  border-bottom: 1px dashed var(--line-strong);
  font-family: "Times New Roman", Times, serif;
}

.study-paper-title-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--paper-2);
  font: 600 14px/1.2 var(--font-body);
}

.study-paper-title-toolbar button {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-pill);
  background: var(--paper);
  color: var(--ink);
  font: 600 14px/1 var(--font-display);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.study-paper-title-toolbar button:hover {
  border-color: var(--ink);
}

.study-paper-title-toolbar button:active {
  background: var(--paper-3);
}

.study-paper-title-toolbar button:disabled {
  border-color: var(--line-strong);
  background: var(--paper);
  cursor: not-allowed;
  opacity: 0.5;
}

.study-paper-title-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px;
  padding: 8px clamp(20px, 5vw, 64px) 0;
  text-align: center;
}

.study-paper-title-main > span {
  font-size: 15px;
}

.study-paper-title-main small {
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.study-paper-title-main h2 {
  margin: 8px 0;
  font: 600 20px/1.35 "Times New Roman", Times, serif;
}

.study-paper-title-main p {
  margin: 0;
}

.study-paper-title-details {
  align-self: flex-end;
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: min(100%, 360px);
  padding-inline: clamp(20px, 5vw, 64px);
  font-size: 15px;
}

.study-paper-title-details p {
  margin: 0;
}

.study-paper-title-details > span {
  margin-top: 24px;
  align-self: center;
}

.study-paper-content {
  padding: clamp(22px, 4vw, 56px);
  font-family: "Times New Roman", Times, serif;
  font-size: 17px;
  line-height: 1.6;
}

.study-paper-lead {
  margin: 0 0 24px;
  padding: 16px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--paper-2);
  font: 500 16px/1.55 var(--font-body);
}

.study-paper-facts {
  display: flex;
  flex-direction: column;
  margin-bottom: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  font-family: var(--font-body);
}

.study-paper-facts article {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 6px 20px;
  padding: 14px 16px;
}

.study-paper-facts article + article {
  border-top: 1px dashed var(--line-strong);
}

.study-paper-facts span {
  display: block;
  padding-top: 1px;
  color: var(--text-2);
  font: 600 14px/1.35 var(--font-display);
}

.study-paper-facts p {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.5;
}

.study-paper-section-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 14px;
  margin-bottom: 12px;
}

.study-paper-section-head span {
  color: var(--text-3);
  font: 600 14px/1.3 var(--font-body);
}

/* Headings inside the document mock follow GOST, so capitals stay here. */
.study-paper-outline h2,
.study-paper-text h2 {
  margin: 0;
  font: 600 18px/1.35 "Times New Roman", Times, serif;
  text-transform: uppercase;
}

.study-paper-text h2 {
  margin: 28px 0 12px;
  text-align: center;
}

.study-paper-outline ol {
  margin: 0;
  padding-left: 1.4em;
}

.study-paper-outline li {
  padding-block: 2px;
}

.study-paper-outline li ol {
  list-style: none;
  padding-left: 1.2em;
}

.study-paper-text p {
  margin: 0;
  text-align: justify;
  text-indent: 1.25cm;
  hyphens: auto;
}

.study-paper-empty {
  padding: 40px 0;
  text-align: center;
  font-family: var(--font-body);
}

.study-paper-empty h2 {
  font: 600 22px/1.2 var(--font-display);
}

/* The rest of the text, blurred until payment. */
.study-blur-zone {
  position: relative;
  min-height: 420px;
  margin: 24px calc(clamp(22px, 4vw, 56px) * -1) calc(clamp(22px, 4vw, 56px) * -1);
  overflow: hidden;
}

.study-blur-copy {
  padding: 10px clamp(22px, 4vw, 56px) 120px;
  filter: blur(5px);
  opacity: 0.5;
  user-select: none;
}

.study-blur-copy p {
  margin: 0 0 10px;
  text-indent: 1.25cm;
}

.study-blur-zone::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), var(--paper) 72%);
}

.study-blur-zone.is-unlocked .study-blur-copy {
  display: none;
}

.study-blur-zone.is-unlocked {
  min-height: 0;
}

.study-blur-zone.is-unlocked::after {
  display: none;
}

.study-blur-zone.is-unlocked .study-unlock-card {
  position: relative;
  left: auto;
  bottom: auto;
  margin: 8px auto 36px;
  transform: none;
}

.study-unlock-card {
  position: absolute;
  z-index: 2;
  left: 50%;
  bottom: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: min(calc(100% - 40px), 540px);
  padding: 26px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-l);
  background: var(--lemon-soft);
  box-shadow: var(--shadow-l);
  font-family: var(--font-body);
  text-align: center;
  transform: translateX(-50%);
}

.study-lock-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--paper);
  font-size: 20px;
}

.study-unlock-card h3 {
  margin: 0;
  font: 600 20px/1.2 var(--font-display);
}

.study-unlock-card p {
  margin: 0;
  max-width: 44ch;
  font-size: 15px;
  line-height: 1.5;
}

.study-disclaimer {
  margin: 16px 0 0;
  color: var(--text-3);
  font-size: 14px;
}

/* Checkout */
.study-checkout-card {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-l);
  background: var(--paper);
  box-shadow: var(--shadow-l);
}

.study-checkout-heading > span {
  color: var(--text-2);
  font: 600 15px/1.2 var(--font-display);
}

.study-checkout-heading h2 {
  margin: 6px 0 4px;
  font: 650 clamp(40px, 4vw, 52px)/1 var(--font-display);
  letter-spacing: -0.03em;
}

.study-checkout-heading h2 b {
  font-weight: inherit;
}

.study-checkout-heading p {
  margin: 0;
  color: var(--text-2);
  font-weight: 600;
  font-size: 15px;
}

.study-check-list li {
  font-weight: 500;
  font-size: 15px;
}

.study-paper-format-chip {
  display: flex;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--paper-2);
  font-size: 14px;
  line-height: 1.45;
}

.study-paper-format-chip b {
  display: block;
  font-weight: 600;
}

.study-paper-format-chip button {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: 600 14px/1.3 var(--font-body);
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: pointer;
  transition: color var(--dur) var(--ease), text-decoration-color var(--dur) var(--ease);
}

.study-paper-format-chip button:hover {
  color: var(--cobalt);
  text-decoration-color: currentColor;
}

.study-paper-format-chip button:active {
  color: var(--cobalt-deep);
}

.study-paper-format-chip button:disabled {
  color: var(--ink);
  text-decoration-color: var(--line-strong);
  opacity: 0.5;
  cursor: not-allowed;
}

.study-checkout-note {
  display: flex;
  gap: 10px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 1.45;
}

.study-checkout-note p {
  margin: 0;
}

.study-pay-button {
  width: 100%;
}

.study-safe-payment {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--text-3);
  font-size: 13.5px;
  font-weight: 500;
}

/* ---------- dialogs ---------- */

.study-title-dialog {
  width: min(calc(100vw - 32px), 640px);
  max-height: calc(100dvh - 32px);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-l);
  background: var(--paper);
  box-shadow: var(--shadow-l);
  color: var(--ink);
  font-family: var(--font-body);
}

.study-format-dialog {
  width: min(calc(100vw - 32px), 860px);
}

.study-title-dialog::backdrop {
  background: rgba(17, 17, 17, 0.5);
}

.study-title-dialog form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
}

.study-title-dialog label {
  display: block;
}

.study-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.study-dialog-head span {
  color: var(--text-2);
  font: 600 14px/1.2 var(--font-display);
}

.study-dialog-head h2 {
  margin: 6px 0;
  font: 600 24px/1.15 var(--font-display);
}

.study-dialog-head p {
  margin: 0;
  color: var(--text-2);
  font-size: 15px;
}

.study-dialog-head button {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--paper);
  color: var(--ink);
  font: 500 20px/1 var(--font-body);
  cursor: pointer;
  transition: border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}

.study-dialog-head button:hover {
  border-color: var(--ink);
}

.study-dialog-head button:active {
  background: var(--paper-3);
}

.study-title-dialog .study-button {
  align-self: flex-start;
}

/* ---------- small screens ---------- */

@media (max-width: 980px) {
  .study-topic-layout,
  .study-paper-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .study-order-summary,
  .study-checkout-card {
    position: relative;
    top: auto;
  }

  .study-subject-picker {
    grid-template-columns: minmax(0, 1fr);
  }

  .study-subject-categories {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding-bottom: 6px;
  }

  .study-subject-categories button {
    flex: none;
    border-color: var(--line-strong);
    border-radius: var(--r-pill);
    background: var(--paper);
  }

  .study-subject-categories button:hover {
    border-color: var(--ink);
  }
}

/* Phones: the price and the next step ride along at the bottom of the screen. */
@media (max-width: 760px) {
  html:has(.study-actionbar) {
    scroll-padding-bottom: 136px;
  }

  .study-actionbar {
    position: sticky;
    bottom: 0;
    z-index: 20;
    gap: 8px 16px;
    margin-inline: calc(var(--gutter) * -1);
    padding: 10px var(--gutter) calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
    background: var(--paper);
  }

  .study-actionbar-info {
    display: flex;
    flex: 1 1 100%;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 2px 12px;
    font-size: 14.5px;
    line-height: 1.3;
  }

  .study-actionbar-info b {
    font-weight: 600;
  }

  .study-actionbar-info small {
    font-size: 13.5px;
  }

  .study-actionbar .study-button {
    flex: 1 1 auto;
    min-height: 48px;
  }

  .study-outline-actions {
    margin-top: 24px;
  }

  .study-paper-actionbar {
    display: flex;
  }

  /* The bar carries these on phones; the card keeps the details. */
  .study-checkout-card :is(#payButton, #downloadButton, #downloadPdfButton, #checkoutError) {
    display: none;
  }

  .study-checkout-card #workspaceButton {
    --btn-bg: var(--paper);
    --btn-fg: var(--ink);
    --btn-line: var(--line-strong);
  }
}

@media (max-width: 640px) {
  .study-progress em {
    display: none;
  }

  .study-progress span {
    padding-right: 6px;
  }

  .study-progress span.is-active em {
    display: inline;
  }

  .study-progress span.is-active {
    padding-right: 14px;
  }

  .study-work-row {
    grid-template-columns: 12px minmax(0, 1fr);
    gap: 6px 14px;
    padding: 16px 18px;
  }

  .study-work-row {
    align-items: start;
  }

  .study-work-icon {
    margin-top: 7px;
  }

  .study-format-panel > summary {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }

  .study-format-panel-action {
    justify-self: start;
  }

  .study-work-price {
    grid-column: 2;
    font-size: 22px;
  }

  .study-form-row,
  .study-paper-facts article {
    grid-template-columns: minmax(0, 1fr);
  }

  .study-format-margins {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .study-unlock-card {
    padding: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .study-wizard-step.is-active,
  .study-loader-mark {
    animation: none;
  }

  .study-outline-card.is-just-selected .study-outline-select .b-tick path {
    animation: none;
    stroke-dashoffset: 0;
  }
}

/* Token prices: the number leads, the unit follows quietly. */
.study-work-price small,
.study-checkout-heading h2 small {
  color: var(--text-3);
  font-size: 0.5em;
  font-weight: 500;
  letter-spacing: 0;
}

.study-checkout-balance {
  margin: 6px 0 0;
  color: var(--text-2);
  font-size: 14.5px;
  font-weight: 500;
}

.study-order-note {
  margin: 10px 0 0;
  color: var(--text-2);
  font-size: 13.5px;
}

.study-nowrap {
  white-space: nowrap;
}

/* brut.css rounds every focus ring to 6px; study controls keep their own shape. */
.brut .study-button:focus-visible,
.brut .study-subject-categories button:focus-visible {
  border-radius: 12px;
}

.brut :is(.study-work-row, .study-format-panel > summary):focus-visible {
  border-radius: var(--r-l);
}

.brut :is(.study-subject-list button, .study-outline-select, .study-outline-edit, .study-paper-title-toolbar button):focus-visible {
  border-radius: var(--r-pill);
}

.brut :is(.study-outline-add, .study-outline-remove):focus-visible {
  border-radius: 10px;
}

.brut .study-file-list button:focus-visible {
  border-radius: 0 11px 11px 0;
  outline-offset: -2px;
}

.brut .study-dialog-head button:focus-visible {
  border-radius: 50%;
}

@media (max-width: 980px) {
  .brut .study-subject-categories button:focus-visible {
    border-radius: var(--r-pill);
  }
}

/* Outline step on wide screens: say the step is free next to its button. */
@media (min-width: 761px) {
  .study-outline-actions .study-actionbar-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-right: auto;
    font-size: 15px;
    line-height: 1.3;
  }
}

/* The price line waits until the work type is known. */
.study-actionbar-info [hidden] {
  display: none;
}
