/* =====================================================================
   Feature 3 – not every note belongs in the report (slide "freigaben")
   Left: notes of one visit; each has an "Intern | Bericht" capsule with a
   sliding black block. Right: a real Bautagebuch page – dense, small print,
   numbered sections – released notes are added and the page grows.
   ===================================================================== */
.rf {
  position: absolute; inset: 0;
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  column-gap: clamp(24px, 3vw, 48px); align-items: start; align-content: start;
  padding-top: clamp(0px, 1.6vw, 28px);   /* fixed top: the page only grows downward */
  --rn-ink: #161615; --rn-line: #e8e5df; --rn-ease: cubic-bezier(0.2, 0, 0, 1);
}

/* ---------- left: the notes ---------- */
.rn-list { min-width: 0; }
/* heading like the folders in feature 2: name · count · hairline */
.rn-cap { margin: 0 0 6px; display: flex; align-items: center; gap: 7px; height: 20px; font-size: 13px; white-space: nowrap; }
.rn-cap b { font-weight: 600; color: var(--text); }
.rn-cap span { color: var(--muted); }
.rn-cap i { flex: 1; height: 1px; background: var(--border); margin-left: 4px; }

.rn-rows { list-style: none; margin: 0; padding: 0; }
.rn-row {
  position: relative; display: flex; align-items: center; gap: 12px;
  min-height: 62px; padding: 9px 0;
}
.rn-row + .rn-row { border-top: 1px solid var(--rn-line); }

