/* ============ open — 06 In the open: the year as signal ============
   One dot is one public contribution. A giant numeral counts what has landed; the record below
   it is a unit chart in ink on paper, the accent kept for the live thing (the write head, the
   day being read, the cursor's light). Repositories follow as three cards whose covers are dot
   fields — the same dots, resolved into each repo's initial. The section stays transparent so
   the paper field moves underneath; only the cards and the floating day card are solid. */

/* the act rises over the opening's last stretch of paper, so the head sits right at its top:
   no lead-in of blank paper before "Built in public." */
.open {
  position: relative;
  padding-block: clamp(1.5rem, 4vh, 3rem) clamp(5rem, 3rem + 6vw, 9rem);
}
/* the opening's stage is already flat paper for about half a screen before this act's edge
   arrives; the head is pulled up over that flat tail (paper on paper, no seam) so the heading is
   there the moment the screen turns to paper. flow-root keeps the pull from collapsing into the
   act's own overlap margin; the act shortens by the same amount, so nothing is left blank below. */
.opening.is-live + .act--open { display: flow-root; }
.opening.is-live + .act--open > .open { margin-top: -50lvh; }
@media (max-width: 760px) {
  .opening.is-live + .act--open > .open { margin-top: -38lvh; }
}

/* ---------- head ---------- */

.open__head {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--col-gap);
  row-gap: clamp(1.25rem, 2.5vw, 2rem);
  align-items: end;
}
.open__head .kicker { grid-column: 1 / -1; justify-self: start; margin-bottom: clamp(0.5rem, 3vh, 2rem); }
.open__title { grid-column: 1 / span 7; }
.open__intro {
  grid-column: 9 / -1;
  max-width: 36ch;
  padding-bottom: 0.6rem;
  font-size: var(--fs-body);
  line-height: 1.55;
  color: var(--ink-2);
}

/* ---------- the plate ---------- */

.open__plate { margin-top: clamp(3.5rem, 2rem + 4.5vw, 6.5rem); }

.open__bar {
  --rule: 1;
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 2rem;
  padding: 0.9rem 0;
}
.open__bar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: var(--ink);
  transform: scaleX(var(--rule));
  transform-origin: 0 50%;
}
.open__label { color: var(--ink); font-weight: 450; }
.open__label span { color: var(--ink-3); }

.open__status {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--ink-2);
  white-space: nowrap;
}
.open__dot {
  position: relative;
  flex: none;
  width: 7px;
  height: 7px;
  border: 1px solid var(--ink);
  border-radius: 50%;
}
.open.is-live .open__dot { background: var(--signal); border-color: var(--signal); }
/* live: a ring breathes out of the dot (transform + opacity only) */
.open.is-live .open__dot::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  background: var(--signal);
  animation: open-pulse 2.4s var(--ease-out) infinite;
}
@keyframes open-pulse {
  0% { transform: scale(1); opacity: 0.5; }
  70%, 100% { transform: scale(3.4); opacity: 0; }
}

