/*
 * style.css
 * Author: GP
 * The look of the portal. BV turns books into pictures, so the portal reads like a well-made book's production
 * ledger: deep book-cloth blue for the frame, red only as the ribbon (the active tab, "ready for you", attention),
 * Literata (a typeface made for reading books) for headings and dates, Instrument Sans for everything you use.
 * The one bold element is the build map on the overview: one tile per feature, filling in as the build goes.
 * History: 17 Nov 2026 - first version; new look (book cloth and ribbon).
 */

@font-face {
  font-family: "Literata";
  src: url("/fonts/literata-latin-opsz-normal.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("/fonts/literata-latin-opsz-italic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("/fonts/instrument-sans-latin-wght-normal.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --cloth: #10204d;
  --cloth-2: #1b3478;
  --blue: #2a4fc4;
  --sky: #7fa2ff;
  --sky-soft: #e6edff;
  --ribbon: #d42a3c;
  --ribbon-dark: #a91d2d;
  --ribbon-soft: #fde9eb;
  --paper: #f2f4f9;
  --sheet: #ffffff;
  --ink: #131a2c;
  --slate: #56617a;
  --rule: #dfe3ee;
  --rule-strong: #c6cddd;
  --serif: "Literata", "Iowan Old Style", Georgia, serif;
  --sans: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  --shadow: 0 1px 0 rgb(16 32 77 / 0.04), 0 10px 28px -16px rgb(16 32 77 / 0.28);
  --wide: 1180px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 16px/1.6 var(--sans);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: var(--blue); text-underline-offset: 0.18em; text-decoration-thickness: 1px; }
a:hover { color: var(--cloth-2); }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; border-radius: 4px; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; color: var(--cloth); letter-spacing: -0.01em; line-height: 1.2; }
h1 { font-size: clamp(1.75rem, 1.3rem + 1.6vw, 2.4rem); margin: 0 0 0.4rem; font-variation-settings: "opsz" 48; }
h2 { font-size: 1.22rem; margin: 0 0 0.75rem; font-variation-settings: "opsz" 24; }
p { margin: 0 0 0.8rem; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--slate); }
.hint { color: var(--slate); font-size: 0.88rem; font-weight: 400; }
.red-text { color: var(--ribbon); }

/* ---------- the frame: masthead in book cloth, tabs with the ribbon ---------- */

