/* some style */

/* !!!UGLY!!! — one-screen-tall chain for the battle arena's flex
   layout. Wide screens only: on a phone the columns stack, and a
   one-screen-tall first column lets the second one (the Game panel)
   paint over its overflow. */
@media screen and (min-width: 769px) {
    html {
        height: 100%;
    }

    body {
        height: 100%;
    }

    #app {
        height: 100%;
    }

    #app > section {
        height: 100%;
    }

    #app > section > .container {
        height: 100%;
    }

    #app > section > .container > .columns {
        height: 100%;
    }

    #app > section > .container > .columns > .column.is-9 {
        height: 100%;
    }
}


.full-height-svg {
    display: block;
    height: 100%;
    width: 100%;
}

.battle-arena-page {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.battle-arena-layout {
    display: flex;
    flex: 1 1 auto;
    min-height: 0;
}

.battle-tools {
    width: 160px;
    flex-shrink: 0;
    overflow-y: auto;
}

.battle-tools > .panel {
    margin-bottom: 0.75rem;
}

.canvas-viewport {
    position: relative;
    overflow: hidden;
    flex: 1 1 auto;
    height: 100%;
    background: #fafafa;
}

.canvas-inspector {
    width: 220px;
    flex-shrink: 0;
    overflow-y: auto;
    margin-left: 0.75rem;
}

.canvas-viewport.is-armed {
    cursor: crosshair;
}

.canvas-world {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
}

.bordered {
    border-style: solid;
}

.is-bordered-ud {
    border-top-style: solid;
};

.is-editable {
    cursor: text;
    border-radius: 4px;
    padding: 0.2em 0.4em;
}

.is-editable:hover {
    outline: 1px dashed #b5b5b5;
}

.stress-box {
    min-width: 2.5em;
}

/* Aspect/boost titles editable inline on the battle canvas — the
   foreignObject they sit in is small, Bulma's default .input isn't. */
.canvas-object-title.input {
    height: 24px;
    min-height: 24px;
    font-size: 0.8rem;
    padding: 2px 4px;
    line-height: 1;
}

.canvas-object-title.is-editable {
    display: block;
    font-size: 0.8rem;
    line-height: 24px;
    padding: 0 4px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* Token captions and free-floating text labels — same idea, centered and
   a touch smaller since they're not sitting in a bordered card. */
.canvas-object-caption.input {
    height: 20px;
    min-height: 20px;
    font-size: 0.75rem;
    text-align: center;
    padding: 1px 4px;
    line-height: 1;
}

.canvas-object-caption.is-editable {
    display: block;
    font-size: 0.75rem;
    line-height: 20px;
    text-align: center;
    color: #333333;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* The drag-handle margin around a free-floating text label — invisible
   until hovered, so it's still discoverable as grabbable. */
.canvas-text-hit-area:hover {
    fill: rgba(0, 0, 0, 0.04);
}

/* About overlay trigger once logged in — a corner link, out of the
   GM's way (logged out, About is a tab instead). See views.cljs
   main-panel; color lives in themes.css. */
.about-link {
    position: fixed;
    bottom: 0.75rem;
    right: 1rem;
    font-size: 0.875rem;
    z-index: 30;
}

/* Phones — see docs/ui-notes.md "Mobile". The battle area stacks
   (tools under a fixed-height map), sheet headers wrap, and the Table
   page leaves room for its bottom bar. */
@media screen and (max-width: 768px) {
    .battle-arena-layout {
        flex-direction: column;
    }

    .battle-tools {
        width: 100%;
        order: 2;
    }

    .canvas-viewport {
        flex: none;
        height: 60vh;
    }

    .canvas-inspector {
        width: 100%;
        margin-left: 0;
    }

    .entity-card-header,
    .entity-card-header > .level-left,
    .entity-card-header > .level-right {
        flex-wrap: wrap;
        row-gap: 0.25rem;
    }

    /* Bulma's level halves don't shrink, so they'd never wrap */
    .level.entity-card-header > .level-left,
    .level.entity-card-header > .level-right {
        flex-shrink: 1;
        min-width: 0;
    }

    .table-page {
        padding-bottom: 3.5rem;
    }

    .about-link {
        display: none;
    }
}

/* Tablets: the tab row and the status/GM-Player toggle don't fit on
   one line, so the latter wraps under, and the tabs scroll sideways
   inside their own row if even they alone don't fit. */
.level.top-bar {
    flex-wrap: wrap;
    row-gap: 0.5rem;
}

.level.top-bar > .level-left {
    min-width: 0;
    max-width: 100%;
}

/* nav.-qualified: style.css loads before bulma.css. */
nav.table-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: flex;
    background-color: var(--theme-surface, #fff);
    border-top: 1px solid var(--theme-border, #dbdbdb);
}

.table-nav a {
    flex: 1;
    text-align: center;
    padding: 0.75rem 0;
}

/* Sheet card collapse toggle (widgets/entity-card): a CSS chevron,
   down when collapsed (expand), up when expanded (collapse). */
.card-toggle {
    background: none;
    border: none;
    color: inherit;
    cursor: pointer;
    padding: 0.25rem 0.6rem 0.25rem 0.1rem;
    line-height: 1;
}

.card-toggle .chevron {
    display: inline-block;
    width: 0.6em;
    height: 0.6em;
    border-right: 2px solid currentColor;
    border-bottom: 2px solid currentColor;
    transition: transform 0.15s;
}

.card-toggle .chevron.is-down {
    transform: translateY(-0.15em) rotate(45deg);
}

.card-toggle .chevron.is-up {
    transform: translateY(0.15em) rotate(-135deg);
}

.mini-map {
    display: block;
    width: 100%;
    height: 240px;
    background: #fafafa;
    border-radius: 6px;
}

/* Asset library — see docs/campaign-auth-notes.md "Asset library". */
.upload-drop-zone {
  border: 2px dashed var(--theme-border, #dbdbdb);
  border-radius: 6px;
  padding: 0.75rem;
  text-align: center;
}

.upload-drop-zone.is-dragover {
  border-color: var(--theme-primary, #3273dc);
}

.library-thumb img {
  object-fit: cover;
  background: var(--theme-surface-alt, #f5f5f5);
}

/* style.css loads before bulma.css, so these need the extra class to
   beat .input / .modal-card's own width. */
.tags .input.library-tag-input {
  width: 5.5rem;
  height: 1.5em;
}

.modal-card.asset-picker {
  width: min(56rem, calc(100vw - 2rem));
}

a.asset-pick {
  display: block;
  border-radius: 4px;
  padding: 2px;
  outline: 2px solid transparent;
}

a.asset-pick:hover,
a.asset-pick:focus {
  outline-color: var(--theme-primary, #3273dc);
}

.asset-pick-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Portraits on sheet cards — only rendered once set. */
.box.has-portrait::after {
  content: "";
  display: block;
  clear: both;
}

.entity-portrait {
  float: right;
  width: 7rem;
  margin: 0 0 0.75rem 0.75rem;
}

.entity-portrait img {
  display: block;
  width: 100%;
  border-radius: 6px;
}

.entity-avatar {
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  object-fit: cover;
  margin-right: 0.5rem;
}

@media (max-width: 768px) {
  .entity-portrait {
    width: 5rem;
  }
}

/* Handouts — see docs/campaign-auth-notes.md "Asset library". */
.handout-card.is-unrevealed .card-image {
  opacity: 0.5;
}

.modal-content.handout-viewer {
  width: auto;
  max-width: calc(100vw - 2rem);
}

.handout-viewer img {
  display: block;
  max-height: 85vh;
  max-width: 100%;
  margin: 0 auto;
  border-radius: 4px;
}

/* A handout is read whole (a letter, a map), so fit it rather than crop. */
.handout-card .library-thumb img {
  object-fit: contain;
}

/* An NPC's description reads as something they'd say. */
.entity-description.is-npc {
  font-style: italic;
  color: var(--theme-text-muted, #7a7a7a);
  margin-bottom: 0.75rem;
}
