/* The project's article in the window (article/articlePage.js): its head, its parts, each read on the left and its
   visual on the right, and its end, in the app's own px and in the project's own app's colour, --app-tint. It stands
   in the window's paper while the project feature does, and the paper scrolls it by --scroll, which the stage writes
   (stage/articleFraming.js). Narrower than 760 px, as on a phone, each part's words stand over its visual and its
   ideas under it. A project's own sheet (article-<id>.css) draws only what its visuals hold. */

.article { --move: cubic-bezier(.32, .72, 0, 1); --soft: cubic-bezier(.4, 0, .2, 1); display: none; position: absolute; left: 0; right: 0; top: 0; container-type: inline-size; padding-bottom: 120px; color: var(--ink); font: 15px/1.68 var(--face-sans); text-align: left; transform: translateY(calc(var(--scroll, 0px) * -1)); pointer-events: auto; }
.stage[data-state^="project"] .article { display: block; }
/* While the article stands, it is what is read, and not what is said of it under the section's words. */
.stage[data-state^="project"] [data-screen="project"] [data-told] { display: none; }
.article button, .article input { font: inherit; color: inherit; }
.article button { cursor: pointer; }
.article :where(h3, h4, h5, h6, p, ul, dl, dd, figure, blockquote) { margin: 0; }

