/* Frosty dummy: all styling. */
:root {
  --fd-bg: #2b2a28;
  --fd-panel: #1f1e1c;
  --fd-ink: #ece8e1;
  --fd-dim: #9a958c;
  --fd-line: #3d3b37;
  --fd-accent: #3d8bff;
  --fd-paper-shadow: 0 10px 40px rgba(0, 0, 0, .45);
  --fd-book: "Adobe Caslon Pro", "Libre Caslon Text", Georgia, serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--fd-bg); color: var(--fd-ink);
  font: 13px/1.3 -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); overflow: hidden;
  user-select: none; -webkit-user-select: none;
}
button {
  font: inherit; color: var(--fd-ink); background: #3a3835; border: 1px solid #4a4743;
  border-radius: 6px; padding: 5px 9px; cursor: pointer; line-height: 1.2;
}
button:hover { background: #46433f; }
button:disabled { opacity: .35; cursor: default; }
button.fd-on { background: var(--fd-accent); border-color: var(--fd-accent); color: #fff; }
.fd-primary { background: var(--fd-accent); border-color: var(--fd-accent); color: #fff; }
.fd-primary:hover { background: #2f78e6; }

/* ---- Top bar: one steady row; tools gray out instead of coming and going ---- */
.fd-bar {
  display: flex; align-items: center; gap: 14px; padding: 7px 12px; min-height: 52px;
  background: var(--fd-panel); border-bottom: 1px solid var(--fd-line); flex-wrap: wrap;
}
.fd-brand { display: flex; align-items: center; gap: 10px; min-width: 0; margin-right: auto; }
.fd-brand > div { display: flex; flex-direction: column; min-width: 0; }
.fd-brand b { font-family: var(--fd-book); font-size: 16px; font-weight: 700; white-space: nowrap; }
.fd-count { color: var(--fd-dim); font-size: 11.5px; margin-top: 1px; white-space: nowrap; }
.fd-count.fd-over { color: #ff9a6b; }
.fd-groups { display: flex; align-items: center; gap: 10px; }
.fd-group { display: flex; align-items: center; gap: 2px; padding: 2px; background: #2a2926; border: 1px solid var(--fd-line); border-radius: 8px; }
.fd-sep { width: 1px; height: 18px; background: var(--fd-line); margin: 0 3px; }
.fd-ib {
  position: relative; width: 30px; height: 28px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 0; border-radius: 6px; color: var(--fd-ink); cursor: pointer;
}
.fd-ib:hover { background: #3d3b37; }
.fd-ib svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.fd-ib svg text { stroke: none; }
.fd-ib.fd-on { background: var(--fd-accent); color: #fff; }
.fd-ib:disabled, .fd-ib.fd-off { opacity: .3; cursor: default; background: transparent; }
.fd-color input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; padding: 0; border: 0; }
.fd-color.fd-off input { pointer-events: none; }
.fd-color i { position: absolute; left: 7px; right: 7px; bottom: 4px; height: 3px; border-radius: 2px; background: #1b1a19; box-shadow: 0 0 0 1px rgba(255,255,255,.35); }
.fd-colorA { font: 700 14px Georgia, serif; margin-top: -4px; }
.fd-color svg { margin-top: -3px; }
.fd-add { height: 32px; padding: 0 12px; }
.fd-file, .fd-help { height: 32px; }
.fd-help { width: 32px; padding: 0; border-radius: 50%; font-weight: 700; }
.fd-cloud { height: 32px; background: transparent; border-color: var(--fd-line); color: var(--fd-dim); white-space: nowrap; }
.fd-menuWrap { position: relative; }
.fd-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; width: 270px; padding: 6px;
  background: #262522; border: 1px solid #45423e; border-radius: 10px; box-shadow: 0 14px 40px rgba(0,0,0,.5);
}
.fd-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: 6px; padding: 8px 10px; }
.fd-menu button:hover { background: #3a3835; }
.fd-menu b { display: block; font-weight: 600; }
.fd-menu span { display: block; color: var(--fd-dim); font-size: 12px; margin-top: 2px; line-height: 1.35; }

/* Tips: a name, what it does, and its key */
.fd-tip {
  position: fixed; z-index: 70; max-width: 260px; padding: 8px 10px; pointer-events: none;
  background: #f4f1ec; color: #1f1e1c; border-radius: 8px; box-shadow: 0 8px 28px rgba(0,0,0,.45);
  font-size: 12.5px; line-height: 1.4; opacity: 0; transform: translateY(-3px); transition: opacity .12s, transform .12s;
}
.fd-tip.fd-show { opacity: 1; transform: none; }
.fd-tip b { display: block; font-size: 13px; }
.fd-tip kbd {
  float: right; margin-left: 10px; font: 600 11px -apple-system, sans-serif; color: #5d5953;
  border: 1px solid #cfcac2; border-bottom-width: 2px; border-radius: 4px; padding: 0 5px;
}
.fd-tip span { display: block; color: #4a4741; margin-top: 2px; }

/* What to do next, under the pages */
.fd-hint { position: absolute; left: 0; right: 0; text-align: center; color: #7d786f; font-size: 12.5px; pointer-events: none; padding: 0 60px; }
.fd-hint b { color: #b9b3a9; font-weight: 600; }

/* The help card */
.fd-helpCard { width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 60px); overflow: auto; }
.fd-helpCard h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--fd-dim); margin: 16px 0 6px; }
.fd-helpCard ul { margin: 0; padding-left: 18px; line-height: 1.55; }
.fd-keys { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; }
.fd-keys kbd { font: 600 12px -apple-system, sans-serif; color: var(--fd-ink); background: #3a3835; border-radius: 4px; padding: 1px 6px; justify-self: start; }

/* ---- Stage ---- */
.fd-main { display: flex; min-height: 0; }
.fd-stage { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; justify-content: center; }
.fd-frameWrap { position: relative; }
.fd-flip {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 5;
  width: 40px; height: 64px; font-size: 30px; padding: 0; background: rgba(255,255,255,.06); border-color: transparent;
}
.fd-flip-prev { left: 10px; }
.fd-flip-next { right: 10px; }
.fd-labels {
  position: absolute; left: 0; right: 0; bottom: 10px; display: flex; justify-content: center;
  color: var(--fd-dim); pointer-events: none;
}
.fd-labels span { width: var(--fd-half, 300px); text-align: center; }
.fd-dropHint {
  position: absolute; inset: 12px; border: 2px dashed var(--fd-accent); border-radius: 12px;
  display: none; align-items: flex-start; justify-content: center; padding-top: 14px;
  color: #cfe2ff; font-size: 15px; pointer-events: none; z-index: 20;
}
.fd-dragging .fd-dropHint { display: flex; }

/* The frame is always a full spread, drawn at real size in points and scaled to fit. */
.fd-frame { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.fd-sheet { position: absolute; top: 0; overflow: hidden; box-shadow: var(--fd-paper-shadow); background: #fff; }
.fd-side { position: absolute; top: 0; height: 100%; }
.fd-sheet.fd-isSpread::after { /* soft gutter shading */
  content: ""; position: absolute; top: 0; bottom: 0; left: calc(50% - 30px); width: 60px; pointer-events: none;
  background: linear-gradient(90deg, rgba(0,0,0,0) 0%, rgba(0,0,0,.07) 47%, rgba(0,0,0,.14) 50%, rgba(0,0,0,.07) 53%, rgba(0,0,0,0) 100%);
}

.fd-item { position: absolute; }
.fd-missing { background: repeating-linear-gradient(45deg, #eee 0 10px, #ddd 10px 20px); }
.fd-missing img { visibility: hidden; }
.fd-img img { display: block; width: 100%; height: 100%; pointer-events: none; -webkit-user-drag: none; }
.fd-text {
  font-family: var(--fd-book); color: #1b1a19; line-height: 1.38; white-space: normal; overflow-wrap: break-word;
}
.fd-text p { margin: 0 0 .62em; }
.fd-text p:last-child { margin-bottom: 0; }
.fd-text.fd-note { font-family: -apple-system, "Helvetica Neue", sans-serif; color: #8a8580; letter-spacing: .02em; }
.fd-text[contenteditable="true"] { outline: none; cursor: text; user-select: text; -webkit-user-select: text; }
.fd-live .fd-item { cursor: move; }

/* Guides */
.fd-guide { position: absolute; pointer-events: none; border: 1px dashed rgba(61,139,255,.6); }
.fd-gutter { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px dashed rgba(255,80,80,.7); pointer-events: none; }

/* Selection */
.fd-selBox { position: absolute; pointer-events: none; border: 2px solid var(--fd-accent); }
.fd-sideSel { position: absolute; top: 0; height: 100%; pointer-events: none; box-shadow: inset 0 0 0 4px rgba(61,139,255,.55); }
.fd-handle {
  position: absolute; background: #fff; border: 2px solid var(--fd-accent); border-radius: 3px; pointer-events: auto;
}

/* Read mode: no chrome on the page */
.fd-reading #fd-tools, .fd-reading .fd-right .fd-group:first-child, .fd-reading .fd-hint, .fd-reading .fd-spreadTools, .fd-reading .fd-tray { display: none !important; }
.fd-reading .fd-live .fd-item { cursor: default; }

/* Page turn */
.fd-turn { position: absolute; top: 0; height: 100%; transform-style: preserve-3d; z-index: 10; }
.fd-face { position: absolute; inset: 0; overflow: hidden; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.fd-face.fd-faceBack { transform: rotateY(180deg); }
.fd-face::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: var(--fd-shade, none); }
.fd-half { position: absolute; top: 0; height: 100%; overflow: hidden; }

/* ---- Pictures tray ---- */
.fd-tray {
  width: 230px; flex: none; background: var(--fd-panel); border-left: 1px solid var(--fd-line);
  overflow-y: auto; padding: 10px; display: none;
}
.fd-tray.fd-show { display: block; }
.fd-trayHead { font-weight: 600; margin-bottom: 8px; }
.fd-trayHead small { font-weight: 400; color: var(--fd-dim); margin-left: 4px; }
.fd-trayGrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fd-trayGrid div {
  aspect-ratio: 1; background: #f4f1ec center/contain no-repeat; border-radius: 4px; cursor: grab;
  border: 1px solid #444;
}
.fd-trayNote { color: var(--fd-dim); font-size: 12px; line-height: 1.45; }
.fd-trayNote code { color: var(--fd-ink); }

/* ---- Thumbnail strip ---- */
.fd-strip {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px;
  background: var(--fd-panel); border-top: 1px solid var(--fd-line);
}
.fd-spreadTools { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; flex: none; }
.fd-spreadTools button { padding: 4px 7px; font-size: 12px; }
.fd-thumbs { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 6px; flex: 1; min-width: 0; }
.fd-thumb { flex: none; cursor: pointer; text-align: center; color: var(--fd-dim); font-size: 11px; }
.fd-thumb .fd-mini { position: relative; overflow: hidden; border-radius: 2px; outline: 2px solid transparent; outline-offset: 2px; }
.fd-thumb.fd-cur .fd-mini { outline-color: var(--fd-accent); }
.fd-thumb.fd-cur { color: var(--fd-ink); }
.fd-thumb .fd-sheet { box-shadow: none; }
.fd-thumb .fd-sheet.fd-isSpread::after { display: none; }

.fd-toast {
  position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%); background: #111; color: #fff;
  padding: 9px 14px; border-radius: 8px; opacity: 0; transition: opacity .25s; pointer-events: none; z-index: 50;
  max-width: 80vw; text-align: center;
}
.fd-toast.fd-show { opacity: 1; }

.fd-fail { padding: 40px; font-size: 16px; }

/* ---- Back to the versions ---- */
.fd-back { color: var(--fd-dim); text-decoration: none; margin-right: 10px; }
.fd-back:hover { color: var(--fd-ink); }

/* ---- Index of versions ---- */
body.fd-index { display: block; overflow: auto; user-select: auto; -webkit-user-select: auto; }
.fd-indexHead { max-width: 1100px; margin: 0 auto; padding: 56px 24px 24px; position: relative; }
/* the Bear James dot, top right, back to the Bear James page: same color and hover as the Tall Tales map's */
.fd-badge { position: absolute; top: 48px; right: 24px; display: grid; place-items: center; width: 62px; height: 62px; border-radius: 50%; background: #4d6fa8; transition: transform .15s; } /* the Folk Figure blue, as on the Tall Tales map */
.fd-badge img { width: 50px; height: auto; display: block; }
.fd-badge:hover { transform: rotate(-6deg) scale(1.06); }
/* the breadcrumb on index pages: Bear James › Books › title */
.fd-crumbs { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; color: var(--fd-dim); text-transform: uppercase; letter-spacing: .14em; font-size: 12px; padding-right: 72px; }
.fd-crumbs a { color: var(--fd-dim); text-decoration: none; }
.fd-crumbs a:hover { color: var(--fd-ink); text-decoration: underline; text-underline-offset: 3px; }
.fd-crumbs i { font-style: normal; opacity: .6; }
.fd-crumbs [aria-current] { color: #cfcac2; }
.fd-indexHead h1 { font-family: var(--fd-book); font-size: 44px; font-weight: 700; margin: 6px 0 8px; }
.fd-indexHead p { color: var(--fd-dim); margin: 0; font-size: 15px; }
.fd-versions:empty { display: none; } /* e.g. no copies saved online */
.fd-versions {
  max-width: 1100px; margin: 0 auto; padding: 16px 24px 64px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 24px;
}
.fd-card {
  display: block; text-decoration: none; color: inherit; background: var(--fd-panel);
  border: 1px solid var(--fd-line); border-radius: 10px; overflow: hidden; transition: transform .15s, border-color .15s;
}
.fd-card:hover { transform: translateY(-3px); border-color: var(--fd-accent); }
.fd-cardCover { aspect-ratio: 792 / 698; background: #fff center/contain no-repeat; }
.fd-cardMeta { padding: 14px 16px 16px; }
.fd-cardMeta h2 { font-family: var(--fd-book); font-size: 22px; margin: 0; }
.fd-cardDate { color: var(--fd-dim); font-size: 12px; margin-top: 3px; }
.fd-cardMeta p { margin: 8px 0 0; line-height: 1.45; color: #cfcac2; }
.fd-empty { color: var(--fd-dim); }
@media (max-width: 600px) { .fd-indexHead { padding-top: 32px; } .fd-indexHead h1 { font-size: 34px; padding-right: 56px; } .fd-badge { top: 24px; width: 46px; height: 46px; } .fd-badge img { width: 37px; } }

/* ---- Saving online ---- */
.fd-cloud[data-state="saved"]::before { content: "✓ "; color: #6fcf8f; }
.fd-cloud[data-state="saving"] { color: var(--fd-ink); }
.fd-cloud[data-state="offline"], .fd-cloud[data-state="conflict"] { color: #ff9a6b; border-color: #7a4a35; }
.fd-cloud[data-state="out"] { color: var(--fd-ink); }
.fd-dialog { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; z-index: 60; }
.fd-dialogCard {
  width: min(380px, calc(100vw - 32px)); background: var(--fd-panel); border: 1px solid var(--fd-line); border-radius: 12px;
  padding: 20px; box-shadow: 0 20px 60px rgba(0,0,0,.5); user-select: text; -webkit-user-select: text;
}
.fd-dialogCard h2 { margin: 0 0 6px; font-family: var(--fd-book); font-size: 22px; }
.fd-dlgNote { color: var(--fd-dim); margin: 0 0 14px; line-height: 1.45; }
.fd-dialogCard label { display: block; margin-bottom: 10px; color: var(--fd-dim); font-size: 12px; }
.fd-dialogCard input {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit; font-size: 14px;
  color: var(--fd-ink); background: #2a2926; border: 1px solid #4a4743; border-radius: 6px;
}
.fd-dialogCard input:focus { outline: 2px solid var(--fd-accent); outline-offset: -1px; }
.fd-dlgErr { min-height: 1em; color: #ff9a6b; margin: 4px 0 10px; line-height: 1.4; }
.fd-dlgBtns { display: flex; gap: 6px; justify-content: flex-end; align-items: center; }
.fd-link { background: none; border: none; color: var(--fd-dim); margin-right: auto; padding-left: 0; text-decoration: underline; }
.fd-link:hover { background: none; color: var(--fd-ink); }

/* small fixes */
.fd-keys kbd { align-self: start; }
.fd-dialog:focus { outline: none; }
.fd-thumb > div:last-child { margin-top: 5px; }
.fd-back { font-size: 22px; line-height: 1; padding: 2px 6px 4px; border-radius: 6px; }
.fd-back:hover { background: #3a3835; }

/* File menu divider; index sections */
.fd-menu hr { border: 0; border-top: 1px solid #45423e; margin: 5px 4px; }
/* Sorting and Cards/List: one row just above the books. Name and Date sit over their own columns in
   the list (the same grid as a row), with the Cards/List switch at the far right. */
.fd-listBar { max-width: 1100px; margin: 0 auto; padding: 8px 24px 0; position: relative; }
.fd-sorts { display: flex; gap: 22px; align-items: center; min-height: 38px; padding-right: 200px; }
.fd-sort { display: inline-flex; align-items: center; gap: 4px; padding: 4px 0; border: 0; background: none; color: var(--fd-dim); font: inherit; font-size: 12px; text-transform: uppercase; letter-spacing: .12em; cursor: pointer; }
.fd-sort:hover { color: var(--fd-ink); }
.fd-sort[aria-pressed="true"] { color: var(--fd-ink); }
.fd-arrow { font-size: 20px; line-height: 1; font-weight: 700; letter-spacing: 0; opacity: .3; }
.fd-sort[aria-pressed="true"] .fd-arrow { opacity: 1; color: var(--fd-accent); }
.fd-seg { position: absolute; right: 24px; top: calc(50% + 4px); transform: translateY(-50%); display: inline-flex; background: var(--fd-panel); border: 1px solid var(--fd-line); border-radius: 9px; padding: 3px; gap: 2px; }
.fd-seg button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border: 0; border-radius: 6px; background: none; color: var(--fd-dim); font: inherit; font-size: 13px; cursor: pointer; }
.fd-seg button:hover { color: var(--fd-ink); }
.fd-seg button[aria-pressed="true"] { background: #3a3835; color: var(--fd-ink); }
.fd-seg svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; }
/* in the list, the sort labels line up with the Name and Date columns of the rows below */
.fd-asList .fd-sorts { display: grid; grid-template-columns: 97px 16px minmax(180px, 1.1fr) minmax(120px, .6fr) 2fr; gap: 0; padding-right: 1px; }
.fd-asList .fd-sort[data-sort="name"] { grid-column: 3; justify-self: start; }
.fd-asList .fd-sort[data-sort="date"] { grid-column: 4; justify-self: start; }

/* List view: one row per book or version */
.fd-asList .fd-versions { grid-template-columns: 1fr; gap: 8px; padding-bottom: 24px; }
.fd-asList .fd-card { display: grid; grid-template-columns: 96px 1fr; align-items: center; }
.fd-asList .fd-card:hover { transform: translateX(3px); }
.fd-asList .fd-cardMeta { display: grid; grid-template-columns: minmax(180px, 1.1fr) minmax(120px, .6fr) 2fr; align-items: center; gap: 4px 0; padding: 10px 0 10px 16px; }
.fd-asList .fd-cardMeta > * { padding-right: 18px; }
.fd-asList .fd-cardMeta h2 { font-size: 19px; }
.fd-asList .fd-cardDate { margin: 0; }
.fd-asList .fd-cardMeta p { margin: 0; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; font-size: 13px; }
.fd-asList .fd-cardBadge { grid-column: 1 / -1; margin: 0; }
@media (max-width: 700px) {
  .fd-asList .fd-card { grid-template-columns: 72px 1fr; }
  .fd-asList .fd-cardMeta { grid-template-columns: 1fr; gap: 2px; }
  .fd-asList .fd-cardMeta p { -webkit-line-clamp: 1; }
  .fd-asList .fd-sorts { display: flex; gap: 22px; padding-right: 110px; }
  .fd-seg button span { display: none; }
}
.fd-who { margin-top: 14px; color: var(--fd-dim); font-size: 13px; }
.fd-who .fd-cloud { color: var(--fd-ink); }
.fd-cardBadge { margin-top: 8px; font-size: 12px; color: #6fcf8f; }
.fd-indexHead p b { color: var(--fd-ink); }

/* ---- Sticky notes: for you, never for the reader ---- */
.fd-text.fd-sticky {
  font-family: "Caveat", "Bradley Hand", "Marker Felt", cursive; color: #3b3420; line-height: 1.15;
  background: #ffe97a; padding: 12px 14px; overflow: hidden;
  box-shadow: 0 1px 1px rgba(0,0,0,.12), 0 8px 18px -6px rgba(0,0,0,.35);
  background-image: linear-gradient(180deg, rgba(0,0,0,.06), rgba(0,0,0,0) 18px);
}
.fd-text.fd-sticky:empty::before { content: "Write a note…"; color: rgba(59,52,32,.45); }
.fd-reading .fd-sticky, .fd-hideNotes .fd-sticky { display: none; }
.fd-addNote { background: #4a4221; border-color: #6b5f2a; color: #ffe97a; }
.fd-addNote:hover { background: #5a5028; }
/* notes sit above everything on the page: pictures, text, guides, the gutter and its shading */
.fd-text.fd-sticky { z-index: 5; }
/* the title block gives way first, so the tools stay on one row */
.fd-bar { flex-wrap: nowrap; }
.fd-brand { flex: 1 1 auto; overflow: hidden; }
.fd-brand > div { overflow: hidden; }
.fd-brand b, .fd-count { overflow: hidden; text-overflow: ellipsis; }
.fd-groups, .fd-right { flex: none; }
.fd-bar { gap: 10px; }
.fd-groups { gap: 6px; }
.fd-brand { min-width: 120px; }
@media (max-width: 1220px) { .fd-bar { flex-wrap: wrap; } }
