/* holorepo.com. One stylesheet, no script needed for anything here: the picture's three states are radio
   buttons read with :has(). Colours follow the system's light or dark setting. */

@font-face { font-family: "EB Garamond"; src: url("/fonts/EBGaramond-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("/fonts/JetBrainsMono-400.woff2") format("woff2"); font-weight: 400; font-style: normal; font-display: swap; }

:root {
  color-scheme: light dark;
  --paper: #f6f2ea;
  --card: #fffdf8;
  --ink: #171a1f;
  --muted: #5c5e66;
  --rule: #dbd4c5;
  --wash: rgb(23 26 31 / 0.05);
  --link: #1d4fc7;
  /* what the pieces in the pictures are: code, and five kinds of document */
  --code: #4a505d;
  --specs: #2f66dd;
  --research: #17946b;
  --design: #b8439a;
  --docs: #d48a07;
  --plans: #dc4e29;
  --plus: #0f7a56;
  --minus: #b83a1c;
  --mark: rgb(255 255 255 / 0.78);
  --serif: "EB Garamond", ui-serif, Georgia, "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #111317;
    --card: #191c22;
    --ink: #ecebe6;
    --muted: #a3a5ab;
    --rule: #2b2f37;
    --wash: rgb(236 235 230 / 0.06);
    --link: #93b2ff;
    --code: #727a8c;
    --specs: #5b8cff;
    --research: #2fbf8f;
    --design: #dd6cc0;
    --docs: #eeae35;
    --plans: #ff7350;
    --plus: #2fbf8f;
    --minus: #ff7350;
    --mark: rgb(17 19 23 / 0.7);
  }
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 1.0625rem/1.65 var(--sans); overflow-wrap: break-word; }
a { color: var(--link); text-underline-offset: 0.18em; text-decoration-thickness: 0.06em; }
a:hover { text-decoration-thickness: 0.12em; }
:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; border-radius: 2px; }
code { font: 0.875em var(--mono); background: var(--wash); padding: 0.1em 0.2em; border-radius: 4px; }
strong { font-weight: 650; }
p { margin: 0 0 1.15em; }
h1, h2, h3 { margin: 0; }
figure { margin: 0; }

.wrap { max-width: 78rem; margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2.5rem); }
.skip { position: absolute; left: 1rem; top: -4rem; background: var(--ink); color: var(--paper); padding: 0.5rem 0.75rem; border-radius: 6px; }
.skip:focus { top: 1rem; }

/* the top line: links to the sections, nothing else */
.top { padding-block: 1.25rem; }
.top nav { display: flex; flex-wrap: wrap; gap: 0.375rem 1.5rem; font: 0.8125rem/1.5 var(--mono); }
.top a { color: var(--muted); text-decoration: none; }
.top a:hover { color: var(--ink); text-decoration: underline; }

/* the word and its definition, with the picture beside them */
.hero { display: grid; gap: 2.75rem; padding-block: clamp(1.5rem, 5vw, 3.75rem) clamp(3rem, 7vw, 5.5rem); }
.entry { display: flex; gap: 1rem; margin-bottom: 1.125rem; color: var(--muted); font: 0.8125rem/1 var(--mono); }
h1 { margin-bottom: 1.5rem; font: 400 clamp(3.75rem, 11vw, 6.75rem)/0.92 var(--serif); letter-spacing: -0.015em; }
.def { margin-bottom: 1.25rem; font: 400 clamp(1.45rem, 2.6vw, 1.9rem)/1.3 var(--serif); text-wrap: pretty; }
.origin { max-width: 35rem; margin-bottom: 1.5rem; color: var(--muted); }
.copy { padding: 0.5rem 0.8rem; border: 1.5px solid var(--ink); border-radius: 6px; background: transparent; color: var(--ink); font: 600 0.8125rem/1.2 var(--sans); cursor: pointer; }
.copy:hover { background: var(--ink); color: var(--paper); }
@media (min-width: 61rem) {
  .hero { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(2.5rem, 5vw, 4.5rem); align-items: start; }
  h1 { font-size: clamp(4.25rem, 7.4vw, 6.75rem); }
  .shape { margin-top: 2rem; }
}

