/* Demo "dela": Delat i skolan: the school dialog (school.css), a sidebar that is a panel or a drawer, and the veil between teachers. */

/* One sidebar for both layouts: a panel above 760px, the kit's drawer below (the timeline aims the cursor at "Delat i skolan") */
.dela-side .dela-ico-phone { display: none; }
@container rp (max-width: 760px) {
  .rp-window .rp-sidebar.dela-side {
    display: flex; position: absolute; z-index: 30; top: 0; bottom: 0; left: 0; width: min(320px, 88%); margin: 0; padding: 12px;
    border-radius: 0 var(--rp-sheet-radius) var(--rp-sheet-radius) 0; background: var(--rp-glass-pop);
    -webkit-backdrop-filter: var(--rp-glass-blur-calm); backdrop-filter: var(--rp-glass-blur-calm); box-shadow: var(--rp-glass-shadow-pop);
    transform: translateX(-102%); visibility: hidden; transition: transform 0.26s var(--rp-ease), visibility 0s 0.26s;
  }
  .dela-side::before, .dela-side::after { display: none; }
  .rp-window[data-drawer="open"] .rp-sidebar.dela-side { transform: none; visibility: visible; transition: transform 0.26s var(--rp-ease); }
  .dela-side .dela-ico-desk { display: none; }
  .dela-side .dela-ico-phone { display: block; }
}
/* Two older provs leave room for the folded Kurser and the account row, on a phone's crop (620 px high) and in the sidebar of a screen */
.dela-side .dela-r3 { display: none; }

.dela-nowrap { white-space: nowrap; }

/* Hem next to the sidebar (the kit's band; on a phone the app's top bar sits above it) */
.dela-home { grid-column: 2; grid-row: 1 / -1; min-width: 0; min-height: 0; overflow: hidden; }
.dela-home-bar { display: none; }
@container rp (max-width: 760px) {
  .dela-home { flex: 1 1 auto; }
  .dela-home-bar {
    display: flex; align-items: center; gap: 10px; height: 52px; padding: 0 12px; background: var(--rp-glass);
    -webkit-backdrop-filter: var(--rp-glass-blur); backdrop-filter: var(--rp-glass-blur); box-shadow: 0 0.5px 0 var(--rp-line);
  }
}

/* The veil: the sky comes over the app, names the next teacher's account and goes again */
.dela-veil {
  position: absolute; inset: 0; z-index: 60; display: grid; place-items: center; border-radius: inherit; pointer-events: none; opacity: 0; transition: opacity 0.4s ease;
  background: url('../img/kit/sky-desktop.webp') center / cover no-repeat;
}
.dela-veil.is-on { opacity: 1; }
.dela-veil-who {
  display: flex; align-items: center; gap: 12px; max-width: calc(100cqw - 32px); padding: 10px 22px 10px 12px; box-sizing: border-box;
  border: 1px solid var(--rp-glass-edge); border-radius: var(--rp-pill-radius); background: var(--rp-glass-pop);
  -webkit-backdrop-filter: var(--rp-glass-blur-calm); backdrop-filter: var(--rp-glass-blur-calm); box-shadow: var(--rp-glass-shadow-pop);
  color: var(--rp-text); font-size: 15px; font-weight: 600;
}
.dela-veil-who .rp-avatar { width: 36px; height: 36px; font-size: 15px; }
@container rp (max-width: 599.98px) { .dela-veil { background-image: url('../img/kit/sky-phone.webp'); } }

/* The dialog: the kit's top-anchored sheet (is-top, is-full on a phone); what is inside it is school.css's */
.dela-dialog :is(h2, h3, h4) { overflow-wrap: anywhere; }
.dela-dialog p { margin: 0; line-height: 1.5; }
.dela-dialog img { max-width: none; }

