/* =====================================================================
   BIS Classic — Declaration form
   Brand: Mont typeface; #3246A8 deep blue, #80ACFF light blue,
          #00BFA5 teal, #FBC02D amber (00_Branding/02_Colours/COLOR.pdf)
   ===================================================================== */

/* Weight mapping matches PLATFORM/server/services/pdfAssets.js exactly,
   so the web form and the generated PDFs stay typographically identical. */
@font-face { font-family:"Mont"; src:url("assets/fonts/Mont-Book.otf")     format("opentype"); font-weight:400; font-style:normal; font-display:swap; }
@font-face { font-family:"Mont"; src:url("assets/fonts/Mont-SemiBold.otf") format("opentype"); font-weight:600; font-style:normal; font-display:swap; }
@font-face { font-family:"Mont"; src:url("assets/fonts/Mont-Bold.otf")     format("opentype"); font-weight:700; font-style:normal; font-display:swap; }
@font-face { font-family:"Mont"; src:url("assets/fonts/Mont-Heavy.otf")    format("opentype"); font-weight:800; font-style:normal; font-display:swap; }

:root{
  --blue:#3246A8;
  --blue-light:#80ACFF;
  --teal:#00BFA5;
  --amber:#FBC02D;

  --blue-dark:#26377F;
  --blue-tint:#EEF2FF;
  --blue-tint-2:#E0E8FF;

  --ink:#1A1D2E;
  --ink-soft:#5A6076;
  --ink-faint:#8A90A6;
  --line:#DDE1EC;
  --line-soft:#EBEEF5;
  --bg:#F6F7FB;
  --card:#FFFFFF;
  --danger:#C0392B;
  --danger-tint:#FDF0EE;

  --radius:12px;
  --radius-lg:18px;
  --shadow:0 1px 2px rgba(26,29,46,.05), 0 8px 24px rgba(26,29,46,.06);
  --maxw:52rem;
}

*,*::before,*::after{ box-sizing:border-box; }
html{ -webkit-text-size-adjust:100%; }
body{
  margin:0; background:var(--bg); color:var(--ink);
  font-family:"Mont", ui-sans-serif, system-ui, "Segoe UI", Roboto, sans-serif;
  font-weight:400; font-size:17px; line-height:1.55;
  -webkit-font-smoothing:antialiased;
}
:focus-visible{ outline:3px solid var(--blue-light); outline-offset:2px; border-radius:4px; }

/* ---------- header ---------- */
.site-header{
  position:sticky; top:0; z-index:50;
  background:rgba(255,255,255,.92); backdrop-filter:blur(10px);
  border-bottom:1px solid var(--line);
}
.site-header__inner{
  max-width:var(--maxw); margin:0 auto; padding:.85rem 1.25rem;
  display:flex; align-items:center; gap:1rem;
}
.logo{ height:38px; width:auto; flex:none; }
.site-header__spacer{ flex:1; }

