/* msos.css — MulviumSOS (pages/offerings/msos.html): the operating-system
   figure. Two chains of layers, user ↔ application ↔ operating system ↔
   hardware, a computer's above Mulvium's; on phones they stand side by side.
   Loaded after css/style.css by that page alone. (The page's other rules
   are in style.css under their original fsos- names.) */

.msos-page {
  --os-tint: rgba(196, 221, 184, 0.42);      /* M.SOS's green */
  --os-tint-strong: rgba(196, 221, 184, 0.7);
  --os-edge: rgba(104, 146, 90, 0.34);
  --os-sponsor: rgba(184, 202, 224, 0.52);   /* Fiscal Sponsorship's blue */
  --os-sponsor-edge: rgba(84, 116, 158, 0.32);
  --os-link: 32px;                           /* the space an arrow spans */
  --os-pair: 30px;                           /* between a layer and its counterpart */
  /* A two-headed arrow, in clay */
  --os-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 10'%3E%3Cpath d='M2 5h20M6 1.5 2 5l4 3.5M18 1.5 22 5l-4 3.5' fill='none' stroke='%23b87758' stroke-width='1.2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}

/* The figure is a little wider than the column */
.os-fig {
  position: relative;
  left: 50%;
  width: min(880px, calc(100vw - 40px));
  transform: translateX(-50%);
  margin: 40px 0 44px;
}

/* Wide screens: a label column, then the four layers; one chain per row.
   Each chain is a subgrid, so a layer sits exactly over its counterpart. */
.os-chains {
  display: grid;
  grid-template-columns: auto repeat(4, minmax(0, 1fr));
  column-gap: var(--os-link);
  row-gap: var(--os-pair);
  align-items: stretch;
}
.os-fig .os-label {
  margin: 0;
  align-self: center;
  text-indent: 0;
  line-height: 1.3;
  font-family: "Cormorant SC", serif;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.2em;
  color: var(--ink-soft);
}
.os-fig .os-label--m { color: var(--clay-deep); }
.os-fig .os-label--pc { grid-column: 1; grid-row: 1; }
.os-fig .os-label--m { grid-column: 1; grid-row: 2; }
.os-chain {
  display: grid;
  grid-template-columns: subgrid;
  grid-column: 2 / span 4;
  list-style: none;
  margin: 0;
  padding: 0;
}
.os-chain--pc { grid-row: 1; }
.os-chain--m { grid-row: 2; }

/* Each layer */
.os-chain li {
  position: relative;
  padding: 13px 10px 14px;
  border-radius: 12px;
  text-align: center;
}
.os-chain--pc li {
  background: rgba(255, 255, 255, 0.34);
  border: 1px solid rgba(27, 22, 19, 0.12);
}
.os-chain--m li {
  background: var(--os-tint);
  border: 1px solid var(--os-edge);
}
.os-chain--m .os-core { background: var(--os-tint-strong); }
.os-chain--m .os-sponsor { background: var(--os-sponsor); border-color: var(--os-sponsor-edge); }
/* The user stands outside the system */
.os-chain .os-user { background: transparent; border-style: dashed; }

/* ↔ between neighbouring layers */
.os-chain li + li::before {
  content: "";
  position: absolute;
  top: 50%;
  right: 100%;
  width: var(--os-link);
  height: 10px;
  margin-top: -5px;
  background: var(--os-arrow) center / 22px 10px no-repeat;
}
/* A layer joined to its counterpart */
.os-chain--pc li::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  height: calc(var(--os-pair) + 1px);
  border-left: 1px dashed rgba(143, 90, 66, 0.45);
}

.os-name {
  display: block;
  font-family: "Cormorant Garamond", serif;
  font-size: 19px;
  line-height: 1.25;
  color: var(--ink);
}
.os-gloss {
  display: block;
  margin-top: 4px;
  font-family: "Cormorant Garamond", serif;
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink-soft);
}

/* Atelier and Grove, side by side in the application layer */
.os-app {
  display: inline-block;
  margin: 0 0 2px;
  padding: 0 8px 1px;
  font-size: 17.5px;
  white-space: nowrap;
  border: 1px solid var(--os-edge);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
}

.os-fig figcaption {
  max-width: 34em;
  margin: 16px auto 0;
  text-align: center;
  font-family: "Cormorant Garamond", serif;
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--ink-soft);
}

/* ---- The layers come in from the hardware up as the figure comes into
   view (js/fsos.js adds .is-in) ---- */
.os-chain li:nth-child(4) { --i: 0; }
.os-chain li:nth-child(3) { --i: 1; }
.os-chain li:nth-child(2) { --i: 2; }
.os-chain li:nth-child(1) { --i: 3; }
.os-chain--m li { --j: 0.1s; }
.os-fig .os-label,
.os-chain li {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
  transition-delay: calc(var(--i, 0) * 0.16s + var(--j, 0s));
}
.os-chain li::before,
.os-chain li::after {
  opacity: 0;
  transition: opacity 0.6s var(--ease) calc(var(--i) * 0.16s + 0.5s);
}
.os-fig.is-in .os-label,
.os-fig.is-in .os-chain li { opacity: 1; transform: none; }
.os-fig.is-in .os-chain li::before,
.os-fig.is-in .os-chain li::after { opacity: 1; }

/* ---- Phones: the chains stand side by side, the layers top to bottom ---- */
@media (max-width: 720px) {
  .msos-page { --os-link: 26px; --os-pair: 14px; }
  .os-fig { width: calc(100vw - 32px); margin: 32px 0 36px; }
  .os-chains {
    grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
    grid-template-rows: auto repeat(4, auto);
    column-gap: var(--os-pair);
    row-gap: var(--os-link);
  }
  .os-fig .os-label {
    align-self: end;
    margin-bottom: calc(10px - var(--os-link));
    text-align: center;
    font-size: 12.5px;
  }
  .os-fig .os-label--pc { grid-column: 1; grid-row: 1; }
  .os-fig .os-label--m { grid-column: 2; grid-row: 1; }
  .os-chain {
    grid-template-columns: none;
    grid-template-rows: subgrid;
  }
  .os-chain--pc { grid-column: 1; grid-row: 2 / span 4; }
  .os-chain--m { grid-column: 2; grid-row: 2 / span 4; }
  .os-chain li {
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 10px 10px 11px;
  }
  /* ↕ between layers */
  .os-chain li + li::before {
    top: auto;
    bottom: 100%;
    right: auto;
    left: 50%;
    width: var(--os-link);
    height: 10px;
    margin: 0 0 calc((var(--os-link) - 10px) / 2) calc(var(--os-link) / -2);
    transform: rotate(90deg);
  }
  /* A layer joined to its counterpart, across */
  .os-chain--pc li::after {
    top: 50%;
    left: 100%;
    width: calc(var(--os-pair) + 1px);
    height: 0;
    border-left: none;
    border-top: 1px dashed rgba(143, 90, 66, 0.45);
  }
  .os-name { font-size: 17px; }
  .os-gloss { font-size: 14px; line-height: 1.4; }
  .os-app { padding: 0 8px 1px; }
}

@media (prefers-reduced-motion: reduce) {
  .os-fig .os-label,
  .os-chain li { opacity: 1; transform: none; transition: none; }
  .os-chain li::before,
  .os-chain li::after { opacity: 1; transition: none; }
}