/* the numeral and three plain stats */
.open__figs {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--col-gap);
  align-items: end;
  padding-top: clamp(1.75rem, 1rem + 2.5vw, 3.25rem);
}
.open__hero {
  grid-column: 1 / span 6;
  display: flex;
  align-items: flex-end;
  gap: clamp(1rem, 0.5rem + 1.6vw, 2.25rem);
  min-width: 0;
}
.open__num {
  flex: none;
  min-width: 1.32em;
  margin-left: -0.055em;
  font-family: var(--font-sans);
  font-size: clamp(6.5rem, 2.5rem + 11vw, 14.5rem);
  font-weight: 600;
  font-stretch: 100%;
  line-height: 0.74;
  letter-spacing: -0.07em;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.open__cap {
  display: grid;
  gap: 0.55rem;
  max-width: 17ch;
  padding-bottom: 0.15rem;
  font-size: var(--fs-body);
  line-height: 1.3;
  color: var(--ink);
}
.open__range { color: var(--ink-3); max-width: none; white-space: nowrap; }

.open__stats {
  grid-column: 7 / -1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.open__stats > div {
  min-width: 0;
  padding: 0.1rem 0 0.2rem clamp(1rem, 0.4rem + 1.2vw, 1.75rem);
  border-left: 1px solid var(--hairline-strong);
}
.open__stats dt { margin-bottom: clamp(1.25rem, 0.5rem + 2.4vw, 3rem); }
.open__stats dd { display: grid; gap: 0.6rem; }
.open__stats dd b {
  font-family: var(--font-sans);
  font-size: clamp(2rem, 1.2rem + 2.1vw, 3.5rem);
  font-weight: 600;
  font-stretch: var(--wd-head);
  line-height: 0.9;
  letter-spacing: -0.045em;
  white-space: nowrap;
  color: var(--ink);
}
.open__stats dd span { color: var(--ink-3); text-transform: none; letter-spacing: 0.04em; }

/* ---------- the record ---------- */

.open__stage {
  position: relative;
  margin-top: clamp(1rem, 0.25rem + 2vw, 2.25rem);
  touch-action: pan-y;
  outline-offset: 8px;
}
.open__stage:focus-visible { outline: 1.5px solid var(--signal-text); border-radius: 4px; }
.open__canvas { display: block; width: 100%; max-width: none; }

/* the end of the record: a caret that keeps blinking, because the year is still being written */
.open__caret {
  position: absolute;
  top: 0;
  left: 0;
  width: 1.5px;
  background: var(--signal);
  opacity: 0;
  pointer-events: none;
  transition: opacity 400ms var(--ease-ui);
}
.open__stage.is-landed .open__caret { opacity: 1; animation: open-blink 1.15s steps(1, end) infinite; }
@keyframes open-blink { 50% { opacity: 0; } }

/* the day being read: a small ink card, the one solid dark thing on the paper */
.open__tip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2;
  display: grid;
  gap: 0.2rem;
  min-width: 10.5rem;
  padding: 0.7rem 0.9rem 0.75rem;
  border-radius: 10px;
  background: var(--ink);
  color: var(--bg);
  box-shadow: 0 20px 40px -20px rgba(11, 11, 12, 0.55);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--d-micro) var(--ease-ui);
}
.open__tip.is-on { opacity: 1; }
.open__tip b { font-size: 0.95rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.25; }
.open__tip-n { font-size: 0.85rem; line-height: 1.3; color: rgba(236, 232, 225, 0.72); }
.open__tip-k { margin-bottom: 0.15rem; font-size: 0.625rem; color: #ff6a3d; }
.open__tip-k[hidden] { display: none; }

/* the whole year on one honest scale */
.open__year { position: relative; margin-top: clamp(1rem, 0.5rem + 1.4vw, 1.75rem); }
.open__ysvg { display: block; width: 100%; max-width: none; height: 22px; overflow: visible; }
.open__ywin { fill: color-mix(in srgb, var(--signal) 6%, transparent); }
.open__ywin-edge { stroke: var(--signal); stroke-width: 1.5; vector-effect: non-scaling-stroke; }
.open__ybase { stroke: var(--ink-4); stroke-width: 1; vector-effect: non-scaling-stroke; }
.open__yticks rect { fill: var(--ink); }
.open__ylabels { position: relative; height: 1.25rem; margin-top: 0.55rem; color: var(--ink-3); }
.open__ylabels > span { position: absolute; top: 0; white-space: nowrap; }
.open__yquiet { transform: translateX(-50%); }
.open__yzoom { padding-left: 0.6rem; color: var(--signal-text); }
.open__yzoom:not([style]) { left: 0; padding-left: 0; }

.open__foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  margin-top: clamp(1.25rem, 0.75rem + 1.5vw, 2rem);
  padding-top: 0.9rem;
  border-top: 1px solid var(--hairline-strong);
}
.open__legend { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.75rem; color: var(--ink-2); }
.open__key { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); }
.open__how { color: var(--ink-3); }
.open__how::before { content: "·"; margin-right: 0.75rem; color: var(--ink-4); }

