/*
 * /try - the in-browser demo. The sheet, its linework and the markups are
 * drawn from the site's tokens, so the page follows the theme; red is kept
 * for the markups, as everywhere else.
 */

/* ------------------------------------------------------------ the intro -- */

.try-hero { padding-bottom: clamp(24px, 3vw, 40px); }
.try-hero-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px clamp(32px, 5vw, 72px); align-items: end; }
.try-hero h1 { font-size: clamp(40px, 5.2vw, 76px); }
.try-hero .lede { margin-top: 0; color: var(--ink); font-weight: 500; max-width: 34ch; }
.try-sub { margin: 16px 0 0; color: var(--muted); font-size: 15.5px; line-height: 1.6; max-width: 48ch; }
@media (max-width: 860px) { .try-hero-grid { grid-template-columns: minmax(0, 1fr); } .try-hero h1 { font-size: clamp(38px, 11vw, 64px); } }

.try-demo { padding-bottom: clamp(48px, 7vw, 96px); }
.tp-note { margin: 14px 2px 0; font-size: 13.5px; color: var(--quiet); }

.try-more { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; }
@media (max-width: 860px) { .try-more { grid-template-columns: minmax(0, 1fr); } }

/* ------------------------------------------------------------ the frame -- */

.tp {
  border: 1px solid var(--rule-2);
  border-radius: 16px;
  background: var(--surface, var(--paper));
  box-shadow: 0 40px 80px -48px rgba(15, 23, 42, .35);
  overflow: hidden;
}

/* The tool bar: tools on the left, zoom on the right. */
.tp-bar { display: flex; align-items: center; gap: 10px; padding: 8px; border-bottom: 1px solid var(--rule); background: var(--mist); }
.tp-tools { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: thin; padding: 2px; }
.tp-tool, .tp-ib, .tp-ab, .tp-chb, .tp-item {
  font: inherit; color: var(--ink); cursor: pointer;
  border: 1px solid transparent; background: transparent;
  transition: background .15s, border-color .15s, color .15s;
}
.tp-tool { display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 10px 0 9px; border-radius: 10px; font-size: 13.5px; font-weight: 600; white-space: nowrap; flex: none; }
@media (hover: hover) { .tp-tool:not([aria-pressed="true"]):hover, .tp-ib:hover, .tp-ab:hover:not(:disabled) { background: var(--paper); border-color: var(--rule-2); } }
.tp-tool[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--on-ink, #fff); }
.tp-tool kbd { min-width: 0; padding: 3px 5px; font-size: 10px; border-radius: 4px; border-bottom-width: 1px; background: transparent; color: var(--quiet); border-color: var(--rule-2); }
.tp-tool[aria-pressed="true"] kbd { color: inherit; border-color: currentColor; opacity: .75; }
.tp-tool svg, .tp-ib svg, .tp-ab svg { flex: none; }
.tp-zoom { display: flex; align-items: center; gap: 2px; flex: none; }
.tp-ib { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 10px; }
.tp-pct { min-width: 46px; text-align: center; font-size: 12px; color: var(--muted); }
.tp :focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* The sheet beside the markups list; the list goes under it on a phone. */
.tp-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; }
.tp-stage { display: flex; flex-direction: column; min-width: 0; border-right: 1px solid var(--rule); }
.tp-canvas {
  position: relative;
  height: clamp(360px, 64vh, 660px);
  overflow: hidden;
  background: var(--mist);
  touch-action: none;
  user-select: none; -webkit-user-select: none;
  cursor: crosshair;
  outline-offset: -3px;
}
.tp-canvas[data-tool="select"], .tp-canvas[data-tool="compare"] { cursor: grab; }
.tp-canvas[data-tool="compare"] { cursor: ew-resize; }
.tp-canvas.space, .tp-canvas.panning { cursor: grabbing; }
.tp-canvas[data-tool="select"] .mk[data-id] { cursor: move; }
.tp-canvas:not([data-tool="select"]) .mk { pointer-events: none; }
.tp-svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.tp-nojs { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 24px; text-align: center; color: var(--muted); }

.tp-input {
  position: absolute; z-index: 2; width: 220px; height: 36px; padding: 0 10px;
  font: 600 13px var(--mono); color: var(--red);
  background: var(--paper); border: 1.5px solid var(--red); border-radius: 6px;
  box-shadow: 0 10px 24px -14px rgba(15, 23, 42, .5);
}
.tp-input:focus { outline: 2px solid var(--ink); outline-offset: 2px; }
.tp-input[hidden] { display: none; }

