/*
 * object.css: the object page, the one frame every class's page uses (spec/src/fos-object.tsp, @screen control-page), on the May look.
 * Linked after tokens.css, shell.css, control-page.css and console.css (whose shared pieces, .bus-part, .bus-card, .bus-dl, .bus-tag,
 * .bus-loading, .bus-empty and the test-data mark, it reuses until they move to one shared sheet). It sets only .obj-* classes and
 * declares no value of its own. Design: ui/object/DESIGN.md.
 */

/* The page grid: the block's 1:2. The side third holds the flow; on a phone, Details first and the flow one tap away (decision 166). */
.obj-grid { display: grid; gap: var(--cp-gap, 1rem); align-items: start; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); }
.obj-side { position: sticky; top: calc(var(--sp-5) + 40px); max-height: calc(100vh - 2 * var(--sp-5) - 40px); overflow: auto; }
.obj-info { display: flex; flex-direction: column; gap: var(--cp-gap, 1rem); min-width: 0; }
.obj-switch { display: none; gap: var(--sp-2); margin: var(--sp-3) 0 0; }
.obj-switch .btn { flex: 1; justify-content: center; position: relative; }
.obj-switch .btn[aria-pressed='true'] { background: var(--bg-3); border-color: var(--accent); color: var(--text); }
.obj-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); display: inline-block; }
@media (max-width: 720px) {
  .obj-grid { display: flex; flex-direction: column; }
  .obj-switch { display: flex; }
  .obj-side { position: static; max-height: none; overflow: visible; }
  .obj-grid[data-view='details'] .obj-side, .obj-grid[data-view='flow'] .obj-info { display: none; }
}

/* The header line: state, dirty and orphan, each in words */
.obj-state { font-size: var(--fs-xs); font-weight: 600; border-radius: var(--r-sm); padding: 1px var(--sp-2); border: 1px solid var(--line-2); color: var(--text-2); order: 2; }
.obj-state[data-state='awake'] { color: var(--ok-text); border-color: var(--ok); }
.obj-state[data-state='retired'] { color: var(--text-3); border-style: dashed; }
.obj-flag { font-size: var(--fs-xs); border-radius: var(--r-sm); padding: 1px var(--sp-2); order: 2; }
.obj-flag-dirty { color: var(--warn); border: 1px solid var(--warn); }
[data-theme='light'] .obj-flag-dirty { color: var(--chip-warn-text); border-color: var(--chip-warn-text); }
.obj-flag-orphan { color: var(--danger); border: 1px solid var(--danger); }
.obj-where { order: 2; flex-basis: 100%; font-size: var(--fs-sm); color: var(--text-2); display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3); }
.obj-where a { color: var(--accent); text-decoration: none; display: inline-flex; align-items: center; min-height: var(--tap-min); min-width: var(--tap-min); }

/* Notices above the grid: retired, orphan */
.obj-notice { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-3); align-items: center; padding: var(--sp-2) var(--sp-3); margin-top: var(--sp-3); border-radius: var(--r-md); font-size: var(--fs-md); color: var(--text); }
.obj-notice-retired { border: 1px dashed var(--line-2); background: var(--bg-3); }
.obj-notice-orphan { border: 1px solid var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }

/* What it is */
.obj-purpose { margin: 0 0 var(--sp-3); font-size: var(--fs-lg); color: var(--text); }
.obj-runner { font-size: var(--fs-sm); color: var(--text-2); }

/* The children: the block's list, rows or icons */
.obj-child-state { margin-left: auto; }
.obj-class-head { margin: var(--sp-3) 0 var(--sp-1); font-size: var(--fs-xs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); }
.obj-class-head:first-child { margin-top: 0; }

/* What you can do: plain code actions; each asks why where the definition takes a reason */
.obj-actions { display: flex; flex-wrap: wrap; gap: var(--sp-2); }
.obj-settings { margin-top: var(--sp-3); }
.obj-why { margin-top: var(--sp-3); padding: var(--sp-3); border: 1px dashed var(--line-2); border-radius: var(--r-md); display: flex; flex-direction: column; gap: var(--sp-2); }
.obj-retire-word { color: var(--danger); }
body[data-obj='retired'] .obj-actions .btn, body[data-obj='retired'] .obj-settings .btn { background: var(--bg-3); color: var(--text-3); border-color: var(--line-2); cursor: not-allowed; }