.open__replay {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  height: 2.75rem;
  padding: 0 1.2rem 0 1rem;
  border: 1px solid var(--hairline-strong);
  border-radius: 999px;
  font: 500 var(--fs-label) / 1 var(--font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--ink);
  transition: background-color var(--d-ui) var(--ease-ui), color var(--d-ui) var(--ease-ui), border-color var(--d-ui) var(--ease-ui);
}
.open__replay[hidden] { display: none; }
/* ▸ drawn, not typed; it becomes ■ while the year is replaying */
.open__replay-ico {
  flex: none;
  width: 8px;
  height: 9px;
  background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.open__replay.is-playing { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.open__replay.is-playing .open__replay-ico { width: 8px; height: 8px; clip-path: none; background: var(--signal); }

/* ---------- repositories ---------- */

.open__repos { margin-top: clamp(5rem, 2.5rem + 7vw, 10rem); }
.open__repos.is-empty .open__rhead,
.open__repos.is-empty .open__cards { display: none; }

.open__rhead {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 2rem;
  padding-bottom: clamp(1.5rem, 1rem + 1.5vw, 2.5rem);
}
.open__rtitle {
  font-family: var(--font-sans);
  font-size: var(--fs-h3);
  font-weight: 600;
  font-stretch: var(--wd-head);
  line-height: 1;
  letter-spacing: -0.04em;
}
.open__rnote { color: var(--ink-3); }

.open__cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--col-gap);
}
.open__cell { display: flex; min-width: 0; }

.ocard {
  --mx: 50%;
  --my: 30%;
  --rx: 0deg;
  --ry: 0deg;
  --lift: 0px;
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--hairline-strong);
  border-radius: 14px;
  background: rgba(243, 240, 234, 0.82);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55), 0 1px 2px rgba(11, 11, 12, 0.04);
  transform: perspective(1400px) translateY(var(--lift)) rotateX(var(--rx)) rotateY(var(--ry));
  transition:
    transform 700ms var(--ease-out),
    box-shadow 700ms var(--ease-out),
    border-color var(--d-ui) var(--ease-ui),
    background-color 400ms var(--ease-ui);
}
/* the warm light that follows the cursor across the card */
.ocard::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(540px circle at var(--mx) var(--my), color-mix(in srgb, var(--signal) 14%, transparent), color-mix(in srgb, var(--signal) 4%, transparent) 38%, transparent 62%);
  opacity: 0;
  transition: opacity 500ms var(--ease-ui);
}
/* lifted: on a real hover (never a touch's sticky one) and on keyboard focus */
.ocard:focus-visible {
  --lift: -8px;
  border-color: rgba(11, 11, 12, 0.7);
  background: #f5f2ec;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    0 60px 90px -56px rgba(11, 11, 12, 0.5),
    0 30px 46px -34px color-mix(in srgb, var(--signal) 38%, transparent);
}
@media (hover: hover) and (pointer: fine) {
  .ocard:hover {
    --lift: -8px;
    border-color: rgba(11, 11, 12, 0.7);
    background: #f5f2ec;
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.7),
      0 60px 90px -56px rgba(11, 11, 12, 0.5),
      0 30px 46px -34px color-mix(in srgb, var(--signal) 38%, transparent);
  }
  .ocard:hover::before { opacity: 1; }
  .ocard:hover .ocard__go { background: var(--ink); border-color: var(--ink); color: var(--bg); }
  .ocard:hover .ocard__go .open__arrow { transform: translate(1.5px, -1.5px); }
  .ocard:hover .ocard__rail i { background: var(--signal); box-shadow: 0 0 0 4px color-mix(in srgb, var(--signal) 18%, transparent); }
  .open__replay:hover { background: var(--ink); border-color: var(--ink); color: var(--bg); }
}
.ocard:focus-visible::before { opacity: 1; }
.ocard:focus-visible { outline: 2px solid var(--signal-text); outline-offset: 4px; }
/* touch: a press sinks the card a little instead */
.ocard:active { --lift: 2px; }

