/* The server-rendered pages of the watch: /admissions/reshte/, /admissions/daneshgah/
   and one page per major and per institution (lib/admissions-pages.mjs).
   They load admissions.css first for the shared shell — topbar, sub-nav, page
   head, footer brand — and this sheet for what only they draw. Tokens only:
   no raw colour, no .ds-* selector; on a ds element this sheet sets knobs and
   placement through its own class (docs/claude/COMPONENTS.md). */

.adm-main { overflow: visible; }

/* Breadcrumb, inside the page head */
.adm-crumbs ol { display: flex; flex-wrap: wrap; align-items: center; margin: 0 0 6px; padding: 0; list-style: none; font-size: var(--fs-micro); color: var(--muted); }
.adm-crumbs li { display: inline-flex; align-items: center; min-width: 0; }
.adm-crumbs li + li::before { content: "‹"; margin-inline: 8px; color: var(--muted-on-white); }
.adm-crumbs a { display: inline-flex; align-items: center; min-height: 32px; color: var(--muted); text-decoration: none; }
.adm-crumbs a:hover { color: var(--action); }
.adm-crumbs [aria-current] { color: var(--ink); font-weight: 700; overflow-wrap: anywhere; }

/* Page head: one column, the clay mark beside the title */
.ad-head { grid-template-columns: minmax(0, 1fr); padding-bottom: 8px; }
.ad-head h1 { overflow-wrap: anywhere; }
.ad-head .page-head__lead { max-width: 760px; }
.ad-facts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; max-width: 920px; margin: 20px 0 0; }
.ad-facts div { display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 12px 14px; border: 1px solid var(--line-warm); border-radius: var(--radius-control); background: var(--surface); }
.ad-facts b { font-size: 22px; line-height: 1.4; font-weight: 850; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ad-facts span { font-size: var(--fs-micro); line-height: 1.6; color: var(--muted); }
.ad-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }

/* Body: a column of sections on the warm ground */
.ad-body { width: var(--narrow); margin: 0 auto 56px; display: grid; gap: 16px; }
.ad-section { min-width: 0; padding: 24px; border: 1px solid var(--line-warm); border-radius: var(--radius-card); background: var(--surface); scroll-margin-top: 16px; }
.ad-section > h2 { margin: 0 0 10px; font-size: clamp(19px, 1.8vw, 24px); line-height: 1.5; font-weight: 850; }
.ad-section h3 { margin: 18px 0 8px; font-size: var(--fs-h4); line-height: var(--lh-h4); }
.ad-section p { max-width: 80ch; margin: 0 0 12px; color: var(--muted); font-size: var(--fs-ui); line-height: 2; }
.ad-section p:last-child { margin-bottom: 0; }
.ad-section p a, .adm-order a { color: var(--action); font-weight: 700; text-underline-offset: 4px; }
.ad-note { font-size: var(--fs-small); }
.ad-more { margin: 10px 0 0; font-size: var(--fs-small); color: var(--muted); }

.ad-links { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; list-style: none; }
.ad-links li { display: flex; min-width: 0; }
.ad-jumps .ad-links { gap: 6px; }
.ad-co-n { font-size: var(--fs-micro); font-weight: 500; color: var(--muted); }

.ad-names { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 0 20px; margin: 0; padding: 0; list-style: none; }
.ad-names a { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 2px; border-bottom: 1px solid var(--line-warm); color: var(--ink); font-size: var(--fs-ui); font-weight: 650; line-height: 1.7; text-decoration: none; }
.ad-names a:hover { color: var(--action); }
.ad-names a > svg { flex: none; margin-inline-start: auto; color: var(--muted-on-white); }
.ad-names a:hover > svg { color: var(--action); }

