/* Nikan Kaveh Bonab Technical School — design system. Mobile-first, RTL. */
@font-face {
  font-family: "Vazirmatn";
  src: url("../fonts/Vazirmatn-variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --brand: #57403f;
  --brand-dark: #3f2e2d;
  --brand-tint: #ece6e5;
  --graphite: #26282c;
  --charcoal: #1b1d20;
  --steel: #3f6a8a;
  --surface: #f3f4f5;
  --paper: #ffffff;
  --line: #d7d9dc;
  --text: #25282b;
  --muted: #5d6268;
  --on-dark: #eef0f2;
  --radius: 4px;
  --max: 72rem;
  --font: "Vazirmatn", Tahoma, "Segoe UI", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); font-size: 1rem; line-height: 1.9;
  color: var(--text); background: var(--surface);
}
img, svg { max-width: 100%; height: auto; }
h1, h2, h3 { line-height: 1.4; margin: 0 0 .6em; color: var(--graphite); font-weight: 700; }
h1 { font-size: clamp(1.6rem, 4vw + .5rem, 2.4rem); }
h2 { font-size: clamp(1.25rem, 2vw + .6rem, 1.6rem); }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1em; max-width: 70ch; }
a { color: var(--steel); text-underline-offset: .2em; }
a:hover { color: var(--brand); }
:focus-visible { outline: 3px solid var(--steel); outline-offset: 2px; border-radius: 2px; }
main:focus { outline: none; }

.container { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: 1rem; }
.narrow { max-width: 50rem; }
.center { text-align: center; }
.center p { margin-inline: auto; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; inset-inline-start: .5rem; top: -4rem; background: var(--paper); color: var(--brand); padding: .6rem 1rem; z-index: 100; border: 2px solid var(--brand); }
.skip-link:focus { top: .5rem; }
.icon { flex: none; }
.muted { color: var(--muted); }
.meta { display: block; font-size: .85rem; color: var(--muted); line-height: 1.6; }
.empty { color: var(--muted); border: 1px dashed var(--line); padding: 1rem 1.25rem; background: var(--paper); border-radius: var(--radius); }
.notice { border-inline-start: 4px solid var(--steel); background: var(--paper); padding: .9rem 1.1rem; border-radius: var(--radius); }