.rn-thumb, .rn-glyph { flex: none; width: 42px; height: 42px; border-radius: 5px; }
.rn-thumb { background: center / cover no-repeat; }
.rn-glyph { display: grid; place-items: center; color: var(--rn-ink); }
.rn-glyph svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rn-glyph--task::after { content: ""; width: 16px; height: 16px; border-radius: 50%; box-shadow: inset 0 0 0 1.6px #a19d95; }
/* a question: a small question mark in a ring */
.rn-glyph--note::after { content: "?"; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 1.6px #a19d95; font-size: 11px; font-weight: 700; color: #8b877f; }

.rn-txt { flex: 1; min-width: 0; display: grid; gap: 2px; }
.rn-txt b { font-size: 14px; font-weight: 500; line-height: 1.25; color: var(--text); }
.rn-txt small { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* "Intern | Bericht": two words, one black block that slides to the chosen side */
.rn-seg {
  position: relative; flex: none; display: grid; grid-template-columns: 1fr 1fr;
  padding: 3px; border-radius: 999px; background: #ebe8e1;
}
.rn-seg__block {
  position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px);
  border-radius: 999px; background: var(--rn-ink);
  transition: transform 380ms var(--rn-ease);
}
.rn-row.is-out .rn-seg__block { transform: translateX(100%); }
.rn-seg button {
  position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  height: 28px; padding: 0 11px; border: 0; border-radius: 999px; background: none; cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 600; color: #8b877f; white-space: nowrap;
  transition: color 300ms var(--ease);
}
.rn-seg button svg { width: 11px; height: 11px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.rn-seg button[aria-checked="true"] { color: #fff; }
.rn-seg button:not([aria-checked="true"]):hover { color: var(--text); }
.rn-seg button:active { transform: scale(0.985); }
.rn-seg button:focus-visible { outline: 2px solid var(--rn-ink); outline-offset: 2px; }
/* the note that stays internal is looked at once: a quiet nudge of its block, nothing more */
.rn-row.is-kept .rn-seg__block { animation: rn-keep 700ms var(--rn-ease); }
@keyframes rn-keep { 0%, 100% { transform: none; } 35% { transform: translateX(14%); } }

/* ---------- right: the Bautagebuch page ---------- */
.rn-page {
  position: relative; min-width: 0;
  padding: clamp(16px, 1.7vw, 24px) clamp(16px, 1.7vw, 24px) clamp(12px, 1.3vw, 18px);
  background: #fff; border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(28, 28, 26, 0.08), 0 2px 4px -2px rgba(28, 24, 18, 0.12), 0 24px 40px -28px rgba(28, 24, 18, 0.35);
  font-size: 10px; line-height: 1.4; color: var(--text);
}
/* office header: wordmark left, document number right */
.rn-doc-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding-bottom: 8px; border-bottom: 1.5px solid var(--rn-ink); }
.rn-office { margin: 0; font-size: 10.5px; letter-spacing: 0.01em; color: var(--text-2); }
.rn-office b { font-weight: 700; color: var(--text); }
.rn-office span { display: block; margin-top: 1px; font-size: 8.5px; color: var(--muted); }
.rn-docno { margin: 0; text-align: right; font-size: 8.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.rn-docno b { display: block; font-size: clamp(14px, 1.2vw, 17px); letter-spacing: -0.01em; text-transform: none; color: var(--text); }

/* project data as a printed form table – everything filled in */
.rn-meta, .rn-firms { width: 100%; border-collapse: collapse; }
.rn-meta th, .rn-meta td, .rn-firms td { padding: 4px 0; border-bottom: 1px solid var(--rn-line); text-align: left; vertical-align: top; }
.rn-meta th { width: 15%; padding-right: 6px; font-weight: 400; color: var(--muted); white-space: nowrap; }
.rn-meta td { padding-right: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 0; }
.rn-firms td:first-child { width: 52%; }
.rn-firms td:last-child { color: var(--text-2); }

/* numbered section headings */
.rn-sec { display: flex; align-items: baseline; gap: 6px; margin: 11px 0 3px; font-size: 9px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text); }
.rn-sec i { font-style: normal; color: var(--muted); font-variant-numeric: tabular-nums; }

/* released notes are appended: the block opens to its height, then the content settles in */
.rn-add { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 520ms var(--rn-ease); }
.rn-add.is-in { grid-template-rows: 1fr; }
.rn-add__in { min-height: 0; overflow: hidden; }
.rn-add__in > * { opacity: 0; transform: translateY(4px); transition: opacity 380ms var(--ease) 140ms, transform 480ms var(--rn-ease) 140ms; }
.rn-add.is-in .rn-add__in > * { opacity: 1; transform: none; }

/* photos with captions; each takes its place as it comes in, no gap waits for it */
.rn-shots { display: flex; padding-top: 3px; }
.rn-shot {
  flex: 0 0 0%; min-width: 0; margin: 0; overflow: hidden; opacity: 0;
  transition: flex-basis 520ms var(--rn-ease), margin-right 520ms var(--rn-ease), opacity 380ms var(--ease) 160ms;
}
.rn-shot.is-in { flex-basis: calc(50% - 4px); margin-right: 8px; opacity: 1; }
.rn-shot.is-in:last-child { margin-right: 0; }
.rn-shot > span { position: relative; display: block; aspect-ratio: 16 / 10; overflow: hidden; }
.rn-shot > span i { position: absolute; inset: 0; background: center / cover no-repeat; }
.rn-shot figcaption { padding-top: 3px; font-size: 8.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.rn-item { display: flex; align-items: flex-start; gap: 7px; margin: 0; padding: 2px 0 3px; }
.rn-item span { flex: 1; min-width: 0; }
.rn-item em { flex: none; font-style: normal; font-size: 9px; color: var(--muted); padding-top: 1px; }
.rn-tick, .rn-ring { flex: none; width: 12px; height: 12px; margin-top: 1px; border-radius: 50%; }
.rn-tick { display: grid; place-items: center; background: var(--rn-ink); }
.rn-tick svg { width: 9px; height: 9px; fill: none; stroke: #fff; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
.rn-ring { box-shadow: inset 0 0 0 1.3px #a19d95; }

/* signature line and page number */
.rn-doc-foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-top: 14px; font-size: 8.5px; color: var(--muted); }
.rn-sign { display: grid; gap: 3px; min-width: 42%; }
.rn-sign i { display: block; height: 14px; border-bottom: 1px solid var(--text-2); }

/* ---------- tablet: tighter (must fit the 4:3 stage) ---------- */
@media (max-width: 1100px) {
  .rf { column-gap: 18px; padding-top: 0; }
  .rn-cap { font-size: 12px; }
  .rn-row { min-height: 50px; padding: 6px 0; gap: 9px; }
  .rn-thumb, .rn-glyph { width: 34px; height: 34px; }
  .rn-txt b { font-size: 12px; }
  .rn-txt small { font-size: 10.5px; }
  .rn-seg button { height: 24px; padding: 0 8px; font-size: 10.5px; }
  .rn-seg button svg { display: none; }
  .rn-page { padding: 12px; font-size: 9px; }
  .rn-office span, .rn-firms tr:nth-child(n + 3) { display: none; }
  .rn-meta tr:nth-child(3) { display: none; }
}

/* ---------- phone: list on top, compact page below (fits the 4:5 stage) ---------- */
@media (max-width: 560px) {
  .rf { grid-template-columns: minmax(0, 1fr); row-gap: 12px; }
  .rn-row { min-height: 44px; padding: 4px 0; }
  .rn-thumb, .rn-glyph { width: 30px; height: 30px; }
  .rn-txt small { display: none; }
  .rn-page { padding: 10px 12px; }
  .rn-meta, .rn-firms, .rn-page > .rn-sec, .rn-add:not(.rn-add--shots), .rn-doc-foot, .rn-shot figcaption, .rn-add--shots .rn-sec { display: none; }
  .rn-shots { padding-top: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .rn-seg__block, .rn-seg button, .rn-add, .rn-add__in > *, .rn-shot { transition: none; }
  .rn-row.is-kept .rn-seg__block { animation: none; }
}

/* ---------- hand-over from feature 2 ----------
   The stage stays opaque (data-handover); its own parts fade instead, so the page can
   appear exactly where the Bautagebuch file was and grow from there. */
.frs__slide:not(.is-active) .rf > * { opacity: 0; transition: opacity 320ms var(--ease); }
.frs__slide.is-active .rf > * { opacity: 1; transition: opacity 420ms var(--ease) 80ms; }
.rf.is-opening .rn-page { transition: none; }
/* after the page has opened, the list arrives row by row */
.rn-cap, .rn-row { transition: opacity 420ms var(--ease) var(--rn-d, 0ms), transform 560ms var(--rn-ease) var(--rn-d, 0ms); }
.rn-row:nth-child(1) { --rn-d: 60ms; } .rn-row:nth-child(2) { --rn-d: 120ms; } .rn-row:nth-child(3) { --rn-d: 180ms; }
.rn-row:nth-child(4) { --rn-d: 240ms; } .rn-row:nth-child(5) { --rn-d: 300ms; }
.rf.is-opening .rn-cap, .rf.is-opening .rn-row { opacity: 0; transform: translateY(8px); transition: none; }
