/* Shared visual language of the 5th Republic online service portal. */
:root {
  color-scheme: light;
  --navy: #245f96;
  --navy-dark: #174f80;
  --text-blue: #39578e;
  --teal: #59b8c3;
  --line: #cdd5e2;
  --heading: #e4e9f8;
  --soft: #f3f6fb;
  --ink: #353e46;
  --muted: #586671;
  --font: "돋움", Dotum, "굴림", Gulim, Arial, sans-serif;
}
* { box-sizing: border-box; }
html { min-height: 100%; background: #e9e9e9; }
body {
  margin: 0;
  background: repeating-linear-gradient(90deg, #ededed 0 1px, #e9e9e9 1px 4px);
  color: var(--ink);
  font: 1rem/1.5 var(--font);
  word-break: keep-all;
  overflow-wrap: anywhere;
}
button, input, textarea, select { font: inherit; }
button { cursor: pointer; color: inherit; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
img { display: block; max-width: 100%; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid #075a85;
  outline-offset: 2px;
}
[hidden] { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: 0; left: 1rem; z-index: 500; padding: .6rem 1rem;
  transform: translateY(-120%); background: var(--navy-dark); color: white;
}
.skip-link:focus { transform: translateY(0); }
.site-shell {
  width: min(1134px, 100%); min-height: 100vh; margin-inline: auto;
  display: flex; flex-direction: column; border-inline: 1px solid #cdcdcd; background: white;
}
.site-shell > .fifth-official-banner { max-width: none; }
.utility-bar, .masthead, .site-footer { display: flex; align-items: center; justify-content: space-between; }
.utility-bar { min-height: 25px; padding-inline: 15px; color: var(--muted); font-size: .75rem; }
.utility-links, .utility-actions, .footer-links { display: flex; align-items: center; }
.utility-bar a + a, .utility-actions > :not(:first-child), .footer-links a + a {
  margin-left: 8px; padding-left: 8px; border-left: 1px solid #c9ced4; line-height: 1.05;
}
.utility-actions a, .utility-actions button { color: #145c78; font-weight: bold; }
.utility-actions button { border: 0; padding: 0; background: none; }
.masthead { min-height: 49px; gap: .65rem; padding: 4px 15px 7px; }
.brand { display: flex; align-items: center; gap: 7px; color: #145c78; }
.brand:hover { text-decoration: none; }
.brand img { width: 38px; height: 38px; object-fit: contain; }
.brand span, .header-service { display: grid; }
.brand strong { font: bold 1.2rem/1.2 "굴림", Gulim, var(--font); }
.brand small { margin-top: 2px; color: #626b73; font: .625rem/1.2 Arial, sans-serif; }
.header-service { padding-left: 13px; border-left: 1px solid #c3cad1; color: #4d5862; text-align: right; }
.header-service small { color: #676f76; font-size: .75rem; }
.header-service strong { font-size: .875rem; }
.nav-toggle { display: none; }
.primary-nav {
  display: flex; padding-inline: 7px; border-block: 1px solid #124d76;
  background: linear-gradient(#286a9f, #205f94 51%, #1b578b 52%, #174f80);
  color: white;
}
.primary-nav a {
  display: grid; flex: 1 1 0; min-height: 33px; place-items: center; padding: 3px 6px;
  border-inline-start: 1px solid #ffffff2c; font-weight: bold; font-size: .875rem;
}
.primary-nav a:last-of-type { border-inline-end: 1px solid #ffffff2c; }
.primary-nav a:hover, .primary-nav a.active, .primary-nav a[aria-current="page"] { background: #075983; }
.primary-nav a:focus-visible { outline-color: #ffce75; outline-offset: -3px; }
main { flex: 1; min-width: 0; padding: 7px 13px 19px; }
.page-heading { margin-bottom: 9px; padding: 0 2px 5px; border-bottom: 1px solid var(--teal); }
.breadcrumb { display: flex; align-items: center; gap: 5px; color: #616b72; font-size: .75rem; }
.breadcrumb span { color: #87939e; }
.page-heading h1 { margin: 3px 0 0; color: #343c40; font-size: 1.125rem; line-height: 1.45; }
.content-layout { display: grid; grid-template-columns: 137px minmax(0, 1fr) 222px; align-items: start; gap: 10px; }
.catalogue-column, .side-column { display: grid; align-content: start; gap: 11px; min-width: 0; }
.local-column { align-self: stretch; min-width: 0; border-right: 1px solid #e0e4ed; background: #f7f8fc; }
.local-column h2, .side-panel h2, .panel-heading {
  margin: 0; color: var(--text-blue); font-size: .9375rem; line-height: 1.45;
}
.local-column h2 {
  padding: 6px 8px; border-block: 2px solid #506b9b; border-bottom: 1px solid var(--line);
  background: var(--heading);
}
.local-menu { padding: 4px 8px 10px; }
.local-menu h3 { margin: 6px 0 3px; padding-bottom: 3px; border-bottom: 1px solid #d9dfeb; color: #545c63; font-size: .8125rem; }
.local-menu h3:not(:first-child) { margin-top: 12px; }
.local-menu a { position: relative; display: block; padding: 3px 0 3px 8px; color: #525f7c; font-size: .8125rem; }
.local-menu a::before { content: ""; position: absolute; top: .82rem; left: 0; width: 3px; height: 3px; background: #7d8eaf; }
.portal-shortcut { margin: 4px 8px; padding-top: 10px; border-top: 1px solid #d9dfeb; }
.portal-shortcut a { display: block; padding: 6px 2px; font-size: .8125rem; text-align: center; }
.portal-shortcut a, .primary-button {
  border: 1px solid #164f79; background: linear-gradient(#2871a6, #174f80); color: white; font-weight: bold;
}
.primary-button, .quiet-button, .outline-button { display: inline-flex; align-items: center; justify-content: center; min-height: 35px; padding: 5px 12px; font-size: .875rem; }
.primary-button:hover, .portal-shortcut a:hover { background: #104970; }
.quiet-button, .outline-button {
  border: 1px solid #aab5c1; background: linear-gradient(white, #e8edf2); color: #384651; font-weight: bold;
}
.quiet-button:hover, .outline-button:hover { background: #e4edf4; }
.text-link { color: #1c6289; text-decoration: underline; text-underline-offset: 2px; }
input:not([type="checkbox"]), select, textarea {
  min-width: 0; padding: 5px 8px; border: 1px solid #a9b8c6; border-radius: 0; background-color: white; color: #2e4050;
}
input::placeholder, textarea::placeholder { color: #66737e; }
select {
  appearance: none;
  padding-right: 1.55rem;
  background-image: linear-gradient(45deg, transparent 50%, #4a6176 50%), linear-gradient(135deg, #4a6176 50%, transparent 50%);
  background-position: right .75rem center, right .5rem center; background-size: .27rem .27rem; background-repeat: no-repeat;
}
.portal-panel, .side-panel { min-width: 0; border: 1px solid var(--line); background: white; }
.portal-panel { border-top: 2px solid #266f9b; }
.panel-heading { padding: 6px 10px; border-bottom: 1px solid #becbdb; background: #eef2fa; color: #245d7c; font-weight: bold; }
.panel-body { padding: 10px; }
.archive-section, .side-panel { scroll-margin-top: 8px; }
.intro { display: flex; align-items: center; gap: 12px; margin: 0 11px; padding: 16px 4px 13px; }
.intro img { flex: none; width: 61px; height: 61px; object-fit: contain; }
.intro p { margin: 0; color: #147887; font: bold .6875rem/1.4 Tahoma, Arial, sans-serif; }
.intro h2 { margin: 3px 0; color: #bd492b; font-size: 1.4rem; line-height: 1.35; }
.intro span { color: #50606a; font-size: .875rem; }



.quick-terms { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 9px; padding: 5px 12px 8px; color: #5c6870; font-size: .8125rem; }
.quick-terms strong { color: #3c6081; }
.quick-terms button { border: 0; padding: 2px 0; background: transparent; }
.quick-terms button:hover { color: var(--navy); text-decoration: underline; }
.catalog-search {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto auto;
  align-items: end; gap: 6px; padding: 8px; border: 1px solid #ccd8e2; background: var(--soft);
}
.search-home .catalog-search { margin-inline: 10px; }
.catalog-query { grid-column: 1 / -1; display: flex; align-items: center; gap: 9px; }
.catalog-search label { display: block; margin: 0 0 3px; color: #405c74; font-weight: bold; font-size: .8125rem; }
.catalog-query label { flex: none; margin: 0; }
.catalog-search input, .catalog-search select { width: 100%; min-height: 33px; font-size: .875rem; }
.catalog-search button { min-height: 33px; padding: 4px 10px; }
.side-panel h2 { padding: 5px 9px; border-bottom: 1px solid var(--teal); background: var(--heading); }
.stats { margin: 2px 9px; }
.stats > div { display: flex; justify-content: space-between; align-items: baseline; gap: 5px; padding: 5px 1px; border-bottom: 1px dotted #bec8d0; font-size: .875rem; }
.stats > div:last-child { border-bottom: 0; }
.stats dd { margin: 0; color: #245d7c; font-weight: bold; font-variant-numeric: tabular-nums; }
.spotlight-link { display: block; padding: 7px; width: 100%; border: 0; background: white; text-align: left; }
.spotlight-link img { width: 100%; height: auto; aspect-ratio: 4 / 3; object-fit: contain; background: #eef2f6; }
.spotlight-caption { display: grid; gap: 3px; padding: 6px 1px 2px; }
.spotlight-caption small { color: #526c80; font-size: .75rem; }
.spotlight-caption strong { color: #214965; font-size: .875rem; }
.spotlight-link:hover strong { text-decoration: underline; }
.guide-steps { list-style: none; margin: 0; padding: 0 9px; counter-reset: step; }
.guide-steps li { position: relative; padding: 7px 0 7px 27px; border-bottom: 1px dotted #bdc7d0; counter-increment: step; }
.guide-steps li:last-child { border-bottom: 0; }
.guide-steps li::before {
  content: counter(step); position: absolute; top: 8px; left: 0; width: 20px; height: 20px;
  display: grid; place-items: center; border: 1px solid #adc3d1; background: #eff5f9; color: #24617e;
  font: bold .75rem/1 Tahoma, sans-serif;
}
.guide-steps strong, .access-note h2 { font-size: .875rem; }
.guide-steps p, .access-note p { margin: 2px 0 0; color: #56626b; font-size: .8125rem; line-height: 1.5; }
.access-note { padding: 9px; border: 1px solid #ddd2a6; background: #fffced; }
.access-note h2 { margin: 0; color: #705a29; }
.site-footer { flex-wrap: wrap; gap: 10px; padding: 13px 15px; border-top: 1px solid #abb0b4; background: #f4f4f4; color: #50585e; }
.footer-brand { display: flex; align-items: center; gap: 10px; }
.footer-brand img { filter: grayscale(1); opacity: .76; object-fit: contain; }
.footer-brand strong { font-size: .875rem; }
.footer-brand p { margin: 2px 0 0; font-size: .75rem; }
.footer-links { font-size: .75rem; }

@media (min-width: 681px) { html { scrollbar-gutter: stable both-edges; } }
@media (max-width: 940px) {
  .content-layout { grid-template-columns: minmax(0, 1fr) 210px; }
  .local-column { display: none; }
}
@media (max-width: 720px) {
  .content-layout { display: block; }
  .side-column { margin-top: 10px; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .primary-nav a { font-size: .8125rem; }
}
@media (max-width: 560px) {
  .site-header { position: relative; }
  .masthead { min-height: 49px; padding-inline: 10px; border-bottom: 3px solid var(--navy); }
  .brand { gap: 5px; }
  .brand img { width: 32px; height: 32px; }
  .brand strong { font-size: 1rem; }
  .brand small { font-size: .6rem; }
  .header-service { display: none; }
  .utility-bar { padding-inline: 9px; font-size: .75rem; }
  .utility-bar a + a, .utility-actions > :not(:first-child) { padding-left: 5px; margin-left: 5px; }
  .nav-toggle {
    display: inline-flex; align-items: center; gap: 5px; min-height: 33px; padding: 4px 8px;
    border: 1px solid #9fb6cb; background: #f0f5fa; color: var(--navy-dark); font-size: .8125rem; font-weight: bold;
  }
  .primary-nav { display: none; }
  .primary-nav.open { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 0; }
  .primary-nav a { min-height: 41px; border-bottom: 1px solid #ffffff30; }
  main { padding: 6px 8px 14px; }
  .page-heading h1 { font-size: 1.05rem; }
  .intro { margin: 0 8px; padding: 12px 0; gap: 9px; }
  .intro img { width: 46px; height: 46px; }
  .intro h2 { font-size: 1.15rem; }
  .intro p { font-size: .625rem; }
  .intro span { font-size: .8125rem; }



  .panel-body { padding: 7px; }
  .search-home .catalog-search { margin-inline: 7px; }
  .catalog-search { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .catalog-search > div:not(.catalog-query) { grid-column: span 2; }
  .catalog-search button { grid-column: span 3; }
  .catalog-search input, .catalog-search select { min-height: 36px; }
  .side-column { grid-template-columns: 1fr; }
  .spotlight-link { display: flex; align-items: center; gap: 9px; }
  .spotlight-link img { flex: none; width: 95px; }
  .site-footer { padding-inline: 9px; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
@media print {
  .site-header, .site-footer, .local-column, .catalog-search, .pagination { display: none !important; }
  body, .site-shell { width: 100%; border: 0; background: white; }
  .content-layout { display: block; }
}
/* Public record catalogue */
.results-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .4rem 1rem;
  padding: .75rem 0 .55rem;
  color: #515f67;
  font-size: .875rem;
}
.results-toolbar p { margin: 0; }
.results-toolbar p strong { color: #07577f; }
.results-toolbar label { display: inline-flex; align-items: center; gap: .4rem; }
.results-toolbar select {
  min-height: 2rem;
  border: 1px solid #aebdc6;
  border-radius: 0;
  padding-block: .2rem;
  padding-inline-start: .45rem;
  color: #243f50;
  font: inherit;
}
.record-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 12rem), 1fr));
  gap: .7rem;
}
.record-card {
  display: flex;
  min-width: 0;
  border: 1px solid #c4d0d8;
  background: #fff;
}
.card-open {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.record-card:where(:hover, :focus-within) { border-color: #407e9d; }
.card-open:hover h3, .card-open:focus-visible h3 { text-decoration: underline; text-underline-offset: .16em; }
.card-open:focus-visible, .folder-card:focus-visible, .recent-item:focus-visible, .timeline-node:focus-visible {
  outline: 2px solid #07577f;
  outline-offset: 1px;
  z-index: 1;
}
.card-preview {
  position: relative;
  display: grid;
  width: 100%;
  aspect-ratio: 1.9;
  place-items: center;
  overflow: hidden;
  border-bottom: 1px solid #becbd3;
  background: #e7eef1;
  color: #406276;
}
.card-preview img { display: block; width: 100%; height: 100%; object-fit: cover; }
.preview-photo img { object-position: center 30%; }
.preview-video, .preview-youtube {
  background: linear-gradient(145deg, #2e566a, #173c53);
  color: #fff;
}
.video-cover {
  display: flex;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .75rem .45rem .45rem;
  background:
    repeating-linear-gradient(90deg, #a4beca 0 .33rem, transparent .33rem .81rem)
      left .35rem top .19rem / calc(100% - .7rem) .19rem no-repeat,
    repeating-linear-gradient(90deg, #a4beca 0 .33rem, transparent .33rem .81rem)
      left .35rem bottom .19rem / calc(100% - .7rem) .19rem no-repeat,
    linear-gradient(to bottom, #254457 0 .57rem, transparent .57rem calc(100% - .57rem), #254457 calc(100% - .57rem)),
    linear-gradient(110deg, #466a7c, #36596c 62%, #2b4d60);
}
.video-cover::before, .video-cover::after {
  content: "";
  position: absolute;
  right: .65rem;
  left: .65rem;
  border-top: 1px solid #aac0cc55;
}
.video-cover::before { top: 1.55rem; }
.video-cover::after { bottom: 1rem; }
.video-glyph {
  color: #edb96c;
  font: .9rem/1 Arial, sans-serif;
}
.video-series {
  color: #fff;
  font-family: "Batang", "바탕", Georgia, serif;
  font-size: clamp(1rem, 2vw, 1.35rem);
  font-weight: 700;
  line-height: 1.25;
  text-wrap: balance;
}
.card-preview:has(.video-cover) .card-type { top: .66rem; left: .64rem; }
.type-glyph {
  display: grid;
  width: 2.65rem;
  height: 3rem;
  place-items: center;
  border: 1px solid currentColor;
  background: #f7fafb;
  font-family: Georgia, "Batang", serif;
  font-size: 1.35rem;
}
.preview-video .type-glyph, .preview-youtube .type-glyph {
  width: 2.5rem;
  height: 1.85rem;
  border-color: #a4b8c3;
  background: #21455a;
  font: 1rem/1 Arial, sans-serif;
}
.card-type, .card-lock {
  position: absolute;
  top: .38rem;
  padding: .08rem .38rem;
  background: #183e53ed;
  color: #fff;
  font-size: .75rem;
  font-weight: 700;
  line-height: 1.55;
}
.card-type { left: .38rem; }
.card-lock { right: .38rem; background: #824b21; }
.card-copy { display: block; padding: .55rem .65rem .65rem; }
.card-copy .record-accession, .recent-copy .record-accession {
  color: #566e7b;
  font: .75rem/1.5 Consolas, "Liberation Mono", monospace;
  font-variant-numeric: tabular-nums;
}
.card-copy h3, .card-copy p {
  display: -webkit-box;
  overflow: hidden;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.card-copy h3 {
  margin: .12rem 0 .28rem;
  color: #183d54;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.45;
  word-break: keep-all;
}
.card-copy p { margin: 0; color: #58656d; font-size: .875rem; line-height: 1.45; }
.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .22rem .35rem;
  margin-top: auto;
  padding: .4rem .58rem;
  width: 100%;
  border-top: 1px solid #dce4e8;
  background: #f6f8fa;
  color: #52616c;
  font-size: .75rem;
  line-height: 1.45;
}
.card-meta .access-chip { border: 1px solid #c1d7e2; padding: 0 .3rem; background: #edf5f9; color: #205571; }
.card-meta .access-chip.restricted { border-color: #dfc9ad; background: #fff7ea; color: #7b4b12; }
.record-skeleton {
  min-height: 13rem;
  border: 1px solid #c4d0d8;
  background: linear-gradient(#e5ecf0 47%, #fff 47%);
}
.empty-panel {
  grid-column: 1 / -1;
  flex: 1;
  padding: 2rem 1rem;
  border: 1px solid #cad5dc;
  background: #f7f9fa;
  color: #4d606c;
  font-size: .9375rem;
  line-height: 1.55;
  text-align: center;
}
.empty-panel.compact { padding: 1.1rem .8rem; }
.empty-panel button { margin-top: .75rem; }
.pagination {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: .25rem;
  margin-top: .85rem;
}
.pagination:empty { display: none; }
.pagination button {
  min-width: 2rem;
  min-height: 2rem;
  border: 1px solid #bac9d2;
  border-radius: 0;
  padding: .2rem .55rem;
  background: #fff;
  color: #334f60;
  font: inherit;
  font-size: .875rem;
  cursor: pointer;
}
.pagination button:hover:enabled:not([aria-current]) { border-color: #4384a4; background: #eaf4f9; }
.pagination button[aria-current="page"] { border-color: #125c82; background: #17688f; color: #fff; font-weight: 700; }
.pagination button:disabled { border-color: #dbe1e4; background: #f4f6f7; color: #79858c; cursor: default; }

/* The lower archive indexes use compact rows like the portal's service lists. */
.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
  gap: .45rem;
}
.folder-card, .recent-item, .timeline-node {
  border-radius: 0;
  color: #29485b;
  font: inherit;
  text-align: start;
  cursor: pointer;
}
.folder-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: .5rem;
  align-items: center;
  min-height: 3.05rem;
  padding: .5rem .6rem;
  border: 1px solid #cad5dc;
  background: linear-gradient(#fff, #f6f8f9);
}
.folder-card::before {
  content: "";
  width: 1.25rem;
  height: .9rem;
  background: #cb8b33;
  clip-path: polygon(0 0, 40% 0, 52% 20%, 100% 20%, 100% 100%, 0 100%);
}
.folder-card h3 { margin: 0; color: #22475b; font-size: .9375rem; line-height: 1.4; overflow-wrap: anywhere; }
.folder-card p { display: none; }
.folder-card strong { color: #205e83; font-size: .9375rem; white-space: nowrap; }
.folder-card strong small { margin-inline-start: .12rem; color: #586a75; font-size: .75rem; font-weight: 400; }
.folder-card:hover, .timeline-node:hover { border-color: #6d9fb7; background: #eff7fb; }
.recent-list { display: grid; border-top: 1px solid #a7bfcf; }
.recent-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  column-gap: .75rem;
  padding: .55rem .55rem;
  min-height: 2.85rem;
  border: 0;
  border-bottom: 1px solid #dce3e7;
  background: #fff;
}
.recent-item:hover { background: #f0f7fb; }
.recent-date {
  grid-column: 2;
  grid-row: 1;
  color: #536b7b;
  font-size: .8125rem;
  font-variant-numeric: tabular-nums;
}
.recent-copy { grid-column: 1; grid-row: 1; min-width: 0; }
.recent-copy .record-accession { display: inline-block; margin-inline-end: .5rem; }
.recent-copy h3 { display: inline; margin: 0; font-size: .9375rem; font-weight: 600; line-height: 1.45; overflow-wrap: anywhere; }
.recent-copy p { margin: .06rem 0 0; color: #5a6b77; font-size: .8125rem; line-height: 1.35; }
.recent-arrow { display: none; }
.timeline-track { display: flex; flex-wrap: wrap; gap: .4rem; }
.timeline-node {
  flex: 1 1 6.4rem;
  display: grid;
  gap: .26rem;
  padding: .65rem .7rem;
  border: 1px solid #bfd0db;
  border-top: 3px solid #4381a1;
  background: #f7fafb;
}
.timeline-node strong { color: #14597f; font-size: 1.1rem; line-height: 1.15; font-variant-numeric: tabular-nums; }
.timeline-node small { color: #536878; font-size: .8125rem; }
.timeline-node b { color: #314d5e; font-size: .875rem; }
.timeline-dot { display: none; }

@media (max-width: 36rem) {
  .record-grid { gap: .55rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-copy { padding-inline: .48rem; }
  .card-meta { padding-inline: .45rem; }
  .folder-grid { grid-template-columns: 1fr; }
  .recent-copy .record-accession { display: block; }
}
@media (max-width: 24rem) {
  .record-grid { grid-template-columns: 1fr; }
}
/* Record detail, administration and registration use the portal's form palette. */
body:is(.drawer-open, .dialog-open) {
  overflow: hidden;
}

.record-dialog {
  width: min(54rem, calc(100% - 2rem));
  max-width: none;
  max-height: calc(100dvh - 2rem);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid #385e7f;
  background: #fff;
  color: #344758;
  box-shadow: 0 12px 40px #152e4640;
  overscroll-behavior: contain;
}

.record-dialog::backdrop,
.drawer-backdrop {
  background: rgb(22 40 59 / 58%);
}

.dialog-topbar,
.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .5rem .65rem .5rem 1rem;
  border-bottom: 1px solid #154368;
  background: linear-gradient(#286a9f, #174f80);
  color: white;
  font-weight: bold;
}

.dialog-topbar {
  position: sticky;
  z-index: 1;
  top: 0;
}

.dialog-close {
  display: grid;
  width: 2.1rem;
  height: 2.1rem;
  place-content: center;
  padding: 0;
  border: 1px solid #8cafca;
  background: #194e78;
  color: white;
  font: 1.5rem/1 Arial, sans-serif;
  cursor: pointer;
}

.dialog-close:hover {
  background: #103959;
}

.dialog-loading,
#admin-app .table-empty,
.overview-grid > .empty-panel {
  padding: 2rem 1rem;
  color: #506072;
  text-align: center;
}

.dialog-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .7rem 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #cdd5e2;
  background: #f5f7fb;
}

.dialog-heading h2,
.gate-card h1,
.admin-heading h1 {
  margin: 0;
  color: #204c73;
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.dialog-heading .record-accession,
.table-record small {
  display: block;
  margin: 0 0 .2rem;
  color: #376582;
  font: .8125rem/1.4 Tahoma, Arial, sans-serif;
  overflow-wrap: anywhere;
}

.dialog-badges {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
}

.dialog-badges .badge,
.table-badge {
  display: inline-block;
  padding: .15rem .45rem;
  border: 1px solid #b5c6d8;
  background: #f2f6fb;
  color: #315c80;
  font-size: .8125rem;
  line-height: 1.5;
  white-space: nowrap;
}

:is(.dialog-badges .badge, .table-badge).restricted {
  border-color: #d6bd87;
  background: #fffae9;
  color: #78551a;
}

:is(.dialog-badges .badge, .table-badge).admin {
  border-color: #cda6a3;
  background: #fff3f1;
  color: #8a3831;
}

.viewer-wrap {
  display: grid;
  place-items: center;
  min-height: 10rem;
  border-bottom: 1px solid #cdd5e2;
  background: #edf2f6;
}

.viewer-wrap :is(img, video) {
  display: block;
  max-width: 100%;
  max-height: 66dvh;
  object-fit: contain;
}

.viewer-wrap video,
.viewer-wrap iframe {
  width: 100%;
}

.viewer-wrap iframe {
  height: min(62dvh, 34rem);
  border: 0;
  background: white;
}

.viewer-wrap iframe[src*="youtube"] {
  height: auto;
  aspect-ratio: 16 / 9;
}

.viewer-wrap audio {
  width: min(90%, 32rem);
}

.viewer-placeholder {
  max-width: 34rem;
  padding: 1.75rem 1rem;
  color: #526372;
  text-align: center;
}

.viewer-placeholder .type-glyph,
.gate-mark {
  display: inline-grid;
  width: 2.5rem;
  height: 2.5rem;
  place-items: center;
  border: 1px solid #9bb1c7;
  background: #fff;
  color: #245f96;
  font: bold 1.25rem/1 serif;
}

.viewer-placeholder h3 {
  margin: .55rem 0 .25rem;
  color: #2e506e;
}

.viewer-placeholder p,
.record-description p {
  margin: 0;
}

.viewer-placeholder a {
  margin-top: .7rem;
}

.dialog-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(15rem, .8fr);
  gap: 1rem;
  padding: 1rem;
}

.dialog-body h3 {
  margin: 0 0 .7rem;
  padding: .45rem .65rem;
  border-top: 2px solid #245f96;
  border-bottom: 1px solid #bfd1e0;
  background: #e4e9f8;
  color: #39578e;
  font-size: 1rem;
}

.record-description p {
  padding: 0 .4rem;
  line-height: 1.7;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.metadata-panel dl {
  margin: 0;
  border-top: 1px solid #cdd5e2;
}

.metadata-panel dl > div {
  display: grid;
  grid-template-columns: 5.25rem minmax(0, 1fr);
  border-bottom: 1px solid #d9dfeb;
  font-size: .875rem;
}

.metadata-panel :is(dt, dd) {
  margin: 0;
  padding: .4rem .55rem;
  overflow-wrap: anywhere;
}

.metadata-panel dt {
  border-right: 1px solid #d9dfeb;
  background: #f2f5fa;
  font-weight: bold;
}

.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .75rem 1rem;
  border-top: 1px solid #cdd5e2;
  background: #f5f7fb;
}

.dialog-actions p {
  margin: 0;
  color: #485a6d;
  font-size: .875rem;
}

.dialog-actions .primary-button {
  flex: none;
}

/* Administration */
.admin-gate {
  display: grid;
  min-height: min(32rem, 75dvh);
  place-items: center;
  padding: 2rem .75rem;
}

.gate-card {
  width: min(100%, 27rem);
  padding: 1.75rem;
  border: 1px solid #bfccda;
  border-top: 3px solid #245f96;
  background: linear-gradient(#f5f7fc, white 7rem);
  text-align: center;
}

.gate-card .section-kicker,
.admin-heading .eyebrow {
  margin: .7rem 0 .2rem;
  color: #476784;
  font-size: .8125rem;
  font-weight: bold;
}

.gate-card > p:not(.section-kicker) {
  margin: .65rem 0 1rem;
  color: #526270;
}

.gate-card .text-link {
  display: block;
  width: fit-content;
  margin: .75rem auto 0;
  color: #245f96;
}

.admin-shell {
  padding: .25rem .75rem 1.5rem;
}

.admin-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  padding: .75rem .25rem;
  border-bottom: 1px solid #59a6b3;
}

.admin-heading .eyebrow {
  margin-top: 0;
}

.admin-heading p:last-child {
  margin: .2rem 0 0;
  color: #526270;
}

.admin-content {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
}

.admin-content > section {
  min-width: 0;
  border: 1px solid #cdd5e2;
  background: white;
}

.admin-section-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  min-height: 2.65rem;
  padding: .4rem .75rem;
  border-top: 2px solid #245f96;
  border-bottom: 1px solid #c4cfdd;
  background: #e4e9f8;
}

.admin-section-title > div {
  display: flex;
  align-items: baseline;
  gap: .65rem;
}

.admin-section-title span {
  color: #546b83;
  font-size: .8125rem;
}

.admin-section-title h2 {
  margin: 0;
  color: #39578e;
  font-size: 1rem;
}

.admin-gate .text-link:hover,
.grant-list button:hover {
  text-decoration: underline;
}

.admin-section-title .icon-button,
.admin-search button,
.edit-button {
  min-height: 2rem;
  padding: .25rem .7rem;
  border: 1px solid #97adc1;
  background: linear-gradient(white, #e4eaf3);
  color: #214c70;
  font-weight: bold;
  cursor: pointer;
}

.admin-section-title .icon-button {
  min-width: 2rem;
  font-size: 1.125rem;
}

.admin-section-title .icon-button:not(:disabled):hover,
.admin-search button:hover,
.edit-button:hover {
  background: #d8e4f2;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.overview-grid article {
  display: grid;
  gap: .15rem;
  padding: .75rem 1rem;
  border-inline-end: 1px solid #d9dfeb;
}

.overview-grid article:last-child {
  border-inline-end: 0;
}

.overview-grid strong {
  color: #245f96;
  font: bold 1.55rem/1.3 Tahoma, Arial, sans-serif;
}

.overview-grid :is(small, span) {
  color: #526372;
  font-size: .8125rem;
}

.overview-grid .empty-panel {
  grid-column: 1 / -1;
}

.admin-search,
.grant-form {
  display: flex;
  gap: .35rem;
  max-width: 100%;
}

.admin-search input {
  width: min(15rem, 100%);
}

.admin-search button,
.grant-form button {
  flex: none;
}

.table-wrap {
  max-width: 100%;
  overflow-x: auto;
}

.admin-records table {
  width: 100%;
  min-width: 42rem;
  border-collapse: collapse;
  font-size: .875rem;
}

.admin-records :is(th, td) {
  padding: .55rem .7rem;
  border-bottom: 1px solid #d9dfeb;
  text-align: left;
  vertical-align: middle;
}

.admin-records th {
  background: #f2f5fa;
  color: #405a73;
  white-space: nowrap;
}

.admin-records tbody tr:hover {
  background: #f7f9fc;
}

.table-record {
  max-width: 24rem;
  overflow-wrap: anywhere;
}

.table-record strong {
  color: #334e66;
}

.audit-item {
  display: grid;
  grid-template-columns: minmax(7rem, .7fr) minmax(9rem, 1fr) minmax(0, 2fr);
  gap: .65rem;
  padding: .65rem .85rem;
  border-bottom: 1px solid #d9dfeb;
  color: #435668;
  font-size: .875rem;
  overflow-wrap: anywhere;
}

.audit-item time {
  color: #546b80;
  font-variant-numeric: tabular-nums;
}

.audit-item:last-child {
  border-bottom: 0;
}

/* The closed registration drawer must also be absent from keyboard navigation. */
.drawer-backdrop {
  position: fixed;
  z-index: 250;
  inset: 0;
}

.record-drawer {
  position: fixed;
  z-index: 260;
  inset: 0 0 0 auto;
  display: flex;
  flex-direction: column;
  width: min(39rem, 100%);
  visibility: hidden;
  border-left: 1px solid #8ea5ba;
  background: #fff;
  box-shadow: -6px 0 28px #17334e33;
  transform: translateX(100%);
  transition: transform .2s ease, visibility 0s .2s;
}

.record-drawer.open {
  visibility: visible;
  transform: translateX(0);
  transition-delay: 0s;
}

.drawer-header > div > p {
  margin: 0;
  font: bold .75rem/1.35 Arial, sans-serif;
}

.drawer-header h2 {
  margin: .1rem 0 0;
  font-size: 1.25rem;
}

.record-form {
  flex: 1;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
}

.record-form fieldset {
  min-width: 0;
  margin: 1rem;
  padding: .8rem;
  border: 1px solid #cdd5e2;
}

.record-form legend {
  padding: 0 .4rem;
  color: #245f96;
  font-size: 1rem;
  font-weight: bold;
}

.record-form legend span,
.record-form label em {
  font-size: .8125rem;
  font-style: normal;
}

.record-form label em {
  color: #a03d28;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .75rem;
}

.form-grid label {
  display: block;
  min-width: 0;
  color: #344d65;
  font-weight: bold;
}

.form-grid label :is(input:not([type=checkbox]), select, textarea) {
  display: block;
  width: 100%;
  margin-top: .3rem;
  color: #344758;
  font-weight: normal;
}

.form-grid .full,
.form-grid .checkbox-label {
  grid-column: 1 / -1;
}

.form-grid .checkbox-label {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.checkbox-label input {
  width: 1.1rem;
  min-height: 1.1rem;
  accent-color: #245f96;
}

.policy-warning {
  margin-top: .75rem;
  padding: .55rem .7rem;
  border: 1px solid #dacc9d;
  background: #fffbeb;
  color: #6d581e;
  font-size: .875rem;
}

.policy-warning p {
  margin: .2rem 0 0;
}

.fieldset-help,
.file-label > span {
  display: block;
  margin: .35rem 0;
  color: #526575;
  font-size: .8125rem;
  font-weight: normal;
  overflow-wrap: anywhere;
}

.grant-form input {
  flex: 1;
  min-width: 0;
}

.grant-list {
  display: grid;
  gap: .25rem;
  margin: .75rem 0 0;
  padding: 0;
  list-style: none;
}

.grant-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  padding: .3rem .55rem;
  background: #f2f5fa;
}

.grant-list code {
  color: #2a5477;
  overflow-wrap: anywhere;
}

.grant-list button,
.drawer-actions .danger-button {
  padding: .35rem .55rem;
  border: 1px solid #cba7a3;
  background: #fff8f7;
  color: #963e35;
  cursor: pointer;
}

.drawer-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: .4rem;
  padding: .6rem .9rem max(.6rem, env(safe-area-inset-bottom));
  border-top: 1px solid #b9c9da;
  background: #eef2fa;
}

#save-status {
  flex: 1;
  min-width: 0;
  color: #3e556a;
  font-size: .8125rem;
  overflow-wrap: anywhere;
}

.toast-region {
  position: fixed;
  z-index: 400;
  inset: auto max(1rem, env(safe-area-inset-right)) max(1rem, env(safe-area-inset-bottom)) auto;
  display: grid;
  width: min(23rem, calc(100% - 2rem));
  gap: .4rem;
  pointer-events: none;
}

.toast {
  padding: .7rem .9rem;
  border: 1px solid #153e68;
  border-left: 4px solid #61b9c6;
  background: #214f79;
  color: white;
  box-shadow: 0 2px 8px #183b5830;
  overflow-wrap: anywhere;
}

.toast.error {
  border-color: #974940;
  border-left-color: #ffb3a0;
  background: #7b3d39;
}

@media (max-width: 40rem) {
  .record-dialog {
    width: calc(100% - 1rem);
    max-height: calc(100dvh - 1rem);
  }
  .dialog-body {
    grid-template-columns: minmax(0, 1fr);
  }
  .dialog-heading,
  .dialog-actions {
    align-items: flex-start;
    flex-direction: column;
  }
  .overview-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .overview-grid article:nth-child(2n) {
    border-right: 0;
  }
  .overview-grid article:nth-child(n + 3) {
    border-top: 1px solid #d9dfeb;
  }
  .audit-item {
    grid-template-columns: minmax(0, 1fr);
    gap: .15rem;
  }
  .admin-search {
    width: 100%;
  }
  .admin-search input {
    flex: 1;
    min-width: 0;
  }
}

@media (max-width: 28rem) {
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .record-form fieldset {
    margin: .75rem;
    padding: .6rem;
  }
  #save-status:not(:empty) {
    flex-basis: 100%;
  }
  .gate-card {
    padding: 1.2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .record-drawer {
    transition: none;
  }
}