.lang-switch{
  display:inline-flex; align-items:center; gap:.4rem;
  background:var(--card); border:1.5px solid var(--line);
  border-radius:999px; padding:.3rem; font-weight:600; font-size:.85rem;
}
.lang-switch button{
  font:inherit; font-weight:600; color:var(--ink-soft);
  background:none; border:0; cursor:pointer;
  padding:.4rem .85rem; border-radius:999px; min-height:34px;
  transition:background .15s, color .15s;
}
.lang-switch button[aria-pressed="true"]{ background:var(--blue); color:#fff; }
.lang-switch button:not([aria-pressed="true"]):hover{ background:var(--blue-tint); color:var(--blue); }

/* ---------- layout ---------- */
main{ max-width:var(--maxw); margin:0 auto; padding:2rem 1.25rem 6rem; }

.intro{ text-align:center; padding:2rem 0 1rem; }
.intro h1{ font-weight:800; font-size:clamp(1.7rem,4.5vw,2.4rem); line-height:1.15; margin:.25rem 0 .5rem; color:var(--blue); letter-spacing:-.01em; }
.intro .year{ display:inline-block; font-weight:600; font-size:.95rem; color:var(--ink-soft); background:var(--blue-tint); border-radius:999px; padding:.3rem 1rem; }
.intro p{ color:var(--ink-soft); max-width:34rem; margin:.75rem auto 0; }
/* The same title block above a grade's form, tightened up: it sits over
   the grade heading rather than over the whole page. */
.intro--form{ padding:1.25rem 0 .5rem; }
.intro--form h1{ font-size:clamp(1.4rem,3.5vw,1.8rem); margin:.35rem 0 0; }

/* ---------- grade picker ---------- */
.grade-groups{ display:grid; gap:1.5rem; margin-top:2rem; }
.grade-group h2{
  font-size:.78rem; font-weight:700; text-transform:uppercase; letter-spacing:.09em;
  color:var(--ink-faint); margin:0 0 .75rem;
}
.grade-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(7.5rem,1fr)); gap:.6rem; }
.grade-btn{
  font:inherit; font-weight:600; cursor:pointer;
  background:var(--card); color:var(--ink);
  border:1.5px solid var(--line); border-radius:var(--radius);
  padding:1rem .75rem; min-height:64px; text-align:center;
  transition:border-color .15s, background .15s, transform .1s, box-shadow .15s;
}
.grade-btn:hover{ border-color:var(--blue-light); background:var(--blue-tint); box-shadow:var(--shadow); }
.grade-btn:active{ transform:translateY(1px); }

/* ---------- form ---------- */
.form-head{
  display:flex; align-items:flex-start; gap:1rem; flex-wrap:wrap;
  padding-bottom:1.25rem; margin-bottom:1.5rem; border-bottom:2px solid var(--line);
}
.form-head h1{ margin:0; font-size:1.5rem; font-weight:800; color:var(--blue); letter-spacing:-.01em; }
.form-head .sub{ color:var(--ink-soft); font-size:.95rem; margin-top:.15rem; }
.form-head .spacer{ flex:1; }

.change-grade{
  font:inherit; font-weight:600; font-size:.9rem; cursor:pointer;
  color:var(--blue); background:var(--blue-tint); border:0;
  border-radius:999px; padding:.55rem 1.1rem; min-height:40px;
  transition:background .15s;
}
.change-grade:hover{ background:var(--blue-tint-2); }

section.card{
  background:var(--card); border:1px solid var(--line);
  border-radius:var(--radius-lg); padding:1.5rem 1.5rem 1.75rem;
  margin-bottom:1.25rem; box-shadow:var(--shadow);
}
section.card > h2{
  margin:0 0 1.25rem; font-size:1.12rem; font-weight:700; color:var(--blue);
  padding-bottom:.7rem; border-bottom:1px solid var(--line-soft);
  letter-spacing:-.005em;
}
section.card > h3, .subhead{
  margin:1.5rem 0 .7rem; font-size:.98rem; font-weight:700; color:var(--ink);
}
section.card > h3:first-of-type{ margin-top:0; }

.note{
  font-size:.85rem; line-height:1.5; color:var(--ink-soft);
  background:var(--blue-tint); border-left:3px solid var(--blue-light);
  border-radius:0 8px 8px 0; padding:.75rem .9rem; margin:.85rem 0 0;
}
.note--plain{ background:none; border-left:0; padding:0; }

/* ---------- fields ---------- */
/* Six columns, so a field can claim a sensible fraction of a row: the
   three parts of a name as 2+2+2, a pair as 3+3, an address as 6. The
   width comes from --span, set per field from content.js.

   align-items:start is what keeps the inputs on a row level with one
   another: the labels are all a single line, so aligning the tops aligns
   the boxes, and an error message — which can run to two lines — then
   hangs below without shifting its neighbours. (Bottom alignment was
   tried first and does the opposite: one long error lifts its own input
   out of line with the rest of the row.) Keep new labels short. */
