/* Inkbound — base styles, animations, hover/focus states.
   Layout/inline styles live in the view templates (ported from the design). */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; background: #0f0e0d; }
body { color: #ddd0b8; font-family: 'Spectral', Georgia, serif; -webkit-font-smoothing: antialiased; }
:root { --accent: #c8903a; }
#app { height: 100vh; overflow: hidden; }

.no-bars { scrollbar-width: none; -ms-overflow-style: none; }
.no-bars::-webkit-scrollbar { width: 0; height: 0; display: none; }
::selection { background: rgba(200,144,58,0.28); }

@keyframes inkBloom {
  0% { transform: scale(0.18); opacity: 0; }
  45% { opacity: 0.55; }
  100% { transform: scale(1); opacity: 0.16; }
}
@keyframes riseUp {
  0% { opacity: 1; transform: translateY(20px); }
  100% { opacity: 1; transform: translateY(0); }
}
@keyframes blink { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0; } }
@keyframes floatPage {
  0%, 100% { transform: translateY(0) rotate(-3deg); }
  50% { transform: translateY(-14px) rotate(-3deg); }
}

/* landing */
.btn-begin {
  font-family: 'Spectral', serif; font-size: 15px; letter-spacing: 0.16em; text-transform: uppercase;
  color: #15110a; background: var(--accent); border: none; padding: 17px 44px; border-radius: 3px;
  cursor: pointer; font-weight: 600; transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 8px 30px rgba(200,144,58,0.28);
}
.btn-begin:hover { transform: translateY(-2px); box-shadow: 0 12px 38px rgba(200,144,58,0.42); }
@media (max-width: 700px) {
  .landing-title { font-size: 68px !important; }
  .landing-title span { height: 50px !important; vertical-align: -7px !important; }
}

/* shared accent button */
.btn-accent {
  font-family: 'Spectral', serif; text-transform: uppercase; color: #15110a; background: var(--accent);
  border: none; border-radius: 4px; cursor: pointer; font-weight: 600; transition: filter 0.2s;
}
.btn-accent:hover { filter: brightness(1.08); }

/* sign-in fields */
.field-label { display: block; font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: #8f8470; margin-bottom: 8px; }
.field {
  width: 100%; padding: 13px 14px; background: #221d16; border: 1px solid rgba(222,206,176,0.12);
  border-radius: 4px; color: #e8ddc6; font-family: 'Spectral', serif; font-size: 15px; outline: none;
  transition: border-color 0.2s;
}
.field:focus { border-color: var(--accent); }

/* left nav */
.nav-btn {
  position: relative; display: flex; align-items: center; gap: 13px; padding: 11px 12px;
  background: none; border: none; border-radius: 5px; cursor: pointer;
  font-family: 'Spectral', serif; font-size: 14.5px; transition: background 0.15s, color 0.15s;
}
.nav-btn:hover { background: rgba(222,206,176,0.05); }

/* editor subheader tool buttons */
.tool-btn {
  background: none; border: 1px solid rgba(222,206,176,0.14); border-radius: 5px;
  width: 32px; height: 32px; flex: none; cursor: pointer; color: #9a8e76;
  display: flex; align-items: center; justify-content: center;
}
.tool-btn:hover { color: var(--accent); border-color: var(--accent); }

/* chapter list items */
.chapter-item {
  width: 100%; text-align: left; display: flex; flex-direction: column; gap: 3px;
  padding: 12px 12px; margin-bottom: 4px; border-radius: 5px; cursor: pointer; transition: background 0.15s;
}
.chapter-item:hover { background: rgba(222,206,176,0.05); }

/* formatting toolbar */
.tbar {
  flex: none; display: flex; align-items: center; gap: 3px; padding: 6px 14px;
  background: #131110; border-bottom: 1px solid rgba(222,206,176,0.07); overflow-x: auto;
}
.tb-btn {
  background: none; border: none; border-radius: 4px; width: 30px; height: 28px; flex: none;
  cursor: pointer; color: #9a8e76; display: flex; flex-direction: column; align-items: center;
  justify-content: center; font-family: 'Spectral', serif; font-size: 14px; line-height: 1;
}
.tb-btn:hover { background: rgba(222,206,176,0.07); color: #d8ccb2; }
.tb-btn.tb-on { background: rgba(200,144,58,0.16); color: var(--accent); }
.tb-select {
  background: #1d1812; border: 1px solid rgba(222,206,176,0.12); border-radius: 4px;
  padding: 4px 6px; height: 28px; color: #c2b59a; font-family: 'Spectral', serif; font-size: 12.5px;
  outline: none; flex: none;
}
.tb-size {
  width: 38px; height: 28px; flex: none; text-align: center; background: #1d1812;
  border: 1px solid rgba(222,206,176,0.12); border-radius: 4px; color: #c2b59a;
  font-family: 'Spectral', serif; font-size: 13px; outline: none;
}
.tb-sep { width: 1px; height: 20px; background: rgba(222,206,176,0.10); margin: 0 5px; flex: none; }

/* manuscript page block typography (editor + measurer) */
.page-content > * { margin: 0 0 26px; }
.page-content p { margin: 0 0 26px; }
.page-content h1 { font-family: 'Cormorant Garamond', serif; font-weight: 600; font-size: 42px; line-height: 1.15; margin: 0 0 26px; }
.page-content h2 { font-family: 'Cormorant Garamond', serif; font-weight: 500; font-style: italic; font-size: 24px; line-height: 1.3; color: #6f6149; margin: 0 0 26px; }
.page-content h3 { font-family: 'Cormorant Garamond', serif; font-weight: 600; font-size: 30px; line-height: 1.2; margin: 0 0 26px; }
.page-content h4 { font-family: 'Cormorant Garamond', serif; font-weight: 600; font-size: 25px; line-height: 1.25; margin: 0 0 26px; }
.page-content h5 { font-family: 'Cormorant Garamond', serif; font-weight: 600; font-size: 21px; line-height: 1.3; margin: 0 0 26px; }
.page-content ul, .page-content ol { padding-left: 26px; }
.page-content li { margin: 0 0 6px; }

/* modals */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; background: rgba(8,7,6,0.72);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal {
  width: 520px; max-width: 100%; max-height: 86vh; display: flex; flex-direction: column;
  background: #16130f; border: 1px solid rgba(222,206,176,0.14); border-radius: 8px;
  box-shadow: 0 40px 90px rgba(0,0,0,0.6);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between; padding: 18px 22px 12px;
  font-family: 'Cormorant Garamond', serif; font-size: 26px; color: #f0e6d2;
}
.modal-x { background: none; border: none; color: #8f8470; font-size: 24px; cursor: pointer; line-height: 1; }
.modal-body { padding: 4px 22px 10px; overflow-y: auto; }
.modal-foot {
  display: flex; align-items: center; gap: 10px; padding: 14px 22px 18px;
  border-top: 1px solid rgba(222,206,176,0.08);
}
.modal-save {
  background: var(--accent, #c8903a); color: #15110a; border: none; border-radius: 4px;
  font-family: 'Spectral', serif; font-size: 13px; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; padding: 13px 30px; cursor: pointer;
  box-shadow: 0 6px 22px rgba(200,144,58,0.35);
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
}
.modal-save:hover { transform: translateY(-1px); filter: brightness(1.08); box-shadow: 0 9px 28px rgba(200,144,58,0.5); }
.modal-cancel {
  background: none; border: 1px solid rgba(222,206,176,0.16); border-radius: 4px; color: #9a8e76;
  font-family: 'Spectral', serif; font-size: 12px; letter-spacing: 0.08em; padding: 10px 18px; cursor: pointer;
}
.modal-del {
  background: none; border: 1px solid rgba(177,96,106,0.4); border-radius: 4px; color: #c47480;
  font-family: 'Spectral', serif; font-size: 12px; letter-spacing: 0.08em; padding: 10px 16px; cursor: pointer;
}
.m-label {
  display: block; font-size: 10.5px; letter-spacing: 0.16em; text-transform: uppercase;
  color: #8f8470; margin: 14px 0 6px;
}
.m-input {
  width: 100%; padding: 10px 12px; background: #221d16; border: 1px solid rgba(222,206,176,0.12);
  border-radius: 4px; color: #e8ddc6; font-family: 'Spectral', serif; font-size: 14px; outline: none;
}
.m-input:focus { border-color: var(--accent); }
.m-checkgroup { display: flex; flex-direction: column; gap: 6px; max-height: 130px; overflow-y: auto; padding: 4px 2px; }
.m-check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: #c2b59a; cursor: pointer; }
.m-check input { accent-color: var(--accent); }
.m-detailrow { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.m-mini {
  background: none; border: 1px solid rgba(222,206,176,0.16); border-radius: 4px; color: #9a8e76;
  font-family: 'Spectral', serif; font-size: 11px; padding: 4px 10px; cursor: pointer; flex: none;
}
.m-mini:hover { color: var(--accent); border-color: var(--accent); }

/* chapter list edit affordance */
.chapter-edit {
  position: absolute; top: 8px; right: 8px; display: none; background: #221d16;
  border: 1px solid rgba(222,206,176,0.16); border-radius: 4px; width: 24px; height: 24px;
  color: #9a8e76; cursor: pointer; align-items: center; justify-content: center; padding: 0;
}
.chapter-item:hover .chapter-edit { display: flex; }
.chapter-edit:hover { color: var(--accent); border-color: var(--accent); }

/* books library */
.book-cover {
  aspect-ratio: 2 / 3; display: flex; flex-direction: column; justify-content: center;
  text-align: center; padding: 26px 20px; background: linear-gradient(160deg, #f4ebd8 0%, #ecdfc4 100%);
  border-radius: 3px 8px 8px 3px; border-left: 5px solid #d8c8a4;
  box-shadow: 0 18px 44px rgba(0,0,0,0.5);
  transition: transform 0.18s, box-shadow 0.18s;
}
div:hover > .book-cover { transform: translateY(-4px); box-shadow: 0 26px 54px rgba(0,0,0,0.6); }
.book-new {
  aspect-ratio: 2 / 3; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; color: #6f6757; border: 1px dashed rgba(222,206,176,0.22); border-radius: 6px;
  cursor: pointer; transition: color 0.15s, border-color 0.15s;
}
.book-new:hover { color: var(--accent); border-color: var(--accent); }

/* characters view */
.view-title { font-family: 'Cormorant Garamond', serif; font-weight: 500; font-size: 44px; color: #f0e6d2; margin: 0; }
.view-sub { font-size: 14px; color: #8f8470; margin: 4px 0 0; font-style: italic; font-family: 'Cormorant Garamond', serif; }
.char-card {
  background: #16130f; border: 1px solid rgba(222,206,176,0.09); border-radius: 7px;
  padding: 22px 22px 20px; transition: transform 0.18s, border-color 0.18s;
}
.char-card:hover { transform: translateY(-3px); }

/* live consistency badge on the Flags tab */
.flag-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; margin-left: 7px; padding: 0 5px;
  border-radius: 9px; background: #b1606a; color: #f5e9d5;
  font-size: 10px; font-weight: 600; letter-spacing: 0; vertical-align: middle;
}

/* detail suggestion chips in the character modal */
.m-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px; }
.m-chip {
  font-family: 'Spectral', serif; font-size: 11px; color: #bfae8e;
  background: rgba(222,206,176,0.05); border: 1px solid rgba(222,206,176,0.16);
  border-radius: 12px; padding: 4px 11px; cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}
.m-chip:hover { color: #e8dcc2; border-color: var(--accent, #c8903a); }

/* flag hot links + jump highlight */
.flag-jumps { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.flag-jump {
  font-family: 'Spectral', serif; font-size: 10.5px; letter-spacing: 0.04em;
  color: #bfae8e; background: rgba(222,206,176,0.05);
  border: 1px solid rgba(222,206,176,0.18); border-radius: 4px;
  padding: 3px 9px; cursor: pointer; max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: color 0.12s, border-color 0.12s, background 0.12s;
}
.flag-jump:hover { color: #f0e6d2; border-color: var(--accent, #c8903a); background: rgba(200,144,58,0.1); }
.flag-flash {
  position: absolute; pointer-events: none; border-radius: 5px; z-index: 5;
  background: rgba(200,144,58,0.18); box-shadow: 0 0 0 2px rgba(200,144,58,0.55);
  animation: flagFlash 2.4s ease forwards;
}
@keyframes flagFlash {
  0% { opacity: 0; } 12% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; }
}