/* Buttons & badges */
.btn {
  display: inline-flex; align-items: center; gap: .5rem; justify-content: center;
  min-height: 2.75rem; padding: .55rem 1.3rem; border-radius: var(--radius);
  background: var(--brand); color: #fff; border: 2px solid var(--brand);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-ghost { background: transparent; color: var(--on-dark); border-color: rgba(255,255,255,.55); }
.btn-ghost:hover { background: rgba(255,255,255,.12); border-color: #fff; color: #fff; }
.btn-small { min-height: 2.5rem; padding: .35rem 1rem; }
.badge { display: inline-block; font-size: .75rem; line-height: 1.6; padding: 0 .55rem; border-radius: 2px; background: var(--brand-tint); color: var(--brand-dark); font-weight: 600; }
.badge-pin { background: #dfe9f1; color: #234a66; }
.badge-light { background: rgba(255,255,255,.16); color: #fff; }
.text-link { font-weight: 600; }

/* Header */
.site-header { background: var(--paper); border-bottom: 3px solid var(--brand); position: sticky; top: 0; z-index: 50; }
.header-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 4.25rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; color: var(--brand); font-weight: 800; font-size: 1.05rem; line-height: 1.4; }
.brand img { border-radius: var(--radius); }
.nav-toggle { min-width: 2.75rem; min-height: 2.75rem; border: 2px solid var(--brand); background: transparent; border-radius: var(--radius); cursor: pointer; display: grid; place-items: center; }
.nav-toggle-bar, .nav-toggle-bar::before, .nav-toggle-bar::after { display: block; width: 1.3rem; height: 2px; background: var(--brand); content: ""; position: relative; }
.nav-toggle-bar::before { position: absolute; top: -6px; }
.nav-toggle-bar::after { position: absolute; top: 6px; }
.site-nav { display: none; width: 100%; padding-bottom: 1rem; }
.site-nav.is-open { display: block; }
.site-nav ul { list-style: none; margin: 0; padding: 0; }
.site-nav a { display: flex; align-items: center; gap: .4rem; min-height: 2.75rem; padding: .3rem .5rem; color: var(--text); text-decoration: none; font-weight: 500; border-bottom: 1px solid var(--line); }
.site-nav a:hover { color: var(--brand); background: var(--surface); }
.site-nav a[aria-current="page"] { color: var(--brand); font-weight: 800; box-shadow: inset -3px 0 0 var(--brand); }
.sub-nav a { padding-inline-start: 1.5rem; font-size: .95rem; }
.nav-login { padding-top: .75rem; }
.nav-login a { border-bottom: 2px solid var(--brand); color: #fff; }
.nav-login a:hover { color: #fff; background: var(--brand-dark); }

@media (min-width: 62rem) {
  .nav-toggle { display: none; }
  .site-nav { display: block; width: auto; padding: 0; }
  .site-nav > ul { display: flex; align-items: center; gap: .1rem; }
  .site-nav a { border-bottom: 0; padding: .3rem .65rem; font-size: .95rem; }
  .site-nav a[aria-current="page"] { box-shadow: inset 0 -3px 0 var(--brand); }
  .nav-login { padding: 0 0 0 0; margin-inline-start: .5rem; }
  .has-sub { position: relative; }
  .sub-nav { display: none; position: absolute; inset-inline-start: 0; top: 100%; min-width: 12rem; background: var(--paper); border: 1px solid var(--line); border-top: 3px solid var(--brand); box-shadow: 0 8px 20px rgba(0,0,0,.12); z-index: 60; }
  .has-sub:hover > .sub-nav, .has-sub:focus-within > .sub-nav { display: block; }
  .sub-nav a { padding-inline-start: .9rem; }
}

/* Hero with blueprint grid */
.hero {
  background-color: var(--graphite);
  background-image:
    linear-gradient(rgba(255,255,255,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.05) 1px, transparent 1px);
  background-size: 28px 28px;
  color: var(--on-dark); padding-block: clamp(2.5rem, 7vw, 5rem);
  border-bottom: 6px solid var(--brand);
}
.hero h1 { color: #fff; font-size: clamp(2rem, 6vw, 3.4rem); font-weight: 800; }
.hero .lead { font-size: 1.1rem; color: #d6dade; max-width: 34rem; }
.hero-grid { display: grid; gap: 2rem; align-items: center; }
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.title-block { border: 2px solid rgba(255,255,255,.75); background: rgba(27,29,32,.85); max-width: 26rem; width: 100%; }
.tb-head, .tb-foot { padding: .55rem 1rem; font-weight: 700; font-size: .9rem; background: rgba(255,255,255,.08); }
.tb-foot { border-top: 2px solid rgba(255,255,255,.75); color: #c3c8ce; font-weight: 500; }
.tb-row { display: flex; align-items: center; gap: .75rem; min-height: 3rem; padding: .35rem 1rem; color: #fff; text-decoration: none; border-top: 1px solid rgba(255,255,255,.3); }
.tb-row:hover { background: var(--brand); color: #fff; }
@media (min-width: 52rem) { .hero-grid { grid-template-columns: 1.4fr 1fr; } .title-block { justify-self: end; } }

/* Sections */
.section { padding-block: clamp(2rem, 5vw, 3.5rem); }
.section-alt { background: var(--paper); border-block: 1px solid var(--line); }
.page-head { background: var(--graphite); color: #fff; padding-block: 2rem; border-bottom: 6px solid var(--brand); }
.page-head h1 { color: #fff; margin-bottom: .4rem; }
.crumbs { font-size: .9rem; margin-bottom: .75rem; color: #c3c8ce; }
.crumbs a { color: inherit; }
.section .crumbs { color: var(--muted); }
.two-col { display: grid; gap: 2rem; }
@media (min-width: 52rem) { .two-col { grid-template-columns: 1fr 1fr; } .two-col.wide-first { grid-template-columns: 1.6fr 1fr; } }
.prose h2 { margin-top: 1.5em; }
.prose h2:first-child { margin-top: 0; }

/* Department cards */
.dept-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); }
.dept-card { display: block; background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--brand); padding: 1.25rem; color: var(--text); text-decoration: none; border-radius: var(--radius); }
.section-alt .dept-card { background: var(--surface); }
.dept-card:hover { border-top-color: var(--steel); background: #fff; }
.dept-card .icon { width: 2.25rem; height: 2.25rem; color: var(--brand); margin-bottom: .5rem; }
.dept-card h2, .dept-card h3 { margin-bottom: .3rem; color: var(--brand-dark); }
.dept-card p { font-size: .95rem; color: var(--muted); margin-bottom: .5rem; }
.image-placeholder { display: grid; place-items: center; gap: .5rem; aspect-ratio: 4 / 3; background: repeating-linear-gradient(45deg, var(--brand-tint), var(--brand-tint) 10px, #f4f0ef 10px, #f4f0ef 20px); color: var(--brand); text-align: center; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); font-size: .9rem; }
.image-placeholder .icon { width: 3rem; height: 3rem; }
.image-placeholder.small { aspect-ratio: 16 / 9; }
.dept-image, .project-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); border: 1px solid var(--line); }

/* Lists */
.news-list { list-style: none; margin: 0 0 1rem; padding: 0; }
.news-list li { padding: .8rem 0; border-bottom: 1px solid var(--line); }
.news-list a { font-weight: 700; text-decoration: none; color: var(--graphite); }
.news-list a:hover { color: var(--brand); text-decoration: underline; }
.news-list.big p { margin: .4rem 0 0; color: var(--muted); }
.pager { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: 1.5rem; }
.pager a, .chips a { min-width: 2.75rem; min-height: 2.75rem; display: inline-flex; align-items: center; justify-content: center; padding-inline: .9rem; border: 1px solid var(--line); background: var(--paper); text-decoration: none; color: var(--text); border-radius: var(--radius); }
.pager a[aria-current], .chips a[aria-current] { background: var(--brand); color: #fff; border-color: var(--brand); }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1.5rem; }
.info-list { display: grid; grid-template-columns: max-content 1fr; gap: .6rem 1.5rem; }
.info-list dt { font-weight: 700; } .info-list dd { margin: 0; }

/* Tables */
.table-wrap { overflow-x: auto; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 2rem; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; min-width: 34rem; }
th, td { padding: .7rem .9rem; text-align: start; border-bottom: 1px solid var(--line); vertical-align: top; }
thead th { background: var(--graphite); color: #fff; font-weight: 600; white-space: nowrap; }
tbody th { background: var(--surface); font-weight: 600; white-space: nowrap; }
.grid-table { min-width: 44rem; }
.grid-table td { min-width: 8rem; }
.inline-form { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin-bottom: 1.25rem; }
select { min-height: 2.5rem; padding: .3rem .6rem; font: inherit; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); max-width: 100%; }

/* Projects */
.project-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); margin-bottom: 1rem; }
.project-card { background: var(--paper); border: 1px solid var(--line); padding: .9rem; border-radius: var(--radius); }
.project-card h3 { margin: .6rem 0 .1rem; }

/* CTA, footer, misc */
.cta { background: var(--brand); color: #fff; padding-block: 2.5rem; }
.cta h2 { color: #fff; }
.cta p { color: #efe7e6; }
.cta-row { display: flex; flex-wrap: wrap; gap: 1.5rem; align-items: center; justify-content: space-between; }
.cta .btn { background: #fff; color: var(--brand-dark); border-color: #fff; }
.cta .btn:hover { background: var(--brand-tint); color: var(--brand-dark); }
.site-footer { background: var(--charcoal); color: #c9cdd2; padding-top: 2.5rem; font-size: .95rem; }
.site-footer a { color: #e6e8ea; }
.footer-grid { display: grid; gap: 1.5rem; grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid li a { display: inline-block; padding-block: .25rem; min-height: 2rem; }
.footer-title { font-weight: 700; color: #fff; margin-bottom: .4rem; }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.15); margin-top: 1.5rem; padding-block: 1rem; font-size: .85rem; }
.big-code { font-size: 5rem; font-weight: 800; color: var(--brand); line-height: 1; margin-bottom: .5rem; }
.debug { text-align: left; direction: ltr; background: var(--paper); padding: 1rem; overflow: auto; border: 1px solid var(--line); }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } * { transition: none !important; animation: none !important; } }
@media print { .site-header, .site-footer, .cta, .skip-link { display: none; } body { background: #fff; } }

/* Forms, alerts (Phase 2) */
.form-card { background: var(--paper); border: 1px solid var(--line); border-top: 4px solid var(--brand); border-radius: var(--radius); padding: 1.25rem; max-width: 28rem; }
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; margin-bottom: .3rem; }
.field input { width: 100%; min-height: 2.75rem; padding: .4rem .7rem; font: inherit; border: 1px solid #9aa0a6; border-radius: var(--radius); background: #fff; color: var(--text); }
.field input:focus-visible { border-color: var(--steel); }
.hint { font-size: .85rem; color: var(--muted); margin: .3rem 0 0; }
.alert { padding: .75rem 1rem; border-radius: var(--radius); margin-bottom: 1rem; border: 1px solid; }
.alert ul { margin: 0; padding-inline-start: 1.2rem; }
.alert-error { background: #fbeaea; border-color: #c75b5b; color: #6d1f1f; }
.alert-success { background: #e7f3ea; border-color: #5b9b6c; color: #1f4b2c; }
.flash { padding-top: 1rem; }
.btn-outline { background: transparent; color: var(--brand); }
.btn-outline:hover { background: var(--brand-tint); color: var(--brand-dark); }
.site-nav .btn.btn-small { border-bottom-width: 2px; }
.nav-logout form { margin: 0; }
.nav-logout { padding-top: .4rem; }
.plain-list { padding-inline-start: 1.2rem; }
.actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.5rem; }
.ltr-start { text-align: left; unicode-bidi: plaintext; }
@media (min-width: 62rem) { .nav-logout { padding-top: 0; } }

/* Admin area (Phase 3) */
.admin-nav { background: var(--charcoal); border-bottom: 3px solid var(--brand); }
.admin-nav ul { list-style: none; margin: 0; padding: 0; display: flex; gap: .15rem; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.admin-nav a { display: flex; align-items: center; min-height: 2.75rem; padding: .3rem .9rem; color: #d6dade; text-decoration: none; white-space: nowrap; font-size: .95rem; }
.admin-nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.admin-nav a[aria-current="page"] { color: #fff; font-weight: 700; box-shadow: inset 0 -3px 0 #fff; }
.head-row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.head-row h1 { margin: 0; }
.form-card.wide { max-width: 100%; }
.field textarea, .field select { width: 100%; padding: .5rem .7rem; font: inherit; border: 1px solid #9aa0a6; border-radius: var(--radius); background: #fff; color: var(--text); line-height: 1.8; }
.field select { min-height: 2.75rem; }
.field input[type="file"] { padding: .5rem; min-height: 2.75rem; }
.check { display: flex; align-items: center; gap: .6rem; min-height: 2.5rem; margin-bottom: .4rem; }
.check input { width: 1.25rem; height: 1.25rem; flex: none; accent-color: var(--brand); }
.field-group { border: 1px solid var(--line); border-radius: var(--radius); padding: .75rem 1rem 1rem; margin: 0 0 1rem; }
.field-group legend { font-weight: 700; padding-inline: .4rem; }
.grid-2 { display: grid; gap: 0 1rem; }
@media (min-width: 40rem) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.thumb { display: block; max-width: 14rem; max-height: 9rem; object-fit: cover; border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: .5rem; }
.logo-thumb { width: 5rem; height: 5rem; object-fit: contain; background: var(--surface); }
.badge-ok { background: #e1f0e5; color: #1f4b2c; }
.hero-photo img { display: block; width: 100%; max-height: 26rem; object-fit: cover; }
.inline-form input[type="search"] { min-height: 2.5rem; padding: .3rem .6rem; font: inherit; border: 1px solid var(--line); border-radius: var(--radius); }
.inline-form label { font-weight: 600; }

/* Academic admin (Phase 4) */
form.inline { display: inline-block; margin: 0 .15rem .15rem 0; }
.actions-cell { white-space: nowrap; }
.actions-cell a { margin-inline-end: .5rem; }
.edit-grid td { min-width: 9.5rem; padding: .4rem; }
.edit-grid input, .edit-grid select { width: 100%; min-height: 2.4rem; padding: .2rem .45rem; margin-bottom: .25rem; font: inherit; font-size: .9rem; border: 1px solid #9aa0a6; border-radius: var(--radius); background: #fff; }
.edit-grid input[readonly] { background: var(--surface); }

/* Portal, resources, projects (Phase 5) */
.media-list { list-style: none; margin: 0 0 1.5rem; padding: 0; display: grid; gap: .75rem; }
.media-list li { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem; padding: .6rem; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.media-list .thumb { margin: 0; max-width: 9rem; max-height: 6rem; }
.lead-name { font-size: 1.1rem; margin-bottom: .25rem; }
.project-card h3 a { color: var(--brand-dark); text-decoration: none; }
.project-card h3 a:hover { text-decoration: underline; }

/* Phase 6 (QA fixes found by real-browser inspection) */
/* Absolutely positioned .visually-hidden labels inside a scrolling table used to escape the scroll box and widen the page. */
.table-wrap { position: relative; }
/* Touch targets: at least 44px tall */
.crumbs a { display: inline-block; padding-block: .65rem; }
.footer-grid li a { display: inline-flex; align-items: center; min-height: 2.75rem; }
.edit-grid input, .edit-grid select { min-height: 2.75rem; }
.dept-grid { grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr)); margin-bottom: 1.75rem; }

/* ===== Polish v3 ===== */
:root { --ease: cubic-bezier(.22, .8, .3, 1); --sk-a: #e1e4e7; --sk-b: #f4f5f6; }
::selection { background: var(--brand); color: #fff; }
a, .btn, input, select, textarea { transition: color .2s, background-color .2s, border-color .2s, box-shadow .2s, transform .15s; }
.btn:active { transform: translateY(1px); }
input:focus, select:focus, textarea:focus { border-color: var(--steel); box-shadow: 0 0 0 4px rgba(63,106,138,.18); }

/* Header: shadow after scroll, reading progress, animated desktop underline */
.site-header { transition: box-shadow .3s; }
.site-header.is-stuck { box-shadow: 0 8px 24px -12px rgba(0,0,0,.4); }
.site-header::after { content: ""; position: absolute; inset-inline: 0; bottom: -3px; height: 3px; background: var(--steel); transform: scaleX(var(--p, 0)); transform-origin: right; pointer-events: none; }
.nav-toggle-bar, .nav-toggle-bar::before, .nav-toggle-bar::after { transition: transform .3s var(--ease), background-color .2s, top .3s var(--ease); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::before { top: 0; transform: rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle-bar::after { top: 0; transform: rotate(-45deg); }
@media (min-width: 62rem) {
  .site-nav a { position: relative; }
  .site-nav > ul > li > a:not(.btn)::after { content: ""; position: absolute; inset-inline: .65rem; bottom: .15rem; height: 2px; background: var(--steel); transform: scaleX(0); transform-origin: right; transition: transform .3s var(--ease); }
  .site-nav > ul > li > a:not(.btn):hover::after { transform: scaleX(1); }
  .nav-backdrop, .sheet-handle { display: none; }
}

/* Mobile menu = bottom sheet: scrollable, swipe down (or tap outside) to close */
.nav-backdrop { position: fixed; inset: 0; z-index: 1; background: rgba(24,20,20,.55); opacity: 0; visibility: hidden; transition: opacity .3s, visibility 0s .3s; }
.nav-backdrop.is-open { opacity: 1; visibility: visible; transition-delay: 0s; }
@media (max-width: 61.99rem) {
  html.nav-locked { overflow: hidden; }
  .site-nav { display: block; position: fixed; inset-inline: 0; bottom: 0; z-index: 2; width: auto; max-height: min(85vh, 85dvh, 40rem); overflow-y: auto; overscroll-behavior: contain; background: var(--paper); border-radius: 18px 18px 0 0; box-shadow: 0 -14px 40px -10px rgba(0,0,0,.4); padding: 0 1rem calc(1rem + env(safe-area-inset-bottom, 0px)); transform: translateY(105%); visibility: hidden; transition: transform .38s var(--ease), visibility 0s .38s; }
  .site-nav.is-open { transform: none; visibility: visible; transition-delay: 0s; }
  .site-nav:focus { outline: none; }
  .sheet-handle { display: grid; place-items: center; position: sticky; top: 0; z-index: 1; margin-inline: -1rem; padding: .85rem 0 .55rem; background: var(--paper); touch-action: none; cursor: grab; }
  .sheet-handle::before { content: ""; width: 2.75rem; height: .3rem; border-radius: 9px; background: var(--line); }
}

/* Hero: one entrance sequence, nothing loops */
.hero { position: relative; overflow: hidden; }
.hero::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(42rem 22rem at 88% -10%, rgba(63,106,138,.38), transparent 65%); }
.hero > .container { position: relative; }
.hero h1::after { content: ""; display: block; height: 4px; width: 5rem; margin-top: .9rem; background: var(--steel); transform-origin: right; animation: dimension 1s .55s var(--ease) both; }
.hero-text > * { animation: rise .8s var(--ease) both; }
.hero-text > :nth-child(2) { animation-delay: .1s; } .hero-text > :nth-child(3) { animation-delay: .2s; } .hero-text > :nth-child(4) { animation-delay: .3s; }
.title-block { animation: slide-in .9s .25s var(--ease) both; }
.tb-row { animation: rise .6s var(--ease) both; }
.tb-row:nth-of-type(1) { animation-delay: .5s; } .tb-row:nth-of-type(2) { animation-delay: .6s; } .tb-row:nth-of-type(3) { animation-delay: .7s; }
.tb-row:nth-of-type(4) { animation-delay: .8s; } .tb-row:nth-of-type(5) { animation-delay: .9s; } .tb-row:nth-of-type(n+6) { animation-delay: 1s; }

/* Cards: brand edge draws in on hover/focus; images ease in */
.dept-card, .project-card { position: relative; }
.dept-card::after, .project-card::after { content: ""; position: absolute; inset-inline: 0; top: 0; height: 3px; background: var(--brand); transform: scaleX(0); transform-origin: right; transition: transform .35s var(--ease); }
.dept-card:hover::after, .project-card:hover::after, .dept-card:focus-within::after, .project-card:focus-within::after { transform: scaleX(1); }
.dept-image, .thumb, .hero-photo { overflow: hidden; }
.dept-image img, .thumb img, .project-card img, .hero-photo img { transition: transform .6s var(--ease), opacity .45s; }
.dept-card:hover img, .project-card:hover img { transform: scale(1.04); }
.alert { animation: rise .4s var(--ease) both; }
.table-wrap tbody tr:hover { background: var(--brand-tint); }

/* Skeletons */
@keyframes shimmer { from { background-position: 150% 0; } to { background-position: -50% 0; } }
.skel-line, .skel-block, .is-loading::before { background: linear-gradient(100deg, var(--sk-a) 30%, var(--sk-b) 50%, var(--sk-a) 70%) 150% 0 / 200% 100%; animation: shimmer 1.4s linear infinite; }
.is-loading { position: relative; min-height: 9rem; }
.is-loading::before { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.is-loading img { opacity: 0; }
.nav-bar { position: fixed; top: 0; inset-inline: 0; height: 3px; z-index: 99; background: var(--steel); transform: scaleX(0); transform-origin: right; pointer-events: none; }
.is-navigating .nav-bar { animation: nav-load 8s cubic-bezier(.1, .6, .2, 1) forwards; }
.skeleton-page { position: fixed; inset: 0; top: var(--hh, 4.5rem); z-index: 45; background: var(--surface); padding-block: 2rem; opacity: 0; pointer-events: none; animation: fade-in .25s .18s forwards; overflow: hidden; }
.skel-line { height: 1rem; border-radius: 3px; margin-bottom: .8rem; }
.skel-title { height: 2.1rem; width: min(22rem, 70%); margin-bottom: 1.6rem; }
.skel-line.w90 { width: 90%; } .skel-line.w75 { width: 75%; } .skel-line.w55 { width: 55%; }
.skeleton-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); margin-top: 1.8rem; }
.skel-card { height: 11rem; border-radius: var(--radius); }
button.is-busy, .btn.is-busy { pointer-events: none; opacity: .85; }
button.is-busy::before, .btn.is-busy::before { content: ""; width: 1em; height: 1em; border: 2px solid currentColor; border-top-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.to-top { position: fixed; inset-inline-end: 1rem; bottom: 1rem; z-index: 60; width: 2.9rem; height: 2.9rem; border: 0; border-radius: 50%; background: var(--brand); color: #fff; cursor: pointer; opacity: 0; transform: translateY(12px); pointer-events: none; transition: opacity .3s, transform .3s var(--ease), background-color .2s; }
.to-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover { background: var(--brand-dark); }
.to-top::before { content: ""; display: block; width: .65rem; height: .65rem; margin: .3rem auto 0; border-top: 3px solid currentColor; border-inline-start: 3px solid currentColor; transform: rotate(45deg); }

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { opacity: 0; transform: translateX(-28px); } to { opacity: 1; transform: none; } }
@keyframes dimension { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { to { opacity: 1; } }
@keyframes nav-load { to { transform: scaleX(.92); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* ===== Deputy panel ===== */
.badge-ok { background: #dcefe0; color: #1d5a30; } .badge-warn { background: #fbebc8; color: #7a4b00; }
.badge-danger { background: #f6d6d3; color: #8a1f17; } .badge-muted { background: #e6e7e9; color: #4d5258; }
.stat-grid { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr)); margin: 1.25rem 0 2rem; }
.stat { display: flex; flex-direction: column; gap: .2rem; padding: 1rem; background: var(--paper); border: 1px solid var(--line); border-inline-start: 4px solid var(--brand); border-radius: var(--radius); color: inherit; text-decoration: none; }
.stat strong { font-size: 1.75rem; line-height: 1.1; }
.stat span { font-size: .85rem; opacity: .8; }
.stat-warn { border-inline-start-color: #c98a00; } .stat-danger { border-inline-start-color: #b3261e; } .stat-ok { border-inline-start-color: #2e7d4f; }
a.stat:hover { border-color: var(--brand); }
.facts { display: grid; gap: .75rem 1.5rem; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); margin: 1rem 0 1.5rem; }
.facts dt { font-size: .8rem; opacity: .75; } .facts dd { margin: 0; font-weight: 600; }
.changes { list-style: none; margin: .35rem 0 0; padding: 0; font-size: .85rem; } .changes del { opacity: .65; }
.quick { display: flex; flex-wrap: wrap; gap: .5rem; }
.plain-list li { margin-bottom: .6rem; } .plain-list .meta { display: block; }
.print-only { display: none; }
@media print {
  .site-header, .site-footer, .no-print, .deputy-nav, .admin-nav, .to-top, .nav-bar, .skeleton-page, .pager { display: none !important; }
  .print-only { display: block; } body { background: #fff; } .table-wrap { overflow: visible; } table { font-size: .8rem; } a { color: inherit; text-decoration: none; }
}
