/* haiOS Tragopogon toggle. Closed = gold bud, open = white seed head.
   State: put the SVG inside an element with aria-expanded="true|false" (usually the <button>).
   Optional: --tg-k on any ancestor scales all durations (1 = spec timing). */
.tg { display: block; width: 100%; height: 100%; overflow: visible; }
.tg * { fill: none; }

/* Closed (default). Transitions here are the closing ones (about 560 ms). */
.tg-br {
  transform-origin: 0 0;
  transform: translate(var(--x), 66px) rotate(var(--c)) scale(1);
  stroke: #C48A24; opacity: var(--oc);
  transition: transform calc((380ms + var(--d) * .5) * var(--tg-k, 1)) cubic-bezier(.3,.6,.25,1),
              stroke calc(260ms * var(--tg-k, 1)) ease calc(120ms * var(--tg-k, 1)), opacity calc(300ms * var(--tg-k, 1)) ease calc(120ms * var(--tg-k, 1));
}
.tg-br .mr { stroke: #DBA344; transition: stroke calc(260ms * var(--tg-k, 1)) ease calc(120ms * var(--tg-k, 1)); }
.tg-pp {
  transform-origin: 0 0;
  transform: translate(60px, 66px) rotate(calc(var(--a) * .08)) scale(.22, .12);
  opacity: 0; stroke: #C48A24;
  transition: transform calc((360ms + var(--d) * .3) * var(--tg-k, 1)) cubic-bezier(.55,0,.8,.3), opacity calc(200ms * var(--tg-k, 1)) ease calc(200ms * var(--tg-k, 1)), stroke calc(220ms * var(--tg-k, 1)) ease;
}
.tg-rc { stroke: #DBA344; opacity: 0; transition: opacity calc(160ms * var(--tg-k, 1)) ease, stroke calc(200ms * var(--tg-k, 1)) ease; }
.tg-st { stroke: #C48A24; opacity: .85; transition: stroke calc(300ms * var(--tg-k, 1)) ease calc(150ms * var(--tg-k, 1)), opacity calc(300ms * var(--tg-k, 1)) ease calc(150ms * var(--tg-k, 1)); }

/* Open. Transitions here are the opening ones (about 860 ms). */
[aria-expanded="true"] .tg-br {
  transform: translate(var(--x), 66px) rotate(var(--o)) scale(.55);
  stroke: #EFE6D2; opacity: var(--oo);
  transition: transform calc((560ms + var(--d)) * var(--tg-k, 1)) cubic-bezier(.45,.05,.2,1),
              stroke calc(420ms * var(--tg-k, 1)) ease calc(220ms * var(--tg-k, 1)), opacity calc(500ms * var(--tg-k, 1)) ease calc(160ms * var(--tg-k, 1));
}
[aria-expanded="true"] .tg-br .mr { stroke: #FFFFFF; transition: stroke calc(420ms * var(--tg-k, 1)) ease calc(220ms * var(--tg-k, 1)); }
[aria-expanded="true"] .tg-pp {
  transform: translate(60px, 66px) rotate(var(--a)) scale(var(--sx), var(--sy));
  opacity: var(--op); stroke: var(--st, #FFFFFF);
  transition: transform calc(620ms * var(--tg-k, 1)) cubic-bezier(.16,.9,.3,1) calc((130ms + var(--d)) * var(--tg-k, 1)),
              opacity calc(260ms * var(--tg-k, 1)) ease calc((130ms + var(--d)) * var(--tg-k, 1)),
              stroke calc(380ms * var(--tg-k, 1)) ease calc((360ms + var(--d)) * var(--tg-k, 1));
}
/* gold lingers at the centre, then turns white */
[aria-expanded="true"] .tg-rc { stroke: #FFFFFF; opacity: 1; transition: opacity calc(240ms * var(--tg-k, 1)) ease calc(260ms * var(--tg-k, 1)), stroke calc(300ms * var(--tg-k, 1)) ease calc(560ms * var(--tg-k, 1)); }
[aria-expanded="true"] .tg-st { stroke: #EFE6D2; opacity: .6; }

/* Light band (white background): seed head in Profondo instead of white */
.tg-light [aria-expanded="true"] .tg-pp { stroke: #1B1510; }
.tg-light [aria-expanded="true"] .tg-br,
.tg-light [aria-expanded="true"] .tg-st { stroke: #1B1510; }
.tg-light [aria-expanded="true"] .tg-br .mr,
.tg-light [aria-expanded="true"] .tg-rc { stroke: #1B1510; }

/* Toggle button */
.tg-btn { appearance: none; -webkit-appearance: none; display: inline-block; flex: none; width: 32px; height: 32px; padding: 0; margin: 0; border: 0; border-radius: 6px; background: none; font-size: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.tg-btn--lg { width: 120px; height: 120px; border-radius: 12px; }
.tg-btn:focus { outline: none; }
.tg-btn:focus-visible { outline: 1.5px solid #DBA344; outline-offset: 4px; }
.tg-sr { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Reduced motion: no movement, cross-fade only. .tg-rm forces it for testing. */
@media (prefers-reduced-motion: reduce) {
 .tg-br,  [aria-expanded="true"] .tg-br { transform: translate(var(--x), 66px) rotate(var(--c)) scale(1); }
 [aria-expanded="true"] .tg-br { opacity: 0; }
 .tg-pp,  [aria-expanded="true"] .tg-pp { transform: translate(60px, 66px) rotate(var(--a)) scale(var(--sx), var(--sy)); }
 .tg *,  [aria-expanded="true"] .tg * { transition: opacity 300ms ease, stroke 300ms ease !important; }
}
.tg-rm .tg-br, .tg-rm [aria-expanded="true"] .tg-br { transform: translate(var(--x), 66px) rotate(var(--c)) scale(1); }
.tg-rm [aria-expanded="true"] .tg-br { opacity: 0; }
.tg-rm .tg-pp, .tg-rm [aria-expanded="true"] .tg-pp { transform: translate(60px, 66px) rotate(var(--a)) scale(var(--sx), var(--sy)); }
.tg-rm .tg *, .tg-rm [aria-expanded="true"] .tg * { transition: opacity 300ms ease, stroke 300ms ease !important; }
