/*
  Copyright 2026 Joseph Anthony Abbott III

  Licensed under the Apache License, Version 2.0 (the "License");
  you may not use this file except in compliance with the License.
  You may obtain a copy of the License at

      http://www.apache.org/licenses/LICENSE-2.0

  Unless required by applicable law or agreed to in writing, software
  distributed under the License is distributed on an "AS IS" BASIS,
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  See the License for the specific language governing permissions and
  limitations under the License.
*/

/*
  The demo page's own styles (ADR-0030), ported from Nadir's nadir.css.
  They sit on jabbott.dev's stylesheet, which the page loads first, and
  use its tokens (--teal, --panel, --font...) so the page follows that
  site's look.
*/

.tp-sep { color: var(--text-3); letter-spacing: 0; }
.tp-mono { font-family: var(--mono); font-size: 0.92em; letter-spacing: 0; text-transform: none; }

.tp-run__text code,
.tp-run__note code,
.tp-c4__text code {
  padding: 0.05em 0.35em;
  font-family: var(--mono); font-size: 0.88em;
  color: #a9ecec;
  background: rgba(92, 203, 203, 0.08);
  border: 1px solid rgba(92, 203, 203, 0.16);
}

/* ---------- Runs and build ---------- */

.tp-demo {
  display: grid;
  grid-template-columns: minmax(0, 2.1fr) minmax(280px, 1fr);
  gap: 22px;
  align-items: start;
  margin-bottom: 56px;
}

.tp-player { padding: clamp(16px, 2.4vw, 26px); }
.tp-player__head {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 12px 20px;
  margin-bottom: 16px;
}
.tp-player__head .kicker { margin: 0; }
.tp-player__head .kicker a { color: inherit; }
.tp-player__head .kicker a:hover { color: var(--teal-hi); }
.tp-tabs[hidden] { display: none; }

.tp-run { margin: 0; }
.tp-run + .tp-run { margin-top: 28px; }
.js .tp-run + .tp-run { margin-top: 0; }
.tp-run[hidden] { display: none; }

/* A terminal, in the colors of jabbott.dev's code blocks. */
.tp-term {
  background: #0a0f11;
  border: 1px solid var(--line-2);
  border-left: 2px solid var(--teal);
  box-shadow: 0 0 0 1px rgba(92, 203, 203, 0.12), 0 18px 50px rgba(0, 0, 0, 0.5);
}
.tp-term__bar {
  display: flex; align-items: center; gap: 14px;
  margin: 0;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(41, 53, 58, 0.45);
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-3);
}
.tp-term__bar > span:nth-child(2) { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-term__bar > span:last-child { white-space: nowrap; }
.tp-term__lights { display: inline-flex; gap: 6px; }
.tp-term__lights span { width: 9px; height: 9px; border-radius: 50%; background: var(--slate); }
.tp-term__lights span:first-child { background: var(--teal); }
.tp-term__screen {
  margin: 0;
  height: clamp(340px, 58vh, 600px);
  padding: 16px 18px;
  overflow: auto;
  font-family: var(--mono); font-size: 13px; line-height: 1.6;
  color: #d9e3e6;
  white-space: pre;
  tab-size: 4;
}
.tp-term__prompt { color: var(--teal); user-select: none; }
.tp-term__elided { color: var(--text-3); font-style: italic; }

.tp-run__caption { padding-top: 18px; }
.tp-run__title {
  margin: 0 0 8px;
  font-size: clamp(20px, 2vw, 24px);
  font-weight: 500;
}
.tp-run__text { margin: 0 0 16px; color: var(--text-2); max-width: 72ch; }
.tp-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tp-run__note { margin: 0; color: var(--text-3); font-size: 13px; }

.tp-build { padding: 22px; }
.tp-spec { margin-bottom: 14px; }
.tp-spec dd a { color: var(--teal); }
.tp-subject { font-size: 13.5px; overflow-wrap: anywhere; }
.tp-subject .tp-mono { color: var(--text); }

.tp-milestones {
  list-style: none;
  margin: 0 0 20px; padding: 0;
  display: grid; gap: 7px;
}
.tp-milestone {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  grid-template-rows: auto 3px;
  gap: 3px 8px;
  font-size: 12.5px;
  color: var(--text-2);
}
.tp-milestone__id { font-family: var(--mono); color: var(--text-3); }
.tp-milestone__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-milestone__count { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); }
.tp-milestone__bar { grid-column: 1 / -1; background: var(--slate-2); }
.tp-milestone__bar span { display: block; height: 100%; background: var(--teal); }
.tp-milestone[data-state="done"] .tp-milestone__id { color: var(--teal); }
.tp-milestone[data-state="active"] { color: var(--text); }
.tp-milestone[data-state="active"] .tp-milestone__id,
.tp-milestone[data-state="active"] .tp-milestone__count { color: var(--amber); }
.tp-milestone[data-state="active"] .tp-milestone__bar span { background: var(--amber); }

/* ---------- Features ---------- */

.tp-features .section-head { flex-wrap: wrap; }
.tp-features .chips[hidden] { display: none; }
.tp-features__lede { margin: -6px 0 22px; color: var(--text-2); max-width: 70ch; }

.tp-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  gap: 16px;
}
.tp-feature {
  display: flex; flex-direction: column;
  padding: 20px 20px 18px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.tp-feature:hover { border-color: rgba(92, 203, 203, 0.45); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35); }
