/* What is Framme's own. The look of the page comes from `ekkel/ekkel.css`, loaded before this. */

/* ---- the shell -------------------------------------------------------------------------- */

body.pending > * { visibility: hidden; }
/* For somebody with no login: one page, so nothing to get around with. */
/* With nothing at its left, a page of one form sits in the middle, and the column is the window. */
body.bare { grid-template-columns: minmax(0, 1fr); --sidebar: 0px; --page-width: 100%; }
body.bare #sidebar { display: none; }
body.bare .narrow { margin-inline: auto; }
main:focus { outline: none; }
h1 > .logo { align-self: center; }

/* ---- lists ------------------------------------------------------------------------------ */

table.list.categories { --columns: 1fr 1fr repeat(5, max-content) max-content; }
table.list.frame-apps { --columns: 1fr repeat(4, max-content) max-content; }
table.list.frames { --columns: 1fr max-content max-content 1fr max-content max-content; }
table.list.formats { --columns: 1fr 2fr 2fr 1fr max-content; }
table.list.codecs { --columns: max-content max-content 3fr 1fr max-content; }
.template-about { max-width: 46rem; line-height: 1.5; }
.template-summary { margin: 0; max-width: 46rem; line-height: 1.5; }
.template-about p { margin: 0 0 .5rem; }
.template-about ul.params { margin: 0; padding-left: 1.2rem; }
.template-about li + li { margin-top: .5rem; }
.template-about ul.params ul.params { margin-top: .3rem; }
/* A codec's parameters are what its page is for, so they get more room than a fact's 8 lines. */
.facts pre.codec-params { max-height: calc(24 * 1.45em); }
table.list.sources { --columns: max-content 1fr 2fr repeat(3, max-content) max-content; }
table.list.versions { --columns: max-content 1fr 2fr; }
table.list.reports { --columns: max-content max-content 2fr max-content; }
table.list.events, .sections.events { --columns: max-content 2fr 1fr; }
/* A label over the days that follow it, as close to the first as a day is to its rows. */
.sections.events > section:has(> h2:only-child) + section > h2.day { margin-top: 0; }
.sections.seals, table.list.seal { --columns: max-content max-content 1fr max-content max-content; }
table.list.held-keys { --columns: max-content 1fr max-content max-content; }
table.list.link-keys { --columns: max-content 1fr max-content; }
/* JSON and tokens have no spaces to wrap at, and would hold their column as wide as they are. */
table.list :is(code, td.mono) { overflow-wrap: anywhere; }
/* Besides the space it brings, in running text. */
:is(td, .facts > div) > .badge { margin-left: .15rem; }
/* What is sealed, and with what: one colour wherever it shows. */
:root { --seal: light-dark(#7b44c9, #b79af2); --seal-soft: light-dark(#f1eafb, #2d2342); }
.badge.seal { background: var(--seal-soft); color: var(--seal); }
svg.seal-mark { width: 1.3em; height: 1.3em; flex: none; color: var(--seal); }
.badge:has(> svg.seal-mark) { display: inline-flex; align-items: center; gap: .25rem; }
.badge > svg.seal-mark { width: 1.25em; height: 1.25em; margin-right: -.15rem; }

/* Under the heading of what it is about. */
.status-switch { width: fit-content; margin-bottom: 1rem; }
section > .status-switch { margin-bottom: .5rem; }

/* Under a name being changed: where the old one stays. */
.outside p { margin: 0; }
.outside ul { margin: .2rem 0 0; padding-left: 1.2rem; }
.card > .warnings { margin: 0; padding: .8rem 1rem .8rem 2.2rem; }
.card + h2 { margin-top: 1.5rem; }
p.hint { margin: 1rem 0 .4rem; }
.cut-cell { display: grid; grid-template-columns: minmax(0, max-content); grid-auto-flow: column; grid-auto-columns: max-content;
  gap: .3rem .5rem; align-items: center; }
/* One line, cut short where the column is: the buttons beside it show or copy the whole of it. */
.cut-cell code { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* Under its caption, not after it: it is a line to paste, as long as the formats make it. */
.sends { display: flex; flex-direction: column; gap: .2rem; min-width: 0; }
.sends code { overflow-wrap: anywhere; }
.checks { display: flex; flex-wrap: wrap; gap: .25rem 1.5rem; }
/* Whether it takes what is not sealed belongs to the seal picked, so it sits beside it. */
.seal-choice { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; }
.seal-choice select { flex: 1 1 12rem; max-width: 24rem; }
/* Under the seals: what a device key is derived from besides a password. */
.salt { display: flex; align-items: center; gap: .5rem; max-width: 32rem; margin-top: 1.5rem; }
.salt > .copybox { flex: 1; }

/* ---- a category's items ----------------------------------------------------------------- */

/* Each tile is a column of rows shared across the grid, so that the parts of tiles side by side
   line up: the preview, the summary, then one row for each detail. */
.queue {
  --gap: .75rem;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: var(--gap);
}
.queue + h2 { margin-top: 1.5rem; }
.tile {
  position: relative; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: subgrid;
  grid-row: span 2; row-gap: 0; min-width: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.items.details .tile { grid-row: span var(--details-span); }
.tile[draggable=true] { cursor: grab; }
.tile.dragging { opacity: .4; }
.tile.over { border-color: var(--accent); }
.tile > .more { position: absolute; top: .3rem; right: .3rem; }
.preview {
  position: relative; grid-row: 1; min-height: 150px; background: var(--bg); display: grid; place-items: center; align-content: center;
  color: var(--muted); padding: .5rem; text-align: center; font-size: .85rem; overflow: hidden;
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
}
.preview img[role=button] { cursor: zoom-in; }
/* What says which codec a preview went through, or that it fell back to the file. */
.preview > .lens { position: absolute; top: .3rem; left: .3rem; max-width: calc(100% - 3rem); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview img { display: block; width: 100%; height: auto; max-height: calc(300px - 1rem); object-fit: contain; }
.preview.text { place-items: start stretch; text-align: left; }
.preview pre { margin: 0; max-height: calc(14 * 1.4em); line-height: 1.4; overflow: auto; color: var(--fg); }
.preview .paths { margin: 0; padding: 0; list-style: none; overflow-wrap: anywhere; color: var(--fg); }
.tile .info { grid-row: 2; padding: .5rem .6rem; display: flex; flex-direction: column; gap: .2rem; font-size: .85rem; }
.tile .info:empty, .tile .extra { display: none; }
.tile .extra {
  grid-row: 3 / -1; grid-template-rows: subgrid; grid-template-columns: max-content minmax(0, 1fr);
  gap: .2rem .6rem; margin: 0; padding: .5rem .6rem; border-top: 1px solid var(--line); font-size: .85rem;
}
.items.details .tile .extra { display: grid; }
.tile .extra dt { color: var(--muted); }
.tile .extra dd { margin: 0; overflow-wrap: anywhere; }
.tile .pos { font-weight: 600; font-size: 14px; }
.tile .meta { margin: 0; max-height: 6rem; overflow: auto; }
.tile .shown { display: flex; justify-content: space-between; gap: .5rem; }
.tile .marks { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem; }
/* An item's picture, as large as the window allows: at its own size on a click, to scroll around. */
dialog.modal.picture { width: fit-content; max-width: calc(100% - 2rem); }
/* Scrolling only at its own size: whole, it fits, and a scrollbar on the edge of being needed
   would come and go with every pixel of the window. */
.picture .modal-body { overflow: hidden; }
.picture .modal-body:has(img.actual) { overflow: auto; }
img.whole { display: block; max-width: calc(100vw - 5rem); max-height: calc(85vh - 6rem); }
/* With the pick of the file or what a frame shows above it. */
.picture.views .modal-body > .chips { margin-bottom: .75rem; }
.picture.views img.whole { max-height: calc(85vh - 8.75rem); }
img.whole.zoomable { cursor: zoom-in; }
img.whole.actual { max-width: none; max-height: none; cursor: zoom-out; }
/* Where an upload goes: a caret on the gap where it would land, and a line down the gap, or across
   it in a single column. The box is the gap, so it catches a pointer without covering a tile. */
.queue { position: relative; }
.insertion { position: absolute; z-index: 1; width: 0; height: 0; }
/* A pin whose tip reaches a little past the point: down over the row's top edge, or right over a
   tile's left edge where the queue is one column. */
.insertion::before {
  content: ""; position: absolute; left: -5.5px; top: -8px; width: 11px; height: 11px;
  border: 1.5px solid var(--accent); border-radius: 50% 50% 50% 1px; background: var(--accent-soft);
  transform: rotate(-45deg);
}
.insertion.across::before { left: -8px; top: -5.5px; transform: rotate(-135deg); }

/* ---- the upload page: nothing here is taller than a phone's screen, and the crop takes the
   touches ---------------------------------------------------------------------------------- */

.source { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.source input[type=file] { min-width: 0; }
.paste-here { min-width: 12rem; min-height: var(--control); padding: .3rem .5rem; border: 1px dashed var(--line); border-radius: 6px; }
.paste-here:empty::before { content: attr(data-placeholder); color: var(--muted); }
.outcome { display: flex; flex-direction: column; gap: .4rem; }
/* Of one height whatever the shape of the result, which the area pins its canvas to. */
.result { height: min(50vh, 32rem); display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: start; }
.result canvas { display: block; max-width: 100%; max-height: 100%; border: 1px solid var(--line); }
/* Cards like a category's tiles, whose rows are shared across the grid, so that the buttons of
   cards side by side line up whatever the shape of the images above them. */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr)); gap: .75rem; }
.thumb {
  display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: subgrid; grid-row: span 2;
  row-gap: 0; min-width: 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
/* Of one height too, whatever the shape of the image. */
.thumb-preview {
  position: relative; display: grid; place-items: center; height: 9rem; padding: .5rem; background: var(--bg);
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
}
.thumb-preview canvas { display: block; max-width: 100%; max-height: 8rem; cursor: zoom-in; }
.thumb-preview .badge { position: absolute; top: .3rem; left: .3rem; }
/* Leaving out sits at the top right, here and in the waiting room. */
:is(.thumb-preview, .waiting-preview) > .leave { position: absolute; top: .3rem; right: .3rem; }
.thumb-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; padding: .4rem .5rem; }
.stage { display: block; max-width: 100%; max-height: 50vh; touch-action: none; cursor: move; }
.adjust { display: flex; flex-direction: column; gap: .75rem; }
.editing { display: flex; flex-direction: column; align-items: flex-start; gap: .75rem; min-width: 0; }
.editing > :is(.sliders, .group, .framing, .tones, .codec-controls) { align-self: stretch; }
/* Wide enough, what it comes to stands beside the crop and the sliders, and stays in sight while
   they scroll. */
@media (min-width: 1100px) {
  dialog.modal.adjusting { max-width: 84rem; }
  .adjust { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1.5rem; align-items: start; }
  .adjust > .outcome { position: sticky; top: 0; }
  .adjust .result { height: calc(85vh - 15rem); }
}
.codec-controls { display: flex; flex-direction: column; gap: .75rem; }
/* Where areas overlap they add up, towards grey where all three do, apart from what is behind them. */
.histogram > svg { display: block; width: 100%; height: 4rem; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; }
.histogram g { isolation: isolate; }
.histogram path { stroke: none; }
.histogram g path { mix-blend-mode: screen; }
.histogram .red { fill: light-dark(#a03030, #903030); }
.histogram .green { fill: light-dark(#30a030, #309030); }
.histogram .blue { fill: light-dark(#3030a0, #303090); }
.histogram .grey { fill: var(--muted); }
.histogram .light { fill: none; stroke: var(--fg); stroke-width: 1.5px; }
.histogram-head { display: flex; justify-content: space-between; gap: .5rem; }
.histogram-head > .caption { color: var(--muted); font-size: .8rem; font-weight: 500; }
.histogram .clipped { display: flex; gap: .75rem; font-size: .8rem; font-variant-numeric: tabular-nums; }
.crop-help:not([hidden]) { display: contents; }
.thumb-trouble { flex-basis: 100%; min-width: 0; }

/* ---- the waiting room: images set aside, at the right over whatever page is open ----------- */

#waiting {
  position: fixed; top: 4rem; right: 1rem; z-index: 10; display: flex; flex-direction: column; gap: .4rem;
  width: 13rem; max-height: calc(100vh - 6rem); padding: .5rem .6rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
#waiting[hidden] { display: none; }
#waiting > button.unfolds { align-self: flex-start; }
/* Room round the cards for the outline of one being pointed at, which would be cut off where they
   scroll. */
.waiting-cards:not([hidden]) { display: flex; flex-direction: column; gap: .5rem; overflow-y: auto; min-height: 0; margin: 0 -.4rem;
  padding: .35rem .4rem; }
.waiting-card { flex: none; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.waiting-preview {
  position: relative; display: grid; place-items: center; height: 6rem; padding: .4rem; background: var(--bg);
  border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0;
}
.waiting-preview img { display: block; max-width: 100%; max-height: 5.2rem; cursor: zoom-in; }
.waiting-foot { display: flex; align-items: center; gap: .3rem; padding: .3rem .4rem; font-size: .85rem; }
.waiting-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.waiting-all:not([hidden]) { display: flex; justify-content: flex-end; }

@media (max-width: 760px) {
  /* An event a block, its cells one under another: three columns leave each too narrow to read. */
  table.list.events, table.list.events > tbody, table.list.events > * > tr, table.list.events td { display: block; }
  table.list.events > * > tr { padding: .6rem .9rem; border-top: 1px solid var(--line); }
  table.list.events > * > tr:first-child { border-top: none; }
  table.list.events td { padding: .1rem 0; border: none; }
  table.list.events td.time { white-space: normal; }
  table.list.events td.time .rel { display: inline; margin-left: .5rem; }
}
