:root {
  color-scheme: light;
  --page: #e8e1d3;
  --panel: #F3EFE6;
  --paper: #fffaf0;
  --paper-warm: #f7f2e8;
  --ink: #243B4A;
  --muted: #5f594f;
  --accent: #1E66D0;
  --border: #D8CDBB;
  --soft-border: #D8CDBB;
  --shadow: 0 4px 6px rgba(67, 55, 39, 0.05);
  font-family: Georgia, "Times New Roman", serif;
  color: var(--ink);
  background: var(--page);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
}

body::before,
body::after { content:none; }
body::before { width:330px; height:225px; right:-70px; top:16%; border:7px solid #d9ecfa; border-radius:13px; transform:rotate(6deg); box-shadow:inset 0 0 0 13px transparent,inset 0 0 0 16px #d9ecfa; }
body::after { width:400px; height:88px; left:-105px; bottom:8%; border-radius:50%; background:linear-gradient(171deg,transparent 34%,#d4af37 36%,#d4af37 42%,transparent 44%,transparent 56%,#d9ecfa 58%,#d9ecfa 62%,transparent 64%); transform:rotate(-7deg); }

.gallery-page {
  position: relative;
  z-index: 1;
  width: min(960px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.gallery-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}

.gallery-header h1,
.gallery-art-nav {
  flex: 1 1 auto;
}

.gallery-art-nav { display: flex; align-items: center; gap: 8px; font-size: 1.1rem; font-weight: 700; }
.gallery-art-nav a { color: inherit; text-underline-offset: 3px; }

.gallery-home-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  min-width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--paper-warm);
  color: var(--ink);
  text-decoration: none;
  box-shadow: var(--shadow);
}

.gallery-home-button:hover,
.gallery-home-button:focus-visible {
  background: var(--panel);
  border-color: #1E66D0;
  outline: 3px solid rgba(30, 102, 208, 0.25);
  outline-offset: 2px;
}

.gallery-home-button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

h1 {
  margin: 0;
  font-size: 1.6rem;
  font-weight: 400;
}

.back-link,
.open-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--paper-warm);
  color: var(--ink);
  text-decoration: none;
  font: inherit;
  font-size: 0.95rem;
  box-shadow: var(--shadow);
}

.back-link:hover,
.open-button:hover {
  background: var(--panel);
  border-color: #1E66D0;
}

.back-link:focus-visible,
.open-button:focus-visible {
  outline: 3px solid rgba(30, 102, 208, 0.25);
  outline-offset: 2px;
}