.tp-feature[hidden] { display: none; }
.tp-feature__name { margin: 4px 0 8px; font-size: 19px; font-weight: 500; line-height: 1.3; }
.tp-feature__summary { margin: 0 0 16px; color: var(--text-2); font-size: 14.5px; line-height: 1.6; flex: 1; }
.tp-feature__tasks .tag { font-family: var(--mono); font-size: 11px; padding: 2px 8px; }

.tp-status { letter-spacing: 0.08em; }
.tp-status--shipped { color: var(--green); }
.tp-status--in-progress { color: var(--amber); }
.tp-status--planned { color: var(--text-3); }
.tp-feature[data-status="planned"] { background: rgba(16, 19, 21, 0.55); }
.tp-feature[data-status="planned"] .tp-feature__name { color: var(--text-2); }

/* ---------- Architecture ---------- */

.tp-arch { margin-bottom: 56px; }
.tp-arch__lede { margin: -6px 0 22px; color: var(--text-2); max-width: 70ch; }
.tp-arch__lede a { color: var(--teal); }

.tp-c4 { margin: 0; padding: clamp(16px, 2.4vw, 26px); }
.tp-c4 + .tp-c4 { margin-top: 22px; }
.tp-c4__title {
  margin: 0 0 8px;
  font-size: clamp(19px, 1.9vw, 22px);
  font-weight: 500;
}
.tp-c4__text { margin: 0 0 16px; color: var(--text-2); max-width: 72ch; }
.tp-c4__scroll { overflow-x: auto; }
.tp-c4__svg { display: block; width: 100%; min-width: 1040px; height: auto; }
.tp-c4__hint { display: none; margin: 8px 0 0; color: var(--text-3); font-size: 12.5px; }

.tp-c4-legend {
  list-style: none;
  margin: 18px 0 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 8px 22px;
  font-size: 13px; color: var(--text-2);
}
.tp-c4-legend li { display: flex; align-items: center; gap: 8px; }
.tp-c4-key { display: inline-block; width: 26px; height: 16px; border: 1.5px solid; border-radius: 3px; }
.tp-c4-key--person { border-color: var(--amber); background: rgba(242, 194, 0, 0.12); border-radius: 8px; }
.tp-c4-key--tidepool { border-color: var(--teal); background: rgba(92, 203, 203, 0.14); }
.tp-c4-key--external { border-color: rgba(255, 255, 255, 0.22); background: rgba(41, 53, 58, 0.85); }
.tp-c4-key--planned { border-color: var(--text-3); border-style: dashed; }
.tp-c4-key--files { border-color: rgba(255, 255, 255, 0.22); border-radius: 8px / 4px; background: rgba(41, 53, 58, 0.85); }

/* The diagrams' own drawing: inline SVG, in the site's tokens. */
.tp-c4__svg { font-family: var(--font); }
.c4-type { font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; fill: var(--text-3); }
.c4-title { font-size: 15px; font-weight: 600; fill: var(--text); }
.c4-desc { font-size: 12px; fill: var(--text-2); }
.c4-shape { stroke-width: 1.5; }
.c4-shape--rim { fill: none; }
.c4-node--system .c4-shape,
.c4-node--container .c4-shape,
.c4-node--store .c4-shape { fill: rgba(92, 203, 203, 0.14); stroke: var(--teal); }
.c4-node--system .c4-type,
.c4-node--container .c4-type,
.c4-node--store .c4-type { fill: var(--teal); }
.c4-node--person .c4-shape { fill: rgba(242, 194, 0, 0.12); stroke: var(--amber); }
.c4-node--person .c4-type { fill: var(--amber); }
.c4-node--external .c4-shape { fill: rgba(41, 53, 58, 0.85); stroke: rgba(255, 255, 255, 0.22); }
.c4-node--external .c4-type { fill: var(--text-2); }
.c4-node--planned .c4-shape { fill: rgba(11, 12, 13, 0.4); stroke: var(--text-3); stroke-dasharray: 6 5; }
.c4-node--planned .c4-type { fill: var(--text-3); }
.c4-node--planned .c4-title { fill: var(--text-2); font-weight: 500; }
.c4-node--planned .c4-desc { fill: var(--text-3); }
.c4-node--store .c4-shape--rim,
.c4-node--external .c4-shape--rim { fill: none; }
.c4-boundary rect {
  fill: rgba(92, 203, 203, 0.035);
  stroke: rgba(92, 203, 203, 0.45);
  stroke-width: 1.2;
}
.c4-boundary__title { font-size: 14px; font-weight: 600; fill: var(--teal); }
.c4-boundary__type { font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; fill: var(--text-3); }
.c4-edge { fill: none; stroke: rgba(238, 242, 243, 0.55); stroke-width: 1.4; }
.c4-edge--planned { stroke: var(--text-3); stroke-dasharray: 5 4; }
.c4-arrow path { fill: rgba(238, 242, 243, 0.55); }
.c4-arrow--planned path { fill: var(--text-3); }
.c4-label rect { fill: #0f1214; }
.c4-label text { font-size: 11.5px; fill: var(--text-2); }
.c4-label--planned text { fill: var(--text-3); }
.tp-layer__band { fill: rgba(92, 203, 203, 0.035); stroke: rgba(92, 203, 203, 0.3); stroke-width: 1; }

/* ---------- Narrow screens ---------- */

@media (max-width: 960px) {
  .tp-demo { grid-template-columns: minmax(0, 1fr); }
}

/* Where the diagrams are wider than their panel and scroll. */
@media (max-width: 1180px) {
  .tp-c4__hint { display: block; }
}

@media (max-width: 560px) {
  .tp-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tp-term__screen { font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .tp-feature { transition: none; }
}
