/* preporuke.rajak.rs — one stylesheet for every page. Tokens and the sheet, marker and button are
   rajak-web's (src/styles/tokens.css, global.css; docs/design-plan.md), copied so the subdomain needs
   nothing from www. The one bold thing is the student's record sheet and its year columns. */

@font-face { font-family: 'Unbounded'; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url(/fonts/unbounded-cyrillic.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Unbounded'; font-style: normal; font-weight: 500 700; font-display: swap;
  src: url(/fonts/unbounded-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(/fonts/manrope-cyrillic.woff2) format('woff2'); unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(/fonts/manrope-latin-ext.woff2) format('woff2'); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Manrope'; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(/fonts/manrope-latin.woff2) format('woff2'); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --paper: #f5f8fb;
  --sheet: #ffffff;
  --ink: #0f2742;
  --ink-soft: #1d3a5c;
  --brand: #1cb4fa;
  --link: #0b6fa8;
  --grid: #d3e4f1;
  --grid-strong: #b7d1e6;
  --marker: #ffe066;
  --orange: #ef5c18;
  --orange-deep: #d9500f;
  --pencil: #526273;
  --ok: #1f7a4d;
  --error: #b42318;

  --font-display: 'Unbounded', system-ui, sans-serif;
  --font-body: 'Manrope', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  --step--1: 0.889rem;
  --step-0: 1.125rem;
  --step-1: 1.406rem;
  --h1: clamp(2rem, 1.2rem + 3.6vw, 3.5rem);
  --h2: clamp(1.5rem, 1.15rem + 1.6vw, 2.2rem);
  --measure: 68ch;

  --s2: 0.5rem; --s3: 0.75rem; --s4: 1rem; --s5: 1.5rem; --s6: 2rem; --s7: 3rem; --s8: 4.5rem;
  --gutter: clamp(1rem, 0.5rem + 2.5vw, 2.5rem);
  --page: 76rem;
  --radius: 10px;
  --cut: 26px;
  --square: 24px;
  --ease-out: cubic-bezier(0.2, 0.7, 0.2, 1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 var(--step-0)/1.55 var(--font-body);
  font-variant-numeric: tabular-nums;
}
h1, h2 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; margin: 0; text-wrap: balance; }
h1 { font-size: var(--h1); line-height: 1.08; }
h2 { font-size: var(--h2); line-height: 1.15; }
p { margin: 0 0 var(--s4); }
a { color: var(--link); text-underline-offset: 0.18em; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; border-radius: 4px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: var(--page); margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- top ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); padding-block: var(--s5); }
.top a { display: block; line-height: 0; color: var(--ink); }
.top svg { width: auto; height: 2.25rem; }
.top p { margin: 0; color: var(--pencil); font-size: var(--step--1); text-align: right; }

/* ---------- the letter and the record sheet ---------- */
.intro {
  display: grid; gap: var(--s7) var(--s8);
  grid-template-columns: minmax(0, 1fr);
  padding-block: var(--s6) var(--s8);
}
@media (min-width: 60rem) {
  .intro { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); align-items: start; padding-top: var(--s7); }
  .letter { position: sticky; top: var(--s6); }
}
.letter h1 { margin-bottom: var(--s5); max-width: 13ch; }
.letter p { max-width: 34rem; }
.letter .lede { font-size: var(--step-1); line-height: 1.45; }
.letter .jump { font-weight: 700; }

.sheet {
  --sheet-pad: clamp(1.25rem, 0.8rem + 2vw, 2.25rem);
  position: relative;
  background-color: var(--sheet);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: var(--square) var(--square);
  background-position: -1px -1px;
  padding: var(--sheet-pad);
  clip-path: polygon(0 0, calc(100% - var(--cut)) 0, 100% var(--cut), 100% 100%, 0 100%);
  border-radius: 0 0 var(--radius) var(--radius);
}
.sheet::after {
  content: ''; position: absolute; top: 0; right: 0;
  width: var(--cut); height: var(--cut);
  background: linear-gradient(225deg, transparent 50%, var(--grid-strong) 50%);
}