.dela-head { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; padding: 14px 16px 14px 20px; background: var(--rp-surface-raised); }
.dela-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dela-mark { display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 10px; background: var(--rp-accent-soft); color: var(--rp-accent); }
.dela-title-text { display: grid; gap: 1px; min-width: 0; }
.dela-title h2 { font-size: 18px; font-weight: 650; letter-spacing: -0.015em; line-height: 1.45; }
.dela-title-text p { color: var(--rp-text-2); font-size: 12.5px; line-height: 1.45; overflow-wrap: anywhere; }
.dela-head-tools { display: flex; align-items: center; gap: 4px; min-width: 0; }
.dela-icon-btn { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 8px; color: var(--rp-text-2); }

/* The school dialog's buttons are the app's 36px ones: taller than the kit's .rp-btn, and they wrap */
.dela-dialog .rp-btn { height: auto; min-height: 36px; padding: 6px 14px; line-height: 1.45; text-align: center; white-space: normal; overflow-wrap: anywhere; }
.dela-dialog .rp-btn.dela-danger { color: var(--rp-danger); border-color: color-mix(in srgb, var(--rp-danger) 45%, transparent); }
.dela-dialog .rp-btn.dela-back { justify-self: start; border-color: transparent; background: var(--rp-fill); }
.dela-item-actions .rp-btn { gap: 4px; }

.dela-content { padding: 18px 20px 28px; display: grid; gap: 16px; align-content: start; }
/* The pane ends at the note (data-dk-scroll-to), as the app leaves it near the top of the reader */
.dela-viewer-note { scroll-margin-top: 12px; }
.dela-lede { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 13.5px; color: var(--rp-text-2); }
.dela-more { color: var(--rp-accent); font-weight: 550; }
.dela-quiet { color: var(--rp-text-2); font-size: 13.5px; }
.dela-note { padding: 10px 14px; border-radius: 12px; background: var(--rp-fill); font-size: 13.5px; }

.dela-panel { display: grid; gap: 16px; min-width: 0; }
.dela-pane, .dela-list-view { display: grid; gap: 12px; min-width: 0; }
.dela-tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; border-bottom: 1px solid var(--rp-line); margin: 0 -4px; padding: 0 4px; }
.dela-tabs::-webkit-scrollbar { display: none; }
.dela-tabs button {
  position: relative; flex: none; height: 40px; padding: 0 12px; border: 0; border-radius: 8px 8px 0 0; background: transparent;
  color: var(--rp-text-2); font-size: 13.5px; font-weight: 550; white-space: nowrap;
}
.dela-tabs button::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; border-radius: 2px; background: var(--rp-accent); transform: scaleX(0); transition: transform var(--rp-dur) var(--rp-ease); }
.dela-tabs button[aria-current="page"] { color: var(--rp-text); font-weight: 650; }
.dela-tabs button[aria-current="page"]::after { transform: scaleX(1); }

.dela-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; justify-content: space-between; min-width: 0; }
.dela-row label { flex: 1 1 180px; }
.dela-dialog label { display: grid; gap: 6px; min-width: 0; font-size: 12.5px; font-weight: 550; color: var(--rp-text-2); }
.dela-dialog input {
  width: 100%; min-width: 0; height: 36px; padding: 0 12px; box-sizing: border-box;
  border: 1px solid var(--rp-line-strong); border-radius: 10px; background: var(--rp-surface); color: var(--rp-text); font: inherit; font-size: 14px; font-weight: 400;
}
.dela-dialog input::placeholder { color: var(--rp-text-3); opacity: 1; }

/* The shared list */
.dela-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.dela-items > li {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; min-width: 0; padding: 10px 12px;
  border-radius: var(--rp-card-radius); background: var(--rp-surface); border: 1px solid var(--rp-line); overflow-wrap: anywhere;
}
.dela-item-icon { display: inline-grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 10px; background: var(--rp-fill); color: var(--rp-text-2); }
.dela-item-text { display: grid; gap: 2px; flex: 1 1 200px; min-width: 0; }
.dela-item-text strong { font-weight: 600; }
.dela-item-text small { display: block; color: var(--rp-text-2); font-size: 12.5px; }
.dela-item-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; flex-wrap: wrap; }