.ocard__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.05rem 1.3rem 0.95rem;
  color: var(--ink-3);
}
.ocard__lang { display: inline-flex; align-items: center; gap: 0.55rem; color: var(--ink-2); }
.ocard__lang i { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--ink); }

.ocard__cover {
  position: relative;
  display: block;
  height: clamp(168px, 4rem + 9vw, 250px);
  margin-inline: 0.6rem;
  overflow: hidden;
  border-radius: 9px;
  background: var(--bg-deep);
  box-shadow: inset 0 0 0 1px rgba(11, 11, 12, 0.06);
}
.ocard__art { display: block; width: 100%; height: 100%; max-width: none; }

.ocard__body { display: grid; align-content: start; gap: 0.6rem; padding: 1.45rem 1.3rem 0; }
.ocard__name {
  font-size: clamp(1.45rem, 0.95rem + 1vw, 2.1rem);
  font-weight: 600;
  font-stretch: var(--wd-head);
  line-height: 1.04;
  letter-spacing: -0.035em;
  color: var(--ink);
  overflow-wrap: anywhere;
  text-wrap: balance;
}
.ocard__desc { font-size: var(--fs-small); line-height: 1.45; color: var(--ink-2); }

.ocard__foot {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  margin-top: auto;
  padding: 1.75rem 1.3rem 1.3rem;
}
.ocard__push { color: var(--ink-3); }
.ocard__push time { color: var(--ink); }
.ocard__go {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  border: 1px solid var(--hairline-strong);
  border-radius: 50%;
  color: var(--ink);
  transition: background-color var(--d-ui) var(--ease-ui), color var(--d-ui) var(--ease-ui), border-color var(--d-ui) var(--ease-ui);
}
.ocard__go .open__arrow { width: 0.95rem; height: 0.95rem; transition: transform 500ms var(--ease-out); }
.ocard:focus-visible .ocard__go { background: var(--ink); border-color: var(--ink); color: var(--bg); }

/* the last push on the same year as the strip above: the zoomed months tinted, a mark on the day */
.ocard__rail {
  grid-column: 1 / -1;
  position: relative;
  height: 9px;
  background: linear-gradient(var(--hairline-strong), var(--hairline-strong)) 0 50% / 100% 1px no-repeat;
}
.ocard__rwin { position: absolute; top: 2px; bottom: 2px; right: 0; background: var(--signal-soft); }
.ocard__rail i {
  position: absolute;
  top: 50%;
  width: 7px;
  height: 7px;
  margin: -3.5px 0 0 -3.5px;
  border-radius: 50%;
  background: var(--ink);
  transition: background-color var(--d-ui) var(--ease-ui), box-shadow var(--d-ui) var(--ease-ui);
}
.ocard__rail i.is-before { background: var(--bg); border: 1px solid var(--ink-3); }
.ocard:focus-visible .ocard__rail i { background: var(--signal); box-shadow: 0 0 0 4px color-mix(in srgb, var(--signal) 18%, transparent); }

/* ---------- the way out ---------- */

.open__all {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem 2rem;
  margin-top: clamp(2rem, 1rem + 2.5vw, 3.5rem);
}
.open__handle { color: var(--ink-3); }
.open__btn {
  display: inline-flex;
  align-items: center;
  gap: 1.2rem;
  min-height: 44px;
  padding: 0.6rem 0.6rem 0.6rem 1.75rem;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-size: clamp(1rem, 0.92rem + 0.35vw, 1.2rem);
  font-weight: 500;
  letter-spacing: -0.01em;
}
.open__btn-label { display: inline-block; }
.open__btn-arrow {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.85rem;
  height: 2.85rem;
  border-radius: 50%;
  background: var(--bg);
  color: var(--ink);
  overflow: hidden;
}
.open__arrow { width: 0.9em; height: 0.9em; flex: none; }
.open__btn-arrow .open__arrow { width: 1rem; height: 1rem; }
.open__btn:hover .open__btn-arrow .open__arrow { animation: open-arrow 560ms var(--ease-in-out) forwards; }
@keyframes open-arrow {
  0% { transform: none; }
  45% { transform: translate(160%, -160%); }
  46% { transform: translate(-160%, 160%); }
  100% { transform: none; }
}