.record h2 { font-size: clamp(1.35rem, 1.1rem + 1.1vw, 1.9rem); margin-bottom: var(--s2); padding-right: var(--cut); }
.record .level { color: var(--pencil); margin-bottom: var(--s5); }
.record .total { font-size: var(--step-1); line-height: 1.45; margin-bottom: var(--s5); }
.record .total strong { font-weight: 800; }
.marker {
  background: linear-gradient(transparent 40%, var(--marker) 40%, var(--marker) 88%, transparent 88%);
  padding-inline: 0.15em;
  -webkit-box-decoration-break: clone; box-decoration-break: clone;
}

/* Lessons per school year: columns drawn in pencil on the sheet's own grid. Each column is a
   square wide and stands on a grid line; the hatch is the pencil, the outline the pen. */
.years { margin: 0 0 var(--s5); }
.years svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.years .bar { fill: url(#hatch); stroke: var(--ink); stroke-width: 1.5; stroke-linejoin: round; }
.years .base { stroke: var(--ink); stroke-width: 1.5; stroke-linecap: round; }
.years .n { font: 800 11px var(--font-body); fill: var(--ink); text-anchor: middle; }
.years .y { font: 600 9.5px var(--font-body); fill: var(--pencil); text-anchor: middle; }
.years figcaption { color: var(--pencil); font-size: var(--step--1); margin-top: var(--s2); }
@media (prefers-reduced-motion: no-preference) {
  .js .years .bar { transform-box: fill-box; transform-origin: 50% 100%; transform: scaleY(0); }
  .js .years.drawn .bar { transform: none; transition: transform 700ms var(--ease-out); transition-delay: calc(var(--i) * 90ms); }
  .js .years .n { opacity: 0; }
  .js .years.drawn .n { opacity: 1; transition: opacity 300ms ease calc(var(--i) * 90ms + 500ms); }
}

.facts { margin: 0; border-top: 1px solid var(--grid-strong); }
.facts div { display: grid; gap: var(--s2) var(--s5); padding-block: var(--s3); border-bottom: 1px solid var(--grid-strong); }
@media (min-width: 30rem) { .facts div { grid-template-columns: 7.5rem minmax(0, 1fr); } }
.facts dt { color: var(--pencil); font-size: var(--step--1); padding-top: 0.2em; }
.facts dd { margin: 0; }
.facts .count { color: var(--pencil); white-space: nowrap; }
.record .note { color: var(--pencil); font-size: var(--step--1); margin: var(--s4) 0 0; }
.record .still { font-weight: 700; margin: var(--s4) 0 0; }

/* ---------- the form ---------- */
.ask { border-top: 1px solid var(--grid-strong); padding-block: var(--s8); }
.ask > .wrap > * { max-width: 42rem; }
.ask h2 { margin-bottom: var(--s4); }
.ask .why { color: var(--ink-soft); margin-bottom: var(--s6); }

form { display: grid; gap: var(--s6); }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
legend, .label { display: block; font-weight: 800; margin-bottom: var(--s2); padding: 0; }
.hint { color: var(--pencil); font-size: var(--step--1); margin: 0 0 var(--s3); }
.optional { color: var(--pencil); font-weight: 400; }

/* Who is writing: two big choices */
.choices { display: flex; flex-wrap: wrap; gap: var(--s3); }
.choice { position: relative; }
.choice input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.choice span {
  display: inline-flex; align-items: center; min-height: 3rem; padding: 0.6rem 1.25rem;
  border: 2px solid var(--grid-strong); border-radius: 999px; background: var(--sheet);
  font-weight: 700; cursor: pointer;
  transition: border-color 160ms var(--ease-out), background 160ms var(--ease-out), color 160ms var(--ease-out);
}
.choice input:checked + span { border-color: var(--ink); background: var(--ink); color: #fff; }
.choice input:focus-visible + span { outline: 3px solid var(--brand); outline-offset: 3px; }

input[type=text], textarea {
  display: block; width: 100%;
  font: inherit; color: var(--ink);
  background: var(--sheet); border: 2px solid var(--grid-strong); border-radius: var(--radius);
  padding: 0.75rem 0.9rem;
}
input[type=text]:focus, textarea:focus { border-color: var(--ink); outline: none; box-shadow: 0 0 0 3px var(--brand); }
/* The recommendation is written on ruled notebook lines. */
textarea {
  min-height: 12.5rem; resize: vertical;
  line-height: 1.75rem; padding-top: 0.6rem;
  background-image: linear-gradient(transparent calc(1.75rem - 1px), var(--grid) calc(1.75rem - 1px));
  background-size: 100% 1.75rem; background-position: 0 0.6rem; background-attachment: local;
}
.counter { color: var(--pencil); font-size: var(--step--1); margin: var(--s2) 0 0; min-height: 1.4em; }
.parent-name { display: none; }
form:has(#author-roditelj:checked) .parent-name { display: block; }
.no-has .parent-name { display: block; } /* browsers without :has() always show it */

/* How to sign: radio rows that show the actual signature */
.sign { display: grid; gap: var(--s2); }
.sign label {
  display: flex; gap: var(--s3); align-items: baseline; padding: var(--s3) var(--s4);
  border: 2px solid var(--grid-strong); border-radius: var(--radius); background: var(--sheet); cursor: pointer;
}
.sign label:has(input:checked) { border-color: var(--ink); }
.sign input { accent-color: var(--ink); transform: translateY(0.1em); flex: none; }
.sign .as { font-weight: 700; }
.sign .what { color: var(--pencil); font-size: var(--step--1); margin-left: auto; text-align: right; }
@media (max-width: 30rem) {
  .sign label { flex-wrap: wrap; row-gap: 0; }
  .sign .what { flex-basis: 100%; margin-left: 1.6rem; text-align: left; }
}

.consent label { display: flex; gap: var(--s3); align-items: flex-start; cursor: pointer; }
.consent input { width: 1.35rem; height: 1.35rem; flex: none; accent-color: var(--ink); margin: 0.15rem 0 0; }
.consent .hint { margin: var(--s2) 0 0 2.1rem; }

.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.send { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s4); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 3.25rem; padding: 0.75rem 1.6rem;
  border-radius: 999px; border: 2px solid var(--orange);
  background: var(--orange); color: #fff;
  font: 800 1.1875rem/1.2 var(--font-body); cursor: pointer;
  transition: background 160ms var(--ease-out), transform 160ms var(--ease-out);
}
.btn:hover { background: var(--orange-deep); border-color: var(--orange-deep); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.7; cursor: progress; }
.send .small { color: var(--pencil); font-size: var(--step--1); margin: 0; max-width: 26rem; }

.errors {
  border-left: 4px solid var(--error); background: #fff; padding: var(--s3) var(--s4);
  color: var(--error); font-weight: 700; margin: 0;
}
.errors[hidden] { display: none; }
.field-error { color: var(--error); font-size: var(--step--1); font-weight: 700; margin: var(--s2) 0 0; }
[aria-invalid=true] { border-color: var(--error) !important; }

/* After sending: the form gives way to the thanks. The check is drawn in pen, once. */
.thanks { display: none; }
.sent .thanks { display: block; }
.sent form, .sent .why { display: none; }
/* Without JS the API redirects back to …?poslato=1#hvala: the target shows the thanks. */
.thanks:target { display: block; }
#forma:has(#hvala:target) form, #forma:has(#hvala:target) .why { display: none; }
.thanks svg { width: 3.5rem; height: 3.5rem; margin-bottom: var(--s4); }
.thanks path { fill: none; stroke: var(--ok); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 60; stroke-dashoffset: 0; }
@media (prefers-reduced-motion: no-preference) {
  .sent .thanks path { animation: draw 600ms var(--ease-out) both 120ms; }
  @keyframes draw { from { stroke-dashoffset: 60; } }
}
.thanks h2 { margin-bottom: var(--s4); }

/* ---------- foot ---------- */
.foot { border-top: 1px solid var(--grid-strong); padding-block: var(--s6) var(--s7); color: var(--pencil); font-size: var(--step--1); }
.foot p { margin: 0 0 var(--s2); }

/* ---------- the plain pages (root, not found) ---------- */
.plain { padding-block: var(--s7) var(--s8); }
.plain h1 { max-width: 16ch; margin-bottom: var(--s5); }
.plain p { max-width: 36rem; }

@media print {
  .ask, .top p { display: none; }
  .sheet { clip-path: none; border: 1px solid var(--grid-strong); }
}