/* The reader */
.dela-viewer { display: grid; gap: 12px; min-width: 0; }
.dela-viewer h3 { font-size: 17px; font-weight: 650; line-height: 1.45; }
.dela-viewer-body { display: grid; gap: 12px; min-width: 0; }
.dela-viewer-actions { justify-content: flex-start; }
.dela-pdf { position: relative; display: flex; flex-direction: column; overflow: hidden; height: min(calc(var(--rp-vh) * 0.65), 700px); min-height: 190px; border-radius: var(--rp-card-radius); background: var(--rp-desk); }
.dela-pdf-scroller { flex: 1 1 auto; min-height: 0; overflow: hidden; }
.dela-pages { display: flex; flex-direction: column; align-items: center; padding: 28px 28px 96px; gap: 24px; }
.dela-page { flex: none; width: 100%; background: #fff; box-shadow: var(--rp-shadow-paper); border-radius: 2px; line-height: 0; }
.dela-page img { display: block; width: 100%; height: auto; border-radius: 2px; }
.dela-zoom {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 3; display: flex; align-items: center; gap: 2px; padding: 4px;
  background: color-mix(in srgb, var(--rp-surface-raised) 78%, transparent); -webkit-backdrop-filter: blur(18px) saturate(1.6); backdrop-filter: blur(18px) saturate(1.6);
  border: 1px solid var(--rp-line); border-radius: var(--rp-pill-radius); box-shadow: var(--rp-float-shadow); color: var(--rp-text-2);
}
.dela-zoom > span { display: grid; place-items: center; min-width: 30px; height: 30px; padding: 0 6px; border-radius: var(--rp-pill-radius); }
.dela-zoom > .dela-zoom-label { width: 54px; min-width: 0; padding: 0; font-size: 12.5px; font-weight: 600; color: var(--rp-text-2); }
.dela-zoom-sep { width: 1px; height: 16px; margin: 0 3px; background: var(--rp-line-strong); }
.dela-zoom > .dela-zoom-page { min-width: 0; padding: 0 5px; font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.dela-source summary { cursor: pointer; font-size: 13.5px; font-weight: 550; color: var(--rp-text-2); }

/* Dela mitt original */
.dela-share { display: grid; gap: 18px; min-width: 0; }
.dela-share > h3 { font-size: 16px; font-weight: 650; line-height: 1.45; }
.dela-share > h3 + p { margin-top: -10px; }
.dela-fieldset { display: grid; gap: 10px; margin: 0; padding: 14px 16px; border: 1px solid var(--rp-line); border-radius: var(--rp-card-radius); min-width: 0; }
.dela-fieldset legend { padding: 0 4px; font-size: 13px; font-weight: 650; color: var(--rp-text); }
.dela-dialog .dela-check { display: flex; align-items: center; gap: 10px; margin: 0; padding: 6px 0; font-size: 14px; font-weight: 400; color: var(--rp-text); }
.dela-check input { width: 18px; height: 18px; flex: none; accent-color: var(--rp-accent); }
.dela-fieldset .rp-btn { justify-self: start; margin-top: 8px; }
.dela-section { display: grid; gap: 10px; min-width: 0; }
.dela-section h4 { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 650; line-height: 1.45; }
.dela-section .rp-btn { justify-self: stretch; }

@container rp (max-width: 600px) {
  .dela-content { padding: 14px 16px 24px; }
  .dela-head { gap: 6px; padding: 10px 12px 10px 16px; }
  .dela-mark { display: none; }
  .dela-item-text { flex-basis: 120px; }   /* the stage is 32px narrower than the app's phone, so the button stays beside the text */
}
@container rp (max-width: 640px) {
  .dela-pages { padding: 16px 12px 88px; }
  .dela-zoom > .dela-zoom-page, .dela-zoom-sep { display: none; }
}

/* In this inert sidebar the teacher cannot scroll. Only show complete examples above the pinned account. */
[data-demo="dela"] .rp-sidebar-scroll { container: sharing-sidebar / size; }
@container sharing-sidebar (max-height: 222px) { .dela-r3 { display: none; } }
@container sharing-sidebar (max-height: 176px) {
  .dela-r2, .rp-section:last-child { display: none; }
}
@container sharing-sidebar (max-height: 130px) { .dela-copy { display: none; } }
