/* =========================================================================
   Museum Collection Management & Digital Asset Workflow Automation
   Design tokens + global styles. Light, elegant, professional palette.
   ========================================================================= */

:root {
  /* Palette */
  --bg: #fbfaf7;            /* warm paper white */
  --surface: #ffffff;
  --surface-alt: #f4f2ec;
  --text: #1f2233;
  --muted: #5b5f73;
  --primary: #4338ca;      /* indigo */
  --primary-deep: #2f2a6b;
  --primary-soft: #eceafe;
  --accent: #e0992f;       /* warm gold */
  --accent-soft: #f6c453;
  --accent-tint: #fcf3df;
  --teal: #0f9d8f;
  --rose: #d6536d;
  --success: #2f9e6b;
  --border: #e7e3d8;
  --border-strong: #d8d3c5;

  /* Code */
  --code-bg: #f7f6fc;
  --code-border: #e7e4f5;
  --inline-code-bg: #efeef8;
  --inline-code-text: #4b3f8f;

  /* Shape & depth */
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(31, 34, 51, .06), 0 2px 8px rgba(31, 34, 51, .05);
  --shadow: 0 6px 22px rgba(47, 42, 107, .10);
  --shadow-lg: 0 18px 48px rgba(47, 42, 107, .16);

  /* Layout */
  --header-h: 68px;
  --container: min(1440px, 94vw);
  --prose: min(1180px, 92vw);

  /* Type */
  --font-sans: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", "Georgia", serif;
  --font-mono: "SFMono-Regular", "JetBrains Mono", "Cascadia Code", "Consolas", ui-monospace, monospace;

  --step-0: clamp(1rem, 0.95rem + 0.25vw, 1.125rem);
  --step-1: clamp(1.2rem, 1.1rem + 0.5vw, 1.4rem);
  --step-2: clamp(1.45rem, 1.3rem + 0.8vw, 1.8rem);
  --step-3: clamp(1.8rem, 1.5rem + 1.4vw, 2.4rem);
  --step-4: clamp(2.2rem, 1.7rem + 2.6vw, 3.4rem);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 16px); /* in-page links clear sticky header */
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;       /* sticky footer */
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.site-main { flex: 1 0 auto; width: 100%; }

a {
  color: var(--primary);
  text-decoration: none;
  transition: color .18s ease, background-color .18s ease;
}
a:hover { color: var(--accent); }

img, svg { max-width: 100%; }

:focus-visible {
  outline: 3px solid var(--accent-soft);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--primary);
  color: #fff;
  padding: .6rem 1rem;
  border-radius: 0 0 var(--radius-sm) 0;
  z-index: 1000;
}
.skip-link:focus { left: 0; }

.wrap { width: var(--container); margin-inline: auto; }

/* =========================================================================
   Header
   ========================================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(251, 250, 247, .85);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header__inner {
  width: var(--container);
  margin-inline: auto;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 700;
  color: var(--primary-deep);
  letter-spacing: -0.01em;
}
.brand:hover { color: var(--primary-deep); }
.brand svg { width: 38px; height: 38px; flex: none; transition: transform .25s ease; }
.brand:hover svg { transform: rotate(-4deg) scale(1.06); }
.brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.brand__name { font-size: 1.02rem; }
.brand__tag { font-size: .68rem; font-weight: 600; color: var(--accent); text-transform: uppercase; letter-spacing: .08em; }

.nav-toggle {
  display: none;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: .5rem .7rem;
  cursor: pointer;
  color: var(--primary-deep);
  font-size: 1.1rem;
}

.site-nav ul {
  list-style: none;
  display: flex;
  gap: .35rem;
  margin: 0; padding: 0;
}
.site-nav a {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .5rem .85rem;
  border-radius: 999px;
  color: var(--text);
  font-weight: 600;
  font-size: .95rem;
}
.site-nav a svg { width: 18px; height: 18px; }
.site-nav a:hover { background: var(--primary-soft); color: var(--primary-deep); }
.site-nav a[aria-current="page"] {
  background: var(--primary);
  color: #fff;
}
.site-nav a[aria-current="page"] svg { color: var(--accent-soft); }

/* =========================================================================
   Footer
   ========================================================================= */