/* Tables: a wide one scrolls inside its own box, never the page */
.ad-table-wrap { overflow-x: auto; overscroll-behavior-x: contain; margin: 14px 0 0; border: 1px solid var(--line-warm); border-radius: var(--radius-field); background: var(--surface); }
.ad-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: var(--fs-small); }
.ad-table th { background: var(--ground-2); text-align: start; padding: 11px 14px; border-bottom: 1px solid var(--line-warm); white-space: nowrap; font-size: var(--fs-micro); font-weight: 700; color: var(--muted); }
.ad-table td { padding: 10px 14px; border-bottom: 1px solid var(--line-warm); white-space: nowrap; font-variant-numeric: tabular-nums; }
.ad-table tbody tr:last-child td { border-bottom: 0; }
.ad-table tbody tr:hover td { background: var(--ground-2); }
.ad-table thead th:first-child, .ad-table tbody td:first-child { position: sticky; inset-inline-start: 0; z-index: 1; box-shadow: inset 1px 0 0 var(--line-warm); }
.ad-table tbody td:first-child { background: var(--surface); }
.ad-name { min-width: 180px; white-space: normal; font-weight: 700; }
.ad-name a { color: var(--action); text-decoration: none; }
.ad-name a:hover { text-decoration: underline; text-underline-offset: 4px; }
.ad-rank { font-weight: 800; }
.ad-rank small { font-weight: 500; color: var(--muted); }
.ad-rank.is-empty { color: var(--muted-on-white); font-weight: 500; }
.ad-count { color: var(--muted); }
.ad-karnameh td:not(:first-child), .ad-karnameh th:not(:first-child) { text-align: center; }
.ad-booklet th, .ad-booklet td { white-space: normal; }
.ad-booklet tbody th { width: 38%; font-size: var(--fs-small); border-bottom: 1px solid var(--line-warm); }
.ad-booklet tbody th:first-child { position: static; box-shadow: none; }
.ad-booklet tbody tr:last-child th { border-bottom: 0; }

/* «پیش از رتبه» */
.ad-profile { margin: 16px 0; padding: 16px 18px; border: 1px solid var(--line-warm); border-radius: var(--radius-field); background: var(--ground-2); }
.ad-profile { columns: 2 300px; column-gap: 36px; }
.ad-profile > .ad-profile__label, .ad-profile > blockquote { column-span: all; }
.ad-profile h3 { break-after: avoid; }
.ad-profile ul, .ad-profile p { break-inside: avoid; }
.ad-section .ad-profile__label { margin: 0 0 10px; font-size: var(--fs-micro); line-height: 1.7; }
.ad-profile blockquote { margin: 0 0 10px; padding: 0 12px; border-inline-start: 3px solid var(--orange); line-height: 2; color: var(--ink); }
.ad-profile h3 { margin: 14px 0 4px; font-size: var(--fs-ui); }
.ad-profile ul { margin: 0; padding-inline-start: 1.2rem; color: var(--ink-2); font-size: var(--fs-ui); line-height: 1.95; }
.ad-section .ad-season { max-width: none; margin: 14px 0; padding: 12px 14px; border: 1px solid var(--warn-line); border-radius: var(--radius-control); background: var(--warn-tint); color: var(--warn-strong); }
.ad-guides { margin-top: 16px; }
.ad-section .ad-guides p { margin-bottom: 8px; }

/* Questions and the honesty block */
.ad-faqs { display: grid; gap: 8px; }
.ad-faq p { margin: 0; }
.ad-honesty { border-color: var(--orange-line); background: var(--ground-2); }
.ad-honesty ul { margin: 0; padding-inline-start: 1.2rem; color: var(--ink-2); font-size: var(--fs-ui); line-height: 2.05; }
.ad-honesty li + li { margin-top: 6px; }
.ad-honesty b { color: var(--ink); }

/* The two lists */
.adm-find__box { --ds-search-shadow: var(--shadow-card); max-width: 640px; }
.adm-order { margin: 0; color: var(--muted); font-size: var(--fs-small); line-height: 1.9; }
.adm-group { display: grid; gap: 12px; min-width: 0; scroll-margin-top: 16px; }
.adm-group + .adm-group { margin-top: 12px; }
.adm-group__head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 16px; }
.adm-group__head h2 { margin: 0; font-size: clamp(20px, 2vw, 26px); line-height: 1.5; font-weight: 850; }
.adm-group__count { margin-inline-start: 6px; font-size: var(--fs-small); font-weight: 600; color: var(--muted); }
.adm-entries { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 10px; margin: 0; padding: 0; list-style: none; }
.adm-entry { display: flex; min-width: 0; }
.adm-entry__link { --ds-card-dir: row; --ds-card-align: center; --ds-card-pad: 14px 16px; --ds-card-gap: 12px; --ds-card-r: var(--radius-field); flex: 1 1 auto; min-height: 78px; }
.adm-entry__link:hover { --ds-card-border: 1.5px solid var(--orange-3); }
.adm-entry__text { display: flex; flex: 1 1 auto; flex-direction: column; gap: 2px; min-width: 0; }
.adm-entry__name { font-size: var(--fs-h4); font-weight: 800; line-height: 1.6; color: var(--ink); overflow-wrap: anywhere; }
.adm-entry__meta { font-size: var(--fs-micro); line-height: 1.7; color: var(--muted); font-variant-numeric: tabular-nums; }
.adm-entry__also { align-self: flex-start; margin-top: 4px; }
.adm-entry__go { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%; background: var(--ground-2); color: var(--action); transition: transform var(--dur-fast) var(--ease-out), background-color var(--dur-fast); }
.adm-entry__link:hover .adm-entry__go { background: var(--orange-tint); transform: translateX(-3px); }
.adm-thin { border-style: dashed; border-color: var(--orange-line); background: var(--ground-2); }
.adm-none { margin: 0; }

