/*
 * Currently — a scope-weighted Mondrian grid + per-project report pages.
 * De Stijl: saturated primaries, white, black gridlines. Block size echoes
 * each umbrella's sub-project count. Shares the site's Dupla typeface.
 */

:root {
  --cream: #f5f2eb;
  --ink: #16140f;
  --line: #16140f;              /* black gridlines */
  --mond-red: #e23b2e;
  --mond-blue: #1d54b8;
  --mond-yellow: #f6c700;
  --mond-white: #faf8f3;
  --mond-black: #16140f;
  --muted: #6b665d;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: clamp(15px, 1.4vw, 19px); }

body {
  font-family: 'Dupla', sans-serif;
  background: var(--cream);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

main { max-width: 76rem; margin: 0 auto; padding: clamp(1.5rem, 4vw, 3.5rem); }

.back {
  display: inline-block;
  font-size: 1.4rem;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: clamp(1.5rem, 4vw, 3rem);
  transition: color 0.15s;
}
.back:hover { color: var(--mond-red); }

/* ---- Masthead --------------------------------------------------------- */

.masthead { margin-bottom: clamp(1.5rem, 4vw, 2.5rem); max-width: 46rem; }
.overline {
  font-weight: 300; font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 0.28em; color: var(--muted); margin-bottom: 0.75rem;
}
.masthead h1 {
  font-weight: 100; font-size: clamp(2.75rem, 9vw, 5rem);
  line-height: 0.95; letter-spacing: -0.02em; margin-bottom: 1rem;
}
.intro {
  font-weight: 300; font-size: 1rem; line-height: 1.6;
  max-width: 36rem; color: #3a362e;
}

/* ---- Mondrian grid ---------------------------------------------------- */

.mondrian {
  display: grid;
  gap: 7px;                       /* black gridlines show through */
  background: var(--line);
  border: 7px solid var(--line);
  grid-template-columns: 1.35fr 1fr 1fr 1.15fr;
  grid-template-rows: repeat(3, minmax(150px, 22vh));
  grid-template-areas:
    "hylograph hylograph humboldt   atlantis"
    "hylograph hylograph infovore   atlantis"
    "polyglot  polyglot  infovore   shapedsteer";
}

.block {
  display: flex;
  flex-direction: column;
  padding: clamp(0.9rem, 1.6vw, 1.5rem);
  text-decoration: none;
  color: inherit;
  position: relative;
  overflow: hidden;
  transition: filter 0.15s, transform 0.15s;
}
.block:hover { filter: saturate(1.15) brightness(1.04); }
.block:focus-visible { outline: 3px solid var(--ink); outline-offset: -7px; }

.block-head { margin-bottom: auto; }
.block-kicker {
  font-weight: 400; font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.16em; opacity: 0.85; margin-bottom: 0.35rem;
}
.block-title {
  font-weight: 300; font-size: clamp(1.4rem, 2.6vw, 2.3rem);
  line-height: 1.02; letter-spacing: -0.01em;
}
.block-summary {
  font-weight: 300; font-size: 0.82rem; line-height: 1.45;
  margin: 0.9rem 0; opacity: 0.9;
  display: -webkit-box; -webkit-box-orient: vertical;
  -webkit-line-clamp: 4; line-clamp: 4; overflow: hidden;
}
.block-stat { display: flex; align-items: baseline; gap: 0.4rem; margin-top: auto; }
.stat-num { font-weight: 100; font-size: clamp(2rem, 4vw, 3.2rem); line-height: 1; }
.stat-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.14em; opacity: 0.8; }

/* The big block can show more summary */
.block[style*="hylograph"] .block-summary { -webkit-line-clamp: 8; line-clamp: 8; font-size: 0.9rem; }

/* Teaser */
.is-teaser .qmark { font-weight: 100; font-size: clamp(3rem, 7vw, 5rem); line-height: 1; opacity: 0.5; }
.is-teaser .block-title { opacity: 0.7; }

/* Mondrian palette */
.c-red    { background: var(--mond-red);    color: #fff; }
.c-blue   { background: var(--mond-blue);   color: #fff; }
.c-yellow { background: var(--mond-yellow); color: var(--ink); }
.c-black  { background: var(--mond-black);  color: var(--cream); }
.c-white  { background: var(--mond-white);  color: var(--ink); }

/* ---- Colophon --------------------------------------------------------- */

.colophon {
  margin-top: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 300; font-size: 0.78rem; letter-spacing: 0.04em; color: var(--muted);
}

/* ======================================================================= */
/* Report page                                                             */
/* ======================================================================= */

.report main { max-width: 52rem; }

.report-head {
  border-top: 7px solid var(--accent, var(--ink));
  padding-top: 1.25rem;
  margin-bottom: clamp(2rem, 5vw, 3rem);
}
.accent-red    { --accent: var(--mond-red); }
.accent-blue   { --accent: var(--mond-blue); }
.accent-yellow { --accent: var(--mond-yellow); }
.accent-black  { --accent: var(--mond-black); }
.accent-white  { --accent: var(--ink); }

.report-kicker {
  font-weight: 400; font-size: 0.78rem; text-transform: uppercase;
  letter-spacing: 0.18em; color: var(--accent, var(--muted)); margin-bottom: 0.6rem;
}
.report-head h1 {
  font-weight: 100; font-size: clamp(2.5rem, 8vw, 4.5rem);
  line-height: 0.95; letter-spacing: -0.02em;
}

.report-grid {
  display: grid;
  grid-template-columns: 1fr 14rem;
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
}
.report-summary p {
  font-weight: 300; font-size: 1.08rem; line-height: 1.65; margin-bottom: 1rem;
}
.report-summary p:last-child { margin-bottom: 0; }
.teaser-note { font-style: italic; color: var(--muted); }

.report-stats {
  border-top: 1px solid #d8d2c5;
  padding-top: 1.25rem;
}
.bignum { display: flex; align-items: baseline; gap: 0.5rem; }
.bignum .n { font-weight: 100; font-size: 3.5rem; line-height: 1; color: var(--accent, var(--ink)); }
.bignum .l { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.14em; color: var(--muted); }
.substat { font-size: 0.85rem; color: var(--muted); margin: 0.4rem 0 1.25rem; }

.statusbar {
  display: flex; height: 0.7rem; border-radius: 2px; overflow: hidden;
  border: 1px solid var(--ink); margin-bottom: 0.75rem;
}
.statusbar .seg { display: block; }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 0.5rem 0.9rem; font-size: 0.72rem; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 0.35rem; }
.legend .dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; display: inline-block; }

/* status colours (muted, semantic) */
.seg-active  { background: #2e8b57; }
.seg-done    { background: #1d54b8; }
.seg-blocked { background: #e23b2e; }
.seg-someday { background: #c9a227; }
.seg-idea    { background: #b7b2a6; }
.seg-dormant { background: #8a8478; }
.seg-defunct { background: #4a463e; }
.seg-evolved { background: #7a5bbd; }

.report-children { margin-top: clamp(2rem, 5vw, 3rem); }
.report-children h3 {
  font-weight: 400; font-size: 0.8rem; text-transform: uppercase;
  letter-spacing: 0.18em; color: var(--muted);
  border-bottom: 1px solid #d8d2c5; padding-bottom: 0.5rem; margin-bottom: 0.75rem;
}
.children { list-style: none; }
.child {
  padding: 0.85rem 0;
  border-bottom: 1px solid #e8e3d8;
}
.child:last-child { border-bottom: none; }
.child-head { display: flex; align-items: baseline; gap: 0.6rem; }
.child-name { font-weight: 400; font-size: 1.02rem; color: var(--ink); }
.child-sub {
  font-size: 0.65rem; font-weight: 400; color: var(--muted);
  border: 1px solid #cdc7ba; border-radius: 999px; padding: 0.05rem 0.4rem;
  line-height: 1.4; align-self: center;
}
.child-status {
  margin-left: auto; align-self: center; white-space: nowrap;
  font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.12em;
  color: #fff; padding: 0.12rem 0.5rem; border-radius: 2px;
}
.child-status.seg-idea,
.child-status.seg-dormant { color: var(--ink); }
.child-desc {
  font-weight: 300; font-size: 0.9rem; line-height: 1.5;
  color: #4a463e; margin-top: 0.4rem; max-width: 42rem;
}
/* dim finished / abandoned children so live work reads first */
.child:has(.seg-done) .child-name,
.child:has(.seg-defunct) .child-name,
.child:has(.seg-evolved) .child-name { color: var(--muted); }
.child:has(.seg-defunct) { opacity: 0.7; }
.muted { color: var(--muted); font-style: italic; }

/* ---- Responsive ------------------------------------------------------- */

@media (max-width: 52rem) {
  .mondrian {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: none;
    grid-auto-rows: minmax(150px, auto);
    grid-template-areas:
      "hylograph hylograph"
      "humboldt  atlantis"
      "infovore  infovore"
      "polyglot  shapedsteer";
  }
  .report-grid { grid-template-columns: 1fr; }
  .children { columns: 1; }
}

@media (max-width: 34rem) {
  .mondrian {
    grid-template-columns: 1fr;
    grid-template-areas:
      "hylograph" "humboldt" "atlantis" "infovore" "polyglot" "shapedsteer";
  }
}