/* The compare wipe's slider, under the sheet. */
.tp-wipe { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--rule); font-size: 11px; letter-spacing: .1em; color: var(--muted); }
.tp-wipe[hidden] { display: none; }
.tp-wipe input { flex: 1; accent-color: var(--ink); min-width: 0; height: 28px; }

.tp-status { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 14px; border-top: 1px solid var(--rule); }
.tp-status p { margin: 0; flex: 1; font-size: 13px; line-height: 1.45; color: var(--muted); }
.tp-finish { display: flex; gap: 6px; flex: none; }
.tp-finish .btn[hidden] { display: none; }

/* ------------------------------------------------------------ the panel -- */

.tp-panel { display: flex; flex-direction: column; gap: 14px; padding: 16px; min-width: 0; }
.tp-ph { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.tp-h { margin: 0; font: 700 18px/1.2 var(--display); letter-spacing: -.02em; }
.tp-h span { font-size: 12px; font-weight: 600; color: var(--quiet); margin-left: 4px; }
.tp-k { font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--quiet); }
.tp-field { display: grid; gap: 6px; }
.tp-field select {
  height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--rule-2);
  background: var(--paper); color: var(--ink); font: 500 14px var(--body);
}
.tp-empty { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.55; padding: 12px; border: 1px dashed var(--rule-2); border-radius: 10px; }
.tp-empty[hidden] { display: none; }
.tp-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 300px; overflow-y: auto; }
.tp-list:empty { display: none; }
.tp-item { width: 100%; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; text-align: left; border-color: var(--rule); }
@media (hover: hover) { .tp-item:hover { border-color: var(--rule-2); background: var(--mist); } }
.tp-item[aria-pressed="true"] { border-color: var(--red); background: var(--red-soft); }
.tp-in { font-size: 11px; color: var(--red); }
.tp-it { display: grid; min-width: 0; line-height: 1.25; }
.tp-it b { font-size: 13.5px; font-weight: 600; }
.tp-it small { font-size: 11.5px; color: var(--quiet); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-im { font-size: 12px; color: var(--ink); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tp-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--rule-2); border-radius: 10px; overflow: hidden; }
.tp-totals div { display: grid; gap: 4px; padding: 10px; }
.tp-totals div + div { border-left: 1px solid var(--rule); }
.tp-totals b { font-size: 13.5px; font-weight: 600; white-space: nowrap; }

.tp-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.tp-ab { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 11px; border-radius: 999px; border-color: var(--rule-2); font-size: 13px; font-weight: 600; }
.tp-ab svg { width: 15px; height: 15px; }
.tp-ab:disabled { opacity: .45; cursor: not-allowed; }
#tpClear:not(:disabled) { color: var(--red); }

.tp-changes { display: grid; gap: 8px; padding-top: 12px; border-top: 1px solid var(--rule); }
.tp-changes[hidden] { display: none; }
.tp-changes ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.tp-chb { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; text-align: left; font-size: 13.5px; border-color: var(--rule); }
@media (hover: hover) { .tp-chb:hover { border-color: var(--red); } }
.tp-chb span { display: grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--red); color: var(--red); font-size: 11px; font-weight: 600; }

@media (max-width: 900px) {
  .tp-body { grid-template-columns: minmax(0, 1fr); }
  .tp-stage { border-right: 0; border-bottom: 1px solid var(--rule); }
  .tp-canvas { height: clamp(300px, 92vw, 560px); }
}
@media (max-width: 640px) {
  .tp { border-radius: 12px; }
  .tp-bar { flex-wrap: wrap; gap: 4px; }
  .tp-tools { flex-basis: 100%; gap: 2px; }
  .tp-tool { position: relative; flex: 1 1 0; min-width: 38px; padding: 0; justify-content: center; }
  .tp-tool span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .tp-tool kbd { display: none; }
  .tp-zoom { margin-left: auto; }
  .tp-input { width: 180px; }
}

/* ------------------------------------------------------------ the sheet -- */

