/* Cube & Curve home page. Loaded after styles.css, on index.html only.
   The deck system's tokens and fonts live in styles.css. */

:root {
  --page: min(84rem, 100%);
}

body.landing {
  font-variant-numeric: tabular-nums;
}

.landing .wrap {
  width: var(--page);
}

.landing a {
  color: inherit;
}

/* top bar */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 4.5rem;
  padding-block: 0.75rem;
}

.write {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  min-height: 2.75rem;
  padding: 0.6rem 1.1rem;
  background: var(--tie);
  color: var(--badge-fg) !important;
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.3;
  text-decoration: none;
  transition: background-color 160ms cubic-bezier(0.16, 1, 0.3, 1);
}

.write:hover {
  background: var(--tie-hover);
}

.write .addr {
  font-weight: 400;
}

@media (max-width: 40rem) {
  .write .addr {
    display: none;
  }
}

/* hero copy */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.25rem 3rem;
  padding-block: clamp(1.25rem, 3vh, 2rem) clamp(1.75rem, 4vh, 2.5rem);
}

.hero h1 {
  max-width: 20ch;
  font-weight: 500;
  font-size: clamp(2.25rem, 1.2rem + 3.2vw, 3.15rem);
  line-height: 1.02;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.subtitle {
  margin-top: 0.85rem;
  max-width: 46ch;
  color: var(--accent);
  font-size: clamp(1.2rem, 1rem + 0.7vw, 1.5rem);
  line-height: 1.3;
  text-wrap: pretty;
}

.passage {
  max-width: 34rem;
  font-size: 1.1875rem;
  line-height: 1.45;
  color: var(--muted);
  text-wrap: pretty;
}

@media (min-width: 64rem) {
  .hero {
    grid-template-columns: minmax(0, 1.55fr) minmax(16rem, 1fr);
    align-items: start;
  }

  .passage {
    padding-top: 0.45rem;
  }
}

/* the stage: a folder or an act on the left, the screen it feeds on the right, tied in orange.
   Wide layouts draw in a 1344-unit space: 1u = 100cqw / 1344. */
.stage-box {
  container: stage / inline-size;
}

.stage-box > * {
  --u: calc(100cqw / 1344);
}

.stage {
  position: relative;
  display: grid;
  gap: 1.25rem;
}

.ties {
  display: none;
}

.shot {
  position: relative;
  margin: 0;
  background: var(--deep);
  border: 1px solid var(--panel-edge);
  box-shadow: var(--shot-shadow);
}

.shot > a {
  display: block;
}

.shot > a:focus-visible {
  outline-offset: 3px;
}

.shot img {
  width: 100%;
  height: auto;
}

/* the target ring: a box drawn around the thing the tie points at */
.ring {
  position: absolute;
  left: var(--l);
  top: var(--t);
  width: var(--w);
  height: var(--hh);
  border: 2.5px solid var(--tie);
  border-radius: 0.375rem;
  pointer-events: none;
}

.ring.round {
  border-radius: 50%;
}

/* on narrow screens the badge sits above its ring so it never covers the target */
.ring span {
  position: absolute;
  bottom: calc(100% + 0.3rem);
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: var(--badge);
  color: var(--badge-fg);
  font: 600 0.8125rem/1 var(--text);
}

/* a capture shown to a set depth: the figure keeps the view's aspect and the image hangs from the top */
.shot.view {
  aspect-ratio: var(--ar);
  overflow: hidden;
}

.shot.view img {
  margin-top: calc(-1 * var(--off, 0%));
}


/* folder tree */
.tree {
  margin: 0;
  background: var(--panel);
  border: 1px solid var(--panel-edge);
}

.tree-path {
  padding: 0.7rem 1rem;
  border-bottom: 1px solid var(--line);
  font: 0.8125rem/1.3 var(--mono);
  color: var(--quiet);
  overflow-wrap: anywhere;
}

.tree ul {
  list-style: none;
  margin: 0;
  padding: 0.4rem 0;
}

.tree li {
  display: block;
}

.tree li > a,
.tree li > span {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 2.25rem;
  padding: 0 1rem 0 calc(1rem + var(--lvl, 0) * 1.4rem);
  text-decoration: none;
  font-size: 1rem;
  line-height: 1.3;
}

.tree .fold {
  flex: none;
  width: 1.25rem;
  height: auto;
  color: var(--folder);
}

.tree .fold.file {
  width: 1rem;
  color: var(--muted);
}

.tree code {
  font-family: var(--mono);
  font-size: 0.9375em;
}

.tree a {
  background: var(--tie-soft);
  font-weight: 600;
}

.tree a code {
  font-weight: 400;
}

.tree a:hover,
.tree a:focus-visible {
  background: color-mix(in srgb, var(--tie) 30%, var(--panel));
  outline-offset: -2px;
}

.tree .num {
  margin-left: auto;
  flex: none;
  display: grid;
  place-items: center;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: var(--badge);
  color: var(--badge-fg);
  font-size: 0.75rem;
}

/* ruled captions */
.caption {
  margin-top: 0.85rem;
  padding-top: 0.6rem;
  border-top: 2px solid var(--rule);
  font-size: 1rem;
  line-height: 1.45;
  color: var(--muted);
  text-wrap: pretty;
}

.caption .sample {
  display: block;
  margin-top: 0.2rem;
  color: var(--quiet);
  font-size: 0.875rem;
}

.stage-captions {
  display: grid;
  gap: 1rem;
}

.cap-tree {
  display: none;
  text-wrap: balance;
}

/* acts */
.act h3 {
  font-weight: 500;
  font-size: 1.1875rem;
  line-height: 1.2;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.act .where {
  margin-top: 0.75rem;
  padding: 0.55rem 0.7rem;
  border-top: 2px solid var(--rule);
  background: var(--panel);
  font-size: 0.9375rem;
  line-height: 1.45;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.act .where.path {
  font: 400 0.875rem/1.45 var(--mono);
  color: var(--accent);
}

.act .result {
  margin-top: 0.8rem;
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--accent);
  text-wrap: pretty;
}

/* wide: absolute placement in drawing units, ties shown */
@container stage (min-width: 60rem) {
  .stage {
    display: block;
    height: calc(var(--h) * var(--u));
  }

  .stage > .tree {
    position: absolute;
    left: 0;
    top: 0;
    width: calc(470 * var(--u));
  }

  .stage > .act {
    position: absolute;
    left: 0;
    top: 0;
    width: calc(340 * var(--u));
  }

  .hero-stage > .shot {
    position: absolute;
    left: calc(560 * var(--u));
    top: 0;
    width: calc(784 * var(--u));
  }

  .pair-stage > .shot {
    position: absolute;
    left: calc(384 * var(--u));
    top: 0;
    width: calc(960 * var(--u));
  }

  .shot.crop {
    aspect-ratio: auto;
    overflow: visible;
  }

  .shot.crop img {
    width: 100%;
    margin: 0;
  }

  .shot.crop .ring {
    left: var(--l);
    top: var(--t);
    width: var(--w);
    height: var(--hh);
  }

  .tree-path {
    height: calc(40 * var(--u));
    padding: 0 calc(16 * var(--u));
    display: flex;
    align-items: center;
    font-size: calc(13 * var(--u));
  }

  .tree ul {
    padding: calc(8 * var(--u)) 0;
  }

  .tree li > a,
  .tree li > span {
    min-height: 0;
    height: calc(28 * var(--u));
    gap: calc(9 * var(--u));
    padding: 0 calc(16 * var(--u)) 0 calc((16 + var(--lvl, 0) * 22) * var(--u));
    font-size: calc(16 * var(--u));
  }

  .tree .fold {
    width: calc(19 * var(--u));
  }

  .tree .fold.file {
    width: calc(14 * var(--u));
  }

  .tree .num,
  .ring span {
    display: none;
  }

  .act h3 {
    min-height: calc(76 * var(--u));
    font-size: calc(21 * var(--u));
  }

  .act .where {
    margin-top: calc(10 * var(--u));
    padding: calc(16 * var(--u)) calc(12 * var(--u)) calc(12 * var(--u));
    font-size: calc(14 * var(--u));
  }

  .act .where.path {
    font-size: calc(13.5 * var(--u));
  }

  .act .result {
    margin-top: calc(16 * var(--u));
    font-size: calc(16 * var(--u));
  }

  .ties {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
  }

  .ties .line {
    fill: none;
    stroke: var(--tie);
    stroke-width: 2.5;
    stroke-linejoin: round;
  }

  .ties .dot {
    fill: var(--tie);
  }

  .ties g,
  .ring {
    transition: opacity 220ms cubic-bezier(0.16, 1, 0.3, 1);
  }

  /* signature: a row lights its tie and quiets the others */
  .stage:has([data-tie="a"]:is(:hover, :focus-visible)) :is(.tie-b, .tie-c),
  .stage:has([data-tie="b"]:is(:hover, :focus-visible)) :is(.tie-a, .tie-c),
  .stage:has([data-tie="c"]:is(:hover, :focus-visible)) :is(.tie-a, .tie-b) {
    opacity: 0.18;
  }

  .stage-captions {
    grid-template-columns: calc(470 * var(--u)) 1fr;
    column-gap: calc(90 * var(--u));
  }

  .cap-tree {
    display: block;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .ties .line {
    stroke-dasharray: 1;
    animation: draw 900ms cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .hero-stage .tie-b .line {
    animation-delay: 140ms;
  }

  .hero-stage .tie-c .line {
    animation-delay: 280ms;
  }

  /* the pairs draw as they arrive; without scroll timelines they are simply drawn */
  @supports (animation-timeline: view()) {
    .pair-stage .ties .line {
      animation-duration: auto;
      animation-timing-function: linear;
      animation-timeline: view();
      animation-range: entry 20% cover 45%;
    }
  }

  @keyframes draw {
    from {
      stroke-dashoffset: 1;
    }

    to {
      stroke-dashoffset: 0;
    }
  }
}

/* sections below */
.section {
  padding-block: clamp(3.5rem, 9vh, 6rem) 0;
}

.section h2 {
  max-width: 30ch;
  font-weight: 500;
  font-size: clamp(1.5rem, 1.2rem + 0.9vw, 1.875rem);
  line-height: 1.15;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.lede {
  margin-top: 0.6rem;
  max-width: 40rem;
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--muted);
  text-wrap: pretty;
}

.acts {
  display: grid;
  gap: clamp(3rem, 8vh, 5rem);
  margin-top: clamp(2rem, 5vh, 3rem);
}

.proof {
  margin-top: clamp(3rem, 7vh, 4.5rem);
  max-width: 44rem;
  padding-top: 0.75rem;
  border-top: 2px solid var(--rule);
  font-size: clamp(1.2rem, 1rem + 0.7vw, 1.5rem);
  line-height: 1.35;
  text-wrap: pretty;
}

/* the rest, as a ruled list */
.rest-list {
  list-style: none;
  margin: clamp(1.5rem, 4vh, 2.25rem) 0 0;
  padding: 0;
  display: grid;
  border-top: 2px solid var(--rule);
}

.rest-list li {
  padding: 0.85rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 1.0625rem;
  line-height: 1.45;
  color: var(--accent);
  text-wrap: pretty;
}

.rest-list b {
  font-weight: 600;
  color: var(--fg);
}

@media (min-width: 52rem) {
  .rest-list {
    grid-template-columns: 1fr 1fr;
    column-gap: 3rem;
  }
}

/* close */
.close {
  padding-block: clamp(4rem, 10vh, 7rem);
}

.close h2 {
  font-weight: 500;
  font-size: clamp(1.5rem, 1.2rem + 0.9vw, 1.875rem);
  line-height: 1.2;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

.close .mail {
  display: inline-block;
  margin-top: 1.25rem;
  font-weight: 500;
  font-size: clamp(1.6rem, 1rem + 3vw, 3rem);
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-decoration: underline;
  text-decoration-color: var(--muted);
  text-decoration-thickness: 0.06em;
  text-underline-offset: 0.18em;
  overflow-wrap: anywhere;
}

.close .mail:hover {
  text-decoration-thickness: 0.12em;
}

@media (forced-colors: active) {
  .ring,
  .tree a {
    forced-color-adjust: none;
  }
}

@media print {
  .ties,
  .ring {
    display: none;
  }

  .shot {
    box-shadow: none;
  }
}

/* callouts under the first stage */
.callouts-band {
  padding-top: clamp(2.5rem, 6vh, 3.5rem);
}

.callouts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 1.5rem 2rem;
}

.callouts li {
  padding-top: 0.75rem;
  border-top: 2px solid var(--rule);
}

.callouts h2 {
  font-weight: 500;
  font-size: 1.375rem;
  line-height: 1.2;
  letter-spacing: -0.015em;
}

.callouts p {
  margin-top: 0.45rem;
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--accent);
  text-wrap: pretty;
}

.how h3 {
  font-weight: 500;
  font-size: 1.1875rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.how p {
  margin-top: 0.4rem;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--muted);
  text-wrap: pretty;
}

@media (min-width: 52rem) {
  .callouts {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.statement {
  margin-top: clamp(2rem, 5vh, 3rem);
  max-width: 40ch;
  font-weight: 500;
  font-size: clamp(1.625rem, 1.2rem + 1.4vw, 2.25rem);
  line-height: 1.25;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

/* as filed, tied to what it shows */
.misnamed {
  list-style: none;
  margin: clamp(1.5rem, 4vh, 2.25rem) 0 0;
  padding: 0;
  display: grid;
  gap: 0.6rem;
}

.misnamed li {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.35rem;
  padding: 0.9rem 1.1rem;
  border-radius: 6px;
  background: var(--panel);
}

.misnamed code {
  font: 0.875rem/1.45 var(--mono);
  color: var(--muted);
  overflow-wrap: anywhere;
}

.misnamed .shows {
  font-size: 1.0625rem;
  line-height: 1.45;
  text-wrap: pretty;
}

.misnamed .head {
  display: none;
  font-size: 0.875rem;
  font-weight: 600;
  padding-block: 0 0.1rem;
  background: transparent;
  color: var(--muted);
}

.misnamed .head span:empty,
.misnamed .tie-x {
  display: none;
}

@media (min-width: 52rem) {
  .misnamed .head {
    display: grid;
  }

  .misnamed li {
    grid-template-columns: minmax(0, 1fr) 4rem minmax(0, 1.15fr);
    align-items: center;
    gap: 0 1rem;
  }

  .misnamed .tie-x {
    display: block;
    position: relative;
    height: 2.5px;
    background: var(--tie);
  }

  .misnamed .tie-x::before {
    content: "";
    position: absolute;
    left: -4px;
    top: -3.5px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--tie);
  }

  .misnamed .head span:empty {
    display: block;
  }
}

/* how it fits */
.how {
  list-style: none;
  margin: clamp(1.5rem, 4vh, 2.25rem) 0 0;
  padding: 0;
  display: grid;
  gap: 1.5rem 2rem;
}

.how li {
  padding-top: 0.75rem;
  border-top: 2px solid var(--rule);
}

@media (min-width: 52rem) {
  .how {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
