/* clinchr blog — figure styles. Loaded only by posts that carry figures,
   after blog.css. Every colour reads a teaser.css token. */

/* SVG elements don't get the UA's [hidden] rule, so the symbol sprites
   would otherwise render as an empty 300x150 box. */
.post-figure svg[hidden], .rails svg[hidden] { display: none; }

/* --- hero: rain over a high street ------------------------------------ */

.post-hero { margin: 0 -1.5rem 2.2rem; }
.hero-street { display: block; width: 100%; height: auto; }
.hero-street .ground { stroke: color-mix(in srgb, var(--ink) 55%, transparent); stroke-width: 2; }
.hero-street .bldg { fill: color-mix(in srgb, var(--cluster) 14%, var(--ground)); stroke: color-mix(in srgb, var(--cluster) 55%, var(--ink-soft)); stroke-width: 1.5; }
.hero-street .bldg--warm { fill: color-mix(in srgb, var(--accent) 16%, var(--ground)); stroke: color-mix(in srgb, var(--accent) 60%, var(--ink-soft)); }
.hero-street .win { fill: color-mix(in srgb, var(--cluster) 36%, var(--ground)); stroke: color-mix(in srgb, var(--cluster) 55%, var(--ink-soft)); stroke-width: 1.2; }
.hero-street .door { fill: color-mix(in srgb, var(--ink-soft) 45%, var(--ground)); stroke: var(--ink-soft); stroke-width: 1.2; }
.hero-street .awn-a { fill: var(--accent); }
.hero-street .awn-b { fill: var(--ground); }
.hero-street .awning { fill: url(#awn); stroke: color-mix(in srgb, var(--accent) 70%, var(--ink-soft)); stroke-width: 1.2; }
.hero-street .cloud {
  fill: color-mix(in srgb, var(--accent) 72%, var(--ground));
  stroke: color-mix(in srgb, var(--accent) 85%, var(--ink-soft)); stroke-width: 1.5;
  animation: hero-drift 9s ease-in-out infinite alternate;
}
.hero-street .c2 { animation-duration: 12s; animation-delay: -5s; }
.hero-street .c3 { animation-duration: 10s; animation-delay: -2s; }
.hero-street .c4 { animation-duration: 13s; animation-delay: -8s; }
.hero-street .rain line { stroke: var(--cluster); stroke-width: 2; stroke-linecap: round; opacity: 0.75; }
/* rows alternate their x offset, so the seamless period is two rows (60px) */
.hero-street .rain { animation: hero-rain 1.5s linear infinite; }
.hero-street .r2 { animation-delay: -0.5s; }
.hero-street .r3 { animation-delay: -1s; }
.hero-street .r4 { animation-delay: -0.25s; }
.hero-street .walker { animation: hero-walk 38s linear infinite; }
.hero-street .walker path, .hero-street .walker circle { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hero-street .walker .brolly { fill: var(--accent); stroke: color-mix(in srgb, var(--accent) 80%, var(--ink)); }
.hero-street .puddle {
  fill: none; stroke: var(--cluster); stroke-width: 1.5;
  transform-box: fill-box; transform-origin: center;
  animation: hero-ripple 3.2s ease-out infinite;
}
.hero-street .p2 { animation-delay: -1.1s; }
.hero-street .p3 { animation-delay: -2.2s; }
.hero-street .p4 { animation-delay: -0.6s; }

@keyframes hero-drift { from { transform: translateX(-18px); } to { transform: translateX(18px); } }
@keyframes hero-rain { from { transform: translateY(-60px); } to { transform: translateY(0); } }
@keyframes hero-walk { from { transform: translateX(-90px); } to { transform: translateX(1090px); } }
@keyframes hero-ripple { 0% { transform: scale(0.3); opacity: 0.9; } 100% { transform: scale(1.4); opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .hero-street * { animation: none !important; }
}

/* --- big number callout ------------------------------------------------ */

.article--post p.big-figure { margin: 2.4rem 0; }
.big-figure b {
  display: block;
  font-weight: 300;
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 1.1;
  letter-spacing: 0.01em;
  color: var(--accent);
}
.big-figure span {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  color: var(--ink-soft);
}

/* --- spreadsheet ------------------------------------------------------- */

.sheet-scroll { overflow-x: auto; }
.sheet-table {
  border-collapse: collapse;
  margin: 0 auto;
  font-size: 0.78rem;
  text-align: left;
  color: var(--ink);
}
.sheet-table th, .sheet-table td {
  border: 1px solid color-mix(in srgb, var(--ink-soft) 32%, transparent);
  padding: 0.35rem 0.6rem;
  white-space: nowrap;
}
.sheet-table th {
  font-weight: 500;
  font-size: 0.68rem;
  color: var(--ink-soft);
  background: color-mix(in srgb, var(--ink-soft) 12%, transparent);
  text-align: center;
}
.sheet-table .sheet-head td {
  font-weight: 500;
  background: color-mix(in srgb, var(--ink-soft) 7%, transparent);
}
.sheet-table td.n { font-family: ui-monospace, 'SF Mono', Menlo, monospace; text-align: right; min-width: 2.4rem; }
.sheet-table tr.is-focus td { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.sheet-table tr.is-focus td.n { color: var(--accent); font-weight: 600; }

/* --- hexagon triangle -------------------------------------------------- */

/* bracketed triangle on the left, the hovered story to its right */
.hex-wrap {
  display: grid; grid-template-columns: auto 18rem; gap: 2.2rem;
  align-items: center; justify-content: center;
  text-align: left;
}
/* square brackets either side of the whole triangle, so the text beneath
   is read as explaining all of it */
.hex-bracket { position: relative; padding: 0.7rem 1.6rem; }
.hex-bracket::before, .hex-bracket::after {
  content: ''; position: absolute; top: 0; bottom: 0; width: 18px;
  border: 3px solid var(--accent);
}
.hex-bracket::before { left: 0; border-right: 0; }
.hex-bracket::after { right: 0; border-left: 0; }
.hex-grid { display: flex; flex-direction: column; align-items: center; }
.hex-row { display: flex; gap: 6px; margin-top: -18px; }
.hex-row:first-child { margin-top: 0; }
.hex {
  --hex: 92px;
  position: relative;
  width: var(--hex); height: calc(var(--hex) * 1.13);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  border: 0; padding: 0;
  background: color-mix(in srgb, var(--cluster) 16%, transparent);
  color: var(--cluster);
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}
.hex-face {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0.3rem;
}
.hex:hover, .hex:focus-visible, .hex.is-active {
  background: color-mix(in srgb, var(--accent) 24%, transparent);
  color: var(--accent);
  outline: none;
}
/* icon arrangements: 1 centred, 2 side by side, 3 as a triangle (one over
   two), 4 as a diamond (one, two, one) */
.hex-icons { display: grid; place-items: center; gap: 2px 6px; }
.hex-icons svg { stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.hex-icons[data-n="1"] svg { width: 38px; height: 38px; }
.hex-icons[data-n="2"] { grid-template-columns: auto auto; }
.hex-icons[data-n="2"] svg { width: 27px; height: 27px; }
.hex-icons[data-n="3"], .hex-icons[data-n="4"] { grid-template-columns: auto auto; gap: 0 4px; }
.hex-icons[data-n="3"] svg, .hex-icons[data-n="4"] svg { width: 23px; height: 23px; }
.hex-icons[data-n="3"] svg:first-child, .hex-icons[data-n="4"] svg:first-child, .hex-icons[data-n="4"] svg:last-child { grid-column: 1 / -1; }

.article--post p.figure-title {
  font-size: 1.05rem; font-weight: 500; line-height: 1.5;
  color: var(--ink);
  max-width: 36rem;
  margin: 0 auto 1rem;
}

.article--post p.hex-story {
  margin: 0;
  font-size: 0.95rem; line-height: 1.65;
  color: var(--ink);
}

@media (max-width: 720px) {
  .hex-wrap { grid-template-columns: 1fr; gap: 1.2rem; text-align: center; }
  .article--post p.hex-story { min-height: 3.2em; }
  .hex-bracket { padding: 0.5rem 1rem; }
  .hex-bracket::before, .hex-bracket::after { width: 12px; border-width: 2px; }
  .hex { --hex: 66px; }
  .hex-row { gap: 4px; margin-top: -13px; }
  .hex-icons[data-n="1"] svg { width: 28px; height: 28px; }
  .hex-icons[data-n="2"] svg { width: 20px; height: 20px; }
  .hex-icons[data-n="3"] svg, .hex-icons[data-n="4"] svg { width: 17px; height: 17px; }
}

/* --- clothes rails ----------------------------------------------------- */

.rails-wrap { display: grid; grid-template-columns: 1fr 1fr; gap: 2.4rem; text-align: left; }
.rail-title {
  font-size: 0.85rem; font-weight: 500; letter-spacing: 0.12em;
  color: var(--ink); margin: 0;
}
.rail-title span { display: block; font-weight: 400; font-size: 0.7rem; letter-spacing: 0.08em; color: var(--ink-soft); margin-top: 0.15rem; }
/* --inset keeps the end hangers clear of the track edges so a pushed-out
   garment never overflows the page; --spread is the push distance;
   --gw is the garment width. main.js sets --shift to -1 / 0 / 1. */
.rail-track {
  --inset: 40px; --spread: 28px; --gw: 96px;
  position: relative; height: 232px; margin-top: 0.8rem; touch-action: pan-y;
}
.rail-track::before {
  content: ''; position: absolute; left: 0; right: 0; top: 14px; height: 3px; border-radius: 2px;
  background: color-mix(in srgb, var(--ink) 55%, transparent);
}
.garment {
  position: absolute; top: 0;
  left: calc(var(--inset) + (var(--i) + 0.5) / var(--n) * (100% - 2 * var(--inset)));
  width: var(--gw);
  display: flex; flex-direction: column; align-items: center;
  transform: translateX(calc(-50% + var(--shift, 0) * var(--spread)));
  transition: transform 0.35s ease;
}
.garment-art {
  width: var(--gw); height: calc(var(--gw) * 1.3);
  /* --garment is set per hanger in the markup: blue by default, accent for
     the second of a pair. Flat solid fill with a bold dark outline. */
  stroke: var(--garment, var(--cluster));
  stroke-width: 3; stroke-linejoin: round; stroke-linecap: round;
  fill: color-mix(in srgb, var(--garment, var(--cluster)) 22%, var(--ground));
}
.garment-name {
  font-size: 0.66rem; letter-spacing: 0.06em; color: var(--ink); white-space: nowrap;
  opacity: 0; transition: opacity 0.3s ease;
}
.demand {
  display: flex; flex-direction: column; align-items: center;
  margin-top: 0.1rem;
  font-size: 0.6rem; letter-spacing: 0.1em; text-transform: lowercase; color: var(--ink-soft);
  white-space: nowrap;
  opacity: 0; transition: opacity 0.3s ease;
}
.demand b { font-size: 1.6rem; font-weight: 600; line-height: 1.1; color: var(--ink); }
.garment.is-focus .garment-name, .garment.is-focus .demand { opacity: 1; }
.garment:focus { outline: none; }
.garment:focus-visible .garment-art { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 8px; }

.rails--static .garment { transform: translateX(-50%) scale(0.72); transition: none; }
.rails--static .garment-name, .rails--static .demand { opacity: 1; font-size: 0.52rem; }
.rails--static .demand b { font-size: 1.1rem; }

@media (max-width: 720px) {
  .rails-wrap { grid-template-columns: 1fr; gap: 1.8rem; }
  .rail-track { --inset: 44px; --spread: 20px; --gw: 80px; height: 236px; }
}
@media (prefers-reduced-motion: reduce) {
  .garment, .garment-name, .demand { transition: none; }
}