.site-footer {
  flex-shrink: 0;
  margin-top: 4rem;
  background: var(--primary-deep);
  color: #d9d7ef;
}
.site-footer a { color: #cfd0f4; }
.site-footer a:hover { color: var(--accent-soft); }
.site-footer__inner {
  width: var(--container);
  margin-inline: auto;
  padding: 2.6rem 0 2rem;
  display: grid;
  grid-template-columns: 1.4fr repeat(3, 1fr);
  gap: 2rem;
}
.site-footer h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent-soft); margin: 0 0 .8rem; }
.site-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.footer-brand { display: flex; gap: .7rem; align-items: flex-start; }
.footer-brand svg { width: 44px; height: 44px; flex: none; }
.footer-brand p { margin: .4rem 0 0; font-size: .9rem; color: #b9b8dd; max-width: 34ch; }
.site-footer__bottom {
  border-top: 1px solid rgba(255,255,255,.12);
  width: var(--container);
  margin-inline: auto;
  padding: 1rem 0 2rem;
  font-size: .82rem;
  color: #a7a6cf;
}

/* =========================================================================
   Hero / Home
   ========================================================================= */
.hero { width: var(--container); margin-inline: auto; padding: 3.4rem 0 1rem; text-align: center; }
.hero__logo { display: block; margin: 0 auto 1.6rem; width: clamp(120px, 22vw, 190px); height: auto; }
.hero__logo svg { width: 100%; height: auto; filter: drop-shadow(0 12px 26px rgba(47,42,107,.18)); transition: transform .4s ease; }
.hero__logo:hover svg { transform: translateY(-4px) scale(1.02); }
.hero h1 {
  font-family: var(--font-serif);
  font-size: var(--step-4);
  line-height: 1.08;
  margin: 0 0 1rem;
  background: linear-gradient(120deg, var(--primary-deep), var(--primary) 55%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero__lead { font-size: var(--step-1); color: var(--muted); max-width: 60ch; margin: 0 auto 2rem; }

.cta-row { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: center; margin-bottom: 1rem; }
.cta {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  padding: .85rem 1.4rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
  color: var(--primary-deep);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.cta:hover { transform: translateY(-3px); box-shadow: var(--shadow); color: var(--primary-deep); border-color: var(--accent-soft); }
.cta__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: #fff; flex: none; }
.cta__icon svg { width: 22px; height: 22px; }
.cta--core .cta__icon { background: linear-gradient(135deg, #4338ca, #6d5ef0); }
.cta--ingest .cta__icon { background: linear-gradient(135deg, #0f9d8f, #19c4a6); }
.cta--rights .cta__icon { background: linear-gradient(135deg, #e0992f, #f6c453); }

.prose-intro { width: var(--prose); margin: 2.4rem auto; }
.prose-intro p { font-size: var(--step-0); color: var(--text); }

/* Section cards */
.section-cards {
  width: var(--container);
  margin: 2rem auto 1rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1.4rem;
}
.s-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.6rem;
  box-shadow: var(--shadow-sm);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
  display: flex;
  flex-direction: column;
}
.s-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--accent-soft); }
.s-card__icon { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; color: #fff; margin-bottom: 1rem; }
.s-card__icon svg { width: 28px; height: 28px; }
.s-card--core .s-card__icon { background: linear-gradient(135deg, #4338ca, #6d5ef0); }
.s-card--ingest .s-card__icon { background: linear-gradient(135deg, #0f9d8f, #19c4a6); }
.s-card--rights .s-card__icon { background: linear-gradient(135deg, #e0992f, #f6c453); }
.s-card h3 { margin: 0 0 .5rem; font-size: var(--step-1); color: var(--primary-deep); }
.s-card p { margin: 0 0 1rem; color: var(--muted); }
.s-card ul { list-style: none; margin: 0 0 1.1rem; padding: 0; display: grid; gap: .4rem; }
.s-card ul a { font-weight: 600; display: inline-flex; align-items: center; gap: .4rem; }
.s-card ul a::before { content: "→"; color: var(--accent); transition: transform .18s ease; }
.s-card ul a:hover::before { transform: translateX(3px); }
.s-card__more { margin-top: auto; font-weight: 700; }

/* =========================================================================
   Article / content pages
   ========================================================================= */
.page-shell { width: var(--container); margin-inline: auto; padding: 1.6rem 0 1rem; }

.breadcrumbs { font-size: .85rem; color: var(--muted); margin: .5rem 0 1.4rem; }
.breadcrumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: .35rem; margin: 0; padding: 0; }
.breadcrumbs li { display: inline-flex; align-items: center; gap: .35rem; }
.breadcrumbs li + li::before { content: "/"; color: var(--border-strong); margin-right: .35rem; }
.breadcrumbs a { font-weight: 600; }
.breadcrumbs [aria-current="page"] { color: var(--text); }

.article { width: 100%; }
.page-title {
  font-family: var(--font-serif);
  font-size: var(--step-3);
  line-height: 1.12;
  margin: 0 0 1.4rem;
  background: linear-gradient(120deg, var(--primary-deep), var(--primary) 60%, var(--accent));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.article-body { font-size: var(--step-0); }
.article-body > * { max-width: 100%; }

.article-body h2 {
  font-size: var(--step-2);
  margin: 2.4rem 0 .8rem;
  padding-bottom: .35rem;
  color: var(--primary-deep);
  border-bottom: 2px solid var(--accent-tint);
}
.article-body h3 { font-size: var(--step-1); margin: 1.8rem 0 .6rem; color: var(--primary); }
.article-body h4 { font-size: 1.1rem; margin: 1.4rem 0 .5rem; color: var(--primary-deep); }
.article-body h2, .article-body h3, .article-body h4 { scroll-margin-top: calc(var(--header-h) + 18px); }

.article-body p { margin: 0 0 1.15rem; }
.article-body ul, .article-body ol { margin: 0 0 1.2rem; padding-left: 1.3rem; }
.article-body li { margin: .3rem 0; }
.article-body li::marker { color: var(--accent); }

.article-body a {
  font-weight: 600;
  background-image: linear-gradient(var(--accent-soft), var(--accent-soft));
  background-size: 0% 2px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size .25s ease, color .2s ease;
  padding-bottom: 1px;
}
.article-body a:hover { background-size: 100% 2px; }

.header-anchor {
  text-decoration: none;
  color: var(--border-strong);
  margin-left: .4rem;
  opacity: 0;
  transition: opacity .15s ease;
  background: none;
}
h2:hover .header-anchor, h3:hover .header-anchor, h4:hover .header-anchor { opacity: 1; }

blockquote {
  margin: 1.4rem 0;
  padding: .6rem 1.2rem;
  border-left: 4px solid var(--accent);
  background: var(--accent-tint);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--primary-deep);
}

hr { border: none; border-top: 1px solid var(--border); margin: 2.4rem 0; }

/* Inline code — subtle, no border, blends in */
:not(pre) > code {
  font-family: var(--font-mono);
  font-size: .9em;
  background: var(--inline-code-bg);
  color: var(--inline-code-text);
  padding: .12em .4em;
  border-radius: 6px;
  border: none;
}

/* Tables — responsive horizontal scroll + styling */
.article-body table {
  border-collapse: collapse;
  width: 100%;
  margin: 0;
  font-size: .95rem;
}
.table-scroll {
  overflow-x: auto;
  margin: 1.5rem 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  -webkit-overflow-scrolling: touch;
}
.article-body th, .article-body td { padding: .7rem 1rem; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.article-body thead th { background: var(--primary-soft); color: var(--primary-deep); font-weight: 700; }
.article-body tbody tr:nth-child(even) { background: var(--surface-alt); }
.article-body tbody tr:hover { background: var(--accent-tint); }

/* Task-list checkboxes */
.article-body li.task-list-item {
  list-style: none;
  margin-left: -1.3rem;
  display: flex;
  align-items: flex-start;
  gap: .6rem;
}
.article-body li.task-list-item::marker { content: ""; }
.task-checkbox {
  appearance: none;
  -webkit-appearance: none;
  width: 1.2em; height: 1.2em;
  margin-top: .2em;
  border: 2px solid var(--border-strong);
  border-radius: 5px;
  background: var(--surface);
  cursor: pointer;
  flex: none;
  display: grid;
  place-content: center;
  transition: background .15s ease, border-color .15s ease;
}
.task-checkbox::before {
  content: "";
  width: .65em; height: .65em;
  transform: scale(0);
  transition: transform .15s ease;
  box-shadow: inset 1em 1em var(--success);
  clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0, 43% 62%);
}
.task-checkbox:checked { border-color: var(--success); }
.task-checkbox:checked::before { transform: scale(1); }
.task-list-item.is-checked { color: var(--muted); text-decoration: line-through; }

/* Code blocks */
.code-block {
  margin: 1.6rem 0;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.code-block__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .45rem .55rem .45rem 1rem;
  background: #efeefa;
  border-bottom: 1px solid var(--code-border);
}
.code-block__lang {
  font-family: var(--font-mono);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--primary);
  font-weight: 700;
}
.copy-btn {
  border: 1px solid var(--code-border);
  background: var(--surface);
  color: var(--primary-deep);
  font-size: .76rem;
  font-weight: 700;
  padding: .3rem .7rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, transform .12s ease;
}
.copy-btn:hover { background: var(--primary); color: #fff; }
.copy-btn.is-copied { background: var(--success); color: #fff; border-color: var(--success); }
.code-pre {
  margin: 0;
  padding: 1.1rem 1.2rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: .86rem;
  line-height: 1.6;
  -webkit-overflow-scrolling: touch;
}
.code-pre code { font-family: inherit; background: none; padding: 0; color: var(--text); }

/* Mermaid */
.mermaid-wrap {
  position: relative;
  margin: 1.6rem 0;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.2rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, border-color .2s ease;
}
.mermaid-wrap .mermaid { background: none; border: none; padding: 0; }
.mermaid-wrap.is-enlargeable { cursor: zoom-in; }
.mermaid-wrap.is-enlargeable:hover,
.mermaid-wrap.is-enlargeable:focus-visible { border-color: var(--accent-soft); box-shadow: var(--shadow); }
/* "Click to enlarge" affordance, shown once the SVG has rendered */
.mermaid-wrap.is-enlargeable::after {
  content: "⤢ Click to enlarge";
  position: absolute;
  top: .6rem;
  right: .6rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .02em;
  color: var(--primary-deep);
  background: var(--primary-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: .25rem .6rem;
  opacity: 0;
  transition: opacity .2s ease;
  pointer-events: none;
}
.mermaid-wrap.is-enlargeable:hover::after,
.mermaid-wrap.is-enlargeable:focus-visible::after { opacity: 1; }

/* Full-screen diagram lightbox */
body.viz-modal-open { overflow: hidden; }
.viz-modal[hidden] { display: none; }
.viz-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: clamp(1rem, 4vw, 3rem);
}
.viz-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 18, 48, .82);
  backdrop-filter: blur(3px);
}
.viz-modal__content {
  position: relative;
  z-index: 1;
  width: min(96vw, 1600px);
  height: min(90vh, 1000px);
  display: grid;
  place-items: center;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: clamp(1rem, 3vw, 2.4rem);
  overflow: auto;
  animation: viz-pop .2s ease;
}
.viz-modal__content svg { width: auto; height: auto; max-width: 100%; max-height: 100%; }
.viz-modal__close {
  position: absolute;
  top: clamp(.6rem, 2vw, 1.4rem);
  right: clamp(.6rem, 2vw, 1.4rem);
  z-index: 2;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--surface);
  color: var(--primary-deep);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background .15s ease, color .15s ease, transform .15s ease;
}
.viz-modal__close:hover { background: var(--primary); color: #fff; transform: scale(1.06); }
@keyframes viz-pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Related content */
.related {
  margin-top: 3rem;
  border-top: 1px solid var(--border);
  padding-top: 1.6rem;
}
.related h2 { font-size: var(--step-1); color: var(--primary-deep); margin: 0 0 1rem; }
.related-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem; }
.related-card {
  display: block;
  padding: 1rem 1.2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
  color: var(--primary-deep);
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.related-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--accent-soft); color: var(--primary-deep); }
.related-card span { display: block; font-weight: 500; font-size: .85rem; color: var(--muted); margin-top: .25rem; }

/* FAQ accordions */
.faq-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  margin: .8rem 0;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.faq-item > summary {
  cursor: pointer;
  list-style: none;
  padding: 1rem 1.2rem;
  font-weight: 700;
  color: var(--primary-deep);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary::after { content: "+"; font-size: 1.4rem; color: var(--accent); transition: transform .2s ease; }
.faq-item[open] > summary::after { transform: rotate(45deg); }
.faq-item > summary:hover { background: var(--primary-soft); }
.faq-body { padding: 0 1.2rem 1.1rem; color: var(--text); }

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 820px) {
  .nav-toggle { display: inline-block; }
  .site-nav {
    position: absolute;
    top: var(--header-h);
    left: 0; right: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow);
    display: none;
    padding: .8rem 0;
  }
  .site-nav.is-open { display: block; }
  .site-nav ul { flex-direction: column; width: var(--container); margin-inline: auto; gap: .25rem; }
  .site-nav a { width: 100%; }
  .brand__tag { display: none; }
  .site-footer__inner { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .site-footer__inner { grid-template-columns: 1fr; }
  .hero { padding-top: 2rem; }
}

@media (min-width: 1600px) {
  :root { --container: min(1560px, 90vw); --prose: min(1280px, 86vw); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