.field-grid{ display:grid; grid-template-columns:repeat(6,minmax(0,1fr)); gap:1rem 1.15rem; align-items:start; }
.field{ grid-column:span var(--span,3); display:flex; flex-direction:column; gap:.35rem; min-width:0; }
.field--wide{ grid-column:1/-1; }
/* An author rule always beats the browser's own `[hidden]{display:none}`
   default, so `.field`'s own `display:flex` above was silently winning and
   keeping a dependsOn-hidden field (e.g. workplace/position when a parent
   is unemployed) visible. This re-asserts it at higher specificity. */
.field[hidden]{ display:none; }
/* The heading over a tick box in the field grid, styled like the labels
   over the text boxes beside it. */
.field-title{ font-size:.85rem; font-weight:600; color:var(--ink-soft); }
.field-head{ display:flex; align-items:baseline; justify-content:space-between; gap:.5rem; flex-wrap:wrap; }
.field-head > label{ font-size:.85rem; font-weight:600; color:var(--ink-soft); }
.field > label{ font-size:.85rem; font-weight:600; color:var(--ink-soft); }
.copy-btn{
  font:inherit; font-size:.78rem; font-weight:600; color:var(--blue);
  background:none; border:0; padding:.1rem .25rem; border-radius:6px;
  cursor:pointer; text-decoration:underline; text-underline-offset:2px; white-space:nowrap;
}
.copy-btn:hover{ background:var(--blue-tint); text-decoration:none; }
.copy-btn:focus-visible{ outline:2px solid var(--blue); outline-offset:1px; }
.field .req{ color:var(--danger); margin-left:.15rem; }
/* These are the styles of a text box, so they must not reach a tick box that
   happens to sit inside a .field — a checkbox given min-height:48px and the
   padding below turns into a large square and pushes its whole row out of
   line. :not() keeps them to the inputs they were written for. */
.field input:not([type="checkbox"]):not([type="radio"]), .field textarea, .field select{
  font:inherit; font-size:1rem; color:var(--ink); width:100%;
  background:#fff; border:1.5px solid var(--line); border-radius:10px;
  padding:.7rem .85rem; min-height:48px;
  transition:border-color .15s, box-shadow .15s;
}
.field textarea{ min-height:6rem; resize:vertical; line-height:1.5; }
.field input:not([type="checkbox"]):not([type="radio"]):hover, .field textarea:hover, .field select:hover{ border-color:var(--blue-light); }
.field input:not([type="checkbox"]):not([type="radio"]):focus, .field textarea:focus, .field select:focus{
  outline:none; border-color:var(--blue); box-shadow:0 0 0 3px rgba(50,70,168,.14);
}
.field input[aria-invalid="true"]:not([type="checkbox"]):not([type="radio"]), .field textarea[aria-invalid="true"], .field select[aria-invalid="true"]{
  border-color:var(--danger); background:var(--danger-tint);
}
/* Present for screen readers, invisible on screen — used where a visible
   heading already names the field. */
.sr-only{
  position:absolute; width:1px; height:1px; margin:-1px; padding:0;
  overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; border:0;
}
.field .field-hint{ font-size:.78rem; line-height:1.35; color:var(--ink-faint); }
.field .field-error{ font-size:.8rem; font-weight:600; color:var(--danger); }

