/* ==========================================================================
   Family photo album - styles
   Everything is sized in "em" from the page width, so the book scales
   with the window.
   ========================================================================== */

/* COLOURS AND TEXTURE. Change these to restyle the whole album. --paper = page colour,
   --ink = text colour, --gold = cover lettering and frame, --cover = cover colour (see
   the options in the comment on that line), --grain = the fine paper texture. */
:root {
  --paper: #f5eedd;
  --ink: #3b3025;
  --gold: #0e1b6a;                 /* cover lettering and frame : gold #dcb862. navy #0e1b6a. Others: forest green #0e3a1b, dark brown #3a1f0e, burgundy #6a0e1b */
  --cover: #dcb862;                     /* cover colour : navy #1f2c4a. Others: forest green #22392c, dark brown #3a2a1f, burgundy #7a2c37 */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .27 0 0 0 0 .17 0 0 0 .14 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* Basic reset: no default margins, and sizes include padding. */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }

/* The page behind the book: dark wood-like background; the page itself never scrolls. */
body {
  overflow: hidden;
  font-family: "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  color: var(--ink);
  background: #ffd670 60%;
  /*background: radial-gradient(ellipse at 50% 40%, #4a3a2f 0%, #2a201a 60%, #14100d 100%);*/
  -webkit-user-select: none; user-select: none;
}

/* ------------------------------------------------------------ stage & book */
/* The area that holds the book, centred, leaving room for the control bar. */
.stage {
  position: fixed; inset: 0 0 56px 0;
  display: flex; align-items: center; justify-content: center;
  touch-action: none; cursor: grab;
}
.stage.dragging { cursor: grabbing; }

/* The book. Page size (--pw, --ph) is set by album.js to fit your window. 'perspective'
   gives the page turn its 3D depth. */
.book {
  --pw: 400px; --ph: 528px;
  position: relative;
  width: calc(var(--pw) * 2);
  height: var(--ph);
  perspective: calc(var(--pw) * 4);       /* gives the page turn its depth */
}

/* The soft shadow on the desk under the book. */
.book-shadow {
  position: absolute; bottom: -1.2em; height: 2.2em; z-index: -1;
  background: radial-gradient(ellipse at center, rgba(0,0,0,.6), transparent 70%);
  filter: blur(.5em);
  pointer-events: none;
}

/* One sheet of paper. It rotates around its left edge (the spine) when turned. */
.leaf {
  position: absolute; top: 0; left: var(--pw);
  width: var(--pw); height: var(--ph);
  transform-origin: left center;           /* the spine */
  transform-style: preserve-3d;
  will-change: transform;
}

/* ------------------------------------------------------------ page faces */
/* One side of a sheet (a page). 'backface-visibility: hidden' means you only see
   the side facing you. The next rules round the corners and add the soft shading
   near the spine. */
.face {
  position: absolute; inset: 0; overflow: hidden;
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  background-color: var(--paper);
  background-image:
    var(--grain),
    linear-gradient(to right, rgba(120,90,50,.07), transparent 14%, transparent 86%, rgba(120,90,50,.06));
}
/* Right-hand pages round their outer (right) corners; left-hand pages the left. */
.face.right { border-radius: .1em .5em .5em .1em; }
.face.left  { border-radius: .5em .1em .1em .5em; }
.face.back  { transform: rotateY(180deg); }

/* shadow in the gutter, next to the spine */
/* Darkening near the spine, like the curve of a real book. */
.face::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 13%;
  pointer-events: none; z-index: 4;
}
.face.right::after { left: 0;  background: linear-gradient(to right, rgba(40,25,10,.30), rgba(40,25,10,.08) 45%, transparent); }
.face.left::after  { right: 0; background: linear-gradient(to left,  rgba(40,25,10,.30), rgba(40,25,10,.08) 45%, transparent); }

/* lighting while a page turns */
.shade { position: absolute; inset: 0; background: #1a0f05; opacity: 0; pointer-events: none; z-index: 5; }

/* ------------------------------------------------------------ covers */
/* COVERS. The cover colour comes from --cover; the gold lettering from --gold. */
.face.t-cover, .face.t-back-cover {
  background-color: var(--cover);
  background-image:
    var(--grain),
    radial-gradient(ellipse at 30% 18%, rgba(255,255,255,.14), transparent 60%),
    linear-gradient(135deg, rgba(0,0,0,.22), transparent 40%, rgba(0,0,0,.32));
  color: var(--gold);
}
.face.t-cover::after, .face.t-back-cover::after { width: 9%; opacity: .8; }

/* book-cloth weave on the covers: on while <body class="cloth"> in flip.html; delete the
   class for smooth leather */
/* Cloth weave on the covers. It is on when <body class="cloth"> in flip.html;
   remove the word 'cloth' there for a smooth leather look. */
.cloth .face.t-cover, .cloth .face.t-back-cover {
  background-image:
    var(--grain),
    repeating-linear-gradient(0deg,  rgba(255,255,255,.07) 0 1px, transparent 1px 2px, rgba(0,0,0,.08) 2px 3px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.05) 0 1px, transparent 1px 2px, rgba(0,0,0,.10) 2px 3px),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='300' height='300'%3E%3Cfilter id='s'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.012 .25' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .22 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23s)'/%3E%3C/svg%3E"),
    radial-gradient(ellipse at 30% 18%, rgba(255,255,255,.12), transparent 60%),
    linear-gradient(135deg, rgba(0,0,0,.18), transparent 40%, rgba(0,0,0,.28));
}