/* ---- the picture: one product drawn three ways ----
   Two numbers say which state it is in. --one: the code is in one repository (monorepo and holorepo).
   --whole: that repository holds the documents too (holorepo). The pieces never move; only the lines do. */
.shape { --one: 1; --whole: 1; min-width: 0; max-width: 46rem; }
.shape:has(#shape-many:checked) { --one: 0; --whole: 0; }
.shape:has(#shape-mono:checked) { --one: 1; --whole: 0; }

.shape fieldset { min-width: 0; margin: 0 0 1.5rem; padding: 0; border: 0; }
@supports not selector(:has(*)) {
  .shape fieldset { display: none; }
}
.shape legend { margin-bottom: 0.5rem; padding: 0; color: var(--muted); font: 0.75rem/1.4 var(--mono); }
.switch { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1.5px solid var(--ink); border-radius: 8px; overflow: hidden; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch label { display: flex; align-items: center; justify-content: center; padding: 0.6rem 0.5rem; border-left: 1.5px solid var(--ink); font: 600 0.875rem/1.2 var(--sans); text-align: center; cursor: pointer; }
.switch label:first-of-type { border-left: 0; }
.switch label:hover { background: var(--wash); }
.switch input:checked + label { background: var(--ink); color: var(--paper); }
.switch input:focus-visible + label { outline: 2px solid var(--paper); outline-offset: -5px; }

.stage {
  --tile: 1.75rem;
  --gap: 0.375rem;
  --pad: 0.875rem;
  --unit-pad: 0.5rem;
  --name: 1rem;
  --name-gap: 0.4375rem;
  --zone-gap: 0.5rem;
  --top: 1.25rem;
  --code-cols: 4;
  --doc-cols: 5;
  --rows: 1;
  --code-unit: calc(var(--unit-pad) * 2 + var(--name) + var(--name-gap) + var(--tile));
  --doc-unit: calc(var(--unit-pad) * 2 + var(--name) + var(--name-gap) + var(--tile) * 1.22);
  --code-h: calc(var(--top) + var(--rows) * var(--code-unit) + (var(--rows) - 1) * var(--zone-gap) + var(--pad));
  position: relative;
}
/* the repository's edge: around the code, or around everything */
.line { position: absolute; top: 0; right: 0; left: 0; height: calc(var(--code-h) + var(--whole) * (100% - var(--code-h))); border: 2px solid var(--ink); border-radius: 12px; background: var(--wash); opacity: var(--one); transition: height 0.55s cubic-bezier(0.3, 0.7, 0.2, 1), opacity 0.3s; }
.line-name { position: absolute; top: 0; left: 0.75rem; transform: translateY(-55%); padding: 0.3rem 0.5rem; border-radius: 4px; background: var(--ink); color: var(--paper); font: 0.6875rem/1 var(--mono); }
.zone { position: relative; display: grid; gap: var(--zone-gap); }
.zone-code { grid-template-columns: repeat(var(--code-cols), minmax(0, 1fr)); height: var(--code-h); padding: var(--top) var(--pad) var(--pad); }
.zone-docs { grid-template-columns: repeat(var(--doc-cols), minmax(0, 1fr)); padding: calc(var(--pad) * 0.6) var(--pad) var(--pad); }
.zone-label { position: relative; grid-column: 1 / -1; height: 1rem; color: var(--muted); font: 0.6875rem/1rem var(--mono); }
.unit { position: relative; display: flex; flex-direction: column; gap: var(--name-gap); height: var(--code-unit); padding: var(--unit-pad); min-width: 0; }
.zone-docs .unit { height: var(--doc-unit); }
/* a unit's own box: a repository of its own (solid) or another tool (dashed). It fades when the unit becomes a folder. */
.unit::before { content: ""; position: absolute; inset: 0; border: 1.5px solid var(--ink); border-radius: 8px; background: var(--card); opacity: calc(1 - var(--one)); transition: opacity 0.35s; }
.zone-docs .unit::before { border-style: dashed; border-color: var(--muted); opacity: calc(1 - var(--whole)); }
.unit > * { position: relative; }
.name { display: block; height: var(--name); font: 0.6875rem/1rem var(--mono); white-space: nowrap; }
.zone-docs .name .now { font-family: var(--sans); }
.now, .then { position: absolute; inset: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: opacity 0.3s; }
.zone-code .now { opacity: calc(1 - var(--one)); }
.zone-code .then { opacity: var(--one); }
.zone-docs .now { opacity: calc(1 - var(--whole)); }
.zone-docs .then { opacity: var(--whole); }
.tiles { display: flex; align-items: flex-start; gap: var(--gap); }

/* a piece: a grey square is code, a coloured page is a document */
.t { position: relative; display: block; flex: 0 1 var(--tile); min-width: 0; aspect-ratio: 1; border-radius: 4px; background: var(--code); }
.t::before, .t::after { content: ""; position: absolute; height: 2px; border-radius: 1px; background: var(--mark); }
.t::before { top: 32%; left: 20%; width: 34%; }
.t::after { top: 56%; left: 34%; width: 44%; }
.t.doc { aspect-ratio: 1 / 1.22; border-radius: 3px; clip-path: polygon(0 0, 68% 0, 100% 26%, 100% 100%, 0 100%); }
.t.doc::before { top: 44%; left: 20%; width: 60%; }
.t.doc::after { top: 64%; left: 20%; width: 40%; }
.specs { background: var(--specs); }
.research { background: var(--research); }
.design { background: var(--design); }
.docs { background: var(--docs); }
.plans { background: var(--plans); }

.legend { display: flex; flex-wrap: wrap; gap: 0.375rem 1.125rem; margin: 1.125rem 0 0; padding: 0; list-style: none; color: var(--muted); font-size: 0.8125rem; }
.legend li { display: flex; align-items: center; gap: 0.4rem; white-space: nowrap; }
.legend .t { --tile: 0.6875rem; flex: none; width: var(--tile); border-radius: 2px; }
.legend .t::before, .legend .t::after, .mini .t::before, .mini .t::after { display: none; }

.shape figcaption { min-height: 6.25rem; margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
.cap { display: none; margin: 0; font-size: 0.9375rem; line-height: 1.55; }
.cap-holo { display: block; }
.shape:has(#shape-many:checked) .cap-holo, .shape:has(#shape-mono:checked) .cap-holo { display: none; }
.shape:has(#shape-many:checked) .cap-many, .shape:has(#shape-mono:checked) .cap-mono { display: block; }

/* the same picture, small and still, three times */
.three { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; margin-top: 2.5rem; }
.three figcaption { margin-top: 0.875rem; color: var(--muted); font-size: 0.875rem; line-height: 1.5; }
.three figcaption strong { display: block; margin-bottom: 0.125rem; color: var(--ink); font-size: 0.9375rem; }
.stage.mini { --one: 0; --whole: 0; --tile: 0.8125rem; --gap: 0.25rem; --pad: 0.625rem; --unit-pad: 0.375rem; --name: 0rem; --name-gap: 0rem; --zone-gap: 0.375rem; --top: 0.625rem; }
.stage.mini.is-mono { --one: 1; }
.stage.mini.is-holo { --one: 1; --whole: 1; }
.mini .line { border-width: 1.5px; border-radius: 8px; }
.mini .unit::before { border-width: 1px; border-radius: 5px; }
.mini .t { border-radius: 2px; }
.mini .t.doc { border-radius: 1px; }

/* ---- sections: the heading in a left column, the words beside it ---- */
.sec { display: grid; gap: 1.5rem 3rem; padding-block: clamp(3rem, 7vw, 5.5rem); border-top: 1px solid var(--rule); scroll-margin-top: 1rem; }
h2 { font: 400 clamp(2rem, 3.6vw, 2.625rem)/1.08 var(--serif); letter-spacing: -0.005em; text-wrap: balance; }
h3 { font: 650 1.0625rem/1.35 var(--sans); }
.body { min-width: 0; }
.body > * { max-width: 43rem; }
.body > .wide, .body > .list { max-width: none; }
.body > h3 { margin: 2.5rem 0 0.5rem; }
.body > :last-child { margin-bottom: 0; }
@media (min-width: 64rem) {
  .sec { grid-template-columns: 15rem minmax(0, 1fr); }
}

/* numbered lists: the five problems and the eight steps */
.list { margin: 2rem 0 0; padding: 0; list-style: none; counter-reset: n; }
.list > li { display: grid; grid-template-columns: 2.25rem minmax(0, 1fr); padding: 1.375rem 0; border-top: 1px solid var(--rule); counter-increment: n; }
.list > li::before { content: counter(n); grid-row: 1 / span 3; color: var(--muted); font: 0.8125rem/1.8rem var(--mono); }
.list > li > * { grid-column: 2; min-width: 0; }
.list > li > p, .list > li > h3 { max-width: 40.75rem; }
.list > li > h3 { margin-bottom: 0.375rem; }
.list > li > p:last-child { margin-bottom: 0; }
.list figure { margin: 1.25rem 0 0.375rem; }
.list figcaption, .find figcaption { margin-top: 0.75rem; color: var(--muted); font-size: 0.875rem; }

/* panels: a search, a folder, a pull request, drawn as plain lists */
.panel { overflow: hidden; border: 1px solid var(--rule); border-radius: 10px; background: var(--card); }
.panel-title { margin: 0; padding: 0.6rem 1rem; border-bottom: 1px solid var(--rule); color: var(--muted); font: 0.75rem/1.4 var(--mono); }
.dot { display: inline-block; flex: none; width: 0.625rem; height: 0.625rem; border-radius: 2px; }
.dot.code { background: var(--code); }
.dot.none { background: transparent; }
.rows, .searches { margin: 0; padding: 0; list-style: none; }
.rows { padding: 0.375rem 0; }
.rows li { display: grid; grid-template-columns: 0.625rem minmax(0, 1fr) auto; gap: 0.75rem; align-items: center; padding: 0.4rem 1rem; font-size: 0.875rem; }
.rows code { padding: 0; background: none; font-size: 0.8125rem; overflow-wrap: anywhere; }
.rows span { color: var(--muted); }
.rows.described li { grid-template-columns: 0.625rem 6.5rem minmax(0, 1fr); align-items: baseline; }
.tree, .pr { max-width: 36rem; }
.pr-name { margin: 0; padding: 0.875rem 1rem 0.25rem; font-weight: 650; }
.changed span { font: 0.75rem var(--mono); white-space: nowrap; }
.plus, .minus { font-weight: 400; }
.plus { color: var(--plus); }
.minus { color: var(--minus); }

.find-cols { display: grid; gap: 1rem; align-items: start; }
@media (min-width: 52rem) { .find-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.searches li { display: grid; grid-template-columns: 6.25rem minmax(0, 1fr); gap: 0.3rem 0.75rem; align-items: center; padding: 0.6rem 1rem; border-top: 1px solid var(--rule); }
.searches li:first-child { border-top: 0; }
.searches.one { border-bottom: 1px solid var(--rule); }
.where { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8125rem; font-weight: 600; }
.query { display: flex; align-items: center; gap: 0.4rem; padding: 0.2rem 0.55rem; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); color: var(--muted); font: 0.75rem/1.5 var(--mono); }
.query::before { content: ""; flex: none; width: 0.5rem; height: 0.5rem; border: 1.5px solid currentColor; border-radius: 50%; }
.found { grid-column: 2; font-size: 0.875rem; line-height: 1.4; }
.found em { color: var(--muted); font-style: normal; }
.found em::before { content: "· "; }

/* tables */
table { width: 100%; margin: 2.75rem 0 0; border-collapse: collapse; font-size: 0.9375rem; line-height: 1.5; }
caption { padding-bottom: 0.75rem; color: var(--muted); font: 0.75rem/1.4 var(--mono); text-align: left; }
th, td { padding: 0.85rem 1rem; border-top: 1px solid var(--rule); text-align: left; vertical-align: top; }
thead th, thead td { border-top: 0; font: 650 0.8125rem/1.4 var(--sans); }
tbody th { width: 24%; padding-left: 0; font-weight: 650; }
.compare td:last-child, .compare thead th:last-child, .pairs td:last-child, .pairs thead th:last-child { background: var(--wash); }
.pairs td:first-child, .pairs thead th:first-child { width: 46%; padding-left: 0; color: var(--muted); }
.pairs thead th:first-child { color: var(--ink); }

.habits { margin: 0; padding-left: 1.15rem; }
.habits li { margin-bottom: 0.6rem; }
.qa { padding: 1.375rem 0; border-top: 1px solid var(--rule); }
.qa:first-child { padding-top: 0; border-top: 0; }
.qa h3 { margin-bottom: 0.375rem; }
.qa p { margin: 0; }

/* the one place another site is named */
.try { padding-block: clamp(3rem, 7vw, 5rem); border-top: 1px solid var(--rule); }
.try-line { margin: 0 0 0.75rem; font: 400 clamp(1.75rem, 3.6vw, 2.625rem)/1.15 var(--serif); text-wrap: balance; }
.try-line a { color: inherit; text-decoration-color: var(--link); text-decoration-thickness: 0.08em; }
.try-what { max-width: 38rem; margin: 0; color: var(--muted); }
.foot { padding-block: 1.75rem 3rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: 0.8125rem; }
.foot p { margin: 0; }

/* phones: the picture is two columns of code and three of documents, and tables become lists */
@media (max-width: 40rem) {
  .stage { --tile: 1.375rem; --gap: 0.3125rem; --pad: 0.75rem; --unit-pad: 0.4375rem; --code-cols: 2; --doc-cols: 3; --rows: 2; }
  .stage.mini { --tile: 0.5rem; --gap: 0.125rem; --pad: 0.375rem; --unit-pad: 0.25rem; --zone-gap: 0.25rem; --top: 0.375rem; }
  .switch label { padding-inline: 0.25rem; font-size: 0.8125rem; }
  .shape figcaption { min-height: 9.5rem; }
  .three { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
  .three figure { display: grid; grid-template-columns: 8.5rem minmax(0, 1fr); gap: 1rem; align-items: start; }
  .three figcaption { margin-top: 0; }
  .list > li { grid-template-columns: 1.625rem minmax(0, 1fr); }
  .rows.described li { grid-template-columns: 0.625rem 5.5rem minmax(0, 1fr); }
  .searches li { grid-template-columns: 5.75rem minmax(0, 1fr); padding-inline: 0.75rem; }
  .rows li { padding-inline: 0.75rem; }
  table, caption, tbody, tr, th, td { display: block; }
  thead { display: none; }
  tbody tr { padding: 1rem 0; border-top: 1px solid var(--rule); }
  tbody th, td { width: auto; padding: 0; border: 0; }
  tbody th { margin-bottom: 0.5rem; }
  td { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: 0.75rem; padding: 0.3rem 0; }
  td::before { content: attr(data-label); color: var(--muted); font-size: 0.8125rem; }
  .compare td:last-child, .pairs td:last-child { background: none; font-weight: 600; }
  .pairs td:first-child { width: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .line, .unit::before, .now, .then { transition: none; }
}
@media print {
  .top, .shape fieldset, .copy, .skip { display: none; }
}