/* ---------- choices ---------- */
.choice-list{ display:flex; flex-direction:column; gap:.55rem; }
/* Two or three short options side by side rather than stacked. */
.choice-list--inline{ flex-direction:row; flex-wrap:wrap; }
.choice-list--inline > .choice{ flex:1 1 8rem; }
.choice{
  display:flex; align-items:flex-start; gap:.75rem; cursor:pointer;
  border:1.5px solid var(--line); border-radius:var(--radius);
  padding:.85rem .95rem; background:#fff;
  transition:border-color .15s, background .15s;
}
.choice:hover{ border-color:var(--blue-light); background:var(--blue-tint); }
.choice input{
  flex:none; width:22px; height:22px; margin:1px 0 0; accent-color:var(--blue); cursor:pointer;
}
.choice span{ font-size:.95rem; line-height:1.45; }
.choice:has(input:checked){ border-color:var(--blue); background:var(--blue-tint); }
.choice--invalid{ border-color:var(--danger); background:var(--danger-tint); }
.choice .price{ display:block; font-weight:700; color:var(--blue); margin-top:.2rem; font-size:.9rem; }
.choice .limited{ display:inline-block; font-size:.75rem; font-weight:600; color:#8A6D00; background:#FFF6DB; border-radius:999px; padding:.1rem .55rem; margin-left:.4rem; }

/* Read-only curriculum items — informational, not a control. */
.info-list{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:.4rem; }
.info-list li{
  display:flex; align-items:flex-start; gap:.65rem;
  font-size:.95rem; padding:.55rem .8rem;
  background:var(--blue-tint); border-radius:8px;
}
.info-list li::before{ content:"✓"; color:var(--teal); font-weight:800; flex:none; line-height:1.45; }
.info-list--exam li::before{ content:"★"; color:var(--amber); }

.dependent{ margin-top:.65rem; padding-left:1rem; border-left:2px solid var(--blue-tint-2); }
.dependent[hidden]{ display:none; }

/* ---------- fee table ---------- */
.fee-table{ width:100%; border-collapse:collapse; font-size:.92rem; }
.fee-table th, .fee-table td{ text-align:left; padding:.6rem .5rem; border-bottom:1px solid var(--line-soft); vertical-align:top; }
.fee-table td.amount, .fee-table th.amount{ text-align:right; white-space:nowrap; font-weight:600; font-variant-numeric:tabular-nums; }
.fee-table .line-note{ display:block; font-size:.82rem; color:var(--ink-faint); font-weight:400; }
.fee-table tfoot td{ border-top:2px solid var(--blue); border-bottom:0; padding-top:.8rem; font-weight:800; color:var(--blue); font-size:1.05rem; }
.fee-additional{ margin-top:1.25rem; }
.fee-pending{
  background:#FFF6DB; border:1px solid var(--amber); border-radius:var(--radius);
  padding:1rem; font-size:.9rem; color:#7A5C00;
}

/* ---------- errors + submit ---------- */
.error-summary{
  background:var(--danger-tint); border:1.5px solid var(--danger);
  border-radius:var(--radius); padding:1rem 1.15rem; margin-bottom:1.25rem;
}
.error-summary h2{ margin:0 0 .5rem; font-size:1rem; font-weight:700; color:var(--danger); }
.error-summary ul{ margin:0; padding-left:1.15rem; font-size:.9rem; color:var(--danger); }
.error-summary li{ margin:.2rem 0; }
.error-summary a{ color:inherit; }

.submit-bar{ display:flex; align-items:center; gap:1rem; flex-wrap:wrap; margin-top:1.75rem; }
.btn-primary{
  font:inherit; font-weight:700; font-size:1.05rem; cursor:pointer;
  background:var(--blue); color:#fff; border:0;
  border-radius:var(--radius); padding:.95rem 2.25rem; min-height:56px;
  box-shadow:0 2px 8px rgba(50,70,168,.28);
  transition:background .15s, transform .1s, box-shadow .15s;
}
.btn-primary:hover:not(:disabled){ background:var(--blue-dark); box-shadow:0 4px 14px rgba(50,70,168,.34); }
.btn-primary:active:not(:disabled){ transform:translateY(1px); }
.btn-primary:disabled{ opacity:.6; cursor:progress; }
.btn-secondary{
  font:inherit; font-weight:600; cursor:pointer;
  background:#fff; color:var(--blue); border:1.5px solid var(--line);
  border-radius:var(--radius); padding:.8rem 1.5rem; min-height:48px;
  transition:border-color .15s, background .15s;
}
.btn-secondary:hover{ border-color:var(--blue-light); background:var(--blue-tint); }

.legal{ font-size:.78rem; line-height:1.55; color:var(--ink-faint); margin-top:2rem; }

/* ---------- confirmation ---------- */
.confirm{ text-align:center; padding:2rem 0; }
.confirm__tick{
  width:64px; height:64px; margin:0 auto 1.25rem; border-radius:50%;
  background:var(--teal); color:#fff; display:grid; place-items:center;
  font-size:2rem; font-weight:800; line-height:1;
}
.confirm h1{ font-size:1.7rem; font-weight:800; color:var(--blue); margin:0 0 .4rem; }
.confirm p{ color:var(--ink-soft); margin:0 0 1.75rem; }
.code-box{
  display:inline-block; background:var(--card); border:2px solid var(--blue);
  border-radius:var(--radius-lg); padding:1.5rem 2.75rem; box-shadow:var(--shadow);
}
.code-box .label{ font-size:.75rem; font-weight:700; text-transform:uppercase; letter-spacing:.11em; color:var(--ink-faint); }
.code-box .code{
  font-size:3rem; font-weight:800; color:var(--blue); line-height:1.1;
  letter-spacing:.16em; font-variant-numeric:tabular-nums; margin:.35rem 0 0;
}
/* The declaration total, under the record number it was recorded against. */
.code-fee{
  display:flex; align-items:baseline; justify-content:center; gap:.6rem;
  margin-top:1rem; padding-top:.9rem; border-top:1px solid var(--line-soft);
}
.code-fee .label{ font-size:.85rem; font-weight:600; color:var(--ink-soft); }
.code-fee .amount{ font-size:1.4rem; font-weight:800; color:var(--blue); font-variant-numeric:tabular-nums; }

.confirm .meta{ font-size:.85rem; color:var(--ink-faint); margin-top:1.25rem; }
.confirm .actions{ display:flex; gap:.75rem; justify-content:center; flex-wrap:wrap; margin-top:2rem; }

/* ---------- print ---------- */
@media print{
  :root{ --shadow:none; }
  body{ background:#fff; font-size:12pt; }
  .site-header, .lang-switch, .confirm .actions, .change-grade, .submit-bar, .copy-btn{ display:none !important; }
  main{ padding:0; max-width:none; }
  .code-box{ border:2px solid #000; box-shadow:none; }
  section.card{ box-shadow:none; border:1px solid #999; break-inside:avoid; }
  a[href]::after{ content:""; }
}

/* The six columns are kept all the way down to phone width. A two-column
   stage in between was tried and dropped: it splits the three parts of a
   name across two rows and leaves Фамилия stranded next to an unrelated
   field. Below 560px every field takes the full width instead. */
@media (max-width:560px){
  .field-grid{ grid-template-columns:minmax(0,1fr); gap:.9rem; }
  .field{ grid-column:1/-1; }
}

@media (max-width:640px){
  body{ font-size:16px; }
  main{ padding:1.25rem 1rem 4rem; }
  section.card{ padding:1.15rem 1.1rem 1.35rem; border-radius:var(--radius); }
  .grade-grid{ grid-template-columns:repeat(auto-fill,minmax(6.5rem,1fr)); }
  .code-box{ padding:1.25rem 1.5rem; }
  .code-box .code{ font-size:2.25rem; }
  .btn-primary{ width:100%; }
}

@media (prefers-reduced-motion:reduce){
  *{ transition:none !important; animation:none !important; }
}

/* ИУЧ / ФУЧ track tags on the II.2 elective lines */
.track-tag{
  display:inline-block; margin-left:.5rem; padding:.08rem .5rem;
  font-size:.7rem; font-weight:700; letter-spacing:.04em;
  border-radius:999px; vertical-align:1px; white-space:nowrap;
}
.track-tag--iuc{ background:var(--blue-tint-2); color:var(--blue); }
.track-tag--fuc{ background:#E4F8F4; color:#00806E; }