/* The gold double border on the cover, with the title, crest and subtitle inside it. */
.cover-frame {
  position: absolute; top: 6%; bottom: 6%;
  border: .14em solid var(--gold);
  outline: .06em solid var(--gold); outline-offset: .35em;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1.1em; padding: 1.6em; text-align: center;
}
.face.right .cover-frame { left: 13%; right: 7%; }
.face.left  .cover-frame { left: 7%;  right: 13%; }

/* spine: darker leather wrapped round the hinge edge, with raised bands */
/* The leather spine strip on the hinge edge of the covers, with its raised bands. */
.spine {
  position: absolute; top: 0; bottom: 0; left: 0; width: 6.5%;
  z-index: 3; pointer-events: none;
  background-color: #3a1218;
  background-color: color-mix(in srgb, var(--cover) 60%, #120806);
  background-image:
    var(--grain),
    linear-gradient(to right, rgba(0,0,0,.55), rgba(0,0,0,.15) 14%, rgba(255,255,255,.13) 34%,
                    rgba(255,255,255,.05) 58%, rgba(0,0,0,.28) 86%, rgba(0,0,0,.5));
  border-right: .07em solid var(--gold);
  box-shadow: inset -.05em 0 0 rgba(0,0,0,.4);
}
.face.left .spine { left: auto; right: 0; transform: scaleX(-1); }   /* back cover: mirror it */
.spine::after {                       /* the hinge groove where the board meets the spine */
  content: ""; position: absolute; top: 0; bottom: 0; left: 100%; width: .45em;
  background: linear-gradient(to right, rgba(0,0,0,.45), rgba(0,0,0,.12) 45%, transparent);
}
.spine i {
  position: absolute; left: 0; right: 0; height: .5em;
  background: linear-gradient(to bottom, rgba(0,0,0,.4), rgba(255,255,255,.2) 38%,
                                         rgba(255,255,255,.06) 62%, rgba(0,0,0,.45));
  border-top: .05em solid rgba(220,184,98,.75);
  border-bottom: .05em solid rgba(220,184,98,.75);
}
.spine i:nth-child(1) { top: 9%; }
.spine i:nth-child(2) { top: 28%; }
.spine i:nth-child(3) { top: 47%; }
.spine i:nth-child(4) { top: 66%; }
.spine i:nth-child(5) { top: 85%; }


/* The small line above the cover crest. */
.eyebrow { letter-spacing: .4em; text-transform: uppercase; font-size: .5em; }
/* The cover title. Font, size and capitals can be changed here, or use the Cover font
   choice in the editor / coverFont in album-data.js. */
.cover-frame h1 {
  font-size: var(--cover-size, 2.1em); font-weight: 600; line-height: 1.15;
  letter-spacing: var(--cover-track, .08em); text-transform: var(--cover-caps, uppercase);
  text-shadow: 0 .05em .1em rgba(0,0,0,.55);
}
/* The italic subtitle line on the cover. */
.cover-sub { font-style: italic; letter-spacing: .1em; font-size: .95em; opacity: .9; }

.face.t-inside-front, .face.t-inside-back {
  background-color: #7a3a40;
  background-image:
    var(--grain),
    repeating-linear-gradient(45deg,  rgba(255,255,255,.055) 0 .55em, transparent .55em 1.1em),
    repeating-linear-gradient(-45deg, rgba(255,255,255,.055) 0 .55em, transparent .55em 1.1em);
}
/* The dedication text on the inside front cover. */
.dedication {
  position: absolute; left: 14%; right: 14%; top: 34%;
  background: var(--paper); padding: 1.5em 1.2em;
  text-align: center; font-style: italic; line-height: 1.5;
  box-shadow: 0 .15em .6em rgba(0,0,0,.45);
  border: .1em double rgba(90,60,30,.5);
}

/* ------------------------------------------------------------ crest */
/* CRESTS. The crest picture box. .crest-lg is the large front-cover crest and
   .crest-sm the smaller one used on the back cover and branch title pages. Raise or
   lower the percentages to make a crest bigger or smaller. */
.crest { display: flex; align-items: center; justify-content: center; }
.crest img, .crest svg { width: 100%; height: 100%; object-fit: contain; display: block; }
.crest-lg { width: 66%; aspect-ratio: 5 / 6; }   /* front-cover crest size: raise or lower the % */
/* a real crest image keeps its own shape (wide or tall) instead of the placeholder's shield box */
.crest-lg:has(img) { width: 92%; aspect-ratio: auto; }
.crest-lg img { height: auto; max-height: calc(var(--ph) * 0.42); }
.crest-sm:has(img) { width: 62%; aspect-ratio: auto; }
.crest-sm img { height: auto; max-height: calc(var(--ph) * 0.3); }
.crest-md { width: 36%; aspect-ratio: 5 / 6; color: rgba(60,45,30,.55); }
.crest-sm { width: 30%; aspect-ratio: 5 / 6; }

/* ------------------------------------------------------------ page content */
/* PAGE CONTENT. The area inside the margins of an ordinary page. */
.page-body {
  position: absolute; inset: 0;
  padding: 7% 7% 10% 7%;
  display: flex; flex-direction: column;
}
.face.right .page-body { padding-left: 11%; }
.face.left  .page-body { padding-right: 11%; }

/* The page number at the bottom of each page. */
.folio {
  position: absolute; bottom: 3.6%; left: 0; right: 0;
  text-align: center; font-size: .7em; letter-spacing: .2em;
  color: rgba(60,45,30,.7);
}

/* The heading line at the top of a branch page (branch name and rule). */
.page-head {
  display: flex; align-items: center; gap: .7em;
  font-size: .62em; letter-spacing: .2em; text-transform: uppercase;
  color: rgba(60,45,30,.8); margin-bottom: 1.1em;
}
.page-head::after { content: ""; flex: 1; height: .12em; background: var(--accent); opacity: .8; }

/* photo grids: 3, 4 or 5 photos */
.photos { flex: 1; min-height: 0; display: grid; gap: .75em .8em; }
.photos.n1 { grid-template-columns: 1fr; grid-template-rows: 1fr; }
.photos.n2 { grid-template-columns: 1fr; grid-template-rows: 1fr 1fr; }
.photos.n3 { grid-template-columns: 1fr 1fr; grid-template-rows: 1.25fr 1fr; }
.photos.n3 .ph:first-child { grid-column: span 2; }
.photos.n4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.photos.n5 { grid-template-columns: repeat(6, 1fr); grid-template-rows: 1fr 1fr; }
.photos.n5 .ph:nth-child(-n+2) { grid-column: span 3; }
.photos.n5 .ph:nth-child(n+3)  { grid-column: span 2; }

.ph { display: flex; flex-direction: column; min-width: 0; min-height: 0; cursor: zoom-in; }
.ph .frame {
  flex: 1; min-height: 0; background: #fff; padding: .28em;
  box-shadow: 0 .08em .35em rgba(40,25,10,.4);
}
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; -webkit-user-drag: none; }
.ph.contain img { object-fit: contain; background: #fbf8f1; }

/* caption area */
.ph figcaption {
  flex: 0 0 auto; min-height: 2.6em; padding-top: .35em;
  font-size: .58em; line-height: 1.25; text-align: center;
  color: #4b3f30; overflow: hidden;
}
.ph .cap  { display: block; font-style: italic; }
.ph .date { display: block; font-size: .85em; letter-spacing: .1em; opacity: .7; margin-top: .1em; }

/* index page */
.page-title { text-align: center; font-size: 1.5em; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; margin-top: .6em; }
.rule { height: .08em; margin: .7em 0 1.4em; background: linear-gradient(to right, transparent, rgba(80,60,40,.55), transparent); }
.idx-list { list-style: none; display: flex; flex-direction: column; gap: 1.2em; }
.idx-link { display: flex; align-items: baseline; gap: .6em; color: inherit; text-decoration: none; cursor: pointer; font-size: .95em; }
.idx-link:hover .idx-name { text-decoration: underline; }
.idx-leader { flex: 1; border-bottom: .1em dotted rgba(60,45,30,.5); transform: translateY(-.25em); }
.dot { width: .7em; height: .7em; border-radius: 50%; flex: none; }

/* branch title page */
.branch-body { align-items: center; justify-content: center; text-align: center; gap: 1em; }
.branch-name { font-size: 1.7em; font-weight: 600; letter-spacing: .06em; }
.accent-rule { width: 28%; height: .18em; background: var(--accent); border-radius: .1em; }
.blurb { font-style: italic; line-height: 1.5; max-width: 80%; font-size: .9em; }

.ornament { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 2.2em; color: rgba(60,45,30,.25); }

/* ------------------------------------------------------------ tabs */
/* TABS. The coloured tabs on the page edges. Their colour comes from each branch's
   'color' in album-data.js. Text is shrunk to fit by album.js. */
.tab {
  position: absolute; left: 100%;
  top: calc(var(--ph) * 0.07 + var(--i) * var(--ph) * 0.86 / var(--n));
  width: calc(var(--pw) * 0.085);
  height: min(calc(var(--ph) * 0.86 / var(--n) - .45em), calc(var(--ph) * 0.2));
  border: 0; cursor: pointer; font: inherit;
  background: var(--tab); color: #fff;
  font-size: .72em; letter-spacing: .12em; text-transform: uppercase; font-weight: 600;
  text-shadow: 0 .06em .12em rgba(0,0,0,.45);
  writing-mode: vertical-rl;
  display: flex; align-items: center; justify-content: center;
  box-shadow: .1em .1em .4em rgba(0,0,0,.4), inset 0 0 0 .08em rgba(255,255,255,.18);
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  opacity: var(--tabs, 1);
  transition: filter .2s, width .2s;
}
.tab { overflow: hidden; padding: .3em 0; }
.tab-txt { display: block; max-height: 100%; line-height: 1.1; text-align: center; -webkit-hyphens: manual; hyphens: manual; }
.tab.clip .tab-txt { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tab-front { border-radius: 0 .45em .45em 0; }
.tab-back  { border-radius: .45em 0 0 .45em; transform: rotateY(180deg); }
.tab:hover { filter: brightness(1.15); }
.tab.active { filter: brightness(1.12); width: calc(var(--pw) * 0.1); }
.book.no-tabs .tab { pointer-events: none; }

/* ------------------------------------------------------------ controls & lightbox */
/* The control bar at the bottom: previous / next buttons, page counter and hint. */
.controls {
  position: fixed; left: 0; right: 0; bottom: 0; height: 56px;
  display: flex; align-items: center; justify-content: center; gap: 1em;
  color: #0b3788; font-size: .9rem; /* Original colour: #d9cdb8 */
}
.controls button {
  width: 2.3rem; height: 2.3rem; border-radius: 50%;
  border: 1px solid rgba(11,55,136.4); background: rgba(255,255,255,.07); /* Original colour: rgba(217,205,184, .4 - rgba(255,255,255,.07) */
  color: inherit; font-size: 1.1rem; cursor: pointer;
}
.controls button:hover:not(:disabled) { background: rgba(255,255,255,.18); }
.controls button:disabled { opacity: .3; cursor: default; }
#pageInfo { min-width: 9em; text-align: center; letter-spacing: .06em; }
.hint { opacity: .55; font-size: .78rem; margin-left: 1em; }
@media (max-width: 760px) { .hint { display: none; } }

/* ------------------------------------------------------------ photo viewer (zoom) */
/* PHOTO VIEWER. The dark full-window layer shown when you click a photo to zoom. */
.lightbox {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,.92);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; touch-action: none; cursor: default;
  -webkit-user-select: none; user-select: none;
}
.lightbox[hidden] { display: none; }
.lightbox img {
  max-width: 94vw; max-height: 80vh;
  border: .5rem solid #fff; box-shadow: 0 0 2rem rgba(0,0,0,.7);
  transform-origin: center center; will-change: transform;
  cursor: zoom-in; -webkit-user-drag: none;
}
.lightbox.zoomed img { cursor: grab; }
.lightbox.zoomed:active img { cursor: grabbing; }
.lightbox p { position: absolute; left: 0; right: 0; text-align: center; pointer-events: none; }
#lbCap {
  bottom: 2.2rem; padding: 0 4rem; color: #eadfca; font-style: italic;
  text-shadow: 0 .1rem .4rem #000;
}
.lb-help { bottom: .7rem; font-size: .72rem; color: rgba(234,223,202,.5); }
.lightbox.zoomed .lb-help { opacity: 0; }
/* The viewer's zoom buttons (minus, plus, Fit, 1:1, close). */
.lb-bar {
  position: absolute; top: .8rem; left: 50%; transform: translateX(-50%); z-index: 3;
  display: flex; align-items: center; gap: .35rem;
  background: rgba(34,27,22,.88); border: 1px solid rgba(217,205,184,.25);
  padding: .3rem; border-radius: 2rem; color: #d9cdb8; font-size: .85rem;
}
.lb-bar button, .lb-nav {
  min-width: 2.2rem; height: 2.2rem; border-radius: 1.1rem;
  border: 1px solid rgba(217,205,184,.35); background: rgba(255,255,255,.07);
  color: #eadfca; font-size: 1.1rem; cursor: pointer; padding: 0 .5rem;
}
.lb-bar button.txt { font-size: .8rem; padding: 0 .75rem; }
.lb-bar button:hover, .lb-nav:hover:not(:disabled) { background: rgba(255,255,255,.2); }
#lbZoomLbl { min-width: 3.4em; text-align: center; }
/* The previous / next photo arrows in the viewer. */
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  width: 3rem; height: 4.5rem; font-size: 2.4rem; line-height: 1; border-radius: .6rem;
}
.lb-nav:disabled { opacity: .2; cursor: default; }
.lb-prev { left: .8rem; }
.lb-next { right: .8rem; }