/* Footer: the brand line and the site's three link groups */
.adm-foot { margin-top: 8px; border-top: 1px solid var(--line-warm); background: var(--surface); }
.adm-foot__inner { width: var(--wide); margin: 0 auto; padding: 32px 0 20px; display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(0, 1fr)); gap: 24px; }
.adm-foot__brand p { max-width: 44ch; margin: 12px 0 0; color: var(--muted); font-size: var(--fs-small); line-height: 2; }
.adm-foot nav { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.adm-foot nav h2 { margin: 0 0 6px; font-size: var(--fs-ui); font-weight: 800; color: var(--ink); }
.adm-foot nav a { display: inline-flex; align-items: center; min-height: 36px; color: var(--muted); font-size: var(--fs-small); text-decoration: none; }
.adm-foot nav a:hover { color: var(--action); }
.adm-foot__base { width: var(--wide); margin: 0 auto; padding: 14px 0 28px; border-top: 1px solid var(--line-warm); color: var(--muted); font-size: var(--fs-micro); }
.adm-foot__base a { color: inherit; }

@media (max-width: 1050px) {
  .adm-foot__inner { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .adm-foot__brand { grid-column: 1 / -1; }
}

@media (max-width: 760px) {
  .ad-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
  .ad-facts div { padding: 10px 12px; }
  .ad-facts b { font-size: 18px; }
  .ad-actions { margin-top: 14px; }
  .ad-actions > a { flex: 1 1 100%; }
  .ad-body { gap: 12px; margin-bottom: 40px; }
  .ad-section { padding: 16px; border-radius: var(--radius-field); }
  .ad-section p { font-size: var(--fs-small); line-height: 1.95; }
  .ad-name { min-width: 132px; }
  .ad-table th, .ad-table td { padding: 9px 11px; }
  .adm-entries { gap: 8px; }
  .adm-entry__link { min-height: 68px; }
  .adm-group__head { align-items: flex-start; flex-direction: column; }
  .adm-foot__inner { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-top: 24px; gap: 18px 16px; }
}

/* A thumb aims at every link, so the secondary ones take the 44px floor too. */
@media (pointer: coarse) {
  .adm-crumbs a, .adm-foot nav a { min-height: 2.75rem; }
}

/* A rank table on a phone: one panel per row — the name, then where, how and
   when with the witness count, then the three quotas side by side. The column
   name rides on each quota cell, since the header row is not drawn here. With
   the script on, a long table opens at its first thirty rows (pages.js). */
.adm-more { margin-top: 10px; }
@media (min-width: 761px) { .adm-more { display: none; } }
@media (max-width: 760px) {
  .ad-rows { overflow: visible; border: 0; border-radius: 0; background: none; }
  .ad-rows table, .ad-rows tbody { display: block; }
  .ad-rows thead { display: none; }
  .ad-rows tr { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 6px; margin-bottom: 8px; padding: 10px 12px; border: 1px solid var(--line-warm); border-radius: var(--radius-control); background: var(--surface); }
  .ad-rows tbody tr:last-child { margin-bottom: 0; }
  .ad-rows[data-clipped] tbody tr:nth-child(n+31) { display: none; }
  .ad-rows td, .ad-rows tbody tr:hover td { display: block; grid-column: span 3; min-width: 0; padding: 0; border: 0; background: none; white-space: normal; overflow-wrap: anywhere; font-size: var(--fs-micro); color: var(--muted); }
  .ad-rows tbody td:first-child { grid-column: 1 / -1; position: static; box-shadow: none; background: none; font-size: var(--fs-ui); line-height: 1.7; color: var(--ink); }
  .ad-rows td:nth-child(8) { grid-row: 2; grid-column: 10 / span 3; text-align: end; }
  .ad-rows td:nth-child(8)::after { content: " شاهد"; }
  .ad-rows td:nth-child(n+5):nth-child(-n+7) { display: flex; flex-direction: column; grid-column: span 4; padding: 5px 8px; border-radius: var(--radius-tile); background: var(--ground-2); color: var(--ink); font-size: var(--fs-small); }
  .ad-rows td:nth-child(n+5):nth-child(-n+7)::before { color: var(--muted); font-size: var(--fs-micro); font-weight: 500; }
  .ad-rows td:nth-child(5)::before { content: "منطقه ۱"; }
  .ad-rows td:nth-child(6)::before { content: "منطقه ۲"; }
  .ad-rows td:nth-child(7)::before { content: "منطقه ۳"; }
}