/* ---- the head: what the project is ---- */
.ahead { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 18px; padding: 40px 56px 34px; }
.aicon { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 14px; background: var(--app-tint); transition: background-color .6s var(--soft); }
.aicon svg { width: 30px; height: 30px; fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ahead h3 { font-size: 30px; line-height: 1.2; font-weight: 650; letter-spacing: -0.022em; color: var(--ink-strong); }
.ahead .dek { max-width: 60ch; margin: 6px 0 10px; font: 19px/1.6 var(--face-serif); color: var(--muted); }
.ahead .how { max-width: 72ch; line-height: 1.75; }

/* ---- a part: its words, its visual and the controls under it, and the ideas it has left ---- */
.apart { display: grid; grid-template-columns: 380px minmax(0, 1fr); grid-template-rows: auto 1fr; grid-template-areas: "read see" "yours see"; column-gap: 56px; align-items: start; padding: 28px 56px 32px; border-top: 1px solid var(--hairline); }
.apart > .read { grid-area: read; }
.apart > .see { grid-area: see; min-width: 0; }
.apart > .yours { grid-area: yours; margin-top: 6px; }
.read h4 { margin-bottom: 6px; font-size: 23px; line-height: 1.3; font-weight: 650; letter-spacing: -0.012em; color: var(--ink-strong); }
.read .stand { margin-bottom: 10px; font: 16.5px/1.55 var(--face-serif); color: var(--muted); }
.read p:not(.stand) { margin-bottom: 10px; }

/* An underlined word: pointed at, focused or pressed, it lights what it names in the visual. */
.article .ref { padding: 0; border: 0; border-radius: 3px; background: none; color: var(--ink); line-height: inherit; text-align: inherit; text-decoration: underline 2px color-mix(in srgb, var(--app-tint) 80%, transparent); text-underline-offset: 4px; transition: background-color .3s var(--soft); }
.article .ref:is(:hover, :focus-visible, .on) { background: color-mix(in srgb, var(--app-tint) 18%, transparent); }
.article [data-lights] { transition: box-shadow .4s var(--soft), background-color .4s var(--soft); }
.article [data-lights].lit { border-radius: 8px; box-shadow: 0 0 0 2px var(--app-tint), 0 0 0 7px color-mix(in srgb, var(--app-tint) 24%, transparent); }

.facts { display: grid; grid-template-columns: 112px minmax(0, 1fr); margin: 12px 0; border-bottom: 1px solid var(--hairline); font-size: 14px; line-height: 1.55; }
.facts :is(dt, dd) { padding: 4px 0; border-top: 1px solid var(--hairline); }
.facts dt { color: var(--muted); }
.facts .filetag { margin-right: 4px; }
.read blockquote { margin-bottom: 4px; font: italic 15px/1.5 var(--face-serif); }
.read blockquote cite { display: block; margin-top: 3px; font: 12.5px/1.5 var(--face-sans); color: var(--muted); }

/* The visual, on a floor washed in the app's colour, and under it what changes it. */
.floor { display: flex; justify-content: center; align-items: center; min-height: 436px; padding: 20px 12px; border-radius: 18px; background: radial-gradient(120% 90% at 50% 0%, color-mix(in srgb, var(--app-tint) 13%, var(--panel)), var(--panel) 70%); outline-offset: 4px; }
.shelf { display: flex; flex-wrap: wrap; gap: 10px 18px; margin-top: 12px; }
.shelf .group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.shelf .glabel { margin-right: 2px; font-size: 12.5px; color: var(--muted); }
.article .ctl { display: flex; align-items: center; gap: 7px; min-height: 32px; padding: 5px 10px; border: 1px solid var(--hairline); border-radius: 10px; background: var(--paper); font-size: 13px; line-height: 1.3; transition: transform .45s var(--move), box-shadow .4s var(--soft), border-color .3s, background-color .3s; }
.article .ctl:hover { transform: translateY(-2px); border-color: var(--faint); box-shadow: 0 8px 16px -10px var(--deep); }
.article .ctl[draggable="true"] { cursor: grab; }
.article .ctl[aria-pressed="true"] { border-color: var(--app-tint); background: color-mix(in srgb, var(--app-tint) 13%, var(--paper)); }
.article .ctl svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linejoin: round; }
.article .swatch { width: 22px; height: 22px; padding: 0; border: 2px solid var(--paper); border-radius: 50%; background: var(--swatch); box-shadow: 0 0 0 1px var(--hairline); transition: box-shadow .3s, transform .45s var(--move); }
.article .swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ink); transform: scale(1.1); }
.article .slide { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.article .slide input { width: 160px; accent-color: var(--app-tint); }
.see figcaption { margin-top: 10px; font-size: 13.5px; line-height: 1.55; color: var(--muted); }

/* ---- the ideas a part leaves, and a thought of one's own ---- */
.yours { padding: 12px 14px 8px; border-radius: 12px; background: var(--panel); }
.yours h5 { margin-bottom: 2px; font-size: 13.5px; line-height: 1.5; font-weight: 600; color: var(--ink-strong); }
.article .empty { font-size: 13px; line-height: 1.6; color: var(--muted); }
.article ul.ideas { padding: 0; list-style: none; }
.article .ideas p { display: flex; align-items: flex-start; gap: 8px; padding: 6px 0; font: 14px/1.55 var(--face-serif); }
.article .ideas span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.article .takeout { flex: none; width: 26px; height: 26px; margin: -2px -4px 0 0; padding: 0; border: 0; border-radius: 6px; background: none; font-size: 15px; line-height: 26px; color: var(--muted); }
.article .takeout:hover { background: var(--hairline); color: var(--ink); }
.write { display: flex; align-items: center; gap: 6px; margin-top: 6px; border-top: 1px solid var(--hairline); }
.write:focus-within { border-top-color: var(--app-tint); }
.write input { flex: 1; min-width: 0; padding: 8px 0 4px; border: 0; outline: 0; background: none; font-size: 14px; }
.write input::placeholder { color: var(--muted); opacity: 1; }
.write .add { flex: none; height: 22px; padding: 0 7px; border: 1px solid var(--hairline); border-radius: 5px; background: none; font-size: 11px; color: var(--muted); }

/* ---- the end: every idea, as the start of an objective ---- */
.apart.end { grid-template-rows: auto; grid-template-areas: "read objective"; }
.end .objective { grid-area: objective; min-height: 240px; padding: 24px 28px; border: 1px solid var(--hairline); border-radius: 14px; box-shadow: 0 18px 50px -24px var(--deep); }
.end .objective h5 { margin-bottom: 10px; font-size: 22px; line-height: 1.3; font-weight: 650; color: var(--ink-strong); }
.end .objective h6 { margin: 0 0 4px; font-size: 16px; line-height: 1.5; font-weight: 600; color: var(--ink-strong); }
.end .objective .empty { font-size: 14.5px; color: var(--faint); }
.end .objective .ideas p { font: 15px/1.6 var(--face-sans); }
.end .objective .ideas p::before { content: "•"; color: var(--muted); }

/* ---- narrow: one column, the words over the visual and the ideas under it ---- */
@container (width < 760px) {
  .ahead { grid-template-columns: 44px minmax(0, 1fr); gap: 12px; padding: 22px 18px 18px; }
  .aicon { width: 44px; height: 44px; border-radius: 11px; }
  .aicon svg { width: 24px; height: 24px; }
  .ahead h3 { font-size: 24px; }
  .ahead .dek { margin: 4px 0 8px; font-size: 16.5px; line-height: 1.5; }
  .ahead .how { line-height: 1.65; }
  .apart { grid-template-columns: minmax(0, 1fr); grid-template-rows: none; grid-template-areas: "read" "see" "yours"; row-gap: 14px; padding: 20px 18px 24px; }
  .apart > .yours { margin-top: 0; }
  .apart.end { grid-template-areas: "read" "objective"; }
  .read h4 { font-size: 21px; }
  .read .stand { font-size: 16px; }
  .facts { grid-template-columns: 104px minmax(0, 1fr); }
  .floor { min-height: 0; padding: 18px 8px; }
  .shelf { gap: 8px 14px; }
  .article .ctl { min-height: 36px; }
  .end .objective { min-height: 0; padding: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  .article, .article * { transition: none !important; }
}