/* ------------------------------------------------------------ extra page types */
.accent-rule.left { margin: .5em 0 1em; width: 22%; }
.note-title { font-size: 1.35em; font-weight: 600; letter-spacing: .04em; margin-top: .3em; }
/* STORY PAGES: the page of text (a family story, names, a note). */
.note-text {
  flex: 1; min-height: 0; overflow: hidden;
  font-size: .9em; line-height: 1.55; white-space: pre-line; text-align: left;
}
.idx-list.dense { gap: .55em; }
.idx-list.dense .idx-link { font-size: .8em; }

/* ------------------------------------------------------------ control bar extras */
.controls .pill {
  width: auto; height: 2.1rem; border-radius: 1.1rem; padding: 0 .9rem;
  font: inherit; font-size: .82rem; letter-spacing: .04em; white-space: nowrap;
}
.controls .pill.off { opacity: .65; }
.controls .pill.on { background: rgba(220,184,98,.25); border-color: rgba(220,184,98,.7); }
@media (max-width: 1100px) { .hint { display: none; } }

/* ------------------------------------------------------------ editor drawer */
:root { --drawer-w: 400px; }
body.editing .stage, body.editing .controls { right: var(--drawer-w); }
@media (max-width: 820px) { body.editing .stage, body.editing .controls { right: 0; } }