.gallery-panel {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.gallery-controls { --ui-font:"Segoe UI",Arial,sans-serif; display:flex; align-items:end; gap:12px; min-height:72px; margin-bottom:14px; padding:11px 14px; border:1px solid var(--border); border-radius:10px; background:rgba(255,250,240,.88); box-shadow:var(--shadow); }
.gallery-control { display:grid; align-content:start; gap:5px; width:min(210px,22vw); min-width:0; }
.gallery-search-control { width:min(270px,28vw); }
.control-label { color:var(--muted); font-family:var(--ui-font); font-size:12px; font-weight:600; letter-spacing:.03em; line-height:1; }
.gallery-control input, .gallery-control select, .select-like-button { width:100%; min-height:38px; padding:0 10px; border:1px solid var(--border); border-radius:7px; background:#fffdf7; color:var(--ink); font-family:var(--ui-font); font-size:14px; }
.gallery-control select, .select-like-button { font-family:"Segoe UI",Arial,sans-serif; font-size:14px; font-weight:400; line-height:normal; }
.gallery-control select { padding-right:32px; }
.gallery-control select:focus-visible, .select-like-button:focus-visible { outline:3px solid rgba(34,34,34,.28); outline-offset:2px; }
.select-like-button { display:inline-flex; align-items:center; justify-content:space-between; min-width:0; overflow:hidden; box-shadow:none; cursor:pointer; }
.select-like-button > span:first-child { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.chevron { width:8px; height:8px; margin:0 2px 4px 10px; border-right:2px solid currentColor; border-bottom:2px solid currentColor; transform:rotate(45deg); flex:0 0 auto; }
.clear-filters-button { min-height:34px; margin-left:auto; padding:0 6px; border:1px solid transparent; background:transparent; color:#654329; font-family:var(--ui-font); font-size:13px; cursor:pointer; }
.clear-filters-button::before { content:"x"; margin-right:6px; }
[hidden] { display:none !important; }
body.gallery-overlay-open { overflow:hidden; }
.gallery-filter-panel { position:fixed; z-index:101; display:flex; flex-direction:column; max-height:min(560px,calc(100vh - 24px)); overflow:hidden; border:1px solid var(--border); border-radius:10px; background:var(--paper); box-shadow:0 14px 34px rgba(52,39,26,.2); }
.gallery-filter-panel-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; padding:13px 14px 9px; }
.gallery-filter-panel-heading h2 { margin:0; font-size:18px; font-weight:400; }
.gallery-filter-heading { margin:0; padding:0 14px 6px; color:var(--muted); font-family:"Segoe UI",Arial,sans-serif; font-size:12px; font-weight:600; line-height:normal; letter-spacing:.04em; text-transform:uppercase; }
.gallery-option-search-label { display:block; padding:0 12px 10px; }
.gallery-option-search-label input { box-sizing:border-box; width:100%; min-height:40px; padding:7px 10px; border:1px solid var(--border); border-radius:7px; background:#fffdf7; color:var(--ink); font-family:"Segoe UI",Arial,sans-serif; font-size:13.3333px; font-weight:400; line-height:normal; }
.gallery-search-control input, .gallery-option-search-label input { min-height:40px; padding:7px 10px; border:1px solid #d3c7b0; border-radius:7px; background:#fffdf7; font-family:"Segoe UI",Arial,sans-serif; font-size:13.3333px; font-weight:400; line-height:normal; }
.gallery-filter-close { display:none; align-items:center; justify-content:center; width:38px; min-width:38px; min-height:38px; padding:0; border:0; background:transparent; color:var(--ink); font-size:25px; cursor:pointer; }
.gallery-select-all, .gallery-checkbox-option { display:flex; align-items:center; gap:9px; min-height:42px; padding:7px 14px; font-family:var(--ui-font); font-size:14px; cursor:pointer; }
.gallery-select-all { border-top:1px solid var(--soft-border); border-bottom:1px solid var(--soft-border); font-weight:600; }
.gallery-select-all input, .gallery-checkbox-option input { width:18px; height:18px; margin:0; accent-color:#1E66D0; flex:0 0 auto; }
.gallery-checkbox-options { min-height:0; overflow-y:auto; overscroll-behavior:contain; padding:4px 0; scrollbar-color:#bca98f transparent; }
.gallery-checkbox-option:hover { background:var(--panel); }
.gallery-filter-note { display:block; padding:12px 14px; color:var(--muted); font-family:var(--ui-font); font-size:13px; }
.gallery-filter-panel-actions { display:grid; grid-template-columns:1fr 1fr; gap:9px; padding:11px 12px; border-top:1px solid var(--soft-border); background:var(--paper); }
.gallery-filter-panel-actions button { min-height:36px; border:1px solid var(--border); border-radius:6px; background:var(--paper-warm); color:var(--ink); font-family:var(--ui-font); cursor:pointer; }
.gallery-filter-panel-actions .gallery-filter-apply { border-color:#1E66D0; background:#1E66D0; color:#fffaf0; font-weight:600; }
.gallery-overlay-backdrop { position:fixed; inset:0; z-index:100; background:rgba(44,36,29,.34); }
.gallery-mobile-control-bar, .gallery-mobile-filter-tabs, .gallery-mobile-sort-options { display:none; }
.gallery-sort-panel { display:none; position:fixed; z-index:101; overflow:hidden; border:1px solid var(--border); border-radius:10px; background:var(--paper); box-shadow:0 14px 34px rgba(52,39,26,.2); }

.gallery-status {
  min-height: 47px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--soft-border);
  color: var(--muted);
}
.gallery-status:empty {
  display: none;
}

.gallery-skeleton-row { height:55px; }
.gallery-skeleton-line, .gallery-option-skeleton span:last-child { display:block; width:min(110px,80%); height:12px; border-radius:999px; background:linear-gradient(90deg,#e8ece9 25%,#f4f6f4 50%,#e8ece9 75%); background-size:200% 100%; animation:gallery-skeleton-pulse 1.4s ease-in-out infinite; }
.gallery-skeleton-line-name { width:min(190px,90%); }
.gallery-skeleton-line-short { width:min(76px,70%); }
.gallery-option-skeleton { display:grid; grid-template-columns:16px 1fr; align-items:center; gap:9px; min-height:32px; padding:0 14px; }
.gallery-option-skeleton span:first-child { width:14px; height:14px; border-radius:2px; background:#e8ece9; }
@keyframes gallery-skeleton-pulse { 0%,100% { background-position:100% 0; } 50% { background-position:0 0; } }
@media (prefers-reduced-motion:reduce) { .gallery-skeleton-line, .gallery-option-skeleton span:last-child { animation:none; } }

.gallery-table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--soft-border);
  text-align: left;
  vertical-align: middle;
}

th {
  background: var(--panel);
  font-size: 0.85rem;
  color: var(--muted);
}

tr:last-child td { border-bottom: 0; }

.type-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 4px 0 14px;
}

.type-choice {
  display: grid;
  min-height: 132px;
  align-content: center;
  justify-items: center;
  gap: 7px;
  padding: 14px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--paper-warm);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color .15s ease, background .15s ease, transform .15s ease;
}

.type-choice:hover,
.type-choice:focus-visible {
  border-color: #1E66D0;
  background: var(--panel);
  transform: translateY(-1px);
}

.type-choice:focus-visible {
  outline: 3px solid rgba(30, 102, 208, 0.25);
  outline-offset: 2px;
}

.type-choice svg {
  width: 48px;
  height: 40px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.type-choice-label { font-weight: 700; }

.type-choice-dimensions {
  color: var(--muted);
  font-size: 12px;
  opacity: 0;
  transition: opacity .15s ease;
}

.type-choice:hover .type-choice-dimensions,
.type-choice:focus-visible .type-choice-dimensions { opacity: 1; }

@media (max-width: 760px) {
  .gallery-page { width: 100%; padding: 12px; }
  .gallery-header { align-items: flex-start; flex-direction: column; }
  th, td { padding: 10px; }
  .type-choice-grid { grid-template-columns: 1fr; }
  .gallery-controls { display:grid; grid-template-columns:1fr; gap:8px; min-height:0; margin-bottom:10px; padding:0; border:0; border-radius:0; background:transparent; box-shadow:none; }
  .gallery-control, .gallery-search-control { width:100%; }
  .gallery-desktop-filter-control { display:none; }
  .gallery-search-control { gap:0; }
  .gallery-search-control .control-label { position:absolute!important; width:1px!important; height:1px!important; padding:0!important; margin:-1px!important; overflow:hidden!important; clip:rect(0,0,0,0)!important; white-space:nowrap!important; border:0!important; }
  .gallery-search-control input { min-height:44px; padding:7px 10px; border-radius:7px; font-family:var(--ui-font); font-size:14px; }
  .gallery-mobile-control-bar { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
  .gallery-mobile-control-bar button { min-width:0; min-height:44px; padding:0 12px; overflow:hidden; border:1px solid var(--border); border-radius:8px; background:var(--paper-warm); color:var(--ink); box-shadow:var(--shadow); font-family:var(--ui-font); font-size:13px; font-weight:600; text-overflow:ellipsis; white-space:nowrap; }
  .gallery-controls > .clear-filters-button { width:auto; min-height:34px; justify-self:end; margin:0; padding:0 6px; }
  .gallery-filter-panel, .gallery-sort-panel { inset:auto 0 0 !important; width:100% !important; max-width:100%; border-width:1px 0 0; border-radius:16px 16px 0 0; }
  .gallery-filter-panel { display:flex; flex-direction:column; height:min(90vh,760px); height:min(90dvh,760px); max-height:min(90vh,760px); max-height:min(90dvh,760px); overflow:hidden; }
  .gallery-sort-panel { display:grid; grid-template-rows:auto auto; }
  .gallery-filter-panel-heading { min-height:52px; padding:10px 12px 8px 16px; }
  .gallery-filter-panel-heading h2 { font-size:20px; }
  .gallery-filter-close { display:inline-flex; }
  .gallery-mobile-filter-tabs { display:grid; grid-template-columns:1fr 1fr; gap:4px; flex:0 0 auto; margin:0 12px 10px; padding:3px; border:1px solid var(--border); border-radius:9px; background:var(--panel); }
  .gallery-mobile-filter-tabs button { min-width:0; min-height:38px; padding:0 8px; border:0; border-radius:6px; background:transparent; box-shadow:none; color:var(--muted); font-family:var(--ui-font); font-size:13px; font-weight:600; }
  .gallery-mobile-filter-tabs button[aria-selected=true] { background:var(--paper); color:#654329; box-shadow:0 1px 4px rgba(67,55,39,.12),inset 0 -2px 0 #1E66D0; }
  .gallery-filter-heading { padding:8px 14px; }
  .gallery-option-search-label { padding:2px 12px 10px; }
  .gallery-option-search-label input { min-height:44px; }
  .gallery-select-all, .gallery-checkbox-option { min-height:46px; padding-inline:16px; font-size:15px; }
  .gallery-checkbox-options { flex:1 1 auto; min-height:0; max-height:none; overflow-y:auto; }
  .gallery-filter-panel-actions { position:static; flex:0 0 auto; padding:10px 12px max(10px,env(safe-area-inset-bottom)); }
  .gallery-filter-panel-actions button { min-height:44px; }
  .gallery-mobile-sort-options { display:grid; padding:2px 0 max(12px,env(safe-area-inset-bottom)); }
  .gallery-mobile-sort-options label { display:flex; align-items:center; gap:11px; min-height:52px; padding:8px 18px; border-top:1px solid var(--soft-border); font-family:var(--ui-font); cursor:pointer; }
  .gallery-mobile-sort-options input { width:19px; height:19px; margin:0; accent-color:#1E66D0; }
  .gallery-skeleton-row { height:64px; }
  .gallery-skeleton-row:nth-child(n+6) { display:none; }
}

@media (max-width: 760px) {
  .gallery-search-control input { font-family:"Segoe UI",Arial,sans-serif; font-size:13.3333px; font-weight:400; line-height:normal; }
  .gallery-mobile-control-bar button { font-family:"Segoe UI",Arial,sans-serif; font-size:13px; font-weight:600; line-height:normal; }
  .gallery-controls > .clear-filters-button { font-family:"Segoe UI",Arial,sans-serif; font-size:13px; font-weight:400; line-height:normal; }
  .gallery-filter-panel-heading h2 { font-family:Georgia,"Times New Roman",serif; font-size:20px; font-weight:400; line-height:normal; }
  .gallery-mobile-filter-tabs button { font-family:"Segoe UI",Arial,sans-serif; font-size:13px; font-weight:600; line-height:normal; }
  .gallery-filter-heading { font-family:"Segoe UI",Arial,sans-serif; font-size:12px; font-weight:600; line-height:normal; }
  .gallery-checkbox-option { font-family:"Segoe UI",Arial,sans-serif; font-size:15px; font-weight:400; line-height:normal; }
  .gallery-select-all { font-family:"Segoe UI",Arial,sans-serif; font-size:15px; font-weight:600; line-height:normal; }
  .gallery-filter-panel-actions button { font-family:Georgia,"Times New Roman",serif; font-size:16px; font-weight:400; line-height:normal; }
  .gallery-filter-panel-actions .gallery-filter-apply { font-family:"Segoe UI",Arial,sans-serif; font-size:16px; font-weight:600; line-height:normal; }
  .gallery-filter-close { font-family:Georgia,"Times New Roman",serif; font-size:25px; font-weight:400; line-height:normal; }
  .gallery-mobile-sort-options label { font-family:"Segoe UI",Arial,sans-serif; font-size:16px; font-weight:400; line-height:normal; }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(30, 102, 208, 0.25);
}

.modal-dialog {
  width: min(400px, 100%);
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 10px 24px rgba(36, 52, 71, 0.10);
}

.modal-dialog h2 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 400;
}

.modal-dialog label {
  display: grid;
  gap: 5px;
  margin-bottom: 10px;
  font-size: 0.95rem;
}

.modal-dialog input {
  min-height: 36px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 8px;
  background: #FFFFFF;
  color: var(--ink);
  font: inherit;
}

.modal-help {
  margin: 4px 0 12px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.modal-error {
  min-height: 18px;
  margin: 0 0 10px;
  color: #B85C4A;
  font-size: 13px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.modal-actions button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--paper-warm);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  box-shadow: var(--shadow);
}

.modal-actions button:hover {
  background: var(--panel);
  border-color: #1E66D0;
}

.modal-actions button[type="submit"] {
  border-color: #1E66D0;
  background: #1E66D0;
  color: #FFFFFF;
}

.modal-actions button:focus-visible,
.modal-dialog input:focus-visible {
  outline: 3px solid rgba(30, 102, 208, 0.25);
  outline-offset: 2px;
}

.gallery-header { background: #234A73; color: #FFFFFF; }
.gallery-header h1 { color: #DBD6A8; }
.gallery-header .gallery-home-button { border-color: rgba(255,255,255,.55); background: rgba(255,255,255,.14); color: #FFFFFF; }
th { background: #3B78B5; color: #FFFFFF; }
.modal-actions .confirm-button { border-color: #3B78B5; background: #3B78B5; color: #FFFFFF; }
/* Keep the Gallery in the Story Library visual system. */
body { background:#4F819F; }
.gallery-page { width:min(920px, calc(100% - 32px)); padding:28px 0; }
.gallery-header { min-height:74px; margin:0 0 18px; padding:0 14px; gap:16px; background:#234A73; border-bottom:1px solid rgba(255,255,255,.24); box-shadow:0 2px 0 #1E66D0; }
.gallery-header h1 { position:relative; display:flex; align-items:center; justify-content:center; box-sizing:border-box; flex:0 1 auto; height:38px; min-width:0; margin:0 auto 0 0; padding:5px 20px; overflow:hidden; border:1px solid #3A2F28; border-radius:3px; background:#DBD6A8; color:#3A2F28; font-size:1rem; font-weight:700; line-height:1.2; text-overflow:ellipsis; white-space:nowrap; }
.gallery-header h1::before,
.gallery-header h1::after { content:""; position:absolute; top:50%; width:4px; height:4px; border-radius:50%; background:#3A2F28; transform:translateY(-50%); }
.gallery-header h1::before { left:6px; }
.gallery-header h1::after { right:6px; }
.gallery-home-button { width:42px; min-width:42px; height:34px; border:1px solid rgba(255,255,255,.55); border-radius:2px; background:rgba(255,255,255,.16); color:#fff; box-shadow:none; }
.gallery-home-button:hover, .gallery-home-button:focus-visible { border-color:rgba(255,255,255,.75); background:rgba(255,255,255,.34); color:#fff; outline:3px solid rgba(255,255,255,.28); outline-offset:2px; }
.back-link { min-height:42px; padding:0 17px; border-color:#1E66D0; border-radius:6px; background:#1E66D0; color:#fff; box-shadow:none; font-weight:600; }
.back-link:hover, .back-link:focus-visible { border-color:#1565C0; background:#1565C0; color:#fff; }
.gallery-panel { border-radius:10px; background:var(--paper); box-shadow:var(--shadow); }
.gallery-table th { background:var(--paper-warm); color:var(--muted); border-bottom-color:var(--border); }
@media (min-width:761px) {
  .gallery-table th { font-family:"Segoe UI",Arial,sans-serif; font-size:10px; font-weight:600; line-height:normal; }
  .gallery-controls .control-label { font-family:"Segoe UI",Arial,sans-serif; font-size:12px; font-weight:600; line-height:1; }
  .gallery-search-control input,
  .gallery-desktop-filter-control .select-like-button,
  .gallery-desktop-filter-control select { font-family:"Segoe UI",Arial,sans-serif; font-size:14px; font-weight:400; line-height:normal; }
  .gallery-controls > .clear-filters-button { font-family:"Segoe UI",Arial,sans-serif; font-size:13px; font-weight:400; line-height:normal; }
  .gallery-filter-panel .gallery-checkbox-option { font-family:"Segoe UI",Arial,sans-serif; font-size:14px; font-weight:400; line-height:normal; }
  .gallery-filter-panel .gallery-select-all { font-family:"Segoe UI",Arial,sans-serif; font-size:14px; font-weight:600; line-height:normal; }
  .gallery-filter-panel-actions button { font-family:Georgia,"Times New Roman",serif; font-size:16px; font-weight:400; line-height:normal; }
  .gallery-filter-panel-actions .gallery-filter-apply { font-family:"Segoe UI",Arial,sans-serif; font-size:16px; font-weight:600; line-height:normal; }
}
.open-button { border-color:var(--border); border-radius:6px; background:var(--paper-warm); color:var(--ink); box-shadow:var(--shadow); }
.open-button:hover, .open-button:focus-visible { border-color:var(--accent); background:var(--panel); color:var(--ink); }
@media (max-width:560px) { .gallery-page { width:100%; padding:12px; } .gallery-header { min-height:64px; padding:0 10px; } .back-link { min-height:40px; } }

/* Gallery full-width Story Library header alignment */ .gallery-header { position:relative; top:-28px; z-index:1; width:100vw; margin-left:calc(50% - 50vw); margin-right:0; padding-left:max(14px, calc((100vw - 920px) / 2)); padding-right:max(14px, calc((100vw - 920px) / 2)); box-sizing:border-box; } .back-link { min-height:42px; padding-inline:17px; border-color:#1E66D0; background:rgba(255,255,255,.16); color:#FFFFFF; font-family:"Segoe UI", Arial, sans-serif; font-weight:600; } .back-link:hover, .back-link:focus-visible { border-color:#1565C0; background:rgba(255,255,255,.34); color:#FFFFFF; } @media (max-width:700px) { .gallery-header { top:-12px; padding-left:10px; padding-right:10px; } .back-link { min-height:40px; padding-inline:11px; font-size:13px; } }
.drawing-name-link { display:inline-flex; align-items:center; min-height:30px; max-width:100%; color:var(--ink); font:inherit; font-weight:700; text-decoration:underline; text-underline-offset:4px; overflow-wrap:anywhere; }
.drawing-name-link:hover { background:transparent; color:var(--accent); }
.drawing-name-link:focus-visible { outline:3px solid rgba(30,102,208,.25); outline-offset:2px; }
.gallery-drawing-title { display:inline-flex; align-items:center; min-width:0; max-width:100%; gap:8px; vertical-align:middle; }
.gallery-chat-link { display:inline-flex; flex:0 0 auto; align-items:center; justify-content:center; width:26px; height:26px; color:#3E6475; cursor:pointer; }
.gallery-chat-link svg { width:21px; height:21px; fill:none; stroke:currentColor; stroke-width:2; stroke-linejoin:round; transition:transform .12s ease,color .12s ease; }
.gallery-chat-link:focus-visible { outline:3px solid rgba(30,102,208,.25); outline-offset:1px; }
@media (hover:hover) { .gallery-chat-link:hover { color:var(--accent); } .gallery-chat-link:hover svg { transform:scale(1.07); } }
.gallery-chat-link:active svg { transform:scale(.96); }
.gallery-carrot-count { display:inline-flex; align-items:center; margin-left:8px; color:var(--muted); font-size:12px; font-weight:600; line-height:1.2; white-space:nowrap; }
.gallery-carrot-icon { font-family:"Segoe UI Emoji","Apple Color Emoji","Noto Color Emoji",sans-serif; }
@media (max-width:760px) {
  .gallery-table thead {
    display: none;
  }

  .gallery-table,
  .gallery-table tbody {
    display: block;
    width: 100%;
  }

  .gallery-table tr {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px 10px;
    width: 100%;
    padding: 10px;
    box-sizing: border-box;
    border-bottom: 1px solid var(--soft-border);
  }

  .gallery-table td {
    min-width: 0;
    padding: 0;
    border-bottom: 0;
  }

  /* Drawing name gets the entire first row */
  .gallery-table td:first-child {
    grid-column: 1 / -1;
    padding-bottom: 5px;
  }

  .drawing-name-link {
    display: block;
    flex: 1 1 auto;
    min-width: 0;
    min-height: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: normal;
  }

  .gallery-drawing-title { display:flex; width:100%; }

  /* Type / Protected / Artist / Updated use the second row */
  .gallery-table td:nth-child(n+2) {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
  }
}


/* Story Library-aligned Gallery identity band and top rhythm. */
.gallery-page { width:min(920px,calc(100% - 40px)); padding:0 0 28px; }
.gallery-header { position:sticky; top:0; z-index:10; width:100%; min-height:75px; margin:0 0 20px; padding:0; display:flex; flex-direction:row; align-items:center; gap:16px; overflow:visible; isolation:isolate; background:transparent; box-shadow:none; }
.gallery-header::before,
.gallery-header::after { content:""; position:absolute; z-index:0; pointer-events:none; }
body {
  background-image:
    linear-gradient(90deg,transparent 0 5px,rgba(217,236,250,.14) 5px 18px,transparent 18px),
    linear-gradient(90deg,transparent 0 9px,rgba(217,236,250,.18) 9px 15px,transparent 15px),
    linear-gradient(90deg,transparent 0 29px,rgba(217,236,250,.13) 29px 45px,transparent 45px),
    linear-gradient(90deg,transparent 0 34px,rgba(217,236,250,.17) 34px 41px,transparent 41px),
    linear-gradient(90deg,transparent 0 56px,rgba(217,236,250,.13) 56px 69px,transparent 69px),
    linear-gradient(90deg,transparent 0 60px,rgba(217,236,250,.17) 60px 66px,transparent 66px),
    repeating-linear-gradient(155deg,transparent 0 17px,rgba(212,175,55,.12) 18px 20px,transparent 21px 39px),
    linear-gradient(to bottom,#234A73 0 75px,#4F819F 75px);
  background-position:0 32px,0 24px,0 26px,0 17px,0 35px,0 27px,0 32px,0 0;
  background-size:78px 43px,78px 8px,78px 49px,78px 9px,78px 40px,78px 8px,78px 43px,100% 100%;
  background-repeat:repeat-x,repeat-x,repeat-x,repeat-x,repeat-x,repeat-x,repeat-x,no-repeat;
}
.gallery-header::before {
  top:0; bottom:0; left:50%; width:100vw; transform:translateX(-50%);
  background-color:#234A73;
  background-image:url(assets/gallery-header-brushes.png);
  background-position:center;
  background-size:cover;
  background-repeat:no-repeat;
  box-shadow:0 2px 0 #1E66D0;
}
.gallery-header::after { top:0; bottom:0; left:50%; width:100vw; transform:translateX(-50%); background:linear-gradient(90deg,transparent 0 10%,rgba(35,74,115,.12) 30%,rgba(35,74,115,.36) 46% 67%,rgba(35,74,115,.10) 86%,transparent 100%); }
.gallery-header > * { position:relative; z-index:1; }
.gallery-header h1 { font-family:Georgia,"Times New Roman",serif; font-size:1.18rem; font-weight:700; line-height:1.2; margin:0 auto 0 0; }
.gallery-controls { background:#F3EFE6; }
.gallery-home-button { width:48px; min-width:48px; height:38px; padding:0; border-radius:2px; }
.gallery-home-button svg { width:22px; height:22px; }
.gallery-header .gallery-home-button,
.gallery-header .back-link { border-color:#3A2F28; background:rgba(255,250,240,.70); color:#3A2F28; font-weight:700; }
.gallery-header .gallery-home-button:hover,
.gallery-header .gallery-home-button:focus-visible,
.gallery-header .back-link:hover,
.gallery-header .back-link:focus-visible { border-color:#2F2721; background:rgba(255,250,240,.85); color:#2F2721; }
@media (max-width:700px) {
  .gallery-page { width:100%; padding:0 10px 22px; }
  .gallery-header { min-height:75px; margin-bottom:10px; padding:0; gap:12px; }
  .gallery-header h1 { font-size:1rem; }
  .gallery-home-button { width:42px; min-width:42px; height:34px; }
  body { background-position:0 36px,0 29px,0 31px,0 23px,0 39px,0 32px,0 36px,0 0; background-size:78px 39px,78px 7px,78px 44px,78px 8px,78px 36px,78px 7px,78px 39px,100% 100%; }
  .gallery-header::before { background-position:center; background-size:cover; }
  .gallery-header::after { background:linear-gradient(90deg,transparent 0 7%,rgba(35,74,115,.11) 27%,rgba(35,74,115,.34) 43% 73%,rgba(35,74,115,.09) 91%,transparent 100%); }
}
@media (max-width:760px) { .gallery-controls { background:transparent; } }

.gallery-results-actions { display:flex; justify-content:flex-end; margin:0 0 12px; }
.gallery-results-actions .view-controls { display:flex; align-items:center; gap:8px; }
.gallery-results-actions .view-button { min-height:42px; padding:8px 12px; border:1px solid #3A2F28; border-radius:8px; background:rgba(255,250,240,.72); color:#3A2F28; font:inherit; font-weight:700; cursor:pointer; }
.gallery-results-actions .view-button:hover,
.gallery-results-actions .view-button:focus-visible,
.gallery-results-actions .view-button[aria-pressed=true] { background:#fffaf0; }
.gallery-results-actions .view-button:focus-visible { outline:3px solid rgba(30,102,208,.25); outline-offset:2px; }
.gallery-card-grid { --gallery-preview-width:100%; --gallery-preview-height:210px; display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:18px; padding:16px; }
.gallery-card-grid[data-view=small] { --gallery-preview-height:128px; grid-template-columns:repeat(4,minmax(0,1fr)); gap:12px; }
.gallery-card-grid[data-view=list] { --gallery-preview-width:116px; --gallery-preview-height:78px; grid-template-columns:minmax(0,1fr); gap:8px; }
.gallery-card { position:relative; min-width:0; overflow:hidden; border:1px solid var(--border); border-radius:12px; background:var(--paper); box-shadow:var(--shadow); }
.gallery-card-open { display:flex; min-width:0; height:100%; flex-direction:column; color:var(--ink); text-decoration:none; }
.gallery-card-open:hover .gallery-card-title { color:var(--accent); text-decoration:underline; text-underline-offset:4px; }
.gallery-card-open:focus-visible { outline:3px solid rgba(30,102,208,.3); outline-offset:-3px; }
.gallery-card-preview { position:relative; display:grid; width:var(--gallery-preview-width); min-width:0; height:var(--gallery-preview-height); place-items:center; overflow:hidden; background:#e7e1d7; }
.gallery-card-preview iframe { display:block; place-self:center; width:min(100%,calc(var(--gallery-preview-height) * 1.7777778)); min-width:0; height:auto; min-height:0; max-width:100%; max-height:100%; aspect-ratio:16 / 9; border:0; pointer-events:none; }
.gallery-card-preview[data-canvas-type=story_cover] iframe { width:auto; height:100%; max-width:100%; aspect-ratio:2 / 3; }
.gallery-card-copy { display:grid; gap:4px; min-width:0; padding:12px 13px 14px; }
.gallery-card-title { overflow-wrap:anywhere; }
.gallery-card-artist { color:#416d86; overflow-wrap:anywhere; }
.gallery-card-meta { color:var(--muted); font-family:"Segoe UI",Arial,sans-serif; font-size:12px; line-height:1.35; overflow-wrap:anywhere; }
.gallery-card .gallery-chat-link { position:absolute; top:8px; right:8px; width:32px; height:32px; border:1px solid var(--border); border-radius:50%; background:rgba(255,250,240,.92); }
.gallery-card-grid[data-view=small] .gallery-card-copy { gap:2px; padding:9px 10px 10px; }
.gallery-card-grid[data-view=small] .gallery-card-meta { font-size:11px; }
.gallery-card-list-status { display:none; }
.gallery-card-list-meta { display:none; }
.gallery-card-grid[data-view=list] .gallery-card { display:flex; align-items:center; gap:14px; min-height:94px; padding:8px; }
.gallery-card-grid[data-view=list] .gallery-card-open { display:grid; flex:1 1 auto; grid-template-columns:var(--gallery-preview-width) minmax(0,1fr); align-items:center; min-width:0; height:auto; }
.gallery-card-grid[data-view=list] .gallery-card-preview { margin:0; }
.gallery-card-grid[data-view=list] .gallery-card-copy { gap:3px; padding:8px 0 8px 12px; }
.gallery-card-grid[data-view=list] .gallery-card-meta { display:none; }
.gallery-card-grid[data-view=list] .gallery-card-list-meta { display:block; color:var(--muted); font-family:"Segoe UI",Arial,sans-serif; font-size:12px; line-height:1.35; overflow-wrap:anywhere; }
.gallery-card-grid[data-view=list] .gallery-card-list-status { display:flex; flex:0 0 auto; flex-wrap:wrap; gap:6px; justify-content:flex-end; color:var(--muted); font-family:"Segoe UI",Arial,sans-serif; font-size:12px; line-height:1.35; text-align:right; }
.gallery-card-grid[data-view=list] .gallery-card .gallery-chat-link { position:static; flex:0 0 auto; }
@media (max-width:900px) {
  .gallery-card-grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .gallery-card-grid[data-view=small] { grid-template-columns:repeat(3,minmax(0,1fr)); }
}
@media (max-width:600px) {
  .gallery-results-actions { margin-bottom:10px; }
  .gallery-results-actions .view-button { min-height:38px; padding:6px 10px; }
  .gallery-card-grid { --gallery-preview-height:clamp(200px,58vw,300px); grid-template-columns:1fr; gap:12px; padding:12px; }
  .gallery-card-grid[data-view=small] { --gallery-preview-height:120px; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
  .gallery-card-grid[data-view=list] .gallery-card { display:grid; grid-template-columns:var(--gallery-preview-width) minmax(0,1fr) 32px; gap:8px; min-height:74px; padding:6px; }
  .gallery-card-grid[data-view=list] .gallery-card-open { grid-column:1 / 3; grid-row:1; grid-template-columns:var(--gallery-preview-width) minmax(0,1fr); }
  .gallery-card-grid[data-view=list] { --gallery-preview-width:94px; --gallery-preview-height:62px; }
  .gallery-card-grid[data-view=list] .gallery-card-copy { padding:6px 0 6px 8px; }
  .gallery-card-grid[data-view=list] .gallery-card-list-status { grid-column:2; grid-row:2; align-self:start; justify-content:flex-start; margin:0; text-align:left; }
  .gallery-card-grid[data-view=list] .gallery-card .gallery-chat-link { grid-column:3; grid-row:1 / 3; align-self:center; margin:0; }
}
@media (max-width:360px) {
  .gallery-card-grid[data-view=small] { grid-template-columns:1fr; }
}

.site-footer { margin-top:28px; padding:24px 0; border-top:1px solid rgba(255,255,255,.24); color:#FFFFFF; background:#234A73; }
.footer-inner { width:min(920px,calc(100% - 40px)); margin:0 auto; }
.footer-inner p { margin:0; }
.site-footer a { color:inherit; text-decoration:none; }
.site-footer a:hover { text-decoration:underline; text-underline-offset:4px; }
@media (max-width:700px) {
  .site-footer { margin-top:18px; padding:20px 0; }
  .footer-inner { width:calc(100% - 20px); }
}
