/* Sinfdoshlar — maktab daftari: katak qog'oz, ko'k siyoh, qizil hoshiya, sinf doskasi */
:root {
  --paper: #fbfcf8;
  --grid: #dbe6ee;
  --ink: #1d2f6f;       /* ko'k siyoh */
  --text: #22262e;
  --muted: #646b78;
  --margin: #d23a3f;    /* qizil hoshiya chizig'i */
  --board: #23403a;     /* sinf doskasi */
  --chalk: #f2f1e6;
  --line: #c9d3dc;
  --ok: #1f6b46;
  --page-bg: #eef2f4;
  --sheet-shadow: 0 1px 0 #c6d0d8, 0 8px 24px -18px rgba(29, 47, 111, .35);
  --body: 'Golos Text', system-ui, sans-serif;
  --script: 'Marck Script', 'Segoe Script', cursive;
  --cell: 22px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #1b2027; --grid: #262d36; --ink: #9db4ff; --text: #e4e7ec; --muted: #9aa2ae;
    --margin: #e0666a; --board: #1a2e2a; --chalk: #ecebdf; --line: #36404b; --ok: #6fcf9c;
    --page-bg: #13171c; --sheet-shadow: 0 1px 0 #0b0e12;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page-bg); color: var(--text);
  font: 400 17px/1.55 var(--body);
}
a { color: var(--ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 2px; }
img { max-width: 100%; display: block; }
h1, h2 { line-height: 1.2; color: var(--text); }
h1 { font-size: 1.9rem; font-weight: 700; margin: 0 0 .5em; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; font-weight: 600; margin: 1.8em 0 .6em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.lede { font-size: 1.1rem; max-width: 62ch; }
.prose { white-space: pre-line; max-width: 68ch; margin: .3em 0 1em; }
.count { font-weight: 400; color: var(--muted); font-size: .9em; }

/* ---------- doska (header) ---------- */
/* Maktab binosi rasmi menyu orqasida, markazda; ikki chetida doska */
.board {
  --photo-w: min(1120px, 100%);
  color: var(--chalk); border-bottom: 6px solid #6b4a2f;
  background:
    /* chetlar rasmni doska rangiga silliq o'tkazadi */
    linear-gradient(90deg,
      var(--board) calc(50% - var(--photo-w) / 2),
      rgba(35, 64, 58, 0) calc(50% - var(--photo-w) / 2 + 220px),
      rgba(35, 64, 58, 0) calc(50% + var(--photo-w) / 2 - 220px),
      var(--board) calc(50% + var(--photo-w) / 2)),
    /* matn o'qilishi uchun yengil qoplama */
    linear-gradient(0deg, rgba(20, 38, 34, .8) 0%, rgba(20, 38, 34, .45) 60%, rgba(20, 38, 34, .3) 100%),
    url('/static/school.jpg') center 48% / var(--photo-w) auto no-repeat,
    var(--board);
}
.board-inner { max-width: 1120px; margin: 0 auto; padding: 18px 16px 0; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0 28px; }
@media (max-width: 600px) {
  .board {
    background:
      linear-gradient(90deg, var(--board) 0%, rgba(35, 64, 58, 0) 22%, rgba(35, 64, 58, 0) 78%, var(--board) 100%),
      linear-gradient(0deg, rgba(20, 38, 34, .82) 0%, rgba(20, 38, 34, .5) 60%, rgba(20, 38, 34, .35) 100%),
      url('/static/school.jpg') center 48% / cover no-repeat, var(--board);
  }
}
.board-title { color: var(--chalk); text-decoration: none; display: flex; flex-direction: column; padding-bottom: 12px; margin-right: auto; }
.chalk { font: 400 2.6rem/1 var(--script); letter-spacing: .01em; text-shadow: 0 0 1px rgba(242,241,230,.6), 1px 1px 0 rgba(242,241,230,.12); }
.board-sub { font-size: .9rem; opacity: .75; margin-top: 4px; }
.nav { display: flex; flex-wrap: wrap; gap: 2px; order: 3; width: 100%; }
.nav a { color: var(--chalk); text-decoration: none; padding: 8px 14px 10px; opacity: .78; border-bottom: 3px solid transparent; }
.nav a:hover { opacity: 1; }
.nav a.on { opacity: 1; border-bottom-color: var(--chalk); }
.me { display: flex; align-items: center; gap: 14px; padding-bottom: 12px; }
.me-link { display: flex; align-items: center; gap: 8px; color: var(--chalk); text-decoration: none; }
.board .link-btn { color: var(--chalk); opacity: .75; }

/* ---------- daftar varag'i ---------- */
.page { max-width: 1120px; margin: 28px auto; padding: 0 16px; }
.sheet {
  position: relative; background-color: var(--paper);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: var(--cell) var(--cell);
  padding: 28px 28px 32px 64px; box-shadow: var(--sheet-shadow); border-radius: 3px;
}
.sheet::before { content: ''; position: absolute; top: 0; bottom: 0; left: 44px; width: 2px; background: var(--margin); opacity: .8; }
.sheet + .sheet { margin-top: 20px; }
.narrow { max-width: 520px; margin: 40px auto; }
.foot { text-align: center; color: var(--muted); font-size: .85rem; padding: 24px 16px 40px; }

.flash { padding: 10px 14px; border-left: 4px solid; background: var(--paper); margin: 0 0 16px; max-width: 720px; }
.flash-ok { border-color: var(--ok); }
.flash-err { border-color: var(--margin); }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; max-width: 420px; }
.form-wide { max-width: 760px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-weight: 500; font-size: .95rem; }
.form label small { font-weight: 400; color: var(--muted); }
input, textarea, select {
  font: inherit; color: var(--text); background: var(--paper);
  border: 1px solid var(--line); border-bottom: 2px solid var(--ink); border-radius: 3px; padding: 9px 11px; width: 100%;
}
textarea { resize: vertical; }
input[type=file] { border-bottom-width: 1px; padding: 7px; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--ink); }
.check { flex-direction: row !important; align-items: center; gap: 8px !important; font-weight: 400 !important; }
fieldset { border: 0; border-top: 1px solid var(--line); padding: 16px 0 6px; margin: 0; display: flex; flex-direction: column; gap: 14px; }
legend { font-weight: 600; padding-right: 10px; color: var(--ink); }
fieldset.kind { flex-direction: row; border: 0; padding: 0; gap: 20px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.actions { display: flex; gap: 16px; align-items: center; }
.form-inline { flex-direction: row; flex-wrap: wrap; align-items: flex-end; max-width: none; }
.form-inline label { flex: 1 1 220px; }
.form-inline .check { flex: 0 0 auto; padding-bottom: 10px; }
#postform:not(:has(input[value=event]:checked)) .event-only { display: none; }

.btn {
  display: inline-block; font: 600 .95rem/1 var(--body); color: #fff; background: var(--ink);
  border: 0; border-radius: 3px; padding: 12px 18px; cursor: pointer; text-decoration: none; align-self: flex-start;
}
.btn:hover { filter: brightness(1.12); }
@media (prefers-color-scheme: dark) { .btn { color: #10162b; } }
.btn-quiet { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 1.5px var(--ink); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-size: .9rem; color: var(--ink); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.danger { color: var(--margin); }
details.upload { margin: 0 0 24px; }
details.upload > summary { list-style: none; }
details.upload > summary::-webkit-details-marker { display: none; }
details.upload[open] > summary { margin-bottom: 18px; }

/* ---------- avatars ---------- */
.ava { border-radius: 50%; object-fit: cover; flex: none; background: var(--grid); }
.ava-xs { width: 28px; height: 28px; font-size: .7rem; }
.ava-sm { width: 38px; height: 38px; font-size: .8rem; }
.ava-lg { width: 96px; height: 96px; font-size: 1.4rem; }
.ava-empty { display: inline-grid; place-items: center; color: var(--ink); font-weight: 600; }
.board .ava-empty { background: rgba(242,241,230,.18); color: var(--chalk); }

/* ---------- bitiruv vinyetkasi (sinfdoshlar) ---------- */
.head-row { display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.head-row h1 { margin: 0; }
.search { display: flex; gap: 8px; flex: 0 1 380px; }
.vignette { list-style: none; padding: 0; margin: 28px 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 30px 18px; }
.vignette a { display: flex; flex-direction: column; align-items: center; text-align: center; text-decoration: none; color: var(--text); }
.oval {
  display: block; width: 120px; height: 152px; border-radius: 50%; overflow: hidden; background: var(--grid);
  box-shadow: 0 0 0 4px var(--paper), 0 0 0 5px var(--line);
}
.oval img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.85); }
.vignette a:hover .oval img { filter: none; }
.oval-empty { display: grid; place-items: center; height: 100%; font: 400 2.4rem var(--script); color: var(--ink); }
.v-name { font: 400 1.35rem/1.15 var(--script); color: var(--ink); margin-top: 12px; }
.v-small { font-size: .82rem; color: var(--muted); margin-top: 3px; }
.oval-lg { width: 170px; height: 216px; }

/* ---------- profile ---------- */
.profile-head { display: flex; flex-wrap: wrap; gap: 28px; align-items: center; margin-bottom: 10px; }
.profile-head h1 { font: 400 2.6rem/1.05 var(--script); color: var(--ink); margin-bottom: 8px; }
.profile-head p { margin: 4px 0; }
.link { margin-left: 12px; font-size: .9rem; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 20px; margin: 18px 0; max-width: 560px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.then blockquote { margin: 14px 0; padding-left: 16px; border-left: 3px solid var(--margin); font-style: italic; }

/* ---------- photos ---------- */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
.snap { display: block; background: #fff; padding: 7px 7px 9px; box-shadow: 0 1px 2px rgba(0,0,0,.18); color: var(--text); text-decoration: none; }
.snap img { aspect-ratio: 1; object-fit: cover; width: 100%; }
.snap-cap { display: block; font-size: .8rem; margin-top: 6px; color: #333; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.snap-lg { max-width: 360px; margin: 0; padding-bottom: 7px; transform: rotate(-1.2deg); }
.snap-lg img { aspect-ratio: auto; }
h2.year { font: 400 1.9rem var(--script); color: var(--ink); margin: 1.2em 0 .5em; }
.photo-full { margin: 0; }
.photo-full img { max-height: 78vh; width: auto; margin: 0 auto; background: #fff; padding: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.photo-full figcaption { display: flex; flex-wrap: wrap; gap: 4px 12px; justify-content: center; margin-top: 14px; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin: 18px 0; }
.crumbs { margin: 0 0 12px; font-size: .9rem; }
.photo-field { display: flex; flex-direction: column; gap: 8px; }

/* ---------- home ---------- */
.home { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.side .sheet { padding: 22px 22px 22px 56px; }
.side .sheet::before { left: 36px; }
.side h2 { margin-top: 0; }
.side .sheet + .sheet { margin-top: 20px; }
.events { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.event { display: flex; gap: 16px; align-items: center; }
.event-date { flex: none; width: 64px; text-align: center; background: var(--paper); border: 1.5px solid var(--margin); border-radius: 3px; padding: 4px 0 6px; color: var(--margin); }
.event-date .d { display: block; font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.event-date .m { font-size: .8rem; }
.event-title { font-weight: 600; font-size: 1.05rem; }
.event p { margin: 2px 0 0; }
.post-list { list-style: none; padding: 0; margin: 0; }
.post-list li { padding: 10px 0; border-bottom: 1px dashed var(--line); }
.post-list li p { margin: 2px 0 0; }
.post-list.big a { font-size: 1.15rem; font-weight: 600; }
.excerpt { white-space: pre-line; max-width: 68ch; }
.tag { display: inline-block; font-size: .8rem; font-weight: 600; color: var(--margin); border: 1px solid var(--margin); border-radius: 3px; padding: 1px 7px; margin-bottom: 6px; }
.bdays, .recent-comments { list-style: none; padding: 0; margin: 0; }
.bdays li { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; }
.bdays a { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.bday-when { font-size: .85rem; color: var(--margin); font-weight: 600; white-space: nowrap; }
.recent-comments li { padding: 7px 0; font-size: .92rem; border-bottom: 1px dashed var(--line); }
.recent-comments a { color: var(--text); text-decoration: none; }

/* ---------- comments ---------- */
.comments { margin-top: 36px; border-top: 1px solid var(--line); }
.comment-list { list-style: none; padding: 0; margin: 0 0 16px; }
.comment { display: flex; gap: 12px; padding: 12px 0; }
.comment-body { flex: 1; min-width: 0; }
.comment-meta { margin: 0; font-size: .9rem; }
.comment-meta a { font-weight: 600; text-decoration: none; }
.comment-meta time { color: var(--muted); margin-left: 6px; }
.comment .prose { margin: 2px 0 4px; }
.comment-form { display: flex; flex-direction: column; gap: 10px; max-width: 640px; }

/* ---------- admin ---------- */
.issued { border: 2px dashed var(--ok); padding: 14px 18px; margin-bottom: 24px; max-width: 640px; background: var(--paper); }
.issued pre { font-size: 1.05rem; background: var(--grid); padding: 10px 12px; margin: 8px 0; overflow-x: auto; user-select: all; }
.table-wrap { overflow-x: auto; }
.users { border-collapse: collapse; width: 100%; font-size: .95rem; background: var(--paper); }
.users th, .users td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.users th { font-weight: 600; color: var(--muted); font-size: .85rem; }
.users tr.off td { opacity: .55; }
.row-actions { display: flex; flex-wrap: wrap; gap: 4px 14px; }

/* ---------- mobile ---------- */
@media (max-width: 860px) {
  .home { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  body { font-size: 16px; }
  .sheet, .side .sheet { padding: 20px 16px 24px 34px; }
  .sheet::before, .side .sheet::before { left: 20px; }
  .chalk { font-size: 2rem; }
  /* ixcham sarlavha: menyu bir qatorda, foydalanuvchi o'ng yuqorida */
  .board-inner { position: relative; padding-top: 12px; }
  .board-title { padding-bottom: 4px; padding-right: 96px; }
  .board-sub { font-size: .78rem; }
  .me { position: absolute; top: 14px; right: 16px; padding: 0; gap: 10px; }
  .me-link span { display: none; }
  .nav { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { white-space: nowrap; padding: 8px 10px 9px; }
  .page { margin-top: 16px; padding: 0 8px; }
  .vignette { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 10px; }
  .oval { width: 108px; height: 136px; }
  .profile-head h1 { font-size: 2.1rem; }
  .thumbs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .facts { grid-template-columns: 1fr; gap: 0; }
  .facts dd { margin-bottom: 8px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