.editor, .editor input, .editor textarea, .editor select {
  -webkit-user-select: text; user-select: text;
}
/* EDITOR DRAWER. Everything from here to the page curl section styles the 'Edit album'
   panel (tabs, drop zone, photo rows, pop-up messages). It is not used if you leave
   editor.js out. */
.editor {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 500;
  width: min(var(--drawer-w), 100vw);
  display: flex; flex-direction: column;
  background: #241c17; color: #e8dcc6;
  border-left: 1px solid rgba(217,205,184,.18);
  box-shadow: -.6rem 0 2rem rgba(0,0,0,.45);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
}
.editor[hidden] { display: none; }
.editor button, .editor input, .editor select, .editor textarea { font: inherit; color: inherit; }
.ed-head { display: flex; align-items: center; justify-content: space-between; padding: .8rem 1rem .4rem; }
.ed-head h2 { font-size: 1.1rem; font-weight: 600; letter-spacing: .03em; }
.ed-x { background: none; border: 0; font-size: 1.1rem; cursor: pointer; opacity: .7; padding: .3rem .5rem; }
.ed-x:hover { opacity: 1; }
.ed-tabs { display: flex; gap: .25rem; padding: 0 .8rem; border-bottom: 1px solid rgba(217,205,184,.18); }
.ed-tabs button {
  background: none; border: 0; border-bottom: 2px solid transparent;
  padding: .5rem .6rem; cursor: pointer; opacity: .65;
}
.ed-tabs button.on { opacity: 1; border-bottom-color: #dcb862; }
.ed-body { flex: 1; overflow-y: auto; padding: .9rem 1rem 1.2rem; display: flex; flex-direction: column; gap: .8rem; }
.ed-status { padding: .45rem 1rem; font-size: .78rem; opacity: .75; border-top: 1px solid rgba(217,205,184,.18); }
.ed-status.warn { color: #ffb48a; opacity: 1; }

.editor button {
  background: rgba(255,255,255,.08); border: 1px solid rgba(217,205,184,.3);
  border-radius: .4rem; padding: .35rem .7rem; cursor: pointer;
}
.editor button:hover:not(:disabled) { background: rgba(255,255,255,.17); }
.editor button:disabled { opacity: .35; cursor: default; }
.editor button.solid { background: #dcb862; border-color: #dcb862; color: #2a1d10; font-weight: 600; }
.editor button.solid:hover { background: #ebca78 !important; }
.editor button.ghost { background: none; }
.editor button.danger:hover:not(:disabled) { background: #7a2a2a; border-color: #b55; }

.editor input[type=text], .editor select, .editor textarea {
  width: 100%; background: rgba(0,0,0,.28); border: 1px solid rgba(217,205,184,.28);
  border-radius: .4rem; padding: .4rem .55rem; min-width: 0;
}
.editor textarea { resize: vertical; }
.editor input:focus, .editor select:focus, .editor textarea:focus, .editor button:focus-visible, .ed-drop:focus-visible {
  outline: 2px solid #dcb862; outline-offset: 1px;
}
.editor input[type=color] { width: 3rem; height: 2.1rem; padding: 0; border: 1px solid rgba(217,205,184,.3); border-radius: .4rem; background: none; }
.editor select option { background: #241c17; }

.ed-row { display: flex; gap: .6rem; align-items: flex-end; }
.ed-grow { flex: 1; min-width: 0; }
.ed-lbl { display: block; font-size: .78rem; opacity: .7; margin-bottom: .2rem; }
.ed-field { display: flex; flex-direction: column; gap: .25rem; margin-top: .7rem; }
.ed-field > span { font-size: .78rem; opacity: .75; }
.ed-field small, .ed-help, .ed-count { font-size: .76rem; opacity: .65; }
.ed-help { line-height: 1.5; }
.ed-note { background: rgba(220,184,98,.12); border: 1px solid rgba(220,184,98,.35); padding: .5rem .7rem; border-radius: .4rem; font-size: .8rem; line-height: 1.45; }
.ed-empty { opacity: .65; font-size: .82rem; line-height: 1.45; }
.ed-btnrow { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .8rem; }
.ed-btnrow.col { flex-direction: column; align-items: stretch; margin-top: 0; }

.ed-details { border: 1px solid rgba(217,205,184,.2); border-radius: .5rem; padding: .5rem .8rem .8rem; background: rgba(255,255,255,.03); }
.ed-details summary { cursor: pointer; font-weight: 600; padding: .15rem 0; }
.ed-newbranch { background: rgba(220,184,98,.1); border: 1px solid rgba(220,184,98,.35); border-radius: .5rem; padding: .7rem .8rem; }
.ed-newbranch p { font-size: .78rem; opacity: .7; margin: .2rem 0 .6rem; }

.ed-crest { display: flex; gap: .7rem; align-items: center; }
.ed-crest-prev {
  width: 3.4rem; height: 4rem; flex: none; display: flex; align-items: center; justify-content: center;
  border: 1px dashed rgba(217,205,184,.4); border-radius: .3rem; font-size: .7rem; opacity: .9; overflow: hidden;
}
.ed-crest-prev img { width: 100%; height: 100%; object-fit: contain; }
.ed-crest-btns { display: flex; flex-wrap: wrap; gap: .4rem; }

.ed-drop {
  border: 2px dashed rgba(220,184,98,.55); border-radius: .6rem;
  padding: 1rem; text-align: center; cursor: pointer;
  display: flex; flex-direction: column; gap: .2rem;
  background: rgba(220,184,98,.06);
}
.ed-drop span { font-size: .8rem; opacity: .75; }
.ed-drop:hover, .ed-drop.over { background: rgba(220,184,98,.16); border-style: solid; }
.ed-drop.working { opacity: .7; pointer-events: none; }

.ed-list { display: flex; flex-direction: column; gap: .55rem; }
.ed-item {
  display: flex; gap: .35rem; align-items: flex-start; position: relative;
  background: rgba(255,255,255,.045); border: 1px solid rgba(217,205,184,.16);
  border-radius: .5rem; padding: .5rem .5rem .5rem .2rem;
}
.ed-item.flash { animation: flash 1.2s ease-out; }
@keyframes flash { from { background: rgba(220,184,98,.45); } }
.ed-item.dragging { opacity: .4; }
.ed-item.drop-before::before, .ed-item.drop-after::after {
  content: ""; position: absolute; left: 0; right: 0; height: 3px; background: #dcb862; border-radius: 2px;
}
.ed-item.drop-before::before { top: -.4rem; }
.ed-item.drop-after::after { bottom: -.4rem; }
.ed-handle { cursor: grab; padding: .3rem .25rem; opacity: .55; font-size: 1.1rem; line-height: 1; touch-action: none; }
.ed-handle:hover { opacity: 1; }
.ed-itembody { flex: 1; min-width: 0; display: flex; gap: .6rem; }
.ed-thumb { width: 4.2rem; height: 4.2rem; flex: none; object-fit: cover; border-radius: .3rem; background: #000; cursor: pointer; }
.ed-notebadge {
  width: 4.2rem; flex: none; height: 4.2rem; border-radius: .3rem; white-space: pre-line; text-align: center;
  display: flex; align-items: center; justify-content: center; font-size: .72rem; line-height: 1.2;
  background: rgba(220,184,98,.18); border: 1px dashed rgba(220,184,98,.5);
}
.ed-fields { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .35rem; }
.ed-2 { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem; }
.ed-check { display: flex; align-items: center; gap: .3rem; font-size: .8rem; cursor: pointer; }
.ed-acts { display: flex; gap: .3rem; }
.ed-acts button { padding: .2rem .55rem; font-size: .8rem; }

.ed-toast {
  margin: 0 1rem .5rem; padding: .55rem .75rem; border-radius: .5rem;
  background: #3b3025; border: 1px solid rgba(220,184,98,.5); font-size: .82rem;
  display: flex; gap: .7rem; align-items: center; justify-content: space-between;
}
.ed-toast[hidden] { display: none; }

/* ------------------------------------------------------------ page curl (corner fold) */
.leaf > .curl { display: none; position: absolute; inset: 0; pointer-events: none; }
.leaf.curling > .curl { display: block; }
.leaf.curling > .face, .leaf.curling > .tab { visibility: hidden; }
.peel-clip, .peel-sheet, .peel-under {
  position: absolute; left: 0; top: 0; width: var(--pw); height: var(--ph);
}
.peel-under { overflow: hidden; }
.peel-sheet { transform-origin: 0 0; overflow: hidden; }
.peel-sheet.tabs { overflow: visible; }
.peel-flap { position: absolute; inset: 0; filter: drop-shadow(0 0 .45em rgba(30,15,5,.45)); }
.curl .face, .curl .tab { -webkit-backface-visibility: visible; backface-visibility: visible; transition: none; }
.peel-grad { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.peel-flap .peel-grad {      /* light on the folded flap: shadowed at the crease, bright on the roll */
  background: linear-gradient(to right, rgba(40,25,10,.32), rgba(255,250,240,.22) 28%,
                              rgba(255,250,240,.06) 65%, rgba(40,25,10,.14));
}
.peel-under .peel-grad {     /* shadow the flap throws on the page underneath */
  background: linear-gradient(to right, rgba(30,15,5,.5), rgba(30,15,5,.16) 40%, rgba(30,15,5,0));
}

/* shadow cast by a turning page onto the page beneath */
/* The soft shadow a turning page casts onto the page beneath. */
.cast {
  position: absolute; top: 0; width: var(--pw); height: var(--ph);
  display: none; pointer-events: none;
}

/* keep the control bar above a page that swings toward the viewer */
.stage { z-index: 1; }
.controls { z-index: 20; }

/* ------------------------------------------------------------ crest on inner pages */
.page-head { position: relative; }
.page-head::after { order: 2; }
/* CRESTS ON INNER PAGES: .mini-crest (small, in the page heading), .foot-crest (bottom
   corner) and .crest-mark (faint watermark behind the photos). Which one is used
   is chosen by innerCrest in album-data.js or in the editor. */
.mini-crest {
  order: 3; flex: none; width: 2.7em; height: 3.3em; margin: -.9em 0;
  display: flex; align-items: center; justify-content: center;
}
.face.left .page-head .mini-crest { order: -1; }
.mini-crest img, .foot-crest img, .idx-crest img, .idx-crest svg, .crest-mark img { width: 100%; height: 100%; object-fit: contain; display: block; }

.foot-crest {
  position: absolute; bottom: 2.6%; width: 4.4%; aspect-ratio: 5 / 6; min-width: 1.6em;
  opacity: .9; pointer-events: none;
}
.face.right .foot-crest { right: 7%; }
.face.left  .foot-crest { left: 7%; }

.crest-mark {
  position: absolute; inset: 0; z-index: 0; pointer-events: none;
  display: flex; align-items: center; justify-content: center;
  opacity: .1; filter: sepia(.55) saturate(.8);
}
.crest-mark img { width: 62%; height: auto; max-height: 70%; }
.page-body { z-index: 1; }

.idx-crest { align-self: center; width: 3.2em; height: 3.8em; margin-bottom: -.2em; color: rgba(60,45,30,.55); }

/* "album-data.js was edited" notice */
/* The notice shown when album-data.js was changed after you made editor edits. */
.ed-banner {
  position: fixed; left: 50%; top: .8rem; transform: translateX(-50%); z-index: 900;
  width: min(640px, calc(100vw - 1.6rem)); padding: .8rem 1rem; border-radius: .6rem;
  background: #2d2118; border: 1px solid #dcb862; color: #f1e6cf;
  box-shadow: 0 .6rem 2rem rgba(0,0,0,.6);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  display: flex; gap: 1rem; align-items: center; flex-wrap: wrap;
}
.ed-banner > div:first-child { flex: 1 1 280px; }
.ed-banner-btns { display: flex; gap: .5rem; flex-wrap: wrap; }
.ed-banner button {
  font: inherit; color: inherit; cursor: pointer; padding: .4rem .8rem; border-radius: .4rem;
  background: rgba(255,255,255,.1); border: 1px solid rgba(217,205,184,.4);
}
.ed-banner button.solid { background: #dcb862; border-color: #dcb862; color: #2a1d10; font-weight: 600; }

/* file version, read by diagnose.js */
:root { --album-css-version: '2026-10-12a'; }

/* PHOTO INDEX (back of the book): a long list of captions, each with its page number. */
.pidx-list { list-style: none; display: flex; flex-direction: column; gap: .45em; }
.pidx-head { font-weight: 600; letter-spacing: .18em; text-transform: uppercase; font-size: .75em;
             margin-top: .5em; color: rgba(60,45,30,.75); border-bottom: .06em solid rgba(60,45,30,.3); }
.pidx-link { font-size: .78em; }
.pidx-link .idx-name { display: flex; align-items: baseline; min-width: 0; max-width: 82%; white-space: nowrap; }
.pidx-link .cap { min-width: 4em; overflow: hidden; text-overflow: ellipsis; }
.pidx-link em, .pidx-link small { flex: none; }
.pidx-link .idx-name small { opacity: .6; font-size: .8em; margin-left: .3em; }
.pidx-link .idx-name em { opacity: .7; margin-left: .2em; }
.pidx-link .dot { flex: none; }
.page-title small { font-size: .55em; letter-spacing: .1em; text-transform: none; opacity: .7; }


/* STORY PAGE PICTURE: an optional photo at the top of a story page, with the story below it. */
.note-pic { flex: 0 0 38%; min-height: 0; display: flex; margin-bottom: .7em; }
.note-pic .ph { flex: 1; }
.note-pic .ph figcaption { min-height: 0; }
.has-pic .note-title { font-size: 1.15em; margin-top: 0; }
.has-pic .accent-rule.left { margin: .35em 0 .6em; }
.ed-notepic { display: flex; align-items: center; gap: .4rem; flex-wrap: wrap; }
.ed-notepic .ed-thumb { width: 3rem; height: 3rem; }


/* PLACING A PHOTO IN A PLACEHOLDER: the drop box and the highlight while dragging a file over one. */
.pick-box {
  position: fixed; z-index: 60; width: 15rem; padding: .8rem; border-radius: .6rem;
  background: #2a2118; color: #f3ead8; border: 1px solid rgba(220,184,98,.6);
  box-shadow: 0 .6rem 2rem rgba(0,0,0,.6); display: flex; flex-direction: column; gap: .5rem;
  font-size: .85rem; text-align: center;
}
.pick-box p { margin: 0; }
.pick-zone {
  display: flex; flex-direction: column; gap: .2rem; padding: 1.1rem .5rem; cursor: pointer;
  border: 2px dashed rgba(220,184,98,.7); border-radius: .5rem; background: rgba(220,184,98,.08);
}
.pick-zone.over, .pick-zone:focus { background: rgba(220,184,98,.25); outline: none; }
.pick-box .ghost { align-self: center; }
.ph.drop-hot .frame { outline: .2em dashed #d9a93a; outline-offset: .15em; }
.pick-box button { font: inherit; font-size: .8rem; padding: .25rem .9rem; border-radius: 1rem; cursor: pointer;
  background: rgba(255,255,255,.08); color: inherit; border: 1px solid rgba(255,255,255,.3); }
.pick-box button:hover { background: rgba(255,255,255,.18); }


/* HIDDEN SIDE OF A PAGE: the side of a sheet that is facing away is invisible, but some
   browsers still let it catch the mouse. That could cover the links on the page showing
   underneath (e.g. the last page of the photo index). So the hidden side ignores the mouse. */
.leaf > .face.front { pointer-events: auto; }
.leaf.turned > .face.front { pointer-events: none; }
.leaf:not(.turned) > .face.back { pointer-events: none; }


/* THE "RETURN" LINK in the bottom bar (back to your website's home page). It is a link,
   so it needs the same look as the round buttons. */
.controls a.pill {
  display: inline-flex; align-items: center; text-decoration: none; color: inherit;
  border: 1px solid rgba(11,55,136,.8); background: rgba(255,255,255,.07);  /* Original colour: rgba(217,205,184,.4) */
}
.controls a.pill:hover { background: rgba(255,255,255,.18); }

/* make only this branch crest bigger on its title page
.crest-sm:has(img[src*="images/Noren.png"]) { width: 85%; }
.crest-sm img[src*="images/Noren.png"] { max-height: calc(var(--ph) * 0.42); }
*/