.masthead {
  view-transition-name: masthead;
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 2rem;
  padding: 0.95rem max(1.25rem, calc((100vw - var(--wide)) / 2));
  color: #fff;
  background-color: var(--cloth);
  background-image:
    repeating-linear-gradient(45deg, rgb(255 255 255 / 0.028) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(-45deg, rgb(0 0 0 / 0.09) 0 1px, transparent 1px 3px);
}
.brand { display: inline-flex; align-items: center; gap: 0.8rem; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand .mark { color: #fff; flex: none; }
.brand-text { display: inline-flex; align-items: baseline; gap: 0.8rem; }
.brand-bv { font-family: var(--serif); font-weight: 700; font-size: 1.65rem; letter-spacing: 0.02em; line-height: 1; }
.brand-sub { padding-left: 0.8rem; border-left: 1px solid rgb(255 255 255 / 0.35); font-size: 1.02rem; font-weight: 500; letter-spacing: 0.01em; color: rgb(255 255 255 / 0.9); }
.account { display: flex; align-items: center; gap: 1.15rem; font-size: 0.92rem; }
.account a, .link-button { color: rgb(255 255 255 / 0.86); text-decoration: none; }
.account a:hover, .link-button:hover { color: #fff; text-decoration: underline; }
.account form { margin: 0; }
.who { display: inline-flex; align-items: center; gap: 0.45rem; padding: 0.22rem 0.7rem 0.22rem 0.3rem; border-radius: 999px; background: rgb(255 255 255 / 0.1); color: #fff; font-weight: 600; }
.who::before { content: ""; width: 1.25rem; height: 1.25rem; border-radius: 50%; background: linear-gradient(135deg, var(--sky), #fff); }
.link-button { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }

.tabs { view-transition-name: tabs; background: var(--sheet); border-bottom: 1px solid var(--rule); position: sticky; top: 0; z-index: 5; }
.tabs-inner { display: flex; gap: 0.25rem; max-width: var(--wide); margin: 0 auto; padding: 0 1.25rem; overflow-x: auto; scrollbar-width: none; }
.tabs a {
  position: relative; flex: none; display: block; padding: 1.05rem 0.95rem 0.8rem;
  color: var(--slate); font-weight: 560; text-decoration: none; white-space: nowrap; border-radius: 0;
}
.tabs a span { position: relative; }
.tabs a:hover { color: var(--cloth); }
.tabs a.active { color: var(--cloth); font-weight: 680; }
/* the ribbon: hangs from the top of the tab bar above the active tab, like a bookmark */
.tabs a.active::before {
  content: ""; position: absolute; top: 0; left: 50%; width: 0.85rem; height: 1.05rem; transform: translateX(-50%);
  background: var(--ribbon); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 72%, 0 100%);
}
.tabs a.active::after { content: ""; position: absolute; left: 0.95rem; right: 0.95rem; bottom: -1px; height: 2px; background: var(--cloth); }

main { max-width: var(--wide); margin: 0 auto; padding: 2rem 1.25rem 4rem; }
main.bare { max-width: none; padding: 0; }

/* ---------- shared pieces ---------- */

.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem 2rem; margin-bottom: 1.5rem; }
.lede { max-width: 68ch; color: var(--slate); font-size: 1.04rem; margin: 0; }
.crumb { margin: 0 0 0.3rem; font-size: 0.9rem; }
.crumb a { color: var(--slate); }
.sheet { background: var(--sheet); border: 1px solid var(--rule); border-radius: 12px; padding: 1.35rem 1.5rem; margin-bottom: 1.1rem; box-shadow: var(--shadow); }
.narrow-sheet { max-width: 760px; }
.prose { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 72ch; }
.prose.small { font-size: 0.9rem; color: var(--slate); }
.prose-page p { max-width: 68ch; }
.clamp { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.text-link { display: inline-block; margin-top: 0.4rem; font-weight: 600; text-decoration: none; }
.text-link:hover { text-decoration: underline; }

.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; min-height: 2.6rem;
  padding: 0.55rem 1.15rem; border-radius: 8px; border: 1px solid var(--cloth-2);
  background: var(--cloth-2); color: #fff; font: 600 0.96rem/1.2 var(--sans); text-decoration: none; cursor: pointer;
  transition: background-color 120ms ease, box-shadow 120ms ease, transform 120ms ease;
}
.button:hover { background: var(--cloth); color: #fff; }
.button:active { transform: translateY(1px); }
.button-red { background: var(--ribbon); border-color: var(--ribbon); }
.button-red:hover { background: var(--ribbon-dark); border-color: var(--ribbon-dark); }
.button-quiet { background: var(--sheet); color: var(--cloth-2); border-color: var(--rule-strong); }
.button-quiet:hover { background: var(--sky-soft); color: var(--cloth); }
.button-small { min-height: 2.1rem; padding: 0.35rem 0.85rem; font-size: 0.88rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }

label { display: block; font-weight: 600; font-size: 0.94rem; color: var(--ink); }
input:not([type=radio]):not([type=checkbox]):not([type=hidden]), select, textarea {
  display: block; width: 100%; margin-top: 0.35rem; padding: 0.62rem 0.75rem;
  font: 400 1rem/1.5 var(--sans); color: var(--ink);
  background: #fbfcfe; border: 1px solid var(--rule-strong); border-radius: 8px;
  transition: border-color 120ms ease, box-shadow 120ms ease, background-color 120ms ease;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue); background: #fff; box-shadow: 0 0 0 3px rgb(127 162 255 / 0.35); }
textarea { resize: vertical; }
.stack { display: grid; gap: 1rem; }
.stack.compact { gap: 0.7rem; }
.check { display: inline-flex; align-items: center; gap: 0.5rem; font-weight: 500; }
.check input { width: 1.05rem; height: 1.05rem; accent-color: var(--cloth-2); }
fieldset { border: 0; padding: 0; margin: 0; }
legend { font-weight: 600; font-size: 0.94rem; margin-bottom: 0.4rem; padding: 0; }

.flash { padding: 0.8rem 1rem; border-radius: 10px; margin: 0 0 1.25rem; border: 1px solid; font-weight: 500; }
.flash-note { background: var(--sky-soft); border-color: #c9d6ff; color: var(--cloth); }
.flash-error { background: var(--ribbon-soft); border-color: #f6c3c9; color: #7c1220; }

.pill { display: inline-flex; align-items: center; padding: 0.18rem 0.65rem; border-radius: 999px; font-size: 0.8rem; font-weight: 650; white-space: nowrap; }
.pill-blue { background: var(--sky-soft); color: var(--cloth-2); }
.pill-red { background: var(--ribbon); color: #fff; }
.pill-solid { background: var(--cloth-2); color: #fff; }
.pill-outline { border: 1px solid var(--ribbon); color: var(--ribbon); }

.kind-dot { display: inline-block; flex: none; width: 0.7rem; height: 0.7rem; border-radius: 3px; margin-right: 0.45rem; vertical-align: 0.02em; }
.kind-change { background: var(--cloth-2); }
.kind-bug { background: var(--ribbon); transform: rotate(45deg); border-radius: 2px; }
.kind-question { background: var(--sky); border-radius: 50%; }

.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--slate); }
.empty-title { font-family: var(--serif); font-size: 1.35rem; color: var(--cloth); margin-bottom: 0.4rem; }

.owner-tool > summary { cursor: pointer; font-weight: 650; color: var(--cloth-2); list-style: none; display: flex; align-items: center; gap: 0.5rem; }
.owner-tool > summary::-webkit-details-marker { display: none; }
.owner-tool > summary::before { content: "+"; display: inline-grid; place-items: center; width: 1.4rem; height: 1.4rem; border-radius: 6px; background: var(--sky-soft); color: var(--cloth-2); font-weight: 700; }
.owner-tool[open] > summary::before { content: "-"; }
.owner-tool[open] > summary { margin-bottom: 1rem; }
details.sheet.owner-tool { border-style: dashed; box-shadow: none; }

/* ---------- sign in ---------- */

.signin { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); min-height: 100vh; }
.signin-cloth {
  display: flex; flex-direction: column; justify-content: center; padding: 3rem clamp(2rem, 6vw, 6rem); color: #fff;
  background-color: var(--cloth);
  background-image:
    radial-gradient(ellipse at 20% 110%, rgb(127 162 255 / 0.28), transparent 60%),
    repeating-linear-gradient(45deg, rgb(255 255 255 / 0.03) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(-45deg, rgb(0 0 0 / 0.1) 0 1px, transparent 1px 3px);
}
.signin-mark .mark { color: #fff; }
.signin-title { font-family: var(--serif); font-weight: 700; font-size: clamp(4rem, 3rem + 5vw, 7.5rem); line-height: 0.95; margin: 1.5rem 0 0.6rem; letter-spacing: 0.01em; font-variation-settings: "opsz" 72; }
.signin-line { font-size: 1.25rem; color: rgb(255 255 255 / 0.85); max-width: 22ch; }
.signin-panel { display: flex; flex-direction: column; justify-content: center; padding: 3rem clamp(1.5rem, 6vw, 6rem); background: var(--sheet); }
.signin-panel > * { max-width: 26rem; width: 100%; }
.signin-panel .lede { margin-bottom: 1.6rem; }
.signin-panel .button { width: 100%; margin-top: 0.4rem; }

/* ---------- overview: hero with the build map ---------- */

.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 2.5rem; align-items: center;
  padding: 2.4rem 2.6rem; margin-bottom: 1.25rem; border-radius: 18px; color: #fff;
  background-color: var(--cloth);
  background-image:
    radial-gradient(ellipse at 100% 0%, rgb(127 162 255 / 0.22), transparent 55%),
    repeating-linear-gradient(45deg, rgb(255 255 255 / 0.025) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(-45deg, rgb(0 0 0 / 0.09) 0 1px, transparent 1px 3px);
  box-shadow: 0 24px 48px -28px rgb(16 32 77 / 0.6);
}
.hero h1 { color: #fff; font-size: clamp(2rem, 1.4rem + 2vw, 2.9rem); margin-bottom: 0.9rem; }
.hero-lede { font-family: var(--serif); font-size: 1.22rem; line-height: 1.55; color: rgb(255 255 255 / 0.92); white-space: pre-wrap; max-width: 46ch; }
.hero-lede.muted { color: rgb(255 255 255 / 0.65); }
.hero-count { color: rgb(255 255 255 / 0.85); margin-top: 1.2rem; }
.hero-count strong { color: #fff; font-family: var(--serif); font-size: 1.35rem; }
.hero-count .red-text { color: #ff8090; }
.hero .text-link { color: #fff; }

.build-map { margin: 0; }
.map-grid { display: flex; flex-wrap: wrap; gap: 0.55rem 0.7rem; align-content: flex-start; }
.map-group { display: flex; flex-wrap: wrap; gap: 4px; }
.tile { display: block; width: 15px; height: 19px; border-radius: 2px 3px 3px 2px; transition: transform 120ms ease; }
.tile:hover, .tile:focus-visible { transform: translateY(-2px) scale(1.15); }
.tile-not_started { background: rgb(255 255 255 / 0.09); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.18); }
.tile-in_progress { background: var(--sky); }
.tile-built { background: #fff; }
.tile-ready { background: var(--ribbon); box-shadow: 0 0 0 1px #ff8090, 0 0 12px rgb(255 90 110 / 0.55); }
.build-map figcaption { margin-top: 1.25rem; }
.hero .legend { color: rgb(255 255 255 / 0.88); }
.hero .key-not_started { background: rgb(255 255 255 / 0.12); box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.3); }
.hero .key-built { background: #fff; }

@keyframes tile-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.js .build-map .tile { animation: tile-in 420ms cubic-bezier(0.2, 0.7, 0.2, 1) both; }

.legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.25rem; list-style: none; padding: 0; margin: 0; font-size: 0.92rem; color: var(--slate); }
.legend li { display: inline-flex; align-items: center; gap: 0.45rem; }
.legend strong { font-family: var(--serif); font-size: 1.05rem; color: inherit; }
.key { display: inline-block; width: 0.8rem; height: 1rem; border-radius: 2px; }
.key-not_started { background: #fff; box-shadow: inset 0 0 0 1.5px var(--rule-strong); }
.key-in_progress { background: var(--sky); }
.key-built { background: var(--cloth-2); }
.key-ready { background: var(--ribbon); }

.milestones { margin: 0 0 1.25rem; padding: 1.4rem 1.6rem 1.1rem; background: var(--sheet); border: 1px solid var(--rule); border-radius: 12px; box-shadow: var(--shadow); }
.milestone-line { display: grid; grid-template-columns: repeat(3, 1fr); list-style: none; padding: 0; margin: 0; }
.milestone { position: relative; padding-top: 1.6rem; padding-right: 1rem; }
.milestone::before { content: ""; position: absolute; top: 0.55rem; left: 0; right: 0; height: 3px; background: var(--rule); }
.milestone:first-child::before { left: 0.6rem; }
.milestone:last-child::before { right: auto; width: 0; }
.ms-complete::before, .ms-shown::before { background: var(--cloth-2); }
.ms-dot { position: absolute; top: 0.1rem; left: 0; width: 1.2rem; height: 1.2rem; border-radius: 50%; background: #fff; border: 3px solid var(--rule-strong); }
.ms-in_progress .ms-dot { border-color: var(--sky); box-shadow: 0 0 0 4px rgb(127 162 255 / 0.25); }
.ms-shown .ms-dot { border-color: var(--cloth-2); }
.ms-complete .ms-dot { border-color: var(--cloth-2); background: var(--cloth-2); }
.ms-title { font-family: var(--serif); font-weight: 600; color: var(--cloth); margin: 0 0 0.1rem; font-size: 1.05rem; }
.ms-meta { color: var(--slate); font-size: 0.9rem; margin: 0; }

.overview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 1.1rem; }
.waiting { border-top: 3px solid var(--ribbon); }
.mini-list { list-style: none; padding: 0; margin: 0 0 0.4rem; }
.mini-list li { display: flex; justify-content: space-between; gap: 0.75rem; align-items: center; padding: 0.45rem 0; border-bottom: 1px solid var(--rule); }
.mini-list li:last-child { border-bottom: 0; }
.mini-list a { color: var(--ink); text-decoration: none; }
.mini-list a:hover { color: var(--blue); }
.log-day { font-family: var(--serif); font-weight: 600; color: var(--cloth); margin-bottom: 0.3rem; }
.decision-mini { list-style: none; padding: 0; margin: 0 0 0.4rem; }
.decision-mini li { padding: 0.4rem 0; border-bottom: 1px solid var(--rule); }
.decision-date { font-family: var(--serif); color: var(--ribbon); font-weight: 600; margin-right: 0.5rem; }
.milestone-forms { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 1.5rem; padding-top: 1.25rem; border-top: 1px solid var(--rule); }

/* ---------- requests ---------- */

.toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 0.75rem 1rem; margin-bottom: 1.1rem; }
.toolbar .inline-label { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; color: var(--slate); }
.toolbar .inline-label select { width: auto; margin: 0; }
.toolbar-note { margin-left: auto; color: var(--slate); font-size: 0.9rem; }
.item-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.55rem; }
.item-row {
  display: flex; align-items: center; gap: 0.9rem; padding: 1rem 1.2rem; text-decoration: none; color: inherit;
  background: var(--sheet); border: 1px solid var(--rule); border-radius: 10px; transition: border-color 120ms ease, box-shadow 120ms ease;
}
.item-row:hover { border-color: var(--sky); box-shadow: var(--shadow); color: inherit; }
.item-main { flex: 1; min-width: 0; display: grid; gap: 0.1rem; }
.item-title { font-weight: 640; font-size: 1.03rem; }
.item-num { color: var(--slate); font-weight: 600; font-variant-numeric: tabular-nums; }
.item-meta { color: var(--slate); font-size: 0.88rem; }
.item-side { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

.choice-row { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.choice-row legend { width: 100%; }
.choice input { position: absolute; opacity: 0; }
.choice-face { display: inline-flex; align-items: center; padding: 0.6rem 1rem; border: 1px solid var(--rule-strong); border-radius: 10px; font-weight: 600; cursor: pointer; background: #fbfcfe; }
.choice input:checked + .choice-face { border-color: var(--cloth-2); background: var(--sky-soft); box-shadow: inset 0 0 0 1px var(--cloth-2); }
.choice input:focus-visible + .choice-face { outline: 3px solid var(--sky); outline-offset: 2px; }

.item-heading { max-width: 40ch; }
.item-layout { display: grid; grid-template-columns: minmax(0, 1fr) 21rem; gap: 1.1rem; align-items: start; }
.item-aside { position: sticky; top: 4.5rem; }
.byline { display: flex; align-items: center; color: var(--slate); font-size: 0.92rem; margin-bottom: 1rem; }
.shots { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }
.shots img { display: block; width: 168px; height: 112px; object-fit: cover; border-radius: 8px; border: 1px solid var(--rule); }
.answer-sheet { border-left: 4px solid var(--cloth-2); }
.status-card { text-align: left; }
.status-label { color: var(--slate); font-size: 0.88rem; margin-bottom: 0.3rem; }
.status-pill .pill { font-size: 0.95rem; padding: 0.35rem 0.9rem; }
.agreement { font-size: 0.9rem; color: var(--cloth-2); background: var(--sky-soft); padding: 0.5rem 0.7rem; border-radius: 8px; }
.agree-fields { display: grid; gap: 0.6rem; padding: 0.75rem; border: 1px dashed var(--rule-strong); border-radius: 8px; }
.agree-fields[hidden] { display: none; }
.agree-fields legend { font-size: 0.85rem; color: var(--slate); padding: 0 0.3rem; }
.saved-version { background: var(--ribbon-soft); border-radius: 8px; padding: 0.6rem 0.75rem; }
.team-only { border-left: 4px solid var(--ribbon); background: linear-gradient(#fff, #fff) padding-box; }
.thread { list-style: none; padding: 0; margin: 0 0 1.25rem; display: grid; gap: 0.7rem; }
.thread li { padding: 0.8rem 1rem; border-radius: 10px; }
.from-team { background: var(--sky-soft); margin-right: 2.5rem; }
.from-client { background: #fff; border: 1px solid var(--rule); margin-left: 2.5rem; }
.thread-meta { font-size: 0.85rem; color: var(--slate); margin-bottom: 0.25rem; }
.thread-meta strong { color: var(--ink); margin-right: 0.35rem; }
.history { list-style: none; padding: 0; margin: 0; display: grid; gap: 0.55rem; font-size: 0.9rem; }
.history li { display: grid; gap: 0.05rem; padding-left: 0.85rem; border-left: 2px solid var(--rule); }
.history-when { color: var(--slate); font-size: 0.8rem; }
.team-line { border-left-color: var(--ribbon); color: var(--ribbon-dark); }
.history-detail summary { cursor: pointer; color: var(--slate); font-size: 0.82rem; }

/* ---------- features: the matrix ---------- */

.stage-bar { display: block; width: 100%; height: 10px; border-radius: 999px; overflow: hidden; }
.seg-track { fill: #edf0f6; }
.seg-ready { fill: var(--ribbon); }
.seg-built { fill: var(--cloth-2); }
.seg-in_progress { fill: var(--sky); }
.seg-not_started { fill: #edf0f6; }
.matrix-summary { display: grid; gap: 0.85rem; }
.matrix-tools { position: sticky; top: 3.4rem; z-index: 4; padding: 0.75rem 0; background: var(--paper); margin: 0; }
.matrix-tools[hidden] { display: none; }
.search input { width: 16rem; margin: 0; }
.segmented { display: inline-flex; background: #e8ebf3; border-radius: 9px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg-button { border: 0; background: transparent; padding: 0.42rem 0.8rem; border-radius: 7px; font: 600 0.86rem var(--sans); color: var(--slate); cursor: pointer; }
.seg-button.on { background: #fff; color: var(--cloth); box-shadow: 0 1px 2px rgb(16 32 77 / 0.15); }
.matrix-group { padding: 1.2rem 1.4rem 0.6rem; }
.group-head { display: grid; grid-template-columns: 1fr auto; align-items: baseline; gap: 0.2rem 1rem; margin-bottom: 0.6rem; }
.group-head h2 { margin: 0; }
.group-count { margin: 0; color: var(--slate); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.group-head .stage-bar { grid-column: 1 / -1; height: 6px; margin-top: 0.4rem; }

.matrix { width: 100%; border-collapse: collapse; }
.matrix thead th { font: 600 0.8rem var(--sans); color: var(--slate); text-align: center; padding: 0.5rem 0.25rem; border-bottom: 1px solid var(--rule); }
.matrix thead .col-feature { text-align: left; }
.matrix tbody tr { border-bottom: 1px solid var(--rule); }
.matrix tbody tr:last-child { border-bottom: 0; }
.matrix tbody tr:hover { background: #f8f9fd; }
.matrix tbody tr:target { background: var(--sky-soft); }
.matrix tbody tr[hidden] { display: none; }
.col-feature { text-align: left; font-weight: 400; padding: 0.75rem 1rem 0.75rem 0; width: 58%; }
.col-stage { width: 10.5%; }
.feature-id { display: block; font-size: 0.78rem; font-weight: 700; color: var(--slate); letter-spacing: 0.02em; font-variant-numeric: tabular-nums; }
.feature-text { display: block; font-size: 0.95rem; line-height: 1.5; }
.feature-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.35rem; }
.tag { font-size: 0.74rem; font-weight: 600; color: var(--cloth-2); background: var(--sky-soft); padding: 0.08rem 0.5rem; border-radius: 999px; }
.tag-stage { display: none; }

.cell { padding: 0; }
.stage-form { margin: 0; height: 100%; }
.cell-inner { position: relative; display: grid; place-items: center; width: 100%; height: 3rem; border: 0; background: none; padding: 0; font: inherit; }
button.cell-inner { cursor: pointer; }
.cell-inner::before { content: ""; position: absolute; top: 50%; left: 0; right: 0; height: 2px; margin-top: -1px; background: var(--rule); }
.cell-not_started .cell-inner::before { left: 50%; }
.cell-ready .cell-inner::before { right: 50%; }
.reached .cell-inner::before { background: var(--cloth-2); }
.current .cell-inner::before { right: 50%; }
.cell-not_started.current .cell-inner::before { display: none; }
.cell-mark { position: relative; display: grid; place-items: center; width: 0.95rem; height: 0.95rem; border-radius: 50%; background: #fff; border: 2px solid var(--rule-strong); color: #fff; font-size: 0.8rem; font-weight: 800; line-height: 1; transition: transform 140ms ease; }
.reached .cell-mark { background: var(--cloth-2); border-color: var(--cloth-2); }
.cell-not_started.reached .cell-mark { background: var(--rule-strong); border-color: var(--rule-strong); }
.current .cell-mark { width: 1.45rem; height: 1.45rem; }
.cell-in_progress.current .cell-mark { background: var(--sky); border-color: var(--sky); box-shadow: 0 0 0 4px rgb(127 162 255 / 0.25); }
.cell-built.current .cell-mark { box-shadow: 0 0 0 4px rgb(27 52 120 / 0.15); }
.cell-ready.current .cell-mark { background: var(--ribbon); border-color: var(--ribbon); box-shadow: 0 0 0 4px rgb(212 42 60 / 0.18); }
.cell-not_started.current .cell-mark { background: #fff; border-color: var(--rule-strong); }
button.cell-inner:hover .cell-mark { transform: scale(1.25); border-color: var(--blue); }
.matrix tr.saving { opacity: 0.6; }

/* ---------- log and decisions ---------- */

.log { list-style: none; padding: 0; margin: 0; position: relative; }
.log::before { content: ""; position: absolute; top: 0.4rem; bottom: 0; left: 0.42rem; width: 2px; background: var(--rule); }
.log-entry { position: relative; padding: 0 0 1.6rem 2rem; }
.log-entry::before { content: ""; position: absolute; left: 0; top: 0.35rem; width: 0.9rem; height: 0.9rem; border-radius: 50%; background: var(--paper); border: 3px solid var(--cloth-2); }
.log-entry .log-day { font-size: 1.15rem; }
.log-entry .prose { background: var(--sheet); border: 1px solid var(--rule); border-radius: 10px; padding: 0.9rem 1.1rem; max-width: 72ch; }
.log-meta { color: var(--slate); font-size: 0.82rem; margin-top: 0.4rem; }
.decisions { list-style: none; padding: 0; margin: 0; background: var(--sheet); border: 1px solid var(--rule); border-radius: 12px; box-shadow: var(--shadow); }
.decisions li { display: grid; grid-template-columns: 9rem minmax(0, 1fr); gap: 1rem; padding: 1rem 1.4rem; border-bottom: 1px solid var(--rule); }
.decisions li:last-child { border-bottom: 0; }
.decisions .decision-date { margin: 0; }

/* ---------- motion between pages ---------- */

@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 160ms; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  @view-transition { navigation: none; }
}

/* ---------- smaller screens ---------- */

@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; padding: 1.8rem 1.4rem; }
  .item-layout { grid-template-columns: 1fr; }
  .item-aside { position: static; }
}
@media (max-width: 760px) {
  main { padding: 1.4rem 1rem 3rem; }
  .masthead { padding: 0.8rem 1rem; }
  .brand-sub { font-size: 0.86rem; }
  .account a { display: none; }
  .tabs-inner { padding: 0 0.5rem; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .tabs a { padding: 1rem 0.75rem 0.75rem; }
  .signin { grid-template-columns: 1fr; }
  .signin-cloth { padding: 2.2rem 1.5rem 1.8rem; }
  .signin-title { font-size: 4rem; margin-top: 0.8rem; }
  .overview-grid, .milestone-forms { grid-template-columns: 1fr; }
  .milestone-line { grid-template-columns: 1fr; gap: 0.9rem; }
  .milestone { padding: 0 0 0 2rem; }
  .milestone::before { top: 0.6rem; bottom: -1.5rem; left: 0.53rem; right: auto; width: 3px; height: auto; }
  .milestone:last-child::before { display: none; }
  .item-row { flex-wrap: wrap; }
  .item-side { width: 100%; justify-content: flex-start; padding-left: 1.6rem; }
  .toolbar-note { margin-left: 0; width: 100%; }
  .matrix-tools { position: static; }
  .search input { width: 100%; }
  .search { width: 100%; }
  .decisions li { grid-template-columns: 1fr; gap: 0.2rem; }
  .from-team, .from-client { margin-left: 0; margin-right: 0; }
  /* the matrix becomes one card per feature with its four-stage track underneath */
  .matrix thead { display: none; }
  .matrix tbody tr { display: grid; grid-template-columns: repeat(4, 1fr); padding: 0.6rem 0; }
  .matrix .col-feature { grid-column: 1 / -1; width: auto; padding: 0 0 0.25rem; }
  .tag-stage { display: inline-block; background: var(--cloth-2); color: #fff; }
  .cell-inner { height: 2.4rem; }
}