.tp-svg text { font-family: var(--mono); fill: var(--ink); }
.tp-paper { fill: var(--paper); stroke: var(--rule-2); stroke-width: .6; }
.tp-frame { fill: none; stroke: var(--ink); stroke-width: .9; }
.tp-wall { fill: none; stroke: var(--ink); stroke-width: 3; }
.tp-pt { fill: none; stroke: var(--ink); stroke-width: 1.1; }
.tp-gap { fill: var(--paper); }
.tp-door, .tp-thin { fill: none; stroke: var(--ink-3); stroke-width: .45; }
.tp-grid { fill: none; stroke: var(--faint); stroke-width: .35; stroke-dasharray: 10 2.5 2 2.5; }
.tp-bub { fill: var(--paper); stroke: var(--ink); stroke-width: .7; }
.tp-col { fill: var(--ink); }
.tp-sb { stroke: var(--ink); stroke-width: .35; }
.tp-beam { fill: none; stroke: var(--ink-3); stroke-width: 1.6; stroke-dasharray: 14 3 3 3; }
.tp-duct { fill: none; stroke: var(--ink-3); stroke-width: 8; }
.tp-duct-in { fill: none; stroke: var(--paper); stroke-width: 6.6; }
.tp-dif { fill: var(--paper); stroke: var(--ink-3); stroke-width: .6; }
.tp-tray { fill: none; stroke: var(--ink-3); stroke-width: .45; }
.tp-tray-r { fill: none; stroke: var(--ink-3); stroke-width: 3.6; stroke-dasharray: .45 2.4; }
.tp-pipe { fill: none; stroke: var(--ink-3); stroke-width: .9; stroke-dasharray: 9 2 2 2; }
.tp-spk { fill: var(--paper); stroke: var(--ink); stroke-width: .6; }
.tp-svg .tp-rn { font-size: 6.2px; font-weight: 600; text-anchor: middle; letter-spacing: .03em; }
.tp-svg .tp-ra { font-size: 4.6px; text-anchor: middle; fill: var(--quiet); }
.tp-svg .tp-s { font-size: 4.6px; fill: var(--muted); }
.tp-svg .tp-c { text-anchor: middle; }
.tp-svg .tp-fine { font-size: 4.7px; font-weight: 600; fill: var(--ink); }
.tp-svg .tp-g { font-size: 7px; font-weight: 600; text-anchor: middle; dominant-baseline: central; }
.tp-svg .tp-k { font-size: 3.8px; letter-spacing: .14em; fill: var(--quiet); text-transform: none; }
.tp-svg .tp-v { font-size: 6.4px; font-weight: 600; }
.tp-svg .tp-dt { font-size: 8px; font-weight: 600; letter-spacing: .04em; }
.tp-svg .tp-big { font-family: var(--display); font-size: 22px; font-weight: 800; letter-spacing: -.02em; }

/* Compare: the changes, the wipe line and its tags. */
.tp-chg { fill: var(--red-soft); stroke: var(--red); stroke-width: 1.5px; vector-effect: non-scaling-stroke; pointer-events: none; }
.tp-wl { stroke: var(--ink); stroke-width: 2px; vector-effect: non-scaling-stroke; }
.tp-wtag { fill: var(--ink); }
.tp-wh { fill: var(--ink); stroke: var(--paper); stroke-width: 2px; vector-effect: non-scaling-stroke; }
.tp-wa { fill: none; stroke: var(--paper); stroke-linecap: round; stroke-linejoin: round; }
.tp-svg .tp-wt { fill: var(--paper); font-weight: 600; text-anchor: middle; dominant-baseline: central; letter-spacing: .08em; }
#tpDiff, #tpWipeG, #tpDraftG { pointer-events: none; }

/* ---------------------------------------------------------- the markups -- */

.mk-s { fill: none; stroke: var(--red); stroke-width: 2px; vector-effect: non-scaling-stroke; stroke-linecap: round; stroke-linejoin: round; }
.mk-f { fill: var(--red-soft); }
.mk-a { fill: var(--red); }
.mk-hit { fill: none; stroke: transparent; stroke-width: 16px; vector-effect: non-scaling-stroke; pointer-events: stroke; }
.mk-in { pointer-events: all; }
.mk-tri { fill: var(--paper); stroke: var(--red); stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.mk-c { fill: var(--paper); stroke: var(--red); stroke-width: 2px; vector-effect: non-scaling-stroke; }
.mk-box { fill: var(--paper); stroke: var(--red); stroke-width: 1.5px; vector-effect: non-scaling-stroke; }
.tp-svg .mk-n { fill: var(--red); font-weight: 700; text-anchor: middle; dominant-baseline: central; }
.tp-svg .mk-l { fill: var(--red); font-weight: 600; text-anchor: middle; dominant-baseline: central; paint-order: stroke; stroke: var(--paper); stroke-linejoin: round; }
.tp-svg .mk-bt { text-anchor: start; stroke: none; }
.tp-svg .mk-l2 { font-weight: 500; }
.mk-close { fill: var(--paper); stroke: var(--red); stroke-width: 2px; vector-effect: non-scaling-stroke; }
.mk-draft .mk-s { stroke-dasharray: 6 4; }
.mk.sel .mk-s { stroke-width: 3px; }
.mk-bb { fill: none; stroke: var(--ink); stroke-width: 1px; stroke-dasharray: 4 3; vector-effect: non-scaling-stroke; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  .tp-tool, .tp-ib, .tp-ab, .tp-chb, .tp-item { transition: none; }
}
