/* The opening and the desk. The headline's two sentences are the posts;
   everything Lintel does between them is the beam that spans them. */

.opening { --proof: light-dark(#B3261E, #E5776C); padding-block: clamp(2.5rem, 6vw, 5rem) clamp(3rem, 6vw, 4.5rem); overflow: clip; }
.opening-stage { display: grid; grid-template-columns: minmax(0, 1fr); }
.eyebrow { margin: 0 0 1.4rem; font-variant: small-caps; text-transform: lowercase; letter-spacing: 0.1em; color: var(--ink-soft); }
:lang(zh) .eyebrow, :lang(hi) .eyebrow { text-transform: none; font-variant: normal; letter-spacing: 0.04em; }

/* One heading, read straight through; laid out as two posts with the beam between. */
.opening h1 { display: grid; grid-template-columns: minmax(0, 1fr); margin: 0; font-size: clamp(2.7rem, 7.4vw, 6.6rem); line-height: 1.02; letter-spacing: -0.015em; }
.opening h1 .ins { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.h1-sign { justify-self: end; text-align: end; }
@supports (grid-template-rows: subgrid) {
  .opening-stage { grid-template-rows: auto auto auto auto auto; }
  .opening h1 { grid-row: 2 / 5; grid-column: 1; grid-template-rows: subgrid; }
  .eyebrow { grid-row: 1; }
  .h1-send { grid-row: 1; }
  .h1-sign { grid-row: 3; }
  .between { grid-row: 3; grid-column: 1; }
  .opening-foot { grid-row: 5; }
}

/* The beam: one file's dated moments. Under the brace it runs dot to dot, from
   the signed APS to the lawyer's own moment, signing and registration: the
   work "in between".
   The lines are per item, so the beam can wrap into rows or stand as a post. */
.between { --cols: 8; --rail: 0.6rem; --thin: 2px; --dot: 1.07rem; position: relative; z-index: 1; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); margin-block: clamp(1.2rem, 3vw, 2.2rem); }
.between .hand { grid-column: 1 / -1; --hand-indent: 0; margin: 0 auto 0.1em; text-align: center; font-size: clamp(1.4rem, 2.6vw, 2.2rem); rotate: -1.5deg; transform-origin: center; }
.brace { grid-column: 1 / -1; display: block; inline-size: calc(100% - 2 * var(--dot)); margin-inline: var(--dot); block-size: 1.1rem; margin-block-end: 0.5rem; overflow: visible; }
.brace path { fill: none; stroke: var(--proof); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.beam-line {
  grid-column: 1 / -1;
  list-style: none; margin: 0; padding: 0 0 0.6rem;
  display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
  font-size: 0.95rem; line-height: 1.25;
}
.beam-item { position: relative; display: grid; align-content: start; gap: 0.2rem; padding: calc(var(--rail) + 1.1rem) 0.4rem 0 0.75rem; }
/* The line under each moment: thin outside Lintel's span, the heavy beam within it. */
.beam-item::after { content: ""; position: absolute; inset-inline: 0; top: calc(var(--rail) / 2 - var(--thin) / 2); block-size: var(--thin); background: var(--ink); }
.beam-item.is-ours::after { top: 0; block-size: var(--rail); }
/* Dot to dot: from the signed APS to the lawyer's signature, and no further. */
.beam-item:first-child::after { inset-inline-start: var(--dot); }
/* The lawyer's moment closes the line at its right edge, under "Sign with your client." */
.beam-item.is-yours { text-align: end; justify-items: end; padding-inline: 0.4rem 0.75rem; }
.beam-item.is-yours::before { inset-inline: auto 0.75rem; }
.beam-item.is-yours::after { top: 0; block-size: var(--rail); inset-inline-end: var(--dot); }
.beam-item::before { content: ""; position: absolute; z-index: 1; inset-inline-start: 0.75rem; top: calc(var(--rail) / 2 - 0.32rem); inline-size: 0.64rem; block-size: 0.64rem; border-radius: 50%; background: var(--paper); box-shadow: 0 0 0 2px var(--ink); }
.beam-item time { font: 400 0.82rem/1.2 var(--type); letter-spacing: 0.04em; color: var(--ink-soft); white-space: nowrap; font-variant-numeric: lining-nums tabular-nums; }
.beam-item span { min-inline-size: 0; color: var(--ink); text-wrap: balance; hyphens: auto; overflow-wrap: break-word; }
/* The one moment that is the lawyer's: in oxblood, under the second post. */
.beam-item.is-yours::before { background: var(--oxblood); box-shadow: 0 0 0 2px var(--oxblood), 0 0 0 5px color-mix(in srgb, var(--oxblood) 25%, transparent); }
.beam-item.is-yours span { color: var(--oxblood); font-weight: 700; }
.beam-item.is-yours time { color: var(--oxblood); }

/* Agreement of Purchase and Sale: the term in the headline opens its definition. */
.term { font: inherit; letter-spacing: inherit; text-align: start; color: inherit; background: none; border: 0; padding: 0; margin: 0; cursor: help; anchor-name: --term;
  text-decoration: underline dotted color-mix(in srgb, var(--oxblood) 70%, transparent); text-decoration-thickness: 0.045em; text-underline-offset: 0.12em; text-decoration-skip-ink: none; }
.term:hover, .opening:has(.definition:popover-open) .term { text-decoration-style: solid; text-decoration-color: var(--oxblood); }
.term:focus-visible { outline: 3px solid var(--brass); outline-offset: 0.12em; }
.definition {
  inline-size: min(25rem, calc(100vw - 2rem)); margin: auto; padding: 1rem 1.25rem 1.1rem;
  color: var(--ink); background: var(--sheet); font: 400 1.05rem/1.45 var(--serif);
  border: 1px solid color-mix(in srgb, var(--ink) 22%, transparent); border-top: 0.4rem solid var(--ink);
  box-shadow: 0 0.8rem 2rem -0.6rem rgb(0 0 0 / 0.35);
}
.definition p { margin: 0; }
.definition-name { margin-bottom: 0.35rem !important; }
.definition dfn { font: 400 1.35rem/1.2 var(--display); font-style: normal; color: var(--oxblood); }
.definition::backdrop { background: transparent; }
@supports (anchor-name: --term) {
  /* Under the term, kept a rem inside the viewport on narrow screens. */
  .definition { position-anchor: --term; inset: auto; top: anchor(bottom); left: clamp(1rem, anchor(left), calc(100vw - 1rem - min(25rem, 100vw - 2rem))); margin: 0.7rem 0 0; position-try-fallbacks: flip-block; }
}
@media (prefers-reduced-motion: no-preference) {
  .definition:popover-open { animation: moment-in 180ms var(--ease-out); }
}

.opening-foot { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 1rem 4rem; align-items: end; margin-top: clamp(1.8rem, 4vw, 3rem); }
.opening-lede { margin: 0; max-width: 34em; font-size: 1.3rem; }
.opening-fee { margin: 0 0 0.9rem; }
.opening-fee strong { color: var(--oxblood); }
.opening-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem 1.6rem; margin: 0; }
.text-link { display: inline-flex; align-items: center; min-block-size: 44px; }

.beam-item:nth-child(2) { --i: 1; } .beam-item:nth-child(3) { --i: 2; } .beam-item:nth-child(4) { --i: 3; } .beam-item:nth-child(5) { --i: 4; }
.beam-item:nth-child(6) { --i: 5; } .beam-item:nth-child(7) { --i: 6; } .beam-item:nth-child(8) { --i: 7; } 

/* Arrival: the beam is set from left to right, then the words are written in. */
@media (prefers-reduced-motion: no-preference) {
  .is-arriving .beam-line { animation: rail-set 700ms var(--ease-out) 150ms both; }
  .is-arriving .beam-item { animation: moment-in 420ms var(--ease-out) calc(380ms + var(--i, 0) * 70ms) both; }
  .is-arriving .brace path { stroke-dasharray: 1; animation: brace-draw 700ms var(--ease-in-out) 1050ms both; }
  .is-arriving .between .hand { animation: hand-in 500ms var(--ease-out) 1500ms both; }
}
@keyframes rail-set { from { clip-path: inset(-2rem 100% -40rem 0); } to { clip-path: inset(-2rem 0 -40rem 0); } }
@keyframes moment-in { from { opacity: 0; transform: translateY(-0.4rem); } }
@keyframes brace-draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@keyframes hand-in { from { opacity: 0; clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 -5% 0 0); } }

@media (max-width: 960px) {
  .between { --cols: 4; }
  .between .hand { grid-column: 1 / -1; }
  .brace { display: none; }
  .beam-line { row-gap: 1.2rem; }
  .opening-foot { grid-template-columns: minmax(0, 1fr); }
}
/* Narrow screens: the beam stands as a post, read top to bottom. */
@media (max-width: 600px) {
  .between { --cols: 1; --rail: 0.4rem; }
  .opening h1 { font-size: clamp(2.45rem, 11.5vw, 3.4rem); }
  .between .hand { text-align: start; rotate: -2deg; transform-origin: left; margin-inline-start: 1.6rem; }
  .beam-line { row-gap: 0; padding: 0; }
  .beam-item { grid-template-columns: 4.6rem minmax(0, 1fr); gap: 0.6rem; padding: 0.45rem 0 0.45rem 1.7rem; align-items: baseline; }
  .beam-item::after, .beam-item.is-ours::after { inset-inline: calc(0.5rem - var(--thin) / 2) auto; top: 0; bottom: 0; block-size: auto; inline-size: var(--thin); }
  .beam-item.is-ours::after { inset-inline-start: calc(0.5rem - var(--rail) / 2); inline-size: var(--rail); }
  .beam-item::before { inset-inline-start: calc(0.5rem - 0.32rem); top: 0.8rem; }
  .beam-item:first-child::after { top: calc(0.8rem + 0.32rem); }
  .is-ours:has(+ .is-yours)::after { inset-inline-end: auto; bottom: calc(-0.8rem - 0.32rem); }
  .beam-item.is-yours { text-align: start; justify-items: stretch; padding-inline: 1.7rem 0; }
  .beam-item.is-yours::before { inset-inline: calc(0.5rem - 0.32rem) auto; }
  .beam-item.is-yours::after { display: none; }
  .opening-lede { font-size: 1.15rem; }
}

/* ---- The desk: finished drafts, flagged where judgment is needed -------- */
.desk { margin-block: 5rem; padding-block: 4.5rem; background: color-mix(in srgb, var(--paper-deep) 70%, transparent); border-block: 1px solid color-mix(in srgb, var(--ink) 18%, transparent); }
.desk-grid { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 3rem 4.5rem; align-items: start; }
.kicker { margin: 0 0 0.6rem; font-variant: small-caps; text-transform: lowercase; letter-spacing: 0.1em; color: var(--oxblood); }
:lang(zh) .kicker, :lang(hi) .kicker { text-transform: none; font-variant: normal; letter-spacing: 0.04em; }
.desk-copy p:not(.kicker) { max-width: var(--measure); }
.desk-tabs { display: grid; gap: 0.35rem; margin-top: 2rem; max-width: 24rem; }
.desk-tabs[hidden] { display: none; }
.desk-tabs button {
  display: flex; align-items: baseline; gap: 0.7rem; min-block-size: 48px; padding: 0.55rem 0.9rem; text-align: start;
  font: inherit; font-size: 1.1rem; color: var(--ink); background: transparent; cursor: pointer;
  border: 0; border-inline-start: 3px solid color-mix(in srgb, var(--ink) 20%, transparent); border-radius: 0;
}
.desk-tabs button span { font-family: var(--display); color: var(--ink-soft); min-inline-size: 1.8rem; }
.desk-tabs button:hover { background: color-mix(in srgb, var(--ink) 5%, transparent); }
.desk-tabs button[aria-selected="true"] { color: var(--oxblood); border-inline-start-color: var(--oxblood); background: var(--sheet); }
.desk-tabs button[aria-selected="true"] span { color: var(--oxblood); }
.desk-tabs button:focus-visible { outline: 3px solid var(--brass); outline-offset: 2px; }

/* Without script the three drafts lie fanned on the desk, all readable. */
.desk-docs { display: grid; gap: 1.5rem; }
.desk.is-tabbed .desk-docs { gap: 0; }
.doc[hidden] { display: none; }
.doc {
  position: relative; padding: 1.6rem 1.8rem 1.4rem; background: var(--sheet); color: var(--ink);
  border: 1px solid color-mix(in srgb, var(--ink) 18%, transparent);
  box-shadow: 0 1px 0 color-mix(in srgb, var(--ink) 8%, transparent), 0.5rem 0.6rem 0 -0.1rem var(--paper), 0.5rem 0.6rem 0 0 color-mix(in srgb, var(--ink) 16%, transparent), 1rem 1.2rem 0 -0.1rem var(--paper), 1rem 1.2rem 0 0 color-mix(in srgb, var(--ink) 12%, transparent);
  margin-inline-end: 1rem; margin-block-end: 1.2rem;
}
.doc:focus-visible { outline: 3px solid var(--brass); outline-offset: 4px; }
.doc-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.4rem 1rem; padding-bottom: 0.8rem; margin-bottom: 1rem; border-bottom: 3px double color-mix(in srgb, var(--ink) 40%, transparent); }
.doc-head h3 { margin: 0; font-size: 1.55rem; }
.doc-stamp { margin: 0; padding: 0.1rem 0.6rem; font: 400 0.78rem/1.6 var(--type); letter-spacing: 0.12em; text-transform: uppercase; color: var(--oxblood); border: 1.5px solid var(--oxblood); rotate: -2deg; }
:lang(zh) .doc-stamp, :lang(hi) .doc-stamp { letter-spacing: 0.04em; }
.doc-body { font: 400 0.92rem/1.5 var(--type); color: var(--ink-soft); }
.doc-body p { margin: 0 0 0.7rem; }
.doc-re { color: var(--ink); }
.doc-sub { margin-top: 1rem !important; letter-spacing: 0.04em; }
/* Ruled lines of a draft, at set lengths (classes: the CSP allows no inline style). */
.w38 { --w: 38%; } .w42 { --w: 42%; } .w44 { --w: 44%; } .w46 { --w: 46%; } .w52 { --w: 52%; } .w54 { --w: 54%; } .w58 { --w: 58%; } .w60 { --w: 60%; } .w64 { --w: 64%; } .w70 { --w: 70%; } .w80 { --w: 80%; } .w82 { --w: 82%; } .w86 { --w: 86%; } .w88 { --w: 88%; } .w90 { --w: 90%; } .w92 { --w: 92%; } .w94 { --w: 94%; }
.ln { display: block; inline-size: var(--w); block-size: 0.42rem; margin-block: 0.5rem; border-radius: 1px; background: color-mix(in srgb, var(--ink) 13%, transparent); }
.doc-reqs { margin: 1rem 0 0; padding-inline-start: 1.6rem; }
.doc-reqs li { margin-bottom: 0.8rem; }
.doc-reqs li::marker { color: var(--ink-soft); }
.is-flag > span, tr.is-flag td > span { color: var(--ink); background: linear-gradient(transparent 55%, color-mix(in srgb, var(--brass-hi, #E2C77F) 55%, transparent) 55% 92%, transparent 92%); }
.doc-sheet { inline-size: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums lining-nums; }
.doc-sheet td { padding: 0.25rem 0; vertical-align: middle; }
.doc-sheet td:not(:first-child) { inline-size: 26%; text-align: end; color: var(--ink); }
.doc-sheet td .ln { margin: 0; }
.doc-total td { padding-top: 0.6rem; border-top: 1px solid color-mix(in srgb, var(--ink) 40%, transparent); font-weight: 700; }
.doc-list { list-style: none; margin: 0.4rem 0 0; padding: 0; display: grid; gap: 0.15rem; }
.doc-list li { display: flex; align-items: center; gap: 0.6rem; padding: 0.3rem 0; border-bottom: 1px dotted color-mix(in srgb, var(--ink) 25%, transparent); color: var(--ink); }
.doc-list li::before { content: "\2713"; flex: none; display: grid; place-items: center; inline-size: 1.15rem; block-size: 1.15rem; font-size: 0.75rem; color: var(--sheet); background: var(--buckram); border-radius: 2px; }
.doc-list .sign-here { margin-inline-start: auto; }
.sign-here { padding: 0.2rem 0.6rem 0.2rem 0.5rem; color: #3C2A0C; background: #E9C766; clip-path: polygon(0 0, 88% 0, 100% 50%, 88% 100%, 0 100%); font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; }

/* Jane's flag: a slip clipped to the draft, the one thing she needs from you. */
.jane-note { display: grid; grid-template-columns: 2.25rem minmax(0, 1fr); gap: 0.8rem; align-items: start; margin: 1.4rem -0.4rem -0.2rem; padding: 0.9rem 1rem; background: color-mix(in srgb, var(--oxblood) 7%, var(--sheet)); border-inline-start: 3px solid var(--oxblood); }
.jane-note img { inline-size: 2.25rem; block-size: 2.25rem; border-radius: 50%; object-fit: cover; }
.jane-note p { margin: 0; font-size: 1.08rem; line-height: 1.45; }
.jane-note strong { font-weight: 700; }
.jane-note small { margin-inline: 0.3rem 0.5rem; font-size: 0.85rem; color: var(--ink-soft); }
.jane-note small::after { content: "\A"; white-space: pre; }
@media (prefers-reduced-motion: no-preference) {
  .desk.is-tabbed .doc:not([hidden]) { animation: doc-in 380ms var(--ease-settle) both; }
  .desk.is-tabbed .doc:not([hidden]) .jane-note { animation: moment-in 360ms var(--ease-out) 220ms both; }
}
@keyframes doc-in { from { opacity: 0; transform: translate(0.6rem, 0.5rem) rotate(0.6deg); } }

@media (max-width: 960px) {
  .desk-grid { grid-template-columns: minmax(0, 1fr); }
  .desk-tabs { grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: none; }
  .desk-tabs button { flex-direction: column; gap: 0.1rem; border-inline-start: 0; border-bottom: 3px solid color-mix(in srgb, var(--ink) 20%, transparent); font-size: 1rem; line-height: 1.2; }
  .desk-tabs button[aria-selected="true"] { border-bottom-color: var(--oxblood); }
}
@media (max-width: 600px) {
  .desk { padding-block: 3rem; margin-block: 3.5rem; }
  .doc { padding: 1.2rem 1.1rem 1rem; margin-inline-end: 0.6rem; }
  .desk-tabs button { padding: 0.5rem 0.4rem; font-size: 0.95rem; }
}

/* The walkthrough sits below the fold now, so its title is a section heading. */
.walkthrough { margin-block: 2rem 0; }
.lsc-hero h2 { font: 2.35em/1.08 var(--lsc-display, var(--display)); letter-spacing: -0.01em; margin: 0; color: var(--lsc-ink, var(--ink)); text-wrap: balance; }
.lsc-hero-copy h2 { margin-top: 0.2em; }
@container lsc (min-width: 900px) {
  .lsc-hero { grid-template-areas: ". chat" "copy chat" "actions chat" ". chat"; grid-template-rows: 1fr auto auto 1fr; }
  .lsc-hero h2 { font-size: 3.7em; }
  :lang(fr) .lsc-hero h2, :lang(es) .lsc-hero h2, :lang(zh) .lsc-hero h2, :lang(hi) .lsc-hero h2 { font-size: 2.9em; }
}

@media print {
  .desk-tabs { display: none !important; }
  .doc[hidden] { display: block; }
  .opening, .desk { background: none; }
}
@media (forced-colors: active) {
  .beam-line, .beam-item, .ln { forced-color-adjust: none; }
  .beam-item::after { background: CanvasText; }
  .ln { background: GrayText; }
  .beam-item::before { background: Canvas; box-shadow: 0 0 0 2px CanvasText; }
  .beam-item.is-yours::before { background: Highlight; }
  .desk-tabs button[aria-selected="true"] { border-color: Highlight; }
}