/* The side bar: the flow, newest first */
.obj-flow { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.obj-entry { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 2px var(--sp-2); padding: var(--sp-2) 0; border-bottom: 1px solid var(--line); }
.obj-entry:last-child { border-bottom: 0; }
.obj-source { grid-row: 1 / span 3; align-self: start; font-size: var(--fs-xs); font-weight: 600; padding: 1px var(--sp-2); border-radius: var(--r-sm); border: 1px solid var(--line-2); color: var(--text-2); min-width: 64px; text-align: center; }
.obj-source[data-source='event'] { border-color: var(--series-1); }
.obj-source[data-source='run'] { border-color: var(--series-3); }
.obj-source[data-source='change'] { border-color: var(--series-2); }
.obj-summary { font-size: var(--fs-md); color: var(--text); overflow-wrap: anywhere; }
.obj-entry-meta { font-size: var(--fs-xs); color: var(--text-3); display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-2); }
.obj-cost { font-family: var(--mono); color: var(--text-2); }
.obj-secret { font-size: var(--fs-xs); color: var(--text-2); background: var(--bg-3); border: 1px solid var(--line-2); border-radius: 999px; padding: 0 var(--sp-2); white-space: nowrap; }
.obj-flow-filters { display: flex; flex-wrap: wrap; gap: var(--sp-1); margin-bottom: var(--sp-2); }
.obj-flow-filters .btn { min-height: var(--tap-min); min-width: var(--tap-min); justify-content: center; padding: var(--sp-1) var(--sp-3); }
.obj-flow-filters .btn[aria-pressed='true'] { background: var(--bg-3); border-color: var(--accent); color: var(--text); }
/* A link inside a sentence stays inline text (a link in a sentence is exempt from the tap floor, WCAG 2.5.8); its focus still shows. */
.obj-inline { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.obj-inline:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* A link that stands alone in a list item or a definition, not in running text, is a 44 px target (WCAG 2.5.8; THEME-2): one rule for every page. */
:is(li, dd) > a.obj-inline { display: inline-flex; align-items: center; min-height: var(--tap-min); min-width: var(--tap-min); }
/* The object named in a page's title is a link too, and on a phone it is a 44 px control like any other (issue 297: the Watch and schedule titles). */
@media (max-width: 720px) { .cp-title a.obj-inline, .cp-header-extra a.obj-inline, .obj-summary a.obj-inline { display: inline-flex; align-items: center; min-height: var(--tap-min); } }
.obj-where { align-items: center; }
.obj-settings .bus-dl { align-items: center; }
.obj-settings .bus-dl dd { align-items: center; }

/* A flow line opens what is behind it, in place: the sentence is the button. */
.obj-open { background: none; border: 0; padding: 0; margin: 0; font: inherit; color: var(--text); text-align: left; cursor: pointer; text-decoration: underline dotted var(--text-3); text-underline-offset: 3px; }
.obj-open:hover { color: var(--accent); }
.obj-open:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.obj-behind { grid-column: 2; margin-top: var(--sp-2); padding: var(--sp-2) var(--sp-3); background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--r-md); }
.obj-behind .bus-dl { margin: 0; }
.obj-behind-note { margin: var(--sp-1) 0 0; font-size: var(--fs-xs); }
@media (max-width: 720px) { .obj-open { display: inline-flex; align-items: center; min-height: var(--tap-min); min-width: var(--tap-min); } }
.obj-open { min-width: var(--tap-min); }

/* The class page's own rows (ui/classpage/): one per item, in number order. */
.cls-rows { list-style: none; display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: 0 0 var(--sp-2); padding: 0; }
/* A flow line opened in place (OPG-17); [hidden] must win over .bus-dl's own display. */
.obj-entry-detail { flex-basis: 100%; margin: var(--sp-2) 0 0; }
.obj-entry-detail[hidden] { display: none; }
.obj-open { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; text-decoration: underline dotted; }

/* Open it as: the screens that show this object, each a 44 px link (NAV-2). */
.obj-views { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-top: var(--sp-2); width: 100%; }
.obj-views-head { font-size: var(--fs-sm); color: var(--text-3); }
.obj-views a { min-height: var(--tap-min); display: inline-flex; align-items: center; }
