/* GreenDeck document view (DocView). Tokens come from styles.css :root. */
.gd-doc {
  --dv-green: var(--green, #1D5B35);
  --dv-yellow: var(--yellow, #F6CF3A);
  --dv-paleblue: var(--paleblue, #E9F3FA);
  --dv-blue: var(--blue, #A8D4EF);
  --dv-ink: var(--ink, #1D2B25);
  --dv-muted: var(--muted, #5B6B63);
  --dv-red: var(--red, #B3261E);
  --dv-line: var(--line, #D6E3EC);
  --dv-serif: var(--serif, ui-serif, "New York", Georgia, serif);
  --dv-sans: var(--sans, -apple-system, system-ui, sans-serif);
  --dv-radius: var(--radius, 14px);
  font-family: var(--dv-sans);
  color: var(--dv-ink);
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  height: 100%;
  min-height: 0;
  box-sizing: border-box;
}
.gd-doc *, .gd-doc *::before, .gd-doc *::after { box-sizing: border-box; }

.gd-doc-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  justify-content: center;
  border: 1.5px dashed var(--dv-line);
  border-radius: var(--dv-radius);
  color: var(--dv-muted);
  font-size: 17px;
  padding: 24px;
  text-align: center;
  min-height: 200px;
}

/* ---------- Slides ---------- */
.gd-stage-wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  align-items: flex-start;
  justify-content: center;
}
.gd-stage {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  box-shadow: 0 1px 2px rgba(29, 43, 37, .08), 0 8px 28px rgba(29, 43, 37, .12);
  background: #fff;
  flex: none;
}
.gd-slide {
  position: absolute;
  left: 0; top: 0;
  width: 960px;
  height: 540px;
  transform-origin: 0 0;
  background: #fff;
  overflow: hidden;
}
.gd-shape {
  position: absolute;
  display: flex;
  flex-direction: column;
  overflow: visible;
}
.gd-shape.anchor-t { justify-content: flex-start; }
.gd-shape.anchor-ctr { justify-content: center; }
.gd-shape.anchor-b { justify-content: flex-end; }
.gd-para { margin: 0; line-height: 1.18; white-space: pre-wrap; overflow-wrap: break-word; }
.gd-para:empty::after { content: "\200b"; }
.gd-run { white-space: pre-wrap; }

/* Linked figure: subtle underline, tooltip on hover */
.gd-linked {
  text-decoration: underline;
  text-decoration-color: rgba(29, 91, 53, .45);
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.16em;
  cursor: help;
  border-radius: 0.12em;
  transition: background-color .15s;
}
.gd-linked:hover { background-color: rgba(246, 207, 58, .35); }

/* Changed figure: flash yellow, keep old value struck through beside it */
.gd-changed { animation: gd-flash 1.5s ease-out 1; }
@keyframes gd-flash {
  0%, 35% { background-color: var(--dv-yellow); box-shadow: 0 0 0 0.15em var(--dv-yellow); }
  100% { background-color: rgba(246, 207, 58, .18); box-shadow: 0 0 0 0 transparent; }
}
.gd-changed { background-color: rgba(246, 207, 58, .18); }
/* Changed run whose text is light (yellow or white on a dark shape):
   no fill, the text keeps its colour, a yellow underline marks the change */
.gd-changed.gd-changed-light {
  background-color: transparent;
  box-shadow: none;
  animation: none;
  text-decoration: underline;
  text-decoration-color: var(--dv-yellow);
  text-decoration-thickness: .08em;
  text-underline-offset: .14em;
}
.gd-changed-light.gd-linked:hover { background-color: rgba(255, 255, 255, .14); }
.gd-old {
  display: inline-block;
  margin-left: .4em;
  font-size: .55em;
  padding: .05em .4em;
  border-radius: 99px;
  background: #fff;
  color: var(--dv-muted);
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  vertical-align: .6em;
  text-decoration: line-through;
  text-decoration-color: var(--dv-red);
  text-decoration-thickness: .1em;
  box-shadow: 0 0 0 1px rgba(29, 43, 37, .14);
  animation: gd-old-in .5s ease-out 1;
}
.gd-old.gd-old-below {
  display: table; margin: .25em 0 0; vertical-align: baseline;
}
.gd-old.gd-old-above-r {
  position: absolute; right: 0; bottom: 100%; margin: 0 0 .2em; z-index: 2; vertical-align: baseline;
}
.gd-old.gd-old-above {
  position: absolute; left: 0; bottom: 100%; margin: 0 0 .2em; z-index: 2; vertical-align: baseline;
}
@keyframes gd-old-in { from { opacity: 0; } to { opacity: 1; } }
.gd-mismatch {
  background-color: rgba(179, 38, 30, .14);
  text-decoration: underline wavy var(--dv-red);
  text-underline-offset: 0.18em;
}

/* Chart */
.gd-chart svg { display: block; width: 100%; height: 100%; overflow: visible; }
.gd-chart.gd-chart-changed .gd-chart-flash { animation: gd-chart-flash 1.5s ease-out 1 both; }
@keyframes gd-chart-flash { 0%, 35% { opacity: .75; } 100% { opacity: 0; } }

/* Thumbnails */
.gd-thumbs {
  flex: none;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 2px 2px 6px;
}
.gd-thumb {
  position: relative;
  flex: none;
  width: 128px;
  height: 72px;
  border: 2px solid transparent;
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 4px rgba(29, 43, 37, .15);
  cursor: pointer;
  padding: 0;
  font: inherit;
}
.gd-thumb:hover { border-color: var(--dv-blue); }
.gd-thumb.is-active { border-color: var(--dv-green); }
.gd-thumb:focus-visible { outline: 3px solid var(--dv-blue); outline-offset: 2px; }
.gd-thumb .gd-slide { pointer-events: none; }
.gd-thumb .gd-changed, .gd-thumb .gd-old, .gd-thumb .gd-bar { animation: none !important; }
.gd-thumb-num {
  position: absolute; left: 5px; bottom: 4px;
  font-size: 11px; font-weight: 600; color: var(--dv-muted);
  background: rgba(255, 255, 255, .9); border-radius: 4px; padding: 0 4px;
}
.gd-thumb-dot {
  position: absolute; right: 5px; top: 5px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--dv-yellow); box-shadow: 0 0 0 2px #fff;
}

/* ---------- Docx page ---------- */
.gd-page-wrap {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  background: var(--dv-paleblue);
  border-radius: var(--dv-radius);
  padding: 22px 18px;
}
.gd-page {
  background: #fff;
  max-width: 720px;
  min-height: 600px;
  margin: 0 auto;
  padding: 56px 64px 64px;
  box-shadow: 0 1px 2px rgba(29, 43, 37, .08), 0 10px 30px rgba(29, 43, 37, .12);
  font-family: var(--dv-serif);
  color: var(--dv-ink);
}
.gd-page p { margin: 0 0 10px; white-space: pre-wrap; overflow-wrap: break-word; }
.gd-page .st-title { font-size: 26px; font-weight: 700; color: var(--dv-green); margin-bottom: 18px; line-height: 1.2; }
.gd-page .st-heading { font-family: var(--dv-sans); font-size: 15px; font-weight: 700; letter-spacing: .02em; color: var(--dv-green); margin-top: 18px; margin-bottom: 6px; }
.gd-page .st-body { font-size: 16px; line-height: 1.55; }
.gd-page .st-small { font-family: var(--dv-sans); font-size: 13px; line-height: 1.45; color: var(--dv-muted); }
/* signature block: two columns, a signature line above each label */
.gd-page .gd-sig { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 56px; }
.gd-page .gd-sig-col.has-line { border-top: 1px solid var(--dv-muted); padding-top: 8px; }
.gd-page .gd-sig-label { font-family: var(--dv-sans); font-size: 13px; color: var(--dv-muted); margin: 0 0 2px; }
.gd-page .gd-sig-name { font-size: 16px; font-weight: 700; margin: 0; }
.gd-page .al-ctr { text-align: center; }
.gd-page .al-r { text-align: right; }
.gd-page .al-just { text-align: justify; }

/* ---------- Blocked panel ---------- */
.gd-blocked {
  flex: none;
  border: 2px solid var(--dv-red);
  background: #FCEDEC;
  border-radius: var(--dv-radius);
  padding: 18px 22px;
  color: var(--dv-ink);
}
.gd-blocked-tag {
  display: inline-block;
  background: var(--dv-red);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: .08em;
  padding: 3px 10px;
  border-radius: 999px;
}
.gd-blocked-head {
  font-family: var(--dv-serif);
  font-size: 24px;
  line-height: 1.25;
  margin: 10px 0 8px;
}
.gd-blocked ul { margin: 6px 0 10px; padding-left: 20px; font-size: 17px; line-height: 1.45; }
.gd-blocked li { margin: 2px 0; }
.gd-blocked-nothing {
  font-size: 16px;
  font-weight: 650;
  color: var(--dv-red);
  margin-top: 6px;
}
.gd-doc.is-blocked .gd-stage-wrap, .gd-doc.is-blocked .gd-page-wrap { opacity: .55; filter: grayscale(.35); }

/* ---------- Tooltip ---------- */
.gd-tip {
  position: fixed;
  z-index: 10000;
  pointer-events: none;
  background: var(--ink, #1D2B25);
  color: #fff;
  font: 500 14px/1.35 var(--sans, -apple-system, system-ui, sans-serif);
  padding: 7px 11px;
  border-radius: 8px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, .25);
  max-width: 440px;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .12s, transform .12s;
}
.gd-tip.is-on { opacity: 1; transform: none; }
.gd-tip b { color: var(--yellow, #F6CF3A); font-weight: 600; }
.gd-tip .gd-tip-old { display: block; color: #C9D3CE; font-size: 13px; margin-top: 2px; }

@media (prefers-reduced-motion: reduce) {
  .gd-changed, .gd-old, .gd-bar, .gd-chart-flash { animation: none !important; }
}

/* integrator: on short screens the thumbnails shrink so the slide itself stays large */
@media (max-height: 820px) {
  .gd-thumbs { zoom: .7; }
}

/* compact slide control: hidden unless the page hides the thumbnails */
.gd-stage-wrap { position: relative; }
.gd-nav {
  display: none;
  position: absolute; right: 0; bottom: 0; z-index: 3;
  align-items: center; gap: 2px;
  background: #fff; border: 1px solid var(--dv-line, #D6E3EC); border-radius: 999px;
  padding: 2px; box-shadow: 0 1px 4px rgba(29, 43, 37, .12);
}
.gd-nav-btn {
  width: 28px; height: 28px; border: 0; border-radius: 50%; background: none; cursor: pointer;
  font-size: 20px; line-height: 1; color: var(--dv-green, #1D5B35); padding: 0 0 2px;
}
.gd-nav-btn:hover:not(:disabled) { background: var(--dv-paleblue, #E9F3FA); }
.gd-nav-btn:disabled { opacity: .3; cursor: default; }
.gd-nav-count { font-size: 13px; font-weight: 600; color: var(--dv-ink, #1D2B25); min-width: 34px; text-align: center; font-variant-numeric: tabular-nums; }

/* ---------- live editing (v6.2) ---------- */
.gd-doc { position: relative; }
.gd-edit { cursor: text; border-radius: 3px; transition: outline-color .15s, background-color .15s; outline: 1.5px dashed transparent; outline-offset: 2px; }
.gd-edit:hover { outline-color: rgba(29, 91, 53, .45); }
.gd-edit.is-editing { outline: 2px solid var(--dv-green); outline-offset: 2px; background: rgba(255, 255, 255, .14); caret-color: currentColor; }
.gd-edit.is-saving { opacity: .55; }
.gd-lockable { cursor: pointer; }
.gd-pop {
  position: absolute; z-index: 30; max-width: 300px;
  padding: 12px 14px; border-radius: 12px;
  background: #17221c; color: #fff; font-size: 14px; line-height: 1.4;
  box-shadow: 0 12px 30px rgba(10, 20, 15, .25);
  animation: gdPopIn .18s cubic-bezier(.22, .8, .24, 1);
}
.gd-pop b { color: var(--dv-yellow); font-weight: 600; }
.gd-pop-s { margin-top: 2px; font-size: 12.5px; color: #c9d3ce; font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.gd-pop-b {
  margin-top: 10px; height: 32px; padding: 0 12px; border: 0; border-radius: 9px;
  background: #dff3a6; color: #23310b; font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer;
}
.gd-pop-b:hover { filter: brightness(.95); }
@keyframes gdPopIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .gd-pop { animation: none; } }