/* ---------- tablet ---------- */

@media (max-width: 1100px) {
  .open__title { grid-column: 1 / -1; }
  .open__intro { grid-column: 1 / span 8; }
}

@media (max-width: 900px) {
  .open__hero { grid-column: 1 / -1; }
  .open__stats { grid-column: 1 / -1; margin-top: clamp(2rem, 5vw, 2.75rem); }
  .open__stats > div:first-child { padding-left: 0; border-left: 0; }
  .open__stats dt { margin-bottom: 1rem; }

  .open__cards { grid-template-columns: minmax(0, 1fr); }
  .ocard {
    display: grid;
    grid-template-columns: minmax(0, 0.95fr) minmax(0, 1fr);
    grid-template-rows: auto 1fr auto;
  }
  .ocard__top { grid-column: 2; grid-row: 1; }
  .ocard__cover { grid-column: 1; grid-row: 1 / -1; height: auto; min-height: 220px; margin: 0.6rem 0 0.6rem 0.6rem; }
  .ocard__body { grid-column: 2; grid-row: 2; padding-top: 0.75rem; }
  .ocard__foot { grid-column: 2; grid-row: 3; }
}

/* ---------- phone ---------- */

@media (max-width: 600px) {
  .open__title,
  .open__intro { grid-column: 1 / -1; }

  .open__bar { padding: 0.75rem 0; }
  .open__hero { gap: 1rem; }
  .open__num { font-size: clamp(6rem, 1rem + 26vw, 8.5rem); }
  .open__cap { font-size: 0.95rem; }
  .open__range { white-space: normal; }
  .open__stats > div { padding-left: 0.85rem; }
  .open__stats dd b { font-size: clamp(1.6rem, 1rem + 3vw, 2.1rem); }
  .open__stats dd span { font-size: 0.6875rem; letter-spacing: 0.02em; }
  .open__stats dt { font-size: 0.625rem; letter-spacing: 0.1em; }

  .open__ylabels { height: auto; display: grid; gap: 0.3rem; }
  .open__ylabels > span { position: static; transform: none; padding: 0; white-space: normal; }

  .open__foot { flex-direction: column; align-items: stretch; }
  .open__replay { justify-content: center; }

  .ocard { display: flex; }
  .ocard__cover { height: 168px; min-height: 0; margin: 0 0.5rem; }
  .ocard__body { padding-top: 1.2rem; }
  .ocard__foot { padding-top: 1.4rem; }

  .open__all { flex-direction: column; align-items: stretch; }
  .open__btn { justify-content: space-between; }
  .open__handle { text-align: center; }
}

/* ---------- reduced motion: nothing tilts, lifts or blinks; colour feedback stays ---------- */

html.is-reduced .ocard,
html.is-reduced .ocard:hover,
html.is-reduced .ocard:active,
html.is-reduced .ocard:focus-visible { transform: none; transition: border-color var(--d-ui) var(--ease-ui), background-color var(--d-ui) var(--ease-ui), box-shadow var(--d-ui) var(--ease-ui); }
html.is-reduced .open__stage.is-landed .open__caret { animation: none; }
html.is-reduced .open.is-live .open__dot::after { animation: none; opacity: 0; }
html.is-reduced .open__btn:hover .open__btn-arrow .open__arrow { animation: none; }
html.is-reduced .ocard__go .open__arrow { transition: none; }
